PageSourceSearch

https://setup-ia-local-rx580-vulkan.web.app/assets/index-Mm7MysVB.js

js setup-ia-local-rx580-vulkan.web.app collected 2026-10-03 12:35:20 UTC 2,784,823 bytes, 22,619 lines download raw bytes

vendor: 4,175 bytes, lines 1-17
1var b6=Object.defineProperty;var y6=(r,e,t)=>e in r?b6(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var R=(r,e,t)=>y6(r,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))o(a);new MutationObserver(a=>{for(const d of a)if(d.type==="childList")for(const c of d.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&o(c)}).observe(document,{childList:!0,subtree:!0});function t(a){const d={};return a.integrity&&(d.integrity=a.integrity),a.referrerPolicy&&(d.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?d.credentials="include":a.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function o(a){if(a.ep)return;a.ep=!0;const d=t(a);fetch(a.href,d)}})();function x6(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var hf={exports:{}},Md={};/**
2 * @license React
3 * react-jsx-runtime.production.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var Vb;function A6(){if(Vb)return Md;Vb=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(o,a,d){var c=null;if(d!==void 0&&(c=""+d),a.key!==void 0&&(c=""+a.key),"key"in a){d={};for(var g in a)g!=="key"&&(d[g]=a[g])}else d=a;return a=d.ref,{$$typeof:r,type:o,key:c,ref:a!==void 0?a:null,props:d}}return Md.Fragment=e,Md.jsx=t,Md.jsxs=t,Md}var Ub;function _6(){return Ub||(Ub=1,hf.exports=A6()),hf.exports}var f=_6(),vf={exports:{}},Be={};/**
10 * @license React
11 * react.production.js
12 *
13 * Copyright (c) Meta Platforms, Inc. and affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var Bb;function w6(){if(Bb)return Be;Bb=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),c=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),E=Symbol.for("react.activity"),M=Symbol.iterator;function G(P){return P===null||typeof P!="object"?null:(P=M&&P[M]||P["@@iterator"],typeof P=="function"?P:null)}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ee=Object.assign,ie={};function ve(P,Z,me){this.props=P,this.context=Z,this.refs=ie,this.updater=me||B}ve.prototype.isReactComponent={},ve.prototype.setState=function(P,Z){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,Z,"setState")},ve.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function Se(){}Se.prototype=ve.prototype;function Me(P,Z,me){this.props=P,this.context=Z,this.refs=ie,this.updater=me||B}var tt=Me.prototype=new Se;tt.constructor=Me,ee(tt,ve.prototype),tt.isPureReactComponent=!0;var Ye=Array.isArray;function qe(){}var w={H:null,A:null,T:null,S:null},C=Object.prototype.hasOwnProperty;function T(P,Z,me){var be=me.ref;return{$$typeof:r,type:P,key:Z,ref:be!==void 0?be:null,props:me}}function z(P,Z){return T(P.type,Z,P.props)}function O(P){return typeof P=="object"&&P!==null&&P.$$typeof===r}function N(P){var Z={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(me){return Z[me]})}var D=/\/+/g;function _e(P,Z){return typeof P=="object"&&P!==null&&P.key!=null?N(""+P.key):Z.toString(36)}function he(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(qe,qe):(P.status="pending",P.then(function(Z){P.status==="pending"&&(P.status="fulfilled",P.value=Z)},function(Z){P.status==="pending"&&(P.status="rejected",P.reason=Z)}
vendor: 18,046 bytes, lines 17-41
17)),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function K(P,Z,me,be,Pe){var Ue=typeof P;(Ue==="undefined"||Ue==="boolean")&&(P=null);var $e=!1;if(P===null)$e=!0;else switch(Ue){case"bigint":case"string":case"number":$e=!0;break;case"object":switch(P.$$typeof){case r:case e:$e=!0;break;case _:return $e=P._init,K($e(P._payload),Z,me,be,Pe)}}if($e)return Pe=Pe(P),$e=be===""?"."+_e(P,0):be,Ye(Pe)?(me="",$e!=null&&(me=$e.replace(D,"$&/")+"/"),K(Pe,Z,me,"",function(Ho){return Ho})):Pe!=null&&(O(Pe)&&(Pe=z(Pe,me+(Pe.key==null||P&&P.key===Pe.key?"":(""+Pe.key).replace(D,"$&/")+"/")+$e)),Z.push(Pe)),1;$e=0;var Pt=be===""?".":be+":";if(Ye(P))for(var wt=0;wt<P.length;wt++)be=P[wt],Ue=Pt+_e(be,wt),$e+=K(be,Z,me,Ue,Pe);else if(wt=G(P),typeof wt=="function")for(P=wt.call(P),wt=0;!(be=P.next()).done;)be=be.value,Ue=Pt+_e(be,wt++),$e+=K(be,Z,me,Ue,Pe);else if(Ue==="object"){if(typeof P.then=="function")return K(he(P),Z,me,be,Pe);throw Z=String(P),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return $e}function ce(P,Z,me){if(P==null)return P;var be=[],Pe=0;return K(P,be,"","",function(Ue){return Z.call(me,Ue,Pe++)}),be}function ae(P){if(P._status===-1){var Z=P._result;Z=Z(),Z.then(function(me){(P._status===0||P._status===-1)&&(P._status=1,P._result=me)},function(me){(P._status===0||P._status===-1)&&(P._status=2,P._result=me)}),P._status===-1&&(P._status=0,P._result=Z)}if(P._status===1)return P._result.default;throw P._result}var ke=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},Ve={map:ce,forEach:function(P,Z,me){ce(P,function(){Z.apply(this,arguments)},me)},count:function(P){var Z=0;return ce(P,function(){Z++}),Z},toArray:function(P){return ce(P,function(Z){return Z})||[]},only:function(P){if(!O(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Be.Activity=E,Be.Children=Ve,Be.Component=ve,Be.Fragment=t,Be.Profiler=a,Be.PureComponent=Me,Be.StrictMode=o,Be.Suspense=h,Be.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,Be.__COMPILER_RUNTIME={__proto__:null,c:function(P){return w.H.useMemoCache(P)}},Be.cache=function(P){return function(){return P.apply(null,arguments)}},Be.cacheSignal=function(){return null},Be.cloneElement=function(P,Z,me){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var be=ee({},P.props),Pe=P.key;if(Z!=null)for(Ue in Z.key!==void 0&&(Pe=""+Z.key),Z)!C.call(Z,Ue)||Ue==="key"||Ue==="__self"||Ue==="__source"||Ue==="ref"&&Z.ref===void 0||(be[Ue]=Z[Ue]);var Ue=arguments.length-2;if(Ue===1)be.children=me;else if(1<Ue){for(var $e=Array(Ue),Pt=0;Pt<Ue;Pt++)$e[Pt]=arguments[Pt+2];be.children=$e}return T(P.type,Pe,be)},Be.createContext=function(P){return P={$$typeof:c,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:d,_context:P},P},Be.createElement=function(P,Z,me){var be,Pe={},Ue=null;if(Z!=null)for(be in Z.key!==void 0&&(Ue=""+Z.key),Z)C.call(Z,be)&&be!=="key"&&be!=="__self"&&be!=="__source"&&(Pe[be]=Z[be]);var $e=arguments.length-2;if($e===1)Pe.children=me;else if(1<$e){for(var Pt=Array($e),wt=0;wt<$e;wt++)Pt[wt]=arguments[wt+2];Pe.children=Pt}if(P&&P.defaultProps)for(be in $e=P.defaultProps,$e)Pe[be]===void 0&&(Pe[be]=$e[be]);return T(P,Ue,Pe)},Be.createRef=function(){return{current:null}},Be.forwardRef=function(P){return{$$typeof:g,render:P}},Be.isValidElement=O,Be.lazy=function(P){return{$$typeof:_,_payload:{_status:-1,_result:P},_init:ae}},Be.memo=function(P,Z){return{$$typeof:v,type:P,compare:Z===void 0?null:Z}},Be.startTransition=function(P){var Z=w.T,me={};w.T=me;try{var be=P(),Pe=w.S;Pe!==null&&Pe(me,be),typeof be=="object"&&be!==null&&typeof be.then=="function"&&be.then(qe,ke)}catch(Ue){ke(Ue)}finally{Z!==null&&me.types!==null&&(Z.types=me.types),w.T=Z}},Be.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},Be.use=function(P){return w.H.use(P)},Be.useActionState=function(P,Z,me){return w.H.useActionState(P,Z,me)},Be.useCallback=function(P,Z){return w.H.useCallback(P,Z)},Be.useContext=function(P){return w.H.useContext(P)},Be.useDebugValue=function(){},Be.useDeferredValue=function(P,Z){return w.H.useDeferredValue(P,Z)},Be.useEffect=function(P,Z){return w.H.useEffect(P,Z)},Be.useEffectEvent=function(P){return w.H.useEffectEvent(P)},Be.useId=function(){return w.H.useId()},Be.useImperativeHandle=function(P,Z,me){return w.H.useImperativeHandle(P,Z,me)},Be.useInsertionEffect=function(P,Z){return w.H.useInsertionEffect(P,Z)},Be.useLayoutEffect=function(P,Z){return w.H.useLayoutEffect(P,Z)},Be.useMemo=function(P,Z){return w.H.useMemo(P,Z)},Be.useOptimistic=function(P,Z){return w.H.useOptimistic(P,Z)},Be.useReducer=function(P,Z,me){return w.H.useReducer(P,Z,me)},Be.useRef=function(P){return w.H.useRef(P)},Be.useState=function(P){return w.H.useState(P)},Be.useSyncExternalStore=function(P,Z,me){return w.H.useSyncExternalStore(P,Z,me)},Be.useTransition=function(){return w.H.useTransition()},Be.version="19.2.7",Be}var Gb;function uh(){return Gb||(Gb=1,vf.exports=w6()),vf.exports}var Re=uh();const E6=x6(Re);var bf={exports:{}},Td={},yf={exports:{}},xf={};/**
18 * @license React
19 * scheduler.production.js
20 *
21 * Copyright (c) Meta Platforms, Inc. and affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */var qb;function S6(){return qb||(qb=1,(function(r){function e(K,ce){var ae=K.length;K.push(ce);e:for(;0<ae;){var ke=ae-1>>>1,Ve=K[ke];if(0<a(Ve,ce))K[ke]=ce,K[ae]=Ve,ae=ke;else break e}}function t(K){return K.length===0?null:K[0]}function o(K){if(K.length===0)return null;var ce=K[0],ae=K.pop();if(ae!==ce){K[0]=ae;e:for(var ke=0,Ve=K.length,P=Ve>>>1;ke<P;){var Z=2*(ke+1)-1,me=K[Z],be=Z+1,Pe=K[be];if(0>a(me,ae))be<Ve&&0>a(Pe,me)?(K[ke]=Pe,K[be]=ae,ke=be):(K[ke]=me,K[Z]=ae,ke=Z);else if(be<Ve&&0>a(Pe,ae))K[ke]=Pe,K[be]=ae,ke=be;else break e}}return ce}function a(K,ce){var ae=K.sortIndex-ce.sortIndex;return ae!==0?ae:K.id-ce.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;r.unstable_now=function(){return d.now()}}else{var c=Date,g=c.now();r.unstable_now=function(){return c.now()-g}}var h=[],v=[],_=1,E=null,M=3,G=!1,B=!1,ee=!1,ie=!1,ve=typeof setTimeout=="function"?setTimeout:null,Se=typeof clearTimeout=="function"?clearTimeout:null,Me=typeof setImmediate<"u"?setImmediate:null;function tt(K){for(var ce=t(v);ce!==null;){if(ce.callback===null)o(v);else if(ce.startTime<=K)o(v),ce.sortIndex=ce.expirationTime,e(h,ce);else break;ce=t(v)}}function Ye(K){if(ee=!1,tt(K),!B)if(t(h)!==null)B=!0,qe||(qe=!0,N());else{var ce=t(v);ce!==null&&he(Ye,ce.startTime-K)}}var qe=!1,w=-1,C=5,T=-1;function z(){return ie?!0:!(r.unstable_now()-T<C)}function O(){if(ie=!1,qe){var K=r.unstable_now();T=K;var ce=!0;try{e:{B=!1,ee&&(ee=!1,Se(w),w=-1),G=!0;var ae=M;try{t:{for(tt(K),E=t(h);E!==null&&!(E.expirationTime>K&&z());){var ke=E.callback;if(typeof ke=="function"){E.callback=null,M=E.priorityLevel;var Ve=ke(E.expirationTime<=K);if(K=r.unstable_now(),typeof Ve=="function"){E.callback=Ve,tt(K),ce=!0;break t}E===t(h)&&o(h),tt(K)}else o(h);E=t(h)}if(E!==null)ce=!0;else{var P=t(v);P!==null&&he(Ye,P.startTime-K),ce=!1}}break e}finally{E=null,M=ae,G=!1}ce=void 0}}finally{ce?N():qe=!1}}}var N;if(typeof Me=="function")N=function(){Me(O)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,_e=D.port2;D.port1.onmessage=O,N=function(){_e.postMessage(null)}}else N=function(){ve(O,0)};function he(K,ce){w=ve(function(){K(r.unstable_now())},ce)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(K){K.callback=null},r.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<K?Math.floor(1e3/K):5},r.unstable_getCurrentPriorityLevel=function(){return M},r.unstable_next=function(K){switch(M){case 1:case 2:case 3:var ce=3;break;default:ce=M}var ae=M;M=ce;try{return K()}finally{M=ae}},r.unstable_requestPaint=function(){ie=!0},r.unstable_runWithPriority=function(K,ce){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var ae=M;M=K;try{return ce()}finally{M=ae}},r.unstable_scheduleCallback=function(K,ce,ae){var ke=r.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?ke+ae:ke):ae=ke,K){case 1:var Ve=-1;break;case 2:Ve=250;break;case 5:Ve=1073741823;break;case 4:Ve=1e4;break;default:Ve=5e3}return Ve=ae+Ve,K={id:_++,callback:ce,priorityLevel:K,startTime:ae,expirationTime:Ve,sortIndex:-1},ae>ke?(K.sortIndex=ae,e(v,K),t(h)===null&&K===t(v)&&(ee?(Se(w),w=-1):ee=!0,he(Ye,ae-ke))):(K.sortIndex=Ve,e(h,K),B||G||(B=!0,qe||(qe=!0,N()))),K},r.unstable_shouldYield=z,r.unstable_wrapCallback=function(K){var ce=M;return function(){var ae=M;M=ce;try{return K.apply(this,arguments)}finally{M=ae}}}})(xf)),xf}var Fb;function k6(){return Fb||(Fb=1,yf.exports=S6()),yf.exports}var Af={exports:{}},En={};/**
26 * @license React
27 * react-dom.production.js
28 *
29 * Copyright (c) Meta Platforms, Inc. and affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var jb;function C6(){if(jb)return En;jb=1;var r=uh();function e(h){var v="https://react.dev/errors/"+h;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var _=2;_<arguments.length;_++)v+="&args[]="+encodeURIComponent(arguments[_])}return"Minified React error #"+h+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var o={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},a=Symbol.for("react.portal");function d(h,v,_){var E=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:E==null?null:""+E,children:h,containerInfo:v,implementation:_}}var c=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(h,v){if(h==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return En.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,En.createPortal=function(h,v){var _=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(e(299));return d(h,v,null,_)},En.flushSync=function(h){var v=c.T,_=o.p;try{if(c.T=null,o.p=2,h)return h()}finally{c.T=v,o.p=_,o.d.f()}},En.preconnect=function(h,v){typeof h=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,o.d.C(h,v))},En.prefetchDNS=function(h){typeof h=="string"&&o.d.D(h)},En.preinit=function(h,v){if(typeof h=="string"&&v&&typeof v.as=="string"){var _=v.as,E=g(_,v.crossOrigin),M=typeof v.integrity=="string"?v.integrity:void 0,G=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;_==="style"?o.d.S(h,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:E,integrity:M,fetchPriority:G}):_==="script"&&o.d.X(h,{crossOrigin:E,integrity:M,fetchPriority:G,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},En.preinitModule=function(h,v){if(typeof h=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var _=g(v.as,v.crossOrigin);o.d.M(h,{crossOrigin:_,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0})}}else v==null&&o.d.M(h)},En.preload=function(h,v){if(typeof h=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var _=v.as,E=g(_,v.crossOrigin);o.d.L(h,_,{crossOrigin:E,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},En.preloadModule=function(h,v){if(typeof h=="string")if(v){var _=g(v.as,v.crossOrigin);o.d.m(h,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:_,integrity:typeof v.integrity=="string"?v.integrity:void 0})}else o.d.m(h)},En.requestFormReset=function(h){o.d.r(h)},En.unstable_batchedUpdates=function(h,v){return h(v)},En.useFormState=function(h,v,_){return c.H.useFormState(h,v,_)},En.useFormStatus=function(){return c.H.useHostTransitionStatus()},En.version="19.2.7",En}var Xb;function R6(){if(Xb)return Af.exports;Xb=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),Af.exports=C6(),Af.exports}/**
34 * @license React
35 * react-dom-client.production.js
36 *
37 * Copyright (c) Meta Platforms, Inc. and affiliates.
38 *
39 * This source code is licensed under the MIT license found in the
40 * LICENSE file in the root directory of this source tree.
41 */var Hb;function D6(){if(Hb)return Td;Hb=1;var r=k6(),e=uh(),t=R6();function o(n){var s="https://react.dev/errors/"+n;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)s+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+n+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function d(n){var s=n,i=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(i=s.return),n=s.return;while(n)}return s.tag===3?i:null}function c(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function g(n){if(n.tag===31){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function h(n){if(d(n)!==n)throw Error(o(188))}function v(n){var s=n.alternate;if(!s){if(s=d(n),s===null)throw Error(o(188));return s!==n?null:n}for(var i=n,l=s;;){var u=i.return;if(u===null)break;var p=u.alternate;if(p===null){if(l=u.return,l!==null){i=l;continue}break}if(u.child===p.child){for(p=u.child;p;){if(p===i)return h(u),n;if(p===l)return h(u),s;p=p.sibling}throw Error(o(188))}if(i.return!==l.return)i=u,l=p;else{for(var y=!1,S=u.child;S;){if(S===i){y=!0,i=u,l=p;break}if(S===l){y=!0,l=u,i=p;break}S=S.sibling}if(!y){for(S=p.child;S;){if(S===i){y=!0,i=p,l=u;break}if(S===l){y=!0,l=p,i=u;break}S=S.sibling}if(!y)throw Error(o(189))}}if(i.alternate!==l)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?n:s}function _(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n;for(n=n.child;n!==null;){if(s=_(n),s!==null)return s;n=n.sibling}return null}var E=Object.assign,M=Symbol.for("react.element"),G=Symbol.for("react.transitional.element"),B=Symbol.for("react.portal"),ee=Symbol.for("react.fragment"),ie=Symbol.for("react.strict_mode"),ve=Symbol.for("react.profiler"),Se=Symbol.for("react.consumer"),Me=Symbol.for("react.context"),tt=Symbol.for("react.forward_ref"),Ye=Symbol.for("react.suspense"),qe=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),T=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),O=Symbol.iterator;function N(n){return n===null||typeof n!="object"?null:(n=O&&n[O]||n["@@iterator"],typeof n=="function"?n:null)}var D=Symbol.for("react.client.reference");function _e(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===D?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case ee:return"Fragment";case ve:return"Profiler";case ie:return"StrictMode";case Ye:return"Suspense";case qe:return"SuspenseList";case T:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case B:return"Portal";case Me:return n.displayName||"Context";case Se:return(n._context.displayName||"Context")+".Consumer";case tt:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case w:return s=n.displayName||null,s!==null?s:_e(n.type)||"Memo";case C:s=n._payload,n=n._init;try{return _e(n(s))}catch{}}return null}var he=Array.isArray,K=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},ke=[],Ve=-1;function P(n){return{current:n}}function Z(n){0>Ve||(n.current=ke[Ve],ke[Ve]=null,Ve--)}function me(n,s){Ve++,ke[Ve]=n.current,n.current=s}var be=P(null),Pe=P(null),Ue=P(null),$e=P(null);function Pt(n,s){switch(me(Ue,s),me(Pe,n),me(be,null),s.nodeType){case 9:case 11:n=(n=s.documentElement)&&(n=n.namespaceURI)?ib(n):0;break;default:if(n=s.tagName,s=s.namespaceURI)s=ib(s),n=lb(s,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Z(be),me(be,n)}function wt(){Z(be),Z(Pe),Z(Ue)}function Ho(n){n.memoizedState!==null&&me($e,n);var s=be.current,i=lb(s,n.type);s!==i&&(me(Pe,n),me(be,i))}function Cs(n){Pe.current===n&&(Z(be),Z(Pe)),$e.current===n&&(Z($e),kd._currentValue=ae)}var Rs,Ds;
vendor: 6,526 bytes, lines 41-48
41function $n(n){if(Rs===void 0)try{throw Error()}catch(i){var s=i.stack.trim().match(/\n( *(at )?)/);Rs=s&&s[1]||"",Ds=-1<i.stack.indexOf(`
42    at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
43`+Rs+n+Ds}var ir=!1;function Wo(n,s){if(!n||ir)return"";ir=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(Q){var X=Q}Reflect.construct(n,[],re)}else{try{re.call()}catch(Q){X=Q}n.call(re.prototype)}}else{try{throw Error()}catch(Q){X=Q}(re=n())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(Q){if(Q&&X&&typeof Q.stack=="string")return[Q.stack,X.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=l.DetermineComponentFrameRoot(),y=p[0],S=p[1];if(y&&S){var I=y.split(`
44`),j=S.split(`
45`);for(u=l=0;l<I.length&&!I[l].includes("DetermineComponentFrameRoot");)l++;for(;u<j.length&&!j[u].includes("DetermineComponentFrameRoot");)u++;if(l===I.length||u===j.length)for(l=I.length-1,u=j.length-1;1<=l&&0<=u&&I[l]!==j[u];)u--;for(;1<=l&&0<=u;l--,u--)if(I[l]!==j[u]){if(l!==1||u!==1)do if(l--,u--,0>u||I[l]!==j[u]){var J=`
46`+I[l].replace(" at new "," at ");return n.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",n.displayName)),J}while(1<=l&&0<=u);break}}}finally{ir=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?$n(i):""}function lr(n,s){switch(n.tag){case 26:case 27:case 5:return $n(n.type);case 16:return $n("Lazy");case 13:return n.child!==s&&s!==null?$n("Suspense Fallback"):$n("Suspense");case 19:return $n("SuspenseList");case 0:case 15:return Wo(n.type,!1);case 11:return Wo(n.type.render,!1);case 1:return Wo(n.type,!0);case 31:return $n("Activity");default:return""}}function dr(n){try{var s="",i=null;do s+=lr(n,i),i=n,n=n.return;while(n);return s}catch(l){return`
47Error generating stack: `+l.message+`
48`+l.stack}}var Tt=Object.prototype.hasOwnProperty,zt=r.unstable_scheduleCallback,Do=r.unstable_cancelCallback,ci=r.unstable_shouldYield,ne=r.unstable_requestPaint,le=r.unstable_now,Fe=r.unstable_getCurrentPriorityLevel,vt=r.unstable_ImmediatePriority,Jn=r.unstable_UserBlockingPriority,gn=r.unstable_NormalPriority,Ko=r.unstable_LowPriority,va=r.unstable_IdlePriority,ba=r.log,Ml=r.unstable_setDisableYieldValue,Mo=null,fn=null;function po(n){if(typeof ba=="function"&&Ml(n),fn&&typeof fn.setStrictMode=="function")try{fn.setStrictMode(Mo,n)}catch{}}var Ut=Math.clz32?Math.clz32:Ic,Tc=Math.log,mi=Math.LN2;function Ic(n){return n>>>=0,n===0?32:31-(Tc(n)/mi|0)|0}var Qo=256,ya=262144,Xt=4194304;function Yo(n){var s=n&42;if(s!==0)return s;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function $o(n,s,i){var l=n.pendingLanes;if(l===0)return 0;var u=0,p=n.suspendedLanes,y=n.pingedLanes;n=n.warmLanes;var S=l&134217727;return S!==0?(l=S&~p,l!==0?u=Yo(l):(y&=S,y!==0?u=Yo(y):i||(i=S&~n,i!==0&&(u=Yo(i))))):(S=l&~p,S!==0?u=Yo(S):y!==0?u=Yo(y):i||(i=l&~n,i!==0&&(u=Yo(i)))),u===0?0:s!==0&&s!==u&&(s&p)===0&&(p=u&-u,i=s&-s,p>=i||p===32&&(i&4194048)!==0)?s:u}function To(n,s){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&s)===0}function yp(n,s){switch(n){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Oc(){var n=Xt;return Xt<<=1,(Xt&62914560)===0&&(Xt=4194304),n}function Jo(n){for(var s=[],i=0;31>i;i++)s.push(n);return s}function xa(n,s){n.pendingLanes|=s,s!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function xp(n,s,i,l,u,p){var y=n.pendingLanes;n.pendingLanes=i,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=i,n.entangledLanes&=i,n.errorRecoveryDisabledLanes&=i,n.shellSuspendCounter=0;var S=n.entanglements,I=n.expirationTimes,j=n.hiddenUpdates;for(i=y&~i;0<i;){var J=31-Ut(i),re=1<<J;S[J]=0,I[J]=-1;var X=j[J];if(X!==null)for(j[J]=null,J=0;J<X.length;J++){var Q=X[J];Q!==null&&(Q.lane&=-536870913)}i&=~re}l!==0&&Aa(n,l,0),p!==0&&u===0&&n.tag!==0&&(n.suspendedLanes|=p&~(y&~s))}function Aa(n,s,i){n.pendingLanes|=s,n.suspendedLanes&=~s;var l=31-Ut(s);n.entangledLanes|=s,n.entanglements[l]=n.entanglements[l]|1073741824|i&261930}function Tl(n,s){var i=n.entangledLanes|=s;for(n=n.entanglements;i;){var l=31-Ut(i),u=1<<l;u&s|n[l]&s&&(n[l]|=s),i&=~u}}function Il(n,s){var i=s&-s;return i=(i&42)!==0?1:_a(i),(i&(n.suspendedLanes|s))!==0?0:i}function _a(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Ms(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Pc(){var n=ce.p;return n!==0?n:(n=window.event,n===void 0?32:Tb(n.type))}function Io(n,s){var i=ce.p;try{return ce.p=n,s()}finally{ce.p=i}}var Oo=Math.random().toString(36).slice(2),Ht="__reactFiber$"+Oo,dn="__reactProps$"+Oo,Zo="__reactContainer$"+Oo,ui="__reactEvents$"+Oo,Ap="__reactListeners$"+Oo,zc="__reactHandles$"+Oo,Lc="__reactResources$"+Oo,es="__reactMarker$"+Oo;function pi(n){delete n[Ht],delete n[dn],delete n[ui],delete n[Ap],delete n[zc]}function ts(n){var s=n[Ht];if(s)return s;for(var i=n.parentNode;i;
vendor: 7,484 bytes, line 48
48){if(s=i[Zo]||i[Ht]){if(i=s.alternate,s.child!==null||i!==null&&i.child!==null)for(n=fb(n);n!==null;){if(i=n[Ht])return i;n=fb(n)}return s}n=i,i=n.parentNode}return null}function go(n){if(n=n[Ht]||n[Zo]){var s=n.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return n}return null}function Zn(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n.stateNode;throw Error(o(33))}function ns(n){var s=n[Lc];return s||(s=n[Lc]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Wt(n){n[es]=!0}var Ol=new Set,Pl={};function os(n,s){ss(n,s),ss(n+"Capture",s)}function ss(n,s){for(Pl[n]=s,n=0;n<s.length;n++)Ol.add(s[n])}var zl=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Ll={},Nl={};function Nc(n){return Tt.call(Nl,n)?!0:Tt.call(Ll,n)?!1:zl.test(n)?Nl[n]=!0:(Ll[n]=!0,!1)}function gi(n,s,i){if(Nc(s))if(i===null)n.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":n.removeAttribute(s);return;case"boolean":var l=s.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){n.removeAttribute(s);return}}n.setAttribute(s,""+i)}}function eo(n,s,i){if(i===null)n.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(s);return}n.setAttribute(s,""+i)}}function Kt(n,s,i,l){if(l===null)n.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttributeNS(s,i,""+l)}}function cn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function cr(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Vl(n,s,i){var l=Object.getOwnPropertyDescriptor(n.constructor.prototype,s);if(!n.hasOwnProperty(s)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var u=l.get,p=l.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return u.call(this)},set:function(y){i=""+y,p.call(this,y)}}),Object.defineProperty(n,s,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(y){i=""+y},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function gt(n){if(!n._valueTracker){var s=cr(n)?"checked":"value";n._valueTracker=Vl(n,s,""+n[s])}}function wa(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var i=s.getValue(),l="";return n&&(l=cr(n)?n.checked?"true":"false":n.value),n=l,n!==i?(s.setValue(n),!0):!1}function rs(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Ea=/[\n"\\]/g;function Nn(n){return n.replace(Ea,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function fi(n,s,i,l,u,p,y,S){n.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?n.type=y:n.removeAttribute("type"),s!=null?y==="number"?(s===0&&n.value===""||n.value!=s)&&(n.value=""+cn(s)):n.value!==""+cn(s)&&(n.value=""+cn(s)):y!=="submit"&&y!=="reset"||n.removeAttribute("value"),s!=null?Ul(n,y,cn(s)):i!=null?Ul(n,y,cn(i)):l!=null&&n.removeAttribute("value"),u==null&&p!=null&&(n.defaultChecked=!!p),u!=null&&(n.checked=u&&typeof u!="function"&&typeof u!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?n.name=""+cn(S):n.removeAttribute("name")}function Vc(n,s,i,l,u,p,y,S){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(n.type=p),s!=null||i!=null){if(!(p!=="submit"&&p!=="reset"||s!=null)){gt(n);return}i=i!=null?""+cn(i):"",s=s!=null?""+cn(s):i,S||s===n.value||(n.value=s),n.defaultValue=s}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,n.checked=S?n.checked:!!l,n.defaultChecked=!!l,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(n.name=y),gt(n)}function Ul(n,s,i){s==="number"&&rs(n.ownerDocument)===n||n.defaultValue===""+i||(n.defaultValue=""+i)}function mr(n,s,i,l){if(n=n.options,s){s={};for(var u=0;u<i.length;u++)s["$"+i[u]]=!0;for(i=0;i<n.length;i++)u=s.hasOwnProperty("$"+n[i].value),n[i].selected!==u&&(n[i].selected=u),u&&l&&(n[i].defaultSelected=!0)}else{for(i=""+cn(i),s=null,u=0;u<n.length;u++){if(n[u].value===i){n[u].selected=!0,l&&(n[u].defaultSelected=!0);return}s!==null||n[u].disabled||(s=n[u])}s!==null&&(s.selected=!0)}}function Uc(n,s,i){if(s!=null&&(s=""+cn(s),s!==n.value&&(n.value=s),i==null)){n.defaultValue!==s&&(n.defaultValue=s);return}n.defaultValue=i!=null?""+cn(i):""}function ur(n,s,i,l){if(s==null){if(l!=null){if(i!=null)throw Error(o(92));if(he(l)){if(1<l.length)throw Error(o(93));l=l[0]}i=l}i==null&&(i=""),s=i}i=cn(s),n.defaultValue=i,l=n.textContent,l===i&&l!==""&&l!==null&&(n.value=l),gt(n)}function Vn(n,s){if(s){var i=n.firstChild;if(i&&i===n.lastChild&&i.nodeType===3){i.nodeValue=s;return}}n.textContent=s}var Bc=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Bl(n,s,i){var l=s.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?n.setProperty(s,""):s==="float"?n.cssFloat="":n[s]="":l?n.setProperty(s,i):typeof i!="number"||i===0||Bc.has(s)?s==="float"?n.cssFloat=i:n[s]=(""+i).trim():n[s]=i+"px"}function Gl(n,s,i){if(s!=null&&typeof s!="object")throw Error(o(62));if(n=n.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||s!=null&&s.hasOwnProperty(l)||(l.indexOf("--")===0?n.setProperty(l,""):l==="float"?n.cssFloat="":n[l]="");for(var u in s)l=s[u],s.hasOwnProperty(u)&&i[u]!==l&&Bl(n,u,l)}else for(var p in s)s.hasOwnProperty(p)&&Bl(n,p,s[p])}function hi(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Gc=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRen
48dering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),pr=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function vi(n){return pr.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Po(){}var ql=null;function fo(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var gr=null,as=null;function Sa(n){var s=go(n);if(s&&(n=s.stateNode)){var i=n[dn]||null;e:switch(n=s.stateNode,s.type){case"input":if(fi(n,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),s=i.name,i.type==="radio"&&s!=null){for(i=n;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Nn(""+s)+'"][type="radio"]'),s=0;s<i.length;s++){var l=i[s];if(l!==n&&l.form===n.form){var u=l[dn]||null;if(!u)throw Error(o(90));fi(l,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(s=0;s<i.length;s++)l=i[s],l.form===n.form&&wa(l)}break e;case"textarea":Uc(n,i.value,i.defaultValue);break e;case"select":s=i.value,s!=null&&mr(n,!!i.multiple,s,!1)}}}var bi=!1;function fr(n,s,i){if(bi)return n(s,i);bi=!0;try{var l=n(s);return l}finally{if(bi=!1,(gr!==null||as!==null)&&(Pm(),gr&&(s=gr,n=as,as=gr=null,Sa(s),n)))for(s=0;s<n.length;s++)Sa(n[s])}}function zo(n,s){var i=n.stateNode;if(i===null)return null;var l=i[dn]||null;if(l===null)return null;i=l[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(n=n.type,l=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!l;break e;default:n=!1}if(n)return null;if(i&&typeof i!="function")throw Error(o(231,s,typeof i));return i}var ho=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ka=!1;if(ho)try{var bt={};Object.defineProperty(bt,"passive",{get:function(){ka=!0}}),window.addEventListener("test",bt,bt),window.removeEventListener("test",bt,bt)}catch{ka=!1}var is=null,Fl=null,Ca=null;function jl(){if(Ca)return Ca;var n,s=Fl,i=s.length,l,u="value"in is?is.value:is.textContent,p=u.length;for(n=0;n<i&&s[n]===u[n];n++);var y=i-n;for(l=1;l<=y&&s[i-l]===u[p-l];l++);return Ca=u.slice(n,1<l?1-l:void 0)}function Ra(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function Ts(){return!0}function Lo(){return!1}function hn(n){function s(i,l,u,p,y){this._reactName=i,this._targetInst=u,this.type=l,this.nativeEvent=p,this.target=y,this.currentTarget=null;for(var S in n)n.hasOwnProperty(S)&&(i=n[S],this[S]=i?i(p):p[S]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Ts:Lo,this.isPropagationStopped=Lo,this}return E(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Ts)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Ts)},persist:function(){},isPersistent:Ts}),s}var Is={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ls=hn(Is),hr=E({},Is,{view:0,detail:0}),Xl=hn(hr),vr,yi,ds,xi=E({},hr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:br,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==ds&&(ds&&n.type==="mousemove"?(vr=n.screenX-ds.screenX,yi=n.screenY-ds.screenY):yi=vr=0,ds=n),vr)},movementY:function(n){return"movementY"in n?n.movementY:yi}}),Hl=hn(xi),Da=E({},xi,{dataTransfer:0}),qc=hn(Da),Fc=E({},hr,{relatedTarget:0}),Ma=hn(Fc),Wl=E({},Is,{animationName:0,elapsedTime:0,pseudoElement:0}),jc=hn(Wl),Ai=E({},Is,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Xc=hn(Ai),Hc=E({},Is,{data:0}),cs=hn(Hc),Wc={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Kc={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Qc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yc(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=Qc[n])?!!s[n]:!1}function br(){return Yc}var In=E({}
vendor: 5,262 bytes, line 48
48,hr,{key:function(n){if(n.key){var s=Wc[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=Ra(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Kc[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:br,charCode:function(n){return n.type==="keypress"?Ra(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Ra(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),$c=hn(In),Jc=E({},xi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Os=hn(Jc),m=E({},hr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:br}),b=hn(m),x=E({},Is,{propertyName:0,elapsedTime:0,pseudoElement:0}),k=hn(x),q=E({},xi,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),W=hn(q),ue=E({},Is,{newState:0,oldState:0}),je=hn(ue),Bt=[9,13,27,32],ct=ho&&"CompositionEvent"in window,Rt=null;ho&&"documentMode"in document&&(Rt=document.documentMode);var vo=ho&&"TextEvent"in window&&!Rt,ms=ho&&(!ct||Rt&&8<Rt&&11>=Rt),No=" ",Vo=!1;function Ta(n,s){switch(n){case"keyup":return Bt.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _i(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var wi=!1;function q8(n,s){switch(n){case"compositionend":return _i(s);case"keypress":return s.which!==32?null:(Vo=!0,No);case"textInput":return n=s.data,n===No&&Vo?null:n;default:return null}}function F8(n,s){if(wi)return n==="compositionend"||!ct&&Ta(n,s)?(n=jl(),Ca=Fl=is=null,wi=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return ms&&s.locale!=="ko"?null:s.data;default:return null}}var j8={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function b1(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!j8[n.type]:s==="textarea"}function y1(n,s,i,l){gr?as?as.push(l):as=[l]:gr=l,s=Gm(s,"onChange"),0<s.length&&(i=new ls("onChange","change",null,i,l),n.push({event:i,listeners:s}))}var Kl=null,Ql=null;function X8(n){tb(n,0)}function Zc(n){var s=Zn(n);if(wa(s))return n}function x1(n,s){if(n==="change")return s}var A1=!1;if(ho){var _p;if(ho){var wp="oninput"in document;if(!wp){var _1=document.createElement("div");_1.setAttribute("oninput","return;"),wp=typeof _1.oninput=="function"}_p=wp}else _p=!1;A1=_p&&(!document.documentMode||9<document.documentMode)}function w1(){Kl&&(Kl.detachEvent("onpropertychange",E1),Ql=Kl=null)}function E1(n){if(n.propertyName==="value"&&Zc(Ql)){var s=[];y1(s,Ql,n,fo(n)),fr(X8,s)}}function H8(n,s,i){n==="focusin"?(w1(),Kl=s,Ql=i,Kl.attachEvent("onpropertychange",E1)):n==="focusout"&&w1()}function W8(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Zc(Ql)}function K8(n,s){if(n==="click")return Zc(s)}function Q8(n,s){if(n==="input"||n==="change")return Zc(s)}function Y8(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var to=typeof Object.is=="function"?Object.is:Y8;function Yl(n,s){if(to(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var i=Object.keys(n),l=Object.keys(s);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var u=i[l];if(!Tt.call(s,u)||!to(n[u],s[u]))return!1}return!0}function S1(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function k1(n,s){var i=S1(n);n=0;for(var l;i;){if(i.nodeType===3){if(l=n+i.textContent.length,n<=s&&l>=s)return{node:i,offset:s-n};n=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=S1(i)}}function C1(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?C1(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function R1(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var s=rs(n.document);s instanceof n.HTMLIFrameElement;){try{var i=typeof s.contentWindow.location.href=="string"}catch{i=!1}if(i)n=s.contentWindow;else break;s=rs(n.document)}return s}function Ep(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}var $8=ho&&"documentMode"in document&&11>=document.documentMode,Ei=null,Sp=null,$l=null,kp=!1;function D1(n,s,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;kp||Ei==null||Ei!==rs(l)||(l=Ei,"selectionStart"in l&&Ep(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focu
vendor: 22,306 bytes, line 48
48sNode:l.focusNode,focusOffset:l.focusOffset}),$l&&Yl($l,l)||($l=l,l=Gm(Sp,"onSelect"),0<l.length&&(s=new ls("onSelect","select",null,s,i),n.push({event:s,listeners:l}),s.target=Ei)))}function Ia(n,s){var i={};return i[n.toLowerCase()]=s.toLowerCase(),i["Webkit"+n]="webkit"+s,i["Moz"+n]="moz"+s,i}var Si={animationend:Ia("Animation","AnimationEnd"),animationiteration:Ia("Animation","AnimationIteration"),animationstart:Ia("Animation","AnimationStart"),transitionrun:Ia("Transition","TransitionRun"),transitionstart:Ia("Transition","TransitionStart"),transitioncancel:Ia("Transition","TransitionCancel"),transitionend:Ia("Transition","TransitionEnd")},Cp={},M1={};ho&&(M1=document.createElement("div").style,"AnimationEvent"in window||(delete Si.animationend.animation,delete Si.animationiteration.animation,delete Si.animationstart.animation),"TransitionEvent"in window||delete Si.transitionend.transition);function Oa(n){if(Cp[n])return Cp[n];if(!Si[n])return n;var s=Si[n],i;for(i in s)if(s.hasOwnProperty(i)&&i in M1)return Cp[n]=s[i];return n}var T1=Oa("animationend"),I1=Oa("animationiteration"),O1=Oa("animationstart"),J8=Oa("transitionrun"),Z8=Oa("transitionstart"),e3=Oa("transitioncancel"),P1=Oa("transitionend"),z1=new Map,Rp="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Rp.push("scrollEnd");function Uo(n,s){z1.set(n,s),os(s,[n])}var em=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},bo=[],ki=0,Dp=0;function tm(){for(var n=ki,s=Dp=ki=0;s<n;){var i=bo[s];bo[s++]=null;var l=bo[s];bo[s++]=null;var u=bo[s];bo[s++]=null;var p=bo[s];if(bo[s++]=null,l!==null&&u!==null){var y=l.pending;y===null?u.next=u:(u.next=y.next,y.next=u),l.pending=u}p!==0&&L1(i,u,p)}}function nm(n,s,i,l){bo[ki++]=n,bo[ki++]=s,bo[ki++]=i,bo[ki++]=l,Dp|=l,n.lanes|=l,n=n.alternate,n!==null&&(n.lanes|=l)}function Mp(n,s,i,l){return nm(n,s,i,l),om(n)}function Pa(n,s){return nm(n,null,null,s),om(n)}function L1(n,s,i){n.lanes|=i;var l=n.alternate;l!==null&&(l.lanes|=i);for(var u=!1,p=n.return;p!==null;)p.childLanes|=i,l=p.alternate,l!==null&&(l.childLanes|=i),p.tag===22&&(n=p.stateNode,n===null||n._visibility&1||(u=!0)),n=p,p=p.return;return n.tag===3?(p=n.stateNode,u&&s!==null&&(u=31-Ut(i),n=p.hiddenUpdates,l=n[u],l===null?n[u]=[s]:l.push(s),s.lane=i|536870912),p):null}function om(n){if(50<yd)throw yd=0,Ug=null,Error(o(185));for(var s=n.return;s!==null;)n=s,s=n.return;return n.tag===3?n.stateNode:null}var Ci={};function t3(n,s,i,l){this.tag=n,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function no(n,s,i,l){return new t3(n,s,i,l)}function Tp(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Ps(n,s){var i=n.alternate;return i===null?(i=no(n.tag,s,n.key,n.mode),i.elementType=n.elementType,i.type=n.type,i.stateNode=n.stateNode,i.alternate=n,n.alternate=i):(i.pendingProps=s,i.type=n.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=n.flags&65011712,i.childLanes=n.childLanes,i.lanes=n.lanes,i.child=n.child,i.memoizedProps=n.memoizedProps,i.memoizedState=n.memoizedState,i.updateQueue=n.updateQueue,s=n.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},i.sibling=n.sibling,i.index=n.index,i.ref=n.ref,i.refCleanup=n.refCleanup,i}function N1(n,s){n.flags&=65011714;var i=n.alternate;return i===null?(n.childLanes=0,n.lanes=s,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=i.childLanes,n.lanes=i.lanes,n.child=i.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=i.memoizedProps,n.memoizedState=i.memoizedState,n.updateQueue=i.updateQueue,n.type=i.type,s=i.dependencies,n.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),n}function sm(n,s,i,l,u,p){var y=0;if(l=n,typeof n=="function")Tp(n)&&(y=1);else if(typeof n=="string")y=a6(n,i,be.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case T:return n=no(31,i,s,u),n.elementType=T,n.lanes=p,n;case ee:return za(i.children,u,p,s);case ie:y=8,u|=24;break;case ve:return n=no(12,i,s,u|2),n.elementType=ve,n.lanes=p,n;case Ye:return n=no(13,i,s,u),n.elementType=Ye,n.lanes=p,n;case qe:return n=no(19,i,s,u),n.elementType=qe,n.lanes=p,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case Me:y=10;break e;case Se:y=9;break e;case tt:y=11;break e;case w:y=14;break e;case C:y=16,l=null;break e}y=29,i=Error(o(130,n===null?"null":typeof n,"")),l=null}return s=no(y,i,s,u),s.elementType=n,s.type=l,s.lanes=p,s}function za(n,s,i,l){return n=no(7,n,l,s),n.lanes=i,n}function Ip(n,s,i){return n=no(6,n,null,s),n.lanes=i,n}function V1(n){var s=no(18,null,null,0);return s.stateNode=n,s}function Op(n,s,i){return s=no(4,n.children!==null?n.children:[],n.key,s),s.lanes=i,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}var U1=new WeakMap;function yo(n,s){if(typeof n=="object"&&n!==null){var i=U1.get(n);return i!==void 0?i:(s={value:n,source:s,stack:dr(s)},U1.set(n,s),s)}return{value:n,source:s,stack:dr(s)}}var Ri=[],Di=0,rm=null,Jl=0,xo=[],Ao=0,yr=null,us=1,ps="";function zs(n,s){Ri[Di++]=Jl,Ri[Di++]=rm,rm=n,Jl=s}function B1(n,s,i){xo[Ao++]=us,xo[Ao++]=ps,xo[Ao++]=yr,yr=n;var l=us;n=ps;var u=32-Ut(l)-1;l&=~(1<<u),i+=1;var p=32-Ut(s)+u;if(30<p){var y=u-u%5;p=(l&(1<<y)-1).toString(32),l>>=y,u-=y,us=1<<32-Ut(s)+u|i<<u|l,ps=p+n}else us=1<<p|i<<u|l,ps=n}function Pp(n){n.return!==null&&(zs(n,1),B1(n,1,0))}function zp(n){for(;n===rm;)rm=Ri[--Di],Ri[Di]=null,Jl=Ri[--Di],Ri[Di]=null;for(;n===yr;)yr=xo[--Ao],xo[Ao]=null,ps=xo[--Ao],xo[Ao]=null,us=xo[--Ao],xo[Ao]=null}function G1(n,s){xo[Ao++]=us,xo[Ao++]=ps,xo[Ao++]=yr,us=s.id,ps=s.overflow,yr=n}var vn=null,St=null,rt=!1,xr=null,_o=!1,Lp=Error(o(519));function Ar(n){var s=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Zl(yo(s,n)),Lp}function q1(n){var s=n.stateNode,i=n.type,l=n.memoizedProps;switch(s[Ht]=n,s[dn]=l,i){case"dialog":Ze("cancel",s),Ze("close",s);break;case"iframe":case"object":case"embed":Ze("load",s);break;case"video":case"audio":for(i=0;i<Ad.length;i++)Ze(Ad[i],s);break;case"source":Ze("error",s);break;case"img":case"image":case"link":Ze("error",s),Ze("load",s);break;case"details":Ze("toggle",s);break;case"input":Ze("invalid",s),Vc(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ze("invalid",s);break;case"textarea":Ze("invalid",s),ur(s,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||s.textContent===""+i||l.suppressHydrationWarning===!0||rb(s.textContent,i)?(l.popover!=null&&(Ze("beforetoggle",s),Ze("toggle",s)),l.onScroll!=null&&Ze("scroll",s),l.onScrollEnd!=null&&Ze("scrollend",s),l.onClick!=null&&(s.onclick=Po),s=!0):s=!1,s||Ar(n,!0)}function F1(n){for(vn=n.return;vn;)switch(vn.tag){case 5:case 31:case 13:_o=!1;return;case 27:case 3:_o=!0;return;default:vn=vn.return}}function Mi(n){if(n!==vn)return!1;if(!rt)return F1(n),rt=!0,!1;var s=n.tag,i;if((i=s!==3&&s!==27)&&((i=s===5)&&(i=n.type,i=!(i!=="form"&&i!=="button")||ef(n.type,n.memoizedProps)),i=!i),i&&St&&Ar(n),F1(n),s===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));St=gb(n)}else if(s===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));St=gb(n)}else s===27?(s=St,zr(n.type)?(n=rf,rf=null,St=n):St=s):St=vn?Eo(n.stateNode.nextSibling):null;return!0}function La(){St=vn=null,rt=!1}function Np(){var n=xr;return n!==null&&(qn===null?qn=n:qn.push.apply(qn,n),xr=null),n}function Zl(n){xr===null?xr=[n]:xr.push(n)}var Vp=P(null),Na=null,Ls=null;function _r(n,s,i){me(Vp,s._currentValue),s._currentValue=i}function Ns(n){n._currentValue=Vp.current,Z(Vp)}function Up(n,s,i){for(;n!==null;){var l=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,l!==null&&(l.childLanes|=s)):l!==null&&(l.childLanes&s)!==s&&(l.childLanes|=s),n===i)break;n=n.return}}function Bp(n,s,i,l){var u=n.child;for(u!==null&&(u.return=n);u!==null;){var p=u.dependencies;if(p!==null){var y=u.child;p=p.firstContext;e:for(;p!==null;){var S=p;p=u;for(var I=0;I<s.length;I++)if(S.context===s[I]){p.lanes|=i,S=p.alternate,S!==null&&(S.lanes|=i),Up(p.return,i,n),l||(y=null);break e}p=S.next}}else if(u.tag===18){if(y=u.return,y===null)throw Error(o(341));y.lanes|=i,p=y.alternate,p!==null&&(p.lanes|=i),Up(y,i,n),y=null}else y=u.child;if(y!==null)y.return=u;else for(y=u;y!==null;){if(y===n){y=null;break}if(u=y.sibling,u!==null){u.return=y.return,y=u;break}y=y.return}u=y}}function Ti(n,s,i,l){n=null;for(var u=s,p=!1;u!==null;){if(!p){if((u.flags&524288)!==0)p=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var y=u.alternate;if(y===null)throw Error(o(387));if(y=y.memoizedProps,y!==null){var S=u.type;to(u.pendingProps.value,y.value)||(n!==null?n.push(S):n=[S])}}else if(u===$e.current){if(y=u.alternate,y===null)throw Error(o(387));y.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(n!==null?n.push(kd):n=[kd])}u=u.return}n!==null&&Bp(s,n,i,l),s.flags|=262144}function am(n){for(n=n.firstContext;n!==null;){if(!to(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Va(n){Na=n,Ls=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function bn(n){return j1(Na,n)}function im(n,s){return Na===null&&Va(n),j1(n,s)}function j1(n,s){var i=s._currentValue;if(s={context:s,memoizedValue:i,next:null},Ls===null){if(n===null)throw Error(o(308));Ls=s,n.dependencies={lanes:0,firstContext:s},n.flags|=524288}else Ls=Ls.next=s;return i}var n3=typeof AbortController<"u"?AbortController:function(){var n=[],s=this.signal={aborted:!1,addEventListener:function(i,l){n.push(l)}};this.abort=function(){s.aborted=!0,n.forEach(function(i){return i()})}},o3=r.unstable_scheduleCallback,s3=r.unstable_NormalPriority,Qt={$$typeof:Me,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Gp(){return{controller:new n3,data:new Map,refCount:0}}function ed(n){n.refCount--,n.refCount===0&&o3(s3,function(){n.controller.abort()})}var td=null,qp=0,Ii=0,Oi=null;function r3(n,s){if(td===null){var i=td=[];qp=0,Ii=Xg(),Oi={status:"pending",value:void 0,then:function(l){i.push(l)}}}return qp++,s.then(X1,X1),s}function X1(){if(--qp===0&&td!==null){Oi!==null&&(Oi.status="fulfilled");var n=td;td=null,Ii=0,Oi=null;for(var s=0;s<n.length;s++)(0,n[s])()}}function a3(n,s){var i=[],l={status:"pending",value:null,reason:null,then:function(u){i.push(u)}};return n.then(function(){l.status="fulfilled",l.value=s;for(var u=0;u<i.length;u++)(0,i[u])(s)},function(u){for(l.status="rejected",l.reason=u,u=0;u<i.length;u++)(0,i[u])(void 0)}),l}var H1=K.S;K.S=function(n,s){Dv=le(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&r3(n,s),H1!==null&&H1(n,s)};var Ua=P(null);function Fp(){var n=Ua.current;return n!==null?n:Et.pooledCache}function lm(n,s){s===null?me(Ua,Ua.current):me(Ua,s.pool)}function W1(){var n=Fp();return n===null?null:{parent:Qt._currentValue,pool:n}}var Pi=Error(o(460)),jp=Error(o(474)),dm=Error(o(542)),cm={then:function(){}};function K1(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Q1(n,s,i){switch(i=n[i],i===void 0?n.push(s):i!==s&&(s.then(Po,Po),s=i),s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,$1(n),n;default:if(typeof s.status=="string")s.then(Po,Po);else{if(n=Et,n!==null&&100<n.shellSuspendCounter)throw Error(o(482));n=s,n.status="pending",n.then(function(l){if(s.status==="pending"){var u=s;u.status="fulfilled",u.value=l}},function(l){if(s.status==="pending"){var u=s;u.status="rejected",u.reason=l}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,$1(n),n}throw Ga=s,Pi}}function Ba(n){try{var s=n._init;return s(n._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Ga=i,Pi):i}}var Ga=null;function Y1(){if(Ga===null)throw Error(o(459));var n=Ga;return Ga=null,n}function $1(n){if(n===Pi||n===dm)throw Error(o(483))}var zi=null,nd=0;function mm(n){var s=nd;return nd+=1,zi===null&&(zi=[]),Q1(zi,n,s)}function od(n,s){s=s.props.ref,n.ref=s!==void 0?s:null}function um(n,s){throw s.$$typeof===M?Error(o(525)):(n=Object.prototype.toString.call(s),Error(o(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n)))}function J1(n){function s(U,L){if(n){var F=U.deletions;F===null?(U.deletions=[L],U.flags|=16):F.push(L)}}function i(U,L){if(!n)return null;for(;L!==null;)s(U,L),L=L.sibling;return null}function l(U){for(var L=new Map;U!==null;)U.key!==null?L.set(U.key,U):L.set(U.index,U),U=U.sibling;return L}function u(U,L){return U=Ps(U,L),U.index=0,U.sibling=null,U}function p(U,L,F){return U.index=F,n?(F=U.alternate,F!==null?(F=F.index,F<L?(U.flags|=67108866,L):F):(U.flags|=67108866,L)):(U.flags|=1048576,L)}function y(U){return n&&U.alternate===null&&(U.flags|=67108866),U}function S(U,L,F,te){return L===null||L.tag!==6?(L=Ip(F,U.mode,te),L.return=U,L):(L=u(L,F),L.return=U,L)}function I(U,L,F,te){var Ce=F.type;return Ce===ee?J(U,L,F.props.children,te,F.key):L!==null&&(L.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===C&&Ba(Ce)===L.type)?(L=u(L,F.props),od(L,F),L.return=U,L):(L=sm(F.type,F.key,F.props,null,U.mode,te),od(L,F),L.return=U,L)}function j(U,L,F,te){return L===null||L.tag!==4||L.stateNode.containerInfo!==F.containerInfo||L.stateNode.implementation!==F.implementation?(L=Op(F,U.mode,te),L.return=U,L):(L=u(L,F.children||[]),L.return=U,L)}function J(U,L,F,te,Ce){return L===null||L.tag!==7?(L=za(F,U.mode,te,Ce),L.return=U,L):(L=u(L,F),L.return=U,L)}function re(U,L,F){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=Ip(""+L,U.mode,F),L.return=U,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case G:return F=sm(L.type,L.key,L.props,null,U.mode,F),od(F,L),F.return=U,F;case B:return L=Op(L,U.mode,F),L.return=U,L;case C:return L=Ba(L),re(U,L,F)}if(he(L)||N(L))return L=za(L,U.mode,F,null),L.return=U,L;if(typeof L.then=="function")return re(U,mm(L),F);if(L.$$typeof===Me)return re(U,im(U,L),F);um(U,L)}return null}function X(U,L,F,te){var Ce=L!==null?L.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return Ce!==null?null:S(U,L,""+F,te);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case G:return F.key===Ce?I(U,L,F,te):null;case B:return F.key===Ce?j(U,L,F,te):null;case C:return F=Ba(F),X(U,L,F,te)}if(he(F)||N(F))return Ce!==null?null:J(U,L,F,te,null);if(typeof F.then=="function")return X(U,L,mm(F),te);if(F.$$typeof===Me)return X(U,L,im(U,F),te);um(U,F)}return null}function Q(U,L,F,te,Ce){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return U=U.get(F)||null,S(L,U,""+te,Ce);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case G:return U=U.get(te.key===null?F:te.key)||null,I(L,U,te,Ce);case B:return U=U.get(te.key===null?F:te.key)||null,j(L,U,te,Ce);case C:return te=Ba(te),Q(U,L,F,te,Ce)}if(he(te)||N(te))return U=U.get(F)||null,J(L,U,te,Ce,null);if(typeof te.then=="function")return Q(U,L,F,mm(te),Ce);if(te.$$typeof===Me)return Q(U,L,F,im(L,te),Ce);um(L,te)}return null}function ye(U,L,F,te){for(var Ce=null,lt=null,xe=L,We=L=0,ot=null;xe!==null&&We<F.length;We++){xe.index>We?(ot=xe,xe=null):ot=xe.sibling;var dt=X(U,xe,F[We],te);if(dt===null){xe===null&&(xe=ot);break}n&&xe&&dt.alternate===null&&s(U,xe),L=p(dt,L,We),lt===null?Ce=dt:lt.sibling=dt,lt=dt,xe=ot}if(We===F.length)return i(U,xe),rt&&zs(U,We),Ce;if(xe===null){for(;We<F.length;We++)xe=re(U,F[We],te),xe!==null&&(L=p(xe,L,We),lt===null?Ce=xe:lt.sibling=xe,lt=xe);return rt&&zs(U,We),Ce}for(xe=l(xe);We<F.length;We++)ot=Q(xe,U,We,F[We],te),ot!==null&&(n&&ot.alternate!==null&&xe.delete(ot.key===null?We:ot.key),L=p(ot,L,We),lt===null?Ce=ot:lt.sibling=ot,lt=ot);return n&&xe.forEach(function(Br){return s(U,Br)}),rt&&zs(U,We),Ce}function Te(U,L,F,te){if(F==null)throw Error(o(151));for(var Ce=null,lt=null,xe=L,We=L=0,ot=null,dt=F.next();xe!==null&&!dt.done;We++,dt=F.next()){xe.index>We?(ot=xe,xe=null):ot=xe.sibling;var Br=X(U,xe,dt.value,te);if(Br===null){xe===null&&(xe=ot);break}n&&xe&&Br.alternate===null&&s(U,xe),L=p(Br,L,We),lt===null?Ce=Br:lt.sibling=Br,lt=Br,xe=ot}if(dt.done)return i(U,xe),rt&&zs(U,We),Ce;if(xe===null){for(;!dt.done;We++,dt=F.next())dt=re(U,dt.value,te),dt!==null&&(L=p(dt,L,We),lt===null?Ce=dt:lt.sibling=dt,lt=dt);return rt&&zs(U,We),Ce}for(xe=l(xe);!dt.done;We++,dt=F.next())dt=Q(xe,U,We,dt.value,te),dt!==null&&(n&&dt.alternate!==null&&xe.delete(dt.key===null?We:dt.key),L=p(dt,L,We),lt===null?Ce=dt:lt.sibling=dt,lt=dt);return n&&xe.forEach(function(v6){return s(U,v6)}),rt&&zs(U,We),Ce}function At(U,L,F,te){if(typeof F=="object"&&F!==null&&F.type===ee&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case G:e:{for(var Ce=F.key;L!==null;){if(L.key===Ce){if(Ce=F.type,Ce===ee){if(L.tag===7){i(U,L.sibling),te=u(L,F.props.children),te.return=U,U=te;break e}}else if(L.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===C&&Ba(Ce)===L.type){i(U,L.sibling),te=u(L,F.props),od(te,F),te.return=U,U=te;break e}i(U,L);break}else s(U,L);L=L.sibling}F.type===ee?(te=za(F.props.children,U.mode,te,F.key),te.return=U,U=te):(te=sm(F.type,F.key,F.props,null,U.mode,te),od(te,F),te.return=U,U=te)}return y(U);case B:e:{for(Ce=F.key;L!==null;){if(L.key===Ce)if(L.tag===4&&L.stateNode.containerInfo===F.containerInfo&&L.stateNode.implementation===F.implementation){i(U,L.sibling),te=u(L,F.children||[]),te.return=U,U=te;break e}else{i(U,L);break}else s(U,L);L=L.sibling}te=Op(F,U.mode,te),te.return=U,U=te}return y(U);case C:return F=Ba(F),At(U,L,F,te)}if(he(F))return ye(U,L,F,te);if(N(F)){if(Ce=N(F),typeof Ce!="function")throw Error(o(150));return F=Ce.call(F),Te(U,L,F,te)}if(typeof F.then=="function")return At(U,L,mm(F),te);if(F.$$typeof===Me)return At(U,L,im(U,F),te);um(U,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,L!==null&&L.tag===6?(i(U,L.sibling),te=u(L,F),te.return=U,U=te):(i(U,L),te=Ip(F,U.mode,te),te.return=U,U=te),y(U)):i(U,L)}return function(U,L,F,te){try{nd=0;var Ce=At(U,L,F,te);return zi=null,Ce}catch(xe){if(xe===Pi||xe===dm)throw xe;var lt=no(29,xe,null,U.mode);return lt.lanes=te,lt.return=U,lt}finally{}}}var qa=J1(!0),Z1=J1(!1),wr=!1;function Xp(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hp(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Er(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Sr(n,s,i){var l=n.updateQueue;if(l===null)return null;if(l=l.shared,(mt&2)!==0){var u=l.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),l.pending=s,s=om(n),L1(n,null,i),s}return nm(n,l,s,i),om(n)}function sd(n,s,i){if(s=s.updateQueue,s!==null&&(s=s.shared,(i&4194048)!==0)){var l=s.lanes;l&=n.pendingLanes,i|=l,s.lanes=i,Tl(n,i)}}function Wp(n,s){var i=n.updateQueue,l=n.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var u=null,p=null;if(i=i.firstBaseUpdate,i!==null){do{var y={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};p===null?u=p=y:p=p.next=y,i=i.next}while(i!==null);p===null?u=p=s:p=p.next=s}else u=p=s;i={baseState:l.baseState,firstBaseUpdate:u,lastBaseUpdate:p,shared:l.shared,callbacks:l.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=s:n.next=s,i.lastBaseUpdate=s}var Kp=!1;function rd(){if(Kp){var n=Oi;if(n!==null)throw n}}function ad(n,s,i,l){Kp=!1;var u=n.updateQueue;wr=!1;var p=u.firstBaseUpdate,y=u.lastBaseUpdate,S=u.shared.pending;if(S!==null){u.shared.pending=null;var I=S,j=I.next;I.next=null,y===null?p=j:y.next=j,y=I;var J=n.alternate;J!==null&&(J=J.updateQueue,S=J.lastBaseUpdate,S!==y&&(S===null?J.firstBaseUpdate=j:S.next=j,J.lastBaseUpdate=I))}if(p!==null){var re=u.baseState;y=0,J=j=I=null,S=p;do{var X=S.lane&-536870913,Q=X!==S.lane;if(Q?(nt&X)===X:(l&X)===X){X!==0&&X===Ii&&(Kp=!0),J!==null&&(J=J.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var ye=n,Te=S;X=s;var At=i;switch(Te.tag){case 1:if(ye=Te.payload,typeof ye=="function"){re=ye.call(At,re,X);break e}re=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Te.payload,X=typeof ye=="function"?ye.call(At,re,X):ye,X==null)break e;re=E({},re,X);break e;case 2:wr=!0}}X=S.callback,X!==null&&(n.flags|=64,Q&&(n.flags|=8192),Q=u.callbacks,Q===null?u.callbacks=[X]:Q.push(X))}else Q={lane:X,tag:S.tag,payload:S.payload,callback:S.callback,next:null},J===null?(j=J=Q,I=re):J=J.next=Q,y|=X;if(S=S.next,S===null){if(S=u.shared.pending,S===null)break;Q=S,S=Q.next,Q.next=null,u.lastBaseUpdate=Q,u.shared.pending=null}}while(!0);J===null&&(I=re),u.baseState=I,u.firstBaseUpdate=j,u.lastBaseUpdate=J,p===null&&(u.shared.lanes=0),Mr|=y,n.lanes=y,n.memoizedState=re}}function e0(n,s){if(typeof n!="function")throw Error(o(191,n));n.call(s)}function t0(n,s){var i=n.callbacks;
vendor: 4,121 bytes, line 48
48if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)e0(i[n],s)}var Li=P(null),pm=P(0);function n0(n,s){n=Hs,me(pm,n),me(Li,s),Hs=n|s.baseLanes}function Qp(){me(pm,Hs),me(Li,Li.current)}function Yp(){Hs=pm.current,Z(Li),Z(pm)}var oo=P(null),wo=null;function kr(n){var s=n.alternate;me(Gt,Gt.current&1),me(oo,n),wo===null&&(s===null||Li.current!==null||s.memoizedState!==null)&&(wo=n)}function $p(n){me(Gt,Gt.current),me(oo,n),wo===null&&(wo=n)}function o0(n){n.tag===22?(me(Gt,Gt.current),me(oo,n),wo===null&&(wo=n)):Cr()}function Cr(){me(Gt,Gt.current),me(oo,oo.current)}function so(n){Z(oo),wo===n&&(wo=null),Z(Gt)}var Gt=P(0);function gm(n){for(var s=n;s!==null;){if(s.tag===13){var i=s.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||of(i)||sf(i)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Vs=0,Xe=null,yt=null,Yt=null,fm=!1,Ni=!1,Fa=!1,hm=0,id=0,Vi=null,i3=0;function Lt(){throw Error(o(321))}function Jp(n,s){if(s===null)return!1;for(var i=0;i<s.length&&i<n.length;i++)if(!to(n[i],s[i]))return!1;return!0}function Zp(n,s,i,l,u,p){return Vs=p,Xe=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,K.H=n===null||n.memoizedState===null?B0:gg,Fa=!1,p=i(l,u),Fa=!1,Ni&&(p=r0(s,i,l,u)),s0(n),p}function s0(n){K.H=cd;var s=yt!==null&&yt.next!==null;if(Vs=0,Yt=yt=Xe=null,fm=!1,id=0,Vi=null,s)throw Error(o(300));n===null||$t||(n=n.dependencies,n!==null&&am(n)&&($t=!0))}function r0(n,s,i,l){Xe=n;var u=0;do{if(Ni&&(Vi=null),id=0,Ni=!1,25<=u)throw Error(o(301));if(u+=1,Yt=yt=null,n.updateQueue!=null){var p=n.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}K.H=G0,p=s(i,l)}while(Ni);return p}function l3(){var n=K.H,s=n.useState()[0];return s=typeof s.then=="function"?ld(s):s,n=n.useState()[0],(yt!==null?yt.memoizedState:null)!==n&&(Xe.flags|=1024),s}function eg(){var n=hm!==0;return hm=0,n}function tg(n,s,i){s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~i}function ng(n){if(fm){for(n=n.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}fm=!1}Vs=0,Yt=yt=Xe=null,Ni=!1,id=hm=0,Vi=null}function On(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Yt===null?Xe.memoizedState=Yt=n:Yt=Yt.next=n,Yt}function qt(){if(yt===null){var n=Xe.alternate;n=n!==null?n.memoizedState:null}else n=yt.next;var s=Yt===null?Xe.memoizedState:Yt.next;if(s!==null)Yt=s,yt=n;else{if(n===null)throw Xe.alternate===null?Error(o(467)):Error(o(310));yt=n,n={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},Yt===null?Xe.memoizedState=Yt=n:Yt=Yt.next=n}return Yt}function vm(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ld(n){var s=id;return id+=1,Vi===null&&(Vi=[]),n=Q1(Vi,n,s),s=Xe,(Yt===null?s.memoizedState:Yt.next)===null&&(s=s.alternate,K.H=s===null||s.memoizedState===null?B0:gg),n}function bm(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return ld(n);if(n.$$typeof===Me)return bn(n)}throw Error(o(438,String(n)))}function og(n){var s=null,i=Xe.updateQueue;if(i!==null&&(s=i.memoCache),s==null){var l=Xe.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(s={data:l.data.map(function(u){return u.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),i===null&&(i=vm(),Xe.updateQueue=i),i.memoCache=s,i=s.data[s.index],i===void 0)for(i=s.data[s.index]=Array(n),l=0;l<n;l++)i[l]=z;return s.index++,i}function Us(n,s){return typeof s=="function"?s(n):s}function ym(n){var s=qt();return sg(s,yt,n)}function sg(n,s,i){var l=n.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=i;var u=n.baseQueue,p=l.pending;if(p!==null){if(u!==null){var y=u.next;u.next=p.next,p.next=y}
vendor: 18,290 bytes, line 48
48s.baseQueue=u=p,l.pending=null}if(p=n.baseState,u===null)n.memoizedState=p;else{s=u.next;var S=y=null,I=null,j=s,J=!1;do{var re=j.lane&-536870913;if(re!==j.lane?(nt&re)===re:(Vs&re)===re){var X=j.revertLane;if(X===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null}),re===Ii&&(J=!0);else if((Vs&X)===X){j=j.next,X===Ii&&(J=!0);continue}else re={lane:0,revertLane:j.revertLane,gesture:null,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},I===null?(S=I=re,y=p):I=I.next=re,Xe.lanes|=X,Mr|=X;re=j.action,Fa&&i(p,re),p=j.hasEagerState?j.eagerState:i(p,re)}else X={lane:re,revertLane:j.revertLane,gesture:j.gesture,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},I===null?(S=I=X,y=p):I=I.next=X,Xe.lanes|=re,Mr|=re;j=j.next}while(j!==null&&j!==s);if(I===null?y=p:I.next=S,!to(p,n.memoizedState)&&($t=!0,J&&(i=Oi,i!==null)))throw i;n.memoizedState=p,n.baseState=y,n.baseQueue=I,l.lastRenderedState=p}return u===null&&(l.lanes=0),[n.memoizedState,l.dispatch]}function rg(n){var s=qt(),i=s.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=n;var l=i.dispatch,u=i.pending,p=s.memoizedState;if(u!==null){i.pending=null;var y=u=u.next;do p=n(p,y.action),y=y.next;while(y!==u);to(p,s.memoizedState)||($t=!0),s.memoizedState=p,s.baseQueue===null&&(s.baseState=p),i.lastRenderedState=p}return[p,l]}function a0(n,s,i){var l=Xe,u=qt(),p=rt;if(p){if(i===void 0)throw Error(o(407));i=i()}else i=s();var y=!to((yt||u).memoizedState,i);if(y&&(u.memoizedState=i,$t=!0),u=u.queue,lg(d0.bind(null,l,u,n),[n]),u.getSnapshot!==s||y||Yt!==null&&Yt.memoizedState.tag&1){if(l.flags|=2048,Ui(9,{destroy:void 0},l0.bind(null,l,u,i,s),null),Et===null)throw Error(o(349));p||(Vs&127)!==0||i0(l,s,i)}return i}function i0(n,s,i){n.flags|=16384,n={getSnapshot:s,value:i},s=Xe.updateQueue,s===null?(s=vm(),Xe.updateQueue=s,s.stores=[n]):(i=s.stores,i===null?s.stores=[n]:i.push(n))}function l0(n,s,i,l){s.value=i,s.getSnapshot=l,c0(s)&&m0(n)}function d0(n,s,i){return i(function(){c0(s)&&m0(n)})}function c0(n){var s=n.getSnapshot;n=n.value;try{var i=s();return!to(n,i)}catch{return!0}}function m0(n){var s=Pa(n,2);s!==null&&Fn(s,n,2)}function ag(n){var s=On();if(typeof n=="function"){var i=n;if(n=i(),Fa){po(!0);try{i()}finally{po(!1)}}}return s.memoizedState=s.baseState=n,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Us,lastRenderedState:n},s}function u0(n,s,i,l){return n.baseState=i,sg(n,yt,typeof l=="function"?l:Us)}function d3(n,s,i,l,u){if(_m(n))throw Error(o(485));if(n=s.action,n!==null){var p={payload:u,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){p.listeners.push(y)}};K.T!==null?i(!0):p.isTransition=!1,l(p),i=s.pending,i===null?(p.next=s.pending=p,p0(s,p)):(p.next=i.next,s.pending=i.next=p)}}function p0(n,s){var i=s.action,l=s.payload,u=n.state;if(s.isTransition){var p=K.T,y={};K.T=y;try{var S=i(u,l),I=K.S;I!==null&&I(y,S),g0(n,s,S)}catch(j){ig(n,s,j)}finally{p!==null&&y.types!==null&&(p.types=y.types),K.T=p}}else try{p=i(u,l),g0(n,s,p)}catch(j){ig(n,s,j)}}function g0(n,s,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){f0(n,s,l)},function(l){return ig(n,s,l)}):f0(n,s,i)}function f0(n,s,i){s.status="fulfilled",s.value=i,h0(s),n.state=i,s=n.pending,s!==null&&(i=s.next,i===s?n.pending=null:(i=i.next,s.next=i,p0(n,i)))}function ig(n,s,i){var l=n.pending;if(n.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=i,h0(s),s=s.next;while(s!==l)}n.action=null}function h0(n){n=n.listeners;for(var s=0;s<n.length;s++)(0,n[s])()}function v0(n,s){return s}function b0(n,s){if(rt){var i=Et.formState;if(i!==null){e:{var l=Xe;if(rt){if(St){t:{for(var u=St,p=_o;u.nodeType!==8;){if(!p){u=null;break t}if(u=Eo(u.nextSibling),u===null){u=null;break t}}p=u.data,u=p==="F!"||p==="F"?u:null}if(u){St=Eo(u.nextSibling),l=u.data==="F!";break e}}Ar(l)}l=!1}l&&(s=i[0])}}return i=On(),i.memoizedState=i.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:v0,lastRenderedState:s},i.queue=l,i=N0.bind(null,Xe,l),l.dispatch=i,l=ag(!1),p=pg.bind(null,Xe,!1,l.queue),l=On(),u={state:s,dispatch:null,action:n,pending:null},l.queue=u,i=d3.bind(null,Xe,u,p,i),u.dispatch=i,l.memoizedState=n,[s,i,!1]}function y0(n){var s=qt();return x0(s,yt,n)}function x0(n,s,i){if(s=sg(n,s,v0)[0],n=ym(Us)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=ld(s)}catch(y){throw y===Pi?dm:y}else l=s;s=qt();var u=s.queue,p=u.dispatch;return i!==s.memoizedState&&(Xe.flags|=2048,Ui(9,{destroy:void 0},c3.bind(null,u,i),null)),[l,p,n]}function c3(n,s){n.action=s}function A0(n){var s=qt(),i=yt;if(i!==null)return x0(s,i,n);qt(),s=s.memoizedState,i=qt();var l=i.queue.dispatch;return i.memoizedState=n,[s,l,!1]}function Ui(n,s,i,l){return n={tag:n,create:i,deps:l,inst:s,next:null},s=Xe.updateQueue,s===null&&(s=vm(),Xe.updateQueue=s),i=s.lastEffect,i===null?s.lastEffect=n.next=n:(l=i.next,i.next=n,n.next=l,s.lastEffect=n),n}function _0(){return qt().memoizedState}function xm(n,s,i,l){var u=On();Xe.flags|=n,u.memoizedState=Ui(1|s,{destroy:void 0},i,l===void 0?null:l)}function Am(n,s,i,l){var u=qt();l=l===void 0?null:l;var p=u.memoizedState.inst;yt!==null&&l!==null&&Jp(l,yt.memoizedState.deps)?u.memoizedState=Ui(s,p,i,l):(Xe.flags|=n,u.memoizedState=Ui(1|s,p,i,l))}function w0(n,s){xm(8390656,8,n,s)}function lg(n,s){Am(2048,8,n,s)}function m3(n){Xe.flags|=4;var s=Xe.updateQueue;if(s===null)s=vm(),Xe.updateQueue=s,s.events=[n];else{var i=s.events;i===null?s.events=[n]:i.push(n)}}function E0(n){var s=qt().memoizedState;return m3({ref:s,nextImpl:n}),function(){if((mt&2)!==0)throw Error(o(440));return s.impl.apply(void 0,arguments)}}function S0(n,s){return Am(4,2,n,s)}function k0(n,s){return Am(4,4,n,s)}function C0(n,s){if(typeof s=="function"){n=n();var i=s(n);return function(){typeof i=="function"?i():s(null)}}if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function R0(n,s,i){i=i!=null?i.concat([n]):null,Am(4,4,C0.bind(null,s,n),i)}function dg(){}function D0(n,s){var i=qt();s=s===void 0?null:s;var l=i.memoizedState;return s!==null&&Jp(s,l[1])?l[0]:(i.memoizedState=[n,s],n)}function M0(n,s){var i=qt();s=s===void 0?null:s;var l=i.memoizedState;if(s!==null&&Jp(s,l[1]))return l[0];if(l=n(),Fa){po(!0);try{n()}finally{po(!1)}}return i.memoizedState=[l,s],l}function cg(n,s,i){return i===void 0||(Vs&1073741824)!==0&&(nt&261930)===0?n.memoizedState=s:(n.memoizedState=i,n=Tv(),Xe.lanes|=n,Mr|=n,i)}function T0(n,s,i,l){return to(i,s)?i:Li.current!==null?(n=cg(n,i,l),to(n,s)||($t=!0),n):(Vs&42)===0||(Vs&1073741824)!==0&&(nt&261930)===0?($t=!0,n.memoizedState=i):(n=Tv(),Xe.lanes|=n,Mr|=n,s)}function I0(n,s,i,l,u){var p=ce.p;ce.p=p!==0&&8>p?p:8;var y=K.T,S={};K.T=S,pg(n,!1,s,i);try{var I=u(),j=K.S;if(j!==null&&j(S,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var J=a3(I,l);dd(n,s,J,io(n))}else dd(n,s,l,io(n))}catch(re){dd(n,s,{then:function(){},status:"rejected",reason:re},io())}finally{ce.p=p,y!==null&&S.types!==null&&(y.types=S.types),K.T=y}}function u3(){}function mg(n,s,i,l){if(n.tag!==5)throw Error(o(476));var u=O0(n).queue;I0(n,u,s,ae,i===null?u3:function(){return P0(n),i(l)})}function O0(n){var s=n.memoizedState;if(s!==null)return s;s={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Us,lastRenderedState:ae},next:null};var i={};return s.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Us,lastRenderedState:i},next:null},n.memoizedState=s,n=n.alternate,n!==null&&(n.memoizedState=s),s}function P0(n){var s=O0(n);s.next===null&&(s=n.alternate.memoizedState),dd(n,s.next.queue,{},io())}function ug(){return bn(kd)}function z0(){return qt().memoizedState}function L0(){return qt().memoizedState}function p3(n){for(var s=n.return;s!==null;){switch(s.tag){case 24:case 3:var i=io();n=Er(i);var l=Sr(s,n,i);l!==null&&(Fn(l,s,i),sd(l,s,i)),s={cache:Gp()},n.payload=s;return}s=s.return}}function g3(n,s,i){var l=io();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},_m(n)?V0(s,i):(i=Mp(n,s,i,l),i!==null&&(Fn(i,n,l),U0(i,s,l)))}function N0(n,s,i){var l=io();dd(n,s,i,l)}function dd(n,s,i,l){var u={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(_m(n))V0(s,u);else{var p=n.alternate;if(n.lanes===0&&(p===null||p.lanes===0)&&(p=s.lastRenderedReducer,p!==null))try{var y=s.lastRenderedState,S=p(y,i);if(u.hasEagerState=!0,u.eagerState=S,to(S,y))return nm(n,s,u,0),Et===null&&tm(),!1}catch{}finally{}if(i=Mp(n,s,u,l),i!==null)return Fn(i,n,l),U0(i,s,l),!0}return!1}function pg(n,s,i,l){if(l={lane:2,revertLane:Xg(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},_m(n)){if(s)throw Error(o(479))}else s=Mp(n,i,l,2),s!==null&&Fn(s,n,2)}function _m(n){var s=n.alternate;return n===Xe||s!==null&&s===Xe}function V0(n,s){Ni=fm=!0;var i=n.pending;i===null?s.next=s:(s.next=i.next,i.next=s),n.pending=s}function U0(n,s,i){if((i&4194048)!==0){var l=s.lanes;l&=n.pendingLanes,i|=l,s.lanes=i,Tl(n,i)}}var cd={readContext:bn,use:bm,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useLayoutEffect:Lt,useInsertionEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useSyncExternalStore:Lt,useId:Lt,useHostTransitionStatus:Lt,useFormState:Lt,useActionState:Lt,useOptimistic:Lt,useMemoCache:Lt,useCacheRefresh:Lt};cd.useEffectEvent=Lt;var B0={readContext:bn,use:bm,useCallback:function(n,s){return On().memoizedState=[n,s===void 0?null:s],n},useContext:bn,useEffect:w0,useImperativeHandle:function(n,s,i){i=i!=null?i.concat([n]):null,xm(4194308,4,C0.bind(null,s,n),i)},useLayoutEffect:function(n,s){return xm(4194308,4,n,s)},useInsertionEffect:function(n,s){xm(4,2,n,s)},useMemo:function(n,s){var i=On();s=s===void 0?null:s;var l=n();if(Fa){po(!0);try{n()}finally{po(!1)}}return i.memoizedState=[l,s],l},useReducer:function(n,s,i){var l=On();if(i!==void 0){var u=i(s);if(Fa){po(!0);try{i(s)}finally{po(!1)}}}else u=s;return l.memoizedState=l.baseState=u,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:u},l.queue=n,n=n.dispatch=g3.bind(null,Xe,n),[l.memoizedState,n]},useRef:function(n){var s=On();return n={current:n},s.memoizedState=n},useState:function(n){n=ag(n);var s=n.queue,i=N0.bind(null,Xe,s);return s.dispatch=i,[n.memoizedState,i]},useDebugValue:dg,useDeferredValue:function(n,s){var i=On();return cg(i,n,s)},useTransition:function(){var n=ag(!1);return n=I0.bind(null,Xe,n.queue,!0,!1),On().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,s,i){var l=Xe,u=On();if(rt){if(i===void 0)throw Error(o(407));i=i()}else{if(i=s(),Et===null)throw Error(o(349));(nt&127)!==0||i0(l,s,i)}u.memoizedState=i;var p={value:i,getSnapshot:s};return u.queue=p,w0(d0.bind(null,l,p,n),[n]),l.flags|=2048,Ui(9,{destroy:void 0},l0.bind(null,l,p,i,s),null),i},useId:function(){var n=On(),s=Et.identifierPrefix;if(rt){var i=ps,l=us;i=(l&~(1<<32-Ut(l)-1)).toString(32)+i,s="_"+s+"R_"+i,i=hm++,0<i&&(s+="H"+i.toString(32)),s+="_"}else i=i3++,s="_"+s+"r_"+i.toString(32)+"_";return n.memoizedState=s},useHostTransitionStatus:ug,useFormState:b0,useActionState:b0,useOptimistic:function(n){var s=On();s.memoizedState=s.baseState=n;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=i,s=pg.bind(null,Xe,!0,i),i.dispatch=s,[n,s]},useMemoCache:og,useCacheRefresh:function(){return On().memoizedState=p3.bind(null,Xe)},useEffectEvent:function(n){var s=On(),i={impl:n};return s.memoizedState=i,function(){if((mt&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},gg={readContext:bn,use:bm,useCallback:D0,useContext:bn,useEffect:lg,useImperativeHandle:R0,useInsertionEffect:S0,useLayoutEffect:k0,useMemo:M0,useReducer:ym,useRef:_0,useState:function(){return ym(Us)},useDebugValue:dg,useDeferredValue:function(n,s){var i=qt();return T0(i,yt.memoizedState,n,s)},useTransition:function(){var n=ym(Us)[0],s=qt().memoizedState;return[typeof n=="boolean"?n:ld(n),s]},useSyncExternalStore:a0,useId:z0,useHostTransitionStatus:ug,useFormState:y0,useActionState:y0,useOptimistic:function(n,s){var i=qt();return u0(i,yt,n,s)},useMemoCache:og,useCacheRefresh:L0};gg.useEffectEvent=E0;var G0={readContext:bn,use:bm,useCallback:D0,useContext:bn,useEffect:lg,useImperativeHandle:R0,useInsertionEffect:S0,useLayoutEffect:k0,useMemo:M0,useReducer:rg,useRef:_0,useState:function(){return rg(Us)},useDebugValue:dg,useDeferredValue:function(n,s){var i=qt();return yt===null?cg(i,n,s):T0(i,yt.memoizedState,n,s)},useTransition:function(){var n=rg(Us)[0],s=qt().memoizedState;return[typeof n=="boolean"?n:ld(n),s]},useSyncExternalStore:a0,useId:z0,useHostTransitionStatus:ug,useFormState:A0,useActionState:A0,useOptimistic:function(n,s){var i=qt();return yt!==null?u0(i,yt,n,s):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:og,useCacheRefresh:L0};G0.useEffectEvent=E0;function fg(n,s,i,l){s=n.memoizedState,i=i(l,s),i=i==null?s:E({},s,i),n.memoizedState=i,n.lanes===0&&(n.updateQueue.baseState=i)}var hg={enqueueSetState:function(n,s,i){n=n._reactInternals;var l=io(),u=Er(l);u.payload=s,i!=null&&(u.callback=i),s=Sr(n,u,l),s!==null&&(Fn(s,n,l),sd(s,n,l))},enqueueReplaceState:function(n,s,i){n=n._reactInternals;var l=io(),u=Er(l);u.tag=1,u.payload=s,i!=null&&(u.callback=i),s=Sr(n,u,l),s!==null&&(Fn(s,n,l),sd(s,n,l))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var i=io(),l=Er(i);l.tag=2,s!=null&&(l.callback=s),s=Sr(n,l,i),s!==null&&(Fn(s,n,i),sd(s,n,i))}};function q0(n,s,i,l,u,p,y){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(l,p,y):s.prototype&&s.prototype.isPureReactComponent?!Yl(i,l)||!Yl(u,p):!0}function F0(n,s,i,l){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(i,l),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(i,l),s.state!==n&&hg.enqueueReplaceState(s,s.state,null)}function ja(n,s){var i=s;if("ref"in s){i={};for(var l in s)l!=="ref"&&(i[l]=s[l])}if(n=n.defaultProps){i===s&&(i=E({},i));for(var u in n)i[u]===void 0&&(i[u]=n[u])}return i}function j0(n){em(n)}function X0(n){console.error(n)}function H0(n){em(n)}function wm(n,s){try{var i=n.onUncaughtError;i(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function W0(n,s,i){try{var l=n.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function vg(n,s,i){return i=Er(i),i.tag=3,i.payload={element:null},i.callback=function(){wm(n,s)},i}function K0(n){return n=Er(n),n.tag=3,n}function Q0(n,s,i,l){var u=i.type.getDerivedStateFromError;if(typeof u=="function"){var p=l.value;n.payload=function(){return u(p)},n.callback=function(){W0(s,i,l)}}var y=i.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(n.callback=function(){W0(s,i,l),typeof u!="function"&&(Tr===null?Tr=new Set([this]):Tr.add(this));var S=l.stack;this.componentDidCatch(l.value,{componentStack:S!==null?S:""})})}function f3(n,s,i,l,u){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=i.alternate,s!==null&&Ti(s,i,u,!0),i=oo.current,i!==null){switch(i.tag){case 31:case 13:return wo===null?zm():i.alternate===null&&Nt===0&&(Nt=3),i.flags&=-257,i.flags|=65536,i.lanes=u,l===cm?i.flags|=16384:(s=i.updateQueue,s===null?i.updateQueue=new Set([l]):s.add(l),qg(n,l,u)),!1;case 22:return i.flags|=65536,l===cm?i.flags|=16384:(s=i.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=s):(i=s.retryQueue,i===null?s.retryQueue=new Set([l]):i.add(l)),qg(n,l,u)),!1}throw Error(o(435,i.tag))}return qg(n,l,u),zm(),!1}if(rt)return s=oo.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=u,l!==Lp&&(n=Error(o(422),{cause:l}),Zl(yo(n,i)))):(l!==Lp&&(s=Error(o(423),{cause:l}),Zl(yo(s,i))),n=n.current.alternate,n.flags|=65536,u&=-u,n.lanes|=u,l=yo(l,i),u=vg(n.stateNode,l,u),Wp(n,u),Nt!==4&&(Nt=2)),!1;var p=Error(o(520),{cause:l});if(p=yo(p,i),bd===null?bd=[p]:bd.push(p),Nt!==4&&(Nt=2),s===null)return!0;l=yo(l,i),i=s;do{switch(i.tag){case 3:return i.flags|=65536,n=u&-u,i.lanes|=n,n=vg(i.stateNode,l,n),Wp(i,n),!1;case 1:if(s=i.type,p=i.stateNode,(i.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Tr===null||!Tr.has(p))))return i.flags|=65536,u&=-u,i.lanes|=u,u=K0(u),Q0(u,n,i,l),Wp(i,u),!1}i=i.return}while(i!==null);return!1}var bg=Error(o(461)),$t=!1;function yn(n,s,i,l){s.child=n===null?Z1(s,null,i,l):qa(s,n.child,i,l)}function Y0(n,s,i,l,u){i=i.render;var p=s.ref;if("ref"in l){var y={};for(var S in l)S!=="ref"&&(y[S]=l[S])}else y=l;return Va(s),l=Zp(n,s,i,y,p,u),S=eg(),n!==null&&!$t?(tg(n,s,u),Bs(n,s,u)):(rt&&S&&Pp(s),s.flags|=1,yn(n,s,l,u),s.child)}function $0(n,s,i,l,u){if(n===null){var p=i.type;return typeof p=="function"&&!Tp(p)&&p.defaultProps===void 0&&i.compare===null?(s.tag=15,s.type=p,J0(n,s,p,l,u)):(n=sm(i.type,null,l,s,s.mode,u),n.ref=s.ref,n.return=s,s.child=n)}if(p=n.child,!kg(n,u)){var y=p.memoizedProps;if(i=i.compare,i=i!==null?i:Yl,i(y,l)&&n.ref===s.ref)return Bs(n,s,u)}return s.flags|=1,n=Ps(p,l),n.ref=s.ref,n.return=s,s.child=n}function J0(n,s,i,l,u){if(n!==null){var p=n.memoizedProps;if(Yl(p,l)&&n.ref===s.ref)if($t=!1,s.pendingProps=l=p,kg(n,u))(n.flags&131072)!==0&&($t=!0);else return s.lanes=n.lanes,Bs(n,s,u)}return yg(n,s,i,l,u)}function Z0(n,s,i,l){var u=l.children,p=n!==null?n.memoizedState:null;if(n===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((s.flags&128)!==0){if(p=p!==null?p.baseLanes|i:i,n!==null){for(l=s.child=n.child,u=0;l!==null;)u=u|l.lanes|l.childLanes,l=l.sibling;l=u&~p}else l=0,s.child=null;return ev(n,s,p,i,l)}if((i&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},n!==null&&lm(s,p!==null?p.cachePool:null),p!==null?n0(s,p):Qp(),o0(s);else return l=s.lanes=536870912,ev(n,s,p!==null?p.baseLanes|i:i,i,l)}
vendor: 8,565 bytes, line 48
48else p!==null?(lm(s,p.cachePool),n0(s,p),Cr(),s.memoizedState=null):(n!==null&&lm(s,null),Qp(),Cr());return yn(n,s,u,i),s.child}function md(n,s){return n!==null&&n.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function ev(n,s,i,l,u){var p=Fp();return p=p===null?null:{parent:Qt._currentValue,pool:p},s.memoizedState={baseLanes:i,cachePool:p},n!==null&&lm(s,null),Qp(),o0(s),n!==null&&Ti(n,s,l,!0),s.childLanes=u,null}function Em(n,s){return s=km({mode:s.mode,children:s.children},n.mode),s.ref=n.ref,n.child=s,s.return=n,s}function tv(n,s,i){return qa(s,n.child,null,i),n=Em(s,s.pendingProps),n.flags|=2,so(s),s.memoizedState=null,n}function h3(n,s,i){var l=s.pendingProps,u=(s.flags&128)!==0;if(s.flags&=-129,n===null){if(rt){if(l.mode==="hidden")return n=Em(s,l),s.lanes=536870912,md(null,n);if($p(s),(n=St)?(n=pb(n,_o),n=n!==null&&n.data==="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:yr!==null?{id:us,overflow:ps}:null,retryLane:536870912,hydrationErrors:null},i=V1(n),i.return=s,s.child=i,vn=s,St=null)):n=null,n===null)throw Ar(s);return s.lanes=536870912,null}return Em(s,l)}var p=n.memoizedState;if(p!==null){var y=p.dehydrated;if($p(s),u)if(s.flags&256)s.flags&=-257,s=tv(n,s,i);else if(s.memoizedState!==null)s.child=n.child,s.flags|=128,s=null;else throw Error(o(558));else if($t||Ti(n,s,i,!1),u=(i&n.childLanes)!==0,$t||u){if(l=Et,l!==null&&(y=Il(l,i),y!==0&&y!==p.retryLane))throw p.retryLane=y,Pa(n,y),Fn(l,n,y),bg;zm(),s=tv(n,s,i)}else n=p.treeContext,St=Eo(y.nextSibling),vn=s,rt=!0,xr=null,_o=!1,n!==null&&G1(s,n),s=Em(s,l),s.flags|=4096;return s}return n=Ps(n.child,{mode:l.mode,children:l.children}),n.ref=s.ref,s.child=n,n.return=s,n}function Sm(n,s){var i=s.ref;if(i===null)n!==null&&n.ref!==null&&(s.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(n===null||n.ref!==i)&&(s.flags|=4194816)}}function yg(n,s,i,l,u){return Va(s),i=Zp(n,s,i,l,void 0,u),l=eg(),n!==null&&!$t?(tg(n,s,u),Bs(n,s,u)):(rt&&l&&Pp(s),s.flags|=1,yn(n,s,i,u),s.child)}function nv(n,s,i,l,u,p){return Va(s),s.updateQueue=null,i=r0(s,l,i,u),s0(n),l=eg(),n!==null&&!$t?(tg(n,s,p),Bs(n,s,p)):(rt&&l&&Pp(s),s.flags|=1,yn(n,s,i,p),s.child)}function ov(n,s,i,l,u){if(Va(s),s.stateNode===null){var p=Ci,y=i.contextType;typeof y=="object"&&y!==null&&(p=bn(y)),p=new i(l,p),s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=hg,s.stateNode=p,p._reactInternals=s,p=s.stateNode,p.props=l,p.state=s.memoizedState,p.refs={},Xp(s),y=i.contextType,p.context=typeof y=="object"&&y!==null?bn(y):Ci,p.state=s.memoizedState,y=i.getDerivedStateFromProps,typeof y=="function"&&(fg(s,i,y,l),p.state=s.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(y=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),y!==p.state&&hg.enqueueReplaceState(p,p.state,null),ad(s,l,p,u),rd(),p.state=s.memoizedState),typeof p.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(n===null){p=s.stateNode;var S=s.memoizedProps,I=ja(i,S);p.props=I;var j=p.context,J=i.contextType;y=Ci,typeof J=="object"&&J!==null&&(y=bn(J));var re=i.getDerivedStateFromProps;J=typeof re=="function"||typeof p.getSnapshotBeforeUpdate=="function",S=s.pendingProps!==S,J||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(S||j!==y)&&F0(s,p,l,y),wr=!1;var X=s.memoizedState;p.state=X,ad(s,l,p,u),rd(),j=s.memoizedState,S||X!==j||wr?(typeof re=="function"&&(fg(s,i,re,l),j=s.memoizedState),(I=wr||q0(s,i,I,l,X,j,y))?(J||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(s.flags|=4194308)):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=j),p.props=l,p.state=j,p.context=y,l=I):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{p=s.stateNode,Hp(n,s),y=s.memoizedProps,J=ja(i,y),p.props=J,re=s.pendingProps,X=p.context,j=i.contextType,I=Ci,typeof j=="object"&&j!==null&&(I=bn(j)),S=i.getDerivedStateFromProps,(j=typeof S=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(y!==re||X!==I)&&F0(s,p,l,I),wr=!1,X=s.memoizedState,p.state=X,ad(s,l,p,u),rd();var Q=s.memoizedState;y!==re||X!==Q||wr||n!==null&&n.dependencies!==null&&am(n.dependencies)?(typeof S=="function"&&(fg(s,i,S,l),Q=s.memoizedState),(J=wr||q0(s,i,J,l,X,Q,I)||n!==null&&n.dependencies!==null&&am(n.dependencies))?(j||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,Q,I),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,Q,I)),typeof p.componentDidUpdate=="function"&&(s.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof p.componentDidUpdate!="function"||y===n.memoizedProps&&X===n.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||y===n.memoizedProps&&X===n.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=Q),p.props=l,p.state=Q,p.context=I,l=J):(typeof p.componentDidUpdate!="function"||y===n.memoizedProps&&X===n.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||y===n.memoizedProps&&X===n.memoizedState||(s.flags|=1024),l=!1)}return p=l,Sm(n,s),l=(s.flags&128)!==0,p||l?(p=s.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:p.render(),s.flags|=1,n!==null&&l?(s.child=qa(s,n.child,null,u),s.child=qa(s,null,i,u)):yn(n,s,i,u),s.memoizedState=p.state,n=s.child):n=Bs(n,s,u),n}function sv(n,s,i,l){return La(),s.flags|=256,yn(n,s,i,l),s.child}var xg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ag(n){return{baseLanes:n,cachePool:W1()}}function _g(n,s,i){return n=n!==null?n.childLanes&~i:0,s&&(n|=ao),n}function rv(n,s,i){var l=s.pendingProps,u=!1,p=(s.flags&128)!==0,y;if((y=p)||(y=n!==null&&n.memoizedState===null?!1:(Gt.current&2)!==0),y&&(u=!0,s.flags&=-129),y=(s.flags&32)!==0,s.flags&=-33,n===null){if(rt){if(u?kr(s):Cr(),(n=St)?(n=pb(n,_o),n=n!==null&&n.data!=="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:yr!==null?{id:us,overflow:ps}:null,retryLane:536870912,hydrationErrors:null},i=V1(n),i.return=s,s.child=i,vn=s,St=null)):n=null,n===null)throw Ar(s);return sf(n)?s.lanes=32:s.lanes=536870912,null}var S=l.children;return l=l.fallback,u?(Cr(),u=s.mode,S=km({mode:"hidden",children:S},u),l=za(l,u,i,null),S.return=s,l.return=s,S.sibling=l,s.child=S,l=s.child,l.memoizedState=Ag(i),l.childLanes=_g(n,y,i),s.memoizedState=xg,md(null,l)):(kr(s),wg(s,S))}var I=n.memoizedState;if(I!==null&&(S=I.dehydrated,S!==null)){if(p)s.flags&256?(kr(s),s.flags&=-257,s=Eg(n,s,i)):s.memoizedState!==null?(Cr(),s.child=n.child,s.flags|=128,s=null):(Cr(),S=l.fallback,u=s.mode,l=km({mode:"visible",children:l.children},u),S=za(S,u,i,null),S.flags|=2,l.return=s,S.return=s,l.sibling=S,s.child=l,qa(s,n.child,null,i),l=s.child,l.memoizedState=Ag(i),l.childLanes=_g(n,y,i),s.memoizedState=xg,s=md(null,l));else if(kr(s),sf(S)){if(y=S.nextSibling&&S.nextSibling.dataset,y)var j=y.dgst;y=j,l=Error(o(419)),l.stack="",l.digest=y,Zl({value:l,source:null,stack:null}),s=Eg(n,s,i)}else if($t||Ti(n,s,i,!1),y=(i&n.childLanes)!==0,$t||y){if(y=Et,y!==null&&(l=Il(y,i),l!==0&&l!==I.retryLane))throw I.retryLane=l,Pa(n,l),Fn(y,n,l),bg;of(S)||zm(),s=Eg(n,s,i)}else of(S)?(s.flags|=192,s.child=n.child,s=null):(n=I.treeContext,St=Eo(S.nextSibling),vn=s,rt=!0,xr=null,_o=!1,n!==null&&G1(s,n),s=wg(s,l.children),s.flags|=4096);return s}return u?(Cr(),S=l.fallback,u=s.mode,I=n.child,j=I.sibling,l=Ps(I,{mode:"hidden",children:l.children}),l.subtreeFlags=I.subtreeFlags&65011712,j!==null?S=Ps(j,S):(S=za(S,u,i,null),S.flags|=2),S.return=s,l.return=s,l.sibling=S,s.child=l,md(null,l),l=s.child,S=n.child.memoizedState,S===null?S=Ag(i):(u=S.cachePool,u!==null?(I=Qt._currentValue,u=u.parent!==I?{parent:I,pool:I}:u):u=W1(),S={baseLanes:S.baseLanes|i,cachePool:u}),l.memoizedState=S,l.childLanes=_g(n,y,i),s.memoizedState=xg,md(n.
vendor: 8,477 bytes, line 48
48child,l)):(kr(s),i=n.child,n=i.sibling,i=Ps(i,{mode:"visible",children:l.children}),i.return=s,i.sibling=null,n!==null&&(y=s.deletions,y===null?(s.deletions=[n],s.flags|=16):y.push(n)),s.child=i,s.memoizedState=null,i)}function wg(n,s){return s=km({mode:"visible",children:s},n.mode),s.return=n,n.child=s}function km(n,s){return n=no(22,n,null,s),n.lanes=0,n}function Eg(n,s,i){return qa(s,n.child,null,i),n=wg(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function av(n,s,i){n.lanes|=s;var l=n.alternate;l!==null&&(l.lanes|=s),Up(n.return,s,i)}function Sg(n,s,i,l,u,p){var y=n.memoizedState;y===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:u,treeForkCount:p}:(y.isBackwards=s,y.rendering=null,y.renderingStartTime=0,y.last=l,y.tail=i,y.tailMode=u,y.treeForkCount=p)}function iv(n,s,i){var l=s.pendingProps,u=l.revealOrder,p=l.tail;l=l.children;var y=Gt.current,S=(y&2)!==0;if(S?(y=y&1|2,s.flags|=128):y&=1,me(Gt,y),yn(n,s,l,i),l=rt?Jl:0,!S&&n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&av(n,i,s);else if(n.tag===19)av(n,i,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(u){case"forwards":for(i=s.child,u=null;i!==null;)n=i.alternate,n!==null&&gm(n)===null&&(u=i),i=i.sibling;i=u,i===null?(u=s.child,s.child=null):(u=i.sibling,i.sibling=null),Sg(s,!1,u,i,p,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,u=s.child,s.child=null;u!==null;){if(n=u.alternate,n!==null&&gm(n)===null){s.child=u;break}n=u.sibling,u.sibling=i,i=u,u=n}Sg(s,!0,i,null,p,l);break;case"together":Sg(s,!1,null,null,void 0,l);break;default:s.memoizedState=null}return s.child}function Bs(n,s,i){if(n!==null&&(s.dependencies=n.dependencies),Mr|=s.lanes,(i&s.childLanes)===0)if(n!==null){if(Ti(n,s,i,!1),(i&s.childLanes)===0)return null}else return null;if(n!==null&&s.child!==n.child)throw Error(o(153));if(s.child!==null){for(n=s.child,i=Ps(n,n.pendingProps),s.child=i,i.return=s;n.sibling!==null;)n=n.sibling,i=i.sibling=Ps(n,n.pendingProps),i.return=s;i.sibling=null}return s.child}function kg(n,s){return(n.lanes&s)!==0?!0:(n=n.dependencies,!!(n!==null&&am(n)))}function v3(n,s,i){switch(s.tag){case 3:Pt(s,s.stateNode.containerInfo),_r(s,Qt,n.memoizedState.cache),La();break;case 27:case 5:Ho(s);break;case 4:Pt(s,s.stateNode.containerInfo);break;case 10:_r(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,$p(s),null;break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(kr(s),s.flags|=128,null):(i&s.child.childLanes)!==0?rv(n,s,i):(kr(s),n=Bs(n,s,i),n!==null?n.sibling:null);kr(s);break;case 19:var u=(n.flags&128)!==0;if(l=(i&s.childLanes)!==0,l||(Ti(n,s,i,!1),l=(i&s.childLanes)!==0),u){if(l)return iv(n,s,i);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),me(Gt,Gt.current),l)break;return null;case 22:return s.lanes=0,Z0(n,s,i,s.pendingProps);case 24:_r(s,Qt,n.memoizedState.cache)}return Bs(n,s,i)}function lv(n,s,i){if(n!==null)if(n.memoizedProps!==s.pendingProps)$t=!0;else{if(!kg(n,i)&&(s.flags&128)===0)return $t=!1,v3(n,s,i);$t=(n.flags&131072)!==0}else $t=!1,rt&&(s.flags&1048576)!==0&&B1(s,Jl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var l=s.pendingProps;if(n=Ba(s.elementType),s.type=n,typeof n=="function")Tp(n)?(l=ja(n,l),s.tag=1,s=ov(null,s,n,l,i)):(s.tag=0,s=yg(null,s,n,l,i));else{if(n!=null){var u=n.$$typeof;if(u===tt){s.tag=11,s=Y0(null,s,n,l,i);break e}else if(u===w){s.tag=14,s=$0(null,s,n,l,i);break e}}throw s=_e(n)||n,Error(o(306,s,""))}}return s;case 0:return yg(n,s,s.type,s.pendingProps,i);case 1:return l=s.type,u=ja(l,s.pendingProps),ov(n,s,l,u,i);case 3:e:{if(Pt(s,s.stateNode.containerInfo),n===null)throw Error(o(387));l=s.pendingProps;var p=s.memoizedState;u=p.element,Hp(n,s),ad(s,l,null,i);var y=s.memoizedState;if(l=y.cache,_r(s,Qt,l),l!==p.cache&&Bp(s,[Qt],i,!0),rd(),l=y.element,p.isDehydrated)if(p={element:l,isDehydrated:!1,cache:y.cache},s.updateQueue.baseState=p,s.memoizedState=p,s.flags&256){s=sv(n,s,l,i);break e}else if(l!==u){u=yo(Error(o(424)),s),Zl(u),s=sv(n,s,l,i);break e}else{switch(n=s.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(St=Eo(n.firstChild),vn=s,rt=!0,xr=null,_o=!0,i=Z1(s,null,l,i),s.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(La(),l===u){s=Bs(n,s,i);break e}yn(n,s,l,i)}s=s.child}return s;case 26:return Sm(n,s),n===null?(i=yb(s.type,null,s.pendingProps,null))?s.memoizedState=i:rt||(i=s.type,n=s.pendingProps,l=qm(Ue.current).createElement(i),l[Ht]=s,l[dn]=n,xn(l,i,n),Wt(l),s.stateNode=l):s.memoizedState=yb(s.type,n.memoizedProps,s.pendingProps,n.memoizedState),null;case 27:return Ho(s),n===null&&rt&&(l=s.stateNode=hb(s.type,s.pendingProps,Ue.current),vn=s,_o=!0,u=St,zr(s.type)?(rf=u,St=Eo(l.firstChild)):St=u),yn(n,s,s.pendingProps.children,i),Sm(n,s),n===null&&(s.flags|=4194304),s.child;case 5:return n===null&&rt&&((u=l=St)&&(l=W3(l,s.type,s.pendingProps,_o),l!==null?(s.stateNode=l,vn=s,St=Eo(l.firstChild),_o=!1,u=!0):u=!1),u||Ar(s)),Ho(s),u=s.type,p=s.pendingProps,y=n!==null?n.memoizedProps:null,l=p.children,ef(u,p)?l=null:y!==null&&ef(u,y)&&(s.flags|=32),s.memoizedState!==null&&(u=Zp(n,s,l3,null,null,i),kd._currentValue=u),Sm(n,s),yn(n,s,l,i),s.child;case 6:return n===null&&rt&&((n=i=St)&&(i=K3(i,s.pendingProps,_o),i!==null?(s.stateNode=i,vn=s,St=null,n=!0):n=!1),n||Ar(s)),null;case 13:return rv(n,s,i);case 4:return Pt(s,s.stateNode.containerInfo),l=s.pendingProps,n===null?s.child=qa(s,null,l,i):yn(n,s,l,i),s.child;case 11:return Y0(n,s,s.type,s.pendingProps,i);case 7:return yn(n,s,s.pendingProps,i),s.child;case 8:return yn(n,s,s.pendingProps.children,i),s.child;case 12:return yn(n,s,s.pendingProps.children,i),s.child;case 10:return l=s.pendingProps,_r(s,s.type,l.value),yn(n,s,l.children,i),s.child;case 9:return u=s.type._context,l=s.pendingProps.children,Va(s),u=bn(u),l=l(u),s.flags|=1,yn(n,s,l,i),s.child;case 14:return $0(n,s,s.type,s.pendingProps,i);case 15:return J0(n,s,s.type,s.pendingProps,i);case 19:return iv(n,s,i);case 31:return h3(n,s,i);case 22:return Z0(n,s,i,s.pendingProps);case 24:return Va(s),l=bn(Qt),n===null?(u=Fp(),u===null&&(u=Et,p=Gp(),u.pooledCache=p,p.refCount++,p!==null&&(u.pooledCacheLanes|=i),u=p),s.memoizedState={parent:l,cache:u},Xp(s),_r(s,Qt,u)):((n.lanes&i)!==0&&(Hp(n,s),ad(s,null,null,i),rd()),u=n.memoizedState,p=s.memoizedState,u.parent!==l?(u={parent:l,cache:l},s.memoizedState=u,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=u),_r(s,Qt,l)):(l=p.cache,_r(s,Qt,l),l!==u.cache&&Bp(s,[Qt],i,!0))),yn(n,s,s.pendingProps.children,i),s.child;case 29:throw s.pendingProps}throw Error(o(156,s.tag))}function Gs(n){n.flags|=4}function Cg(n,s,i,l,u){if((s=(n.mode&32)!==0)&&(s=!1),s){if(n.flags|=16777216,(u&335544128)===u)if(n.stateNode.complete)n.flags|=8192;else if(zv())n.flags|=8192;else throw Ga=cm,jp}else n.flags&=-16777217}function dv(n,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Eb(s))if(zv())n.flags|=8192;else throw Ga=cm,jp}function Cm(n,s){s!==null&&(n.flags|=4),n.flags&16384&&(s=n.tag!==22?Oc():536870912,n.lanes|=s,Fi|=s)}function ud(n,s){if(!rt)switch(n.tailMode){case"hidden":s=n.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?n.tail=null:i.sibling=null;break;case"collapsed":i=n.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:l.sibling=null}}function kt(n){var s=n.alternate!==null&&n.alternate.child===n.child,i=0,l=0;if(s)for(var u=n.child;u!==null;)i|=u.lanes|u.childLanes,l|=u.subtreeFlags&65011712,l|=u.flags&65011712,u.return=n,u=u.sibling;else for(u=n.child;u!==null;)i|=u.lanes|u.childLanes,l|=u.subtreeFlags,l|=u.flags,u.return=n,u=u.sibling;return n.subtreeFlags|=l,n.childLanes=i,s}function b3(n,s,i){var l=s.pendingProps;switch(zp(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(s),null;case 1:return kt(s),null;case 3:return i=s.stateNode,l=null,n!==null&&(l=n.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),Ns(Qt),wt(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Mi(s)?G
vendor: 4,884 bytes, line 48
48s(s):n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Np())),kt(s),null;case 26:var u=s.type,p=s.memoizedState;return n===null?(Gs(s),p!==null?(kt(s),dv(s,p)):(kt(s),Cg(s,u,null,l,i))):p?p!==n.memoizedState?(Gs(s),kt(s),dv(s,p)):(kt(s),s.flags&=-16777217):(n=n.memoizedProps,n!==l&&Gs(s),kt(s),Cg(s,u,n,l,i)),null;case 27:if(Cs(s),i=Ue.current,u=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==l&&Gs(s);else{if(!l){if(s.stateNode===null)throw Error(o(166));return kt(s),null}n=be.current,Mi(s)?q1(s):(n=hb(u,l,i),s.stateNode=n,Gs(s))}return kt(s),null;case 5:if(Cs(s),u=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==l&&Gs(s);else{if(!l){if(s.stateNode===null)throw Error(o(166));return kt(s),null}if(p=be.current,Mi(s))q1(s);else{var y=qm(Ue.current);switch(p){case 1:p=y.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:p=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":p=y.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":p=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":p=y.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof l.is=="string"?y.createElement("select",{is:l.is}):y.createElement("select"),l.multiple?p.multiple=!0:l.size&&(p.size=l.size);break;default:p=typeof l.is=="string"?y.createElement(u,{is:l.is}):y.createElement(u)}}p[Ht]=s,p[dn]=l;e:for(y=s.child;y!==null;){if(y.tag===5||y.tag===6)p.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===s)break e;for(;y.sibling===null;){if(y.return===null||y.return===s)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}s.stateNode=p;e:switch(xn(p,u,l),u){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Gs(s)}}return kt(s),Cg(s,s.type,n===null?null:n.memoizedProps,s.pendingProps,i),null;case 6:if(n&&s.stateNode!=null)n.memoizedProps!==l&&Gs(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(o(166));if(n=Ue.current,Mi(s)){if(n=s.stateNode,i=s.memoizedProps,l=null,u=vn,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}n[Ht]=s,n=!!(n.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||rb(n.nodeValue,i)),n||Ar(s,!0)}else n=qm(n).createTextNode(l),n[Ht]=s,s.stateNode=n}return kt(s),null;case 31:if(i=s.memoizedState,n===null||n.memoizedState!==null){if(l=Mi(s),i!==null){if(n===null){if(!l)throw Error(o(318));if(n=s.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(557));n[Ht]=s}else La(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;kt(s),n=!1}else i=Np(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return s.flags&256?(so(s),s):(so(s),null);if((s.flags&128)!==0)throw Error(o(558))}return kt(s),null;case 13:if(l=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(u=Mi(s),l!==null&&l.dehydrated!==null){if(n===null){if(!u)throw Error(o(318));if(u=s.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[Ht]=s}else La(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;kt(s),u=!1}else u=Np(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=u),u=!0;if(!u)return s.flags&256?(so(s),s):(so(s),null)}return so(s),(s.flags&128)!==0?(s.lanes=i,s):(i=l!==null,n=n!==null&&n.memoizedState!==null,i&&(l=s.child,u=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(u=l.alternate.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==u&&(l.flags|=2048)),i!==n&&i&&(s.child.flags|=8192),Cm(s,s.updateQueue),kt(s),null);case 4:return wt(),n===null&&Qg(s.stateNode.containerInfo),kt(s),null;case 10:return Ns(s.type),kt(s),null;case 19:if(Z(Gt),l=s.memoizedState,l===null)return kt(s),null;if(u=(s.flags&128)!==0,p=l.rendering,p===null)if(u)ud(l,!1);else{if(Nt!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(p=gm(n),p!==null){for(s.flags|=128,ud(l,!1),n=p.updateQueue,s.updateQueue=n,Cm(s,n),s.subtreeFlags=0,n=i,i=s.child;i!==null;)N1(i,n),i=i.sibling;return me(Gt,Gt.current&1|2),rt&&zs(s,l.treeForkCount),s.child}n=n.sibling}l.tail!==null&&le()>Im&&(s.flags|=128,u=!0,ud(l,!1),s.lanes=4194304)}else{if(!u)if(n=gm(p),n!==null){if(s.flags|=128,u=!0,n=n.updateQueue,s.updateQueue=n,Cm(s,n),ud(l,!0),l.tail===null&&l.tailMode==="hidden"&&!p.alternate&&!rt)return kt(s),null}else 2*le()-l.renderingStartTime>Im&&i!==536870912&&(s.flags|=128,u=!0,ud(l,!1),s.lanes=4194304);l.isBackwards?(p.sibling=s.child,s.child=p):(n=l.last,n!==null?n.sibling=p:s.child=p,l.last=p)}return l.tail!==null?(n=l.tail,l.rendering=n,l.tail=n.sibling,l.renderingStartTime=le(),n.sibling=null,i=Gt.current,me(Gt,u?i&1|2
vendor: 9,043 bytes, line 48
48:i&1),rt&&zs(s,l.treeForkCount),n):(kt(s),null);case 22:case 23:return so(s),Yp(),l=s.memoizedState!==null,n!==null?n.memoizedState!==null!==l&&(s.flags|=8192):l&&(s.flags|=8192),l?(i&536870912)!==0&&(s.flags&128)===0&&(kt(s),s.subtreeFlags&6&&(s.flags|=8192)):kt(s),i=s.updateQueue,i!==null&&Cm(s,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),l=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),l!==i&&(s.flags|=2048),n!==null&&Z(Ua),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),s.memoizedState.cache!==i&&(s.flags|=2048),Ns(Qt),kt(s),null;case 25:return null;case 30:return null}throw Error(o(156,s.tag))}function y3(n,s){switch(zp(s),s.tag){case 1:return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return Ns(Qt),wt(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 26:case 27:case 5:return Cs(s),null;case 31:if(s.memoizedState!==null){if(so(s),s.alternate===null)throw Error(o(340));La()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 13:if(so(s),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(o(340));La()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return Z(Gt),null;case 4:return wt(),null;case 10:return Ns(s.type),null;case 22:case 23:return so(s),Yp(),n!==null&&Z(Ua),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 24:return Ns(Qt),null;case 25:return null;default:return null}}function cv(n,s){switch(zp(s),s.tag){case 3:Ns(Qt),wt();break;case 26:case 27:case 5:Cs(s);break;case 4:wt();break;case 31:s.memoizedState!==null&&so(s);break;case 13:so(s);break;case 19:Z(Gt);break;case 10:Ns(s.type);break;case 22:case 23:so(s),Yp(),n!==null&&Z(Ua);break;case 24:Ns(Qt)}}function pd(n,s){try{var i=s.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var u=l.next;i=u;do{if((i.tag&n)===n){l=void 0;var p=i.create,y=i.inst;l=p(),y.destroy=l}i=i.next}while(i!==u)}}catch(S){ht(s,s.return,S)}}function Rr(n,s,i){try{var l=s.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var p=u.next;l=p;do{if((l.tag&n)===n){var y=l.inst,S=y.destroy;if(S!==void 0){y.destroy=void 0,u=s;var I=i,j=S;try{j()}catch(J){ht(u,I,J)}}}l=l.next}while(l!==p)}}catch(J){ht(s,s.return,J)}}function mv(n){var s=n.updateQueue;if(s!==null){var i=n.stateNode;try{t0(s,i)}catch(l){ht(n,n.return,l)}}}function uv(n,s,i){i.props=ja(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(l){ht(n,s,l)}}function gd(n,s){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var l=n.stateNode;break;case 30:l=n.stateNode;break;default:l=n.stateNode}typeof i=="function"?n.refCleanup=i(l):i.current=l}}catch(u){ht(n,s,u)}}function gs(n,s){var i=n.ref,l=n.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(u){ht(n,s,u)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(u){ht(n,s,u)}else i.current=null}function pv(n){var s=n.type,i=n.memoizedProps,l=n.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(u){ht(n,n.return,u)}}function Rg(n,s,i){try{var l=n.stateNode;G3(l,n.type,i,s),l[dn]=s}catch(u){ht(n,n.return,u)}}function gv(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&zr(n.type)||n.tag===4}function Dg(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||gv(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&zr(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Mg(n,s,i){var l=n.tag;if(l===5||l===6)n=n.stateNode,s?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(n,s):(s=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,s.appendChild(n),i=i._reactRootContainer,i!=null||s.onclick!==null||(s.onclick=Po));else if(l!==4&&(l===27&&zr(n.type)&&(i=n.stateNode,s=null),n=n.child,n!==null))for(Mg(n,s,i),n=n.sibling;n!==null;)Mg(n,s,i),n=n.sibling}function Rm(n,s,i){var l=n.tag;if(l===5||l===6)n=n.stateNode,s?i.insertBefore(n,s):i.appendChild(n);else if(l!==4&&(l===27&&zr(n.type)&&(i=n.stateNode),n=n.child,n!==null))for(Rm(n,s,i),n=n.sibling;n!==null;)Rm(n,s,i),n=n.sibling}function fv(n){var s=n.stateNode,i=n.memoizedProps;try{for(var l=n.type,u=s.attributes;u.length;)s.removeAttributeNode(u[0]);xn(s,l,i),s[Ht]=n,s[dn]=i}catch(p){ht(n,n.return,p)}}var qs=!1,Jt=!1,Tg=!1,hv=typeof WeakSet=="function"?WeakSet:Set,mn=null;function x3(n,s){if(n=n.containerInfo,Jg=Qm,n=R1(n),Ep(n)){if("selectionStart"in n)var i={start:n.selectionStart,end:n.selectionEnd};else e:{i=(i=n.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var u=l.anchorOffset,p=l.focusNode;l=l.focusOffset;try{i.nodeType,p.nodeType}catch{i=null;break e}var y=0,S=-1,I=-1,j=0,J=0,re=n,X=null;t:for(;;){for(var Q;re!==i||u!==0&&re.nodeType!==3||(S=y+u),re!==p||l!==0&&re.nodeType!==3||(I=y+l),re.nodeType===3&&(y+=re.nodeValue.length),(Q=re.firstChild)!==null;)X=re,re=Q;for(;;){if(re===n)break t;if(X===i&&++j===u&&(S=y),X===p&&++J===l&&(I=y),(Q=re.nextSibling)!==null)break;re=X,X=re.parentNode}re=Q}i=S===-1||I===-1?null:{start:S,end:I}}else i=null}i=i||{start:0,end:0}}else i=null;for(Zg={focusedElem:n,selectionRange:i},Qm=!1,mn=s;mn!==null;)if(s=mn,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,mn=n;else for(;mn!==null;){switch(s=mn,p=s.alternate,n=s.flags,s.tag){case 0:if((n&4)!==0&&(n=s.updateQueue,n=n!==null?n.events:null,n!==null))for(i=0;i<n.length;i++)u=n[i],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&p!==null){n=void 0,i=s,u=p.memoizedProps,p=p.memoizedState,l=i.stateNode;try{var ye=ja(i.type,u);n=l.getSnapshotBeforeUpdate(ye,p),l.__reactInternalSnapshotBeforeUpdate=n}catch(Te){ht(i,i.return,Te)}}break;case 3:if((n&1024)!==0){if(n=s.stateNode.containerInfo,i=n.nodeType,i===9)nf(n);else if(i===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":nf(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(o(163))}if(n=s.sibling,n!==null){n.return=s.return,mn=n;break}mn=s.return}}function vv(n,s,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:js(n,i),l&4&&pd(5,i);break;case 1:if(js(n,i),l&4)if(n=i.stateNode,s===null)try{n.componentDidMount()}catch(y){ht(i,i.return,y)}else{var u=ja(i.type,s.memoizedProps);s=s.memoizedState;try{n.componentDidUpdate(u,s,n.__reactInternalSnapshotBeforeUpdate)}catch(y){ht(i,i.return,y)}}l&64&&mv(i),l&512&&gd(i,i.return);break;case 3:if(js(n,i),l&64&&(n=i.updateQueue,n!==null)){if(s=null,i.child!==null)switch(i.child.tag){case 27:case 5:s=i.child.stateNode;break;case 1:s=i.child.stateNode}try{t0(n,s)}catch(y){ht(i,i.return,y)}}break;case 27:s===null&&l&4&&fv(i);case 26:case 5:js(n,i),s===null&&l&4&&pv(i),l&512&&gd(i,i.return);break;case 12:js(n,i);break;case 31:js(n,i),l&4&&xv(n,i);break;case 13:js(n,i),l&4&&Av(n,i),l&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=D3.bind(null,i),Q3(n,i))));break;case 22:if(l=i.memoizedState!==null||qs,!l){s=s!==null&&s.memoizedState!==null||Jt,u=qs;var p=Jt;qs=l,(Jt=s)&&!p?Xs(n,i,(i.subtreeFlags&8772)!==0):js(n,i),qs=u,Jt=p}break;case 30:break;default:js(n,i)}}function bv(n){var s=n.alternate;s!==null&&(n.alternate=null,bv(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&pi(s)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Dt=null,Un=!1;function Fs(n,s,i){for(i=i.child;i!==null;)yv(n,s,i),i=i.sibling}function yv(n,s,i){if(fn&&typeof fn.onCommitFiberUnmount=="function")try{fn.onCommitFiberUnmount(Mo,i)}catch{}switch(i.tag){case 26:Jt||gs(i,s),Fs(n,s,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Jt||gs(i,s);var l=Dt,u=Un;zr(i.type)&&(Dt=i.stateNode,Un=!1),Fs(n,s,i),wd(i.stateNode),Dt=l,Un=u;break;case 5:Jt||gs(i,s);case 6:if(l=Dt,u=Un,Dt=null,Fs(n,s,i),Dt=l,Un=u,Dt!==null)if(Un)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(i.stateNode)}catch(p){ht(i,s,p)}else try{Dt.removeChild(i.stateNode)}catch(p){ht(i,s,p)}break;case 18:Dt!==null&&(Un?(n=Dt,mb(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),$i(n)):mb(Dt,i.stateNode));break;case 4:l=Dt,u=Un,Dt=i.stateNode.containerInfo,Un=!0,Fs(n,s,i),Dt=l,Un=u;break;case 0:case 11:case 14:case 15:Rr(2,i,s),Jt||Rr(4,i,s),Fs(n,s,i);break;case 1:Jt||(gs(i,s),l=i.stateNode,typeof l.componentWillUnmount=="function"&&uv(i,s,l)),Fs(n,s,i);break;case 21:Fs(n,s,i);break;case 22:Jt=(l=Jt)||i.memoizedState!==null,Fs(n,s,i),Jt=l;break;default:Fs(n,s,i)}}
vendor: 1,507 bytes, line 48
48function xv(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{$i(n)}catch(i){ht(s,s.return,i)}}}function Av(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{$i(n)}catch(i){ht(s,s.return,i)}}function A3(n){switch(n.tag){case 31:case 13:case 19:var s=n.stateNode;return s===null&&(s=n.stateNode=new hv),s;case 22:return n=n.stateNode,s=n._retryCache,s===null&&(s=n._retryCache=new hv),s;default:throw Error(o(435,n.tag))}}function Dm(n,s){var i=A3(n);s.forEach(function(l){if(!i.has(l)){i.add(l);var u=M3.bind(null,n,l);l.then(u,u)}})}function Bn(n,s){var i=s.deletions;if(i!==null)for(var l=0;l<i.length;l++){var u=i[l],p=n,y=s,S=y;e:for(;S!==null;){switch(S.tag){case 27:if(zr(S.type)){Dt=S.stateNode,Un=!1;break e}break;case 5:Dt=S.stateNode,Un=!1;break e;case 3:case 4:Dt=S.stateNode.containerInfo,Un=!0;break e}S=S.return}if(Dt===null)throw Error(o(160));yv(p,y,u),Dt=null,Un=!1,p=u.alternate,p!==null&&(p.return=null),u.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)_v(s,n),s=s.sibling}var Bo=null;function _v(n,s){var i=n.alternate,l=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Bn(s,n),Gn(n),l&4&&(Rr(3,n,n.return),pd(3,n),Rr(5,n,n.return));break;case 1:Bn(s,n),Gn(n),l&512&&(Jt||i===null||gs(i,i.return)),l&64&&qs&&(n=n.updateQueue,n!==null&&(l=n.callbacks,l!==null&&(i=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;
vendor: 11,788 bytes, line 48
48case 26:var u=Bo;if(Bn(s,n),Gn(n),l&512&&(Jt||i===null||gs(i,i.return)),l&4){var p=i!==null?i.memoizedState:null;if(l=n.memoizedState,i===null)if(l===null)if(n.stateNode===null){e:{l=n.type,i=n.memoizedProps,u=u.ownerDocument||u;t:switch(l){case"title":p=u.getElementsByTagName("title")[0],(!p||p[es]||p[Ht]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=u.createElement(l),u.head.insertBefore(p,u.querySelector("head > title"))),xn(p,l,i),p[Ht]=n,Wt(p),l=p;break e;case"link":var y=_b("link","href",u).get(l+(i.href||""));if(y){for(var S=0;S<y.length;S++)if(p=y[S],p.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&p.getAttribute("rel")===(i.rel==null?null:i.rel)&&p.getAttribute("title")===(i.title==null?null:i.title)&&p.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){y.splice(S,1);break t}}p=u.createElement(l),xn(p,l,i),u.head.appendChild(p);break;case"meta":if(y=_b("meta","content",u).get(l+(i.content||""))){for(S=0;S<y.length;S++)if(p=y[S],p.getAttribute("content")===(i.content==null?null:""+i.content)&&p.getAttribute("name")===(i.name==null?null:i.name)&&p.getAttribute("property")===(i.property==null?null:i.property)&&p.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&p.getAttribute("charset")===(i.charSet==null?null:i.charSet)){y.splice(S,1);break t}}p=u.createElement(l),xn(p,l,i),u.head.appendChild(p);break;default:throw Error(o(468,l))}p[Ht]=n,Wt(p),l=p}n.stateNode=l}else wb(u,n.type,n.stateNode);else n.stateNode=Ab(u,l,n.memoizedProps);else p!==l?(p===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):p.count--,l===null?wb(u,n.type,n.stateNode):Ab(u,l,n.memoizedProps)):l===null&&n.stateNode!==null&&Rg(n,n.memoizedProps,i.memoizedProps)}break;case 27:Bn(s,n),Gn(n),l&512&&(Jt||i===null||gs(i,i.return)),i!==null&&l&4&&Rg(n,n.memoizedProps,i.memoizedProps);break;case 5:if(Bn(s,n),Gn(n),l&512&&(Jt||i===null||gs(i,i.return)),n.flags&32){u=n.stateNode;try{Vn(u,"")}catch(ye){ht(n,n.return,ye)}}l&4&&n.stateNode!=null&&(u=n.memoizedProps,Rg(n,u,i!==null?i.memoizedProps:u)),l&1024&&(Tg=!0);break;case 6:if(Bn(s,n),Gn(n),l&4){if(n.stateNode===null)throw Error(o(162));l=n.memoizedProps,i=n.stateNode;try{i.nodeValue=l}catch(ye){ht(n,n.return,ye)}}break;case 3:if(Xm=null,u=Bo,Bo=Fm(s.containerInfo),Bn(s,n),Bo=u,Gn(n),l&4&&i!==null&&i.memoizedState.isDehydrated)try{$i(s.containerInfo)}catch(ye){ht(n,n.return,ye)}Tg&&(Tg=!1,wv(n));break;case 4:l=Bo,Bo=Fm(n.stateNode.containerInfo),Bn(s,n),Gn(n),Bo=l;break;case 12:Bn(s,n),Gn(n);break;case 31:Bn(s,n),Gn(n),l&4&&(l=n.updateQueue,l!==null&&(n.updateQueue=null,Dm(n,l)));break;case 13:Bn(s,n),Gn(n),n.child.flags&8192&&n.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Tm=le()),l&4&&(l=n.updateQueue,l!==null&&(n.updateQueue=null,Dm(n,l)));break;case 22:u=n.memoizedState!==null;var I=i!==null&&i.memoizedState!==null,j=qs,J=Jt;if(qs=j||u,Jt=J||I,Bn(s,n),Jt=J,qs=j,Gn(n),l&8192)e:for(s=n.stateNode,s._visibility=u?s._visibility&-2:s._visibility|1,u&&(i===null||I||qs||Jt||Xa(n)),i=null,s=n;;){if(s.tag===5||s.tag===26){if(i===null){I=i=s;try{if(p=I.stateNode,u)y=p.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{S=I.stateNode;var re=I.memoizedProps.style,X=re!=null&&re.hasOwnProperty("display")?re.display:null;S.style.display=X==null||typeof X=="boolean"?"":(""+X).trim()}}catch(ye){ht(I,I.return,ye)}}}else if(s.tag===6){if(i===null){I=s;try{I.stateNode.nodeValue=u?"":I.memoizedProps}catch(ye){ht(I,I.return,ye)}}}else if(s.tag===18){if(i===null){I=s;try{var Q=I.stateNode;u?ub(Q,!0):ub(I.stateNode,!1)}catch(ye){ht(I,I.return,ye)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===n)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break e;for(;s.sibling===null;){if(s.return===null||s.return===n)break e;i===s&&(i=null),s=s.return}i===s&&(i=null),s.sibling.return=s.return,s=s.sibling}l&4&&(l=n.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,Dm(n,i))));break;case 19:Bn(s,n),Gn(n),l&4&&(l=n.updateQueue,l!==null&&(n.updateQueue=null,Dm(n,l)));break;case 30:break;case 21:break;default:Bn(s,n),Gn(n)}}function Gn(n){var s=n.flags;if(s&2){try{for(var i,l=n.return;l!==null;){if(gv(l)){i=l;break}l=l.return}if(i==null)throw Error(o(160));switch(i.tag){case 27:var u=i.stateNode,p=Dg(n);Rm(n,p,u);break;case 5:var y=i.stateNode;i.flags&32&&(Vn(y,""),i.flags&=-33);var S=Dg(n);Rm(n,S,y);break;case 3:case 4:var I=i.stateNode.containerInfo,j=Dg(n);Mg(n,j,I);break;default:throw Error(o(161))}}catch(J){ht(n,n.return,J)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function wv(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var s=n;wv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),n=n.sibling}}function js(n,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)vv(n,s.alternate,s),s=s.sibling}function Xa(n){for(n=n.child;n!==null;){var s=n;switch(s.tag){case 0:case 11:case 14:case 15:Rr(4,s,s.return),Xa(s);break;case 1:gs(s,s.return);var i=s.stateNode;typeof i.componentWillUnmount=="function"&&uv(s,s.return,i),Xa(s);break;case 27:wd(s.stateNode);case 26:case 5:gs(s,s.return),Xa(s);break;case 22:s.memoizedState===null&&Xa(s);break;case 30:Xa(s);break;default:Xa(s)}n=n.sibling}}function Xs(n,s,i){for(i=i&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,u=n,p=s,y=p.flags;switch(p.tag){case 0:case 11:case 15:Xs(u,p,i),pd(4,p);break;case 1:if(Xs(u,p,i),l=p,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(j){ht(l,l.return,j)}if(l=p,u=l.updateQueue,u!==null){var S=l.stateNode;try{var I=u.shared.hiddenCallbacks;if(I!==null)for(u.shared.hiddenCallbacks=null,u=0;u<I.length;u++)e0(I[u],S)}catch(j){ht(l,l.return,j)}}i&&y&64&&mv(p),gd(p,p.return);break;case 27:fv(p);case 26:case 5:Xs(u,p,i),i&&l===null&&y&4&&pv(p),gd(p,p.return);break;case 12:Xs(u,p,i);break;case 31:Xs(u,p,i),i&&y&4&&xv(u,p);break;case 13:Xs(u,p,i),i&&y&4&&Av(u,p);break;case 22:p.memoizedState===null&&Xs(u,p,i),gd(p,p.return);break;case 30:break;default:Xs(u,p,i)}s=s.sibling}}function Ig(n,s){var i=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),n=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),n!==i&&(n!=null&&n.refCount++,i!=null&&ed(i))}function Og(n,s){n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&ed(n))}function Go(n,s,i,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Ev(n,s,i,l),s=s.sibling}function Ev(n,s,i,l){var u=s.flags;switch(s.tag){case 0:case 11:case 15:Go(n,s,i,l),u&2048&&pd(9,s);break;case 1:Go(n,s,i,l);break;case 3:Go(n,s,i,l),u&2048&&(n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&ed(n)));break;case 12:if(u&2048){Go(n,s,i,l),n=s.stateNode;try{var p=s.memoizedProps,y=p.id,S=p.onPostCommit;typeof S=="function"&&S(y,s.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(I){ht(s,s.return,I)}}else Go(n,s,i,l);break;case 31:Go(n,s,i,l);break;case 13:Go(n,s,i,l);break;case 23:break;case 22:p=s.stateNode,y=s.alternate,s.memoizedState!==null?p._visibility&2?Go(n,s,i,l):fd(n,s):p._visibility&2?Go(n,s,i,l):(p._visibility|=2,Bi(n,s,i,l,(s.subtreeFlags&10256)!==0||!1)),u&2048&&Ig(y,s);break;case 24:Go(n,s,i,l),u&2048&&Og(s.alternate,s);break;default:Go(n,s,i,l)}}function Bi(n,s,i,l,u){for(u=u&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var p=n,y=s,S=i,I=l,j=y.flags;switch(y.tag){case 0:case 11:case 15:Bi(p,y,S,I,u),pd(8,y);break;case 23:break;case 22:var J=y.stateNode;y.memoizedState!==null?J._visibility&2?Bi(p,y,S,I,u):fd(p,y):(J._visibility|=2,Bi(p,y,S,I,u)),u&&j&2048&&Ig(y.alternate,y);break;case 24:Bi(p,y,S,I,u),u&&j&2048&&Og(y.alternate,y);break;default:Bi(p,y,S,I,u)}s=s.sibling}}function fd(n,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var i=n,l=s,u=l.flags;switch(l.tag){case 22:fd(i,l),u&2048&&Ig(l.alternate,l);break;case 24:fd(i,l),u&2048&&Og(l.alternate,l);break;default:fd(i,l)}s=s.sibling}}var hd=8192;function Gi(n,s,i){if(n.subtreeFlags&hd)for(n=n.child;n!==null;)Sv(n,s,i),n=n.sibling}function Sv(n,s,i){switch(n.tag){case 26:Gi(n,s,i),n.flags&hd&&n.memoizedState!==null&&i6(i,Bo,n.memoizedState,n.memoizedProps);break;case 5:Gi(n,s,i);break;case 3:case 4:var l=Bo;Bo=Fm(n.stateNode.containerInfo),Gi(n,s,i),Bo=l;break;case 22:n.memoizedState===null&&(l=n.alternate,l!==null&&l.memoizedState!==null?(l=hd,hd=16777216,Gi(n,s,i),hd=l):Gi(n,s,i));break;default:Gi(n,s,i)}}function kv(n){var s=n.alternate;if(s!==null&&(n=s.child,n!==null)){s.child=null;do s=n.sibling,n.sibling=null,n=s;while(n!==null)}}function vd(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var i=0;i<s.length;i++){var l=s[i];mn=l,Rv(l,n)}kv(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Cv(n),n=n.sibling}function Cv(n){switch(n.tag){case 0:case 11:case 15:vd(n),n.flags&2048&&Rr(9,n,n.return);break;case 3:vd(n);break;case 12:vd(n);break;case 22:var s=n.stateNode;n.memoizedState!==null&&s._visibility&2&&(n.return===null||n.return.tag!==13)?(s._visibility&=-3,Mm(n)):vd(n);break;default:vd(n)}}function Mm(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var i=0;i<s.length;i++){var l=s[i];mn=l,Rv(l,n)}kv(n)}for(n=n.child;n!==null;){switch(s=n,s.tag){case 0:case 11:case 15:Rr(8,s,s.return),Mm(s);break;case 22:i=s.stateNode,i._visibility&2&&(i._visibility&=-3,Mm(s));break;default:Mm(s)}n=n.sibling}}function Rv(n,s){for(;mn!==null;){var i=mn;switch(i.tag){case 0:case 11:case 15:Rr(8,i,s);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:ed(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,mn=l;else e:for(i=n;mn!==null;){l=mn;var u=l.sibling,p=l.return;if(bv(l),l===i){mn=null;break e}if(u!==null){u.return=p,mn=u;break e}mn=p}}}var _3={getCacheForType:function(n){var s=bn(Qt),i=s.data.get(n);return i===void 0&&(i=n(),s.data.set(n,i)),i},cacheSignal:function(){return bn(Qt).controller.signal}},w3=typeof WeakMap=="function"?WeakMap:Map,mt=0,Et=null,Je=null,nt=0,ft=0,ro=null,Dr=!1,qi=!1,Pg=!1,Hs=0,Nt=0,Mr=0,Ha=0,zg=0,ao=0,Fi=0,bd=null,qn=null,Lg=!1,Tm=0,Dv=0,Im=1/0,Om=null,Tr=null,rn=0,Ir=null,ji=null,Ws=0,Ng=0,Vg=null,Mv=null,yd=0,Ug=null;function io(){return(mt&2)!==0&&nt!==0?nt&-nt:K.T!==null?Xg():Pc()}function Tv(){if(ao===0)if((nt&536870912)===0||rt){var n=ya;ya<<=1,(ya&3932160)===0&&(ya=262144),ao=n}else ao=536870912;return n=oo.current,n!==null&&(n.flags|=32),ao}function Fn(n,s,i){(n===Et&&(ft===2||ft===9)||n.cancelPendingCommit!==null)&&(Xi(n,0),Or(n,nt,ao,!1)),xa(n,i),((mt&2)===0||n!==Et)&&(n===Et&&((mt&2)===0&&(Ha|=i),Nt===4&&Or(n,nt,ao,!1)),fs(n))}function Iv(n,s,i){if((mt&6)!==0)throw Error(o(327));var l=!i&&(s&127)===0&&(s&n.expiredLanes)===0||To(n,s),u=l?k3(n,s):Gg(n,s,!0),p=l;do{if(u===0){qi&&!l&&Or(n,s,0,!1);break}else{if(i=n.current.alternate,p&&!E3(i)){u=Gg(n,s,!1),p=!1;continue}if(u===2){if(p=s,n.errorRecoveryDisabledLanes&p)var y=0;else y=n.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){s=y;e:{var S=n;u=bd;var I=S.current.memoizedState.isDehydrated;if(I&&(Xi(S,y).flags|=256),y=Gg(S,y,!1),y!==2){if(Pg&&!I){S.errorRecoveryDisabledLanes|=p,Ha|=p,u=4;break e}p=qn,qn=u,p!==null&&(qn===null?qn=p:qn.push.apply(qn,p))}u=y}if(p=!1,u!==2)continue}}if(u===1){Xi(n,0),Or(n,s,0,!0);break}e:{switch(l=n,p=u,p){case 0:case 1:throw Error(o(345));case 4:if((s&4194048)!==s)break;case 6:Or(l,s,ao,!Dr);break e;case 2:qn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((s&62914560)===s&&(u=Tm+300-le(),10<u)){if(Or(l,s,ao,!Dr),$o(l,0,!0)!==0)break e;
vendor: 20,408 bytes, line 48
48Ws=s,l.timeoutHandle=db(Ov.bind(null,l,i,qn,Om,Lg,s,ao,Ha,Fi,Dr,p,"Throttled",-0,0),u);break e}Ov(l,i,qn,Om,Lg,s,ao,Ha,Fi,Dr,p,null,-0,0)}}break}while(!0);fs(n)}function Ov(n,s,i,l,u,p,y,S,I,j,J,re,X,Q){if(n.timeoutHandle=-1,re=s.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Po},Sv(s,p,re);var ye=(p&62914560)===p?Tm-le():(p&4194048)===p?Dv-le():0;if(ye=l6(re,ye),ye!==null){Ws=p,n.cancelPendingCommit=ye(Gv.bind(null,n,s,p,i,l,u,y,S,I,J,re,null,X,Q)),Or(n,p,y,!j);return}}Gv(n,s,p,i,l,u,y,S,I)}function E3(n){for(var s=n;;){var i=s.tag;if((i===0||i===11||i===15)&&s.flags&16384&&(i=s.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var u=i[l],p=u.getSnapshot;u=u.value;try{if(!to(p(),u))return!1}catch{return!1}}if(i=s.child,s.subtreeFlags&16384&&i!==null)i.return=s,s=i;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Or(n,s,i,l){s&=~zg,s&=~Ha,n.suspendedLanes|=s,n.pingedLanes&=~s,l&&(n.warmLanes|=s),l=n.expirationTimes;for(var u=s;0<u;){var p=31-Ut(u),y=1<<p;l[p]=-1,u&=~y}i!==0&&Aa(n,i,s)}function Pm(){return(mt&6)===0?(xd(0),!1):!0}function Bg(){if(Je!==null){if(ft===0)var n=Je.return;else n=Je,Ls=Na=null,ng(n),zi=null,nd=0,n=Je;for(;n!==null;)cv(n.alternate,n),n=n.return;Je=null}}function Xi(n,s){var i=n.timeoutHandle;i!==-1&&(n.timeoutHandle=-1,j3(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),Ws=0,Bg(),Et=n,Je=i=Ps(n.current,null),nt=s,ft=0,ro=null,Dr=!1,qi=To(n,s),Pg=!1,Fi=ao=zg=Ha=Mr=Nt=0,qn=bd=null,Lg=!1,(s&8)!==0&&(s|=s&32);var l=n.entangledLanes;if(l!==0)for(n=n.entanglements,l&=s;0<l;){var u=31-Ut(l),p=1<<u;s|=n[u],l&=~p}return Hs=s,tm(),i}function Pv(n,s){Xe=null,K.H=cd,s===Pi||s===dm?(s=Y1(),ft=3):s===jp?(s=Y1(),ft=4):ft=s===bg?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,ro=s,Je===null&&(Nt=1,wm(n,yo(s,n.current)))}function zv(){var n=oo.current;return n===null?!0:(nt&4194048)===nt?wo===null:(nt&62914560)===nt||(nt&536870912)!==0?n===wo:!1}function Lv(){var n=K.H;return K.H=cd,n===null?cd:n}function Nv(){var n=K.A;return K.A=_3,n}function zm(){Nt=4,Dr||(nt&4194048)!==nt&&oo.current!==null||(qi=!0),(Mr&134217727)===0&&(Ha&134217727)===0||Et===null||Or(Et,nt,ao,!1)}function Gg(n,s,i){var l=mt;mt|=2;var u=Lv(),p=Nv();(Et!==n||nt!==s)&&(Om=null,Xi(n,s)),s=!1;var y=Nt;e:do try{if(ft!==0&&Je!==null){var S=Je,I=ro;switch(ft){case 8:Bg(),y=6;break e;case 3:case 2:case 9:case 6:oo.current===null&&(s=!0);var j=ft;if(ft=0,ro=null,Hi(n,S,I,j),i&&qi){y=0;break e}break;default:j=ft,ft=0,ro=null,Hi(n,S,I,j)}}S3(),y=Nt;break}catch(J){Pv(n,J)}while(!0);return s&&n.shellSuspendCounter++,Ls=Na=null,mt=l,K.H=u,K.A=p,Je===null&&(Et=null,nt=0,tm()),y}function S3(){for(;Je!==null;)Vv(Je)}function k3(n,s){var i=mt;mt|=2;var l=Lv(),u=Nv();Et!==n||nt!==s?(Om=null,Im=le()+500,Xi(n,s)):qi=To(n,s);e:do try{if(ft!==0&&Je!==null){s=Je;var p=ro;t:switch(ft){case 1:ft=0,ro=null,Hi(n,s,p,1);break;case 2:case 9:if(K1(p)){ft=0,ro=null,Uv(s);break}s=function(){ft!==2&&ft!==9||Et!==n||(ft=7),fs(n)},p.then(s,s);break e;case 3:ft=7;break e;case 4:ft=5;break e;case 7:K1(p)?(ft=0,ro=null,Uv(s)):(ft=0,ro=null,Hi(n,s,p,7));break;case 5:var y=null;switch(Je.tag){case 26:y=Je.memoizedState;case 5:case 27:var S=Je;if(y?Eb(y):S.stateNode.complete){ft=0,ro=null;var I=S.sibling;if(I!==null)Je=I;else{var j=S.return;j!==null?(Je=j,Lm(j)):Je=null}break t}}ft=0,ro=null,Hi(n,s,p,5);break;case 6:ft=0,ro=null,Hi(n,s,p,6);break;case 8:Bg(),Nt=6;break e;default:throw Error(o(462))}}C3();break}catch(J){Pv(n,J)}while(!0);return Ls=Na=null,K.H=l,K.A=u,mt=i,Je!==null?0:(Et=null,nt=0,tm(),Nt)}function C3(){for(;Je!==null&&!ci();)Vv(Je)}function Vv(n){var s=lv(n.alternate,n,Hs);n.memoizedProps=n.pendingProps,s===null?Lm(n):Je=s}function Uv(n){var s=n,i=s.alternate;switch(s.tag){case 15:case 0:s=nv(i,s,s.pendingProps,s.type,void 0,nt);break;case 11:s=nv(i,s,s.pendingProps,s.type.render,s.ref,nt);break;case 5:ng(s);default:cv(i,s),s=Je=N1(s,Hs),s=lv(i,s,Hs)}n.memoizedProps=n.pendingProps,s===null?Lm(n):Je=s}function Hi(n,s,i,l){Ls=Na=null,ng(s),zi=null,nd=0;var u=s.return;try{if(f3(n,u,s,i,nt)){Nt=1,wm(n,yo(i,n.current)),Je=null;return}}catch(p){if(u!==null)throw Je=u,p;Nt=1,wm(n,yo(i,n.current)),Je=null;return}s.flags&32768?(rt||l===1?n=!0:qi||(nt&536870912)!==0?n=!1:(Dr=n=!0,(l===2||l===9||l===3||l===6)&&(l=oo.current,l!==null&&l.tag===13&&(l.flags|=16384))),Bv(s,n)):Lm(s)}function Lm(n){var s=n;do{if((s.flags&32768)!==0){Bv(s,Dr);return}n=s.return;var i=b3(s.alternate,s,Hs);if(i!==null){Je=i;return}if(s=s.sibling,s!==null){Je=s;return}Je=s=n}while(s!==null);Nt===0&&(Nt=5)}function Bv(n,s){do{var i=y3(n.alternate,n);if(i!==null){i.flags&=32767,Je=i;return}if(i=n.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!s&&(n=n.sibling,n!==null)){Je=n;return}Je=n=i}while(n!==null);Nt=6,Je=null}function Gv(n,s,i,l,u,p,y,S,I){n.cancelPendingCommit=null;do Nm();while(rn!==0);if((mt&6)!==0)throw Error(o(327));if(s!==null){if(s===n.current)throw Error(o(177));if(p=s.lanes|s.childLanes,p|=Dp,xp(n,i,p,y,S,I),n===Et&&(Je=Et=null,nt=0),ji=s,Ir=n,Ws=i,Ng=p,Vg=u,Mv=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,T3(gn,function(){return Hv(),null})):(n.callbackNode=null,n.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=K.T,K.T=null,u=ce.p,ce.p=2,y=mt,mt|=4;try{x3(n,s,i)}finally{mt=y,ce.p=u,K.T=l}}rn=1,qv(),Fv(),jv()}}function qv(){if(rn===1){rn=0;var n=Ir,s=ji,i=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||i){i=K.T,K.T=null;var l=ce.p;ce.p=2;var u=mt;mt|=4;try{_v(s,n);var p=Zg,y=R1(n.containerInfo),S=p.focusedElem,I=p.selectionRange;if(y!==S&&S&&S.ownerDocument&&C1(S.ownerDocument.documentElement,S)){if(I!==null&&Ep(S)){var j=I.start,J=I.end;if(J===void 0&&(J=j),"selectionStart"in S)S.selectionStart=j,S.selectionEnd=Math.min(J,S.value.length);else{var re=S.ownerDocument||document,X=re&&re.defaultView||window;if(X.getSelection){var Q=X.getSelection(),ye=S.textContent.length,Te=Math.min(I.start,ye),At=I.end===void 0?Te:Math.min(I.end,ye);!Q.extend&&Te>At&&(y=At,At=Te,Te=y);var U=k1(S,Te),L=k1(S,At);if(U&&L&&(Q.rangeCount!==1||Q.anchorNode!==U.node||Q.anchorOffset!==U.offset||Q.focusNode!==L.node||Q.focusOffset!==L.offset)){var F=re.createRange();F.setStart(U.node,U.offset),Q.removeAllRanges(),Te>At?(Q.addRange(F),Q.extend(L.node,L.offset)):(F.setEnd(L.node,L.offset),Q.addRange(F))}}}}for(re=[],Q=S;Q=Q.parentNode;)Q.nodeType===1&&re.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<re.length;S++){var te=re[S];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}Qm=!!Jg,Zg=Jg=null}finally{mt=u,ce.p=l,K.T=i}}n.current=s,rn=2}}function Fv(){if(rn===2){rn=0;var n=Ir,s=ji,i=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||i){i=K.T,K.T=null;var l=ce.p;ce.p=2;var u=mt;mt|=4;try{vv(n,s.alternate,s)}finally{mt=u,ce.p=l,K.T=i}}rn=3}}function jv(){if(rn===4||rn===3){rn=0,ne();var n=Ir,s=ji,i=Ws,l=Mv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?rn=5:(rn=0,ji=Ir=null,Xv(n,n.pendingLanes));var u=n.pendingLanes;if(u===0&&(Tr=null),Ms(i),s=s.stateNode,fn&&typeof fn.onCommitFiberRoot=="function")try{fn.onCommitFiberRoot(Mo,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=K.T,u=ce.p,ce.p=2,K.T=null;try{for(var p=n.onRecoverableError,y=0;y<l.length;y++){var S=l[y];p(S.value,{componentStack:S.stack})}}finally{K.T=s,ce.p=u}}(Ws&3)!==0&&Nm(),fs(n),u=n.pendingLanes,(i&261930)!==0&&(u&42)!==0?n===Ug?yd++:(yd=0,Ug=n):yd=0,xd(0)}}function Xv(n,s){(n.pooledCacheLanes&=s)===0&&(s=n.pooledCache,s!=null&&(n.pooledCache=null,ed(s)))}function Nm(){return qv(),Fv(),jv(),Hv()}function Hv(){if(rn!==5)return!1;var n=Ir,s=Ng;Ng=0;var i=Ms(Ws),l=K.T,u=ce.p;try{ce.p=32>i?32:i,K.T=null,i=Vg,Vg=null;var p=Ir,y=Ws;if(rn=0,ji=Ir=null,Ws=0,(mt&6)!==0)throw Error(o(331));var S=mt;if(mt|=4,Cv(p.current),Ev(p,p.current,y,i),mt=S,xd(0,!1),fn&&typeof fn.onPostCommitFiberRoot=="function")try{fn.onPostCommitFiberRoot(Mo,p)}catch{}return!0}finally{ce.p=u,K.T=l,Xv(n,s)}}function Wv(n,s,i){s=yo(i,s),s=vg(n.stateNode,s,2),n=Sr(n,s,2),n!==null&&(xa(n,2),fs(n))}function ht(n,s,i){if(n.tag===3)Wv(n,n,i);else for(;s!==null;){if(s.tag===3){Wv(s,n,i);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Tr===null||!Tr.has(l))){n=yo(i,n),i=K0(2),l=Sr(s,i,2),l!==null&&(Q0(i,l,s,n),xa(l,2),fs(l));break}}s=s.return}}function qg(n,s,i){var l=n.pingCache;if(l===null){l=n.pingCache=new w3;var u=new Set;l.set(s,u)}else u=l.get(s),u===void 0&&(u=new Set,l.set(s,u));u.has(i)||(Pg=!0,u.add(i),n=R3.bind(null,n,s,i),s.then(n,n))}function R3(n,s,i){var l=n.pingCache;l!==null&&l.delete(s),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,Et===n&&(nt&i)===i&&(Nt===4||Nt===3&&(nt&62914560)===nt&&300>le()-Tm?(mt&2)===0&&Xi(n,0):zg|=i,Fi===nt&&(Fi=0)),fs(n)}function Kv(n,s){s===0&&(s=Oc()),n=Pa(n,s),n!==null&&(xa(n,s),fs(n))}function D3(n){var s=n.memoizedState,i=0;s!==null&&(i=s.retryLane),Kv(n,i)}function M3(n,s){var i=0;switch(n.tag){case 31:case 13:var l=n.stateNode,u=n.memoizedState;u!==null&&(i=u.retryLane);break;case 19:l=n.stateNode;break;case 22:l=n.stateNode._retryCache;break;default:throw Error(o(314))}l!==null&&l.delete(s),Kv(n,i)}function T3(n,s){return zt(n,s)}var Vm=null,Wi=null,Fg=!1,Um=!1,jg=!1,Pr=0;function fs(n){n!==Wi&&n.next===null&&(Wi===null?Vm=Wi=n:Wi=Wi.next=n),Um=!0,Fg||(Fg=!0,O3())}function xd(n,s){if(!jg&&Um){jg=!0;do for(var i=!1,l=Vm;l!==null;){if(n!==0){var u=l.pendingLanes;if(u===0)var p=0;else{var y=l.suspendedLanes,S=l.pingedLanes;p=(1<<31-Ut(42|n)+1)-1,p&=u&~(y&~S),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(i=!0,Jv(l,p))}else p=nt,p=$o(l,l===Et?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(p&3)===0||To(l,p)||(i=!0,Jv(l,p));l=l.next}while(i);jg=!1}}function I3(){Qv()}function Qv(){Um=Fg=!1;var n=0;Pr!==0&&F3()&&(n=Pr);for(var s=le(),i=null,l=Vm;l!==null;){var u=l.next,p=Yv(l,s);p===0?(l.next=null,i===null?Vm=u:i.next=u,u===null&&(Wi=i)):(i=l,(n!==0||(p&3)!==0)&&(Um=!0)),l=u}rn!==0&&rn!==5||xd(n),Pr!==0&&(Pr=0)}function Yv(n,s){for(var i=n.suspendedLanes,l=n.pingedLanes,u=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var y=31-Ut(p),S=1<<y,I=u[y];I===-1?((S&i)===0||(S&l)!==0)&&(u[y]=yp(S,s)):I<=s&&(n.expiredLanes|=S),p&=~S}if(s=Et,i=nt,i=$o(n,n===s?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),l=n.callbackNode,i===0||n===s&&(ft===2||ft===9)||n.cancelPendingCommit!==null)return l!==null&&l!==null&&Do(l),n.callbackNode=null,n.callbackPriority=0;if((i&3)===0||To(n,i)){if(s=i&-i,s===n.callbackPriority)return s;switch(l!==null&&Do(l),Ms(i)){case 2:case 8:i=Jn;break;case 32:i=gn;break;case 268435456:i=va;break;default:i=gn}return l=$v.bind(null,n),i=zt(i,l),n.callbackPriority=s,n.callbackNode=i,s}return l!==null&&l!==null&&Do(l),n.callbackPriority=2,n.callbackNode=null,2}function $v(n,s){if(rn!==0&&rn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var i=n.callbackNode;if(Nm()&&n.callbackNode!==i)return null;var l=nt;return l=$o(n,n===Et?l:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),l===0?null:(Iv(n,l,s),Yv(n,le()),n.callbackNode!=null&&n.callbackNode===i?$v.bind(null,n):null)}function Jv(n,s){if(Nm())return null;Iv(n,s,!0)}function O3(){X3(function(){(mt&6)!==0?zt(vt,I3):Qv()})}function Xg(){if(Pr===0){var n=Ii;n===0&&(n=Qo,Qo<<=1,(Qo&261888)===0&&(Qo=256)),Pr=n}return Pr}function Zv(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:vi(""+n)}function eb(n,s){var i=s.ownerDocument.createElement("input");return i.name=s.name,i.value=s.value,n.id&&i.setAttribute("form",n.id),s.parentNode.insertBefore(i,s),n=new FormData(n),i.parentNode.removeChild(i),n}function P3(n,s,i,l,u){if(s==="submit"&&i&&i.stateNode===u){var p=Zv((u[dn]||null).action),y=l.submitter;y&&(s=(s=y[dn]||null)?Zv(s.formAction):y.getAttribute("formAction"),s!==null&&(p=s,y=null));var S=new ls("action","action",null,l,u);n.push({event:S,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Pr!==0){var I=y?eb(u,y):new FormData(u);mg(i,{pending:!0,data:I,method:u.method,action:p},null,I)}}else typeof p=="function"&&(S.preventDefault(),I=y?eb(u,y):new FormData(u),mg(i,{pending:!0,data:I,method:u.method,action:p},p,I))},currentTarget:u}]})}}for(var Hg=0;Hg<Rp.length;Hg++){var Wg=Rp[Hg],z3=Wg.toLowerCase(),L3=Wg[0].toUpperCase()+Wg.slice(1);Uo(z3,"on"+L3)}Uo(T1,"onAnimationEnd"),Uo(I1,"onAnimationIteration"),Uo(O1,"onAnimationStart"),Uo("dblclick","onDoubleClick"),Uo("focusin","onFocus"),Uo("focusout","onBlur"),Uo(J8,"onTransitionRun"),Uo(Z8,"onTransitionStart"),Uo(e3,"onTransitionCancel"),Uo(P1,"onTransitionEnd"),ss("onMouseEnter",["mouseout","mouseover"]),ss("onMouseLeave",["mouseout","mouseover"]),ss("onPointerEnter",["pointerout","pointerover"]),ss("onPointerLeave",["pointerout","pointerover"]),os("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),os("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),os("onBeforeInput",["compositionend","keypress","textInput","paste"]),os("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),os("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),os("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ad="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),N3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ad));function tb(n,s){s=(s&4)!==0;for(var i=0;i<n.length;i++){var l=n[i],u=l.event;l=l.listeners;e:{var p=void 0;if(s)for(var y=l.length-1;0<=y;y--){var S=l[y],I=S.instance,j=S.currentTarget;if(S=S.listener,I!==p&&u.isPropagationStopped())break e;p=S,u.currentTarget=j;try{p(u)}catch(J){em(J)}u.currentTarget=null,p=I}else for(y=0;y<l.length;y++){if(S=l[y],I=S.instance,j=S.currentTarget,S=S.listener,I!==p&&u.isPropagationStopped())break e;p=S,u.currentTarget=j;try{p(u)}catch(J){em(J)}u.currentTarget=null,p=I}}}}function Ze(n,s){var i=s[ui];i===void 0&&(i=s[ui]=new Set);var l=n+"__bubble";i.has(l)||(nb(s,n,2,!1),i.add(l))}function Kg(n,s,i){var l=0;s&&(l|=4),nb(i,n,l,s)}var Bm="_reactListening"+Math.random().toString(36).slice(2);function Qg(n){if(!n[Bm]){n[Bm]=!0,Ol.forEach(function(i){i!=="selectionchange"&&(N3.has(i)||Kg(i,!1,n),Kg(i,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[Bm]||(s[Bm]=!0,Kg("selectionchange",!1,s))}}function nb(n,s,i,l){switch(Tb(s)){case 2:var u=m6;break;case 8:u=u6;break;default:u=mf}i=u.bind(null,s,i,n),u=void 0,!ka||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(u=!0),l?u!==void 0?n.addEventListener(s,i,{capture:!0,passive:u}):n.addEventListener(s,i,!0):u!==void 0?n.addEventListener(s,i,{passive:u}):n.addEventListener(s,i,!1)}function Yg(n,s,i,l,u){var p=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var y=l.tag;if(y===3||y===4){var S=l.stateNode.containerInfo;if(S===u)break;if(y===4)for(y=l.return;y!==null;){var I=y.tag;if((I===3||I===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;S!==null;){if(y=ts(S),y===null)return;if(I=y.tag,I===5||I===6||I===26||I===27){l=p=y;continue e}S=S.parentNode}}l=l.return}fr(function(){var j=p,J=fo(i),re=[];e:{var X=z1.get(n);if(X!==void 0){var Q=ls,ye=n;switch(n){case"keypress":if(Ra(i)===0)break e;case"keydown":case"keyup":Q=$c;break;case"focusin":ye="focus",Q=Ma;break;case"focusout":ye="blur",Q=Ma;break;case"beforeblur":case"afterblur":Q=Ma;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=Hl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=qc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=b;break;case T1:case I1:case O1:Q=jc;break;case P1:Q=k;break;case"scroll":case"scrollend":Q=Xl;break;case"wheel":Q=W;break;case"copy":case"cut":case"paste":Q=Xc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=Os;break;case"toggle":case"beforetoggle":Q=je}var Te=(s&4)!==0,At=!Te&&(n==="scroll"||n==="scrollend"),U=Te?X!==null?X+"Capture":null:X;Te=[];for(var L=j,F;L!==null;){var te=L;if(F=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||F===null||U===null||(te=zo(L,U),te!=null&&Te.push(_d(L,te,F))),At)break;L=L.return}0<Te.length&&(X=new Q(X,ye,null,i,J),re.push({event:X,listeners:Te}))}}if((s&7)===0){e:{if(X=n==="mouseover"||n==="pointerover",Q=n==="mouseout"||n==="pointerout",X&&i!==ql&&(ye=i.relatedTarget||i.fromElement)&&(ts(ye)||ye[Zo]))break e;if((Q||X)&&(X=J.window===J?J:(X=J.ownerDocument)?X.defaultView||X.parentWindow:window,Q?(ye=i.relatedTarget||i.toElement,Q=j,ye=ye?ts(ye):null,ye!==null&&(At=d(ye),Te=ye.tag,ye!==At||Te!==5&&Te!==27&&Te!==6)&&(ye=null)):(Q=null,ye=j),Q!==ye)){if(Te=Hl,te="onMouseLeave",U="onMouseEnter",L="mouse",(n==="pointerout"||n==="pointerover")&&(Te=Os,te="onPointerLeave",U="onPointerEnter",L="pointer"),At=Q==null?X:Zn(Q),F=ye==null?X:Zn(ye),X=new Te(te,L+"leave",Q,i,J),X.target=At,X.relatedTarget=F,te=null,ts(J)===j&&(Te=new Te(U,L+"enter",ye,i,J),Te.target=F,Te.relatedTarget=At,te=Te),At=te,Q&&ye)t:{for(Te=V3,U=Q,L=ye,F=0,te=U;te;te=Te(te))F++;te=0;for(var Ce=L;Ce;Ce=Te(Ce))te++;for(;0<F-te;)U=Te(U),F--;for(;0<te-F;)L=Te(L),te--;for(;F--;){if(U===L||L!==null&&U===L.alternate){Te=U;break t}U=Te(U),L=Te(L)}Te=null}else Te=null;Q!==null&&ob(re,X,Q,Te,!1),ye!==null&&At!==null&&ob(re,At,ye,Te,!0)}}e:{if(X=j?Zn(j):window,Q=X.nodeName&&X.nodeName.toLowerCase(),Q==="select"||Q==="input"&&X.type==="file")var lt=x1;else if(b1(X))if(A1)lt=Q8;else{lt=W8;var xe=H8}else Q=X.nodeName,!Q||Q.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?j&&hi(j.elementType)&&(lt=x1):lt=K8;if(lt&&(lt=lt(n,j))){y1(re,lt,i,J);break e}xe&&xe(n,X,j),n==="focusout"&&j&&X.type==="number"&&j.memoizedProps.value!=null&&Ul(X,"number",X.value)}switch(xe=j?Zn(j):window,n){case"focusin":(b1(xe)||xe.contentEditable==="true")&&(Ei=xe,Sp=j,$l=null);break;case"focusout":$l=Sp=Ei=null;break;case"mousedown":kp=!0;break;case"contextmenu":case"mouseup":case"dragend":kp=!1,D1(re,i,J);break;case"selectionchange":if($8)break;case"keydown":case"keyup":D1(re,i,J)}var We;if(ct)e:{switch(n){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else wi?Ta(n,i)&&(ot="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&(ot="onCompositionStart");ot&&(ms&&i.locale!=="ko"&&(wi||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&wi&&(We=jl()):(is=J,Fl="value"in is?is.value:is.textContent,wi=!0)),xe=Gm(j,ot),0<xe.length&&(ot=new cs(ot,n,null,i,J),re.push({event:ot,listeners:xe}),We?ot.data=We:(We=_i(i),We!==null&&(ot.data=We)))),(We=vo?q8(n,i):F8(n,i))&&(ot=Gm(j,"onBeforeInput"),0<ot.length&&(xe=new cs("onBeforeInput","beforeinput",null,i,J),re.push({event:xe,listeners:ot}),xe.data=We)),P3(re,n,j,i,J)}tb(re,s)})}function _d(n,s,i){return{instance:n,listener:s,currentTarget:i}}function Gm(n,s){for(var i=s+"Capture",l=[];n!==null;){var u=n,p=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||p===null||(u=zo(n,i),u!=null&&l.unshift(_d(n,u,p)),u=zo(n,s),u!=null&&l.push(_d(n,u,p))),n.tag===3)return l;n=n.return}return[]}function V3(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function ob(n,s,i,l,u){for(var p=s._reactName,y=[];i!==null&&i!==l;){var S=i,I=S.alternate,j=S.stateNode;if(S=S.tag,I!==null&&I===l)break;S!==5&&S!==26&&S!==27||j===null||(I=j,u?(j=zo(i,p),j!=null&&y.unshift(_d(i,j,I))):u||(j=zo(i,p),j!=null&&y.push(_d(i,j,I)))),i=i.return}y.length!==0&&n.push({event:s,listeners:y})}var U3=/\r\n?/g,B3=/\u0000|\uFFFD/g;
vendor: 6,707 bytes, lines 48-49
48function sb(n){return(typeof n=="string"?n:""+n).replace(U3,`
49`).replace(B3,"")}function rb(n,s){return s=sb(s),sb(n)===s}function xt(n,s,i,l,u,p){switch(i){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||Vn(n,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&Vn(n,""+l);break;case"className":eo(n,"class",l);break;case"tabIndex":eo(n,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":eo(n,i,l);break;case"style":Gl(n,l,p);break;case"data":if(s!=="object"){eo(n,"data",l);break}case"src":case"href":if(l===""&&(s!=="a"||i!=="href")){n.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){n.removeAttribute(i);break}l=vi(""+l),n.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){n.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(i==="formAction"?(s!=="input"&&xt(n,s,"name",u.name,u,null),xt(n,s,"formEncType",u.formEncType,u,null),xt(n,s,"formMethod",u.formMethod,u,null),xt(n,s,"formTarget",u.formTarget,u,null)):(xt(n,s,"encType",u.encType,u,null),xt(n,s,"method",u.method,u,null),xt(n,s,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){n.removeAttribute(i);break}l=vi(""+l),n.setAttribute(i,l);break;case"onClick":l!=null&&(n.onclick=Po);break;case"onScroll":l!=null&&Ze("scroll",n);break;case"onScrollEnd":l!=null&&Ze("scrollend",n);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(i=l.__html,i!=null){if(u.children!=null)throw Error(o(60));n.innerHTML=i}}break;case"multiple":n.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":n.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){n.removeAttribute("xlink:href");break}i=vi(""+l),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?n.setAttribute(i,""+l):n.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?n.setAttribute(i,""):n.removeAttribute(i);break;case"capture":case"download":l===!0?n.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?n.setAttribute(i,l):n.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?n.setAttribute(i,l):n.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?n.removeAttribute(i):n.setAttribute(i,l);break;case"popover":Ze("beforetoggle",n),Ze("toggle",n),gi(n,"popover",l);break;case"xlinkActuate":Kt(n,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Kt(n,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Kt(n,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Kt(n,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Kt(n,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Kt(n,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Kt(n,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Kt(n,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Kt(n,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":gi(n,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=Gc.get(i)||i,gi(n,i,l))}}function $g(n,s,i,l,u,p){switch(i){case"style":Gl(n,l,p);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(i=l.__html,i!=null){if(u.children!=null)throw Error(o(60));n.innerHTML=i}}break;case"children":typeof l=="string"?Vn(n,l):(typeof l=="number"||typeof l=="bigint")&&Vn(n,""+l);break;case"onScroll":l!=null&&Ze("scroll",n);break;case"onScrollEnd":l!=null&&Ze("scrollend",n);break;case"onClick":l!=null&&(n.onclick=Po);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pl.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(u=i.endsWith("Capture"),s=i.slice(2,u?i.length-7:void 0),p=n[dn]||null,p=p!=null?p[i]:null,typeof p=="function"&&n.removeEventListener(s,p,u),typeof l=="function")){typeof p!="function"&&p!==null&&(i in n?n[i]=null:n.hasAttribute(i)&&n.removeAttribute(i)),n.addEventListener(s,l,u);break e}i in n?n[i]=l:l===!0?n.setAttribute(i,""):gi(n,i,l)}}}function xn(n,s,i){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ze("error",n),Ze("load",n);var l=!1,u=!1,p;for(p in i)if(i.hasOwnProperty(p)){var y=i[p];if(y!=null)switch(p){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,s));default:xt(n,s,p,y,i,null)}}u&&xt(n,s,"srcSet",i.srcSet,i,null),l&&xt(n,s,"src",i.src,i,null);return;case"input":Ze("invalid",n);var S=p=y=u=null,I=null,j=null;for(l in i)if(i.hasOwnProperty(l)){var J=i[l];if(J!=null)switch(l){case"name":u=J;break;case"type":y=J;break;case"checked":I=J;break;case"defaultChecked":j=J;break;case"value":p=J;break;case"defaultValue":S=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(o(137,s));break;default:xt(n,s,l,J,i,null)}}Vc(n,p,S,I,j,y,u,!1);return;case"select":Ze("invalid",n),l=y=p=null;for(u in i)if(i.hasOwnProperty(u)&&(S=i[u],S!=null))switch(u){case"value":p=S;break;case"defaultValue":y=S;break;case"multiple":l=S;default:xt(n,s,u,S,i,null)}s=p,i=y,n.multiple=!!l,s!=null?mr(n,!!l,s,!1):i!=null&&mr(n,!!l,i,!0);return;case"textarea":Ze("invalid",n),p=u=l=null;
vendor: 4,768 bytes, line 49
49for(y in i)if(i.hasOwnProperty(y)&&(S=i[y],S!=null))switch(y){case"value":l=S;break;case"defaultValue":u=S;break;case"children":p=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(o(91));break;default:xt(n,s,y,S,i,null)}ur(n,l,u,p);return;case"option":for(I in i)if(i.hasOwnProperty(I)&&(l=i[I],l!=null))switch(I){case"selected":n.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:xt(n,s,I,l,i,null)}return;case"dialog":Ze("beforetoggle",n),Ze("toggle",n),Ze("cancel",n),Ze("close",n);break;case"iframe":case"object":Ze("load",n);break;case"video":case"audio":for(l=0;l<Ad.length;l++)Ze(Ad[l],n);break;case"image":Ze("error",n),Ze("load",n);break;case"details":Ze("toggle",n);break;case"embed":case"source":case"link":Ze("error",n),Ze("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(j in i)if(i.hasOwnProperty(j)&&(l=i[j],l!=null))switch(j){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,s));default:xt(n,s,j,l,i,null)}return;default:if(hi(s)){for(J in i)i.hasOwnProperty(J)&&(l=i[J],l!==void 0&&$g(n,s,J,l,i,void 0));return}}for(S in i)i.hasOwnProperty(S)&&(l=i[S],l!=null&&xt(n,s,S,l,i,null))}function G3(n,s,i,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,p=null,y=null,S=null,I=null,j=null,J=null;for(Q in i){var re=i[Q];if(i.hasOwnProperty(Q)&&re!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":I=re;default:l.hasOwnProperty(Q)||xt(n,s,Q,null,l,re)}}for(var X in l){var Q=l[X];if(re=i[X],l.hasOwnProperty(X)&&(Q!=null||re!=null))switch(X){case"type":p=Q;break;case"name":u=Q;break;case"checked":j=Q;break;case"defaultChecked":J=Q;break;case"value":y=Q;break;case"defaultValue":S=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(o(137,s));break;default:Q!==re&&xt(n,s,X,Q,l,re)}}fi(n,y,S,I,j,J,p,u);return;case"select":Q=y=S=X=null;for(p in i)if(I=i[p],i.hasOwnProperty(p)&&I!=null)switch(p){case"value":break;case"multiple":Q=I;default:l.hasOwnProperty(p)||xt(n,s,p,null,l,I)}for(u in l)if(p=l[u],I=i[u],l.hasOwnProperty(u)&&(p!=null||I!=null))switch(u){case"value":X=p;break;case"defaultValue":S=p;break;case"multiple":y=p;default:p!==I&&xt(n,s,u,p,l,I)}s=S,i=y,l=Q,X!=null?mr(n,!!i,X,!1):!!l!=!!i&&(s!=null?mr(n,!!i,s,!0):mr(n,!!i,i?[]:"",!1));return;case"textarea":Q=X=null;for(S in i)if(u=i[S],i.hasOwnProperty(S)&&u!=null&&!l.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:xt(n,s,S,null,l,u)}for(y in l)if(u=l[y],p=i[y],l.hasOwnProperty(y)&&(u!=null||p!=null))switch(y){case"value":X=u;break;case"defaultValue":Q=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(o(91));break;default:u!==p&&xt(n,s,y,u,l,p)}Uc(n,X,Q);return;case"option":for(var ye in i)if(X=i[ye],i.hasOwnProperty(ye)&&X!=null&&!l.hasOwnProperty(ye))switch(ye){case"selected":n.selected=!1;break;default:xt(n,s,ye,null,l,X)}for(I in l)if(X=l[I],Q=i[I],l.hasOwnProperty(I)&&X!==Q&&(X!=null||Q!=null))switch(I){case"selected":n.selected=X&&typeof X!="function"&&typeof X!="symbol";break;default:xt(n,s,I,X,l,Q)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in i)X=i[Te],i.hasOwnProperty(Te)&&X!=null&&!l.hasOwnProperty(Te)&&xt(n,s,Te,null,l,X);for(j in l)if(X=l[j],Q=i[j],l.hasOwnProperty(j)&&X!==Q&&(X!=null||Q!=null))switch(j){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(o(137,s));break;default:xt(n,s,j,X,l,Q)}return;default:if(hi(s)){for(var At in i)X=i[At],i.hasOwnProperty(At)&&X!==void 0&&!l.hasOwnProperty(At)&&$g(n,s,At,void 0,l,X);for(J in l)X=l[J],Q=i[J],!l.hasOwnProperty(J)||X===Q||X===void 0&&Q===void 0||$g(n,s,J,X,l,Q);return}}for(var U in i)X=i[U],i.hasOwnProperty(U)&&X!=null&&!l.hasOwnProperty(U)&&xt(n,s,U,null,l,X);for(re in l)X=l[re],Q=i[re],!l.hasOwnProperty(re)||X===Q||X==null&&Q==null||xt(n,s,re,X,l,Q)}function ab(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function q3(){if(typeof performance.getEntriesByType=="function"){for(var n=0,s=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var u=i[l],p=u.transferSize,y=u.initiatorType,S=u.duration;if(p&&S&&ab(y)){for(y=0,S=u.responseEnd,l+=1;l<i.length;l++){var I=i[l],j=I.startTime;if(j>S)break;var J=I.transferSize,re=I.initiatorType;J&&ab(re)&&(I=I.responseEnd,y+=J*(I<S?1:(S-j)/(I-j)))}if(--l,s+=8*(p+y)/(u.duration/1e3),n++,10<n)break}}if(0<n)return s/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?
vendor: 14,710 bytes, line 49
49n:5}var Jg=null,Zg=null;function qm(n){return n.nodeType===9?n:n.ownerDocument}function ib(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function lb(n,s){if(n===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&s==="foreignObject"?0:n}function ef(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var tf=null;function F3(){var n=window.event;return n&&n.type==="popstate"?n===tf?!1:(tf=n,!0):(tf=null,!1)}var db=typeof setTimeout=="function"?setTimeout:void 0,j3=typeof clearTimeout=="function"?clearTimeout:void 0,cb=typeof Promise=="function"?Promise:void 0,X3=typeof queueMicrotask=="function"?queueMicrotask:typeof cb<"u"?function(n){return cb.resolve(null).then(n).catch(H3)}:db;function H3(n){setTimeout(function(){throw n})}function zr(n){return n==="head"}function mb(n,s){var i=s,l=0;do{var u=i.nextSibling;if(n.removeChild(i),u&&u.nodeType===8)if(i=u.data,i==="/$"||i==="/&"){if(l===0){n.removeChild(u),$i(s);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")wd(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,wd(i);for(var p=i.firstChild;p;){var y=p.nextSibling,S=p.nodeName;p[es]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&p.rel.toLowerCase()==="stylesheet"||i.removeChild(p),p=y}}else i==="body"&&wd(n.ownerDocument.body);i=u}while(i);$i(s)}function ub(n,s){var i=n;n=0;do{var l=i.nextSibling;if(i.nodeType===1?s?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(s?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(n===0)break;n--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||n++;i=l}while(i)}function nf(n){var s=n.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var i=s;switch(s=s.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":nf(i),pi(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function W3(n,s,i,l){for(;n.nodeType===1;){var u=i;if(n.nodeName.toLowerCase()!==s.toLowerCase()){if(!l&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(l){if(!n[es])switch(s){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(p=n.getAttribute("rel"),p==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(p!==u.rel||n.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||n.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||n.getAttribute("title")!==(u.title==null?null:u.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(p=n.getAttribute("src"),(p!==(u.src==null?null:u.src)||n.getAttribute("type")!==(u.type==null?null:u.type)||n.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&p&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(s==="input"&&n.type==="hidden"){var p=u.name==null?null:""+u.name;if(u.type==="hidden"&&n.getAttribute("name")===p)return n}else return n;if(n=Eo(n.nextSibling),n===null)break}return null}function K3(n,s,i){if(s==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=Eo(n.nextSibling),n===null))return null;return n}function pb(n,s){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!s||(n=Eo(n.nextSibling),n===null))return null;return n}function of(n){return n.data==="$?"||n.data==="$~"}function sf(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Q3(n,s){var i=n.ownerDocument;if(n.data==="$~")n._reactRetry=s;else if(n.data!=="$?"||i.readyState!=="loading")s();else{var l=function(){s(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),n._reactRetry=l}}function Eo(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return n}var rf=null;function gb(n){n=n.nextSibling;for(var s=0;n;){if(n.nodeType===8){var i=n.data;if(i==="/$"||i==="/&"){if(s===0)return Eo(n.nextSibling);s--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||s++}n=n.nextSibling}return null}function fb(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var i=n.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(s===0)return n;s--}else i!=="/$"&&i!=="/&"||s++}n=n.previousSibling}return null}function hb(n,s,i){switch(s=qm(i),n){case"html":if(n=s.documentElement,!n)throw Error(o(452));return n;case"head":if(n=s.head,!n)throw Error(o(453));return n;case"body":if(n=s.body,!n)throw Error(o(454));return n;default:throw Error(o(451))}}function wd(n){for(var s=n.attributes;s.length;)n.removeAttributeNode(s[0]);pi(n)}var So=new Map,vb=new Set;function Fm(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Ks=ce.d;ce.d={f:Y3,r:$3,D:J3,C:Z3,L:e6,m:t6,X:o6,S:n6,M:s6};function Y3(){var n=Ks.f(),s=Pm();return n||s}function $3(n){var s=go(n);s!==null&&s.tag===5&&s.type==="form"?P0(s):Ks.r(n)}var Ki=typeof document>"u"?null:document;function bb(n,s,i){var l=Ki;if(l&&typeof s=="string"&&s){var u=Nn(s);u='link[rel="'+n+'"][href="'+u+'"]',typeof i=="string"&&(u+='[crossorigin="'+i+'"]'),vb.has(u)||(vb.add(u),n={rel:n,crossOrigin:i,href:s},l.querySelector(u)===null&&(s=l.createElement("link"),xn(s,"link",n),Wt(s),l.head.appendChild(s)))}}function J3(n){Ks.D(n),bb("dns-prefetch",n,null)}function Z3(n,s){Ks.C(n,s),bb("preconnect",n,s)}function e6(n,s,i){Ks.L(n,s,i);var l=Ki;if(l&&n&&s){var u='link[rel="preload"][as="'+Nn(s)+'"]';s==="image"&&i&&i.imageSrcSet?(u+='[imagesrcset="'+Nn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(u+='[imagesizes="'+Nn(i.imageSizes)+'"]')):u+='[href="'+Nn(n)+'"]';var p=u;switch(s){case"style":p=Qi(n);break;case"script":p=Yi(n)}So.has(p)||(n=E({rel:"preload",href:s==="image"&&i&&i.imageSrcSet?void 0:n,as:s},i),So.set(p,n),l.querySelector(u)!==null||s==="style"&&l.querySelector(Ed(p))||s==="script"&&l.querySelector(Sd(p))||(s=l.createElement("link"),xn(s,"link",n),Wt(s),l.head.appendChild(s)))}}function t6(n,s){Ks.m(n,s);var i=Ki;if(i&&n){var l=s&&typeof s.as=="string"?s.as:"script",u='link[rel="modulepreload"][as="'+Nn(l)+'"][href="'+Nn(n)+'"]',p=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Yi(n)}if(!So.has(p)&&(n=E({rel:"modulepreload",href:n},s),So.set(p,n),i.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Sd(p)))return}l=i.createElement("link"),xn(l,"link",n),Wt(l),i.head.appendChild(l)}}}function n6(n,s,i){Ks.S(n,s,i);var l=Ki;if(l&&n){var u=ns(l).hoistableStyles,p=Qi(n);s=s||"default";var y=u.get(p);if(!y){var S={loading:0,preload:null};if(y=l.querySelector(Ed(p)))S.loading=5;else{n=E({rel:"stylesheet",href:n,"data-precedence":s},i),(i=So.get(p))&&af(n,i);var I=y=l.createElement("link");Wt(I),xn(I,"link",n),I._p=new Promise(function(j,J){I.onload=j,I.onerror=J}),I.addEventListener("load",function(){S.loading|=1}),I.addEventListener("error",function(){S.loading|=2}),S.loading|=4,jm(y,s,l)}y={type:"stylesheet",instance:y,count:1,state:S},u.set(p,y)}}}function o6(n,s){Ks.X(n,s);var i=Ki;if(i&&n){var l=ns(i).hoistableScripts,u=Yi(n),p=l.get(u);p||(p=i.querySelector(Sd(u)),p||(n=E({src:n,async:!0},s),(s=So.get(u))&&lf(n,s),p=i.createElement("script"),Wt(p),xn(p,"link",n),i.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(u,p))}}function s6(n,s){Ks.M(n,s);var i=Ki;if(i&&n){var l=ns(i).hoistableScripts,u=Yi(n),p=l.get(u);p||(p=i.querySelector(Sd(u)),p||(n=E({src:n,async:!0,type:"module"},s),(s=So.get(u))&&lf(n,s),p=i.createElement("script"),Wt(p),xn(p,"link",n),i.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(u,p))}}function yb(n,s,i,l){var u=(u=Ue.current)?Fm(u):null;if(!u)throw Error(o(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(s=Qi(i.href),i=ns(u).hoistableStyles,l=i.get(s),l||(l={type:"style",instance:null,count:0,state:null},i.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=Qi(i.href);var p=ns(u).hoistableStyles,y=p.get(n);if(y||(u=u.ownerDocument||u,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,y),(p=u.querySelector(Ed(n)))&&!p._p&&(y.instance=p,y.state.loading=5),So.has(n)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},So.set(n,i),p||r6(u,n,i,y.state))),s&&l===null)throw Error(o(528,""));return y}if(s&&l!==null)throw Error(o(529,""));return null;case"script":return s=i.async,i=i.src,typeof i=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Yi(i),i=ns(u).hoistableScripts,l=i.get(s),l||(l={type:"script",instance:null,count:0,state:null},i.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,n))}}function Qi(n){return'href="'+Nn(n)+'"'}function Ed(n){return'link[rel="stylesheet"]['+n+"]"}function xb(n){return E({},n,{"data-precedence":n.precedence,precedence:null})}function r6(n,s,i,l){n.querySelector('link[rel="preload"][as="style"]['+s+"]")?l.loading=1:(s=n.createElement("link"),l.preload=s,s.addEventListener("load",function(){return l.loading|=1}),s.addEventListener("error",function(){return l.loading|=2}),xn(s,"link",i),Wt(s),n.head.appendChild(s))}function Yi(n){return'[src="'+Nn(n)+'"]'}function Sd(n){return"script[async]"+n}function Ab(n,s,i){if(s.count++,s.instance===null)switch(s.type){case"style":var l=n.querySelector('style[data-href~="'+Nn(i.href)+'"]');if(l)return s.instance=l,Wt(l),l;var u=E({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(n.ownerDocument||n).createElement("style"),Wt(l),xn(l,"style",u),jm(l,i.precedence,n),s.instance=l;case"stylesheet":u=Qi(i.href);var p=n.querySelector(Ed(u));if(p)return s.state.loading|=4,s.instance=p,Wt(p),p;l=xb(i),(u=So.get(u))&&af(l,u),p=(n.ownerDocument||n).createElement("link"),Wt(p);var y=p;return y._p=new Promise(function(S,I){y.onload=S,y.onerror=I}),xn(p,"link",l),s.state.loading|=4,jm(p,i.precedence,n),s.instance=p;case"script":return p=Yi(i.src),(u=n.querySelector(Sd(p)))?(s.instance=u,Wt(u),u):(l=i,(u=So.get(p))&&(l=E({},i),lf(l,u)),n=n.ownerDocument||n,u=n.createElement("script"),Wt(u),xn(u,"link",l),n.head.appendChild(u),s.instance=u);case"void":return null;default:throw Error(o(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(l=s.instance,s.state.loading|=4,jm(l,i.precedence,n));return s.instance}function jm(n,s,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,p=u,y=0;y<l.length;y++){var S=l[y];if(S.dataset.precedence===s)p=S;else if(p!==u)break}p?p.parentNode.insertBefore(n,p.nextSibling):(s=i.nodeType===9?i.head:i,s.insertBefore(n,s.firstChild))}function af(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.title==null&&(n.title=s.title)}function lf(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.integrity==null&&(n.integrity=s.integrity)}var Xm=null;function _b(n,s,i){if(Xm===null){var l=new Map,u=Xm=new Map;u.set(i,l)}else u=Xm,l=u.get(i),l||(l=new Map,u.set(i,l));if(l.has(n))return l;for(l.set(n,null),i=i.getElementsByTagName(n),u=0;u<i.length;u++){var p=i[u];if(!(p[es]||p[Ht]||n==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var y=p.getAttribute(s)||"";y=n+y;var S=l.get(y);S?S.push(p):l.set(y,[p])}}return l}function wb(n,s,i){n=n.ownerDocument||n,n.head.insertBefore(i,s==="title"?n.querySelector("head > title"):null)}function a6(n,s,i){if(i===1||s.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return n=s.disabled,typeof s.precedence=="string"&&n==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Eb(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function i6(n,s,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var u=Qi(l.href),p=s.querySelector(Ed(u));if(p){s=p._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(n.count++,n=Hm.bind(n),s.then(n,n)),i.state.loading|=4,i.instance=p,Wt(p);return}p=s.ownerDocument||s,l=xb(l),(u=So.get(u))&&af(l,u),p=p.createElement("link"),Wt(p);var y=p;y._p=new Promise(function(S,I){y.onload=S,y.onerror=I}),xn(p,"link",l),i.instance=p}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,s),(s=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=Hm.bind(n),s.addEventListener("load",i),s.addEventListener("error",i))}}var df=0;function l6(n,s){return n.stylesheets&&n.count===0&&Km(n,n.stylesheets),0<n.count||0<n.imgCount?function(i){var l=setTimeout(function(){if(n.stylesheets&&Km(n,n.stylesheets),n.unsuspend){var p=n.unsuspend;n.unsuspend=null,p()}},6e4+s);0<n.imgBytes&&df===0&&(df=62500*q3());var u=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Km(n,n.stylesheets),n.unsuspend)){var p=n.unsuspend;n.unsuspend=null,p()}},(n.imgBytes>df?50:800)+s);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function Hm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Km(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Wm=null;function Km(n,s){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Wm=new Map,s.forEac
vendor: 13,450 bytes, lines 49-74
49h(d6,n),Wm=null,Hm.call(n))}function d6(n,s){if(!(s.state.loading&4)){var i=Wm.get(n);if(i)var l=i.get(null);else{i=new Map,Wm.set(n,i);for(var u=n.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<u.length;p++){var y=u[p];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(i.set(y.dataset.precedence,y),l=y)}l&&i.set(null,l)}u=s.instance,y=u.getAttribute("data-precedence"),p=i.get(y)||l,p===l&&i.set(null,u),i.set(y,u),this.count++,l=Hm.bind(this),u.addEventListener("load",l),u.addEventListener("error",l),p?p.parentNode.insertBefore(u,p.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(u,n.firstChild)),s.state.loading|=4}}var kd={$$typeof:Me,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function c6(n,s,i,l,u,p,y,S,I){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Jo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jo(0),this.hiddenUpdates=Jo(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=p,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function Sb(n,s,i,l,u,p,y,S,I,j,J,re){return n=new c6(n,s,i,y,I,j,J,re,S),s=1,p===!0&&(s|=24),p=no(3,null,null,s),n.current=p,p.stateNode=n,s=Gp(),s.refCount++,n.pooledCache=s,s.refCount++,p.memoizedState={element:l,isDehydrated:i,cache:s},Xp(p),n}function kb(n){return n?(n=Ci,n):Ci}function Cb(n,s,i,l,u,p){u=kb(u),l.context===null?l.context=u:l.pendingContext=u,l=Er(s),l.payload={element:i},p=p===void 0?null:p,p!==null&&(l.callback=p),i=Sr(n,l,s),i!==null&&(Fn(i,n,s),sd(i,n,s))}function Rb(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<s?i:s}}function cf(n,s){Rb(n,s),(n=n.alternate)&&Rb(n,s)}function Db(n){if(n.tag===13||n.tag===31){var s=Pa(n,67108864);s!==null&&Fn(s,n,67108864),cf(n,67108864)}}function Mb(n){if(n.tag===13||n.tag===31){var s=io();s=_a(s);var i=Pa(n,s);i!==null&&Fn(i,n,s),cf(n,s)}}var Qm=!0;function m6(n,s,i,l){var u=K.T;K.T=null;var p=ce.p;try{ce.p=2,mf(n,s,i,l)}finally{ce.p=p,K.T=u}}function u6(n,s,i,l){var u=K.T;K.T=null;var p=ce.p;try{ce.p=8,mf(n,s,i,l)}finally{ce.p=p,K.T=u}}function mf(n,s,i,l){if(Qm){var u=uf(l);if(u===null)Yg(n,s,l,Ym,i),Ib(n,l);else if(g6(u,n,s,i,l))l.stopPropagation();else if(Ib(n,l),s&4&&-1<p6.indexOf(n)){for(;u!==null;){var p=go(u);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var y=Yo(p.pendingLanes);if(y!==0){var S=p;for(S.pendingLanes|=2,S.entangledLanes|=2;y;){var I=1<<31-Ut(y);S.entanglements[1]|=I,y&=~I}fs(p),(mt&6)===0&&(Im=le()+500,xd(0))}}break;case 31:case 13:S=Pa(p,2),S!==null&&Fn(S,p,2),Pm(),cf(p,2)}if(p=uf(l),p===null&&Yg(n,s,l,Ym,i),p===u)break;u=p}u!==null&&l.stopPropagation()}else Yg(n,s,l,null,i)}}function uf(n){return n=fo(n),pf(n)}var Ym=null;function pf(n){if(Ym=null,n=ts(n),n!==null){var s=d(n);if(s===null)n=null;else{var i=s.tag;if(i===13){if(n=c(s),n!==null)return n;n=null}else if(i===31){if(n=g(s),n!==null)return n;n=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null)}}return Ym=n,null}function Tb(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Fe()){case vt:return 2;case Jn:return 8;case gn:case Ko:return 32;case va:return 268435456;default:return 32}default:return 32}}var gf=!1,Lr=null,Nr=null,Vr=null,Cd=new Map,Rd=new Map,Ur=[],p6="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Ib(n,s){switch(n){case"focusin":case"focusout":Lr=null;break;case"dragenter":case"dragleave":Nr=null;break;case"mouseover":case"mouseout":Vr=null;break;case"pointerover":case"pointerout":Cd.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Rd.delete(s.pointerId)}}function Dd(n,s,i,l,u,p){return n===null||n.nativeEvent!==p?(n={blockedOn:s,domEventName:i,eventSystemFlags:l,nativeEvent:p,targetContainers:[u]},s!==null&&(s=go(s),s!==null&&Db(s)),n):(n.eventSystemFlags|=l,s=n.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),n)}function g6(n,s,i,l,u){switch(s){case"focusin":return Lr=Dd(Lr,n,s,i,l,u),!0;case"dragenter":return Nr=Dd(Nr,n,s,i,l,u),!0;case"mouseover":return Vr=Dd(Vr,n,s,i,l,u),!0;case"pointerover":var p=u.pointerId;return Cd.set(p,Dd(Cd.get(p)||null,n,s,i,l,u)),!0;case"gotpointercapture":return p=u.pointerId,Rd.set(p,Dd(Rd.get(p)||null,n,s,i,l,u)),!0}return!1}function Ob(n){var s=ts(n.target);if(s!==null){var i=d(s);if(i!==null){if(s=i.tag,s===13){if(s=c(i),s!==null){n.blockedOn=s,Io(n.priority,function(){Mb(i)});return}}else if(s===31){if(s=g(i),s!==null){n.blockedOn=s,Io(n.priority,function(){Mb(i)});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){n.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}n.blockedOn=null}function $m(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var i=uf(n.nativeEvent);if(i===null){i=n.nativeEvent;var l=new i.constructor(i.type,i);ql=l,i.target.dispatchEvent(l),ql=null}else return s=go(i),s!==null&&Db(s),n.blockedOn=i,!1;s.shift()}return!0}function Pb(n,s,i){$m(n)&&i.delete(s)}function f6(){gf=!1,Lr!==null&&$m(Lr)&&(Lr=null),Nr!==null&&$m(Nr)&&(Nr=null),Vr!==null&&$m(Vr)&&(Vr=null),Cd.forEach(Pb),Rd.forEach(Pb)}function Jm(n,s){n.blockedOn===s&&(n.blockedOn=null,gf||(gf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,f6)))}var Zm=null;function zb(n){Zm!==n&&(Zm=n,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){Zm===n&&(Zm=null);for(var s=0;s<n.length;s+=3){var i=n[s],l=n[s+1],u=n[s+2];if(typeof l!="function"){if(pf(l||i)===null)continue;break}var p=go(i);p!==null&&(n.splice(s,3),s-=3,mg(p,{pending:!0,data:u,method:i.method,action:l},l,u))}}))}function $i(n){function s(I){return Jm(I,n)}Lr!==null&&Jm(Lr,n),Nr!==null&&Jm(Nr,n),Vr!==null&&Jm(Vr,n),Cd.forEach(s),Rd.forEach(s);for(var i=0;i<Ur.length;i++){var l=Ur[i];l.blockedOn===n&&(l.blockedOn=null)}for(;0<Ur.length&&(i=Ur[0],i.blockedOn===null);)Ob(i),i.blockedOn===null&&Ur.shift();if(i=(n.ownerDocument||n).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var u=i[l],p=i[l+1],y=u[dn]||null;if(typeof p=="function")y||zb(i);else if(y){var S=null;if(p&&p.hasAttribute("formAction")){if(u=p,y=p[dn]||null)S=y.formAction;else if(pf(u)!==null)continue}else S=y.action;typeof S=="function"?i[l+1]=S:(i.splice(l,3),l-=3),zb(i)}}}function Lb(){function n(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(y){return u=y})},focusReset:"manual",scroll:"manual"})}function s(){u!==null&&(u(),u=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,u=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),u!==null&&(u(),u=null)}}}function ff(n){this._internalRoot=n}eu.prototype.render=ff.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(o(409));var i=s.current,l=io();Cb(i,l,n,s,null,null)},eu.prototype.unmount=ff.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;Cb(n.current,2,null,n,null,null),Pm(),s[Zo]=null}};function eu(n){this._internalRoot=n}eu.prototype.unstable_scheduleHydration=function(n){if(n){var s=Pc();n={blockedOn:null,target:n,priority:s};for(var i=0;i<Ur.length&&s!==0&&s<Ur[i].priority;i++);Ur.splice(i,0,n),i===0&&Ob(n)}};var Nb=e.version;if(Nb!=="19.2.7")throw Error(o(527,Nb,"19.2.7"));ce.findDOMNode=function(n){var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(o(188)):(n=Object.keys(n).join(","),Error(o(268,n)));return n=v(s),n=n!==null?_(n):null,n=n===null?null:n.stateNode,n};var h6={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:K,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var tu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tu.isDisabled&&tu.supportsFiber)try{Mo=tu.inject(h6),fn=tu}catch{}}return Td.createRoot=function(n,s){if(!a(n))throw Error(o(299));var i=!1,l="",u=j0,p=X0,y=H0;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(l=s.identifierPrefix),s.onUncaughtError!==void 0&&(u=s.onUncaughtError),s.onCaughtError!==void 0&&(p=s.onCaughtError),s.onRecoverableError!==void 0&&(y=s.onRecoverableError)),s=Sb(n,1,!1,null,null,i,l,null,u,p,y,Lb),n[Zo]=s.current,Qg(n),new ff(s)},Td.hydrateRoot=function(n,s,i){if(!a(n))throw Error(o(299));var l=!1,u="",p=j0,y=X0,S=H0,I=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(p=i.onUncaughtError),i.onCaughtError!==void 0&&(y=i.onCaughtError),i.onRecoverableError!==void 0&&(S=i.onRecoverableError),i.formState!==void 0&&(I=i.formState)),s=Sb(n,1,!0,s,i??null,l,u,I,p,y,S,Lb),s.context=kb(null),i=s.current,l=io(),l=_a(l),u=Er(l),u.callback=null,Sr(i,u,l),i=l,s.current.lanes=i,xa(s,i),fs(s),n[Zo]=s.current,Qg(n),new eu(s)},Td.version="19.2.7",Td}var Wb;function M6(){if(Wb)return bf.exports;Wb=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),bf.exports=D6(),bf.exports}var T6=M6();/**
50 * @license lucide-react v0.546.0 - ISC
51 *
52 * This source code is licensed under the ISC license.
53 * See the LICENSE file in the root directory of this source tree.
54 */const I6=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O6=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,o)=>o?o.toUpperCase():t.toLowerCase()),Kb=r=>{const e=O6(r);return e.charAt(0).toUpperCase()+e.slice(1)},K5=(...r)=>r.filter((e,t,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===t).join(" ").trim(),P6=r=>{for(const e in r)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
55 * @license lucide-react v0.546.0 - ISC
56 *
57 * This source code is licensed under the ISC license.
58 * See the LICENSE file in the root directory of this source tree.
59 */var z6={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
60 * @license lucide-react v0.546.0 - ISC
61 *
62 * This source code is licensed under the ISC license.
63 * See the LICENSE file in the root directory of this source tree.
64 */const L6=Re.forwardRef(({color:r="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:o,className:a="",children:d,iconNode:c,...g},h)=>Re.createElement("svg",{ref:h,...z6,width:e,height:e,stroke:r,strokeWidth:o?Number(t)*24/Number(e):t,className:K5("lucide",a),...!d&&!P6(g)&&{"aria-hidden":"true"},...g},[...c.map(([v,_])=>Re.createElement(v,_)),...Array.isArray(d)?d:[d]]));/**
65 * @license lucide-react v0.546.0 - ISC
66 *
67 * This source code is licensed under the ISC license.
68 * See the LICENSE file in the root directory of this source tree.
69 */const pt=(r,e)=>{const t=Re.forwardRef(({className:o,...a},d)=>Re.createElement(L6,{ref:d,iconNode:e,className:K5(`lucide-${I6(Kb(r))}`,`lucide-${r}`,o),...a}));return t.displayName=Kb(r),t};/**
70 * @license lucide-react v0.546.0 - ISC
71 *
72 * This source code is licensed under the ISC license.
73 * See the LICENSE file in the root directory of this source tree.
74 */const N6=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l
74-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Qb=pt("activity",N6);/**
75 * @license lucide-react v0.546.0 - ISC
76 *
77 * This source code is licensed under the ISC license.
78 * See the LICENSE file in the root directory of this source tree.
79 */const V6=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],U6=pt("arrow-left",V6);/**
80 * @license lucide-react v0.546.0 - ISC
81 *
82 * This source code is licensed under the ISC license.
83 * See the LICENSE file in the root directory of this source tree.
84 */const B6=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],G6=pt("arrow-up",B6);/**
85 * @license lucide-react v0.546.0 - ISC
86 *
87 * This source code is licensed under the ISC license.
88 * See the LICENSE file in the root directory of this source tree.
89 */const q6=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],F6=pt("check",q6);/**
90 * @license lucide-react v0.546.0 - ISC
91 *
92 * This source code is licensed under the ISC license.
93 * See the LICENSE file in the root directory of this source tree.
94 */const j6=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],X6=pt("chevron-left",j6);/**
95 * @license lucide-react v0.546.0 - ISC
96 *
97 * This source code is licensed under the ISC license.
98 * See the LICENSE file in the root directory of this source tree.
99 */const H6=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Q5=pt("chevron-right",H6);/**
100 * @license lucide-react v0.546.0 - ISC
101 *
102 * This source code is licensed under the ISC license.
103 * See the LICENSE file in the root directory of this source tree.
104 */const W6=[["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"}]],K6=pt("circle-alert",W6);/**
105 * @license lucide-react v0.546.0 - ISC
106 *
107 * This source code is licensed under the ISC license.
108 * See the LICENSE file in the root directory of this source tree.
109 */const Q6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Nf=pt("circle-check",Q6);/**
110 * @license lucide-react v0.546.0 - ISC
111 *
112 * This source code is licensed under the ISC license.
113 * See the LICENSE file in the root directory of this source tree.
114 */const Y6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],$6=pt("circle-question-mark",Y6);/**
115 * @license lucide-react v0.546.0 - ISC
116 *
117 * This source code is licensed under the ISC license.
118 * See the LICENSE file in the root directory of this source tree.
119 */const J6=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Yb=pt("clock",J6);/**
120 * @license lucide-react v0.546.0 - ISC
121 *
122 * This source code is licensed under the ISC license.
123 * See the LICENSE file in the root directory of this source tree.
124 */const Z6=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],$b=pt("cpu",Z6);/**
125 * @license lucide-react v0.546.0 - ISC
126 *
127 * This source code is licensed under the ISC license.
128 * See the LICENSE file in the root directory of this source tree.
129 */const ex=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],tx=pt("database",ex);/**
130 * @license lucide-react v0.546.0 - ISC
131 *
132 * This source code is licensed under the ISC license.
133 * See the LICENSE file in the root directory of this source tree.
134 */const nx=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",ke
134y:"1slcih"}]],ox=pt("flame",nx);/**
135 * @license lucide-react v0.546.0 - ISC
136 *
137 * This source code is licensed under the ISC license.
138 * See the LICENSE file in the root directory of this source tree.
139 */const sx=[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]],rx=pt("headphones",sx);/**
140 * @license lucide-react v0.546.0 - ISC
141 *
142 * This source code is licensed under the ISC license.
143 * See the LICENSE file in the root directory of this source tree.
144 */const ax=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],ix=pt("image",ax);/**
145 * @license lucide-react v0.546.0 - ISC
146 *
147 * This source code is licensed under the ISC license.
148 * See the LICENSE file in the root directory of this source tree.
149 */const lx=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],dx=pt("laptop",lx);/**
150 * @license lucide-react v0.546.0 - ISC
151 *
152 * This source code is licensed under the ISC license.
153 * See the LICENSE file in the root directory of this source tree.
154 */const cx=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],mx=pt("menu",cx);/**
155 * @license lucide-react v0.546.0 - ISC
156 *
157 * This source code is licensed under the ISC license.
158 * See the LICENSE file in the root directory of this source tree.
159 */const ux=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],px=pt("message-square",ux);/**
160 * @license lucide-react v0.546.0 - ISC
161 *
162 * This source code is licensed under the ISC license.
163 * See the LICENSE file in the root directory of this source tree.
164 */const gx=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],fx=pt("monitor",gx);/**
165 * @license lucide-react v0.546.0 - ISC
166 *
167 * This source code is licensed under the ISC license.
168 * See the LICENSE file in the root directory of this source tree.
169 */const hx=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],vx=pt("panels-top-left",hx);/**
170 * @license lucide-react v0.546.0 - ISC
171 *
172 * This source code is licensed under the ISC license.
173 * See the LICENSE file in the root directory of this source tree.
174 */const bx=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],yx=pt("plus",bx);/**
175 * @license lucide-react v0.546.0 - ISC
176 *
177 * This source code is licensed under the ISC license.
178 * See the LICENSE file in the root directory of this source tree.
179 */const xx=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ax=pt("refresh-cw",xx);/**
180 * @license lucide-react v0.546.0 - ISC
181 *
182 * This source code is licensed under the ISC license.
183 * See the LICENSE file in the root directory of this source tree.
184 */const _x=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],wx=pt("search",_x);/**
185 * @license lucide-react v0.546.0 - ISC
186 *
187 * This source code is licensed under the ISC license.
188 * See the LICENSE file in the root directory of this source tree.
189 */const Ex=[["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"}]],Sx=pt("send",Ex);/**
190 * @license lucide-react v0.546.0 - ISC
191 *
192 * This source code is licensed under the ISC license.
193 * See the LICENSE file in the root directory of this source tree.
194 */const kx=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Vf=pt("terminal",kx);/**
195 * @license lucide-react v0.546.0 - ISC
196 *
197 * This source code is licensed under the ISC license.
198 * See the LICENSE file in the root directory of this source tree.
199 */const Cx=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],Rx=pt("thumbs-up",Cx);/**
200 * @license lucide-react v0.546.0 - ISC
201 *
202 * This source code is licensed under the ISC license.
203 * See the LICENSE file in the root directory of this source tree.
204 */const Dx=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Mx=pt("trash-2",Dx);/**
205 * @license lucide-react v0.546.0 - ISC
206 *
207 * This source code is licensed under the ISC license.
208 * See the LICENSE file in the root directory of this source tree.
209 */const Tx=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Y5=pt("triangle-alert",Tx);/**
210 * @license lucide-react v0.546.0 - ISC
211 *
212 * This source code is licensed under the ISC license.
213 * See the LICENSE file in the root directory of this source tree.
214 */const Ix=[["path",{d:"M18 6 6 18",key:"1bl5f8"}
214],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ox=pt("x",Ix);/**
215 * @license lucide-react v0.546.0 - ISC
216 *
217 * This source code is licensed under the ISC license.
218 * See the LICENSE file in the root directory of this source tree.
219 */const Px=[["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"}]],Jb=pt("zap",Px),Zb={"pt-BR":{amihart:{id:"amihart",title:"31. MÉTODO AMIHART — INFERÊNCIA RX580 EM POLARIS/DEBIAN",desc:"Nota de Crédito: Seção documental em homenagem à prova de conceito realizada por Amihart, pioneira na validação de Vulkan sob Debian GCN4/Polaris.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:30,tags:["metodo-amihart","debian-polaris","vulkan-diagnostics"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comunidade"],previous:"comunidade",next:"dadhacks",related:["comunidade","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Em janeiro de 2025, o desenvolvedor <strong style="color:#fff">Amihart</strong> publicou um estudo técnico demonstrando que, apesar das limitações oficiais impostas pela AMD (fim do suporte oficial do ROCm para arquiteturas Polaris/GCN4), o hardware RX 580 ainda possui pleno potencial de aceleração de IA.</p>
220  
221  <div style="display:grid;grid-template-columns:1fr 1fr;gap:.85rem;margin-bottom:1.25rem">
222    <div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid var(--r)">
223      <p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">Abordagem AIVisionsLab (Windows Nativo)</p>
224      <ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8">
225        <li>Execução no sistema hospedeiro (Windows).</li>
226        <li>Foco em produção diária de alta estabilidade.</li>
227        <li>Tuning de orquestração Vulkan nativo.</li>
228        <li>Segmentação VRAM/CPU híbrida no WSL.</li>
229      </ul>
230    </div>
231    <div class="card" style="border-left:3px solid #22c55e;padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid #22c55e">
232      <p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">O Método Amihart (Linux/Debian)</p>
233      <ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8">
234        <li>Execução em ecossistema Linux/Debian.</li>
235        <li>Isolamento robusto via containers Docker.</li>
236        <li>Compilação estrita com flags do Vulkan API.</li>
237        <li>Sandbox ROCm adaptado virtualizado.</li>
238      </ul>
239    </div>
240  </div>
241
242  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. Setup de LLM — Vulkan no Debian</h4>
243  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">O llama.cpp é compilado com Vulkan API puro para contornar a ausência do driver ROCm:</p>
244  <div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Passo 1: Instalar drivers Vulkan e pré-requisitos de compilação
245sudo apt install vulkan-tools libtcmalloc-minimal4 libcurl4-openssl-dev glslc cmake make git pkg-config libvulkan-dev
246
247# Passo 2: Clonar e compilar o llama.cpp com Vulkan habilitado
248cd ~
249git clone https://github.com/ggerganov/llama.cpp
250cd llama.cpp && mkdir build && cd build
251cmake .. -DGGML_VULKAN=on -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=ON
252
253# Passo 3: Adicionar binários ao PATH de execução
254echo 'export PATH=$PATH:'$(realpath bin) >> ~/.bashrc
255source ~/.bashrc
256
257# Passo 4: Executar DeepSeek R1 8B (Aceleração Vulkan0)
258llama-cli -m deepseek-r1:8B --device Vulkan0 -ngl 100</code></pre></div>
259
260  <p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Métrica de Desempenho (Amihart):</strong> No Celeron G6900 operando sem GPU, a resposta é de 5,45 tokens/s. Utilizando aceleração Vulkan pura na RX 580 com 100 camadas offload, a performance sobe para <strong style="color:var(--r)">24,56 tokens/s</strong>, tornando o modelo viável e ágil.</p>
261
262  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">B. Setup de Stable Diffusion — Sandbox Docker</h4>
263  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Como geradores de imagem exigem dependências ROCm, Amihart utiliza containers virtuais isolados para rodar a Web
263UI de forma limpa no Debian:</p>
264  <div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Passo 1: Instalação do motor Docker e chaves estritas
265sudo apt update && sudo apt install -y ca-certificates curl
266install -m 0755 -d /etc/apt/keyrings
267curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
268chmod a+r /etc/apt/keyrings/docker.asc
269echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
270sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io
271
272# Passo 2: Clonagem da WebUI e execução sob isolamento ROCm gfx803
273cd ~
274git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
275cd ~/stable-diffusion-webui
276
277sudo docker run -it \\
278  --network=host --device=/dev/kfd --device=/dev/dri \\
279  --ipc=host --shm-size 16G --group-add video \\
280  --cap-add=SYS_PTRACE \\
281  --rm -v $(pwd)/cache:/root/.cache \\
282  -v $(pwd)/data:/stable-diffusion-webui/data \\
283  woodrex/sd-webui-for-gfx803:latest</code></pre></div>
284
285  <p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Otimização Crítica do Cache Amihart:</strong> Para evitar re-loadings de dependências todas as vezes que o container iniciar:</p>
286  <div class="code" style="margin-bottom:1.5rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Obter o CONTAINER ID ativo
287sudo docker ps -l
288# Cometer o estado para uma nova imagem persistente
289sudo docker commit [CONTAINER_ID]
290# Ver o ID da imagem persistida e substituir a chamada de docker run por ele
291sudo docker images</code></pre></div>
292
293  <div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem">
294    <strong style="color:var(--r)">Métricas e Referências Técnicas:</strong> Roteamento baseado na publicação original de <a href="https://amihart.medium.com/inference-with-an-rx580-13e9c1055472" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">Amihart</a> (Medium, Janeiro de 2025). O conhecimento é aberto e útil à comunidade.
295  </div>`},"animatediff-video":{id:"animatediff-video",title:"19. ANIMATEDIFF E INTERPOLAÇÃO DE QUADROS (VÍDEO)",desc:"Injetando consistência temporal no ComfyUI sobre hardware legado para estruturar loops fluidos coprocessados no Intel Xeon.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"advanced",estimated_time_min:30,tags:["animatediff","geracao-video","motion-modules"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-modelos"],previous:"comfyui-modelos",next:"stack",related:["comfyui-flux","sdxl_vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
296  O <strong>AnimateDiff</strong> é um framework de modelagem temporal projetado especificamente para converter modelos de difusão estática (como Stable Diffusion 1.5) em geradores de vídeo consistentes. Ele funciona injetando módulos de atenção temporal sobrepostos no ComfyUI/WSL2. Essa técnica permite calcular transições de quadros adjacentes de forma matematicamente coordenada, gerando loops fluidos e eliminando os efeitos estáticos caóticos de ruído cintilante.
297</p>
298
299<!-- Stat cards of render cost -->
300<div style="display:grid;grid-template-columns:1fr 1fr;gap:1.25rem;margin-bottom:1.5rem">
301  <div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px">
302    <div style="font-size:1.8rem">🎬</div>
303    <div>
304      <div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">Pipeline de Vídeo</div>
305      <div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#fff">AnimateDiff (WSL2 Pure CPU)</div>
306      <div style="font-size:.65rem;color:#64748b;margin-top:2px">24 Threads Intel Xeon E5</div>
307    </div>
308  </div>
309  <div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px">
310    <div style="font-size:1.8rem">⏳</div>
311    <div>
312      <div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">Métrica de Processamento</div>
313      <div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#34d399">~141s por Segundo de Frame</div>
314      <div style="font-size:.65rem;color:#64748b;margin-top:2px">Renderização temporal interpolada</div>
315    </div>
316  </div>
317</div>
318
319<!-- Visual Exhibition Player -->
320<div style="background:#0F1115;border:1px solid rgba(255,255,255,0.04);border-radius:6px;padding:1.5rem;margin-bottom:1.5rem">
321  <h4 style="font-size:.85rem;color:#fff;text-transform:uppercase;letter-spacing:1px;margin-bottom:1rem;display:flex;align-items:center;gap:.5rem;margin-top:0">
322    <span>🎥</span> Vitrine Interativa de Geração (Breathe-Loop de Vídeo por Cache Local)
323  </h4>
324  <p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">
325    Abaixo estão representados os dois outputs renderizados pela sua pilha de IA local. Passe o mouse para ativar a sensação de vídeo interpolada, ou clique no botão simulador para iniciar o render sintético do Xeon:
326  </p>
327  
328  <div style="display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-bottom:1.25rem">
329    <!-- Player 1: Cyberpunk -->
330    <div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1">
331      <img src="/images/cyberpunk_alley_0_1779586391528.png" alt="Cyberpunk Neon Alley" referrerPolicy="no-referrer" class="animatediff-img-1" style="width:100%;height:100%;object-fit:cover;transition:transform 8s ease-in-out, filter 2s ease;filter:brightness(0.9)" />
332      <div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem">
333        <span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span>
334        <span>CYBER_STREET_00.GIF</span>
335      </div>
336      <div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.75rem .5rem .5rem .75rem;display:flex;justify-content:space-between;align-items:center">
337        <span style="font-family:monospace;font-size:9px;color:#64748b">Stable Diffusion 1.5</span>
338        <span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">VULKAN_OK</span>
339      </div>
340    </div>
341
342    <!-- Player 2: Cosmic Glass -->
343    <div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1">
344      <img src="/images/cosmic_glass_0_1779586410888.png" alt="Cosmic Glass Flask" referrerPolicy="no-referrer" class="animatediff-img-2" style="width:100%;height:100%;object-fit:cover;transition:transform 6s ease-in-out, filter 3s ease;filter:brightness(0.85)" />
345      <div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem">
346        <span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span>
347        <span>ALCHEM_COSMOS_01.GIF</span>
348      </div>
349      <div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.5rem .75rem;display:flex;justify-content:space-between;align-items:center">
350        <span style="font-family:monospace;font-size:9px;color:#64748b">Pure Xeon Model</span>
351        <span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">THREADED_OK</span>
352      </div>
353    </div>
354  </div>
355
356  <div style="text-align:center;margin-top:.5rem">
357    <button onclick="toggleAnimateDiffSim(this)" style="background:rgba(239, 68, 68, 0.1);border:1px solid rgba(239, 68, 68, 0.4);border-radius:3px;color:#fca5a5;font-family:monospace;padding:.5rem 1rem;font-size:.72rem;cursor:pointer;transition:all 0.2s;text-transform:uppercase">
358      ▶ Ativar Simulação de Movimento
359    </button>
360  </div>
361  
362  <div id="sim-log-box" style="background:#07080a;border:1px solid rgba(255,255,255,0.01);border-radius:3px;padding:0.75rem;margin-top:1rem;font-family:monospace;font-size:10px;color:#475569;line-height:1.5;display:none;max-height:120px;overflow-y:auto;text-align:left">
363  </div>
364</div>
365
366<style>
367  .video-preview-box:hover .animatediff-img-1 {
368    transform: scale(1.1) rotate(0.5deg);
369    filter: brightness(1.1) saturate(1.15) !important;
370  }
371  .video-preview-box:hover .animatediff-img-2 {
372    transform: scale(1.08) rotate(-0.5deg);
373    filter: brightness(1.05) saturate(1.2) !important;
374  }
375  .animate-active-1 {
376    animation: panCyberpunk 12s infinite alternate ease-in-out;
377    filter: brightness(1.1) saturate(1.15) !important;
378  }
379  .animate-active-2 {
380    animation: panGlass 10s infinite alternate ease-in-out;
381    filter: brightness(1.05) saturate(1.2) !important;
382  }
383  @keyframes panCyberpunk {
384    0% { transform: scale(1); filter: hue-rotate(0deg); }
385    50% { transform: scale(1.12) translate(5px, -3px); filter: hue-rotate(15deg); }
386    100% { transform: scale(1.02) translate(-5px, 2px); filter: hue-rotate(-10deg); }
387  }
388  @keyframes panGlass {
389    0% { transform: scale(1.02) rotate(0deg); }
390    50% { transform: scale(1.15) translate(-2px, 4px) rotate(1deg); filter: hue-rotate(5deg); }
391    100% { transform: scale(1.05) translate(4px, -2px) rotate(-0.5deg); filter: hue-rotate(-5deg); }
392  }
393  @keyframes heartbeat {
394    0%, 100% { opacity: 0.4; }
395    50% { opacity: 1; }
396  }
397  .pulse-red {
398    animation: heartbeat 1s infinite;
399  }
400</style>`},arquivos:{id:"arquivos",title:"35. TAXONOMIA E ESTRUTURA DE ARQUIVOS NVMe",desc:"Árvore de diretórios unificada para rastreamento de binários compilados e modelos compartilhados.",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"armazenamento",difficulty:"beginner",estimated_time_min:10,tags:["nvme-struct","model-directories","storage-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proximos"],previous:"proximos",next:"meta",related:["comfyui-modelos","meta"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Organização estrutural rigorosa dos caminhos físicos mantidos dentro da partição de alta velocidade do SSD:</p>
401  <pre style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#e2e8f0;background:rgba(0,0,0,.3);padding:.9rem;border-radius:4px;border:1px solid var(--b)">
402E:\\
403├── llama.cpp\\
404│   └── build\\bin\\Release\\
405│       ├── llama-server.exe     <span style="color:#64748b"># Servidor de Linguagem Local</span>
406│       └── llama-cli.exe        <span style="color:#64748b"># Utilitario de Diagnostico</span>
407├── stable-diffusion.cpp\\
408│   └── build\\bin\\Release\\
409│       ├── sd-server.exe        <span style="color:#64748b"># Servidor de Imagem Vulkan</span>
410│       └── sd-cli.exe           <span style="color:#64748b"># Conversor de Modelos GGUF</span>
411└── models\\
412    ├── mistral-7b-instruct.Q4_K_M.gguf
413    └── dreamshaper8.gguf        <span style="color:#64748b"># Checkpoint SD 1.5 Quantizado</span></pre>`},audio_rvc:{id:"audio_rvc",title:"38. VOICE CONVERSION LOCAL — APPLIO RVC EM AMD RX 580 (Fases Iniciais)",desc:"Pipeline de clonagem de voz no Windows sem CUDA NVIDIA - Configuração do ambiente e primeiras fases.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:35,tags:["applio","rvc-voice-clone","sintese-audio"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linhatempo"],previous:"linhatempo",next:"audio_whisper",related:["audio_whisper","audio_srt_ptbr"]},part:1},html:`<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
414  Documentação honesta de uma instalação real, incluindo todas as tentativas, erros e soluções.<br />
415  Conduzida em duas sessões: ChatGPT (fases iniciais) + Claude (fases finais).
416</blockquote>
417
418<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">CONTEXTO DO PROJETO</h3>
419<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O objetivo era montar um pipeline de produção audiovisual para canal do YouTube estilo dark/documentário:</p>
420<div class="code" style="margin-bottom:1.25rem">
421  <pre><code>Texto → Balabolka + Antônio Neural (TTS) → WAV → Applio/RVC → Yuri (voz clonada)</code></pre>
422</div>
423<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A ideia central: separar <strong>atuação</strong> de <strong>identidade vocal</strong>.</p>
424<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
425  <li><strong style="color:#fff">Antônio Neural</strong> faz a interpretação, prosódia e emoção (voz Microsoft Neural)</li>
426  <li><strong style="color:#fff">Yuri</strong> (modelo RVC treinado) aplica a identidade vocal por cima</li>
427</ul>
428<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.5rem">Isso produz resultado muito mais natural que TTS generativo puro.</p>
429
430<div class="tbl" style="margin-bottom:1.5rem">
431  <table>
432    <thead>
433      <tr>
434        <th>Aspecto</th>
435        <th>XTTS/TTS puro</th>
436        <th>Antônio → Yuri (RVC)</th>
437      </tr>
438    </thead>
439    <tbody>
440      <tr>
441        <td>Prosódia</td>
442        <td>Artificial</td>
443        <td>Humana (ator real)</td>
444      </tr>
445      <tr>
446        <td>Termos técnicos</td>
447        <td>Tropeça</td>
448        <td>Lê corretamente</td>
449      </tr>
450      <tr>
451        <td>Textos longos</td>
452        <td>Degrada</td>
453        <td>Estável</td>
454      </tr>
455      <tr>
456        <td>Identidade vocal</td>
457        <td>Genérica</td>
458        <td>Clonada</td>
459      </tr>
460      <tr>
461        <td>Naturalidade</td>
462        <td>60-70%</td>
463        <td>80-95%</td>
464      </tr>
465    </tbody>
466  </table>
467</div>
468
469<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">HARDWARE UTILIZADO</h3>
470<div class="tbl" style="margin-bottom:1.5rem">
471  <table>
472    <thead>
473      <tr>
474        <th>Item</th>
475        <th>Especificação</th>
476      </tr>
477    </thead>
478    <tbody>
479      <tr>
480        <td>CPU</td>
481        <td>Intel Xeon E5-2690 v3 (24 núcleos)</td>
482      </tr>
483      <tr>
484        <td>GPU</td>
485        <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
486      </tr>
487      <tr>
488        <td>RAM</td>
489        <td>31.8 GB DDR4 REG ECC</td>
490      </tr>
491      <tr>
492        <td>OS</td>
493        <td>Windows 11</td>
494      </tr>
495      <tr>
496        <td>Storage</td>
497        <td>SSD NVMe (E:)</td>
498      </tr>
499      <tr>
500        <td>Python</td>
501        <td>3.11.9</td>
502      </tr>
503    </tbody>
504  </table>
505</div>
506
507<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 0 — TENTATIVA COM DATASET DO ANTÔNIO (fracasso documentado)</h3>
508<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A ideia original era treinar o modelo RVC com horas de áudio do Antônio Neural. Foi criado um script <code>split.py</code> com Whisper para segmentar automaticamente o áudio em clips de 6-12 segundos.</p>
509<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-bottom:0.5rem"><strong>O problema: estouro de memória</strong></p>
510<div class="code" style="margin-bottom:1.25rem">
511  <pre><code>MemoryError
512concurrent.futures.process.BrokenProcessPool</code></pre>
513</div>
514<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O pré-processamento de dataset grande (~2h34 de áudio) estourou RAM e VRAM simultaneamente. Mesmo quando terminava, o volume de 1000+ clips causava instabilidade no pipeline do Applio.</p>
515<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem"><strong>Decisão:</strong> abandonar o dataset do Antônio e usar diretamente <strong>9 minutos de TTS do ElevenLabs</strong> com a voz do Yuri. Menor, mais limpo, mais controlado.</p>
516
517<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 1 — INSTALAÇÃO DO AMBIENTE BASE</h3>
518<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Estrutura de pastas:</strong></p>
519<div class="code" style="margin-bottom:1.25rem">
520  <pre><code>E:\\tts-audio_pra_youtube\\
521├── Applio\\
522├── voices\\
523│   └── YURI-TTS.wav  (9 minutos, ElevenLabs, voz Yuri)
524├── output\\
525└── scripts\\</code></pre>
526</div>
527
528<div class="err" style="margin-bottom:1.25rem">
529  <div class="err-t">⚠️ Problema: Python 3.10 incompatível</div>
530  <p>O Applio moderno exige Python 3.11+. O numpy 2.4.4 requerido não existe para 3.10.</p>
531</div>
532
533<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução:</strong> instalar Python 3.11 em paralelo sem remover o 3.10:</p>
534<div class="code" style="margin-bottom:1.25rem">
535  <span class="code-lang">powershell</span>
536  <pre><code>py -0
537# -V:3.11  Python 3.11 (64-bit)   ← usar esta
538# -V:3.10  Python 3.10 (64-bit)   ← manter para outros projetos
539
540py -3.11 -m venv venv
541venv\\Scripts\\activate
542python --version
543# Python 3.11.9  ✅</code></pre>
544</div>
545
546<div class="err" style="margin-bottom:1.25rem">
547  <div class="err-t">⚠️ Problema: requirements.txt com CUDA forçado</div>
548  <div class="code" style="margin-top:0.5rem;margin-bottom:0.5rem">
549    <pre><code># O Applio traz esta linha que quebra no AMD Windows:
550torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'</code></pre>
551  </div>
552  <p>O sufixo <code>+cu128</code> é CUDA 12.8 exclusivo NVIDIA. No Windows (<code>win32</code>), essa condição sempre é verdadeira.</p>
553</div>
554
555<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução:</strong> editar o <code>requirements.txt</code>:</p>
556<div class="code" style="margin-bottom:1.25rem">
557  <pre><code># REMOVER:
558torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
559torchaudio==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
560torchvision==0.22.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
561
562# SUBSTITUIR POR:
563torch==2.7.1; sys_platform == 'win32'
564torchaudio==2.7.1; sys_platform == 'win32'
565torchvision==0.22.1; sys_platform == 'win32'</code></pre>
566</div>
567
568<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 2 — TENTATIVA DIRECTML (fracasso documentado)</h3>
569<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Com o Applio rodando em CPU (~10 min por época), tentou-se acelerar com DirectML.</p>
570<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Instalação e teste:</strong></p>
571<div class="code" style="margin-bottom:1.25rem">
572  <span class="code-lang">powershell</span>
573  <pre><code>pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
574pip install torch-directml
575
576python -c "import torch_directml; dml = torch_directml.device(); print(dml)"
577# privateuseone:0  ✅  — RX 580 reconhecida</code></pre>
578</div>
579<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Resultado real:</strong></p>
580<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
581  <li>GPU uso: 7-10%</li>
582  <li>VRAM: 1.2GB usada</li>
583  <li>Velocidade com DirectML: <strong>4.27s/it</strong></li>
584  <li>Velocidade sem DirectML (CPU): <strong>4.46s/it</strong></li>
585  <li>Diferença real: <strong>~5%</strong> — irrelevante</li>
586</ul>
587<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Por que foi abandonado:</strong></p>
588<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O <code>torch-directml</code> está preso na versão <code>0.2.5.dev240914</code> (setembro 2024) e exige <code>torch==2.4.1</code>. O Applio precisa de <code>torch==2.7.1</code>. Conflito irreconciliável:</p>
589<div class="code" style="margin-bottom:1.25rem">
590  <pre><code>torch-directml 0.2.5 requires torch==2.4.1
591hyper-connections 0.4.11 requires torch>=2.5   ← conflito
592torch-einops-utils 0.1.1 requires torch>=2.5   ← conflito</code></pre>
593</div>
594<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A Microsoft parou de investir no DirectML para IA. O projeto está essencialmente abandonado.</p>
595<p style="font-size:.88rem;color:#10b981;line-height:1.9;margin-bottom:1.25rem">✅ <strong>Conclusão:</strong> DirectML para RVC em Windows AMD em 2026 = não vale a pena.</p>
596<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 3 — ERRO CRÍTICO: VARIÁVEIS DE AMBIENTE</h3>
597<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Durante tentativas de forçar CPU, foram usados comandos que <strong>silenciosamente quebravam a extração de características</strong>:</p>
598<div class="code" style="margin-bottom:1.25rem">
599  <span class="code-lang">powershell</span>
600  <pre><code># ❌ NUNCA FAZER ISSO com Applio AMD:
601set USE_DIRECTML=0
602set CUDA_VISIBLE_DEVICES=-1
603set ROCM_VISIBLE_DEVICES=-1
604set HIP_VISIBLE_DEVICES=-1</code></pre>
605</div>
606<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Esses comandos deixavam a pasta <code>extracted</code> vazia após a extração. O treino terminava em <strong>segundos</strong> dizendo "Model trained successfully" sem gerar nenhum <code>.pth</code>.</p>
607<div class="code" style="margin-bottom:1.25rem">
608  <pre><code>Not enough data present in the training set.
609Feature files in logs\\my-project\\extracted could not be loaded correctly.</code></pre>
610</div>
611<div class="err" style="margin-bottom:1.25rem">
612  <div class="err-t">⚠️ Armadilha: "Model trained successfully" em segundos = treino fake.</div>
613  <p>Sempre verificar se <code>logs/projeto/extracted/</code> tem arquivos <code>.npy</code> antes de treinar.</p>
614</div>
615
616<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 4 — INSTALAÇÃO LIMPA (solução final)</h3>
617<div class="code" style="margin-bottom:1.25rem">
618  <span class="code-lang">powershell</span>
619  <pre><code># 1. Destruir ambiente corrompido
620deactivate
621Remove-Item -Recurse -Force venv
622Remove-Item -Recurse -Force logs
623
624# 2. Criar venv limpo
625py -3.11 -m venv venv
626venv\\Scripts\\activate
627python -m pip install --upgrade pip
628
629# 3. Instalar torch base
630pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
631pip install torch-directml
632
633# 4. Instalar dependências sem sobrescrever torch
634pip install -r requirements.txt --no-deps
635
636# 5. Corrigir dependências faltantes
637pip install gradio-client==1.14.0
638pip install cffi soupsieve local-attention
639pip install "aiofiles&lt;25.0" "pandas&lt;3.0" "pydantic&lt;=2.12.3"
640pip install "starlette&lt;1.0,&gt;=0.40.0" "tomlkit&lt;0.14.0"
641pip install "tokenizers&gt;=0.22.0,&lt;=0.23.0"
642pip install audioread decorator lazy-loader msgpack pooch scikit-learn resampy</code></pre>
643</div>
644<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>config.py — versão final (sem DirectML):</strong></p>
645<div class="code" style="margin-bottom:1.25rem">
646  <span class="code-lang">python</span>
647  <pre><code>import torch
648import json
649import os
650
651@singleton
652class Config:
653    def __init__(self):
654        self.device = "cuda:0" if torch.cuda.is_available() else "cpu"
655        # No AMD Windows sem CUDA, usa "cpu" automaticamente</code></pre>
656</div>
657<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Iniciar:</strong></p>
658<div class="code" style="margin-bottom:1.25rem">
659  <span class="code-lang">powershell</span>
660  <pre><code># PowerShell LIMPO, sem nenhum 'set' antes
661python app.py
662# * Running on local URL: http://127.0.0.1:6969  ✅</code></pre>
663</div>
664
665<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 5 — ARQUIVOS MUTE FALTANDO</h3>
666<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Na instalação via git, os arquivos de silêncio não são criados. Aparecem um por um durante o treino:</p>
667<div class="code" style="margin-bottom:1.25rem">
668  <pre><code>FileNotFoundError: logs\\mute\\sliced_audios\\mute40000.wav
669FileNotFoundError: logs\\mute\\extracted\\mute.npy          ← shape errado causa crash
670FileNotFoundError: logs\\mute\\f0\\mute.wav.npy
671FileNotFoundError: logs\\mute\\f0_voiced\\mute.wav.npy
672RuntimeError: tensor (100) must match size (768)</code></pre>
673</div>
674<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução — criar todos de uma vez:</strong></p>
675<div class="code" style="margin-bottom:1.25rem">
676  <span class="code-lang">powershell</span>
677  <pre><code>python -c "
678import numpy as np, soundfile as sf, os
679[os.makedirs(d, exist_ok=True) for d in [
680    'logs/mute/sliced_audios','logs/mute/extracted',
681    'logs/mute/f0','logs/mute/f0_voiced'
682]]
683sf.write('logs/mute/sliced_audios/mute40000.wav', np.zeros(int(40000*3.7)), 40000)
684sf.write('logs/mute/sliced_audios/mute48000.wav', np.zeros(int(48000*3.7)), 48000)
685sf.write('logs/mute/sliced_audios/mute32000.wav', np.zeros(int(32000*3.7)), 32000)
686np.save('logs/mute/extracted/mute.npy', np.zeros((196, 768)))
687np.save('logs/mute/f0/mute.wav.npy', np.zeros(100))
688np.save('logs/mute/f0_voiced/mute.wav.npy', np.zeros(100))
689print('OK')
690"</code></pre>
691</div>
692<div class="err" style="margin-bottom:1.25rem">
693  <div class="err-t">⚠️ Crítico: mute.npy precisa ter shape (196, 768)</div>
694  <p>dimensão 768 do embedder contentvec. Qualquer outro shape causa crash.</p>
695</div>
696
697<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">
697FASE 6 — DATASET E TREINO</h3>
698<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Dataset usado:</strong></p>
699<div class="tbl" style="margin-bottom:1.5rem">
700  <table>
701    <thead>
702      <tr>
703        <th>Parâmetro</th>
704        <th>Valor</th>
705      </tr>
706    </thead>
707    <tbody>
708      <tr>
709        <td>Arquivo</td>
710        <td>YURI-TTS.wav</td>
711      </tr>
712      <tr>
713        <td>Duração</td>
714        <td>9 minutos</td>
715      </tr>
716      <tr>
717        <td>Fonte</td>
718        <td>ElevenLabs TTS</td>
719      </tr>
720      <tr>
721        <td>Nota</td>
722        <td>Mínimo aceitável. Ideal: 15-25 min</td>
723      </tr>
724    </tbody>
725  </table>
726</div>
727
728<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Configurações do Applio:</strong></p>
729<div class="tbl" style="margin-bottom:1.5rem">
730  <table>
731    <thead>
732      <tr>
733        <th>Parâmetro</th>
734        <th>Valor</th>
735      </tr>
736    </thead>
737    <tbody>
738      <tr>
739        <td>Taxa de amostragem</td>
740        <td>40000 Hz</td>
741      </tr>
742      <tr>
743        <td>Vocoder</td>
744        <td>HiFi-GAN</td>
745      </tr>
746      <tr>
747        <td>Algoritmo de pitch</td>
748        <td>RMVPE</td>
749      </tr>
750      <tr>
751        <td>Embedder</td>
752        <td>contentvec</td>
753      </tr>
754      <tr>
755        <td>Tamanho do lote</td>
756        <td>4</td>
757      </tr>
758      <tr>
759        <td>Total de épocas</td>
760        <td>200</td>
761      </tr>
762      <tr>
763        <td>Número da GPU</td>
764        <td><strong>vazio</strong> (não colocar 0, -1 ou cpu)</td>
765      </tr>
766    </tbody>
767  </table>
768</div>
769
770<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Métricas reais:</strong></p>
771<div class="tbl" style="margin-bottom:1.5rem">
772  <table>
773    <thead>
774      <tr>
775        <th>Época</th>
776        <th>Loss</th>
777        <th>Tempo por época</th>
778      </tr>
779    </thead>
780    <tbody>
781      <tr>
782        <td>1</td>
783        <td>27.181</td>
784        <td>7:21</td>
785      </tr>
786      <tr>
787        <td>8</td>
788        <td>17.93</td>
789        <td>7:02</td>
790      </tr>
791      <tr>
792        <td>20</td>
793        <td>16.212</td>
794        <td>7:43</td>
795      </tr>
796      <tr>
797        <td>43</td>
798        <td>15.785</td>
799        <td>5:43</td>
800      </tr>
801    </tbody>
802  </table>
803</div>
804<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
805  <li>Velocidade: ~6 minutos por época</li>
806  <li>Total: ~20 horas para 200 épocas</li>
807  <li>Hardware efetivo: CPU Xeon 24 núcleos</li>
808</ul>
809<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
810  <strong>ℹ️ Buffer do PowerShell:</strong> de treino overnight o terminal pode parecer travado. O treino continua normalmente — verificar o contador no Applio.
811</blockquote>
812
813<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">LIÇÕES APRENDIDAS</h3>
814<p style="font-size:.88rem;color:#10b981;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">✅ O que funciona:</p>
815<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
816  <li>Applio + CPU puro no AMD Windows — estável e funcional</li>
817  <li>Python 3.11 obrigatório (não 3.10)</li>
818  <li><code>requirements.txt</code> editado — remover <code>+cu128</code></li>
819  <li>PowerShell limpo — sem variáveis <code>CUDA_VISIBLE_DEVICES</code></li>
820  <li>Arquivos mute criados manualmente antes do treino</li>
821  <li>Campo "Número da GPU" <strong>vazio</strong> no Applio</li>
822</ol>
823<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">❌ O que não funciona:</p>
824<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
825  <li>DirectML + torch 2.7.1 — incompatível em 2026</li>
826  <li><code>set CUDA_VISIBLE_DEVICES=-1</code> — quebra a extração de features</li>
827  <li><code>pip install -r requirements.txt</code> sem editar — instala CUDA e falha</li>
828  <li>Dataset grande (horas de áudio) — estouro de RAM/VRAM</li>
829</ol>
830
831<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">PIPELINE FINAL DE PRODUÇÃO</h3>
832<div class="code" style="margin-bottom:1.25rem">
833  <pre><code>1. Escrever roteiro
834   ↓
8352. Balabolka + Antônio Neural → WAV com interpretação humana
836   ↓
8373. Applio — Inferência
838   Modelo: my-project_200e.pth
839   Índice: my-project.index
840   ↓
8414. Output: WAV com voz do Yuri
842   ↓
8435. Edição e publicação no YouTube</code></pre>
844</div>
845<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Velocidade de inferência (pós-treino):</strong></p>
846<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
847  <li>~5-30 segundos por minuto de áudio</li>
848  <li>2 horas de áudio → ~30 minutos de processamento</li>
849  <li>Modo Lote disponível no Applio</li>
850</ul>
851
852<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">CHECKLIST — REPRODUZINDO DO ZERO</h3>
853<ul style="list-style-type:none;padding-left:0;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
854  <li><span style="color:#475569">[ ]</span> Python 3.11 instalado</li>
855  <li><span style="color:#475569">[ ]</span> Git instalado</li>
856  <li><span style="color:#475569">[ ]</span> FFmpeg no PATH</li>
857  <li><span style="color:#475569">[ ]</span> Dataset WAV limpo (mínimo 5 min, ideal 15-25 min)</li>
858  <li><span style="color:#475569">[ ]</span> <code>requirements.txt</code> editado (remover <code>+cu128</code>)</li>
859  <li><span style="color:#475569">[ ]</span> <code>config.py</code> sem referências ao <code>torch_directml</code></li>
860  <li><span style="color:#475569">[ ]</span> Arquivos mute criados</li>
861  <li><span style="color:#475569">[ ]</span> PowerShell limpo (sem <code>set CUDA_VISIBLE_DEVICES</code>)</li>
862  <li><span style="color:#475569">[ ]</span> Campo "Número da GPU" <strong>vazio</strong> no Applio</li>
863  <li><span style="color:#475569">[ ]</span> Após extração: verificar que <code>logs/projeto/extracted/</code> tem arquivos <code>.npy</code></li>
864</ul>
865
866<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">AMD vs NVIDIA EM IA — POSIÇÃO DO APPLIO/RVC (2026)</h3>
867<div class="tbl" style="margin-bottom:1.5rem">
868  <table>
869    <thead>
870      <tr>
871        <th>Plataforma</th>
872        <th>Situação</th>
873      </tr>
874    </thead>
875    <tbody>
876      <tr>
877        <td>NVIDIA CUDA</td>
878        <td>✅ Excelente — suporte nativo</td>
879      </tr>
880      <tr>
881        <td>AMD ROCm Linux</td>
882        <td>⚠️ Razoável — funciona com esforço</td>
883      </tr>
884      <tr>
885        <td>AMD Windows DirectML</td>
886        <td>❌ Abandonado</td>
887      </tr>
888      <tr>
889        <td>AMD Windows CPU</td>
890        <td>✅ Funcional — lento mas estável</td>
891      </tr>
892    </tbody>
893  </table>
894</div>
895<p style="font-size:.85rem;color:#94a3b8;font-style:italic;line-height:1.8"><em>*Hardware legado não morre — só precisa do backend certo.</em></p>`},audio_srt_ptbr:{id:"audio_srt_ptbr",title:"40. PIPELINE COMPLETO — TRANSCRIÇÃO + TRADUÇÃO PT-BR COM RX 580",desc:"Transcrição de vídeo em inglês com tradução automática para português brasileiro, do .mp4 ao .srt sem nenhum serviço pago.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:25,tags:["srt-generation","automacao-srt","ffmpeg-pipeline"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linux_nativo"],previous:"linux_nativo",next:"limit_qwen_35b",related:["audio_whisper","limit_qwen_35b"]},part:1}
895,html:`<div class="whisper-doc">
896  <div class="hero">
897    <div class="hero-title"><span>Pipeline Completo</span> — Transcrição + Tradução EN➔PT-BR</div>
898    <div class="hero-sub">Transcrição offline de vídeo em inglês com tradução automática para português brasileiro, do <code>.mp4</code> ao <code>.srt</code> de forma 100% gratuita usando a RX 580 via Vulkan.</div>
899    <div class="hero-badges">
900      <span class="badge badge-gpu">AMD RX 580 8GB</span>
901      <span class="badge badge-win">Windows + PowerShell</span>
902      <span class="badge badge-ok">Vulkan Backend</span>
903      <span class="badge badge-ok">large-v3-turbo</span>
904      <span class="badge badge-win">deep-translator (Gratuito)</span>
905    </div>
906  </div>
907
908  <div class="stat-grid">
909    <div class="stat">
910      <div class="stat-label">tempo total pipeline</div>
911      <div class="stat-value">~8 min</div>
912      <div class="stat-sub">Vídeo de 29m 51s</div>
913    </div>
914    <div class="stat">
915      <div class="stat-label">VRAM Usada</div>
916      <div class="stat-value">2.9 GB</div>
917      <div class="stat-sub">de 8 GB Polaris</div>
918    </div>
919    <div class="stat">
920      <div class="stat-label">Temp. Média GPU</div>
921      <div class="stat-value">50°C</div>
922      <div class="stat-sub">Fan Curve Otimizada</div>
923    </div>
924    <div class="stat">
925      <div class="stat-label">Custo Cloud</div>
926      <div class="stat-value">R$ 0,00</div>
927      <div class="stat-sub">100% Local & Offline</div>
928    </div>
929  </div>
930
931  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Hardware Utilizado no Teste</h3>
932  <div class="tbl">
933    <table>
934      <thead>
935        <tr>
936          <th>Componente</th>
937          <th>Especificação</th>
938        </tr>
939      </thead>
940      <tbody>
941        <tr>
942          <td><strong>GPU</strong></td>
943          <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
944        </tr>
945        <tr>
946          <td><strong>CPU</strong></td>
947          <td>Intel Xeon E5-2690 v3 (24 threads / 12 Cores)</td>
948        </tr>
949        <tr>
950          <td><strong>RAM</strong></td>
951          <td>31.8 GB DDR4 REG ECC</td>
952        </tr>
953        <tr>
954          <td><strong>OS</strong></td>
955          <td>Windows 11 Professional</td>
956        </tr>
957        <tr>
958          <td><strong>Driver</strong></td>
959          <td>Adrenalin 31.0.21925.1001 (2026/05/20)</td>
960        </tr>
961      </tbody>
962    </table>
963  </div>
964
965  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Fluxo de Dados Unificado (Pipeline)</h3>
966  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
967    O objetivo é mapear um vídeo educacional em inglês para legenda em português compatível com software editor de vídeo (Filmora, Premiere, etc.), rodando a transcrição via GPU nativa e traduzindo cada timestamp sem limites de API de nuvem comercial:
968  </p>
969  <div class="cmd" style="white-space:normal; line-height:1.6; padding: 1rem;">
970    <strong>video.mp4</strong> ➔ <code>FFmpeg (extração)</code> ➔ <strong>video_16k.wav</strong><br>
971    ➔ <code>whisper-cli Vulkan (transcrição)</code> ➔ <strong>video.srt (English)</strong><br>
972    ➔ <code>Python deep-translator (Google Translate)</code> ➔ <strong>video_ptbr.srt (Português)</strong><br>
973    ➔ <code>Importar na Timeline do Filmora</code>
974  </div>
975
976  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Performance e Timing Detalhado</h3>
977  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
978    Métricas reais obtidas transcrição de um vídeo educacional de <strong>29 minutos e 51 segundos</strong> (áudio em inglês, AAC, 480x360):
979  </p>
980  <div class="tbl" style="margin-bottom:1.5rem">
981    <table>
982      <thead>
983        <tr>
984          <th>Etapa do Pipeline</th>
985          <th>Ferramenta</th>
986          <th>Tempo Gasto</th>
987        </tr>
988      </thead>
989      <tbody>
990        <tr>
991          <td><strong>1. Extração de Áudio WAV Sem Compressão</strong></td>
992          <td>FFmpeg</td>
993          <td><strong>1.7 segundos</strong></td>
994        </tr>
995        <tr>
996          <td><strong>2. Transcrição de Áudio (EN)</strong></td>
997          <td>Whisper.cpp + Vulkan</td>
998          <td><strong>6 minutos e 07 segundos</strong></td>
999        </tr>
1000        <tr>
1001          <td><strong>3. Tradução em Bloco do SRT (EN➔PT-BR)</strong></td>
1002          <td>Python + <code>deep-translator</code></td>
1003          <td><strong>~2 minutos</strong> (limitação de I/O de rede)</td>
1004        </tr>
1005        <tr style="border-top:1px solid rgba(255,255,255,0.15)">
1006          <td><strong>Métrica Total Consolidade</strong></td>
1007          <td><strong>Pipeline Completo</strong></td>
1008          <td><strong>~8 minutos</strong></td>
1009        </tr>
1010      </tbody>
1011    </table>
1012  </div>
1013
1014  <h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">Timings Internos do Core (whisper_print_timings)</h4>
1015  <div class="card bg-black/40 border border-white/5 p-4 rounded-md my-3 font-mono text-xs text-[#a7f3d0] leading-relaxed">
1016    load modelo : 3.687 ms<br>
1017    mel (áudio) : 2.305 ms<br>
1018    encode GPU  : 204.689 ms<br>
1019    decode      : 4.081 ms<br>
1020    batch total : 108.675 ms<br>
1021    total       : 367.432 ms (por batch de segmentação)
1022  </div>
1023
1024  <div class="section-title">Manual de Instruções Passo a Passo</div>
1025
1026  <div class="step">
1027    <div class="step-header">
1028      <div class="step-num">1</div>
1029      <div class="step-name">Extrair Áudio Compatível via FFmpeg</div>
1030      <div class="step-desc">WAV 16kHz Mono 16-bit</div>
1031    </div>
1032    <div class="step-body">
1033      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">O Whisper necessita estritamente de áudio WAV cru em 16.000 Hz, formato mono de 16 bits:</p>
1034      <div class="cmd">ffmpeg -i "E:\\MUSICAS SUNO AI\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\MUSICAS SUNO AI\\video_16k.wav"</div>
1035      <p class="note"><strong>Flags:</strong> <code>-ar 16000</code> força 16kHz · <code>-ac 1</code> converte para canal mono único · <code>-c:a pcm_s16le</code> define PCM de 16 bits sem perda.</p>
1036    </div>
1037  </div>
1038
1039  <div class="step">
1040    <div class="step-header">
1041      <div class="step-num">2</div>
1042      <div class="step-name">Transcrever via Vulkan</div>
1043      <div class="step-desc">
1043Carga pesada na GPU Polaris</div>
1044    </div>
1045    <div class="step-body">
1046      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">Chamar o executável compilado do Whisper para gerar o arquivo inicial de legendas SRT em inglês:</p>
1047      <div class="cmd">cd C:\\whisper.cpp</div>
1048      <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\MUSICAS SUNO AI\\video_16k.wav" -l en --output-srt</div>
1049      <p class="note"><strong>Verificação de atividade da GPU:</strong> Certifique-se de ver as linhas <code>ggml_vulkan: Found 1 Vulkan devices: AMD Radeon RX 580 2048SP</code> na inicialização para atestar que o encode pesado foi acoplado na GPU, reduzindo o uso de CPU para ~5%.</p>
1050    </div>
1051  </div>
1052
1053  <div class="step">
1054    <div class="step-header">
1055      <div class="step-num">3</div>
1056      <div class="step-name">Criar e Executar Script Python de Tradução</div>
1057      <div class="step-desc">Zero Keys, Zero Custos</div>
1058    </div>
1059    <div class="step-body">
1060      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">
1061        Instale a biblioteca de tradução sem chaves de API: <code>pip install deep-translator</code>. Crie e rode o arquivo <code>C:\\whisper.cpp\\traduzir.py</code> com este código:
1062      </p>
1063      <div class="cmd" style="white-space:pre-wrap; font-size:11px;">from deep_translator import GoogleTranslator
1064
1065def traduzir_srt(entrada, saida):
1066    with open(entrada, 'r', encoding='utf-8') as f:
1067        conteudo = f.read()
1068
1069    blocos = conteudo.strip().split('\\n\\n')
1070    resultado = []
1071
1072    for bloco in blocos:
1073        linhas = bloco.split('\\n')
1074        if len(linhas) >= 3:
1075            numero = linhas[0]
1076            timestamp = linhas[1]
1077            texto = ' '.join(linhas[2:])
1078            traduzido = GoogleTranslator(source='en', target='pt').translate(texto)
1079            resultado.append(f"{numero}\\n{timestamp}
1079\\n{traduzido}")
1080
1081    with open(saida, 'w', encoding='utf-8') as f:
1082        f.write('\\n\\n'.join(resultado))
1083    print("Pronto!")
1084
1085traduzir_srt(
1086    r'E:\\MUSICAS SUNO AI\\video_16k.wav.srt',
1087    r'E:\\MUSICAS SUNO AI\\video_16k_ptbr.srt'
1088)</div>
1089<p style="font-size:0.8rem;color:#94a3b8;margin-top:0.5rem">Para rodar:</p>
1090      <div class="cmd">python traduzir.py</div>
1091    </div>
1092  </div>
1093
1094  <div class="step">
1095    <div class="step-header">
1096      <div class="step-num">4</div>
1097      <div class="step-name">Importar Legenda no Filmora</div>
1098      <div class="step-desc">Concluir Edição de Vídeo</div>
1099    </div>
1100    <div class="step-body">
1101      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6">
1102        1. No Wondershare Filmora, acesse <strong>Arquivo ➔ Importar ➔ Importar arquivos de legenda</strong>.<br>
1103        2. Selecione o arquivo gerado <code>video_16k_ptbr.srt</code>.<br>
1104        3. Arraste e solte o track de legenda diretamente na timeline, sobreposto ao track de vídeo original.
1105      </p>
1106    </div>
1107  </div>
1108
1109  <div class="section-title">Lições Autônomas Aprendidas nas Peripécias</div>
1110  <div class="card-inner">
1111    <div class="lesson">
1112      <div class="lesson-icon">⚠️</div>
1113      <div class="lesson-text"><strong>Evite usar --translate para PT-BR direto nas flags do Whisper:</strong> O parâmetro <code>--translate</code> por design traduz o áudio para o inglês de forma nativa. Para ter legendas em português brasileiro de qualidade, a abordagem correta é extrair inglês por <code>-l en</code> e traduzir com o algoritmo <code>traduzir.py</code>.</div>
1114    </div>
1115    <div class="lesson">
1116      <div class="lesson-icon">⚠️</div>
1117      <div class="lesson-text"><strong>Problemas de Linguagem de Origem Incorreta:</strong> Passar <code>-l pt</code> quando o áudio de origem é falado em inglês faz o Whisper forçar padrões fonéticos portugueses no áudio em inglês, gerando textos completamente incompreensíveis e sem sentido. Defina sempre o idioma real do áudio de entrada como parâmetro inicial.</div>
1118    </div>
1119    <div class="lesson">
1120      <div class="lesson-icon">ℹ️</div>
1121      <div class="lesson-text"><strong>Local do Arquivo Gerado:</strong> Por padrão, em compilados nativos, o arquivo <code>.srt</code> é salvo na mesma pasta física do arquivo de áudio WAV processado, e não dentro do diretório do script ou do Whisper.</div>
1122    </div>
1123    <div class="lesson">
1124      <div class="lesson-icon">✅</div>
1125      <div class="lesson-text"><strong>8 GB de VRAM em 2026 Segue Firme:</strong> O modelo Whisper <code>large-v3-turbo</code> consome apenas 2.9 GB de VRAM física no ecossistema, permitindo folga para outras atividades na sua máquina ou renderização benta paralela. Milhares de dólares economizados em assinaturas e APIs proprietárias.</div>
1126    </div>
1127  </div>
1128
1129  <div class="footer">
1130    RX 580 — velha de 580 anos, mas ainda na ativa 🚀 · Peripécias documentadas em junho/2026
1131  </div>
1132</div>`},audio_whisper:{id:"audio_whisper",title:"39. WHISPER.CPP LOCAL — TRANSCRIÇÃO DE ÁUDIO EM AMD RX 580",desc:"Transcrição de áudio/vídeo acelerada por GPU AMD via Vulkan no Windows (modelo large-v3-turbo).",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:30,tags:["whispercpp","transcricao-audio","vulkan-whisper"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_rvc"],previous:"audio_rvc",next:"linux_nativo",related:["audio_rvc","audio_srt_ptbr"]},part:1},html:`<div class="whisper-doc">
1133<style>
1134.whisper-doc {
1135  --color-border-secondary: rgba(255, 255, 255, 0.05);
1136  --color-border-tertiary: rgba(255, 255, 255, 0.08);
1137  --color-background-secondary: #0c0d10;
1138  --color-background-primary: #07080a;
1139  --color-text-primary: #ffffff;
1140  --color-text-secondary: #94a3b8;
1141  font-family: inherit;
1142}
1143.whisper-doc * { box-sizing: border-box; }
1144.whisper-doc .badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 4px; letter-spacing: 0.04em; text-transform: uppercase; }
1145.whisper-doc .badge-gpu { background: rgba(225, 29, 72, 0.1); border: 1px solid rgba(225, 29, 72, 0.3); color: #fda4af; }
1146.whisper-doc .badge-win { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.2); color: #a7f3d0; }
1147.whisper-doc .badge-ok { background: rgba(14, 165, 233, 0.1); border: 1px solid rgba(14, 165, 233, 0.3); color: #bae6fd; }
1148.whisper-doc .badge-warn { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #fef08a; }
1149.whisper-doc .hero { border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 1.5rem; margin-bottom: 2rem; background: #0c0d10; }
1150.whisper-doc .hero-title { font-size: 26px; font-weight: 700; color: var(--color-text-primary); line-height: 1.2; margin-bottom: 0.5rem; font-family: 'Syne', var(--font-sans); text-transform: uppercase; }
1151.whisper-doc .hero-title span { color: #E11D48; }
1152.whisper-doc .hero-sub { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 1.25rem; line-height: 1.6; font-family: var(--font-sans); }
1153.whisper-doc .hero-badges { display: flex; flex-wrap: wrap; gap: 6px; }
1154.whisper-doc .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 2rem; }
1155.whisper-doc .stat { background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 0.875rem 1rem; }
1156.whisper-doc .stat-label { font-size: 11px; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; font-family: var(--font-sans); }
1157.whisper-doc .stat-value { font-size: 20px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-mono); }
1158.whisper-doc .stat-sub { font-size: 11px; color: var(--color-text-secondary); margin-top: 2px; font-family: var(--font-sans); }
1159.whisper-doc .section { margin-bottom: 2.5rem; }
1160.whisper-doc .section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #E11D48; margin-top: 2rem; margin-bottom: 1rem; font-family: var(--font-sans); padding-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
1161.whisper-doc .step { border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; margin-bottom: 10px; overflow: hidden; background: #050506; }
1162.whisper-doc .step-header { display: flex; align-items: center; gap: 10px; padding: 0.75rem 1rem; background: #0c0d10; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
1163.whisper-doc .step-num { width: 24px; height: 24px; border-radius: 50%; background: #E11D48; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-mono); }
1164.whisper-doc .step-name { font-size: 13px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-sans); }
1165.whisper-doc .step-desc { font-size: 11px; color: var(--color-text-secondary); font-family: var(--font-sans); margin-left: auto; }
1166.whisper-doc .step-body { padding: 0.875rem 1rem; }
1167.whisper-doc .cmd { background: #050506; border: 1px solid rgba(255, 255, 255, 0.03); border-radius: 4px; padding: 0.625rem 0.875rem; font-size: 12px; color: #fff; font-family: var(--font-mono); margin-bottom: 6px; overflow-x: auto; white-space: nowrap; border-left: 3px solid #E11D48; }
1168.whisper-doc .note { font-size: 12px; color: var(--color-text-secondary); font-family: var(--font-sans); line-height: 1.6; margin-top: 4px; padding-left: 8px; border-left: 2px solid #E11D48; }
1169.whisper-doc .flag-table { width: 100%; border-collapse: collapse; font-size: 12px; }
1170.whisper-doc .flag-table th { text-align: left; padding: 8px 10px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-sans); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: #111215; }
1171.whisper-doc .flag-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-family: var(--font-mono); }
1172.whisper-doc .flag-table td:first-child { color: #fda4af; }
1173.whisper-doc .flag-table td:last-child { font-family: var(--font-sans); color: var(--color-text-secondary); }
1174.whisper-doc .flag-table tr:last-child td { border-bottom: none; }
1175.whisper-doc .perf-bar-wrap { margin: 0.5rem 0 1rem; background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); padding: 1rem; border-radius: 6px; }
1176.whisper-doc .perf-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
1177.whisper-doc .perf-row:last-child { margin-bottom: 0; }
1178.whisper-doc .perf-label { font-size: 12px; color: var(--color-text-secondary); width: 120px; flex-shrink: 0; font-family: var(--font-sans); text-align: right; }
1179.whisper-doc .perf-bar-bg { flex: 1; height: 8px; background: rgba(255, 255, 255, 0.03); border-radius: 4px; overflow: hidden; }
1180.whisper-doc .perf-bar { height: 100%; border-radius: 4px; }
1181.whisper-doc .perf-time { font-size: 12px; font-family: var(--font-mono); color: var(--color-text-primary); width: 70px; flex-shrink: 0; margin-left: 8px; }
1182.whisper-doc .lesson { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); align-items: flex-start; }
1183.whisper-doc .lesson:last-child { border-bottom: none; }
1184.whisper-doc .lesson-icon { font-size: 16px; flex-shrink: 0;
1184 margin-top: 1px; }
1185.whisper-doc .lesson-text { font-size: 12.5px; color: var(--color-text-secondary); font-family: var(--font-sans); line-height: 1.6; }
1186.whisper-doc .lesson-text strong { font-weight: 700; color: var(--color-text-primary); }
1187.whisper-doc .footer { text-align: center; font-size: 11px; color: #475569; font-family: var(--font-mono); padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, 0.05); margin-top: 2rem; }
1188.whisper-doc .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
1189@media (max-width: 600px) { .whisper-doc .two-col { grid-template-columns: 1fr; } }
1190.whisper-doc .env-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-size: 12px; }
1191.whisper-doc .env-row:last-child { border-bottom: none; }
1192.whisper-doc .env-key { color: var(--color-text-secondary); font-family: var(--font-sans); }
1193.whisper-doc .env-val { font-family: var(--font-mono); color: var(--color-text-primary); text-align: right; }
1194.whisper-doc .card-inner { background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 1rem 1.25rem; }
1195</style>
1196
1197  <div class="hero">
1198    <div class="hero-title"><span>whisper.cpp</span> + RX 580 via Vulkan</div>
1199    <div class="hero-sub">
1199Transcrição de áudio/vídeo com aceleração GPU AMD no Windows — usando Vulkan para rodar modelos Whisper direto na VRAM da RX 580. Uma GPU de 2017 botando pra trabalhar em 2026.</div>
1200    <div class="hero-badges">
1201      <span class="badge badge-gpu">AMD RX 580 8GB</span>
1202      <span class="badge badge-win">Windows + PowerShell</span>
1203      <span class="badge badge-ok">Vulkan Backend</span>
1204      <span class="badge badge-ok">large-v3-turbo</span>
1205      <span class="badge badge-warn">FFmpeg pré-req</span>
1206    </div>
1207  </div>
1208
1209  <div class="stat-grid">
1210    <div class="stat">
1211      <div class="stat-label">tempo total</div>
1212      <div class="stat-value">~5 min</div>
1213      <div class="stat-sub">para 15 min de vídeo</div>
1214    </div>
1215    <div class="stat">
1216      <div class="stat-label">VRAM usada</div>
1217      <div class="stat-value">2.6 GB</div>
1218<div class="stat-sub">de 8 GB disponíveis</div>
1219    </div>
1220    <div class="stat">
1221      <div class="stat-label">speedup vs CPU</div>
1222      <div class="stat-value">~150×</div>
1223      <div class="stat-sub">antes: 12h para 40min</div>
1224    </div>
1225    <div class="stat">
1226      <div class="stat-label">modelo</div>
1227      <div class="stat-value">1.6 GB</div>
1228      <div class="stat-sub">large-v3-turbo</div>
1229    </div>
1230  </div>
1231
1232  <div class="section">
1233    <div class="section-title">pré-requisitos verificados</div>
1234    <div class="card-inner">
1235      <div class="env-row"><span class="env-key">Vulkan SDK</span><span class="env-val">glslc v2026.1</span></div>
1236      <div class="env-row"><span class="env-key">Git</span><span class="env-val">2.54.0.windows.1</span></div>
1237      <div class="env-row"><span class="env-key">CMake</span><span class="env-val">4.3.2</span></div>
1238      <div class="env-row"><span class="env-key">MSVC (Build Tools)</span><span class="env-val">14.52.36328 — VS 2026</span></div>
1239      <div class="env-row"><span class="env-key">GPU detectada</span><span class="env-val">AMD Radeon RX 580 2048SP</span></div>
1240      <div class="env-row"><span class="env-key">FFmpeg</span><span class="env-val">2026-04-19 (Gyan full build)</span></div>
1241    </div>
1242    <p class="note" style="margin-top: 8px;">Verificar RX 580 no Vulkan: <span style="font-family:var(--font-mono); color:#fda4af;">vulkaninfo --summary</span> → deve aparecer AMD Radeon RX 580 2048SP</p>
1243  </div>
1244
1245  <div class="section">
1246    <div class="section-title">compilação — passo a passo</div>
1247
1248    <div class="step">
1249      <div class="step-header">
1250        <div class="step-num">1</div>
1251        <div class="step-name">ativar ambiente MSVC x64</div>
1252        <div class="step-desc">a cada nova sessão</div>
1253      </div>
1254      <div class="step-body">
1255        <div class="cmd">& "C:\\Program Files (x86)\\Microsoft Visual Studio\\18\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"</div>
1256        <p class="note">Precisa repetir toda vez que abrir um novo PowerShell antes de compilar. Saída esperada: "Environment initialized for: 'x64'"</p>
1257      </div>
1258    </div>
1259
1260    <div class="step">
1261      <div class="step-header">
1262        <div class="step-num">2</div>
1263        <div class="step-name">clonar repositório</div>
1264        <div class="step-desc">~40 MB</div>
1265      </div>
1266      <div class="step-body">
1267        <div class="cmd">cd C:\\</div>
1268        <div class="cmd">git clone https://github.com/ggml-org/whisper.cpp</div>
1269        <div class="cmd">cd whisper.cpp</div>
1270      </div>
1271    </div>
1272
1273    <div class="step">
1274      <div class="step-header">
1275        <div class="step-num">3</div>
1276        <div class="step-name">cmake com Vulkan habilitado</div>
1277        <div class="step-desc">flag crítica: -DGGML_VULKAN=ON</div>
1278      </div>
1279      <div class="step-body">
1280        <div class="cmd">cmake -B build -DGGML_VULKAN=ON -DGGML_HIPBLAS=OFF -DGGML_HIP=OFF -DGGML_CUDA=OFF</div>
1281        <div class="cmd">cmake --build build --config Release -j4</div>
1282        <p class="note">Dura ~5-10 min. Warnings de C4267/C4244 são normais — não afetam o funcionamento. Binários ficam em build\\bin\\Release\\</p>
1283      </div>
1284    </div>
1285
1286    <div class="step">
1287      <div class="step-header">
1288        <div class="step-num">4</div>
1289        <div class="step-name">baixar modelo large-v3-turbo</div>
1290        <div class="step-desc">~1.6 GB</div>
1291      </div>
1292      <div class="step-body">
1293        <div class="cmd">Invoke-WebRequest -Uri "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo.bin" -OutFile "models\\ggml-large-v3-turbo.bin"</div>
1294        <p class="note">Outros modelos: large-v3 (~6GB VRAM, melhor qualidade), medium (~2.5GB), small (~1GB)</p>
1295      </div>
1296    </div>
1297  </div>
1298
1299  <div class="section">
1300    <div class="section-title">uso — fluxo completo mp4 → txt</div>
1301
1302    <div class="step">
1303      <div class="step-header">
1304        <div class="step-num" style="background:#1D9E75;">1</div>
1305        <div class="step-name">extrair áudio com FFmpeg</div>
1306        <div class="step-desc">whisper não lê mp4 direto no Windows</div>
1307      </div>
1308      <div class="step-body">
1309        <div class="cmd">ffmpeg -i "E:\\videos\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\videos\\video.wav"</div>
1310        <p class="note">-ar 16000 = 16kHz (obrigatório para o Whisper) · -ac 1 = mono · -c:a pcm_s16le = WAV sem compressão</p>
1311      </div>
1312    </div>
1313
1314    <div class="step">
1315      <div class="step-header">
1316        <div class="step-num" style="background:#1D9E75;">2</div>
1317        <div class="step-name">transcrever / traduzir</div>
1318        <div class="step-desc">GPU cuida do resto</div>
1319      </div>
1320      <div class="step-body">
1321        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --output-txt</
1321div>
1322        <p style="font-size:12px; color:var(--color-text-secondary); margin: 6px 0 4px; font-family:var(--font-sans);">com tradução para inglês:</p>
1323        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --translate --output-txt</div>
1324        <p class="note">--translate sempre gera inglês (limitação do Whisper). Para outros idiomas de destino, usar etapa adicional de tradução.</p>
1325      </div>
1326    </div>
1327
1328    <div style="margin-top: 1rem;">
1329      <div class="section-title" style="margin-bottom: 0.75rem;">flags úteis</div>
1330      <div class="card-inner">
1331        <table class="flag-table">
1332          <thead><tr><th>flag</th><th>descrição</th></tr></thead>
1333          <tbody>
1334            <tr><td>-l pt</td><td>idioma fonte: português</td></tr>
1335            <tr><td>-l en</td><td>idioma fonte: inglês</td></tr>
1336            <tr><td>--translate</td><td>traduz tudo para inglês</td></tr>
1337            <tr><td>--output-txt</td><td>salva .txt com transcrição</td></tr>
1338            <tr><td>--output-srt</td><td>salva legendas .srt com timestamps</td></tr>
1339            <tr><td>--output-vtt</td><td>salva legendas .vtt</td></tr>
1340            <tr><td>-t 8</td><td>usa 8 threads de CPU (padrão: 4)</td></tr>
1341            <tr><td>--device 0</td><td>seleciona GPU 0 (padrão)</td></tr>
1342            <tr><td>--no-gpu</td><td>força CPU (modo lento)</td></tr>
1343          </tbody>
1344        </table>
1345      </div>
1346    </div>
1347  </div>
1348
1349  <div class="section">
1350    <div class="section-title">performance — vídeo de 15 min</div>
1351    <div class="perf-bar-wrap">
1352      <div class="perf-row">
1353        <div class="perf-label">load modelo</div>
1354        <div class="perf-bar-bg"><div class="perf-bar" style="width:1.3%; background:#E11D48;"></div></div>
1355        <div class="perf-time">4 s</div>
1356      </div>
1357      <div class="perf-row">
1358        <div class="perf-label">mel (áudio)</div>
1359        <div class="perf-bar-bg"><div class="perf-bar" style="width:0.4%; background:#E11D48;"></div></div>
1360        <div class="perf-time">1.2 s</div>
1361      </div>
1362      <div class="perf-row">
1363        <div class="perf-label">encode GPU</div>
1364        <div class="perf-bar-bg"><div class="perf-bar" style="width:23.7%; background:#1D9E75;"></div></div>
1365        <div class="perf-time">73 s</div>
1366      </div>
1367      <div class="perf-row">
1368        <div class="perf-label">decode + batch</div>
1369        <div class="perf-bar-bg"><div class="perf-bar" style="width:54.7%; background:#1D9E75;"></div></div>
1370        <div class="perf-time">168 s</div>
1371      </div>
1372      <div class="perf-row">
1373        <div class="perf-label" style="font-weight:700; color:var(--color-text-primary);">total</div>
1374        <div class="perf-bar-bg"><div class="perf-bar" style="width:100%; background:#E11D48;"></div></div>
1375        <div class="perf-time" style="font-weight:700;">307 s</div>
1376      </div>
1377    </div>
1378    <p class="note">CPU em ~5% durante toda a transcrição. VRAM: 2.6 GB de 8 GB. A GPU fez o trabalho — CPU ficou de molho.</p>
1379  </div>
1380
1381  <div class="section">
1382    <div class="section-title">lições aprendidas nas peripécias</div>
1383    <div class="card-inner">
1384      <div class="lesson">
1385        <div class="lesson-icon">⚠️</div>
1386<div class="lesson-text"><strong>WSL2 não expõe a RX 580 via Vulkan</strong> — usar sempre PowerShell/Windows nativo para aproveitar a GPU.</div>
1387      </div>
1388      <div class="lesson">
1389        <div class="lesson-icon">⚠️</div>
1390        <div class="lesson-text"><strong>Whisper não lê MP4 no Windows</strong> — sempre extrair o áudio com FFmpeg antes. Usar -ar 16000 -ac 1 -c:a pcm_s16le.</div>
1391      </div>
1392      <div class="lesson">
1393        <div class="lesson-icon">ℹ️</div>
1394        <div class="lesson-text"><strong>--translate só gera inglês</strong> — é limitação do Whisper, não da configuração. Para PT como destino, precisa de etapa extra.</div>
1395      </div>
1396      <div class="lesson">
1397        <div class="lesson-icon">ℹ️</div>
1398        <div class="lesson-text"><strong>vcvars64.bat precisa ser reativado</strong> a cada nova sessão do PowerShell antes de qualquer compilação.</div>
1399      </div>
1400      <div class="lesson">
1401        <div class="lesson-icon">✅</div>
1402        <div class="lesson-text"><strong>8 GB de VRAM em 2026 ainda é sólido</strong> — large-v3-turbo usa apenas 2.6 GB. GPU "velha" com VRAM decente bate GPU nova com 4 GB fácil.</div>
1403      </div>
1404      <div class="lesson">
1405        <div class="lesson-icon">✅</div>
1406        <div class="lesson-text"><strong>Warnings C4267/C4244 durante compilação são normais</strong> — conversões de tipo esperadas no código do ggml, não impactam funcionamento.</div>
1407      </div>
1408    </div>
1409  </div>
1410
1411  <div class="footer">
1412    RX 580 — velha de 580 anos, mas ainda na ativa 🚀 · Peripécias documentadas em junho/2026
1413  </div>
1414
1415</div>`},benchmarks:{id:"benchmarks",title:"23. BENCHMARKS REAIS DO LABORATÓRIO",desc:"Dados consolidados de telemetria medidos diretamente nos logs de inferência das duas arquiteturas.",meta:{version:"1.0.0",type:"benchmark",category:"hardware",subcategory:"benchmarks",difficulty:"beginner",estimated_time_min:15,tags:["telemetria","gpu-benchmarks","performance-history"],last_reviewed:"2026-07-01",relationships:{prerequisites:["guia"],previous:"guia",next:"cpu",related:["hardware","cpu"]}},html:`<div class="tbl"><table>
1416    <thead><tr><th>
1416Modo de Execução do Modelo</th><th>Arquitetura Alocada</th><th>Métrica Comercial Obtida</th><th>Status de Viabilidade</th></tr></thead>
1417    <tbody>
1418      <tr><td>Inferência de Texto Comum</td><td>CPU Xeon Pura (Sem Aceleração)</td><td>3 a 5 tokens por segundo</td><td>❌ Ineficiente / Respostas Lentas</td></tr>
1419      <tr class="hig"><td>Inferência de Texto Compilada</td><td>RX 580 8GB via Vulkan Backend</td><td>15 a 16 tokens por segundo</td><td>✅ Altamente Produtivo / Instantâneo</td></tr>
1420      <tr><td>Amostragem SD 1.5 (20 Steps)</td><td>ComfyUI Windows via DirectML</td><td>~450 segundos por imagem</td><td>❌ Instável / Descarte por Erro Crítico</td></tr>
1421      <tr class="hig"><td>Amostragem SD 1.5 (20 Steps)</td><td>stable-diffusion.cpp via Vulkan</td><td>72 segundos por imagem</td><td>✅ Otimizado / Resposta Rápida</td></tr>
1422    </tbody>
1423  </table></div>`},codacus:{id:"codacus",title:"33. MÉTODO CODACUS vs AIVisionsLab",desc:"Experimento das 5 flags que salvaram uma GTX 1060 — funcionam numa RX 580?",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:25,tags:["gtx-1060","metodo-codacus","nvidia-pascal"],last_reviewed:"2026-07-01",relationships:{prerequisites:["dadhacks"],previous:"dadhacks",next:"proximos",related:["dadhacks","amihart"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
1424  O canal Codacus publicou um vídeo de grande repercussão demonstrando como rodar um modelo de <strong>35B parâmetros numa GTX 1060 de 6GB</strong> usando 5 flags específicas do <code>llama.cpp</code>, saltando de 3.0 tokens/s no baseline para 17.0 tokens/s pós-otimizações. O AIVisionsLab testou essa hipótese na antiga <strong>RX 580 2048SP 8GB com Vulkan</strong> — comparando Windows e Linux nativo.
1425</p>
1426
1427<div class="tbl">
1428  <table>
1429    <thead>
1430      <tr>
1431        <th>Métrica / Configuração</th>
1432        <th>Setup Codacus (Ref)</th>
1433        <th>Setup AIVisionsLab</th>
1434      </tr>
1435    </thead>
1436    <tbody>
1437      <tr>
1438        <td><strong>GPU</strong></td>
1439        <td>Nvidia GTX 1060 6GB</td>
1440        <td>AMD Radeon RX 580 2048SP 8GB</td>
1441      </tr>
1442      <tr>
1443        <td><strong>Backend</strong></td>
1444        <td>CUDA</td>
1445        <td>Vulkan (Mesa RADV)</td>
1446      </tr>
1447      <tr>
1448        <td><strong>OS</strong></td>
1449        <td>Linux + Docker</td>
1450        <td>Windows 10 / Ubuntu 26.04</td>
1451      </tr>
1452      <tr>
1453        <td><strong>CPU</strong></td>
1454        <td>Intel Core i3-8100</td>
1455        <td>Intel Xeon E5-2690 v3 (12c/24t)</td>
1456      </tr>
1457      <tr>
1458        <td><strong>Modelo de Teste</strong></td>
1459        <td>Qwen3.6 35B-A3B Q4_K_M</td>
1460        <td>Qwen3.6 35B-A3B Q4_K_M (Mesmo modelo)</td>
1461      </tr>
1462    </tbody>
1463  </table>
1464</div>
1465
1466<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">O Impacto das 5 Flags no Vulkan AMD</h3>
1467
1468<div class="tbl">
1469  <table>
1470    <thead>
1471      <tr>
1472        <th>Flag Aplicada</th>
1473        <th>Impacto na GTX 1060 (CUDA)</th>
1474        <th>Impacto na RX 580 (Vulkan Windows)</th>
1475        <th>Impacto na RX 580 (Vulkan Linux Native)</th>
1476      </tr>
1477    </thead>
1478    <tbody>
1479      <tr>
1480        <td><strong>Baseline</strong></td>
1481        <td>3.0 tokens/s (-ngl 20)</td>
1482        <td><strong>7.62 tokens/s (-ngl 10)</strong></td>
1483        <td><strong>5.18 tokens/s (-ngl 20)</strong></td>
1484      </tr>
1485      <tr>
1486        <td><code>--override-tensor exps=CPU</code></td>
1487        <td>10.0 tokens/s (+233%)</td>
1488        <td>6.92 tokens/s (❌ -9%)</td>
1489        <td>4.62 tokens/s (❌ -11%)</td>
1490      </tr>
1491      <tr>
1492        <td><code>--no-mmap</code> (ou <code>-mmp 0</code>)</td>
1493        <td>13.5 tokens/s (+35%)</td>
1494        <td>7.44 tokens/s (❌ -2%)</td>
1495        <td>4.86 tokens/s (❌ -6%)</td>
1496      </tr>
1497      <tr>
1498        <td>Quantização KV cache (<code>-ctk/ctv</code>)</td>
1499        <td>17.0 tokens/s (+26%)</td>
1500        <td>7.58 tokens/s (❌ -1%)</td>
1501        <td><strong>5.41 tokens/s (✅ +4%)</strong></td>
1502      </tr>
1503      <tr>
1504        <td><code>--mlock</code> / ngl extra</td>
1505        <td>Estabilidade ampliada</td>
1506        <td>OOM acima de ngl 10 (❌)</td>
1507        <td>OOM acima de ngl 20 (❌)</td>
1508      </tr>
1509    </tbody>
1510  </table>
1511</div>
1512
1513<div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4">
1514  <h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Análise das Descobertas Técnicas</h4>
1515  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7">
1516    <strong>1. Modelo de Alocação de VRAM:</strong> Por que ngl 20 dava OOM no Windows mas passou no Linux? O driver proprietário da AMD no Windows aloca a memória de forma mais conservadora, enquanto o driver open-source <strong>Mesa RADV no Linux</strong> permite que mais layers sejam descarregados no buffer (teto máximo real de 20 layers vs 10 layers no Windows).
1517  </p>
1518  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem">
1519    <strong>2. Incompatibilidade de Backend:</strong> O roteamento <code>override-tensor exps=CPU</code> para isolar experts Mixtral/MoE da GPU funciona de forma espetacular em CUDA devido ao acesso PCIe de alta velocidade nativo da Nvidia. Sob o backend Vulkan, o overhead dessa movimentação destrói os ganhos de processamento.
1520  </p>
1521  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem">
1522    <strong>3. O Xeon Superior Compensou o Backend:</strong> Mesmo com menor otimização de VRAM, a infraestrutura da CPU Xeon E5-2690 v3 (24 threads) do AIVisionsLab garantiu um baseline original superior de 7.62 tokens/s — batendo os 3.0 tokens/s baselines do i3
1522-8100 do Codacus.
1523  </p>
1524</div>
1525
1526<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Comparativo Mistral 7B — CPU Pura vs Vulkan</h3>
1527<p style="font-size:.88rem;color:#94a3b8;line-height:1.9">
1528  Para demonstrar o valor bruto e absoluto do backend Vulkan em hardware legado Polaris:
1529</p>
1530<div class="code ok">
1531  <pre>💻 WSL2 Ubuntu (CPU Pura)  ·  24 threads  ·  1.79 tokens/s
1532🎮 Windows 10 (Vulkan GPU)  ·  12 threads  ·  18.54 tokens/s (⚡ 10x Mais Rápido!)</pre>
1533</div>
1534<blockquote style="font-size:.82rem;color:#64748b;font-style:italic;line-height:1.8;border-left:3px solid #E11D48;padding-left:.9rem;margin-top:1rem">
1535  "As 5 flags do Codacus funcionam perfeitamente para marcas NVIDIA + CUDA + Linux Docker. No ecossistema AMD + Vulkan, nossa própria receita é diferente mas incrivelmente sólida!"
1536</blockquote>`},"comfyui-directml-func":{id:"comfyui-directml-func",title:"17. FIXES DIRECTML",desc:"Instalação da roda de desenvolvimento específica para forçar estabilidade operacional.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-batch-fix","memoria-virtual","crash-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml"],previous:"comfyui-directml",next:"comfyui-flux",related:["comfyui-directml","scripts"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Caso haja necessidade de executar testes comparativos na camada DirectML sem crashes de inicialização, é preciso fazer o downgrade forçado dos pacotes utilizando a build de desenvolvimento de maio de 2024:</p>
1537  <div class="code"><pre># Comando para expurgar dependências conflitantes e instalar o dev wheel estável
1538pip uninstall torch torch-directml torchaudio
1539pip install torch==2.3.1+cpu --index-url https://download.pytorch.org/whl/cpu
1540pip install torch-directml==0.2.1.dev240521 --no-deps</pre></div>`},"comfyui-directml":{id:"comfyui-directml",title:"16. DIRECTML",desc:"Explicação técnica detalhada das falhas crônicas encontradas durante os testes na branch Windows.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fix","windows-driver","comfyui-windows"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-wsl"],previous:"comfyui-wsl",next:"comfyui-directml-func",related:["troubleshoot-comfyui","comfyui-portable-amd"]}},html:`<div class="err"><div class="err-t">Falha Estrutural — Incompatibilidade do Módulo CLIPTextEncode</div><p>Ao carregar os fluxos básicos de geração de imagem utilizando o instalador nativo DirectML para placas AMD, o console aborta a execução retornando a seguinte exceção impeditiva:</p><div class="code"><span class="code-lang">stderr</span><pre>File "comfy\\utils.py", line 245, in encode_token
1541NotImplementedError: Cannot access storage of OpaqueTensorImpl</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Análise de Engenharia:</strong> O driver DirectML encapsula os dados de memória em objetos conhecidos como <code>OpaqueTensorImpl</code>. Quando as funções internas de otimização de atenção matemática do ComfyUI tentam ler o conteúdo bruto desses tensores na memória física, a camada do ecossistema Microsoft bloqueia o acesso, interrompendo o pipeline de renderização.</p></div>`},"comfyui-flux":{id:"comfyui-flux",title:"18. PARAMETRIZAÇÃO CRÍTICA DO FLUX.1 SCHNELL",desc:"Configuração matemática obrigatória para processar o modelo SOTA na CPU sem estourar os limites da RAM.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:20,tags:["flux-fp8","comfyui-workflow","vram-allocation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml-func"],previous:"comfyui-directml-func",next:"comfyui-modelos",related:["flux_server","comfyui-modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">O processamento do FLUX.1 Schnell de 16GB em modo de CPU exige limites de amostragem fixos. Desvios nestas regras provocam o travamento da máquina por saturação extrema de memória:</p>
1542  <div class="tbl"><table>
1543    <thead><tr><th>
1543Parâmetro de Amostragem</th><th>Valor de Ajuste Obrigatório</th><th>Explicação Técnica no Xeon</th></tr></thead>
1544    <tbody>
1545      <tr class="hig"><td>Sampling Steps</td><td>4 Steps</td><td>O modelo Schnell foi desenhado para fechar a convergência de ruído em apenas 4 interações.</td></tr>
1546      <tr class="hig"><td>CFG Scale</td><td>1.0</td><td>Valores acima de 1.0 destroem a fidelidade das texturas e distorcem a distribuição de tensores.</td></tr>
1547      <tr><td>Scheduler Type</td><td>sgm_uniform</td><td>Garante a interpolação linear dos tensores de difusão de forma otimizada para instruções AVX2.</td></tr>
1548    </tbody>
1549  </table></div>`},"comfyui-modelos":{id:"comfyui-modelos",title:"14. GESTÃO ZERO-COPY DE MODELOS NO NVMe",desc:"Técnica de links simbólicos para unificar o armazenamento de checkpoints pesados sem duplicar arquivos.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"armazenamento",difficulty:"intermediate",estimated_time_min:15,tags:["symlink","diretorios-compartilhados","espaco-disco"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-flux"],previous:"comfyui-flux",next:"animatediff-video",related:["arquivos","modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Para evitar o desperdício de espaço no drive SSD NVMe e eliminar a necessidade de manter cópias gigantes idênticas entre o Windows e o Linux (WSL2), cria-se um link simbólico direto apontando para o sistema de arquivos cruzado:</p>
1550  <div class="code"><span class="code-lang">bash</span><pre># Executar este bloco dentro do terminal do subsistema Linux Ubuntu
1551cd ~/ComfyUI/models/checkpoints/
1552
1553# Criar o ponto de ancoragem virtual espelhando o arquivo físico localizado na partição E: do Windows
1554ln -s "/mnt/e/ComfyUI_Models/checkpoints/flux1-schnell-fp8.safetensors" ./flux1-schnell-fp8.safetensors</pre></div>`},"comfyui-portable-amd":{id:"comfyui-portable-amd",title:"29. COMFYUI PORTÁTIL v0.3.48 — IMPLEMENTAÇÃO AMD",desc:"Configurações específicas e injeção de variáveis de ambiente para a arquitetura Polaris.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-portable","directml-setup","portable-workflow"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshoot-comfyui"],previous:"troubleshoot-comfyui",next:"comunidade",related:["comfyui-directml","comfyui-flux"]}},html:`<div class="card">
1555    <p style="font-size:.88rem;color:#94a3b8;line-height:1.9">Para implementações que utilizam pacotes portáteis pré-compilados do ComfyUI focados em compatibilidade AMD DirectML no Windows, o interpretador Python precisa de ajuda para identificar corretamente as capacidades de hardware da GPU antiga:</p>
1556    <div class="code"><span class="code-lang">batch</span><pre># Inserir no topo do arquivo run_nvidia_gpu.bat ou do script portátil customizado:
1557set HSA_OVERRIDE_GFX_VERSION=8.0.3
1558set DXVK_ASYNC=1
1559
1560.\\python_embeded\\python.exe main.py --directml</pre></div>
1561    <p style="margin-top:.5rem;font-size:.82rem;color:#64748b;line-height:1.6">O sinalizador <code>8.0.3</code> emula o ID de arquitetura de compilação necessário para que as bibliotecas numéricas processem tensores sem travar o barramento PCIe da série RX 500.</p>
1562  </div>`},"comfyui-wsl":{id:"comfyui-wsl",title:"15. COMFYUI WSL2",desc:"Configurando o ambiente Linux virtualizado para herdar o poder computacional do Xeon e RAM ECC.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"virtualizacao",difficulty:"advanced",estimated_time_min:30,tags:["wsl2-linux","comfyui-wsl","direct-vulkan"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_openwebui_integration"],previous:"sd_openwebui_integration",next:"comfyui-directml",related:["comfyui-flux","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Para contornar o limite de VRAM física da GPU em modelos massivos, o ComfyUI é instanciado dentro do subsistema Linux apontando a execução estritamente para os cores do processador:</p>
1563  <div class="code"><span class="code-lang">bash</span>
1563<pre># Ativar o ambiente virtual isolado via Miniconda no terminal do Ubuntu
1564conda activate comfy_env
1565
1566# Chamar o script principal forçando o uso do hardware de processamento central
1567python main.py --cpu --listen 0.0.0.0 --port 8188</pre></div>
1568  <div class="note info" style="margin-top:.75rem">O painel de nós do ComfyUI estará totalmente disponível no lado do Windows através da rota mapeada: <strong>http://localhost:8188</strong></div>`},comunidade:{id:"comunidade",title:"30. CONTEXTO E FONTES DA COMUNIDADE",desc:"Repositórios de conhecimento hacker e fóruns dedicados à preservação e otimização de hardware legado.",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"comunidade",difficulty:"beginner",estimated_time_min:10,tags:["comunidade-hacker","links-utiles","github-preservation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-portable-amd"],previous:"comfyui-portable-amd",next:"amihart",related:["amihart","dadhacks","codacus"]}},html:`<div class="card acc">
1569    <p style="font-size:.85rem;color:#94a3b8;line-height:1.9">A engenharia reversa e a viabilidade técnica deste laboratório baseiam-se em discussões de otimização documentadas por comunidades focadas na extração de performance máxima de componentes de baixo custo:</p>
1570    <ul style="padding-left:1.2rem;margin-top:.5rem;font-size:.85rem;color:#e2e8f0;line-height:2">
1571      <li>Servidor Discord Oficial AIVisionsLab: <strong style="color:#5865F2"><a href="https://discord.gg/FmkxZjN8f" target="_blank" rel="noopener noreferrer" style="color:#5865F2;text-decoration:underline">discord.gg/FmkxZjN8f</a></strong></li>
1572      <li>Comunidade Global de Engenharia de Servidores de Herança: <strong style="color:var(--r)">r/X99_Lab</strong></li>
1573      <li>Discussões de Otimização e Rimes de Compilação GGUF: <strong style="color:#fff">Github: ggerganov/llama.cpp/discussions</strong></li>
1574    </ul>
1575  </div>`},contexto:{id:"contexto",title:"01. CONTEXTO E PROBLEMA",desc:"Em 2026, a narrativa padrão era clara: RX 580 não roda IA. Análise dos ecossistemas travados e viabilidade de aceleração via Vulkan.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:10,tags:["obsolescencia-programada","hardware-livre","preservacao-silicio"],last_reviewed:"2026-07-01",relationships:{prerequisites:[],previous:"",next:"hardware",related:["solucao","jornada"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Em 2026, a narrativa padrão era clara: <strong style="color:#fff">RX 580 não roda IA</strong>. Os ecossistemas disponíveis eram:</p>
1576  <div class="tbl"><table>
1577    <thead><tr><th>Solução</th><th>Status para RX 580</th></tr></thead>
1578    <tbody>
1579      <tr><td>CUDA (Nvidia)</td><td>❌ Exclusivo Nvidia</td></tr>
1580      <tr><td>ROCm (AMD oficial)</td><td>❌ Removeu suporte a Polaris/GCN4 na versão 5.x</td></tr>
1581      <tr><td>DirectML (Microsoft)</td><td>❌ Abandonado antes de amadurecer — instável, lento</td></tr>
1582      <tr><td>OpenVINO (Intel)</td><td>❌ Incompatível com Forge no Windows</td></tr>
1583    </tbody>
1584  </table></div>
1585  <div class="tbl" style="margin-top:.9rem"><table>
1586    <thead><tr><th>Item</th><th>Status (antes da solução)</th></tr></thead>
1587    <tbody>
1588      <tr><td>LLM</td><td>CPU pura — 25 a 40 minutos por resposta</td></tr>
1589      <tr><td>Geração de imagens</td><td>ComfyUI via CPU — 50+ minutos por imagem no HDD</td></tr>
1590      <tr><td>RX 580</td><td>Ociosa, 0% de uso para IA</td></tr>
1591      <tr><td>Storage</td><td>HDD lento (gargalo crítico de I/O)</td></tr>
1592    </tbody>
1593  </table></div>
1594  <div class="card acc" style="margin-top:1.25rem">
1595    <blockquote style="font-size:.88rem;color:#94a3b8;font-style:italic;line-height:1.9;border-left:3px solid var(--r);padding-left:.9rem">"Polaris é obsoleta. Só serve pra mineração. AMD antiga não roda IA. Troca de placa."</blockquote>
1596    <p style="margin-top:.9rem;font-size:.88rem;color:#e2e8f0;font-weight:600">Essa crença era falsa. O poder computacional sempre esteve lá. O problema era o software, não o hardware.</p>
1597  </div>
1598  <p style="margin-top:1.25rem;font-size:.88rem;color:#94a3b8;line-height:1.9">O projeto <code style="color:var(--r)">ggml</code> (base do <code style="color:var(--r)">llama.cpp</code> and <code style="color:var(--r)">stable-diffusion.cpp</code>) usa Vulkan como backend de GPU — padrão aberto que funciona em qualquer GPU moderna. A RX 580 suporta Vulkan 1.x desde os drivers originais de 2017. ROCm e CUDA são desnecessários.</p>
1599  <p style="margin-top:.9rem;font-size:.88rem;color:#94a3b8;line-height:1.9">Para modelos maiores (FLUX.1 Schnell 16GB, por exemplo), a solução é rodar via <strong style="color:#fff">CPU Xeon + RAM ECC abundante</strong> através do ComfyUI no WSL2, com link simbólico para os modelos no Windows — sem duplicar arquivos, sem perder espaço.</p>`},cpu:{id:"cpu",title:"24. PARAMETRIZAÇÃO E AJUSTES DO XEON",desc:"Configurações de BIOS e limites estruturais de instruções fp32 para o processador LGA 2011-3.",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"processadores",difficulty:"intermediate",estimated_time_min:18,tags:["bios-tuning","avx-optimization","intel-xeon-tuning"],last_reviewed:"2026-07-01",relationships:{prerequisites:["benchmarks"],previous:"benchmarks",next:"troubleshooting",related:["hardware","benchmarks"]}},html:`<div class="card acc">
1600    <p style="font-size:.88rem;color:#e2e8f0;font-weight:600;line-height:1.6">Diretrizes Técnicas para Processadores Xeon de Microarquitetura Haswell (v3):</p>
1601    <p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">O processador Intel Xeon E5-2690 v3 lançado em 2014 possui suporte nativo ao conjunto de instruções vetoriais <strong style="color:#fff">AVX2</strong>. No entanto, ele não possui hardware dedicado para cálculos matemáticos de precisão reduzida em <strong style="color:var(--r)">FP16 (Half-Precision)</strong>.</p>
1602    <p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">Ao instanciar os loaders de modelos dentro do ComfyUI no Linux, certifique-se de configurar a precisão de cálculo para <strong style="color:#22c55e">FP32 (Single-Precision)</strong>. Caso force a execução em FP16, o processador precisará emular as instruções via software, reduzindo a velocidade de processamento pela metade.</p>
1603  </div>`},dadhacks:{id:"dadhacks",title:"32. MÉTODO DADHACKS — AI IMAGE GENERATION ON RX 580 USING VULKAN: A COST-EFFECTIVE SOLUTION",desc:"Análise da consolidação experimental realizada por DH (DadHacks) em dezembro de 2025, estabelecendo caminhos de compatibilidade para geração de imagens na GPU legado.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"intermediate",estimated_time_min:20,tags:["dadhacks-method","estetica-baixo-custo","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["amihart"],previous:"amihart",next:"codacus",related:["amihart","codacus"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Em 05 de dezembro de 2025, o desenvolvedor <strong style="color:#fff">DH (DadHacks)</strong> publicou um guia técnico inovador no site <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline">dadhacks.org</a> demonstrando que a GPU AMD RX 580 de 8GB é perfeitamente viável para geração de IA moderna sem depender de soluções de softw
1603are proprietárias ou do ROCm.</p>
1604
1605  <div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);margin-bottom:1.25rem">
1606    <strong style="color:#fff;display:block;margin-bottom:.4rem">📌 Resultados da Validação Técnica:</strong>
1607    <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">O estudo de DadHacks demonstrou de forma experimental que é viável executar o Stable Diffusion via Vulkan, refinando a conclusão preliminar de janeiro de 2025. A maturidade gradual do ecossistema do <code>stable-diffusion.cpp</code> ampliou as taxas de transferência até o fim de 2025.</p>
1608  </div>
1609
1610  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. Compilação do Motor — stable-diffusion.cpp</h4>
1611  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">DH detalhou o fluxo de compilação no Linux utilizando a flag compiladora nativa <code>-DSD_VULKAN=ON</code>:</p>
1612  <div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># Clonar de forma recursiva (obrigatório para trazer submódulos do ggml)
1613git clone --recursive https://github.com/leejet/stable-diffusion.cpp
1614cd stable-diffusion.cpp && mkdir build && cd build
1615
1616# Configurar CMake usando Vulkan ativado
1617cmake .. -DSD_VULKAN=ON
1618
1619# Compilar binários
1620cmake --build . --config Release</pre></div>
1621
1622  <p style="font-size:.82rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">🧬 <strong>Divergência de Flags Documentada:</strong> O DadHacks usou <code>-DSD_VULKAN=ON</code> (camada de aplicação), enquanto o AIVisionsLab homologou <code>-DGGML_VULKAN=ON</code> (camada de engine de tensores). Ambas geram o mesmo binário eficiente na prática, mas referenciam caminhos diferentes da evolução do repositório leejet.</p>
1623
1624  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. Comandos de Geração Originais (DadHacks)</h4>
1625  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Demonstração original de chamada offline via terminal para Flux Schnell (modelo quantizado de 4-bits) e Flux Dev, usando segmentação de memória para poupar VRAM:</p>
1626  <div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># Executar Flux Schnell (4 steps de amostragem)
1627sd --diffusion-model SD-Models/flux1-schnell-q4_0.gguf \\
1628   --vae SD-Models/ae.safetensors \\
1629   --clip_l SD-Models/clip_l.safetensors \\
1630   --t5xxl SD-Models/t5xxl_fp16.safetensors \\
1631   -p "a lovely beagle holding a sign says 'hello'" \\
1632   --cfg-scale 1.0 \\
1633   --sampling-method euler \\
1634   -v --steps 4 \\
1635   --clip-on-cpu</pre></div>
1636
1637  <div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin-bottom:1.25rem">
1638    <strong style="color:#ef4444;display:block;margin-bottom:.4rem">🚨 ALERTA CRÍTICO: Incompatibilidade GGUF (Descoberta AIVisionsLab)</strong>
1639    <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">O DadHacks não listou uma incompatibilidade de formato muito comum: pesos GGUF publicados pelo mantenedor <strong>city96</strong> são compatíveis <em>apenas</em> com o ComfyUI. Para execução no stable-diffusion.cpp / sd-server, é obrigatório utilizar os modelos publicados oficialmente pelo mantenedor <strong>leejet</strong> (ex: <code style="color:#fff">FLUX.1-schnell-gguf</code>).</p>
1640  </div>
1641
1642  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">C. O Que o DadHacks Não Cobriu (Que o AIVisionsLab Expandiu)</h4>
1643  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">O guia original de DadHacks focou no ecossistema Linux/terminal com comandos manuais. O AIVisionsLab expandiu agressivamente essa base técnica:</p>
1644  <table style="width:100%;border-collapse:collapse;font-size:.78rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem;border:1px solid var(--b)">
1645    <thead>
1646      <tr style="background:rgba(255,255,255,0.02);color:#fff;border-bottom:1px solid var(--b)">
1647        <th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">Funcionalidade</th>
1648        <th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">DadHacks (Linux)</th>
1649        <th style="padding:.5rem;text-align:left">AIVisionsLab (Windows Nativo)</th>
1650      </tr>
1651    </thead>
1652    <tbody>
1653      <tr style="border-bottom:1px solid var(--b)">
1654        <td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Hospedagem no Windows</td>
1655        <td style="padding:.5rem;border-right:1px solid var(--b)">❌ Não abordada</td>
1656        <td style="padding:.5rem;color:#22c55e">✅ Mapeamento via MSVC / Cmd executáveis</td>
1657      </tr>
1658      <tr style="border-bottom:1px solid var(--b)">
1659        <td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Integração Gráfica</td>
1660        <td style="padding:.5rem;border-right:1px solid var(--b)">❌ Apenas terminal CLI</td>
1661        <td style="padding:.5rem;color:#22c55e">✅ Servidor API + OpenWebUI / Docker link</td>
1662      </tr>
1663      <tr style="border-bottom:1px solid var(--b)">
1664        <td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Automação .bat</td>
1665        <td style="padding:.5rem;border-right:1px solid var(--b)">❌ Scripts manuais shell</td>
1666        <td style="padding:.5rem;color:#22c55e">✅ Scripts automáticos double-click no Desktop</td>
1667      </tr>
1668      <tr>
1669        <td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Segurança VRAM</td>
1670        <td style="padding:.5rem;border-right:1px solid var(--b)">⚠️ Limitação a base CLI</td>
1671        <td style="padding:.5rem;color:#22c55e">✅ Otimizações com VAE Tiling contra bugs OOM</td>
1672      </tr>
1673    </tbody>
1674  </table>
1675
1676  <div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem">
1677    <strong style="color:var(--r)">Crédito Comunitário Extensivo:</strong>
1677 Seção documental baseada na publicação original de <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">DH (DadHacks)</a>, intitulada <em>"AI Image Generation on RX 580 Using Vulkan"</em>. O conhecimento é livre e evolutivo.
1678  </div>`},falhas:{id:"falhas",title:"03. O QUE NÃO FUNCIONOU (O CEMITÉRIO TÉCNICO)",desc:"Análise detalhada de erros: os motivos técnicos da rejeição do DirectML nativo, OpenVINO e ROCm.",meta:{version:"1.0.0",type:"estudo_caso",category:"troubleshooting",subcategory:"historico",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fail","rocm-amd","openvino-intel"],last_reviewed:"2026-07-01",relationships:{prerequisites:["hardware"],previous:"hardware",next:"solucao",related:["troubleshooting","comfyui-directml"]}},html:`<div class="err">
1679    <div class="err-t">3.1 DirectML + ComfyUI Windows Nativo — ABANDONADO</div>
1680    <p><strong style="color:#e2e8f0">Tentativas:</strong> Invocação via <code>torch-directml</code> e flag <code>--directml</code>. O ecossistema foi detectado como <code>privateuseone0</code>, mas revelou instabilidade crônica devido à falta de atualizações estruturais da Microsoft.</p>
1681    <p style="margin-top:.45rem"><strong style="color:#e2e8f0">Logs de Erro Críticos:</strong></p>
1682    <div class="code"><span class="code-lang">stderr</span><pre>WARNING: torch-directml barely works, is very slow, has not been updated in over 1 year and might be removed soon, please don't use it.
1683
1684OSError: [WinError 127] Não foi possível encontrar o procedimento especificado
1685# Causado por um mismatch de DLL entre o torchaudio e a build de CPU do torch 2.4.1
1686
1687NotImplementedError: Cannot access storage of OpaqueTensorImpl
1688# CLIPTextEncode quebra ao tentar manipular tensores opacos gerados pelo DirectML</pre></div>
1689    <p style="margin-top:.45rem"><strong style="color:#e2e8f0">Causa Raiz:</strong> O DirectML gera tensores opacos incapazes de se comunicar com os backends de atenção modernos do ComfyUI. Além disso, o instalador força a importação do <code>torchaudio</code> dentro do módulo <code>audio_vae.py</code>, quebrando a inicialização mesmo que você não use áudio.</p>
1690  </div>
1691  <div class="err" style="margin-top:1rem">
1692    <div class="err-t">3.2 OpenVINO + Stable Diffusion Forge</div>
1693    <p><strong style="color:#e2e8f0">Tentativa:</strong> Acoplamento da extensão <code>sd-webui-openvino</code> desenvolvida pela Intel dentro do ecossistema Forge.</p>
1694    <div class="code"><span class="code-lang">stderr</span><pre>ModuleNotFoundError: No module named 'ldm'
1695ModuleNotFoundError: No module named 'sgm'
1696Error build_unet: Invalid backend: 'openvino'</pre></div>
1697    <p style="margin-top:.45rem"><strong style="color:#e2e8f0">Causa Raiz:</strong> A extensão foi desenhada para a arquitetura antiga do Automatic1111. Como o Forge reestruturou completamente o código e substituiu os módulos nativos de <code>ldm</code> e <code>sgm</code>, a injeção do backend OpenVINO falha por completo.</p>
1698  </div>
1699  <div class="err" style="margin-top:1rem">
1700    <div class="err-t">3.3 ROCm — Inviável por Design em Polaris</div>
1701    <ul>
1702      <li>A AMD encerrou oficialmente o suporte à arquitetura GCN4 (Polaris/RX 580) nas branches modernas do ROCm (v5.x+).</li>
1703      <li>Inexistência de suporte oficial para ROCm nativo em ambiente Windows.</li>
1704      <li>Camadas de compatibilidade via WSL2 para placas antigas geram Kernel Panics constantes em inferências de alta carga.</li>
1705    </ul>
1706  </div>
1707  <div class="err" style="margin-top:1rem">
1708    <div class="err-t">3.4 WebUI Forge em CPU Pura (HDD)</div>
1709    <p><strong style="color:#e2e8f0">Métricas:</strong> Startup time de 85 segundos. Tempo de renderização insustentável de ~19 minutos por imagem simples (512x512, 20 steps). O gargalo do HDD em concorrência com o gerenciamento de paginação do <code>memory_management.py</code> tornou o setup impraticável.</p>
1710  </div>`},"flux-vulkan":{id:"flux-vulkan",title:"25. EXPLORAÇÃO COMPLEMENTAR: FLUX VIA VULKAN",desc:"Aceleração alternativa de modelos Flux utilizando quantizações ultra-compactas em C++.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["flux-vulkan","cpp-native-inference","amd-acceleration"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshooting"],previous:"troubleshooting",next:"troubleshoot-comfyui",related:["flux_server","sdxl_vulkan"]}},html:`<div class="card">
1711    <p style="font-size:.88rem;color:#94a3b8;line-height:1.9">Embora o checkpoint nativo do FLUX.1 de 16GB exija o processamento robusto da CPU Xeon, é totalmente viável realizar inferências diretamente na GPU RX 580 utilizando o binário do <code>stable-diffusion.cpp</code> acoplado com quantizações agressivas de 3-bits:</p>
1712    <div class="note info" style="margin-top:.5rem">Peso Recomendado para Testes VRAM: <strong>flux1-schnell-Q3_K_S.gguf (~5.2GB)</strong>. Esta variação se acomoda com folga dentro do limite físico de 8GB da placa Polaris, entregando gerações SOTA aceleradas por hardware.</div>
1713  </div>`},flux_server:{id:"flux_server",title:"11. RODAR FLUX NO SD-SERVER (GPU + CPU HÍBRIDO)",desc:"Mapeamento e inicialização do ecossistema Flux de 12B parâmetros com arquitetura de memória segmentada.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"advanced",estimated_time_min:30,tags:["flux-schnell","servidor-imagem","gerenciamento-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdserver"],previous:"sdserver",next:"sd_bat_automation",related:["comfyui-flux","flux-vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O Flux exige segmentação precisa entre VRAM e RAM host. Utilizando as flags <code>--vae-on-cpu</code> e <code>--vae-tiling</code>, evitamos o estouro de memória (OOM) na RX 580 2048SP. O T5XXL (fp16) e o VAE residem na RAM; o modelo de difusão ocupa a VRAM.</p>
1714  <div class="tbl">
1715    <table>
1716      <thead>
1717        <tr><th>Componente</th><th>Arquivo Homologado</th><th>Alocação Final</th><th>Tamanho</th></tr>
1718      </thead>
1719      <tbody>
1720        <tr><td>Diffusion Model</td><td><code>flux1-schnell-q4_k.gguf</code></td><td><strong>GPU (VRAM)</strong></td><td>~6.5 GB</td></tr>
1721        <tr><td>VAE</td><td><code>ae.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~160 MB</td></tr>
1722        <tr><td>CLIP L</td><td><code>clip_l.safetensors</code></td><td><strong>GPU (VRAM)</strong></td><td>~235 MB</td></tr>
1723        <tr><td>T5XXL</td><td><code>t5xxl_fp16.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~9.3 GB</td></tr>
1724      </tbody>
1725    </table>
1726  </div>
1727  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-top:1.25rem">⚠️ <strong style="color:#fff">Notas de Estabilidade:</strong> A remoção da flag <code>--timeout</code> (não suportada pela versão atual) e a inclusão de <code>--vae-tiling</code> eliminaram os erros de <em>DeviceMemoryAllocation</em>. O uso de RAM total chega a ~9.5 GB (T5XXL fp16). Para economizar RAM, substituir por <code>t5xxl_fp8</code> reduz para ~5 GB.</p>
1728  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Comando de Produção (iniciar.bat):</strong></p>
1729  <pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
1730  --diffusion-model "E:\\ia_storage\\models\\Stable-diffusion\\flux1-schnell-q4_k.gguf" ^
1731  --vae "E:\\ia_storage\\models\\Stable-diffusion\\ae.safetensors" ^
1732  --clip_l "E:\\ia_storage\\models\\Stable-diffusion\\clip_l.safetensors" ^
1733  --t5xxl "E:\\ia_storage\\models\\Stable-diffusion\\t5xxl_fp16.safetensors" ^
1734  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre>
1735  <div class="tbl" style="margin-top:1.25rem; margin-bottom:1.25rem">
1736    <table>
1737      <thead>
1738        <tr><th>Etapa</th><th>Tempo Real</th></tr>
1739      </thead>
1740      <tbody>
1741        <tr><td>Condicionamento (T5XXL)</td><td>11.49s</td></tr>
1742        <tr><td>Sampling — 4 steps @ 1024x1024</td><td>~838s (~14 min)</td></tr>
1743        <tr><td>VAE Decode — 9 tiles</td><td>40.45s</td></tr>
1744        <tr><td><strong>Total por imagem</strong></td><td><strong>~838s (~14 min)</strong></td></tr>
1745      </tbody>
1746    </table>
1747  </div>
1748  <div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;">
1749    <span style="color:#22c55e; font-weight:bold">✅ STATUS: SERVIDOR EM PRODUÇÃO — IMAGEM GERADA COM SUCESSO</span><br>
1750    <span style="font-size:.8rem; color:#94a3b8">Listening on http://0.0.0.0:7860 | VRAM: 7.6/8.0 GB | RAM: ~9.5 GB | GPU: RX 580 2048SP | Temp: 66°C</span>
1751  </div>`}
1751,guia:{id:"guia",title:"22. GUIA ESTRATÉGICO POR CASO DE USO",desc:"Matriz de tomada de decisão: quando direcionar o processamento para a GPU ou para o Xeon.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:12,tags:["decision-making","workflows","hardware-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["scripts"],previous:"scripts",next:"benchmarks",related:["contexto","benchmarks"]}},html:`<div class="tbl"><table>
1752    <thead><tr><th>Objetivo do Workflow</th><th>Modelo Recomendado</th><th>Backend Alocado</th><th>Métrica Real de Geração</th></tr></thead>
1753    <tbody>
1754      <tr class="hig"><td>Chat de Texto e Assistência Local</td><td>Mistral 7B / Llama 3 8B GGUF</td><td>GPU RX 580 (Vulkan)</td><td>Alta Performance (15-16 tokens/s) ⚡</td></tr>
1755      <tr class="hig"><td>Geração de Imagens Veloz (512x512)</td><td>DreamShaper 8 (SD 1.5 GGUF)</td><td>GPU RX 580 (Vulkan)</td><td>Renderização Fluida (~72 segundos)</td></tr>
1756      <tr><td>Criação de Alta Resolução e Detalhe SOTA</td><td>FLUX.1 Schnell (16GB Weights)</td><td>CPU Xeon (WSL2)</td><td>Processamento Pesado (~24 minutos)</td></tr>
1757      <tr><td>Interpolação de Quadros e Animação Video</td><td>AnimateDiff Pipeline Standard</td><td>CPU Xeon (WSL2)</td><td>Processamento Estável (~141 segundos)</td></tr>
1758    </tbody>
1759  </table></div>`},hardware:{id:"hardware",title:"02. HARDWARE DO LABORATÓRIO",desc:"Configuração Master detalhada: Xeon E5-2690 v3, RX 580 8GB, 32GB RAM ECC e o impacto crítico do NVMe.",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"especificacoes",difficulty:"beginner",estimated_time_min:12,tags:["amd-polar","rx-580","intel-xeon","ram-ecc"],last_reviewed:"2026-07-01",relationships:{prerequisites:["contexto"],previous:"contexto",next:"falhas",related:["cpu","benchmarks"]}},html:`<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:.85rem;margin-bottom:1.25rem">
1760    <div class="stat"><div class="stat-icon">🖥️</div><div><div class="stat-lbl">GPU</div><div class="stat-val" style="font-size:.82rem">RX 580 2048SP</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">8GB GDDR5 VRAM</div></div></div>
1761    <div class="stat"><div class="stat-icon">⚙️</div><div><div class="stat-lbl">CPU</div><div class="stat-val" style="font-size:.82rem">Xeon E5-2690 v3</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">12c/24t · 3.5GHz boost</div></div></div>
1762    <div class="stat"><div class="stat-icon">💾</div><div><div class="stat-lbl">RAM</div><div class="stat-val" style="font-size:.82rem">32GB DDR4 REG ECC</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Quad Channel RDIMM</div></div></div>
1763    <div class="stat"><div class="stat-icon">📀</div><div><div class="stat-lbl">Storage</div><div class="stat-val" style="font-size:.82rem">NVMe E: 1TB</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">1.7–3.5 GB/s leitura</div></div></div>
1764    <div class="stat"><div class="stat-icon">🖥️</div><div><div class="stat-lbl">OS</div><div class="stat-val" style="font-size:.82rem">Windows 10 Pro</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">WSL2 Ubuntu 22.04.5</div></div></div>
1765    <div class="stat"><div class="stat-icon">🔧</div><div><div class="stat-lbl">Driver AMD</div><div class="stat-val" style="font-size:.82rem">31.0.21924.61</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Amdnolk (11/12/2025)</div></div></div>
1766  </div>
1767  <div class="tbl"><table>
1768    <thead><tr><th>Componente</th><th>Especificação no Ambiente</th></tr></thead>
1769    <tbody>
1770      <tr><td>Placa-mãe</td><td>Machinist MR9A Pro (Chipset X99, LGA 2011-3)</td></tr>
1771      <tr><td>Storage Secundário</td><td>HDD C: (Gargalo de I/O — modelos mantidos no NVMe E:)</td></tr>
1772      <tr><td>Kernel WSL2</td><td>6.6.87.2-microsoft-standard-WSL2</td></tr>
1773      <tr><td>Vulkan SDK</td><td>1.4.341.1</td></tr>
1774      <tr><td>CMake</td><td>4.3.2</td></tr>
1775      <tr><td>Visual Studio</td><td>2022/2026 Community (MSVC 19.50)</td></tr>
1776      <tr><td>Python (WSL2)</td><td>3.11.15</td></tr>
1777      <tr><td>PyTorch (WSL2)</td><td>2.4.1+cu121</td></tr>
1778      <tr><td>ComfyUI Versões</td><td>0.19.3 (WSL2 CPU) | 0.21.0 (Windows DirectML)</td></tr>
1779    </tbody>
1780  </table></div>
1781  <div class="card" style="margin-top:.9rem">
1782    <p style="font-size:.85rem;color:#64748b;line-height:1.9"><strong style="color:#fff">RX 580 2048SP:</strong> Variante com 2048 Shader Processors (vs 2304SP original). Placa extremamente comum de mineração que performa de forma impecável via Vulkan.</p>
1783    <p style="font-size:.85rem;color:#64748b;line-height:1.9;margin-top:.65rem"><strong style="color:#fff">NVMe vs HDD:</strong> A mudança para o NVMe reduziu o carregamento do LLM de 25 minutos para 4 minutos. No caso do FLUX (16GB), o carregamento caiu de 25 minutos no HDD para apenas ~30 segundos no NVMe. <strong style="color:var(--r)">O storage é tão crítico quanto a capacidade de processamento.</strong></p>
1784    <p style="font-size:.85rem;color:#64748b;line-height:1.9;margin-top:.65rem"><strong style="color:#fff">32GB REG ECC:</strong> Operando com o FLUX.1 Schnell FP8, o sistema consome 94% da memória disponível de forma contínua. A RAM de servidor ECC mantém estabilidade absoluta e evita corrupção de tensores s
1784ob carga extrema.</p>
1785  </div>`},jornada:{id:"jornada",title:"06. JORNADA COMPLETA — AS 5 FASES",desc:"A linha do tempo do laboratório: da lentidão inicial da CPU ao controle total do hardware de herança.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:10,tags:["linha-tempo","conquistas","roadmap"],last_reviewed:"2026-07-01",relationships:{prerequisites:["prereqs"],previous:"prereqs",next:"llama",related:["linhatempo","proximos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.75rem">O sucesso técnico do ecossistema local foi alcançado através de 5 marcos evolutivos e decisões estratégicas de hardware:</p>
1786  <div class="phase">
1787    <div class="phase-num">01</div>
1788    <div class="phase-body">
1789      <div class="phase-hdr"><span class="phase-title">WebUI Forge em CPU Pura (HDD)</span><span class="lbl lbl-b">BASELINE INICIAL</span></div>
1790      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Primeira infraestrutura funcional. Boot demorado de 85 segundos e tempos de renderização batendo ~19 minutos por imagem. Sistema completamente inviável para uso produtivo.</p>
1791    </div>
1792  </div>
1793  <div class="phase">
1794    <div class="phase-num">02</div>
1795    <div class="phase-body">
1796      <div class="phase-hdr"><span class="phase-title">Aceleração de LLM via Vulkan (RX 580)</span><span class="lbl lbl-r">BREAKTHROUGH TÉCNICO</span></div>
1797      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Compilação bem-sucedida do llama.cpp ativando a flag <code>-DGGML_VULKAN=ON</code>. O motor passou a identificar a placa de vídeo Polaris nativamente, saltando a taxa de inferência de 3-5 t/s para expressivos 15-16 t/s.</p>
1798    </div>
1799  </div>
1800  <div class="phase">
1801    <div class="phase-num">03</div>
1802    <div class="phase-body">
1803      <div class="phase-hdr"><span class="phase-title">Migração de Armazenamento Centralizado para NVMe</span><span class="lbl lbl-y">MARCO DECISIVO</span></div>
1804      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Substituição do HDD mecânico pelo drive NVMe de alta velocidade (1.7–3.5 GB/s). O tempo de carga na memória do modelo de linguagem caiu de 25 minutos para apenas 4 minutos, eliminando o principal gargalo de I/O do laboratório.</p>
1805    </div>
1806  </div>
1807  <div class="phase">
1808    <div class="phase-num">04</div>
1809    <div class="phase-body">
1810      <div class="phase-hdr"><span class="phase-title">stable-diffusion.cpp nativo via Vulkan</span><span class="lbl lbl-g">OBJETIVO GPU CONCLUÍDO ✅</span></div>
1811      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Primeira imagem renderizada localmente utilizando 100% da GPU RX 580 no ambiente Windows. Ciclo de geração do modelo de pesos quânticos SD 1.5 GGUF estabilizado na marca de ~72 segundos.</p>
1812    </div>
1813  </div>
1814  <div class="phase">
1815    <div class="phase-num">05</div>
1816    <div class="phase-body">
1817      <div class="phase-hdr"><span class="phase-title">Escalonamento do FLUX.1 Schnell via Xeon + RAM ECC</span><span class="lbl lbl-b">EXPANSÃO DE CAPACIDADE ✅</span></div>
1818      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Implementação estável do modelo SOTA de 16GB rodando no processador de servidor. Prova empírica de que uma infraestrutura corporativa de 2014 consegue processar de forma robusta inteligências artificiais de última geração de 2026.</p>
1819    </div>
1820  </div>`},limit_qwen_35b:{id:"limit_qwen_35b",title:"41. LEVANDO AO LIMITE QWEN3.5 35B Q6_K NA RX 580 8GB VIA VULKAN",desc:"Experimento de execução híbrida extrema de um modelo de 34.66B de parâmetros na GPU Polaris e Xeon de 2014.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:45,tags:["qwen-35b","offloading-extremo","vram-spillover"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_srt_ptbr"],previous:"audio_srt_ptbr",next:"proving_hypothesis_35b",related:["proving_hypothesis_35b","llama"]},part:1}
1820,html:`<div class="whisper-doc">
1821  <div class="hero">
1822    <div class="hero-title"><span>Leve ao Limite</span> — Qwen3.5 35B na RX 580</div>
1823    <div class="hero-sub">Experimento de execução híbrida extrema de um modelo de <strong>34,66B parâmetros</strong> na GPU de 8GB de VRAM e Xeon de 2014 via motor Vulkan.</div>
1824    <div class="hero-badges">
1825      <span class="badge badge-gpu">AMD RX 580 8GB</span>
1826      <span class="badge badge-win">Xeon E5-2690 v3</span>
1827      <span class="badge badge-ok">Vulkan Híbrido</span>
1828      <span class="badge badge-ok">34.66B parameters</span>
1829      <span class="badge badge-win">Q6_K Quantization</span>
1830    </div>
1831  </div>
1832
1833  <div class="stat-grid">
1834    <div class="stat">
1835      <div class="stat-label">Velocidade Geração</div>
1836      <div class="stat-value">5.64 tok/s</div>
1837      <div class="stat-sub">Sessão 2 (Estável)</div>
1838    </div>
1839    <div class="stat">
1840      <div class="stat-label">Prompt Eval</div>
1841      <div class="stat-value">34.13 tok/s</div>
1842      <div class="stat-sub">Tempo resposta ~107s</div>
1843    </div>
1844    <div class="stat">
1845      <div class="stat-label">Temperatura Máxima</div>
1846      <div class="stat-value">80°C</div>
1847      <div class="stat-sub">Sem Throttling (Alvo: 90°C)</div>
1848    </div>
1849    <div class="stat">
1850      <div class="stat-label">Custo Adicional</div>
1851      <div class="stat-value">R$ 0,00</div>
1852      <div class="stat-sub">Execução 100% local</div>
1853    </div>
1854  </div>
1855
1856  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.0 — Contexto e Motivação</h3>
1857  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
1858    Em 15 de junho de 2026, o AIVisionsLab conduziou o experimento mais extremo da sua história: rodar um modelo de <strong>34,66 bilhões de parâmetros</strong> em modo híbrido numa GPU AMD Radeon RX 580 2048SP de 2017 com apenas 8GB de VRAM.
1859  </p>
1860  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
1861    "Se a RX 580 já roda Qwen3 4B a 35 tokens/s via Vulkan, até onde vai o limite?"
1862  </blockquote>
1863  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
1864    A resposta documentada abaixo prova que o limite não é onde o mercado de hardware diz que é.
1865  </p>
1866
1867  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.1 — Hardware do Laboratório</h3>
1868  <div class="tbl">
1869    <table>
1870      <thead>
1871        <tr>
1872          <th>Componente</th>
1873          <th>Especificação</th>
1874        </tr>
1875      </thead>
1876      <tbody>
1877        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 cores / 24 threads · 3,05 GHz turbo (Lançado em 2014)</td></tr>
1878        <tr><td><strong>RAM</strong></td><td>31,8 GB DDR4 REG ECC (quad-channel)</td></tr>
1879        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (Lançado em 2017)</td></tr>
1880        <tr><td><strong>Storage 1</strong></td><td>SSD NVMe (Disco E:) — modelos GGUF (Leitura de 1.7–3.5 GB/s)</td></tr>
1881        <tr><td><strong>Storage 2</strong></td><td>HDD (Disco C: / F:) — sistema Windows + swap</td></tr>
1882        <tr><td><strong>Storage 3</strong></td><td>HDD (Disco D:) — arquivos secundários</td></tr>
1883        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — lançado em 20/05/2026</td></tr>
1884        <tr><td><strong>DirectX</strong></td><td>12 (Feature Level 12.0)</td></tr>
1885        <tr><td><strong>Barramento</strong></td><td>PCI Express 3, dispositivo 0, função 0</td></tr>
1886        <tr><td><strong>Sistema</strong></td><td>Windows 10/11 com WSL2 ativo</td></tr>
1887      </tbody>
1888    </table>
1889  </div>
1890  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
1891    *Nota histórica: O Xeon E5-2690 v3 é de 2014. A RX 580 é de 2017. O Qwen3.5 é de 2025. Hardware de datacenter de 10 anos atrás processando IA de última geração.
1892  </p>
1893
1894  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.2 — Software e Versões</h3>
1895  <div class="tbl">
1896    <table>
1897      <thead>
1898        <tr>
1899          <th>Software</th>
1900          <th>Versão / Detalhe</th>
1901        </tr>
1902      </thead>
1903      <tbody>
1904        <tr><td><strong>llama.cpp</strong></td><td>build b9049-2496f9c14</td></tr>
1905        <tr><td><strong>Compilador</strong></td><td>MSVC 14.51.36231 (Visual Studio)</td></tr>
1906        <tr><td><strong>Vulkan SDK</strong></td><td>1.4.350.0</td></tr>
1907        <tr><td><strong>OpenWebUI</strong></td><td>v0.9.6</td></tr>
1908        <tr><td><strong>SearXNG</strong></td><td>via Docker — integrado ao OpenWebUI</td></tr>
1909        <tr><td><strong>
1909Backend GPU</strong></td><td>Vulkan — <em>sem CUDA, sem ROCm, sem DirectML</em></td></tr>
1910        <tr><td><strong>Docker Desktop</strong></td><td>Ativo — containers open-webui + searxng</td></tr>
1911      </tbody>
1912    </table>
1913  </div>
1914
1915  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.3 — O Modelo: Qwen3.5-35B-A3B-Uncensored Q6_K</h3>
1916  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.1 — Especificações Técnicas</h4>
1917  <div class="tbl">
1918    <table>
1919      <thead>
1920        <tr>
1921          <th>Parâmetro</th>
1922          <th>Valor</th>
1923        </tr>
1924      </thead>
1925      <tbody>
1926        <tr><td><strong>Nome completo</strong></td><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K</td></tr>
1927        <tr><td><strong>Arquitetura</strong></td><td>qwen35moe — Mixture of Experts (MoE)</td></tr>
1928        <tr><td><strong>Parâmetros totais</strong></td><td>34,66 bilhões</td></tr>
1929        <tr><td><strong>Tamanho do arquivo</strong></td><td>26,55 GiB (6,58 bits por peso)</td></tr>
1930        <tr><td><strong>Quantização</strong></td><td>Q6_K — 432 tensores q6_K + 301 tensores f32</td></tr>
1931        <tr><td><strong>Experts totais</strong></td><td>256 experts</td></tr>
1932        <tr><td><strong>Experts ativos por token</strong></td><td>8 de 256 (apenas 3,1% ativados)</td></tr>
1933        <tr><td><strong>Contexto máximo de treino</strong></td><td>262.144 tokens</td></tr>
1934        <tr><td><strong>Vocabulário</strong></td><td>248.320 tokens (BPE, tokenizer qwen35)</td></tr>
1935        <tr><td><strong>Thinking mode padrão</strong></td><td>ATIVADO (<code>thinking = 1</code> no template Jinja2)</td></tr>
1936        <tr><td><strong>Intervalo de full attention</strong></td><td>A cada 4 layers</td></tr>
1937      </tbody>
1938    </table>
1939  </div>
1940
1941  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.2 — Por que MoE muda tudo</h4>
1942  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
1943    Em um modelo denso de 35B, <strong>todos</strong> os 35 bilhões de parâmetros são ativados para cada token gerado. No Qwen3.5 MoE, apenas os <strong>8 experts mais relevantes</strong> de 256 são ativados — o equivalente a ~3B parâmetros ativos por token.
1944  </p>
1945  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
1946    Isso explica por que um arquivo de 26GB consegue rodar numa máquina com 32GB de RAM: a maior parte dos pesos está na memória mas <strong>não é calculada simultaneamente</strong>.
1947  </p>
1948
1949  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.4 — Comando de Inicialização</h3>
1950  <div class="cmd">
1951# Sessão 1 (porta 8080 — erro corrigido depois)
1952.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
1952ort 8080
1953
1954# Sessão 2 (porta 8081 — correta)
1955.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --port 8081</div>
1956  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
1957    <strong>Nenhuma flag manual de camadas (<code>-ngl</code>).</strong> O llama.cpp fez todo o fitting automático.
1958  </p>
1959<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.5 — O Fitting Automático: Como o llama.cpp dividiu 26GB em 1,15 segundos</h3>
1960  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
1961    Este é o coração técnico do experimento. Sem nenhuma intervenção manual, o llama.cpp executou um algoritmo de otimização que analisou a VRAM disponível e distribuiu o modelo entre GPU e RAM de forma inteligente.
1962  </p>
1963
1964  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.1 — Situação Inicial (Impossível carregar inteiro na GPU)</h4>
1965  <div class="cmd">
1966Memória necessária na GPU (modelo completo): 32.961 MiB
1967VRAM livre disponível:                        7.366 MiB
1968Déficit:                                     26.618 MiB — impossível da GPU conter tudo</div>
1969
1970  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.2 — Sequência de Decisões do Fitting (1,15 segundos)</h4>
1971  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
1972    <strong>Passo 1 — Redução de contexto:</strong>
1973  </p>
1974  <div class="cmd">Contexto original:  262.144 tokens ➔ Contexto reduzido automaticamente: 4.096 tokens (Economia de VRAM: 5.347 MiB)</div>
1975  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
1976    <strong>Passo 2 — Mover todos os experts MoE para RAM:</strong>
1977  </p>
1978  <div class="cmd">Vulkan0 com as camadas densas residuais: 2.418 MiB (Sobra 3.924 MiB VRAM livre)
1979RAM host (experts MoE mapeados): 25.613 MiB</div>
1980  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
1981    <strong>Passo 3 — Realocar camadas densas de volta para GPU (back-to-front):</strong>
1982  </p>
1983  <div class="cmd">41 camadas densas realocadas ➔ GPU. Uso resultante: 3.048 MiB | Livre: 4.318 MiB</div>
1984  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
1985    <strong>Passo 4 — Filling front-to-back com overflow fracionado:</strong>
1986  </p>
1987  <div class="cmd">Resultado: 41 camadas (36 "overflowing") na GPU
1988Tipo de overflow: GATE (fracionado no gate layer)
1989Uso final GPU: 6.255 MiB | Livre: 1.111 MiB</div>
1990
1991  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.3 — Distribuição Final dos Pesos</h4>
1992  <div class="tbl">
1993    <table>
1994      <thead>
1995        <tr>
1996          <th>Localização do Buffer</th>
1997          <th>Conteúdo Armazenado</th>
1998          <th>Tamanho Mobilizado</th>
1999        </tr>
2000      </thead>
2001      <tbody>
2002        <tr><td><strong>Vulkan0 (RX 580 8GB)</strong></td><td>41 camadas densas + output layer</td><td><strong>5.154 MiB</strong></td></tr>
2003        <tr><td><strong>CPU_Mapped (RAM via mmap)</strong></td><td>256 experts MoE</td><td><strong>26.784 MiB</strong></td></tr>
2004      </tbody>
2005    </table>
2006  </div>
2007
2008  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.4 — Buffers Adicionais alocados na VRAM</h4>
2009  <div class="tbl">
2010    <table>
2011      <thead>
2012        <tr>
2013          <th>Buffer Tipo</th>
2014          <th>Tamanho Alocado</th>
2015          <th>Descrição Física</th>
2016        </tr>
2017      </thead>
2018      <tbody>
2019        <tr><td><strong>KV Cache (Vulkan0)</strong></td><td>80,00 MiB</td><td>4.096 cells, 10 layers</td></tr>
2020        <tr><td><strong>RS Buffer (Vulkan0)</strong></td><td>251,25 MiB</td><td>recorrente: 40 layers, 4 seqs</td></tr>
2021        <tr><td><strong>Compute Buffer (Vulkan0)</strong></td><td>770,02 MiB</td><td>Ativado durante grafos de computação</td></tr>
2022        <tr><td><strong>Host Compute Buffer</strong></td><td>16,02 MiB</td><td>RAM do sistema</td></tr>
2023        <tr><td><strong>Output Buffer (Vulkan_Host)</strong></td><td>3,79 MiB</td><td>Buffer de saída de tokens</td></tr>
2024      </tbody>
2025    </table>
2026  </div>
2027  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
2028    <strong>Total efetivo na VRAM durante inferência: ~6,2–7,2 GB</strong> (77–90% dos 8GB físicos livres).
2029  </p>
2030
2031  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.5 — Features habilitadas automaticamente</h4>
2032  <div class="cmd">
2033✅ Flash Attention (auto ➔ ENABLED)
2034✅ Fused Gated Delta Net — autoregressive
2035✅ Fused Gated Delta Net — chunked
2036✅ Prompt cache (limite: 8.192 MiB, ~89.715 MiB salvos em disco)
2037✅ Thinking mode (thinking = 1)
2038✅ 4 slots paralelos (n_seq_max = 4)
2039
2040Graph nodes: 3.729 | Graph splits: 106 (com bs=512), 74 (com bs=1)
2041Reserve: 137–183 ms</div>
2042
2043  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.6 — A Arquitetura de 4 Níveis de Memória</h3>
2044  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
2045    Primeiro registro documentado de um modelo 35B usando <strong>4 camadas de memória simultaneamente</strong> para processamento numa RX 580 comum:
2046  </p>
2047  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.8rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
2048    <div>⚡ <strong style="color:#ff9e64">
2048NÍVEL 1 — VRAM RX 580 (8GB GDDR5):</strong> 5.154 MiB de camadas densas | Acesso: ~400 GB/s (GDDR5) | Latência: nanosegundos</div>
2049    <div style="margin-top:0.5rem">🧠 <strong style="color:#7aa2f7">NÍVEL 2 — RAM DDR4 ECC (32GB Sytem):</strong> 26.784 MiB de experts MoE via mmap | Acesso: ~51 GB/s (quad-channel) | Latência: dezenas de ns</div>
2050    <div style="margin-top:0.5rem">💾 <strong style="color:#22c55e">NÍVEL 3 — SSD NVMe (Disco E:):</strong> 26,55 GiB de arquivo .gguf fonte | Acesso: 1,7–3,5 GB/s | Usado durante carregamento inicial</div>
2051    <div style="margin-top:0.5rem">📁 <strong style="color:#e0af68">NÍVEL 4 — HDD (Disco C: Swap):</strong> Swap do Windows ativado quando a RAM esgota (>97% de uso) | Acesso: ~120–180 MB/s | Pico de 98–100% de uso na inferência</div>
2052  </div>
2053
2054  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.7 — Configuração do Contexto Carregado</h3>
2055  <div class="cmd">
2056n_ctx         = 4.096 tokens (reduzido de 262.144 pelo fitting)
2057n_batch       = 2.048
2058n_ubatch      = 512
2059n_seq_max     = 4 (slots paralelos)
2060flash_attn    = auto ➔ ENABLED
2061kv_unified    = true</div>
2062  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
2063    <strong>Limitação crítica documentada:</strong> O contexto de 4.096 tokens é o principal gargalo do setup. O thinking mode (modo raciocínio) do Qwen3.5 consome 3.000+ tokens sozinho antes de gerar qualquer resposta visível — deixando menos de 1.000 tokens livres para a resposta final ao cliente.
2064  </p>
2065
2066  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.8 — Benchmark Confirmado em Duas Sessões</h3>
2067  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Velocidade de geração</h4>
2068  <div class="tbl">
2069    <table>
2070      <thead>
2071        <tr>
2072          <th>Sessão</th>
2073          <th>Horário aproximado</th>
2074          <th>Prompt Eval Speed</th>
2075          <th>Geração Speed</th>
2076          <th>Total Tokens</th>
2077          <th>Tempo Total</th>
2078        </tr>
2079      </thead>
2080      <tbody>
2081        <tr><td><strong>Sessão 1</strong></td><td>~17h39</td><td><strong>34,13 tok/s</strong></td><td><strong>5,57 tok/s</strong></td><td>1.377 tok</td><td>~107 segundos</td></tr>
2082        <tr><td><strong>Sessão 2</strong></td><td>~21h34</td><td>~40.00 tok/s</td><td><strong>5,64 tok/s</strong></td><td>2.929 tok</td><td>~533 segundos</td></tr>
2083      </tbody>
2084    </table>
2085  </div>
2086  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
2087    <strong>Consistência notável:</strong> Manutenção na linha de ~5,6 tokens/segundo de geração independente da sessão estar sobrecarregada ou fria.
2088  </p>
2089<h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Registro de temperaturas registradas</h4>
2090  <div class="tbl">
2091    <table>
2092      <thead>
2093        <tr>
2094          <th>Momento do Teste</th>
2095          <th>GPU Temp (°C)</th>
2096        </tr>
2097      </thead>
2098      <tbody>
2099        <tr><td>Idle (modelo estacionado na VRAM)</td><td>33–41°C</td></tr>
2100        <tr><td>Inferência normal (sem Web Search ativo)</td><td>44–64°C</td></tr>
2101        <tr><td>Inferência carregada (com Web Search ativo)</td><td>70–75°C</td></tr>
2102        <tr><td><strong>Pico absoluto registrado</strong></td><td><strong>80°C</strong></td></tr>
2103        <tr><td>Após conclusão de resposta</td><td>71–73°C</td></tr>
2104      </tbody>
2105    </table>
2106  </div>
2107  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
2108    <strong>Temperatura de thermal throttling da RX 580:</strong> ~90°C. <strong>Margem de segurança operacional perfeitamente mantida!</strong>
2109  </p>
2110
2111  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Utilização de recursos na inferência física</h4>
2112  <div class="tbl">
2113    <table>
2114      <thead>
2115        <tr>
2116          <th>Recurso de Hardware</th>
2117          <th>Idle</th>
2118          <th>Durante Inferência</th>
2119          <th>Pico Registrado</th>
2120        </tr>
2121      </thead>
2122      <tbody>
2123        <tr><td>VRAM dedicada</td><td>6,7 / 8,0 GB</td><td>6,8 – 7,2 / 8,0 GB</td><td>7,4 GB / 8,0 GB</td></tr>
2124        <tr><td>RAM do Sistema</td><td>~29,0 GB</td><td>30,7 – 31,1 GB</td><td>31,2 / 31,8 GB (98% utiliz.)</td></tr>
2125        <tr><td>CPU Xeon v3</td><td>3%</td><td>62 – 70%</td><td>70%</td></tr>
2126        <tr><td>GPU utilização 3D</td><td>0%</td><td>1 – 3%</td><td>3% (Carga no barramento PCIe)</td></tr>
2127        <tr><td>
2127HDD C: (Atividade swap)</td><td>0%</td><td>13 – 42%</td><td>98 – 100% (Limiar swap)</td></tr>
2128      </tbody>
2129    </table>
2130  </div>
2131
2132  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.9 — Os 5 Testes: Histórico Completo de Engenharia</h3>
2133  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
2134    <strong>Pergunta de entrada enviada em todos os testes:</strong><br>
2135    "Explique detalhadamente como funciona o mecanismo de atenção em transformers e por que o MoE é mais eficiente que modelos densos. Responda em português."
2136  </blockquote>
2137
2138  <div style="display:flex;flex-direction:column;gap:1rem;margin-bottom:1.5rem">
2139    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
2140      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 1 — Sessão 1 · Raciocínio ON + Web Search ON + Geração Imagem ON</h5>
2141      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
2142        <strong>Resultado:</strong> ❌ Erro de protocolo (reposta não entregue) | <strong>Log do erro:</strong> <code>operator (): got exception: {"error":"code":400,"message":"Assistant response prefill is incompatible with enable_thinking."}</code>
2143      </p>
2144      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
2145        <strong>Análise:</strong> O modelo processou um pensamento por ~1 minuto recuperando 10 fontes do SearXNG, mas o OpenWebUI injetou um prefill incorreto incompatível com a flag de pensamento do Jinja2, forçando o cancelamento.
2146      </p>
2147    </div>
2148
2149    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
2150      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 2 — Sessão 2 · Raciocínio ON + Web Search ON (30 pesquisas consecutivas)</h5>
2151      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
2152        <strong>Resultado:</strong> ❌ Contexto esgotado | <strong>Log do erro:</strong> <code>stop processing: n_tokens = 3285, truncated = 1</code>
2153      </p>
2154      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
2155        <strong>Análise:</strong> As 30 pesquisas do SearXNG injetaram milhares de tokens de contexto na memória. O thinking mode tentou alocar seu próprio buffer e estourou os 4.096 limitantes do setup híbrido, forçando corte prematuro.
2156      </p>
2157    </div>
2158
2159    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
2160      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 3 — Sessão 2 · Raciocínio ON + Web Search ON (25 pesquisas, nova rodada acumulada)</h5>
2161      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
2162        <strong>Resultado:</strong> ❌ Contexto esgotado | <strong>Log do erro:</strong> <code>stop processing: n_tokens = 4095, truncated = 1</code>
2163      </p>
2164      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
2165        <strong>Análise:</strong> O OpenWebUI tentou reenviar acumulando o histórico de conversação anterior. O prompt cresceu tanto que atingiu o teto exato delimitado de hardware de 4.095 tokens no Fitting.
2166      </p>
2167    </div>
2168
2169    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
2170      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 4 — Sessão 2 · Raciocínio ON + Web Search OFF</h5>
2171      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
2172        <strong>Resultado:</strong> ❌ Timeout do Cliente | <strong>Log do erro:</strong> <code>stop: cancel task, id_task = 6887 (truncated = 0)</code>
2173      </p>
2174      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
2175        <strong>Análise:</strong> Sem web-search o consumo térmico despencou para estáveis 51°C e uso de swap caiu. Mas o processamento de raciocínio interno demorou tempo suficiente na CPU Xeon de 2014 para que a UI disparasse seu timeout de segurança de chamadas.
2176      </p>
2177    </div>
2178
2179    <div style="border:1px solid rgba(34, 197, 94, 0.2);background:rgba(0, 3, 1, 0.6);border-radius:6px;padding:1rem">
2180      <h5 style="color:#22c55e;font-weight:bold;font-size:0.85rem">✅ TESTE 5 — Sessão 2 · Raciocínio ON + Web Search OFF + Prompt Curto (45 tokens)</h5>
2181      <p style="font-size:0.8rem;color:#c2ffd2;line-height:1.6;margin-top:0.25rem">
2182        <strong>Resultado:</strong> SUCESSO ABSOLUTO ✅ | Resposta técnica profunda entregue integralmente em português brasileiro estruturado.
2183      </p>
2184      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
2185        <strong>Análise:</strong> Ao restringir o prompt inicial para 45 tokens e desativar barulhos complementares, o pensamento pôde rodar por 4 minutos completos sob o Xeon, realizando rascunho de equações e respondendo impecavelmente sobre Transformers (Softmax, Multiheads) e as eficiências do MoE.
2186      </p>
2187    </div>
2188  </div>
2189
2190  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.10 — Tabela Comparativa de Comportamento dos Testes</h3>
2191  <div class="tbl">
2192    <table>
2193      <thead>
2194        <tr>
2195          <th>ID</th>
2196          <th>Thinking</th>
2197          <th>Web Search</th>
2198          <th>Promo Token</th>
2199          <th>Status</th>
2200          <th>Causa Raiz Real da Falha</th>
2201        </tr>
2202      </thead>
2203      <tbody>
2204        <tr><td>1</td><td>ON</td><td>ON (10 fontes)</td><td>~936 tok</td><td>❌ Falha</td><td>Prefill de resposta incompatível with thinking=1</td></tr>
2205        <tr><td>2</td><td>ON</td><td>ON (30 pesq.)</td><td>~357 tok</td><td>❌ Falha</td><td>Esgotamento de contexto do Fitting (4.095 max)</td></tr>
2206        <tr><td>3</td><td>ON</td><td>ON (25 pesq.)</td><td>~3.385 tok</td><td>❌ Falha</td><td>Esgotamento de contexto imediato no reenvio</td></tr>
2207        <tr><td>4</td><td>ON</td><td>OFF</td><td>~350 tok</td><td>❌ Falha</td><td>Timeout nas requisições da OpenWebUI antes do output</td></tr>
2208        <tr style="background:rgba(34, 197, 94, 0.05)"><td><strong>5</strong></td><td><strong>ON</strong></td><td><strong>OFF</strong></td><td><strong>45 tok</strong></td><td><strong>✅ SUCESSO</strong></td><td><strong>Prompt enxuto coube integralmente na arquitetura de mmap</strong></td></tr>
2209      </tbody>
2210    </table>
2211  </div>
2212<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
2213    <strong>Conclusão Crítica:</strong> A RX 580 do laboratório de 2017 e o Xeon funcionaram estavelmente sem dar nenhum reset físico em todas as situações de stress. As falhas residiram estritamente na calibração lógica do software de front-end.
2214  </p>
2215
2216  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.11 — Coletas de Descobertas e Limitações Cruciais</h3>
2217  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
2218    <li><strong style="color:#fff">Incompatibilidade do Thinking com Contexto Curto:</strong> Por design de modelo, o pensamento consome cerca de 3.000 tokens e estoura rapidamente o KV Cache alocado de 4.096 se o prompt ou histórico for longo.</li>
2219    <li><strong style="color:#fff">O Fitting Automático do llama.cpp é Excepcional:</strong> Forçar o split por flags experimentais rígidas como <code>--override-tensor</code> prejudica as chamadas no Vulkan. O fitting por cálculo de grafos resolveu milimetricamente a distribuição de forma otimizada.</li>
2220    <li><strong style="color:#fff">Superaquecimento da GPU mitigado:</strong> Apenas a renderização profunda com dezenas de filtros simultâneos elevou a 80°C. Limitar a GPU para inferir frações densas mantém o chip a confortáveis 44-64°C.</li>
2221    <li><strong style="color:#fff font-weight:bold">O gargalo reside na taxa de I/O de Swap do HDD:</strong> Quando RAM estoura a 98%, a taxa cai para 5 tok/s devido ao HDD. Migrar o swap do host inteiro para unidades de estado sólido aumentará consideravelmente a velocidade de fluxo comb
2221inada.</li>
2222  </ul>
2223
2224  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.12 — Comparação Direta com Projetos de Comunidade</h3>
2225  <div class="tbl">
2226    <table>
2227      <thead>
2228        <tr>
2229          <th>Projeto / Autor</th>
2230          <th>Arquitetura Utilizada</th>
2231          <th>Modelo Testado</th>
2232          <th>Velocidade Geração</th>
2233          <th>Status de Autoria</th>
2234        </tr>
2235      </thead>
2236      <tbody>
2237        <tr><td><strong>Matheus Fertunani</strong></td><td>Linux Comercial / CPU Xeon pura (192GB RAM)</td><td>Qwen3.5 35B Q8</td><td>~7–8 tokens/s</td><td>Documentado no YouTube</td></tr>
2238        <tr><td><strong>AIVisionsLab (Nossos testes)</strong></td><td>Vulkan Híbrido (RX 580 8GB + 32GB RAM ECC)</td><td>Qwen3.5 35B Q6_K</td><td><strong>5,64 tokens/s</strong></td><td>✅ Validado e Registrado</td></tr>
2239      </tbody>
2240    </table>
2241  </div>
2242  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
2243    <strong>A grande vantagem arquitetural:</strong> O teste de CPU pura de Matheus exige hardwares profissionais de alto custo com mais de 100GB de RAM instalada. O ecossistema de Vulkan do AIVisionsLab provou-se operável em uma GPU de menos de R$ 400 em mercado secundário!
2244  </p>
2245
2246  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.13 — Configurações Recomendadas para Testes Futuros</h3>
2247  <div class="cmd">
2248# Teste 6 — Desativação explícita de thinking via servidor em versões de compilação recentes:
2249.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
2249ort 8081 --no-thinking
2250
2251# Teste 7 — Elevação estrita de buffers de contexto se a memória for redirecionada:
2252.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-...-Q6_K.gguf" --host 0.0.0.0 --port 8081 --ctx-size 8192
2253
2254# Teste 8 — Testar com quantizações menores como Q4_K_M (~21GB):
2255# Liberação de ~5GB adicionais na RAM host que reduz a dependência de swap no HDD e melhora consideravelmente a taxa de tok/s!</div>
2256
2257  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.14 — Lições Técnicas Consolidadas</h3>
2258  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
2259    <li><strong style="color:#fff">O silício de 2017 não é o limite:</strong> A placa de vídeo nunca crashou nos testes contínuos de estresse térmico, dezenas de vezes. O gargalo se provou uma mera calibração lógica de software.</li>
2260    <li><strong style="color:#fff">As esparsidades do MoE salvam a categoria:</strong> Sem MoE, seria impensável arrastar um modelo de 26GB de pesos ativos. O MoE faz com que apenas 3.1% dos neurônios fiquem de fato excitados por token.</li>
2261  </ul>
2262
2263  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.15 — Veredicto Geral do Laboratório</h3>
2264  <div class="tbl">
2265    <table>
2266      <thead>
2267        <tr>
2268          <th>Questão de Engenharia</th>
2269          <th>Veredicto Final</th>
2270        </tr>
2271      </thead>
2272      <tbody>
2273        <tr><td><strong>A RX 580 de 8GB suporta modelos de 35B parâmetros?</strong></td><td>✅ <strong>Sim</strong> (Em barramento híbrido mmap)</td></tr>
2274        <tr><td><strong>É prático para o dia a dia?</strong></td><td>⚠️ <strong>Não</strong> (5,6 tok/s e contexto de 4.096 tokens)</td></tr>
2275        <tr><td><strong>Vale como prova de conceito?</strong></td><td>✅ <strong>Absolutamente</strong></td></tr>
2276        <tr><td><strong>Houve throttling ou crash?</strong></td><td>✅ <strong>Zero ocorrências de instabilidade</strong></td></tr>
2277        <tr><td><strong>Temperatura máxima registrada</strong></td><td><strong>80°C</strong> (margem de segurança: ~90°C)</td></tr>
2278        <tr><td><strong>Velocidade de geração</strong></td><td><strong>~5,6 tokens/segundo</strong></td></tr>
2279        <tr><td><strong>Memória total mobilizada</strong></td><td><strong>~34 GB</strong> (VRAM + RAM + swap HDD)</td></tr>
2280      </tbody>
2281    </table>
2282  </div>
2283
2284  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.16 — Linha do Tempo do Experimento</h3>
2285  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
2286    <div>🕒 <strong>~17:39</strong> — Servidor sobe na porta 8080 (erro)</div>
2287    <div>🕒 <strong>~17:40</strong> — "Network Problem" no OpenWebUI (porta errada)</div>
2288    <div>🕒 <strong>~17:41</strong> — Servidor fechou ao trocar porta → reiniciado na 8081</div>
2289    <div>🕒 <strong>~17:42</strong> — Todas as ferramentas habilitadas no modelo (imagem, web, terminal)</div>
2290    <div>🕒 <strong>~17:43</strong> — <strong>TESTE 1</strong> inicia</div>
2291    <div>🕒 <strong>~17:44</strong> — Web search: 10 fontes recuperadas</div>
2292    <div>🕒 <strong>~17:44</strong> — Tentativa de gerar imagem → erro tratado → continua</div>
2293    <div>🕒 <strong>~17:45</strong> — "Pensado por um minuto" aparece no OpenWebUI</div>
2294    <div>🕒 <strong>~17:46</strong> — Resposta estruturada com título gerado internamente</div>
2295    <div>🕒 <strong>~17:50</strong> — Erro de protocolo (prefill + thinking) → sem entrega. Pico: 80°C</div>
2296    <div>🕒 <strong>~21:34</strong> — Sessão 2 inicia</div>
2297    <div>🕒 <strong>~21:34</strong> — <strong>TESTE 2</strong> inicia — web search ON (30 pesquisas). Contexto truncado.</div>
2298    <div>🕒 <strong>~21:48</strong>
2298 — <strong>TESTE 3</strong> automático — 25 pesquisas. Contexto truncado.</div>
2299    <div>🕒 <strong>~22:00</strong> — <strong>TESTE 4</strong> — web search OFF. Temperatura cai para 51°C. Timeout da UI.</div>
2300    <div>🕒 <strong>~23:06</strong> — <strong>TESTE 5</strong> — prompt de 45 tokens. Thinking decodificado com sucesso.</div>
2301    <div>🕒 <strong>~23:14</strong> — Resposta completa entregue em português ✅. GPU: 64°C | RAM: 96%</div>
2302  </div>
2303
2304  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.17 — Impacto para a Documentação do AIVisionsLab</h3>
2305<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
2306    Este experimento adiciona ao projeto: um novo benchmark robusto de 5,6 tok/s para modelos 35B MoE híbridos, a confirmação de que o fitting automático do llama.cpp supera configurações manuais rígidas via Vulkan, a identificação clara de incompatibilidade do modo thinking com contextos inferiores a 8.192 e a descrição de uma arquitetura estendida a 4 níveis de memória.
2307  </p>
2308
2309  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.18 — Tags e Metadados</h3>
2310  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
2311    <div>🏷️ <strong>Tags:</strong> hybrid, moe, vulkan, rx580, large-model, thinking-mode, limits, qwen35b, benchmark, fitting-automático, 4-memory-levels, sem-throttling</div>
2312    <div style="margin-top:0.5rem">💻 <strong>Hardware:</strong> RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
2313    <div style="margin-top:0.25rem">💿 <strong>Software:</strong> llama.cpp b9049 + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
2314    <div style="margin-top:0.25rem">📅 <strong>Data:</strong> 15/06/2026</div>
2315    <div style="margin-top:0.25rem">⏱️ <strong>Sessões:</strong> 2 (17h39–18h24 e 21h34–23h14)</div>
2316    <div style="margin-top:0.25rem">📊 <strong>Testes:</strong> 5 (4 falhas de software, 1 sucesso de inferência completa)</div>
2317    <div style="margin-top:0.25rem">📈 <strong>Benchmark:</strong> 5,57–5,64 tok/s (geração) | 34,13 tok/s (prompt eval)</div>
2318    <div style="margin-top:0.25rem">🔥 <strong>Temperatura pico:</strong> 80°C</div>
2319    <div style="margin-top:0.25rem">🏆 <strong>Status final:</strong> ✅ HARDWARE APROVADO</div>
2320  </div>
2321
2322  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
2323    "O problema nunca foi o hardware.<br>
2324    Foi a combinação de thinking + web search esgotando os 4.096 tokens de contexto.<br>
2325    Com prompt curto e sem web search, o Qwen3.5-35B Q6_K responde normalmente numa RX 580 de 2017."<br>
2326    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 15/06/2026</span>
2327  </blockquote>
2328
2329  <div class="footer">
2330    Documentação gerada por Claude Sonnet 4.6 — 15/06/2026 · Baseada em logs reais, screenshots, benchmarks e observações em tempo real · Sessão 1: ~17h39–18h24 | Sessão 2: ~21h34–23h14 · 5 testes documentados · 1 bem-sucedido · Hardware de 2017 processando IA de 2025
2331  </div>
2332</div>`},linhatempo:{id:"linhatempo",title:"37. LINHA DO TEMPO COLETIVA — A EVOLUÇÃO DO RX 580 COMO PLATAFORMA DE IA",desc:"Análise histórica e comparativa unificada documentando a quebra de barreiras e obsolescência da RX 580 em três etapas revolucionárias (2025-2026).",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:25,tags:["evolucion-historica","rx580-timeline","comunidade-hacker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["meta"],previous:"meta",next:"audio_rvc",related:["jornada","comunidade"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O resgate técnico e a ascensão da AMD Radeon RX 580 como uma plataforma de inteligência artificial prática não é fruto de uma única mente, mas sim de uma <strong>evolução coletiva ascendente</strong>. Três projetos independentes, construídos sobre a base matemática comum do ecossistema <code>ggml</code>, pavimentaram esta jornada:</p>
2333
2334  <!-- Linha do Tempo Visual -->
2335  <div style="position:relative;margin:2rem 0;padding-left:1.5rem;border-left:2px solid var(--b)">
2336    <div style="margin-bottom:1.5rem;position:relative">
2337      <div style="position:absolute;
2337left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:var(--r);border:2px solid #07080a"></div>
2338      <span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:var(--r);font-weight:bold">JANEIRO DE 2025</span>
2339      <h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">Método Amihart (Debian Linux)</h5>
2340      <p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Primeiro marco documentado. Validou LLMs acelerados por Vulkan no <code>llama.cpp</code> obtendo 24.56 t/s. No entanto, declarou: <em>"Vulkan não funciona para Stable Diffusion"</em>, devido às limitações do software na época, recorrendo ao ROCm via Docker.</p>
2341    </div>
2342    <div style="margin-bottom:1.5rem;position:relative">
2343      <div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#eab308;border:2px solid #07080a"></div>
2344      <span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#eab308;font-weight:bold">DEZEMBRO DE 2025</span>
2345      <h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">Método DadHacks (Linux/Debian)</h5>
2346      <p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Refutou empiricamente a impossibilidade de Stable Diffusion via Vulkan. Utilizou o recém-lançado motor <code>stable-diffusion.cpp</code> com a flag compiladora <code>-DSD_VULKAN=ON</code> para rodar geração GGUF do Flux Schnell com segmentação CPU/GPU.</p>
2347    </div>
2348    <div style="position:relative">
2349      <div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#22c55e;border:2px solid #07080a"></div>
2350      <span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#22c55e;font-weight:bold">TEMPORADA 2026</span>
2351      <h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">AIVisionsLab (Windows Nativo + WSL2)</h5>
2352      <p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Unificação do ecossistema de produção. Desenvolveu automação nativa via <code>.bat</code>, integrou renderização Vulkan local a painéis amigáveis (OpenWebUI via Docker), documentou os fallbacks para CPU Xeon em modelos SOTA e mapeou de forma exaustiva os motivos de falhas do DirectML/ROCm no Windows.</p>
2353    </div>
2354  </div>
2355
2356  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:2rem 0 .75rem 0;text-transform:uppercase">A. A Pergunta que Cada Projeto Respondeu</h4>
2357  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">A evolução da maturidade técnica da RX 580 pode ser traduzida pelas premissas respondidas pelos autores:</p>
2358  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
2359    <li><strong style="color:#fff">Amihart (Jan 2025):</strong> <em>"É possível rodar LLMs de forma rápida na RX 580 sem ROCm oficial?"</em> <strong style="color:var(--r)">Sim</strong>, compilando o llama.cpp com Vulkan API puro.</li>
2360    <li><strong style="color:#fff">DadHacks (Dez 2025):</strong> <em>"É possível gerar imagens via IA aceleradas por Vulkan na RX 580?"</em> <strong style="color:var(--r)">Sim</strong>, compilando stable-diffusion.cpp e utilizando o formato alternativo estável GGUF.</li>
2361    <li><strong style="color:#fff">AIVisionsLab (2026):</strong> <em>"É possível colocar toda essa infraestrutura em produção integrada e amigável no Windows?"</em> <strong style="color:var(--r)">Sim</strong>, construindo pontes de rede de contêineres Docker, automações unificadas e fallbacks inteligentes de CPU para excedentes de VRAM.</li>
2362  </ul>
2363
2364  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. Tabela Mestre Comparativa Unificada</h4>
2365  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">Mapeamento estruturado cruzado das capacidades e conquistas cumulativas:</p>
2366  <div class="tbl" style="margin-bottom:1.5rem">
2367    <table>
2368      <thead>
2369        <tr>
2370          <th>Capacidade</th>
2371          <th>Amihart (2025)</th>
2372          <th>DadHacks (2025)</th>
2373          <th>AIVisionsLab (2026)</th>
2374        </tr>
2375      </thead>
2376      <tbody>
2377        <tr><td><strong>Sistema Base</strong></td><td>Debian Linux</td><td>Linux Debian</td><td>Windows 10 Pro + WSL2 Linux</td></tr>
2378        <tr><td><strong>Motor de LLM</strong></td><td>✅ Vulkan (24.56 t/s)</td><td>✅ Vulkan (llama.cpp)</td><td>✅ Vulkan (15-16 t/s)</td></tr>
2379        <tr><td><strong>Motor SD</strong></td><td>❌ Não viável em Vulkan</td><td>✅ Vulkan puro</td><td>✅ Vulkan puro (~72s SD1.5)</td></tr>
2380        <tr><td><strong>Flux GGUF</strong></td><td>❌ Inexistente</td><td>✅ Linha de comando</td><td>✅ Híbrido GPU/CPU Estável</td></tr>
2381        <tr><td><strong>Interface Gráfica</strong></td><td>
2381❌ Apenas Console / WebUI Docker</td><td>❌ Apenas CLI</td><td>✅ OpenWebUI + API integrada</td></tr>
2382        <tr><td><strong>Automação</strong></td><td>❌ Não desenvolvido</td><td>❌ Não desenvolvido</td><td>✅ Scripts .bat double-click</td></tr>
2383        <tr><td><strong>Estabilidade VRAM</strong></td><td>❌ Limitação física ROCm</td><td>⚠️ Manual CLI</td><td>✅ VAE Tiling integrado</td></tr>
2384        <tr><td><strong>Modelos &gt; 8GB</strong></td><td>❌ OOM crônicos</td><td>⚠️ CPU offload básico</td><td>✅ Quad-Channel REG ECC fallbacks</td></tr>
2385        <tr><td><strong>Animação Video</strong></td><td>❌ Não abordado</td><td>❌ Não abordado</td><td>✅ AnimateDiff WSL2 CPU Xeon</td></tr>
2386        <tr><td><strong>Detecção GGUF</strong></td><td>❌ Não abordado</td><td>❌ Não abordado</td><td>✅ Mapeamento leejet vs city96</td></tr>
2387      </tbody>
2388    </table>
2389  </div>
2390
2391  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">C. O Denominador Técnico Comum — Engine GGML</h4>
2392  <p style="font-size:.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">A tecnologia central de compressão e execução que viabilizou o aproveitamento de GPUs legacy foi o ecossistema desenvolvido por Georgi Gerganov (<strong>ggml / llama.cpp / stable-diffusion.cpp</strong>). Ao portar as operações tensoriais diretamente para a linguagem C/C++ e expor ganchos nativos à biblioteca gráfica aberta do <strong>Vulkan API</strong>, esta implementação permite que placas sem pacotes modernos de driver proprietário realizem cálculos massivos nativos (contornando drivers de vendor restritivos).</p>
2393 
2394   <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">D. Filosofia Convergente</h4>
2395   <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Manifestações diretas que eternizam o propósito livre destes pesquisadores:</p>
2396   <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem">
2397     <strong>Amihart:</strong> "Apesar de quão antiga é esta GPU, é tecnicamente possível utilizá-la para IA se adaptarmos o fluxo de execução... otimização de baixo nível é a chave para o reaproveitamento de hardware legado."
2398   </blockquote>
2399   <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem">
2400     <strong>DadHacks:</strong> "Esse setup fornece uma ponte viável de aproveitamento técnico dos investimentos existentes em hardware sem exigir upgrades caros ou dependência de pacotes de software inchados."
2401   </blockquote>
2402   <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
2403     <strong>AIVisionsLab:</strong> "A degradação por obsolescência de drivers e ecossistemas fechados é um fator comercial e não uma limitação material da placa. O hardware legado mantém sua utilidade operacional mediante suporte de software aberto."
2404   </blockquote>
2405 
2406   <div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem">
2407     <strong style="color:var(--r)">Crédito de Co-autoria e Referência:</strong> Linha do tempo técnica dedicada ao esforço experimental cumulativo de <strong>Amihart</strong>, <strong>DH (DadHacks)</strong>, <strong>leejet</strong>, <strong>ggerganov</strong>, <strong>woodrex</strong> e a todos os desenvolvedores independentes focados em reaproveitamento digital e preservação de hardware.
2408       </div>`},linux_nativo:{id:"linux_nativo",title:"43. LINUX NATIVO — Ubuntu 26.04 LTS + RX 580 + Vulkan",desc:"AIVisionsLab — Documentação da Stack Completa em Linux Real",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"sistema-operacional",difficulty:"advanced",estimated_time_min:40,tags:["ubuntu-native","linux-vulkan","low-level-compilation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_whisper"],previous:"audio_whisper",next:"audio_srt_ptbr",related:["comfyui-wsl","amihart"]},part:1},html:`<div class="card bg-red-950/20 border border-red-500/30 p-5 rounded-md my-6">
2409  <h4 style="color:#ef4444;font-weight:800;font-size:0.95rem;margin-bottom:0.6rem;display:flex;items-center;gap:0.4rem">
2410    🚨 INCIDENT REPORT (16/06/2026): O GRANDE DESASTRE DE ESPAÇO E A QUEDA DO GNOME
2411  </h4>
2412  <p style="font-size:0.82rem;color:#fca5a5;line-height:1.75;margin-bottom:0.75rem">
2413    <strong>Status Crítico:</strong> Durante os testes de pipelines extremos e download massivo de modelos GGUF pesados na partição dedicada de 97GB, o espaço físico foi totalmente exaurido (0 bytes livres no swap/root). Em uma tentativa rápida de liberação de cache e limpeza forçada via terminal, dependências críticas do ambiente gráfico foram corrompidas.
2414  </p>
2415  <ul style="padding-left:1.2rem;font-size:.8rem;color:#fbcfe8;line-height:1.8;margin-bottom:1rem">
2416    <li><strong>Sintoma:</strong> O gerenciador de Janelas <strong>GNOME</strong> quebrou por completo, resultando em loops de login e tela preta terminal sem carregamento de interface de vídeo.</li>
2417    <li><strong>Ação de Recuperação:</strong> Formatação física e reinstalação imediata do sistema Linux Bare-Metal do zero para reconstrução limpa e redimensionamento adequado de partições.</li>
2418    <li><strong>O Veredicto Existencial:</strong> <em>"Definitivamente preciso aprender Linux!"</em> — A jornada do AIVisionsLab prova que dominar o terminal e a alocação de espaço sob LVM é tão crucial quanto conhecer os shaders de backend do Vulkan.</li>
2419  </ul>
2420</div>
2421
2422<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
2423  Documentação detalhada e homologada de execução direta em Linux nativo. Sem WSL2, sem emulação de contêiner ou Docker Passthrough: acesso bare-metal real através de drivers open-source <strong>Mesa RADV</strong> sobre o novíssimo <strong>Ubuntu 26.04 LTS (Resolute Raccoon)</strong> rodando o kernel Linux 7.0.
2424</p>
2425
2426<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:.85rem;margin-bottom:1.25rem">
2427  <div class="stat"><div class="stat-icon">🐧</div><div><div class="stat-lbl">Plataforma Linux</div><div class="stat-val" style="font-size:.82rem">Ubuntu 26.04 LTS</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Kernel 7.0 (Resolute)</div></div></div>
2428  <div class="stat"><div class="stat-icon">🎛️</div><div><div class="stat-lbl">Vulkan Driver</div><div class="stat-val" style="font-size:.82rem">Mesa RADV 26.0.3</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Vulkan Core version 1.4.341</div></div></div>
2429  <div class="stat"><div class="stat-icon">💽</div><div><div class="stat-lbl">Particionamento</div><div class="stat-val" style="font-size:.82rem">Ext4 dedidada 97GB</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">HDD sdb6 Dual Boot</div></div></div>
2430  <div class="stat"><div class="stat-icon">📦</div><div><div class="stat-lbl">
2430Docker Runtime</div><div class="stat-val" style="font-size:.82rem">Nativo Linux Engine</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Pontes OpenWebUI a 100%</div></div></div>
2431</div>
2432
2433<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Tabela Comparativa Bruta: Windows 10 vs Linux Nativo</h3>
2434<div class="tbl">
2435  <table>
2436    <thead>
2437      <tr>
2438        <th>Cenário / Carga de Trabalho</th>
2439        <th>Windows 10 (AMD oficial)</th>
2440        <th>Linux Ubuntu 26.04 (Mesa RADV)</th>
2441        <th>Vencedor Crucial</th>
2442      </tr>
2443    </thead>
2444    <tbody>
2445      <tr>
2446        <td><strong>LLM (Qwen3 4B GGUF) @ 99 layers</strong></td>
2447        <td>~15-17 tokens/s</td>
2448        <td><strong>~35 tokens/s (RADV engine)</strong></td>
2449        <td>🏆 <strong>Linux (2x mais veloz)</strong></td>
2450      </tr>
2451      <tr>
2452        <td><strong>LLM Grande (Qwen3.6 35B) @ Max layers</strong></td>
2453        <td><strong>7.62 tokens/s (max 10 layers)</strong></td>
2454        <td>5.18 tokens/s (max 20 layers)</td>
2455        <td>⚖️ <strong>Empate Técnico</strong> (Linux permite 2x mais layers, Windows é mais rápido por layer)</td>
2456      </tr>
2457      <tr>
2458        <td><strong>Stable Diffusion (Dreamshaper8 - 50st)</strong></td>
2459        <td><strong>~72 segundos (1.44s/it)</strong></td>
2460        <td>~85 segundos (1.65s/it)</td>
2461        <td>🏆 <strong>Windows (estável por driver)</strong></td>
2462      </tr>
2463      <tr>
2464        <td><strong>Flux Schnell (4 steps, 512x512)</strong></td>
2465        <td>~84 segundos (OOM se 1024x1024)</td>
2466        <td><strong>~52 segundos sampling (Total: 95s)</strong></td>
2467        <td>🏆 <strong>Linux (melhor swap VRAM)</strong></td>
2468      </tr>
2469      <tr>
2470        <td><strong>whisper.cpp (large-v3-turbo, áudio 106s)</strong></td>
2471        <td>307 s (Uso de VRAM: 2.6 GB)</td>
2472        <td><strong>23.58 s (Uso de VRAM: 1.6 GB)</strong></td>
2473        <td>🏆 <strong>Linux (Absurdamente superior)</strong></td>
2474      </tr>
2475    </tbody>
2476  </table>
2477</div>
2478
2479<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Instalação e Dual-Boot sem Sobrescrever Registros</h3>
2480<p style="font-size:.82rem;color:#94a3b8;line-height:1.75">
2481  1. No Windows, libere espaço usando o Gerenciador de Discos (Diminuir Volume).<br>
2482  2. Prepare o pendrive com a ISO desktop do <strong>Ubuntu 26.04 amd64</strong>.<br>
2483  3. No instalador do Ubuntu, selecione a opção "Instalar ao lado do Windows Boot Manager". O instalador criará a partição e configurará o menu GRUB para permitir a seleção de boot em cada reinicialização automaticamente.
2484</p>
2485
2486<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Pós-Instalação: Validação Bare-Metal da GPU Polaris</h3>
2487<div class="code">
2488  <span class="code-lang">bash</span>
2489  <pre>lspci | grep -i vga
2490# AMD Radeon RX 580 2048SP detectada!
2491
2492vulkaninfo --summary 2>/dev/null | grep -A5 "Devices"
2493# Deve exibir: GPU0: DRIVER_ID_MESA_RADV | driverInfo = Mesa 26.0.3 ✅</pre>
2494</div>
2495
2496<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Pilha de Comandos de Execução Homologados no Ubuntu</h3>
2497
2498<h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">1. Inicializando llama-server via Vulkan</h4>
2499<div class="code">
2500  <span class="code-lang">bash</span>
2501  <pre>~/llama.cpp/build/bin/llama-server \\
2502  -m "/run/media/aivisions-lab-studio/NVMe/models/qwen3/Qwen3-4B-Q4_K_M.gguf" \\
2503  --host 0.0.0.0 --port 8081 \\
2504  -ngl 99 -t 24</pre>
2505</div>
2506
2507<h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">2. Geração de Imagens (Flux Schnell) — Segredos Contra Travamento do GNOME</h4>
2508<div class="code">
2509  <span class="code-lang">bash</span>
2510  <pre>~/stable-diffusion.cpp/build/bin/sd-server \\
2511  --listen-ip 0.0.0.0 --listen-port 7860 \\
2512  --diffusion-model /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/flux1-schnell-q4_k.gguf \\
2513  --vae /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/ae.safetensors \\
2514  --clip_l /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/clip_l.safetensors \\
2515  --t5xxl /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/t5xxl_fp16.safetensors \\
2516  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre>
2517</div>
2518<p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-top:.35rem">
2519  💡 <strong>Flags Críticas:</strong> O parâmetro <code>--vae-tiling</code> é estritamente obrigatório. Sem ele, a decodificação do VAE estoura o limite de memória física e trava o ambiente gráfico GNOME. Evite usar <code>--backend vulkan0</code> para este modelo pesado no Linux, pois gera bugs de contexto perdidos.
2520</p>
2521
2522<h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">3. Transcrição Rápida de Áudio via whisper.cpp</h4>
2523<div class="code">
2524  <span class="code-lang">bash</span>
2525  <pre>~/whisper.cpp/build/bin/whisper-cli \\
2526  -m ~/whisper.cpp/models/ggml-large-v3-turbo.bin \\
2527  -f "/caminho/para/audio.wav" \\
2528  -l pt --output-txt</pre>
2529</div>
2530
2531<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Serviços e Contêineres Docker Rodando Paralelos</h3>
2532<div class="tbl">
2533  <table>
2534    <thead>
2535      <tr>
2536        <th>Contêiner ativo</th>
2537        <th>Imagem Base</th>
2538        <th>Porta Mapeada</th>
2539        <th>Finalidade</th>
2540      </tr>
2541    </thead>
2542    <tbody>
2543      <tr>
2544        <td><strong>open-webui</strong></td>
2545        <td>ghcr.io/open-webui/open-webui:main</td>
2546        <td>3000 -> 8080</td>
2547        <td>Painel unificado de Chat com LLM e render SD</td>
2548      </tr>
2549      <tr>
2550        <td><strong>portainer</strong></td>
2551        <td>portainer/portainer-ce</td>
2552        <td>9000</td>
2553        <td>Gerenciamento visual de processos e pilhas Docker</td>
2554      </tr>
2555      <tr>
2556        <td><strong>searxng</strong></td>
2557        <td>searxng/searxng:latest</td>
2558        <td>8080</td>
2559        <td>Mecanismo de busca privado para as respostas ancoradas de IA</td>
2560      </tr>
2561    </tbody>
2562  </table>
2563</div>
2564
2565<div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4">
2566  <h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Lições Autônomas Aprendidas em Linux</h4>
2567  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7">
2568    <strong>ROCm Abandonado:</strong> Placas GCN4 / Polaris como a RX 580 não têm mais suporte no SDK ROCm oficial. Tentar rodar Ollama oficial via GPU Docker nela falhará. A rota de ouro é rodar o <strong>Ollama na CPU Xeon</strong> ou usar o <strong>llama-server nativo compilado com Vulkan</strong>! Docker só deve ser empregado para frontends e servidores secundários livres.
2569  </p>
2570</div>`},llama:{id:"llama",title:"07. COMPILAÇÃO DO LLAMA.CPP (BACKEND VULKAN)",desc:"Passo a passo com os comandos mestre para gerar os binários otimizados de LLM para a RX 580.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["llamacpp","vulkan-acceleration","compilacao-cpp"],last_reviewed:"2026-07-01",relationships:{prerequisites:["jornada"],previous:"jornada",next:"sdcpp",related:["modelos","limit_qwen_35b"]}},html:`<div class="note">⚠ Certifique-se de executar os comandos abaixo exclusivamente dentro do <strong>Developer PowerShell do Visual Studio</strong></div>
2571  <div class="code"><pre># Navegar para a partição de alta velocidade e clonar o repositório oficial
2572cd E:\\
2573git clone https://github.com/ggerganov/llama.cpp
2574cd llama.cpp
2575
2576# Instanciar o diretório de build injetando a flag compiladora do backend Vulkan
2577cmake -B build -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
2578
2579# Disparar a compilação utilizando 20 threads paralelas do processador Xeon
2580cmake --build build --config Release -j20</pre></div>
2581  <h4 class="s" style="margin-top:1rem;margin-bottom:.5rem;color:#fff">Comando de Validação do Dispositivo de Aceleração</h4>
2582  <div class="code"><pre>cd build\\bin\\Release
2583.\\llama-cli.exe --list-devices
2584# Retorno esperado do console: Vulkan0: AMD Radeon RX 580 2048SP ✅</pre></div>`},meta:{id:"meta",title:"36. REFERÊNCIAS E METADADOS DO DOCUMENTO",desc:"Análise técnica do ciclo de vida físico do hardware legado e filosofia de reaproveitamento do laboratório.",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"metadados",difficulty:"beginner",estimated_time_min:10,tags:["silicon-governance","metadata-specs","efficie
2584ncy-telemetry"],last_reviewed:"2026-07-01",relationships:{prerequisites:["arquivos"],previous:"arquivos",next:"linhatempo",related:["arquivos","proximos"]}},html:`<blockquote style="font-size:.9rem;color:#94a3b8;font-style:italic;line-height:1.9;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">
2585    "A obsolescência programada comercial é uma escolha de mercado, não uma barreira de engenharia. O hardware de herança não morre; ele é libertado pelo software correto."
2586  </blockquote>
2587  <div class="tbl" style="margin-top:.9rem"><table>
2588    <thead><tr><th>Metadado do Sistema</th><th>Registro de Auditoria</th></tr></thead>
2589    <tbody>
2590      <tr><td>Versão do Deploy</td><td>VULKAN_DEPLOY_V3.0_COMPLETO</td></tr>
2591      <tr><td>Ano do Registro</td><td>Histórico Consolidado // Temporada 2026</td></tr>
2592      <tr><td>Escopo de Autoria</td><td>Arquitetura de Sistemas Black Tuxedo AI Solutions</td></tr>
2593    </tbody>
2594  </table></div>`},modelos:{id:"modelos",title:"09. CONVERSÃO DE MODELOS PARA FORMATO GGUF",desc:"Otimização e quantização de arquivos .safetensors padrão para o formato aceito pela engine ggml.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"quantizacao",difficulty:"intermediate",estimated_time_min:15,tags:["gguf","quantizacao-modelos","vram-8gb"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdcpp"],previous:"sdcpp",next:"sdserver",related:["llama","comfyui-modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.9rem">Os runtimes otimizados em C++ do <code>stable-diffusion.cpp</code> exigem o formato de arquivo estruturado em <code style="color:var(--r)">.gguf</code>. Modelos tradicionais baixados do Civitai (.safetensors) precisam passar pelo conversor nativo:</p>
2595  <div class="code"><pre># Comando para conversão direta e aplicação de quantização estável em 8-bits (q8_0)
2596.\\sd-cli.exe -M convert -m "E:\\models\\DreamShaper_8.safetensors" -o "E:\\models\\dreamshaper8.gguf" --type q8_0</pre></div>
2597  <div class="code ok" style="margin-top:.75rem"><pre># Log de encerramento do processo:
2598[INFO] convert 'DreamShaper_8.safetensors' to 'dreamshaper8.gguf' success ✅</pre></div>`},prereqs:{id:"prereqs",title:"05. PRÉ-REQUISITOS DO SISTEMA",desc:"Ferramental necessário para compilar os binários abertos e subir os servidores locais.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"dependencias",difficulty:"intermediate",estimated_time_min:20,tags:["cmake","git","msvc-compiler","gcc","vulkan-sdk"],last_reviewed:"2026-07-01",relationships:{prerequisites:["solucao"],previous:"solucao",next:"jornada",related:["llama","sdcpp"]}},html:`<div class="c2">
2599    <div class="card"><p style="font-size:.58rem;color:var(--r);text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">⚠ AMBIENTE DE COMPILAÇÃO (GPU)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">Developer PowerShell do VS</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">Abre através do Menu Iniciar → "Developer PowerShell for VS 2022"</p></div>
2600    <div class="card"><p style="font-size:.58rem;color:#22c55e;text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">✅ AMBIENTE DE EXECUÇÃO (RUNTIME)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">PowerShell Padrão do Windows</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">Executa os binários finais compilados sem overhead do ecossistema dev</p></div>
2601  </div>
2602  <div class="tbl" style="margin-top:1rem"><table>
2603    <thead><tr><th>Software / SDK</th><th>Versão Homologada</th><th>Notas de Configuração Essenciais</th></tr></thead>
2604    <tbody>
2605      <tr><td>Visual Studio Community</td><td>2022 ou 2026</td><td>Obrigatório marcar a carga de trabalho: "Desenvolvimento para desktop com C++"</td></tr>
2606      <tr><td>CMake Compiler</td><td>v4.3.2+</td><td>Disponível em cmake.org. Lembrar de marcar: "Add CMake to system PATH"</td></tr>
2607      <tr><td>Vulkan SDK</td><td>v1.4.341.1</td><td>Baixar via LunarG. Instalação padrão obrigatoriamente em <code>C:\\VulkanSDK\\</code></td></tr>
2608      <tr><td>Git Windows</td><td>Última estável</td><td>Instalador oficial para clonagem dos repositórios open-source</td></tr>
2609      <tr><td>Docker Desktop</td><td>v4.x+</td><td>Necessário para rodar o ecossistema OpenWebUI e pipelines auxiliares como SearXNG</td></tr>
2610      <tr><td>WSL2 Subsystem</td><td>Ubuntu 22.04.5 LTS</td><td>Base de execução estável para o ambiente Python do ComfyUI e Ollama</td></tr>
2611      <tr><td>Miniconda Linux</td><td>Branch Python 3.11</td><td>Gerenciador isolado de pacotes rodando dentro do subsistema Linux WSL2</td></tr>
2612    </tbody>
2613  </table></div>
2614  <div class="code"><pre># Comandos de validação do ambiente de compilação
2615cmake --version
2616# Retorno esperado: cmake version 4.3.2 ✅
2617
2618dir C:\\VulkanSDK
2619# Retorno esperado: exibição do diretório da versão 1.4.341.1 ✅</pre></div>`},proving_hypothesis_35b:{id:"proving_hypothesis_35b",title:"42. PROVANDO A HIPÓTESE: CURL, CTX-SIZE 8192 E A PRIMEIRA RESPOSTA COMPLETA",desc:"Continuação direta da Seção 33 · 3 testes · Hipótese confirmada · Hardware de 2017",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:35,tags:["context-length","offloading-layer","matematica-tensores"],last_reviewed:"2026-07-01",relationships:{prerequisites:["limit_qwen_35b"],previous:"limit_qwen_35b",next:"sdxl_vulkan",related:["limit_qwen_35b","cpu"]},part:1}
2619,html:`<div class="whisper-doc">
2620  <div class="hero">
2621    <div class="hero-title"><span>Provando a Hipótese</span> — Qwen3.5 35B</div>
2622    <div class="hero-sub">Experimentos conclusivos validando preenchimento de contexto, timeouts de cliente e comparação Q4_K_M vs Q6_K no silício de 2017.</div>
2623    <div class="hero-badges">
2624      <span class="badge badge-gpu">AMD RX 580 8GB</span>
2625      <span class="badge badge-win">Xeon E5-2690 v3</span>
2626      <span class="badge badge-ok">Hipótese Provada</span>
2627      <span class="badge badge-ok">--ctx-size 8192</span>
2628      <span class="badge badge-win">Q4_K_M vs Q6_K</span>
2629    </div>
2630  </div>
2631
2632  <div class="stat-grid">
2633    <div class="stat">
2634      <div class="stat-label">Velocidade (Q4_K_M)</div>
2635      <div class="stat-value">6.42 - 6.65 tok/s</div>
2636      <div class="stat-sub">Sem Swap Ativo</div>
2637    </div>
2638    <div class="stat">
2639      <div class="stat-label">Contexto Provado</div>
2640      <div class="stat-value">8.192 tokens</div>
2641      <div class="stat-sub">Acomoda modo de Raciocínio</div>
2642    </div>
2643    <div class="stat">
2644      <div class="stat-label">Temperatura Máxima</div>
2645      <div class="stat-value">74°C</div>
2646      <div class="stat-sub">10°C mais frio com Q4_K_M</div>
2647    </div>
2648    <div class="stat">
2649      <div class="stat-label">Status do Hardware</div>
2650      <div class="stat-value">100% Aprovado</div>
2651      <div class="stat-sub">Zero crashes / 4 slots paralelos</div>
2652    </div>
2653  </div>
2654
2655  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.0 — Contexto e Motivação</h3>
2656  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
2657    A Seção 33 terminou com uma hipótese clara: <em>"O problema nunca foi o hardware. Foi a combinação de thinking + web search esgotando os 4.096 tokens de contexto. Com prompt curto e sem web search, o Qwen3.5-35B Q6_K responde normalmente numa RX 580 de 2017."</em>
2658  </p>
2659  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
2660    Em 16 de junho de 2026, o AIVisionsLab executou os testes pendentes sugeridos para provar essa hipótese ao vivo, avaliando o comportamento com curl direto (sem timeout do cliente), habilitando a flag de tamanho de contexto ampliado e testando quantizações mais eficientes.
2661  </blockquote>
2662
2663  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.1 — Hardware do Laboratório</h3>
2664  <div class="tbl">
2665    <table>
2666      <thead>
2667        <tr>
2668          <th>Componente</th>
2669          <th>Especificação</th>
2670        </tr>
2671      </thead>
2672      <tbody>
2673        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 cores / 24 threads · 3,05 GHz turbo (Lançado em 2014)</td></tr>
2674        <tr><td><strong>RAM</strong></td><td>31,8 GB DDR4 REG ECC (quad-channel)</td></tr>
2675        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (Lançado em 2017)</td></tr>
2676        <tr><td><strong>Storage NVMe</strong></td><td>SSD NVMe (Disco E:) — modelos GGUF (Leitura de 1.7–3.5 GB/s)</td></tr>
2677        <tr><td><strong>Storage HDD</strong></td><td>HDD (Disco C: / F:) — sistema Windows + swap</td></tr>
2678        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — lançado em 20/05/2026</td></tr>
2679        <tr><td><strong>Sistema</strong></td><td>Windows 10 Pro com WSL2 activo</td></tr>
2680      </tbody>
2681    </table>
2682  </div>
2683
2684  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.2 — Modelos Testados</h3>
2685  <div class="tbl">
2686    <table>
2687      <thead>
2688        <tr>
2689          <th>Modelo</th>
2690          <th>Quantização</th>
2691          <th>Tamanho do Arquivo</th>
2692          <th>Parâmetros da Arquitetura</th>
2693        </tr>
2694      </thead>
2695      <tbody>
2696        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q6_K</strong></td><td>6 bits</td><td>28,51 GB</td><td>34,66B (MoE)</td></tr>
2697        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M</strong></td><td>4 bits (Medium)</td><td><strong>21,17 GB</strong></td><td>34,66B (MoE)</td></tr>
2698        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q5_K_M</strong></td><td>5 bits (Medium)</td><td>24,76 GB</td><td>34,66B (MoE)</td></tr>
2699      </tbody>
2700    </table>
2701  </div>
2702  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
2703    *Nota: Todos os modelos possuem arquitetura idêntica de Mixture of Experts (MoE), variando apenas a compressão matemática de seus pesos.
2704  </p>
2705
2706  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.3 — Localizando os Executáveis</h3>
2707  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
2708    Antes de testar, foi necessário localizar as compilações otimizadas do <code>llama-server</code>. No PowerShell do laboratório:
2709  </p>
2710  <div class="cmd">Get-ChildItem -Path E:\\ -Recurse -Filter "llama-server.exe" -ErrorAction SilentlyContinue
2711 
2712# Resultado:
2713E:\\llama.cpp\\llama-server.exe (stub de 9KB)
2714E:\\llama.cpp\\build\\bin\\Release\\llama-server.exe (Executável real de 7.5MB) ◀</div>
2715
2716  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.4 — Teste 9: Curl Direto Sem Timeout</h3>
2717  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.1 — Motivação</h4>
2718  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
2719    Identificar se o gargalo de timeout relatado no Teste 4 residia no servidor ou estritamente nas requisições AJAX do cliente OpenWebUI.
2720  </p>
2721
2722  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.2 — Inicialização do Servidor</h4>
2723  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
2724.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --port 8081</div>
2725
2726  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.3 — Resolvendo Escaping de JSON no PowerShell</h4>
2727  <div class="cmd">'{"model":"any","messages":[{"role":"user","content":"Explique MoE em 3 paragrafos"}]}' | Out-File -Encoding utf8 -FilePath "E:\\teste.json"</div>
2728
2729  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.4 — Executando a Chamada de Longa Duração</h4>
2730  <div class="cmd">curl.exe -X POST http://localhost:8081/v1/chat/completions -H "Content-Type: application/json" --max-time 600 -d "@E:\\teste.json"</div>
2731
2732  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.5 — Resultado Analítico</h4>
2733  <div class="cmd">truncated = 0  ◀ RESPOSTA COMPLETA ENTREGUE COM SUCESSO
2734total time = 266.42 s / 1955 tokens
2735eval time  = 255.97 s / 1683 tokens @ 6.57 t/s</div>
2736  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
2737    <strong>Veredicto técnico:</strong> O hardware de 2017 processou e entregou a resposta perfeitamente! O problema anterior era o tempo limite do navegador desistindo da conexão TCP, enquanto o servidor continuava gerando em background.
2738  </p>
2739
2740  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.5 — Paralelismo Real: 4 Slots de Computação</h3>
2741  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
2742    Durante o Teste 9, o OpenWebUI foi conectado paralelamente disparando a mesma pergunta. O motor de agendamento do llama.cpp processou de forma concorrente sem travamentos:
2743  </p>
2744  <div class="cmd">Task 0 (curl)      — n_decoded = 1125, tg = 5.96 t/s
2745Task 875 (OpenWebUI) — n_decoded = 243,  tg = 5.08 t/s</div>
2746<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
2747    A arquitetura resistiu de forma estável (GPU: 63°C, VRAM: 7.1/8.0 GB, RAM: 91% de uso de sistema total seguro, sem travar o Windows).
2748  </p>
2749
2750  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.6 — Teste 7: Habilitando Contexto Extremo (--ctx-size 8192)</h3>
2751  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.1 — O Comando Otimizado</h4>
2752  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
2753.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --p
2753ort 8081 --ctx-size 8192</div>
2754
2755  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.2 — Prompt de Teste e Comportamento do Thinking</h4>
2756  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">
2757    "Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."
2758  </blockquote>
2759  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
2760    Ao receber o prompt, o processador de pensamento rodou por longos 9 minutos em background na CPU trabalhando com o contexto de 8192 tokens. A análise interna destrinchou a matemática da VRAM (calculou que 35B em INT4 exige 17,5GB de peso puro) para desvendar as complexidades de esparsidade de ativação.
2761  </p>
2762
2763  <h4 style="color:rgba(225,29,72,0.9);font-weight:700;font-size:0.95rem;margin-top:2rem;margin-bottom:0.5rem">34.6.2-A — O Raciocínio Interno do Modelo: Análise Comparativa dos Três Thinking Blocks</h4>
2764  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
2765    Durante as exaustivas sessões de ensaio das Seções 33 e 34, o Qwen3.5-35B gerou três blocos independentes de raciocínio de bastidores (<code>&lt;think&gt;</code>) que foram capturados via interceptação direta de pacotes brutos. A tabulação e o mapeamento sistemático dessas sessões fornecem evidências fundamentais de análise cognitiva do modelo:
2766  </p>
2767
2768  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">1. Thinking Block 1 — Quantização Q6_K — Sessão 1 (23:06 de 15/06)</h5>
2769  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
2770    <strong>Prompt:</strong> <em>"Explique detalhadamente o mecanismo de atenção nos Transformers e por que MoE é mais eficiente que modelos densos."</em><br>
2771    <strong>Tempo de Raciocínio:</strong> ~4 minutos | <strong>Tokens do Bloco:</strong> ~2.000 | <strong>Status:</strong> ✅ Concluído com Sucesso.
2772  </p>
2773  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
2774    <span style="color:#e11d48">// Linha de Pensamento do Qwen3.5 (Q6_K):</span><br>
2775    - Deconstruct query into structured chunks: Attention math, Multi-head, MoE, benefits vs dense.<br>
2776    - Detail Attention: Focus on Scaled Dot-Product mathematical formulation (Q, K, V). Show why division by sqrt(d_k) is required to prevent vanishing gradients during Softmax.<br>
2777    - Explain Multi-Head as parallel subspace projections (capturing both strict syntactic dependencies and semantic references).<br>
2778    - Deconstruct MoE: Discuss role of Router/Gating network, Routing sparsity (top-k selection), and load balancing to prevent routing collapse (unused experts).<br>
2779    - <span style="color:#a3e635">[Autocorreção Interna]</span>: "Wait, I must check if MoE is always faster. I should explicitly note that MoE is memory-intensive for routing/loading but highly sparse computationally. If memory bandwidth is bottlenecked under dual-system offloading, token generation speed depends strongly on mmap performance."
2780  </div>
2781
2782  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">2. Thinking Block 2 — Quantização Q4_K_M — Sessão 2 (05:05 de 16/06)</h5>
2783  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
2784    <strong>Prompt:</strong> <em>"Qual a diferença entre MoE e modelo denso, e por que MoE permite rodar 35B numa GPU de 8GB?"</em><br>
2785    <strong>Tempo de Raciocínio:</strong> ~11 minutos | <strong>Tokens do Bloco:</strong> ~3.500 | <strong>Status:</strong> ❌ Interrompido por esgotamento de contexto (Límite 4096).
2786  </p>
2787  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
2788    <span style="color:#e11d48">// Linha de Pensamento do Qwen3.5 (Q4_K_M):</span><br>
2789    - Analysis of premise: Running 35 billion parameter model in 8GB VRAM.<br>
2790    - <span style="color:#f43f5e">
2790[Cálculo Físico Espontâneo]</span>:<br>
2791      * FP32 weights: 35B * 4 bytes = 140 GB. Impossible.<br>
2792      * FP16 weights: 35B * 2 bytes = 70 GB. Impossible.<br>
2793      * INT8 quant:  35B * 1 byte = 35 GB. Impossible.<br>
2794      * INT4 quant:  35B * 0.5 bytes = 17.5 GB. Still larger than 8GB. This doesn't fit natively.<br>
2795    - Challenge the premise: "Wait, if the model indeed runs on 8GB, there must be extreme offloading, sparse activation memory loading, or aggressive hybrid quantization."<br>
2796    - <span style="color:#a3e635">[Autocorreção Crítica]</span>: "Ah! The user says 'por que o MoE permite rodar'. But actually, MoE weights are typically larger than equivalent dense models. A 35B MoE has 35B total parameters but only roughly 6B-8B active parameters per token. If we offload the inactive experts to system memory (RAM/mmap swap) and only load the active experts or the shared dense blocks onto the GPU, then the GPU memory footprint during active tensor computation is massively reduced. Let me structure this hypothesis."<br>
2797    - <span style="color:#d946ef">[Análise Meta-Arquitetural]</span>: Elaborating on the split mechanism. Router stays in VRAM for instant routing, shared blocks in VRAM, active experts fetched from RAM dynamically during forward pass.
2798  </div>
2799  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
2800    <em>Nota Conclusiva de Engenharia:</em> Enquanto o modelo formulava esse raciocínio fascinante na CPU, ele estava descrevendo em profundidade matemática exatamente o sistema de mmap distribuído e a arquitetura Vulkan de 4 níveis de memória que o sustentava em tempo real — sem possuir acesso direto aos metadados do container ou ao sistema de arquivos do laboratório.
2801  </p>
2802
2803  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">3. Thinking Block 3 — Quantização Q4_K_M — Sessão 2 (05:24 de 16/06)</h5>
2804  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
2805    <strong>Prompt:</strong> <em>"Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."</em><br>
2806    <strong>Tempo de Raciocínio:</strong> ~9 minutos | <strong>Tokens do Bloco:</strong> ~3.000 | <strong>Status:</strong> ✅ Concluído com Sucesso (--ctx-size 8192).
2807  </p>
2808  <div style="background:#090a0f;border:1px solid rgba(34,197,94,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a3e635;margin-bottom:1rem">
2809    <span style="color:#a3e635">// Linha de Pensamento do Qwen3.5 (Q4_K_M com limite otimizado):</span><br>
2810    - Prompt requests: Portuguese, direct, concise.<br>
2811    - Challenge VRAM claim again internally: MoE total size is bigger than dense, but active size is smaller. VRAM savings must come from smaller activation graphs (fewer experts evaluated simultaneously) and CPU-offloaded weight mapping.<br>
2812    - Work step-by-step to compress explanation to fit "direto e conciso":<br>
2813      * <span style="color:#cbd5e1">Rascunho v1:</span> Long theoretical detail on Router and CPU/VRAM exchange metrics.<br>
2814      * <span style="color:#cbd5e1">Refinamento v2:</span> Cut down router math, focus on "Ativação Esparsa" (activation memory bounds).<br>
2815      * <span style="color:#cbd5e1">Compressão Final:</span> Produce 3 crisp, highly readable Portuguese bullet points summarizing Active Parameters, Activation Garty/Memory limit, and Compute Scalability.
2816  </div>
2817<h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">Tabela Comparativa de Comportamento Cognitivo</h5>
2818  <div class="tbl">
2819    <table>
2820      <thead>
2821        <tr>
2822          <th>Métrica de Profiling</th>
2823          <th>Sessão 1 (Q6_K)</th>
2824          <th>Sessão 2-A (Q4_K_M)</th>
2825          <th>Sessão 2-B (Q4_K_M / ctx 8192)</th>
2826        </tr>
2827      </thead>
2828      <tbody>
2829        <tr><td><strong>Duração do Raciocínio</strong></td><td>~4 minutos</td><td><strong>~11 minutos</strong></td><td>~9 minutos</td></tr>
2830        <tr><td><strong>Volume do Bloco &lt;think&gt;</strong></td><td>~2.000 tokens</td><td><strong>~3.500 tokens</strong></td><td>~3.000 tokens</td></tr>
2831        <tr><td><strong>Autocorreções Efetuadas</strong></td><td>2</td><td><strong>7 (Autocorreções profundas)</strong></td><td>4 (Foco em concisão)</td></tr>
2832        <tr><td><strong>Questionamento de Premissa?</strong></td><td>Não</td><td><strong>✅ Sim (Provou erro matemático do prompt)</strong></td><td>Sim (reajuste técnico)</td></tr>
2833        <tr><td><strong>Raciocínio Matemático</strong></td><td>Equação Transformers</td><td><strong>Cálculo do tamanho de pesos reais</strong></td><td>Cálculo de buffers de ativação</td></tr>
2834        <tr><td><strong>Entrega do Texto</strong></td><td>✅ Sucesso</td><td>❌ Estouro (4096 esgotados)</td><td><strong>✅ Sucesso Absoluto (Zero cortes)</strong></td></tr>
2835      </tbody>
2836    </table>
2837  </div>
2838
2839  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.8 — Cronograma Histórico do Laboratório</h3>
2840  <div class="tbl">
2841    <table>
2842      <thead>
2843        <tr>
2844          <th>Sessão do Experimento</th>
2845          <th>ID</th>
2846          <th>Parâmetros de Ctx</th>
2847          <th>Geração (tok/s)</th>
2848          <th>Corte de Fluxo (truncated)</th>
2849          <th>Resultado Efetivo</th>
2850        </tr>
2851      </thead>
2852      <tbody>
2853        <tr><td>Seção 34 — Teste 5</td><td>Q6_K</td><td>4096 tokens</td><td>5,57 t/s</td><td>0 (prompt enxuto)</td><td>✅ Resposta entregue (contexto enxuto)</td></tr>
2854        <tr><td>Seção 34 — Teste 9 (curl)</td><td>Q4_K_M</td><td>4096 tokens</td><td><strong>6,57 t/s</strong></td><td>0 (sem timeout)</td><td>
2854✅ Resposta integral por canal direto</td></tr>
2855        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Seção 34 — Teste 7 (WebUI)</strong></td><td>Q4_K_M</td><td>8192 tokens</td><td>6,42 t/s</td><td>0</td><td>✅ Resposta completa com raciocínio expandido</td></tr>
2856      </tbody>
2857    </table>
2858  </div>
2859
2860  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.9 — Nova Coleção de Lições Técnicas Consolidadas</h3>
2861  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
2862    <li><strong style="color:#fff">Lição 6 — O fator Timeout do Cliente:</strong> A maior parte dos erros apontados por testadores não decorre de incapacidade física da GPU, mas sim da persistência HTTP falha de interfaces que desistem antes da decodificação final.</li>
2863    <li><strong style="color:#fff">Lição 7 — Ajuste de Buffers de Contexto:</strong> Ativar a diretiva <code>--ctx-size 8192</code> remove o limite asfixiante do buffer de raciocínio, oferecendo fôlego de processamento para os mais de 3.500 tokens exigidos de raciocínio lógico interno.</li>
2864    <li><strong style="color:#fff">Lição 8 — Supremacia de Carregamento da Quantização Média:</strong> Rodar 35B com quantização de 4 bits economiza 7GB cruciais na carga física de RAM da CPU, reduzindo o I/O do Swap do disco e otimizando a temperatura.</li>
2865    <li><strong style="color:#fff">Lição 9 — Raciocínio de Modelo Crítico:</strong> O Qwen3.5 MoE questionou a premissa errônea presente no prompt, calculando pesos em tempo real e rebatendo sobre o offloading híbrido, o que prova comportamento de atenção e alinhamento impecáveis.</li>
2866    <li><strong style="color:#fff">Lição 10 — Paralelismo nativo estável:</strong> A coexistência de chamadas em canais concorrentes prova a maturidade das implementações de pipeline de shaders Vulkan no llama.cpp.</li>
2867  </ul>
2868
2869  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.10 — Setup Recomendado para Implementações Futuras</h3>
2870  <div class="cmd"># Script do Laboratório para inicialização de produção
2871cd E:\\llama.cpp\\build\\bin\\Release
2872 
2873.\\llama-server.exe \`
2874  -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" \`
2875  --host 0.0.0.0 \`
2876  --port 8081 \`
2877  --ctx-size 8192</div>
2878  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
2879    *Instruções de interface complementares: Desativação estrita de Web Search e geração e imagens durante o processamento híbrido extremo.
2880  </p>
2881
2882  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.11 — Veredicto Geral do Laboratório (Provando a Hipótese)</h3>
2883  <div class="tbl">
2884    <table>
2885      <thead>
2886        <tr>
2887          <th>Questão de Engenharia</th>
2888          <th>Veredicto Final</th>
2889        </tr>
2890      </thead>
2891      <tbody>
2892        <tr><td><strong>O curl resolve o timeout do OpenWebUI?</strong></td><td>✅ <strong>Sim</strong> (truncated = 0, resposta 100% íntegra)</td></tr>
2893        <tr><td><strong>CTX-SIZE de 8.192 resolve o thinking mode esmagado?</strong></td><td>✅ <strong>Sim</strong> (Acomoda com folga raciocínios longos)</td></tr>
2894        <tr><td><strong>Q4_K_M é superior para o cenário de 32GB de RAM?</strong></td><td>✅ <strong>Sim</strong> (Mais rápido, mais frio, menor swap)</td></tr>
2895        <tr><td><strong>A hipótese de esgotamento de contexto foi confirmada?</strong></td><td>✅ <strong>Absolutamente</strong></td></tr>
2896        <tr><td><strong>Sobrecusto financeiro para otimização em 2026?</strong></td><td>✅ <strong>R$ 0,00</strong> (Solução lógica via flags)</td></tr>
2897      </tbody>
2898    </table>
2899  </div>
2900
2901  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.12 — Tags e Metadados</h3>
2902  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
2903    <div>🏷️ <strong>Tags:</strong> curl, ctx-size, timeout, openwebui, q4km, q6k, paralelismo, thinking-mode, resposta-completa, hipotese-confirmada, rx580</div>
2904    <div style="margin-top:0.5rem">💻 <strong>Hardware:</strong>
2904 RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
2905    <div style="margin-top:0.25rem">💿 <strong>Software:</strong> llama.cpp (build\\bin\\Release) + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
2906    <div style="margin-top:0.25rem">📅 <strong>Data:</strong> 16/06/2026</div>
2907    <div style="margin-top:0.25rem">📊 <strong>Testes:</strong> 3 (Teste 9 curl, paralelismo real, Teste 7 ctx8192)</div>
2908    <div style="margin-top:0.25rem">📈 <strong>Benchmark:</strong> 6,42–6,65 tok/s (Q4_K_M) | truncated = 0</div>
2909    <div style="margin-top:0.25rem">🔥 <strong>Temperatura pico:</strong> 74°C</div>
2910    <div style="margin-top:0.25rem">🏆 <strong>Status final:</strong> ✅ HIPÓTESE CONFIRMADA</div>
2911  </div>
2912
2913  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
2914    "O problema nunca foi o hardware. Era uma flag e um timeout."<br>
2915    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 16/06/2026</span>
2916  </blockquote>
2917
2918  <div class="footer">
2919    Documentação gerada por Claude Sonnet 4.6 — 16/06/2026 · Baseada em logs reais, screenshots e benchmarks ao vivo · 3 testes documentados · Hipótese confirmada · Hardware de 2017 processando IA de 2025
2920  </div>
2921</div>`},proximos:{id:"proximos",title:"34. PRÓXIMOS PASSOS (ROADMAP 2027)",desc:"Próximas metas de desenvolvimento: Clusters Multi-GPU Vulkan e malha local de agentes autônomos.",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"planejamento",difficulty:"beginner",estimated_time_min:10,tags:["roadmap-2027","planejamento-tecnico","novas-verticais"],last_reviewed:"2026-07-01",relationships:{prerequisites:["codacus"],previous:"codacus",next:"arquivos",related:["jornada","meta"]}},html:`<div class="card" style="border-left:3px solid #22c55e">
2922    <p style="font-size:.88rem;color:#fff;font-weight:600">Planejamento de Expansão do Infraestrutura Computacional:</p>
2923    <ul style="padding-left:1.2rem;margin-top:.45rem;font-size:.85rem;color:#94a3b8;line-height:2">
2924      <li><strong style="color:#fff">[ ] Homologação de Cluster Multi-GPU:</strong> Acoplamento de uma segunda placa de vídeo RX 580 em paralelo via Vulkan para distribuição de tensores de peso.</li>
2925      <li><strong style="color:#fff">[ ] Mapeamento de Agentes Locais Autônomos:</strong> Integração completa do framework CrewAI rodando nativamente sobre a API do OpenWebUI para automação empresarial.</li>
2926    </ul>
2927  </div>`},scripts:{id:"scripts",title:"21. SCRIPTS E AUTOMAÇÃO",desc:"Scripts em lote para limpar a memória de vídeo e inicializar os servidores locais sem conflitos.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:15,tags:["reboot-stack","memory-flush","manutencao-servidor"],last_reviewed:"2026-07-01",relationships:{prerequisites:["stack"],previous:"stack",next:"guia",related:["reboot_stack","sd_bat_automation"]}},html:`<h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">19.A — Script Master (Todos os Serviços)</h4>
2928  <div class="code"><span class="code-lang">batch</span><pre>@echo off
2929title INFRASTRUCTURE IA - REBOOT STACK
2930cls
2931echo Encerramento forcado de instancias ativas em background...
2932taskkill /F /IM sd-server.exe 2>nul
2933taskkill /F /IM llama-server.exe 2>nul
2934timeout /t 2 /nobreak >nul
2935
2936echo Inicializando LLM via Vulkan na RX 580 (porta 8081)...
2937start "LLM Server - Vulkan RX580" C:\\llama.cpp\\build\\bin\\Release\\llama-server.exe ^
2938  -m "E:\\MODELO LLM PARA GPU\\Mistral-7B-Q4_K_M.gguf" ^
2939  --host 0.0.0.0 ^
2940  --port 8081 ^
2941  --device Vulkan0
2942
2943timeout /t 3 /nobreak >nul
2944
2945echo Inicializando SD Server via Vulkan na RX 580 (porta 7860)...
2946E:
2947cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
2948sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
2949  -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
2950
2951pause</pre></div>
2952
2953  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.B — Conectar LLM no OpenWebUI</h4>
2954  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Após subir o llama-server, conecte no OpenWebUI:</p>
2955  <ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:.75rem">
2956    <li>Acesse <code style="color:var(--r)">http://localhost:3000</code></li>
2957    <li>Clique no avatar → <strong style="color:#fff">Painel de Administração</strong></li>
2958    <li>Vá em <strong style="color:#fff">Configurações → Conexões</strong></li>
2959    <li>Na seção <strong style="color:#fff">API OpenAI</strong> clique em <strong style="color:#fff">"+"</strong></li>
2960    <li>Preencha os campos abaixo:</li>
2961  </ol>
2962  <div class="tbl"><table>
2963    <thead><tr><th>
2963Campo</th><th>Valor</th></tr></thead>
2964    <tbody>
2965      <tr><td>URL</td><td><code>http://host.docker.internal:8081/v1</code></td></tr>
2966      <tr><td>API Key</td><td><code>sk-local</code></td></tr>
2967    </tbody>
2968  </table></div>
2969  <ol start="6" style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-top:.75rem">
2970    <li>Clique no ícone de <strong style="color:#fff">refresh</strong> — deve aparecer tarja verde ✅</li>
2971    <li>Salva</li>
2972  </ol>
2973  <div class="card" style="margin-top:.75rem;border-left:3px solid #eab308;padding-left:.9rem">
2974    <p style="font-size:.85rem;color:#94a3b8;line-height:1.8"><strong style="color:#eab308">⚠️ Não use <code>127.0.0.1</code></strong> — o Docker roda em rede isolada WSL2 e não enxerga o localhost do Windows. Use sempre <code style="color:var(--r)">host.docker.internal</code>.</p>
2975  </div>
2976
2977  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.C — Validação no Chat</h4>
2978  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Após salvar, abra um <strong style="color:#fff">Novo Chat</strong> no OpenWebUI:</p>
2979  <ul style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem">
2980    <li>O modelo <code style="color:var(--r)">Mistral-7B-Q4_K_M.gguf</code> aparece na lista em <strong style="color:#fff">Externo</strong></li>
2981    <li>Seleciona e conversa normalmente</li>
2982    <li>O modelo roda 100% na <strong style="color:#fff">RX 580 via Vulkan</strong> — não no Ollama</li>
2983  </ul>
2984
2985  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.D — Verificar se está na GPU (não na CPU)</h4>
2986  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem">No terminal do llama-server, confirme:</p>
2987  <div class="code"><span class="code-lang">log</span><pre>ggml_vulkan: Found 1 Vulkan device(s)
2988ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
2989llama server listening at http://0.0.0.0:8081</pre></div>
2990  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:.75rem 0 .5rem 0">E durante inferência o benchmark aparece:</p>
2991  <div class="code"><span class="code-lang">log</span><pre>17.77 t/s  ← RX 580 Vulkan ✅</pre></div>
2992  <div class="card" style="margin-top:.75rem">
2993    <p style="font-size:.85rem;color:#64748b;line-height:1.8">Se aparecer apenas <code>3-5 t/s</code> sem linha <code>ggml_vulkan</code> — está rodando na CPU. Verifique se o <code style="color:var(--r)">--device Vulkan0</code> está no comando.</p>
2994  </div>
2995
2996  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.E — Três Interfaces Disponíveis</h4>
2997  <div class="tbl"><table>
2998    <thead><tr><th>Interface</th><th>URL</th><th>Quando Usar</th></tr></thead>
2999    <tbody>
3000      <tr><td><strong style="color:#fff">llama.cpp UI nativa</strong></td><td><code>http://127.0.0.1:8081</code></td><td>Testes rápidos direto no browser</td></tr>
3001      <tr class="hig"><td><strong style="color:#fff">OpenWebUI</strong></td><td><code>http://localhost:3000</code></td><td>Uso diário com histórico e RAG</td></tr>
3002      <tr><td><strong style="color:#fff">API direta</strong></td><td><code>http://192.168.15.68:8081/v1</code></td><td>Integração com outros apps</td></tr>
3003    </tbody>
3004  </table></div>
3005
3006  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.F — Regras Críticas do Script</h4>
3007  <div class="tbl"><table>
3008    <thead><tr><th>Regra</th><th>Motivo</th></tr></thead>
3009    <tbody>
3010      <tr class="hig"><td><code>--host 0.0.0.0</code> obrigatório</td><td><code>127.0.0.1</code> bloqueia Docker</td></tr>
3011      <tr class="hig"><td><code>--device Vulkan0</code> obrigatório</td><td>Sem isso cai em CPU (3-5 t/s)</td></tr>
3012      <tr><td><code>taskkill</code> antes de iniciar</td><td>Libera VRAM de processos travados</td></tr>
3013      <tr><td><code>host.docker.internal</code> no OpenWebUI</td><td>
3013Único endereço que Docker enxerga no host Windows</td></tr>
3014    </tbody>
3015  </table></div>`},sd_bat_automation:{id:"sd_bat_automation",title:"12. SD-SERVER LOCAL / BOOT SEQUENCE",desc:"Script de lote dedicado para inicialização segura e reproduzível do servidor de IA.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:12,tags:["batch-automation","loop-monitoramento","gerenciamento-portas"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux_server"],previous:"flux_server",next:"sd_openwebui_integration",related:["scripts","reboot_stack"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Para evitar erros manuais, caminhos incorretos ou portas presas na VRAM ao reiniciar o Windows, o servidor deve ser iniciado exclusivamente via arquivo <code>.bat</code> na Área de Trabalho.</p>
3016
3017<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Script de Produção (iniciar_ia_server.bat):</strong></p>
3018<pre style="font-family:'JetBrains Mono',monospace;font-size:11px">@echo off
3019title Servidor Stable Diffusion Local - Producao
3020cls
3021
3022:: 1. Limpeza de processos fantasmas na VRAM/RAM
3023taskkill /f /im sd-server.exe 2>nul
3024taskkill /f /im sd-cli.exe 2>nul
3025timeout /t 2 /nobreak >nul
3026
3027:: 2. Salto de unidade e rota nativa (CMD syntax)
3028E:
3029cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
3030
3031:: 3. Execucao com escuta aberta para Docker
3032sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
3033
3034pause</pre>
3035
3036<div class="tbl" style="margin:1.25rem 0">
3037  <table>
3038    <thead>
3039      <tr><th>Regra</th><th>Motivo</th></tr>
3040    </thead>
3041    <tbody>
3042      <tr><td>Nunca usar <code>.\\</code> antes do executável</td><td>CMD tradicional não reconhece — quebra o terminal</td></tr>
3043      <tr><td>Bloco <code>taskkill</code> obrigatório</td><td>Libera porta 7860 travada em processos background</td></tr>
3044      <tr><td>Salto de unidade (<code>E:</code>) antes do <code>cd</code></td><td>CMD não muda de drive sem o salto explícito</td></tr>
3045    </tbody>
3046  </table>
3047</div>
3048
3049<div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;">
3050  <span style="color:#22c55e; font-weight:bold">✅ STATUS: AUTOMAÇÃO VALIDADA EM PRODUÇÃO</span><br>
3051  <span style="font-size:.8rem; color:#94a3b8">Dois cliques no .bat inicializam o ecossistema completo — limpeza, rota e bind de porta em sequência</span>
3052</div>`},sd_openwebui_integration:{id:"sd_openwebui_integration",title:"13. INTEGRAÇÃO OPENWEBUI + DOCKER",desc:"Ponte de rede entre o contêiner Docker do OpenWebUI e o motor C++ nativo rodando na GPU do host.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"integracao",difficulty:"advanced",estimated_time_min:35,tags:["open-webui","docker-compose","networking-docker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_bat_automation"],previous:"sd_bat_automation",next:"comfyui-wsl",related:["sdserver","comfyui-wsl"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Quando o motor de geração roda fora do contêiner Docker, a comunicação local padrão (<code>127.0.0.1</code>) é bloqueada pelo isolamento de rede e pelo Firewall do Windows. A inicialização e a rota precisam ser explícitas.</p>
3053
3054<p style="font-size:.88rem;color:#fff;margin-bottom:.5rem">⚙️ <strong>Parâmetros Críticos de Inicialização</strong></p>
3055<div class="tbl" style="margin-bottom:1.25rem">
3056  <table>
3057    <thead>
3058      <tr><th>Flag</th><th>Valor</th><th>Descrição</th></tr>
3059    </thead>
3060    <tbody>
3061      <tr><td><code>--listen-ip</code></td><td><code>0.0.0.0</code></td><td>Abre escuta para requisições externas ao host (Docker)</td></tr>
3062      <tr><td><code>--listen-port</code></td><td><code>7860</code></td><td>Porta padrão de integração com OpenWebUI</td></tr>
3063      <tr><td><code>-m</code></td><td>caminho absoluto</td><td>Modelo SD 1.5 / XL em <code>.safetensors</code> ou <code>.gguf</code></td></tr>
3064    </tbody>
3065  </table>
3066</div>
3067
3068<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Comando de Produção — SD 1.5 / DreamShaper:</strong></p>
3069<pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"</pre>
3070
3071<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:1rem 0">⚠️ <strong style="color:#fff">Nota de Arquitetura:</strong> Modelos Flux.1 não são compatíveis com esta build via flag <code>-m</code> simples — retornam <code>[ERROR] main.cpp:92 - new_sd_ctx_t failed</code>. Para Flux, use o comando dedicado da seção 10.A com flags <code>--diffusion-model</code>, <code>--vae</code>, <code>--clip_l</code> e <code>--t5xxl</code> separadamente.</p>
3072
3073<p style="font-size:.88rem;color:#fff;margin-bottom:.75rem">🔌 <strong>Configuração de Rota no OpenWebUI</strong></p>
3074<ol style="font-size:.88rem;color:#94a3b8;line-height:2;margin-left:1.25rem">
3075  <li>Acesse <code>http://localhost:3000</code></li>
3076  <li>Vá em <strong>Configurações &gt; Imagens</strong> (Painel do Administrador)</li>
3077  <li>Selecione o motor <strong>Automatic1111</strong></li>
3078  <li>Insira o IP local da máquina com <code>/</code> obrigatório no final:<br>
3079    <code style="color:#22c55e">http://192.168.15.68:7860/</code>
3080  </li>
3081  <li>Clique em <strong>Salvar</strong> — tarja verde confirmará a ponte de rede</li>
3082</ol>
3083
3084<div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin:1.25rem 0">
3085  <strong style="color:#ef4444;display:block;margin-bottom:.4rem">🔒 Liberação Obrigatória no Windows Defender Firewall</strong>
3086  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem">O Windows Defender bloqueia silenciosamente conexões vindas da subrede interna do Docker (<code>172.17.0.0/16</code>) e do WSL2 (<code>172.x.x.x</code>) por padrão. Sem esta regra, o OpenWebUI não consegue alcançar o sd-server mesmo com <code>--listen-ip 0.0.0.0</code> ativo.</p>
3087  <p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>Método 1 — Interface Gráfica (recomendado para primeira instalação):</strong></p>
3088  <ol style="font-size:.82rem;color:#94a3b8;line-height:1.6;margin-left:1.25rem;margin-bottom:.5rem">
3089    <li>Abra: <code>Painel de Controle → Windows Defender Firewall → Configurações Avançadas</code></li>
3090    <li>Clique em: <code>
3090Regras de Entrada → Nova Regra</code></li>
3091    <li>Tipo: <code>Porta</code></li>
3092    <li>Protocolo: <code>TCP</code> | Porta: <code>7860</code></li>
3093    <li>Ação: <code>Permitir a conexão</code></li>
3094    <li>Perfis: marque <code>Domínio</code>, <code>Privado</code> e <code>Público</code></li>
3095    <li>Nome: <code>sd-server AIVisionsLab</code></li>
3096  </ol>
3097  <p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>Método 2 — PowerShell (uma linha, execução como Administrador):</strong></p>
3098  <pre style="font-family:'JetBrains Mono',monospace;font-size:10px;margin-bottom:.5rem">New-NetFirewallRule -DisplayName "sd-server AIVisionsLab" -Direction Inbound -Protocol TCP -LocalPort 7860 -Action Allow</pre>
3099  <p style="font-size:.82rem;color:#94a3b8;margin:0"><strong>Validação:</strong> Após criar a regra, reinicie o sd-server e tente gerar uma imagem pelo OpenWebUI. A tarja verde na configuração de imagens confirma a ponte ativa.</p>
3100</div>
3101
3102<p style="font-size:.88rem;color:#fff;margin:1rem 0 .5rem">📊 <strong>Logs de Sucesso Esperados</strong></p>
3103<pre style="font-family:'JetBrains Mono',monospace;font-size:11px">[INFO] main.cpp:148 - listening on: http://0.0.0.0:7860
3104[INFO] stable-diffusion.cpp:3987 - generate_image 512x512
3105[INFO] stable-diffusion.cpp:4218 - generate_image completed in X.XXs</pre>
3106
3107<div class="card" style="border-left:3px dashed var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);margin-top:1.25rem">
3108  <strong style="color:#fff;display:block;margin-bottom:.4rem">⚠️ Nota de Compatibilidade de Flags — sd-server</strong>
3109  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem">O repositório <code>leejet/stable-diffusion.cpp</code> passou por renomeação de argumentos CLI ao longo de suas versões. Dependendo do commit compilado:</p>
3110  <div class="tbl" style="margin-bottom:.75rem">
3111    <table>
3112      <thead>
3113        <tr><th>Versão / Build</th><th>Flags Corretas</th></tr>
3114      </thead>
3115      <tbody>
3116        <tr><td>Builds antigas (pré master-600)</td><td><code>
3116--host 0.0.0.0 --port 7860</code></td></tr>
3117        <tr><td>Builds recentes (master-600+)</td><td><code>--listen-ip 0.0.0.0 --listen-port 7860</code></td></tr>
3118      </tbody>
3119    </table>
3120  </div>
3121  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem"><strong>Diagnóstico rápido:</strong> Se o terminal retornar <code>error: unknown argument '--listen-ip'</code>, substitua imediatamente por <code>--host</code> e <code>--port</code>. O comportamento de rede é idêntico — apenas a nomenclatura do argumento foi atualizada.</p>
3122  <p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>Validação da sua versão:</strong></p>
3123  <pre style="font-family:'JetBrains Mono',monospace;font-size:10px;margin:0">E:\\stable-diffusion.cpp\\build\\bin\\Release\\sd-server.exe --help
3124# Procure na listagem: se aparecer "--listen-ip", use a sintaxe nova.
3125# Se aparecer "--host", use a sintaxe antiga.</pre>
3126</div>`},sdcpp:{id:"sdcpp",title:"08. COMPILAÇÃO DO STABLE-DIFFUSION.CPP",desc:"Gerando o motor limpo em C++ para renderização de imagens acelerada por GPU sem dependências CUDA.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["sdcpp","stable-diffusion-cpp","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["llama"],previous:"llama",next:"modelos",related:["sdserver","flux_server"]}},html:`<div class="note">⚠ Compilação via <strong>Developer PowerShell</strong> · Execução posterior via <strong>PowerShell Comum</strong></div>
3127  <div class="code"><pre># Clonagem estruturada trazendo todos os submódulos de dependência vinculados
3128git clone --recursive https://github.com/leejet/stable-diffusion.cpp
3129cd stable-diffusion.cpp
3130mkdir build
3131cd build
3132
3133# Mapear o compilador ativando a engine Vulkan e compilar os binários em modo de performance
3134cmake .. -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
3135cmake --build . --config Release -j20</pre></div>
3136  <div class="code ok" style="margin-top:.75rem"><pre># Logs finais de compilação bem-sucedida:
3137-- Found Vulkan: C:/VulkanSDK/1.4.341.1/Lib/vulkan-1.lib
3138[100%] Built target sd-server ✅</pre></div>`},sdserver:{id:"sdserver",title:"10. INICIALIZAÇÃO DO SERVIDOR SD-SERVER (GPU)",desc:"Ativação do serviço de imagem na porta local para escuta das chamadas de API da interface gráfica.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"intermediate",estimated_time_min:15,tags:["sd-server","api-rest","inferenca-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["modelos"],previous:"modelos",next:"flux_server",related:["sd_bat_automation","sd_openwebui_integration"]}},html:`<div class="note ok">
3138✅ Inicialização homologada: Execute este bloco de código dentro do <strong>PowerShell Comum</strong></div>
3139  <div class="code"><pre># Levantar o servidor apontando para o modelo quantizado e definindo o host de escuta
3140E:\\stable-diffusion.cpp\\build\\bin\\Release\\sd-server.exe \\
3141  -m "E:\\models\\dreamshaper8.gguf" \\
3142  --host 0.0.0.0 \\
3143  --port 7860</pre></div>
3144  <div class="code ok" style="margin-top:.75rem"><pre># Monitoramento do terminal:
3145ggml_vulkan: Found 1 Vulkan device(s)
3146ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
3147Server listening on http://0.0.0.0:7860 ✅</pre></div>`},sdxl_vulkan:{id:"sdxl_vulkan",title:"26. SDXL & FLUX.1 VULKAN: ALTA RESOLUÇÃO NA POLARIS",desc:"Mapeamento completo do desafio de difusão de alta resolução (1024x1024) via Vulkan e offloading estruturado de tensores no silício de 8GB.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:40,tags:["sdxl","vulkan-diffusion","segmentacao-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proving_hypothesis_35b"],previous:"proving_hypothesis_35b",next:"",related:["animatediff-video","flux-vulkan"]}},html:`<div class="page">
3148
3149  <div class="hero">
3150    <div class="hero-eyebrow">AIVisionsLab — Seção 26</div>
3151    <div class="hero-title">SDXL 1024×1024 na RX 580 via Vulkan:<br>o desafio que veio da AMD e foi respondido ao vivo</div>
3152    <div class="hero-sub">AMD RX 580 8GB (2017) · stable-diffusion.cpp (leejet) · Vulkan · sem CUDA · sem ROCm · split híbrido CPU/GPU · output fotorrealista confirmado</div>
3153  </div>
3154
3155  <div class="badges">
3156    <span class="badge badge-red">RX 580 · GCN 4th gen</span>
3157    <span class="badge badge-blue">Vulkan backend</span>
3158    <span class="badge badge-gray">stable-diffusion.cpp</span>
3159    <span class="badge badge-green">SDXL 1024×1024 ✓</span>
3160    <span class="badge badge-amber">split híbrido CPU/GPU</span>
3161  </div>
3162
3163  <h2>Contexto: o desafio veio do Discord da AMD</h2>
3164  <p>Enquanto discutíamos ROCm vs Vulkan no servidor oficial do AMD Developer Community, um membro questionou ao vivo os limites do stack. A resposta não foi especulação — foi rodar o benchmark em tempo real e postar o resultado com prints, logs e a imagem gerada, dentro do próprio servidor da AMD.</p>
3165
3166  <div class="discord-card">
3167    <div class="discord-header"><i class="ti ti-brand-discord" aria-hidden="true"></i> AMD Developer Community · #rocm-ai-assistant</div>
3168    <div class="discord-body">
3169      <div class="discord-quote">
3170        <div class="author">POIZONE 🔥</div>
3171        <p>"Love the RX 580 flex. Which SD backend are you using, stable-diffusion.cpp on Vulkan? And does it support SDXL or Flux, or only SD1.5?"</p>
3172      </div>
3173      <div class="discord-reply">Resposta: rodamos o teste ao vivo durante a conversa. O resultado — SDXL 1.0 @ 1024×1024 confirmado, com logs, prints do Task Manager e imagem gerada — foi postado de volta no mesmo canal. O ROCm AI Assistant (bot oficial da AMD) respondeu reconhecendo que Vulkan é a escolha legítima para hardware fora do suporte ROCm.</div>
3174    </div>
3175  </div>
3176
3177  <h2>O problema: 6.9 GB de modelo, 8 GB de VRAM</h2>
3178  <p>O SDXL base pesa ~6.9 GB em fp16. Com buffers de ativação durante a inferência, isso estoura os 8 GB da RX 580 se tudo for carregado na GPU. A solução é offload seletivo por componente — o stable-diffusion.cpp (fork leejet) suporta isso nativamente, com a mesma lógica que já usamos para o FLUX.1-schnell com <code>--clip-on-cpu</code>.</p>
3179  <p>Um segundo problema silencioso: o VAE original do SDXL produz NaN em FP16, e o ggml_conv_2d do sd.cpp só opera em FP16. Sem o fix correto, a imagem sai preta — sem nenhum erro visível no log.</p>
3180
3181  <div class="gotcha-box">
3182    <div class="gotcha-title">⚠ gotcha obrigatória — VAE FP16 fix</div>
3183    <p>Use sempre <strong>sdxl_vae-fp16-fix.safetensors</strong> (madebyollin) no lugar do VAE original. Sem ele: imagem preta, silenciosamente, em todo e qualquer render. O flag <code>--vae</code> aponta para esse arquivo, não para o VAE embutido no checkpoint.</p>
3184  </div>
3185
3186  <h2>Solução: split híbrido CPU/GPU</h2>
3187  <p>UNet inteiro na VRAM. Text encoders e VAE decode na RAM. O <code>--vae-tiling</code> divide o decode em tiles 32×32 para eliminar o pico de memória na etapa final do pipeline.</p>
3188
3189  <div class="code-block">
3190    <div class="code-label">PowerShell — E:\\stable-diffusion.cpp\\build\\bin\\Release\\</div>
3191    <pre>.\\sd-server.exe \`
3192  --listen-ip 0.0.0.0 \`
3193  --listen-port 8081 \`
3194  -m E:\\models\\sd_xl_base_1.0.safetensors \`
3195  --vae E:\\models\\sdxl_vae-fp16-fix.safetensors \`
3196  --clip-on-cpu \`
3197  --vae-on-cpu \`
3198  --vae-tiling \`
3199  -H 1024 -W 1024 -v</pre>
3200  </div>
3201
3202  <table class="flag-table">
3203    <thead><tr><th>Flag</th><th>Efeito</th><th>Memória liberada da VRAM</th></tr></thead>
3204    <tbody>
3205      <tr><td>--clip-on-cpu</td><td>CLIP-L + OpenCLIP-bigG rodam na RAM durante o conditioner</td><td>~1.56 GB</td></tr>
3206      <tr><td>--vae-on-cpu</td><td>VAE decode roda na CPU/RAM — elimina pico no final do pipeline</td><td>~416 MB</td></tr>
3207      <tr><td>--vae-tiling</td><td>Divide o decode em tiles 32×32 (49 tiles em 1024×1024)</td><td>— (reduz pico de RAM)</td></tr>
3208    </tbody>
3209  </table>
3210
3211  <h2>Split de memória confirmado nos logs</h2>
3212
3213  <div class="log-block">
3214    <pre><span class="comment"># saída do sd-server após load completo do modelo:</span>
3215
3216total params memory size = 6624.11MB
3217<span class="highlight">  VRAM  4900.07MB  →  diffusion_model (UNet)</span>
3218<span class="highlight">  RAM   1564.36MB  →  text_encoders (CLIP-L + OpenCLIP-bigG)</span>
3219<span class="highlight">  RAM    159.68MB  →  vae</span>
3220
3221listening on: http://0.0.0.0:8081</pre>
3222  </div>
3223
3224  <div class="memory-split">
3225    <div class="mem-card gpu">
3226      <div class="mem-label">GPU · VRAM</div>
3227      <div class="mem-value">4.9 GB</div>
3228      <div class="mem-sub">UNet (diffusion_model)</div>
3229    </div>
3230    <div class="mem-card ram">
3231      <div class="mem-label">CPU · RAM</div>
3232      <div class="mem-value">1.56 GB</div>
3233      <div class="mem-sub">CLIP-L + OpenCLIP-bigG</div>
3234    </div>
3235    <div class="mem-card ram">
3236      <div class="mem-label">CPU · RAM</div>
3237      <div class="mem-value">160 MB</div>
3238      <div class="mem-sub">VAE decode (49 tiles)</div>
3239    </div>
3240  </div>
3241
3242  <h2>Teste de geração via PowerShell</h2>
3243  <p>Por que não usamos o Open WebUI: já estava configurado apontando para o FLUX.1-schnell em outra porta. Reconfigurar arriscava quebrar um setup que já funcionava. O terminal resolve mais rápido, sem estado salvo para preservar e sem conflito de porta.</p>
3244
3245  <div class="code-block">
3246    <div class="code-label">PowerShell — envio do prompt via API A1111-compatible</div>
3247    <pre>$body = @{
3248    prompt         = "a lovely cat, detailed fur, studio lighting"
3249    negative_prompt = ""
3250    width          = 1024
3251    height         = 1024
3252    steps          = 20
3253    cfg_scale      = 7
3254    sampler_name   = "Euler a"
3255} | ConvertTo-Json
3256
3257$response = Invoke-RestMethod \`
3258    -Uri "http://localhost:8081/sdapi/v1/txt2img" \`
3259    -Method Post \`
3260    -ContentType "application/json" \`
3261    -Body $body
3262
3263$bytes = [Convert]::FromBase64String($response.images[0])
3264[IO.File]::WriteAllBytes("E:\\models\\teste_sdxl_1024.png", $bytes)</pre>
3265  </div>
3266
3267  <h2>Benchmark completo</h2>
3268
3269  <div class="bench-grid">
3270    <div class="bench-card">
3271      <div class="bench-phase">Conditioner (CLIP)</div>
3272      <div class="bench-time">~4s</div>
3273      <div class="bench-detail">CPU/RAM · CLIP-L + OpenCLIP-bigG</div>
3274    </div>
3275    <div class="bench-card">
3276      <div class="bench-phase">UNet sampling</div>
3277      <div class="bench-time">267s</div>
3278      <div class="bench-detail">20 steps · Euler A · 13.37s/it · RX 580 Vulkan</div>
3279    </div>
3280    <div class="bench-card">
3281      <div class="bench-phase">VAE decode</div>
3282      <div class="bench-time">~390s</div>
3283      <div class="bench-detail">49 tiles 32×32 · ~8s/tile · CPU/RAM</div>
3284    </div>
3285    <div class="bench-card">
3286      <div class="bench-phase">VRAM pico</div>
3287      <div class="bench-time">5.7 GB</div>
3288      <div class="bench-detail">de 8.0 GB disponíveis · margem de 2.3 GB</div>
3289    </div>
3290    <div class="bench-card total">
3291      <div class="bench-phase">Total end-to-end</div>
3292      <div class="bench-time">662s · ~11 minutos</div>
3293      <div class="bench-detail">Temperatura pico 67°C → 39°C idle · RAM usada 17.7/31.8 GB</div>
3294    </div>
3295  </div>
3296
3297  <h2>Contexto de velocidade</h2>
3298  <p>Não é rápido. Esse não é o ponto.</p>
3299
3300  <table class="comparison-table">
3301    <thead><tr><th>
3301Hardware</th><th>Stack</th><th>Tempo SDXL 1024×1024</th></tr></thead>
3302    <tbody>
3303      <tr><td>RTX 4090</td><td>CUDA</td><td>~8s</td></tr>
3304      <tr><td>RTX 3080</td><td>CUDA</td><td>~25s</td></tr>
3305      <tr class="highlight-row"><td>RX 580 8GB (2017)</td><td>Vulkan · sem CUDA · sem ROCm</td><td>662s <span class="tag">funciona</span></td></tr>
3306      <tr><td>CPU puro (Xeon E5-2690 v3)</td><td>AVX2</td><td>faixa similar ao setup acima</td></tr>
3307    </tbody>
3308  </table>
3309
3310  <h2>Output gerado</h2>
3311  <p>Prompt: <em>"a lovely cat, detailed fur, studio lighting"</em></p>
3312  <p>Resultado: Maine Coon fotorrealista, pelos individuais visíveis, olhos nítidos, bokeh, studio lighting com contraste dramático. Sem artefatos, sem ruído, sem imagem preta. O VAE FP16 fix funcionou exatamente como documentado.</p>
3313
3314  <div class="result-box">
3315    <p>✓ SDXL 1.0 @ 1024×1024 — confirmado na RX 580 8GB via Vulkan puro. Hardware lançado em 2017, fora do suporte oficial ROCm, sem nenhuma dependência proprietária de vendor. O split híbrido CPU/GPU com --clip-on-cpu + --vae-on-cpu + --vae-tiling é a combinação que torna isso possível dentro dos 8 GB de VRAM.</p>
3316  </div>
3317
3318  <h2>A resposta do AMD Developer Community</h2>
3319  <p>O benchmark foi postado no servidor oficial da AMD com logs, prints do Task Manager durante a inferência e a imagem gerada, em resposta direta à pergunta do membro POIZONE no canal #rocm-ai-assistant. A reação foi imediata: <em>"wow, that was fast thanks alot, and also pretty good results"</em>.</p>
3320  <p>Na sequência, em resposta a uma mensagem mais longa sobre a motivação do projeto — acesso a hardware legado, o abandono do Polaris pelo ROCm e pelo DirectML, e a filosofia de "hardware não morre, suporte oficial é que desaparece" — POIZONE comentou: <em>"Today, someone who wanted to run local AI and couldn't — now can. That's what matters. — this is exactly why i like this idea"</em>.</p>
3321
3322  <h2>Downloads de modelo</h2>
3323  <div class="code-block">
3324    <div class="code-label">PowerShell — baixar em E:\\models\\</div>
3325    <pre>cd E:\\models\\
3326
3327# modelo base SDXL (~6.9 GB)
3328curl.exe -L -o sd_xl_base_1.0.safetensors \`
3329  https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
3330
3331# VAE FP16 fix — obrigatório (~319 MB)
3332curl.exe -L -o sdxl_vae-fp16-fix.safetensors \`
3333  https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors</pre>
3334  </div>
3335
3336  <div class="footer-note">
3337    AIVisionsLab · Seção 26 de 36 · Hardware: AMD RX 580 8GB (2017) + Xeon E5-2690 v3 + 32 GB DDR4 ECC · Windows 10 Pro + WSL2 · stable-diffusion.cpp fork leejet · Vulkan backend · Testado e documentado ao vivo em resposta a desafio no AMD Developer Community Discord.
3338  </div>
3339
3340</div>`},solucao:{id:"solucao",title:"04. A SOLUÇÃO — ARQUITETURA DUPLA",desc:"A estratégia de engenharia definitiva: Divisão inteligente de workloads entre GPU Vulkan e CPU Xeon.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"arquitetura",difficulty:"intermediate",estimated_time_min:15,tags:["vulkan-api","co-processamento","otimizacao-barramento"],last_reviewed:"2026-07-01",relationships:{prerequisites:["falhas"],previous:"falhas",next:"prereqs",related:["contexto","stack"]}},html:`<div class="card acc">
3341    <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-bottom:.9rem">Lógica de Fluxo do Sistema</h3>
3342    <div class="code"><pre>CAMINHO 1 — GPU VULKAN (Aceleração Local RX 580):
3343O ecossistema llama.cpp mapeia a GPU via chamadas nativas Vulkan
3344        ↓
3345O stable-diffusion.cpp herda e compartilha a mesma base limpa da engine ggml
3346        ↓
3347Modelos SD 1.5 convertidos para GGUF geram imagens estáveis em ~72 segundos ✅
3348
3349CAMINHO 2 — CPU XEON (Escalonamento para Modelos SOTA Pesados):
3350O modelo FLUX.1 Schnell FP8 exige 16GB e excede os 8GB de VRAM física da placa
3351        ↓
3352Mapeamento do workflow para o ComfyUI rodando via CPU dentro do WSL2 Linux
3353        ↓
3354A memória RAM DDR4 REG ECC atua como uma "VRAM virtual de alta estabilidade"
3355        ↓
3356Geração completa do FLUX.1 em resolução 768x768 finalizada em ~24 minutos ✅</pre></div>
3357  </div>
3358  <h4 class="s" style="margin-top:1.25rem;margin-bottom:.6rem;color:#fff;font-family:'Syne',sans-serif">Mapeamento de Portas e Serviços Coordenados</h4>
3359  <div class="code"><pre>Interface do Usuário (OpenWebUI via Docker — Porta :3000)
3360        │
3361        ├──► Orquestração de Texto: llama-server.exe (Porta :8081 — Backend Vulkan na RX 580)
3362        │     └── Alternativa de Contingência: Ollama Engine (Porta :11434 — Modo CPU Pura)
3363        │
3364        └──► Orquestração de Imagem (Rotas Dinâmicas de Prompt):
3365              ├──► Demanda Ultra Rápida (SD 1.5 GGUF): sd-server.exe (Porta :7860 — Backend Vulkan)
3366              └──► Demanda SOTA/Complexa (FLUX.1): ComfyUI Server (Porta :8188 — WSL2 CPU Xeon)</pre></div>`},stack:{id:"stack",title:"20. MAPA DE SERVIÇOS DO STACK INTEGRADO",desc:"Tabela de monitoramento de infraestrutura, roteamento de tráfego local e backends ativos.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"monitoramento",difficulty:"beginner",estimated_time_min:10,tags:["network-stack","ports-mapping","security-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["animatediff-video"],previous:"animatediff-video",next:"scripts",related:["sd_bat_automation","scripts"]}},html:`<div class="tbl"><table>
3367    <thead><tr><th>
3367Serviço de IA</th><th>Porta de Acesso</th><th>Protocolo / Engine</th><th>Backend de Hardware Ativo</th></tr></thead>
3368    <tbody>
3369      <tr><td><strong>Open WebUI</strong></td><td><code>:3000</code></td><td>Docker Container</td><td>Ambiente Virtualizado WSL2</td></tr>
3370      <tr class="hig"><td><strong>llama-server</strong></td><td><code>:8081</code></td><td>Nativo ggml Executável</td><td>GPU AMD Radeon RX 580 (Vulkan 1.x)</td></tr>
3371      <tr class="hig"><td><strong>sd-server</strong></td><td><code>:7860</code></td><td>Nativo ggml Executável</td><td>GPU AMD Radeon RX 580 (Vulkan 1.x)</td></tr>
3372      <tr><td><strong>ComfyUI Server</strong></td><td><code>:8188</code></td><td>Python Runtime Isolado</td><td>CPU Xeon E5-2690 v3 (Modo Pure CPU)</td></tr>
3373      <tr><td><strong>Ollama Engine</strong></td><td><code>:11434</code></td><td>Serviço de Contingência</td><td>CPU Xeon E5-2690 v3 (Modo Pure CPU)</td></tr>
3374    </tbody>
3375  </table></div>`},"troubleshoot-comfyui":{id:"troubleshoot-comfyui",title:"28. CATASTROFE DE MEMÓRIA NO COMFYUI WINDOWS",desc:"Tratamento de estouros de alocação física de VRAM e uso emergencial de sinalizadores de paginação.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["vram-spillfix","pagefile-allocation","comfyui-out-of-memory"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux-vulkan"],previous:"flux-vulkan",next:"comfyui-portable-amd",related:["comfyui-directml","comfyui-directml-func"]}},html:`<div class="err">
3376    <div class="err-t">Exceção de Runtime: RuntimeError: Could not allocate tensor with...</div>
3377    <p style="margin-top:.35rem"><strong style="color:#e2e8f0">Mecanismo da Falha:</strong> Ocorre ao tentar rodar fluxos de imagem complexos no Windows utilizando backends de aceleração instáveis que tentam reservar mais blocos contínuos de memória do que a placa dispõe livremente no momento.</p>
3378    <p style="margin-top:.35rem"><strong style="color:#fff">Flags de Sobrevivência:</strong> Altere a chamada do arquivo de inicialização injetando os comandos de fragmentação de carga: <code>--lowvram</code> ou <code>--normalvram</code>. Isso força o gerenciador do ComfyUI a descarregar as camadas do CLIP da memória de vídeo antes de inicializar o processamento do KSampler.</p>
3379  </div>`},troubleshooting:{id:"troubleshooting",title:"27. GUIA DE RESOLUÇÃO DE PROBLEMAS (TROUBLESHOOTING)",desc:"Diagnósticos rápidos para contornar falhas de timeout de API e sementes nulas no servidor.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"geral",difficulty:"beginner",estimated_time_min:10,tags:["port-fixing","network-troubleshoot","timeout-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["cpu"],previous:"cpu",next:"flux-vulkan",related:["falhas","troubleshoot-comfyui"]}},html:`<div class="err">
3380    <div class="err-t">Sintoma Crítico: generate_image returned no results / Terminal congelado</div>
3381    <p style="margin-top:.35rem"><strong style="color:#e2e8f0">Causa Identificada:</strong> O servidor <code>sd-server.exe</code> apresenta um bug de estouro numérico intermitente ao processar gerações enviadas com a semente configurada em modo randômico (Seed: -1).</p>
3382    <p style="margin-top:.35rem"><strong style="color:#22c55e">Ação Corretiva:</strong> Dentro da interface do OpenWebUI, desative a chave de semente dinâmica nas opções avançadas do prompt e force um valor numérico inteiro fixo e válido (Exemplo: <code>42</code>, <code>1337</code>).</p>
3383  </div>`}},de:{amihart:{id:"amihart",title:"31. MÉTODO AMIHART — INFERÊNCIA RX580 EM POLARIS/DEBIAN",desc:"Nota de Crédito: Seção documental em homenagem à prova de conceito realizada por Amihart, pioneira na validação de Vulkan sob Debian GCN4/Polaris.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:30,tags:["metodo-amihart","debian-polaris","vulkan-diagnostics"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comunidade"],previous:"comunidade",next:"dadhacks",related:["comunidade","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Em janeiro de 2025, o desenvolvedor <strong style="color:#fff">Amihart</strong> publicou um estudo técnico demonstrando que, apesar das limitações oficiais impostas pela AMD (fim do suporte oficial do ROCm para arquiteturas Polaris/GCN4), o hardware RX 580 ainda possui pleno potencial de aceleração de IA.</p>
3384  
3385  <div style="display:grid;grid-template-columns:1fr 1fr;gap:.85rem;margin-bottom:1.25rem">
3386    <div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid var(--r)">
3387      <p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">Abordagem AIVisionsLab (Windows Nativo)</p>
3388      <ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8">
3389        <li>Execução no sistema hospedeiro (Windows).</li>
3390        <li>Foco em produção diária de alta estabilidade.</li>
3391        <li>Tuning de orquestração Vulkan nativo.</li>
3392        <li>Segmentação VRAM/CPU híbrida no WSL.</li>
3393      </ul>
3394    </div>
3395    <div class="card" style="border-left:3px solid #22c55e;padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid #22c55e">
3396      <p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">O Método Amihart (Linux/Debian)</p>
3397      <ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8">
3398        <li>Execução em ecossistema Linux/Debian.</li>
3399        <li>Isolamento robusto via containers Docker.</li>
3400        <li>Compilação estrita com flags do Vulkan API.</li>
3401        <li>Sandbox ROCm adaptado virtualizado.</li>
3402      </ul>
3403    </div>
3404  </div>
3405
3406  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. Setup de LLM — Vulkan no Debian</h4>
3407  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">O llama.cpp é compilado com Vulkan API puro para contornar a ausência do driver ROCm:</p>
3408  <div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Passo 1: Instalar drivers Vulkan e pré-requisitos de compilação
3409sudo apt install vulkan-tools libtcmalloc-minimal4 libcurl4-openssl-dev glslc cmake make git pkg-config libvul
3409kan-dev
3410
3411# Passo 2: Clonar e compilar o llama.cpp com Vulkan habilitado
3412cd ~
3413git clone https://github.com/ggerganov/llama.cpp
3414cd llama.cpp && mkdir build && cd build
3415cmake .. -DGGML_VULKAN=on -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=ON
3416
3417# Passo 3: Adicionar binários ao PATH de execução
3418echo 'export PATH=$PATH:'$(realpath bin) >> ~/.bashrc
3419source ~/.bashrc
3420
3421# Passo 4: Executar DeepSeek R1 8B (Aceleração Vulkan0)
3422llama-cli -m deepseek-r1:8B --device Vulkan0 -ngl 100</code></pre></div>
3423
3424  <p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Métrica de Desempenho (Amihart):</strong> No Celeron G6900 operando sem GPU, a resposta é de 5,45 tokens/s. Utilizando aceleração Vulkan pura na RX 580 com 100 camadas offload, a performance sobe para <strong style="color:var(--r)">24,56 tokens/s</strong>, tornando o modelo viável e ágil.</p>
3425
3426  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">B. Setup de Stable Diffusion — Sandbox Docker</h4>
3427  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Como geradores de imagem exigem dependências ROCm, Amihart utiliza containers virtuais isolados para rodar a Web
3427UI de forma limpa no Debian:</p>
3428  <div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Passo 1: Instalação do motor Docker e chaves estritas
3429sudo apt update && sudo apt install -y ca-certificates curl
3430install -m 0755 -d /etc/apt/keyrings
3431curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
3432chmod a+r /etc/apt/keyrings/docker.asc
3433echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
3434sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io
3435
3436# Passo 2: Clonagem da WebUI e execução sob isolamento ROCm gfx803
3437cd ~
3438git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
3439cd ~/stable-diffusion-webui
3440
3441sudo docker run -it \\
3442  --network=host --device=/dev/kfd --device=/dev/dri \\
3443  --ipc=host --shm-size 16G --group-add video \\
3444  --cap-add=SYS_PTRACE \\
3445  --rm -v $(pwd)/cache:/root/.cache \\
3446  -v $(pwd)/data:/stable-diffusion-webui/data \\
3447  woodrex/sd-webui-for-gfx803:latest</code></pre></div>
3448
3449  <p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Otimização Crítica do Cache Amihart:</strong> Para evitar re-loadings de dependências todas as vezes que o container iniciar:</p>
3450  <div class="code" style="margin-bottom:1.5rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Obter o CONTAINER ID ativo
3451sudo docker ps -l
3452# Cometer o estado para uma nova imagem persistente
3453sudo docker commit [CONTAINER_ID]
3454# Ver o ID da imagem persistida e substituir a chamada de docker run por ele
3455sudo docker images</code></pre></div>
3456
3457  <div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem">
3458    <strong style="color:var(--r)">Métricas e Referências Técnicas:</strong> Roteamento baseado na publicação original de <a href="https://amihart.medium.com/inference-with-an-rx580-13e9c1055472" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">Amihart</a> (Medium, Janeiro de 2025). O conhecimento é aberto e útil à comunidade.
3459  </div>`},"animatediff-video":{id:"animatediff-video",title:"19. ANIMATEDIFF UND FRAME-INTERPOLATION (VIDEO)",desc:"Einfügen zeitlicher Konsistenz in ComfyUI auf Legacy-Hardware zur Strukturierung flüssiger, auf dem Intel Xeon koprozessierter Loops.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"advanced",estimated_time_min:30,tags:["animatediff","geracao-video","motion-modules"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-modelos"],previous:"comfyui-modelos",next:"stack",related:["comfyui-flux","sdxl_vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
3460  <strong>AnimateDiff</strong> ist ein Framework für zeitliche Modellierung, das speziell dafür entwickelt wurde, statische Diffusionsmodelle (wie Stable Diffusion 1.5) in konsistente Videogeneratoren umzuwandeln. Es funktioniert durch das Injizieren überlagerter zeitlicher Aufmerksamkeitsmodule in ComfyUI/WSL2. Diese Technik ermöglicht die mathematisch koordinierte Berechnung von Übergängen zwischen benachbarten Frames, wodurch flüssige Loops erzeugt und die chaotischen statischen Effekte von flimmerndem Rauschen eliminiert werden.
3461</p>
3462
3463<!-- Stat cards of render cost -->
3464<div style="display:grid;grid-template-columns:1fr 1fr;gap:1.25rem;margin-bottom:1.5rem">
3465  <div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px">
3466    <div style="font-size:1.8rem">🎬</div>
3467    <div>
3468      <div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">Video-Pipeline</div>
3469      <div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#fff">AnimateDiff (WSL2 Pure CPU)</div>
3470      <div style="font-size:.65rem;color:#64748b;margin-top:2px">24 Threads Intel Xeon E5</div>
3471    </div>
3472  </div>
3473  <div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px">
3474    <div style="font-size:1.8rem">⏳</div>
3475    <div>
3476      <div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">Verarbeitungsmetrik</div>
3477      <div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#34d399">~141s pro Frame-Sekunde</div>
3478      <div style="font-size:.65rem;color:#64748b;margin-top:2px">Interpoliertes zeitliches Rendering</div>
3479    </div>
3480  </div>
3481</div>
3482
3483<!-- Visual Exhibition Player -->
3484<div style="background:#0F1115;border:1px solid rgba(255,255,255,0.04);border-radius:6px;padding:1.5rem;margin-bottom:1.5rem">
3485  <h4 style="font-size:.85rem;color:#fff;text-transform:uppercase;letter-spacing:1px;margin-bottom:1rem;display:flex;align-items:center;gap:.5rem;margin-top:0">
3486    <span>🎥</span> Interaktive Generierungs-Vitrine (Video-Breathe-Loop via lokalem Cache)
3487  </h4>
3488  <p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">
3489    Unten sind die beiden von Ihrem lokalen KI-Stack gerenderten Outputs dargestellt. Bewegen Sie die Maus darüber, um den interpolierten Videoeffekt zu aktivieren, oder klicken Sie auf den Simulator-Button, um das synthetische Xeon-Rendering zu starten:
3490  </p>
3491  
3492  <div style="display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-bottom:1.25rem">
3493    <!-- Player 1: Cyberpunk -->
3494    <div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1">
3495      <img src="/images/cyberpunk_alley_0_1779586391528.png" alt="Cyberpunk Neon Alley" referrerPolicy="no-referrer" class="animatediff-img-1" style="width:100%;height:100%;object-fit:cover;transition:transform 8s ease-in-out, filter 2s ease;filter:brightness(0.9)" />
3496      <div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem">
3497        <span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span>
3498        <span>CYBER_STREET_00.GIF</span>
3499      </div>
3500      <div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.75rem .5rem .5rem .75rem;display:flex;justify-content:space-between;align-items:center">
3501        <span style="font-family:monospace;font-size:9px;color:#64748b">Stable Diffusion 1.5</span>
3502        <span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">VULKAN_OK</span>
3503      </div>
3504    </div>
3505
3506    <!-- Player 2: Cosmic Glass -->
3507    <div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1">
3508      <img src="/images/cosmic_glass_0_1779586410888.png" alt="Cosmic Glass Flask" referrerPolicy="no-referrer" class="animatediff-img-2" style="width:100%;height:100%;object-fit:cover;transition:transform 6s ease-in-out, filter 3s ease;filter:brightness(0.85)" />
3509      <div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem">
3510        <span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span>
3511        <span>ALCHEM_COSMOS_01.GIF</span>
3512      </div>
3513      <div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.5rem .75rem;display:flex;justify-content:space-between;align-items:center">
3514        <span style="font-family:monospace;font-size:9px;color:#64748b">Pure Xeon Model</span>
3515        <span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">THREADED_OK</span>
3516      </div>
3517    </div>
3518  </div>
3519
3520  <div style="text-align:center;margin-top:.5rem">
3521    <button onclick="toggleAnimateDiffSim(this)" style="background:rgba(239, 68, 68, 0.1);border:1px solid rgba(239, 68, 68, 0.4);border-radius:3px;color:#fca5a5;font-family:monospace;padding:.5rem 1rem;font-size:.72rem;cursor:pointer;transition:all 0.2s;text-transform:uppercase">
3522      ▶ Bewegungssimulation aktivieren
3523    </button>
3524  </div>
3525  
3526  <div id="sim-log-box" style="background:#07080a;border:1px solid rgba(255,255,255,0.01);border-radius:3px;padding:0.75rem;margin-top:1rem;font-family:monospace;font-size:10px;color:#475569;line-height:1.5;display:none;max-height:120px;overflow-y:auto;text-align:left">
3527  </div>
3528</div>
3529
3530<style>
3531  .video-preview-box:hover .animatediff-img-1 {
3532    transform: scale(1.1) rotate(0.5deg);
3533    filter: brightness(1.1) saturate(1.15) !important;
3534  }
3535  .video-preview-box:hover .animatediff-img-2 {
3536    transform: scale(1.08) rotate(-0.5deg);
3537    filter: brightness(1.05) saturate(1.2) !important;
3538  }
3539  .animate-active-1 {
3540    animation: panCyberpunk 12s infinite alternate ease-in-out;
3541    filter: brightness(1.1) saturate(1.15) !important;
3542  }
3543  .animate-active-2 {
3544    animation: panGlass 10s infinite alternate ease-in-out;
3545    filter: brightness(1.05) saturate(1.2) !important;
3546  }
3547  @keyframes panCyberpunk {
3548    0% { transform: scale(1); filter: hue-rotate(0deg); }
3549    50% { transform: scale(1.12) translate(5px, -3px); filter: hue-rotate(15deg); }
3550    100% { transform: scale(1.02) translate(-5px, 2px); filter: hue-rotate(-10deg); }
3551  }
3552  @keyframes panGlass {
3553    0% { transform: scale(1.02) rotate(0deg); }
3554    50% { transform: scale(1.15) translate(-2px, 4px) rotate(1deg); filter: hue-rotate(5deg); }
3555    100% { transform: scale(1.05) translate(4px, -2px) rotate(-0.5deg); filter: hue-rotate(-5deg); }
3556  }
3557  @keyframes heartbeat {
3558    0%, 100% { opacity: 0.4; }
3559    50% { opacity: 1; }
3560  }
3561  .pulse-red {
3562    animation: heartbeat 1s infinite;
3563  }
3564</style>`},arquivos:{id:"arquivos",title:"35. TAXONOMIA E ESTRUTURA DE ARQUIVOS NVMe",desc:"Árvore de diretórios unificada para rastreamento de binários compilados e modelos compartilhados.",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"armazenamento",difficulty:"beginner",estimated_time_min:10,tags:["nvme-struct","model-directories","storage-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proximos"],previous:"proximos",next:"meta",related:["comfyui-modelos","meta"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Organização estrutural rigorosa dos caminhos físicos mantidos dentro da partição de alta velocidade do SSD:</p>
3565  <pre style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#e2e8f0;background:rgba(0,0,0,.3);padding:.9rem;border-radius:4px;border:1px solid var(--b)">
3566E:\\
3567├── llama.cpp\\
3568│   └── build\\bin\\Release\\
3569│       ├── llama-server.exe     <span style="color:#64748b"># Servidor de Linguagem Local</span>
3570│       └── llama-cli.exe        <span style="color:#64748b"># Utilitario de Diagnostico</span>
3571├── stable-diffusion.cpp\\
3572│   └── build\\bin\\Release\\
3573│       ├── sd-server.exe        <span style="color:#64748b"># Servidor de Imagem Vulkan</span>
3574│       └── sd-cli.exe           <span style="color:#64748b"># Conversor de Modelos GGUF</span>
3575└── models\\
3576    ├── mistral-7b-instruct.Q4_K_M.gguf
3577    └── dreamshaper8.gguf        <span style="color:#64748b"># Checkpoint SD 1.5 Quantizado</span></pre>`},audio_rvc:{id:"audio_rvc",title:"38. VOICE CONVERSION LOCAL — APPLIO RVC EM AMD RX 580 (Fases Iniciais)",desc:"Pipeline de clonagem de voz no Windows sem CUDA NVIDIA - Configuração do ambiente e primeiras fases.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:35,tags:["applio","rvc-voice-clone","sintese-audio"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linhatempo"],previous:"linhatempo",next:"audio_whisper",related:["audio_whisper","audio_srt_ptbr"]},part:1},html:`<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
3578  Documentação honesta de uma instalação real, incluindo todas as tentativas, erros e soluções.<br />
3579  Conduzida em duas sessões: ChatGPT (fases iniciais) + Claude (fases finais).
3580</blockquote>
3581
3582<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">CONTEXTO DO PROJETO</h3>
3583<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O objetivo era montar um pipeline de produção audiovisual para canal do YouTube estilo dark/documentário:</p>
3584<div class="code" style="margin-bottom:1.25rem">
3585  <pre><code>Texto → Balabolka + Antônio Neural (TTS) → WAV → Applio/RVC → Yuri (voz clonada)</code></pre>
3586</div>
3587<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A ideia central: separar <strong>atuação</strong> de <strong>identidade vocal</strong>.</p>
3588<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
3589  <li><strong style="color:#fff">Antônio Neural</strong> faz a interpretação, prosódia e emoção (voz Microsoft Neural)</li>
3590  <li><strong style="color:#fff">Yuri</strong> (modelo RVC treinado) aplica a identidade vocal por cima</li>
3591</ul>
3592<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.5rem">Isso produz resultado muito mais natural que TTS generativo puro.</p>
3593
3594<div class="tbl" style="margin-bottom:1.5rem">
3595  <table>
3596    <thead>
3597      <tr>
3598        <th>Aspecto</th>
3599        <th>XTTS/TTS puro</th>
3600        <th>Antônio → Yuri (RVC)</th>
3601      </tr>
3602    </thead>
3603    <tbody>
3604      <tr>
3605        <td>Prosódia</td>
3606        <td>Artificial</td>
3607        <td>Humana (ator real)</td>
3608      </tr>
3609      <tr>
3610        <td>Termos técnicos</td>
3611        <td>Tropeça</td>
3612        <td>Lê corretamente</td>
3613      </tr>
3614      <tr>
3615        <td>Textos longos</td>
3616        <td>Degrada</td>
3617        <td>Estável</td>
3618      </tr>
3619      <tr>
3620        <td>Identidade vocal</td>
3621        <td>Genérica</td>
3622        <td>Clonada</td>
3623      </tr>
3624      <tr>
3625        <td>Naturalidade</td>
3626        <td>60-70%</td>
3627        <td>80-95%</td>
3628      </tr>
3629    </tbody>
3630  </table>
3631</div>
3632
3633<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">HARDWARE UTILIZADO</h3>
3634<div class="tbl" style="margin-bottom:1.5rem">
3635  <table>
3636    <thead>
3637      <tr>
3638        <th>Item</th>
3639        <th>Especificação</th>
3640      </tr>
3641    </thead>
3642    <tbody>
3643      <tr>
3644        <td>CPU</td>
3645        <td>Intel Xeon E5-2690 v3 (24 núcleos)</td>
3646      </tr>
3647      <tr>
3648        <td>GPU</td>
3649        <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
3650      </tr>
3651      <tr>
3652        <td>RAM</td>
3653        <td>31.8 GB DDR4 REG ECC</td>
3654      </tr>
3655      <tr>
3656        <td>OS</td>
3657        <td>Windows 11</td>
3658      </tr>
3659      <tr>
3660        <td>Storage</td>
3661        <td>SSD NVMe (E:)</td>
3662      </tr>
3663      <tr>
3664        <td>Python</td>
3665        <td>3.11.9</td>
3666      </tr>
3667    </tbody>
3668  </table>
3669</div>
3670
3671<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 0 — TENTATIVA COM DATASET DO ANTÔNIO (fracasso documentado)</h3>
3672<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A ideia original era treinar o modelo RVC com horas de áudio do Antônio Neural. Foi criado um script <code>split.py</code> com Whisper para segmentar automaticamente o áudio em clips de 6-12 segundos.</p>
3673<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-bottom:0.5rem"><strong>O problema: estouro de memória</strong></p>
3674<div class="code" style="margin-bottom:1.25rem">
3675  <pre><code>MemoryError
3676concurrent.futures.process.BrokenProcessPool</code></pre>
3677</div>
3678<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O pré-processamento de dataset grande (~2h34 de áudio) estourou RAM e VRAM simultaneamente. Mesmo quando terminava, o volume de 1000+ clips causava instabilidade no pipeline do Applio.</p>
3679<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem"><strong>Decisão:</strong> abandonar o dataset do Antônio e usar diretamente <strong>9 minutos de TTS do ElevenLabs</strong> com a voz do Yuri. Menor, mais limpo, mais controlado.</p>
3680
3681<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 1 — INSTALAÇÃO DO AMBIENTE BASE</h3>
3682<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Estrutura de pastas:</strong></p>
3683<div class="code" style="margin-bottom:1.25rem">
3684  <pre><code>E:\\tts-audio_pra_youtube\\
3685├── Applio\\
3686├── voices\\
3687│   └── YURI-TTS.wav  (9 minutos, ElevenLabs, voz Yuri)
3688├── output\\
3689└── scripts\\</code></pre>
3690</div>
3691
3692<div class="err" style="margin-bottom:1.25rem">
3693  <div class="err-t">⚠️ Problema: Python 3.10 incompatível</div>
3694  <p>O Applio moderno exige Python 3.11+. O numpy 2.4.4 requerido não existe para 3.10.</p>
3695</div>
3696
3697<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução:</strong> instalar Python 3.11 em paralelo sem remover o 3.10:</p>
3698<div class="code" style="margin-bottom:1.25rem">
3699  <span class="code-lang">powershell</span>
3700  <pre><code>py -0
3701# -V:3.11  Python 3.11 (64-bit)   ← usar esta
3702# -V:3.10  Python 3.10 (64-bit)   ← manter para outros projetos
3703
3704py -3.11 -m venv venv
3705venv\\Scripts\\activate
3706python --version
3707# Python 3.11.9  ✅</code></pre>
3708</div>
3709
3710<div class="err" style="margin-bottom:1.25rem">
3711  <div class="err-t">⚠️ Problema: requirements.txt com CUDA forçado</div>
3712  <div class="code" style="margin-top:0.5rem;margin-bottom:0.5rem">
3713    <pre><code># O Applio traz esta linha que quebra no AMD Windows:
3714torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'</code></pre>
3715  </div>
3716  <p>O sufixo <code>+cu128</code> é CUDA 12.8 exclusivo NVIDIA. No Windows (<code>win32</code>), essa condição sempre é verdadeira.</p>
3717</div>
3718
3719<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução:</strong> editar o <code>requirements.txt</code>:</p>
3720<div class="code" style="margin-bottom:1.25rem">
3721  <pre><code># REMOVER:
3722torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
3723torchaudio==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
3724torchvision==0.22.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
3725
3726# SUBSTITUIR POR:
3727torch==2.7.1; sys_platform == 'win32'
3728torchaudio==2.7.1; sys_platform == 'win32'
3729torchvision==0.22.1; sys_platform == 'win32'</code></pre>
3730</div>
3731
3732<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 2 — TENTATIVA DIRECTML (fracasso documentado)</h3>
3733<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Com o Applio rodando em CPU (~10 min por época), tentou-se acelerar com DirectML.</p>
3734<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Instalação e teste:</strong></p>
3735<div class="code" style="margin-bottom:1.25rem">
3736  <span class="code-lang">powershell</span>
3737  <pre><code>pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
3738pip install torch-directml
3739
3740python -c "import torch_directml; dml = torch_directml.device(); print(dml)"
3741# privateuseone:0  ✅  — RX 580 reconhecida</code></pre>
3742</div>
3743<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Resultado real:</strong></p>
3744<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
3745  <li>GPU uso: 7-10%</li>
3746  <li>VRAM: 1.2GB usada</li>
3747  <li>Velocidade com DirectML: <strong>4.27s/it</strong></li>
3748  <li>Velocidade sem DirectML (CPU): <strong>4.46s/it</strong></li>
3749  <li>Diferença real: <strong>~5%</strong> — irrelevante</li>
3750</ul>
3751<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Por que foi abandonado:</strong></p>
3752<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O <code>torch-directml</code> está preso na versão <code>0.2.5.dev240914</code> (setembro 2024) e exige <code>torch==2.4.1</code>. O Applio precisa de <code>torch==2.7.1</code>. Conflito irreconciliável:</p>
3753<div class="code" style="margin-bottom:1.25rem">
3754  <pre><code>torch-directml 0.2.5 requires torch==2.4.1
3755hyper-connections 0.4.11 requires torch>=2.5   ← conflito
3756torch-einops-utils 0.1.1 requires torch>=2.5   ← conflito</code></pre>
3757</div>
3758<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A Microsoft parou de investir no DirectML para IA. O projeto está essencialmente abandonado.</p>
3759<p style="font-size:.88rem;color:#10b981;line-height:1.9;margin-bottom:1.25rem">✅ <strong>Conclusão:</strong> DirectML para RVC em Windows AMD em 2026 = não vale a pena.</p>
3760<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 3 — ERRO CRÍTICO: VARIÁVEIS DE AMBIENTE</h3>
3761<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Durante tentativas de forçar CPU, foram usados comandos que <strong>silenciosamente quebravam a extração de características</strong>:</p>
3762<div class="code" style="margin-bottom:1.25rem">
3763  <span class="code-lang">powershell</span>
3764  <pre><code># ❌ NUNCA FAZER ISSO com Applio AMD:
3765set USE_DIRECTML=0
3766set CUDA_VISIBLE_DEVICES=-1
3767set ROCM_VISIBLE_DEVICES=-1
3768set HIP_VISIBLE_DEVICES=-1</code></pre>
3769</div>
3770<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Esses comandos deixavam a pasta <code>extracted</code> vazia após a extração. O treino terminava em <strong>segundos</strong> dizendo "Model trained successfully" sem gerar nenhum <code>.pth</code>.</p>
3771<div class="code" style="margin-bottom:1.25rem">
3772  <pre><code>Not enough data present in the training set.
3773Feature files in logs\\my-project\\extracted could not be loaded correctly.</code></pre>
3774</div>
3775<div class="err" style="margin-bottom:1.25rem">
3776  <div class="err-t">⚠️ Armadilha: "Model trained successfully" em segundos = treino fake.</div>
3777  <p>Sempre verificar se <code>logs/projeto/extracted/</code> tem arquivos <code>.npy</code> antes de treinar.</p>
3778</div>
3779
3780<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 4 — INSTALAÇÃO LIMPA (solução final)</h3>
3781<div class="code" style="margin-bottom:1.25rem">
3782  <span class="code-lang">powershell</span>
3783  <pre><code># 1. Destruir ambiente corrompido
3784deactivate
3785Remove-Item -Recurse -Force venv
3786Remove-Item -Recurse -Force logs
3787
3788# 2. Criar venv limpo
3789py -3.11 -m venv venv
3790venv\\Scripts\\activate
3791python -m pip install --upgrade pip
3792
3793# 3. Instalar torch base
3794pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
3795pip install torch-directml
3796
3797# 4. Instalar dependências sem sobrescrever torch
3798pip install -r requirements.txt --no-deps
3799
3800# 5. Corrigir dependências faltantes
3801pip install gradio-client==1.14.0
3802pip install cffi soupsieve local-attention
3803pip install "aiofiles&lt;25.0" "pandas&lt;3.0" "pydantic&lt;=2.12.3"
3804pip install "starlette&lt;1.0,&gt;=0.40.0" "tomlkit&lt;0.14.0"
3805pip install "tokenizers&gt;=0.22.0,&lt;=0.23.0"
3806pip install audioread decorator lazy-loader msgpack pooch scikit-learn resampy</code></pre>
3807</div>
3808<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>config.py — versão final (sem DirectML):</strong></p>
3809<div class="code" style="margin-bottom:1.25rem">
3810  <span class="code-lang">python</span>
3811  <pre><code>import torch
3812import json
3813import os
3814
3815@singleton
3816class Config:
3817    def __init__(self):
3818        self.device = "cuda:0" if torch.cuda.is_available() else "cpu"
3819        # No AMD Windows sem CUDA, usa "cpu" automaticamente</code></pre>
3820</div>
3821<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Iniciar:</strong></p>
3822<div class="code" style="margin-bottom:1.25rem">
3823  <span class="code-lang">powershell</span>
3824  <pre><code># PowerShell LIMPO, sem nenhum 'set' antes
3825python app.py
3826# * Running on local URL: http://127.0.0.1:6969  ✅</code></pre>
3827</div>
3828
3829<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 5 — ARQUIVOS MUTE FALTANDO</h3>
3830<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Na instalação via git, os arquivos de silêncio não são criados. Aparecem um por um durante o treino:</p>
3831<div class="code" style="margin-bottom:1.25rem">
3832  <pre><code>FileNotFoundError: logs\\mute\\sliced_audios\\mute40000.wav
3833FileNotFoundError: logs\\mute\\extracted\\mute.npy          ← shape errado causa crash
3834FileNotFoundError: logs\\mute\\f0\\mute.wav.npy
3835FileNotFoundError: logs\\mute\\f0_voiced\\mute.wav.npy
3836RuntimeError: tensor (100) must match size (768)</code></pre>
3837</div>
3838<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução — criar todos de uma vez:</strong></p>
3839<div class="code" style="margin-bottom:1.25rem">
3840  <span class="code-lang">powershell</span>
3841  <pre><code>python -c "
3842import numpy as np, soundfile as sf, os
3843[os.makedirs(d, exist_ok=True) for d in [
3844    'logs/mute/sliced_audios','logs/mute/extracted',
3845    'logs/mute/f0','logs/mute/f0_voiced'
3846]]
3847sf.write('logs/mute/sliced_audios/mute40000.wav', np.zeros(int(40000*3.7)), 40000)
3848sf.write('logs/mute/sliced_audios/mute48000.wav', np.zeros(int(48000*3.7)), 48000)
3849sf.write('logs/mute/sliced_audios/mute32000.wav', np.zeros(int(32000*3.7)), 32000)
3850np.save('logs/mute/extracted/mute.npy', np.zeros((196, 768)))
3851np.save('logs/mute/f0/mute.wav.npy', np.zeros(100))
3852np.save('logs/mute/f0_voiced/mute.wav.npy', np.zeros(100))
3853print('OK')
3854"</code></pre>
3855</div>
3856<div class="err" style="margin-bottom:1.25rem">
3857  <div class="err-t">⚠️ Crítico: mute.npy precisa ter shape (196, 768)</div>
3858  <p>dimensão 768 do embedder contentvec. Qualquer outro shape causa crash.</p>
3859</div>
3860
3861<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">
3861FASE 6 — DATASET E TREINO</h3>
3862<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Dataset usado:</strong></p>
3863<div class="tbl" style="margin-bottom:1.5rem">
3864  <table>
3865    <thead>
3866      <tr>
3867        <th>Parâmetro</th>
3868        <th>Valor</th>
3869      </tr>
3870    </thead>
3871    <tbody>
3872      <tr>
3873        <td>Arquivo</td>
3874        <td>YURI-TTS.wav</td>
3875      </tr>
3876      <tr>
3877        <td>Duração</td>
3878        <td>9 minutos</td>
3879      </tr>
3880      <tr>
3881        <td>Fonte</td>
3882        <td>ElevenLabs TTS</td>
3883      </tr>
3884      <tr>
3885        <td>Nota</td>
3886        <td>Mínimo aceitável. Ideal: 15-25 min</td>
3887      </tr>
3888    </tbody>
3889  </table>
3890</div>
3891
3892<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Configurações do Applio:</strong></p>
3893<div class="tbl" style="margin-bottom:1.5rem">
3894  <table>
3895    <thead>
3896      <tr>
3897        <th>Parâmetro</th>
3898        <th>Valor</th>
3899      </tr>
3900    </thead>
3901    <tbody>
3902      <tr>
3903        <td>Taxa de amostragem</td>
3904        <td>40000 Hz</td>
3905      </tr>
3906      <tr>
3907        <td>Vocoder</td>
3908        <td>HiFi-GAN</td>
3909      </tr>
3910      <tr>
3911        <td>Algoritmo de pitch</td>
3912        <td>RMVPE</td>
3913      </tr>
3914      <tr>
3915        <td>Embedder</td>
3916        <td>contentvec</td>
3917      </tr>
3918      <tr>
3919        <td>Tamanho do lote</td>
3920        <td>4</td>
3921      </tr>
3922      <tr>
3923        <td>Total de épocas</td>
3924        <td>200</td>
3925      </tr>
3926      <tr>
3927        <td>Número da GPU</td>
3928        <td><strong>vazio</strong> (não colocar 0, -1 ou cpu)</td>
3929      </tr>
3930    </tbody>
3931  </table>
3932</div>
3933
3934<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Métricas reais:</strong></p>
3935<div class="tbl" style="margin-bottom:1.5rem">
3936  <table>
3937    <thead>
3938      <tr>
3939        <th>Época</th>
3940        <th>Loss</th>
3941        <th>Tempo por época</th>
3942      </tr>
3943    </thead>
3944    <tbody>
3945      <tr>
3946        <td>1</td>
3947        <td>27.181</td>
3948        <td>7:21</td>
3949      </tr>
3950      <tr>
3951        <td>8</td>
3952        <td>17.93</td>
3953        <td>7:02</td>
3954      </tr>
3955      <tr>
3956        <td>20</td>
3957        <td>16.212</td>
3958        <td>7:43</td>
3959      </tr>
3960      <tr>
3961        <td>43</td>
3962        <td>15.785</td>
3963        <td>5:43</td>
3964      </tr>
3965    </tbody>
3966  </table>
3967</div>
3968<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
3969  <li>Velocidade: ~6 minutos por época</li>
3970  <li>Total: ~20 horas para 200 épocas</li>
3971  <li>Hardware efetivo: CPU Xeon 24 núcleos</li>
3972</ul>
3973<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
3974  <strong>ℹ️ Buffer do PowerShell:</strong> de treino overnight o terminal pode parecer travado. O treino continua normalmente — verificar o contador no Applio.
3975</blockquote>
3976
3977<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">LIÇÕES APRENDIDAS</h3>
3978<p style="font-size:.88rem;color:#10b981;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">✅ O que funciona:</p>
3979<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
3980  <li>Applio + CPU puro no AMD Windows — estável e funcional</li>
3981  <li>Python 3.11 obrigatório (não 3.10)</li>
3982  <li><code>requirements.txt</code> editado — remover <code>+cu128</code></li>
3983  <li>PowerShell limpo — sem variáveis <code>CUDA_VISIBLE_DEVICES</code></li>
3984  <li>Arquivos mute criados manualmente antes do treino</li>
3985  <li>Campo "Número da GPU" <strong>vazio</strong> no Applio</li>
3986</ol>
3987<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">❌ O que não funciona:</p>
3988<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
3989  <li>DirectML + torch 2.7.1 — incompatível em 2026</li>
3990  <li><code>set CUDA_VISIBLE_DEVICES=-1</code> — quebra a extração de features</li>
3991  <li><code>pip install -r requirements.txt</code> sem editar — instala CUDA e falha</li>
3992  <li>Dataset grande (horas de áudio) — estouro de RAM/VRAM</li>
3993</ol>
3994
3995<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">PIPELINE FINAL DE PRODUÇÃO</h3>
3996<div class="code" style="margin-bottom:1.25rem">
3997  <pre><code>1. Escrever roteiro
3998   ↓
39992. Balabolka + Antônio Neural → WAV com interpretação humana
4000   ↓
40013. Applio — Inferência
4002   Modelo: my-project_200e.pth
4003   Índice: my-project.index
4004   ↓
40054. Output: WAV com voz do Yuri
4006   ↓
40075. Edição e publicação no YouTube</code></pre>
4008</div>
4009<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Velocidade de inferência (pós-treino):</strong></p>
4010<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
4011  <li>~5-30 segundos por minuto de áudio</li>
4012  <li>2 horas de áudio → ~30 minutos de processamento</li>
4013  <li>Modo Lote disponível no Applio</li>
4014</ul>
4015
4016<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">CHECKLIST — REPRODUZINDO DO ZERO</h3>
4017<ul style="list-style-type:none;padding-left:0;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
4018  <li><span style="color:#475569">[ ]</span> Python 3.11 instalado</li>
4019  <li><span style="color:#475569">[ ]</span> Git instalado</li>
4020  <li><span style="color:#475569">[ ]</span> FFmpeg no PATH</li>
4021  <li><span style="color:#475569">[ ]</span> Dataset WAV limpo (mínimo 5 min, ideal 15-25 min)</li>
4022  <li><span style="color:#475569">[ ]</span> <code>requirements.txt</code> editado (remover <code>+cu128</code>)</li>
4023  <li><span style="color:#475569">[ ]</span> <code>config.py</code> sem referências ao <code>torch_directml</code></li>
4024  <li><span style="color:#475569">[ ]</span> Arquivos mute criados</li>
4025  <li><span style="color:#475569">[ ]</span> PowerShell limpo (sem <code>set CUDA_VISIBLE_DEVICES</code>)</li>
4026  <li><span style="color:#475569">[ ]</span> Campo "Número da GPU" <strong>vazio</strong> no Applio</li>
4027  <li><span style="color:#475569">[ ]</span> Após extração: verificar que <code>logs/projeto/extracted/</code> tem arquivos <code>.npy</code></li>
4028</ul>
4029
4030<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">AMD vs NVIDIA EM IA — POSIÇÃO DO APPLIO/RVC (2026)</h3>
4031<div class="tbl" style="margin-bottom:1.5rem">
4032  <table>
4033    <thead>
4034      <tr>
4035        <th>Plataforma</th>
4036        <th>Situação</th>
4037      </tr>
4038    </thead>
4039    <tbody>
4040      <tr>
4041        <td>NVIDIA CUDA</td>
4042        <td>✅ Excelente — suporte nativo</td>
4043      </tr>
4044      <tr>
4045        <td>AMD ROCm Linux</td>
4046        <td>⚠️ Razoável — funciona com esforço</td>
4047      </tr>
4048      <tr>
4049        <td>AMD Windows DirectML</td>
4050        <td>❌ Abandonado</td>
4051      </tr>
4052      <tr>
4053        <td>AMD Windows CPU</td>
4054        <td>✅ Funcional — lento mas estável</td>
4055      </tr>
4056    </tbody>
4057  </table>
4058</div>
4059<p style="font-size:.85rem;color:#94a3b8;font-style:italic;line-height:1.8"><em>*Hardware legado não morre — só precisa do backend certo.</em></p>`},audio_srt_ptbr:{id:"audio_srt_ptbr",title:"40. KOMPLETTE PIPELINE — TRANSKRIPTION + ÜBERSETZUNG PT-BR MIT RX 580 (Teil 1)",desc:"Transkription von englischen Videos mit automatischer Übersetzung ins brasilianische Portugiesisch, von .mp4 bis .srt ohne kostenpflichtige Dienste.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:25,tags:["srt-generation","automacao-srt","ffmpeg-pipeline"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linux_nativo"],previous:"linux_nativo",next:"limit_qwen_35b",related:["audio_whisper","limit_qwen_35b"]},part:1}
4059,html:`<div class="whisper-doc">
4060  <div class="hero">
4061    <div class="hero-title"><span>Komplette Pipeline</span> — Transkription + Übersetzung EN➔PT-BR</div>
4062    <div class="hero-sub">Offline-Transkription von englischen Videos mit automatischer Übersetzung ins brasilianische Portugiesisch, von <code>.mp4</code> bis <code>.srt</code> zu 100 % kostenlos mit der RX 580 über Vulkan.</div>
4063    <div class="hero-badges">
4064      <span class="badge badge-gpu">AMD RX 580 8GB</span>
4065      <span class="badge badge-win">Windows + PowerShell</span>
4066      <span class="badge badge-ok">Vulkan Backend</span>
4067      <span class="badge badge-ok">large-v3-turbo</span>
4068      <span class="badge badge-win">deep-translator (Kostenlos)</span>
4069    </div>
4070  </div>
4071
4072  <div class="stat-grid">
4073    <div class="stat">
4074      <div class="stat-label">Gesamtzeit Pipeline</div>
4075      <div class="stat-value">~8 min</div>
4076      <div class="stat-sub">Video von 29m 51s</div>
4077    </div>
4078    <div class="stat">
4079      <div class="stat-label">Genutzter VRAM</div>
4080      <div class="stat-value">2.9 GB</div>
4081      <div class="stat-sub">von 8 GB Polaris</div>
4082    </div>
4083    <div class="stat">
4084      <div class="stat-label">Mittlere GPU-Temp.</div>
4085      <div class="stat-value">50°C</div>
4086      <div class="stat-sub">Optimierte Lüfterkurve</div>
4087    </div>
4088    <div class="stat">
4089      <div class="stat-label">Cloud-Kosten</div>
4090      <div class="stat-value">R$ 0,00</div>
4091      <div class="stat-sub">100% lokal & offline</div>
4092    </div>
4093  </div>
4094
4095  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Im Test verwendete Hardware</h3>
4096  <div class="tbl">
4097    <table>
4098      <thead>
4099        <tr>
4100          <th>Komponente</th>
4101          <th>Spezifikation</th>
4102        </tr>
4103      </thead>
4104      <tbody>
4105        <tr>
4106          <td><strong>GPU</strong></td>
4107          <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
4108        </tr>
4109        <tr>
4110          <td><strong>CPU</strong></td>
4111          <td>Intel Xeon E5-2690 v3 (24 threads / 12 Cores)</td>
4112        </tr>
4113        <tr>
4114          <td><strong>RAM</strong></td>
4115          <td>31.8 GB DDR4 REG ECC</td>
4116        </tr>
4117        <tr>
4118          <td><strong>OS</strong></td>
4119          <td>Windows 11 Professional</td>
4120        </tr>
4121        <tr>
4122          <td><strong>Driver</strong></td>
4123          <td>Adrenalin 31.0.21925.1001 (2026/05/20)</td>
4124        </tr>
4125      </tbody>
4126    </table>
4127  </div>
4128
4129  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Einheitlicher Datenfluss (Pipeline)</h3>
4130  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
4131    Das Ziel ist es, ein englisches Lehrvideo in portugiesische Untertitel zu übersetzen, die mit Videoschnittsoftware (Filmora, Premiere usw.) kompatibel sind. Dabei wird die Transkription über die native GPU ausgeführt und jeder Zeitstempel ohne Einschränkungen kommerzieller Cloud-APIs übersetzt:
4132  </p>
4133  <div class="cmd" style="white-space:normal; line-height:1.6; padding: 1rem;">
4134    <strong>video.mp4</strong> ➔ <code>FFmpeg (Extraktion)</code> ➔ <strong>video_16k.wav</strong><br>
4135    ➔ <code>whisper-cli Vulkan (Transkription)</code> ➔ <strong>video.srt (English)</strong><br>
4136    ➔ <code>Python deep-translator (Google Translate)</code> ➔ <strong>video_ptbr.srt (Portugiesisch)</strong><br>
4137    ➔ <code>In Filmora-Timeline importieren</code>
4138  </div>
4139
4140  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Detaillierte Performance und Timings</h3>
4141  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
4142    Tatsächliche Metriken aus der Transkription eines Lehrvideos von <strong>29 Minuten und 51 Sekunden</strong> (englischer Ton, AAC, 480x360):
4143  </p>
4144  <div class="tbl" style="margin-bottom:1.5rem">
4145    <table>
4146      <thead>
4147        <tr>
4148          <th>Pipeline-Schritt</th>
4149          <th>Werkzeug</th>
4150          <th>Benötigte Zeit</th>
4151        </tr>
4152      </thead>
4153      <tbody>
4154        <tr>
4155          <td><strong>1. Unkomprimierte WAV-Audioextraktion</strong></td>
4156          <td>FFmpeg</td>
4157          <td><strong>1,7 Sekunden</strong></td>
4158        </tr>
4159        <tr>
4160          <td><strong>2. Audiotranskription (EN)</strong></td>
4161          <td>Whisper.cpp + Vulkan</td>
4162          <td><strong>6 Minuten und 07 Sekunden</strong></td>
4163        </tr>
4164        <tr>
4165          <td><strong>3. Blockweise Übersetzung der SRT (EN➔PT-BR)</strong></td>
4166          <td>Python + <code>deep-translator</code></td>
4167          <td><strong>~2 Minuten</strong> (Netzwerk-I/O-Einschränkung)</td>
4168        </tr>
4169        <tr style="border-top:1px solid rgba(255,255,255,0.15)">
4170          <td><strong>Konsolidierte Gesamtmetrik</strong></td>
4171          <td><strong>Komplette Pipeline</strong></td>
4172          <td><strong>~8 Minuten</strong></td>
4173        </tr>
4174      </tbody>
4175    </table>
4176  </div>
4177
4178  <h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">Interne Core-Timings (whisper_print_timings)</h4>
4179  <div class="card bg-black/40 border border-white/5 p-4 rounded-md my-3 font-mono text-xs text-[#a7f3d0] leading-relaxed">
4180    Modell laden : 3.687 ms<br>
4181    Mel (Audio) : 2.305 ms<br>
4182    GPU-Encode  : 204.689 ms<br>
4183    Decode      : 4.081 ms<br>
4184    Batch gesamt : 108.675 ms<br>
4185    Gesamt       : 367.432 ms (pro Segmentierungs-Batch)
4186  </div>
4187
4188  <div class="section-title">Schritt-für-Schritt-Anleitung</div>
4189
4190  <div class="step">
4191    <div class="step-header">
4192      <div class="step-num">1</div>
4193      <div class="step-name">Kompatibles Audio über FFmpeg extrahieren</div>
4194      <div class="step-desc">WAV 16kHz Mono 16-bit</div>
4195    </div>
4196    <div class="step-body">
4197      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">Whisper benötigt zwingend unkomprimiertes WAV-Audio mit 16.000 Hz im 
419716-Bit-Mono-Format:</p>
4198      <div class="cmd">ffmpeg -i "E:\\MUSICAS SUNO AI\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\MUSICAS SUNO AI\\video_16k.wav"</div>
4199      <p class="note"><strong>Flags:</strong> <code>-ar 16000</code> erzwingt 16kHz · <code>-ac 1</code> konvertiert in einen einzelnen Monokanal · <code>-c:a pcm_s16le</code> definiert verlustfreies 16-Bit-PCM.</p>
4200    </div>
4201  </div>
4202
4203  <div class="step">
4204    <div class="step-header">
4205      <div class="step-num">2</div>
4206      <div class="step-name">Über Vulkan transkribieren</div>
4207      <div class="step-desc">Hohe Last auf der Polaris-GPU</div>
4208    </div>
4209    <div class="step-body">
4210      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">Die kompilierte Whisper-Ausführungsdatei aufrufen, um die erste SRT-Untertiteldatei auf Englisch zu erstellen:</p>
4211      <div class="cmd">cd C:\\whisper.cpp</div>
4212      <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\MUSICAS SUNO AI\\video_16k.wav" -l en --output-srt</div>
4213      <p class="note"><strong>Überprüfung der GPU-Aktivität:</strong> Stellen Sie sicher, dass beim Start die Zeilen <code>ggml_vulkan: Found 1 Vulkan devices: AMD Radeon RX 580 2048SP</code> angezeigt werden, um zu bestätigen, dass das rechenintensive Encoding auf die GPU ausgelagert wurde, wodurch die CPU-Auslastung auf ~5 % sinkt.</p>
4214    </div>
4215  </div>
4216
4217  <div class="step">
4218    <div class="step-header">
4219      <div class="step-num">3</div>
4220      <div class="step-name">Python-Übersetzungsskript erstellen und ausführen</div>
4221      <div class="step-desc">Keine Keys, keine Kosten</div>
4222    </div>
4223    <div class="step-body">
4224      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">
4225        Installieren Sie die Übersetzungsbibliothek ohne API-Schlüssel: <code>pip install deep-translator</code>. Erstellen und führen Sie die Datei <code>C:\\whisper.cpp\\traduzir.py</code> mit diesem Code aus:
4226      </p>
4227      <div class="cmd" style="white-space:pre-wrap; font-size:11px;">from deep_translator import GoogleTranslator
4228
4229def traduzir_srt(entrada, saida):
4230    with open(entrada, 'r', encoding='utf-8') as f:
4231        conteudo = f.read()
4232
4233    blocos = conteudo.strip().split('\\n\\n')
4234    resultado = []
4235
4236    for bloco in blocos:
4237        linhas = bloco.split('\\n')
4238        if len(linhas) >= 3:
4239            numero = linhas[0]
4240            timestamp = linhas[1]
4241            texto = ' '.join(linhas[2:])
4242            traduzido = GoogleTranslator(source='en', target='pt').translate(texto)
4243            resultado.append(f"{numero}\\n{timestamp}
4243\\n{traduzido}")
4244
4245    with open(saida, 'w', encoding='utf-8') as f:
4246        f.write('\\n\\n'.join(resultado))
4247    print("Pronto!")
4248
4249traduzir_srt(
4250    r'E:\\MUSICAS SUNO AI\\video_16k.wav.srt',
4251    r'E:\\MUSICAS SUNO AI\\video_16k_ptbr.srt'
4252)</div>
4253<p style="font-size:0.8rem;color:#94a3b8;margin-top:0.5rem">Para rodar:</p>
4254      <div class="cmd">python traduzir.py</div>
4255    </div>
4256  </div>
4257
4258  <div class="step">
4259    <div class="step-header">
4260      <div class="step-num">4</div>
4261      <div class="step-name">Importar Legenda no Filmora</div>
4262      <div class="step-desc">Concluir Edição de Vídeo</div>
4263    </div>
4264    <div class="step-body">
4265      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6">
4266        1. No Wondershare Filmora, acesse <strong>Arquivo ➔ Importar ➔ Importar arquivos de legenda</strong>.<br>
4267        2. Selecione o arquivo gerado <code>video_16k_ptbr.srt</code>.<br>
4268        3. Arraste e solte o track de legenda diretamente na timeline, sobreposto ao track de vídeo original.
4269      </p>
4270    </div>
4271  </div>
4272
4273  <div class="section-title">Lições Autônomas Aprendidas nas Peripécias</div>
4274  <div class="card-inner">
4275    <div class="lesson">
4276      <div class="lesson-icon">⚠️</div>
4277      <div class="lesson-text"><strong>Evite usar --translate para PT-BR direto nas flags do Whisper:</strong> O parâmetro <code>--translate</code> por design traduz o áudio para o inglês de forma nativa. Para ter legendas em português brasileiro de qualidade, a abordagem correta é extrair inglês por <code>-l en</code> e traduzir com o algoritmo <code>traduzir.py</code>.</div>
4278    </div>
4279    <div class="lesson">
4280      <div class="lesson-icon">⚠️</div>
4281      <div class="lesson-text"><strong>Problemas de Linguagem de Origem Incorreta:</strong> Passar <code>-l pt</code> quando o áudio de origem é falado em inglês faz o Whisper forçar padrões fonéticos portugueses no áudio em inglês, gerando textos completamente incompreensíveis e sem sentido. Defina sempre o idioma real do áudio de entrada como parâmetro inicial.</div>
4282    </div>
4283    <div class="lesson">
4284      <div class="lesson-icon">ℹ️</div>
4285      <div class="lesson-text"><strong>Local do Arquivo Gerado:</strong> Por padrão, em compilados nativos, o arquivo <code>.srt</code> é salvo na mesma pasta física do arquivo de áudio WAV processado, e não dentro do diretório do script ou do Whisper.</div>
4286    </div>
4287    <div class="lesson">
4288      <div class="lesson-icon">✅</div>
4289      <div class="lesson-text"><strong>8 GB de VRAM em 2026 Segue Firme:</strong> O modelo Whisper <code>large-v3-turbo</code> consome apenas 2.9 GB de VRAM física no ecossistema, permitindo folga para outras atividades na sua máquina ou renderização benta paralela. Milhares de dólares economizados em assinaturas e APIs proprietárias.</div>
4290    </div>
4291  </div>
4292
4293  <div class="footer">
4294    RX 580 — velha de 580 anos, mas ainda na ativa 🚀 · Peripécias documentadas em junho/2026
4295  </div>
4296</div>`},audio_whisper:{id:"audio_whisper",title:"39. WHISPER.CPP LOCAL — TRANSCRIÇÃO DE ÁUDIO EM AMD RX 580",desc:"Transcrição de áudio/vídeo acelerada por GPU AMD via Vulkan no Windows (modelo large-v3-turbo).",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:30,tags:["whispercpp","transcricao-audio","vulkan-whisper"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_rvc"],previous:"audio_rvc",next:"linux_nativo",related:["audio_rvc","audio_srt_ptbr"]},part:1},html:`<div class="whisper-doc">
4297<style>
4298.whisper-doc {
4299  --color-border-secondary: rgba(255, 255, 255, 0.05);
4300  --color-border-tertiary: rgba(255, 255, 255, 0.08);
4301  --color-background-secondary: #0c0d10;
4302  --color-background-primary: #07080a;
4303  --color-text-primary: #ffffff;
4304  --color-text-secondary: #94a3b8;
4305  font-family: inherit;
4306}
4307.whisper-doc * { box-sizing: border-box; }
4308.whisper-doc .badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 4px; letter-spacing: 0.04em; text-transform: uppercase; }
4309.whisper-doc .badge-gpu { background: rgba(225, 29, 72, 0.1); border: 1px solid rgba(225, 29, 72, 0.3); color: #fda4af; }
4310.whisper-doc .badge-win { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.2); color: #a7f3d0; }
4311.whisper-doc .badge-ok { background: rgba(14, 165, 233, 0.1); border: 1px solid rgba(14, 165, 233, 0.3); color: #bae6fd; }
4312.whisper-doc .badge-warn { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #fef08a; }
4313.whisper-doc .hero { border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 1.5rem; margin-bottom: 2rem; background: #0c0d10; }
4314.whisper-doc .hero-title { font-size: 26px; font-weight: 700; color: var(--color-text-primary); line-height: 1.2; margin-bottom: 0.5rem; font-family: 'Syne', var(--font-sans); text-transform: uppercase; }
4315.whisper-doc .hero-title span { color: #E11D48; }
4316.whisper-doc .hero-sub { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 1.25rem; line-height: 1.6; font-family: var(--font-sans); }
4317.whisper-doc .hero-badges { display: flex; flex-wrap: wrap; gap: 6px; }
4318.whisper-doc .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 2rem; }
4319.whisper-doc .stat { background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 0.875rem 1rem; }
4320.whisper-doc .stat-label { font-size: 11px; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; font-family: var(--font-sans); }
4321.whisper-doc .stat-value { font-size: 20px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-mono); }
4322.whisper-doc .stat-sub { font-size: 11px; color: var(--color-text-secondary); margin-top: 2px; font-family: var(--font-sans); }
4323.whisper-doc .section { margin-bottom: 2.5rem; }
4324.whisper-doc .section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #E11D48; margin-top: 2rem; margin-bottom: 1rem; font-family: var(--font-sans); padding-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
4325.whisper-doc .step { border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; margin-bottom: 10px; overflow: hidden; background: #050506; }
4326.whisper-doc .step-header { display: flex; align-items: center; gap: 10px; padding: 0.75rem 1rem; background: #0c0d10; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
4327.whisper-doc .step-num { width: 24px; height: 24px; border-radius: 50%; background: #E11D48; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-mono); }
4328.whisper-doc .step-name { font-size: 13px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-sans); }
4329.whisper-doc .step-desc { font-size: 11px; color: var(--color-text-secondary); font-family: var(--font-sans); margin-left: auto; }
4330.whisper-doc .step-body { padding: 0.875rem 1rem; }
4331.whisper-doc .cmd { background: #050506; border: 1px solid rgba(255, 255, 255, 0.03); border-radius: 4px; padding: 0.625rem 0.875rem; font-size: 12px; color: #fff; font-family: var(--font-mono); margin-bottom: 6px; overflow-x: auto; white-space: nowrap; border-left: 3px solid #E11D48; }
4332.whisper-doc .note { font-size: 12px; color: var(--color-text-secondary); font-family: var(--font-sans); line-height: 1.6; margin-top: 4px; padding-left: 8px; border-left: 2px solid #E11D48; }
4333.whisper-doc .flag-table { width: 100%; border-collapse: collapse; font-size: 12px; }
4334.whisper-doc .flag-table th { text-align: left; padding: 8px 10px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-sans); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: #111215; }
4335.whisper-doc .flag-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-family: var(--font-mono); }
4336.whisper-doc .flag-table td:first-child { color: #fda4af; }
4337.whisper-doc .flag-table td:last-child { font-family: var(--font-sans); color: var(--color-text-secondary); }
4338.whisper-doc .flag-table tr:last-child td { border-bottom: none; }
4339.whisper-doc .perf-bar-wrap { margin: 0.5rem 0 1rem; background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); padding: 1rem; border-radius: 6px; }
4340.whisper-doc .perf-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
4341.whisper-doc .perf-row:last-child { margin-bottom: 0; }
4342.whisper-doc .perf-label { font-size: 12px; color: var(--color-text-secondary); width: 120px; flex-shrink: 0; font-family: var(--font-sans); text-align: right; }
4343.whisper-doc .perf-bar-bg { flex: 1; height: 8px; background: rgba(255, 255, 255, 0.03); border-radius: 4px; overflow: hidden; }
4344.whisper-doc .perf-bar { height: 100%; border-radius: 4px; }
4345.whisper-doc .perf-time { font-size: 12px; font-family: var(--font-mono); color: var(--color-text-primary); width: 70px; flex-shrink: 0; margin-left: 8px; }
4346.whisper-doc .lesson { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); align-items: flex-start; }
4347.whisper-doc .lesson:last-child { border-bottom: none; }
4348.whisper-doc .lesson-icon { font-size: 16px; flex-shrink: 0;
4348 margin-top: 1px; }
4349.whisper-doc .lesson-text { font-size: 12.5px; color: var(--color-text-secondary); font-family: var(--font-sans); line-height: 1.6; }
4350.whisper-doc .lesson-text strong { font-weight: 700; color: var(--color-text-primary); }
4351.whisper-doc .footer { text-align: center; font-size: 11px; color: #475569; font-family: var(--font-mono); padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, 0.05); margin-top: 2rem; }
4352.whisper-doc .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
4353@media (max-width: 600px) { .whisper-doc .two-col { grid-template-columns: 1fr; } }
4354.whisper-doc .env-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-size: 12px; }
4355.whisper-doc .env-row:last-child { border-bottom: none; }
4356.whisper-doc .env-key { color: var(--color-text-secondary); font-family: var(--font-sans); }
4357.whisper-doc .env-val { font-family: var(--font-mono); color: var(--color-text-primary); text-align: right; }
4358.whisper-doc .card-inner { background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 1rem 1.25rem; }
4359</style>
4360
4361  <div class="hero">
4362    <div class="hero-title"><span>whisper.cpp</span> + RX 580 via Vulkan</div>
4363    <div class="hero-sub">
4363Transcrição de áudio/vídeo com aceleração GPU AMD no Windows — usando Vulkan para rodar modelos Whisper direto na VRAM da RX 580. Uma GPU de 2017 botando pra trabalhar em 2026.</div>
4364    <div class="hero-badges">
4365      <span class="badge badge-gpu">AMD RX 580 8GB</span>
4366      <span class="badge badge-win">Windows + PowerShell</span>
4367      <span class="badge badge-ok">Vulkan Backend</span>
4368      <span class="badge badge-ok">large-v3-turbo</span>
4369      <span class="badge badge-warn">FFmpeg pré-req</span>
4370    </div>
4371  </div>
4372
4373  <div class="stat-grid">
4374    <div class="stat">
4375      <div class="stat-label">tempo total</div>
4376      <div class="stat-value">~5 min</div>
4377      <div class="stat-sub">para 15 min de vídeo</div>
4378    </div>
4379    <div class="stat">
4380      <div class="stat-label">VRAM usada</div>
4381      <div class="stat-value">2.6 GB</div>
4382<div class="stat-sub">von 8 GB verfügbar</div>
4383    </div>
4384    <div class="stat">
4385      <div class="stat-label">Speedup vs CPU</div>
4386      <div class="stat-value">~150×</div>
4387      <div class="stat-sub">vorher: 12h für 40min</div>
4388    </div>
4389    <div class="stat">
4390      <div class="stat-label">Modell</div>
4391      <div class="stat-value">1.6 GB</div>
4392      <div class="stat-sub">large-v3-turbo</div>
4393    </div>
4394  </div>
4395
4396  <div class="section">
4397    <div class="section-title">überprüfte Voraussetzungen</div>
4398    <div class="card-inner">
4399      <div class="env-row"><span class="env-key">Vulkan SDK</span><span class="env-val">glslc v2026.1</span></div>
4400      <div class="env-row"><span class="env-key">Git</span><span class="env-val">2.54.0.windows.1</span></div>
4401      <div class="env-row"><span class="env-key">CMake</span><span class="env-val">4.3.2</span></div>
4402      <div class="env-row"><span class="env-key">MSVC (Build Tools)</span><span class="env-val">14.52.36328 — VS 2026</span></div>
4403      <div class="env-row"><span class="env-key">GPU erkannt</span><span class="env-val">AMD Radeon RX 580 2048SP</span></div>
4404      <div class="env-row"><span class="env-key">FFmpeg</span><span class="env-val">2026-04-19 (Gyan full build)</span></div>
4405    </div>
4406    <p class="note" style="margin-top: 8px;">RX 580 in Vulkan prüfen: <span style="font-family:var(--font-mono); color:#fda4af;">vulkaninfo --summary</span> → AMD Radeon RX 580 2048SP sollte erscheinen</p>
4407  </div>
4408
4409  <div class="section">
4410    <div class="section-title">Kompilierung — Schritt für Schritt</div>
4411
4412    <div class="step">
4413      <div class="step-header">
4414        <div class="step-num">1</div>
4415        <div class="step-name">MSVC x64 Umgebung aktivieren</div>
4416        <div class="step-desc">bei jeder neuen Sitzung</div>
4417      </div>
4418      <div class="step-body">
4419        <div class="cmd">& "C:\\Program Files (x86)\\Microsoft Visual Studio\\18\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"</div>
4420        <p class="note">Muss bei jedem Öffnen eines neuen PowerShell-Fensters vor dem Kompilieren wiederholt werden. Erwartete Ausgabe: "Environment initialized for: 'x64'"</p>
4421      </div>
4422    </div>
4423
4424    <div class="step">
4425      <div class="step-header">
4426        <div class="step-num">2</div>
4427        <div class="step-name">Repository klonen</div>
4428        <div class="step-desc">~40 MB</div>
4429      </div>
4430      <div class="step-body">
4431        <div class="cmd">cd C:\\</div>
4432        <div class="cmd">git clone https://github.com/ggml-org/whisper.cpp</div>
4433        <div class="cmd">cd whisper.cpp</div>
4434      </div>
4435    </div>
4436
4437    <div class="step">
4438      <div class="step-header">
4439        <div class="step-num">3</div>
4440        <div class="step-name">cmake mit aktiviertem Vulkan</div>
4441        <div class="step-desc">kritische Flag: -DGGML_VULKAN=ON</div>
4442      </div>
4443      <div class="step-body">
4444        <div class="cmd">cmake -B build -DGGML_VULKAN=ON -DGGML_HIPBLAS=OFF -DGGML_HIP=OFF -DGGML_CUDA=OFF</div>
4445        <div class="cmd">cmake --build build --config Release -j4</div>
4446        <p class="note">Dauert ~5-10 Min. C4267/C4244 Warnungen sind normal — sie beeinträchtigen die Funktion nicht. Binärdateien befinden sich in build\\bin\\Release\\</p>
4447      </div>
4448    </div>
4449
4450    <div class="step">
4451      <div class="step-header">
4452        <div class="step-num">4</div>
4453        <div class="step-name">Modell large-v3-turbo herunterladen</div>
4454        <div class="step-desc">~1.6 GB</div>
4455      </div>
4456      <div class="step-body">
4457        <div class="cmd">Invoke-WebRequest -Uri "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo.bin" -OutFile "models\\ggml-large-v3-turbo.bin"</div>
4458        <p class="note">Andere Modelle: large-v3 (~6GB VRAM, bessere Qualität), medium (~2.5GB), small (~1GB)</p>
4459      </div>
4460    </div>
4461  </div>
4462
4463  <div class="section">
4464    <div class="section-title">Nutzung — kompletter Workflow mp4 → txt</div>
4465
4466    <div class="step">
4467      <div class="step-header">
4468        <div class="step-num" style="background:#1D9E75;">1</div>
4469        <div class="step-name">Audio mit FFmpeg extrahieren</div>
4470        <div class="step-desc">whisper liest unter Windows keine mp4 direkt</div>
4471      </div>
4472      <div class="step-body">
4473        <div class="cmd">ffmpeg -i "E:\\videos\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\videos\\video.wav"</div>
4474        <p class="note">-ar 16000 = 16kHz (erforderlich für Whisper) · -ac 1 = mono · -c:a pcm_s16le = unkomprimiertes WAV</p>
4475      </div>
4476    </div>
4477
4478    <div class="step">
4479      <div class="step-header">
4480        <div class="step-num" style="background:#1D9E75;">2</div>
4481        <div class="step-name">transkribieren / übersetzen</div>
4482        <div class="step-desc">GPU übernimmt den Rest</div>
4483      </div>
4484      <div class="step-body">
4485        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --output-txt</
4485div>
4486        <p style="font-size:12px; color:var(--color-text-secondary); margin: 6px 0 4px; font-family:var(--font-sans);">mit Übersetzung ins Englische:</p>
4487        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --translate --output-txt</div>
4488        <p class="note">--translate generiert immer Englisch (Einschränkung von Whisper). Für andere Zielsprachen ist ein zusätzlicher Übersetzungsschritt erforderlich.</p>
4489      </div>
4490    </div>
4491
4492    <div style="margin-top: 1rem;">
4493      <div class="section-title" style="margin-bottom: 0.75rem;">nützliche Flags</div>
4494      <div class="card-inner">
4495        <table class="flag-table">
4496          <thead><tr><th>Flag</th><th>Beschreibung</th></tr></thead>
4497          <tbody>
4498            <tr><td>-l pt</td><td>Quellsprache: Portugiesisch</td></tr>
4499            <tr><td>-l en</td><td>Quellsprache: Englisch</td></tr>
4500            <tr><td>--translate</td><td>übersetzt alles ins Englische</td></tr>
4501            <tr><td>--output-txt</td><td>speichert .txt mit Transkription</td></tr>
4502            <tr><td>--output-srt</td><td>speichert .srt Untertitel mit Zeitstempeln</td></tr>
4503            <tr><td>--output-vtt</td><td>speichert .vtt Untertitel</td></tr>
4504            <tr><td>-t 8</td><td>nutzt 8 CPU-Threads (Standard: 4)</td></tr>
4505            <tr><td>--device 0</td><td>wählt GPU 0 (Standard)</td></tr>
4506            <tr><td>--no-gpu</td><td>erzwingt CPU (langsamer Modus)</td></tr>
4507          </tbody>
4508        </table>
4509      </div>
4510    </div>
4511  </div>
4512
4513  <div class="section">
4514    <div class="section-title">Performance — 15 min Video</div>
4515    <div class="perf-bar-wrap">
4516      <div class="perf-row">
4517        <div class="perf-label">Modell laden</div>
4518        <div class="perf-bar-bg"><div class="perf-bar" style="width:1.3%; background:#E11D48;"></div></div>
4519        <div class="perf-time">4 s</div>
4520      </div>
4521      <div class="perf-row">
4522        <div class="perf-label">mel (Audio)</div>
4523        <div class="perf-bar-bg"><div class="perf-bar" style="width:0.4%; background:#E11D48;"></div></div>
4524        <div class="perf-time">1.2 s</div>
4525      </div>
4526      <div class="perf-row">
4527        <div class="perf-label">GPU-Kodierung</div>
4528        <div class="perf-bar-bg"><div class="perf-bar" style="width:23.7%; background:#1D9E75;"></div></div>
4529        <div class="perf-time">73 s</div>
4530      </div>
4531      <div class="perf-row">
4532        <div class="perf-label">Dekodierung + Batch</div>
4533        <div class="perf-bar-bg"><div class="perf-bar" style="width:54.7%; background:#1D9E75;"></div></div>
4534        <div class="perf-time">168 s</div>
4535      </div>
4536      <div class="perf-row">
4537        <div class="perf-label" style="font-weight:700; color:var(--color-text-primary);">Gesamt</div>
4538        <div class="perf-bar-bg"><div class="perf-bar" style="width:100%; background:#E11D48;"></div></div>
4539        <div class="perf-time" style="font-weight:700;">307 s</div>
4540      </div>
4541    </div>
4542    <p class="note">CPU bei ~5% während der gesamten Transkription. VRAM: 2.6 GB von 8 GB. Die GPU hat die Arbeit erledigt — die CPU konnte sich ausruhen.</p>
4543  </div>
4544
4545  <div class="section">
4546    <div class="section-title">Erkenntnisse aus den Abenteuern</div>
4547    <div class="card-inner">
4548      <div class="lesson">
4549        <div class="lesson-icon">⚠️</div>
4550<div class="lesson-text"><strong>WSL2 não expõe a RX 580 via Vulkan</strong> — usar sempre PowerShell/Windows nativo para aproveitar a GPU.</div>
4551      </div>
4552      <div class="lesson">
4553        <div class="lesson-icon">⚠️</div>
4554        <div class="lesson-text"><strong>Whisper não lê MP4 no Windows</strong> — sempre extrair o áudio com FFmpeg antes. Usar -ar 16000 -ac 1 -c:a pcm_s16le.</div>
4555      </div>
4556      <div class="lesson">
4557        <div class="lesson-icon">ℹ️</div>
4558        <div class="lesson-text"><strong>--translate só gera inglês</strong> — é limitação do Whisper, não da configuração. Para PT como destino, precisa de etapa extra.</div>
4559      </div>
4560      <div class="lesson">
4561        <div class="lesson-icon">ℹ️</div>
4562        <div class="lesson-text"><strong>vcvars64.bat precisa ser reativado</strong> a cada nova sessão do PowerShell antes de qualquer compilação.</div>
4563      </div>
4564      <div class="lesson">
4565        <div class="lesson-icon">✅</div>
4566        <div class="lesson-text"><strong>8 GB de VRAM em 2026 ainda é sólido</strong> — large-v3-turbo usa apenas 2.6 GB. GPU "velha" com VRAM decente bate GPU nova com 4 GB fácil.</div>
4567      </div>
4568      <div class="lesson">
4569        <div class="lesson-icon">✅</div>
4570        <div class="lesson-text"><strong>Warnings C4267/C4244 durante compilação são normais</strong> — conversões de tipo esperadas no código do ggml, não impactam funcionamento.</div>
4571      </div>
4572    </div>
4573  </div>
4574
4575  <div class="footer">
4576    RX 580 — velha de 580 anos, mas ainda na ativa 🚀 · Peripécias documentadas em junho/2026
4577  </div>
4578
4579</div>`},benchmarks:{id:"benchmarks",title:"23. BENCHMARKS REAIS DO LABORATÓRIO",desc:"Dados consolidados de telemetria medidos diretamente nos logs de inferência das duas arquiteturas.",meta:{version:"1.0.0",type:"benchmark",category:"hardware",subcategory:"benchmarks",difficulty:"beginner",estimated_time_min:15,tags:["telemetria","gpu-benchmarks","performance-history"],last_reviewed:"2026-07-01",relationships:{prerequisites:["guia"],previous:"guia",next:"cpu",related:["hardware","cpu"]}},html:`<div class="tbl"><table>
4580    <thead><tr><th>
4580Modo de Execução do Modelo</th><th>Arquitetura Alocada</th><th>Métrica Comercial Obtida</th><th>Status de Viabilidade</th></tr></thead>
4581    <tbody>
4582      <tr><td>Inferência de Texto Comum</td><td>CPU Xeon Pura (Sem Aceleração)</td><td>3 a 5 tokens por segundo</td><td>❌ Ineficiente / Respostas Lentas</td></tr>
4583      <tr class="hig"><td>Inferência de Texto Compilada</td><td>RX 580 8GB via Vulkan Backend</td><td>15 a 16 tokens por segundo</td><td>✅ Altamente Produtivo / Instantâneo</td></tr>
4584      <tr><td>Amostragem SD 1.5 (20 Steps)</td><td>ComfyUI Windows via DirectML</td><td>~450 segundos por imagem</td><td>❌ Instável / Descarte por Erro Crítico</td></tr>
4585      <tr class="hig"><td>Amostragem SD 1.5 (20 Steps)</td><td>stable-diffusion.cpp via Vulkan</td><td>72 segundos por imagem</td><td>✅ Otimizado / Resposta Rápida</td></tr>
4586    </tbody>
4587  </table></div>`},codacus:{id:"codacus",title:"33. MÉTODO CODACUS vs AIVisionsLab",desc:"Experimento das 5 flags que salvaram uma GTX 1060 — funcionam numa RX 580?",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:25,tags:["gtx-1060","metodo-codacus","nvidia-pascal"],last_reviewed:"2026-07-01",relationships:{prerequisites:["dadhacks"],previous:"dadhacks",next:"proximos",related:["dadhacks","amihart"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
4588  O canal Codacus publicou um vídeo de grande repercussão demonstrando como rodar um modelo de <strong>35B parâmetros numa GTX 1060 de 6GB</strong> usando 5 flags específicas do <code>llama.cpp</code>, saltando de 3.0 tokens/s no baseline para 17.0 tokens/s pós-otimizações. O AIVisionsLab testou essa hipótese na antiga <strong>RX 580 2048SP 8GB com Vulkan</strong> — comparando Windows e Linux nativo.
4589</p>
4590
4591<div class="tbl">
4592  <table>
4593    <thead>
4594      <tr>
4595        <th>Métrica / Configuração</th>
4596        <th>Setup Codacus (Ref)</th>
4597        <th>Setup AIVisionsLab</th>
4598      </tr>
4599    </thead>
4600    <tbody>
4601      <tr>
4602        <td><strong>GPU</strong></td>
4603        <td>Nvidia GTX 1060 6GB</td>
4604        <td>AMD Radeon RX 580 2048SP 8GB</td>
4605      </tr>
4606      <tr>
4607        <td><strong>Backend</strong></td>
4608        <td>CUDA</td>
4609        <td>Vulkan (Mesa RADV)</td>
4610      </tr>
4611      <tr>
4612        <td><strong>OS</strong></td>
4613        <td>Linux + Docker</td>
4614        <td>Windows 10 / Ubuntu 26.04</td>
4615      </tr>
4616      <tr>
4617        <td><strong>CPU</strong></td>
4618        <td>Intel Core i3-8100</td>
4619        <td>Intel Xeon E5-2690 v3 (12c/24t)</td>
4620      </tr>
4621      <tr>
4622        <td><strong>Modelo de Teste</strong></td>
4623        <td>Qwen3.6 35B-A3B Q4_K_M</td>
4624        <td>Qwen3.6 35B-A3B Q4_K_M (Mesmo modelo)</td>
4625      </tr>
4626    </tbody>
4627  </table>
4628</div>
4629
4630<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">O Impacto das 5 Flags no Vulkan AMD</h3>
4631
4632<div class="tbl">
4633  <table>
4634    <thead>
4635      <tr>
4636        <th>Flag Aplicada</th>
4637        <th>Impacto na GTX 1060 (CUDA)</th>
4638        <th>Impacto na RX 580 (Vulkan Windows)</th>
4639        <th>Impacto na RX 580 (Vulkan Linux Native)</th>
4640      </tr>
4641    </thead>
4642    <tbody>
4643      <tr>
4644        <td><strong>Baseline</strong></td>
4645        <td>3.0 tokens/s (-ngl 20)</td>
4646        <td><strong>7.62 tokens/s (-ngl 10)</strong></td>
4647        <td><strong>5.18 tokens/s (-ngl 20)</strong></td>
4648      </tr>
4649      <tr>
4650        <td><code>--override-tensor exps=CPU</code></td>
4651        <td>10.0 tokens/s (+233%)</td>
4652        <td>6.92 tokens/s (❌ -9%)</td>
4653        <td>4.62 tokens/s (❌ -11%)</td>
4654      </tr>
4655      <tr>
4656        <td><code>--no-mmap</code> (ou <code>-mmp 0</code>)</td>
4657        <td>13.5 tokens/s (+35%)</td>
4658        <td>7.44 tokens/s (❌ -2%)</td>
4659        <td>4.86 tokens/s (❌ -6%)</td>
4660      </tr>
4661      <tr>
4662        <td>Quantização KV cache (<code>-ctk/ctv</code>)</td>
4663        <td>17.0 tokens/s (+26%)</td>
4664        <td>7.58 tokens/s (❌ -1%)</td>
4665        <td><strong>5.41 tokens/s (✅ +4%)</strong></td>
4666      </tr>
4667      <tr>
4668        <td><code>--mlock</code> / ngl extra</td>
4669        <td>Estabilidade ampliada</td>
4670        <td>OOM acima de ngl 10 (❌)</td>
4671        <td>OOM acima de ngl 20 (❌)</td>
4672      </tr>
4673    </tbody>
4674  </table>
4675</div>
4676
4677<div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4">
4678  <h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Análise das Descobertas Técnicas</h4>
4679  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7">
4680    <strong>1. Modelo de Alocação de VRAM:</strong> Por que ngl 20 dava OOM no Windows mas passou no Linux? O driver proprietário da AMD no Windows aloca a memória de forma mais conservadora, enquanto o driver open-source <strong>Mesa RADV no Linux</strong> permite que mais layers sejam descarregados no buffer (teto máximo real de 20 layers vs 10 layers no Windows).
4681  </p>
4682  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem">
4683    <strong>2. Incompatibilidade de Backend:</strong> O roteamento <code>override-tensor exps=CPU</code> para isolar experts Mixtral/MoE da GPU funciona de forma espetacular em CUDA devido ao acesso PCIe de alta velocidade nativo da Nvidia. Sob o backend Vulkan, o overhead dessa movimentação destrói os ganhos de processamento.
4684  </p>
4685  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem">
4686    <strong>3. O Xeon Superior Compensou o Backend:</strong> Mesmo com menor otimização de VRAM, a infraestrutura da CPU Xeon E5-2690 v3 (24 threads) do AIVisionsLab garantiu um baseline original superior de 7.62 tokens/s — batendo os 3.0 tokens/s baselines do i3
4686-8100 do Codacus.
4687  </p>
4688</div>
4689
4690<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Comparativo Mistral 7B — CPU Pura vs Vulkan</h3>
4691<p style="font-size:.88rem;color:#94a3b8;line-height:1.9">
4692  Para demonstrar o valor bruto e absoluto do backend Vulkan em hardware legado Polaris:
4693</p>
4694<div class="code ok">
4695  <pre>💻 WSL2 Ubuntu (CPU Pura)  ·  24 threads  ·  1.79 tokens/s
4696🎮 Windows 10 (Vulkan GPU)  ·  12 threads  ·  18.54 tokens/s (⚡ 10x Mais Rápido!)</pre>
4697</div>
4698<blockquote style="font-size:.82rem;color:#64748b;font-style:italic;line-height:1.8;border-left:3px solid #E11D48;padding-left:.9rem;margin-top:1rem">
4699  "As 5 flags do Codacus funcionam perfeitamente para marcas NVIDIA + CUDA + Linux Docker. No ecossistema AMD + Vulkan, nossa própria receita é diferente mas incrivelmente sólida!"
4700</blockquote>`},"comfyui-directml-func":{id:"comfyui-directml-func",title:"17. FIXES DIRECTML",desc:"Installation des spezifischen Entwicklungs-Wheels zur Erzwingung der Betriebsstabilität.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-batch-fix","memoria-virtual","crash-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml"],previous:"comfyui-directml",next:"comfyui-flux",related:["comfyui-directml","scripts"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Falls vergleichende Tests auf der DirectML-Ebene ohne Initialisierungsabstürze durchgeführt werden müssen, ist ein erzwungenes Downgrade der Pakete unter Verwendung des Entwicklungs-Builds vom Mai 2024 erforderlich:</p>
4701  <div class="code"><pre># Comando para expurgar dependências conflitantes e instalar o dev wheel estável
4702pip uninstall torch torch-directml torchaudio
4703pip install torch==2.3.1+cpu --index-url https://download.pytorch.org/whl/cpu
4704pip install torch-directml==0.2.1.dev240521 --no-deps</pre></div>`},"comfyui-directml":{id:"comfyui-directml",title:"16. DIRECTML",desc:"Explicação técnica detalhada das falhas crônicas encontradas durante os testes na branch Windows.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fix","windows-driver","comfyui-windows"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-wsl"],previous:"comfyui-wsl",next:"comfyui-directml-func",related:["troubleshoot-comfyui","comfyui-portable-amd"]}},html:`<div class="err"><div class="err-t">Falha Estrutural — Incompatibilidade do Módulo CLIPTextEncode</div><p>Ao carregar os fluxos básicos de geração de imagem utilizando o instalador nativo DirectML para placas AMD, o console aborta a execução retornando a seguinte exceção impeditiva:</p><div class="code"><span class="code-lang">stderr</span><pre>File "comfy\\utils.py", line 245, in encode_token
4705NotImplementedError: Cannot access storage of OpaqueTensorImpl</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Análise de Engenharia:</strong> O driver DirectML encapsula os dados de memória em objetos conhecidos como <code>OpaqueTensorImpl</code>. Quando as funções internas de otimização de atenção matemática do ComfyUI tentam ler o conteúdo bruto desses tensores na memória física, a camada do ecossistema Microsoft bloqueia o acesso, interrompendo o pipeline de renderização.</p></div>`},"comfyui-flux":{id:"comfyui-flux",title:"18. KRITISCHE PARAMETRISIERUNG VON FLUX.1 SCHNELL",desc:"Obligatorische mathematische Konfiguration zur Verarbeitung des SOTA-Modells auf der CPU, ohne die RAM-Grenzwerte zu überschreiten.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:20,tags:["flux-fp8","comfyui-workflow","vram-allocation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml-func"],previous:"comfyui-directml-func",next:"comfyui-modelos",related:["flux_server","comfyui-modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Die Verarbeitung des 16GB FLUX.1 Schnell im CPU-Modus erfordert feste Sampling-Grenzwerte. Abweichungen von diesen Regeln führen aufgrund extremer Speichersättigung zum Systemabsturz:</p>
4706  <div class="tbl"><table>
4707    <thead><tr><th>
4707Sampling-Parameter</th><th>Obligatorischer Einstellwert</th><th>Technische Erläuterung auf Xeon</th></tr></thead>
4708    <tbody>
4709      <tr class="hig"><td>Sampling Steps</td><td>4 Steps</td><td>Das Schnell-Modell wurde entwickelt, um die Rauschkonvergenz in nur 4 Iterationen abzuschließen.</td></tr>
4710      <tr class="hig"><td>CFG Scale</td><td>1.0</td><td>Werte über 1.0 zerstören die Texturtreue und verzerren die Tensorverteilung.</td></tr>
4711      <tr><td>Scheduler Type</td><td>sgm_uniform</td><td>Gewährleistet die lineare Interpolation der Diffusionstensoren auf eine für AVX2-Befehle optimierte Weise.</td></tr>
4712    </tbody>
4713  </table></div>`},"comfyui-modelos":{id:"comfyui-modelos",title:"14. GESTÃO ZERO-COPY DE MODELOS NO NVMe",desc:"Técnica de links simbólicos para unificar o armazenamento de checkpoints pesados sem duplicar arquivos.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"armazenamento",difficulty:"intermediate",estimated_time_min:15,tags:["symlink","diretorios-compartilhados","espaco-disco"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-flux"],previous:"comfyui-flux",next:"animatediff-video",related:["arquivos","modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Para evitar o desperdício de espaço no drive SSD NVMe e eliminar a necessidade de manter cópias gigantes idênticas entre o Windows e o Linux (WSL2), cria-se um link simbólico direto apontando para o sistema de arquivos cruzado:</p>
4714  <div class="code"><span class="code-lang">bash</span><pre># Executar este bloco dentro do terminal do subsistema Linux Ubuntu
4715cd ~/ComfyUI/models/checkpoints/
4716
4717# Criar o ponto de ancoragem virtual espelhando o arquivo físico localizado na partição E: do Windows
4718ln -s "/mnt/e/ComfyUI_Models/checkpoints/flux1-schnell-fp8.safetensors" ./flux1-schnell-fp8.safetensors</pre></div>`},"comfyui-portable-amd":{id:"comfyui-portable-amd",title:"29. COMFYUI PORTÁTIL v0.3.48 — IMPLEMENTAÇÃO AMD",desc:"Configurações específicas e injeção de variáveis de ambiente para a arquitetura Polaris.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-portable","directml-setup","portable-workflow"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshoot-comfyui"],previous:"troubleshoot-comfyui",next:"comunidade",related:["comfyui-directml","comfyui-flux"]}},html:`<div class="card">
4719    <p style="font-size:.88rem;color:#94a3b8;line-height:1.9">Para implementações que utilizam pacotes portáteis pré-compilados do ComfyUI focados em compatibilidade AMD DirectML no Windows, o interpretador Python precisa de ajuda para identificar corretamente as capacidades de hardware da GPU antiga:</p>
4720    <div class="code"><span class="code-lang">batch</span><pre># Inserir no topo do arquivo run_nvidia_gpu.bat ou do script portátil customizado:
4721set HSA_OVERRIDE_GFX_VERSION=8.0.3
4722set DXVK_ASYNC=1
4723
4724.\\python_embeded\\python.exe main.py --directml</pre></div>
4725    <p style="margin-top:.5rem;font-size:.82rem;color:#64748b;line-height:1.6">O sinalizador <code>8.0.3</code> emula o ID de arquitetura de compilação necessário para que as bibliotecas numéricas processem tensores sem travar o barramento PCIe da série RX 500.</p>
4726  </div>`},"comfyui-wsl":{id:"comfyui-wsl",title:"15. COMFYUI WSL2",desc:"Configurando o ambiente Linux virtualizado para herdar o poder computacional do Xeon e RAM ECC.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"virtualizacao",difficulty:"advanced",estimated_time_min:30,tags:["wsl2-linux","comfyui-wsl","direct-vulkan"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_openwebui_integration"],previous:"sd_openwebui_integration",next:"comfyui-directml",related:["comfyui-flux","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Para contornar o limite de VRAM física da GPU em modelos massivos, o ComfyUI é instanciado dentro do subsistema Linux apontando a execução estritamente para os cores do processador:</p>
4727  <div class="code"><span class="code-lang">bash</span>
4727<pre># Ativar o ambiente virtual isolado via Miniconda no terminal do Ubuntu
4728conda activate comfy_env
4729
4730# Chamar o script principal forçando o uso do hardware de processamento central
4731python main.py --cpu --listen 0.0.0.0 --port 8188</pre></div>
4732  <div class="note info" style="margin-top:.75rem">O painel de nós do ComfyUI estará totalmente disponível no lado do Windows através da rota mapeada: <strong>http://localhost:8188</strong></div>`},comunidade:{id:"comunidade",title:"30. CONTEXTO E FONTES DA COMUNIDADE",desc:"Repositórios de conhecimento hacker e fóruns dedicados à preservação e otimização de hardware legado.",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"comunidade",difficulty:"beginner",estimated_time_min:10,tags:["comunidade-hacker","links-utiles","github-preservation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-portable-amd"],previous:"comfyui-portable-amd",next:"amihart",related:["amihart","dadhacks","codacus"]}},html:`<div class="card acc">
4733    <p style="font-size:.85rem;color:#94a3b8;line-height:1.9">A engenharia reversa e a viabilidade técnica deste laboratório baseiam-se em discussões de otimização documentadas por comunidades focadas na extração de performance máxima de componentes de baixo custo:</p>
4734    <ul style="padding-left:1.2rem;margin-top:.5rem;font-size:.85rem;color:#e2e8f0;line-height:2">
4735      <li>Comunidade Global de Engenharia de Servidores de Herança: <strong style="color:var(--r)">r/X99_Lab</strong></li>
4736      <li>Discussões de Otimização e Rimes de Compilação GGUF: <strong style="color:#fff">Github: ggerganov/llama.cpp/discussions</strong></li>
4737    </ul>
4738  </div>`},contexto:{id:"contexto",title:"01. CONTEXTO E PROBLEMA",desc:"Em 2026, a narrativa padrão era clara: RX 580 não roda IA. Análise dos ecossistemas travados e viabilidade de aceleração via Vulkan.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:10,tags:["obsolescencia-programada","hardware-livre","preservacao-silicio"],last_reviewed:"2026-07-01",relationships:{prerequisites:[],previous:"",next:"hardware",related:["solucao","jornada"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Em 2026, a narrativa padrão era clara: <strong style="color:#fff">RX 580 não roda IA</strong>. Os ecossistemas disponíveis eram:</p>
4739  <div class="tbl"><table>
4740    <thead><tr><th>Solução</th><th>Status para RX 580</th></tr></thead>
4741    <tbody>
4742      <tr><td>CUDA (Nvidia)</td><td>❌ Exclusivo Nvidia</td></tr>
4743      <tr><td>ROCm (AMD oficial)</td><td>❌ Removeu suporte a Polaris/GCN4 na versão 5.x</td></tr>
4744      <tr><td>DirectML (Microsoft)</td><td>❌ Abandonado antes de amadurecer — instável, lento</td></tr>
4745      <tr><td>OpenVINO (Intel)</td><td>❌ Incompatível com Forge no Windows</td></tr>
4746    </tbody>
4747  </table></div>
4748  <div class="tbl" style="margin-top:.9rem"><table>
4749    <thead><tr><th>Item</th><th>Status (antes da solução)</th></tr></thead>
4750    <tbody>
4751      <tr><td>LLM</td><td>CPU pura — 25 a 40 minutos por resposta</td></tr>
4752      <tr><td>Geração de imagens</td><td>ComfyUI via CPU — 50+ minutos por imagem no HDD</td></tr>
4753      <tr><td>RX 580</td><td>Ociosa, 0% de uso para IA</td></tr>
4754      <tr><td>Storage</td><td>HDD lento (gargalo crítico de I/O)</td></tr>
4755    </tbody>
4756  </table></div>
4757  <div class="card acc" style="margin-top:1.25rem">
4758    <blockquote style="font-size:.88rem;color:#94a3b8;font-style:italic;line-height:1.9;border-left:3px solid var(--r);padding-left:.9rem">"Polaris é obsoleta. Só serve pra mineração. AMD antiga não roda IA. Troca de placa."</blockquote>
4759    <p style="margin-top:.9rem;font-size:.88rem;color:#e2e8f0;font-weight:600">Essa crença era falsa. O poder computacional sempre esteve lá. O problema era o software, não o hardware.</p>
4760  </div>
4761  <p style="margin-top:1.25rem;font-size:.88rem;color:#94a3b8;line-height:1.9">O projeto <code style="color:var(--r)">ggml</code> (base do <code style="color:var(--r)">llama.cpp</code> and <code style="color:var(--r)">stable-diffusion.cpp</code>) usa Vulkan como backend de GPU — padrão aberto que funciona em qualquer GPU moderna. A RX 580 suporta Vulkan 1.x desde os drivers originais de 2017. ROCm e CUDA são desnecessários.</p>
4762  <p style="margin-top:.9rem;font-size:.88rem;color:#94a3b8;line-height:1.9">Para modelos maiores (FLUX.1 Schnell 16GB, por exemplo), a solução é rodar via <strong style="color:#fff">CPU Xeon + RAM ECC abundante</strong> através do ComfyUI no WSL2, com link simbólico para os modelos no Windows — sem duplicar arquivos, sem perder espaço.</p>`},cpu:{id:"cpu",title:"24. PARAMETRIZAÇÃO E AJUSTES DO XEON",desc:"Configurações de BIOS e limites estruturais de instruções fp32 para o processador LGA 2011-3.",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"processadores",difficulty:"intermediate",estimated_time_min:18,tags:["bios-tuning","avx-optimization","intel-xeon-tuning"],last_reviewed:"2026-07-01",relationships:{prerequisites:["benchmarks"],previous:"benchmarks",next:"troubleshooting",related:["hardware","benchmarks"]}},html:`<div class="card acc">
4763    <p style="font-size:.88rem;color:#e2e8f0;font-weight:600;line-height:1.6">Diretrizes Técnicas para Processadores Xeon de Microarquitetura Haswell (v3):</p>
4764    <p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">O processador Intel Xeon E5-2690 v3 lançado em 2014 possui suporte nativo ao conjunto de instruções vetoriais <strong style="color:#fff">AVX2</strong>. No entanto, ele não possui hardware dedicado para cálculos matemáticos de precisão reduzida em <strong style="color:var(--r)">FP16 (Half-Precision)</strong>.</p>
4765    <p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">Ao instanciar os loaders de modelos dentro do ComfyUI no Linux, certifique-se de configurar a precisão de cálculo para <strong style="color:#22c55e">FP32 (Single-Precision)</strong>. Caso force a execução em FP16, o processador precisará emular as instruções via software, reduzindo a velocidade de processamento pela metade.</p>
4766  </div>`},dadhacks:{id:"dadhacks",title:"32. MÉTODO DADHACKS — AI IMAGE GENERATION ON RX 580 USING VULKAN: A COST-EFFECTIVE SOLUTION",desc:"Análise da consolidação experimental realizada por DH (DadHacks) em dezembro de 2025, estabelecendo caminhos de compatibilidade para geração de imagens na GPU legado.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"intermediate",estimated_time_min:20,tags:["dadhacks-method","estetica-baixo-custo","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["amihart"],previous:"amihart",next:"codacus",related:["amihart","codacus"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Em 05 de dezembro de 2025, o desenvolvedor <strong style="color:#fff">DH (DadHacks)</strong> publicou um guia técnico inovador no site <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline">dadhacks.org</a> demonstrando que a GPU AMD RX 580 de 8GB é perfeitamente viável para geração de IA moderna sem depender de soluções de softw
4766are proprietárias ou do ROCm.</p>
4767
4768  <div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);margin-bottom:1.25rem">
4769    <strong style="color:#fff;display:block;margin-bottom:.4rem">📌 Resultados da Validação Técnica:</strong>
4770    <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">O estudo de DadHacks demonstrou de forma experimental que é viável executar o Stable Diffusion via Vulkan, refinando a conclusão preliminar de janeiro de 2025. A maturidade gradual do ecossistema do <code>stable-diffusion.cpp</code> ampliou as taxas de transferência até o fim de 2025.</p>
4771  </div>
4772
4773  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. Compilação do Motor — stable-diffusion.cpp</h4>
4774  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">DH detalhou o fluxo de compilação no Linux utilizando a flag compiladora nativa <code>-DSD_VULKAN=ON</code>:</p>
4775  <div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># Clonar de forma recursiva (obrigatório para trazer submódulos do ggml)
4776git clone --recursive https://github.com/leejet/stable-diffusion.cpp
4777cd stable-diffusion.cpp && mkdir build && cd build
4778
4779# Configurar CMake usando Vulkan ativado
4780cmake .. -DSD_VULKAN=ON
4781
4782# Compilar binários
4783cmake --build . --config Release</pre></div>
4784
4785  <p style="font-size:.82rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">🧬 <strong>Divergência de Flags Documentada:</strong> O DadHacks usou <code>-DSD_VULKAN=ON</code> (camada de aplicação), enquanto o AIVisionsLab homologou <code>-DGGML_VULKAN=ON</code> (camada de engine de tensores). Ambas geram o mesmo binário eficiente na prática, mas referenciam caminhos diferentes da evolução do repositório leejet.</p>
4786
4787  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. Comandos de Geração Originais (DadHacks)</h4>
4788  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Demonstração original de chamada offline via terminal para Flux Schnell (modelo quantizado de 4-bits) e Flux Dev, usando segmentação de memória para poupar VRAM:</p>
4789  <div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># Executar Flux Schnell (4 steps de amostragem)
4790sd --diffusion-model SD-Models/flux1-schnell-q4_0.gguf \\
4791   --vae SD-Models/ae.safetensors \\
4792   --clip_l SD-Models/clip_l.safetensors \\
4793   --t5xxl SD-Models/t5xxl_fp16.safetensors \\
4794   -p "a lovely beagle holding a sign says 'hello'" \\
4795   --cfg-scale 1.0 \\
4796   --sampling-method euler \\
4797   -v --steps 4 \\
4798   --clip-on-cpu</pre></div>
4799
4800  <div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin-bottom:1.25rem">
4801    <strong style="color:#ef4444;display:block;margin-bottom:.4rem">🚨 ALERTA CRÍTICO: Incompatibilidade GGUF (Descoberta AIVisionsLab)</strong>
4802    <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">O DadHacks não listou uma incompatibilidade de formato muito comum: pesos GGUF publicados pelo mantenedor <strong>city96</strong> são compatíveis <em>apenas</em> com o ComfyUI. Para execução no stable-diffusion.cpp / sd-server, é obrigatório utilizar os modelos publicados oficialmente pelo mantenedor <strong>leejet</strong> (ex: <code style="color:#fff">FLUX.1-schnell-gguf</code>).</p>
4803  </div>
4804
4805  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">C. O Que o DadHacks Não Cobriu (Que o AIVisionsLab Expandiu)</h4>
4806  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">O guia original de DadHacks focou no ecossistema Linux/terminal com comandos manuais. O AIVisionsLab expandiu agressivamente essa base técnica:</p>
4807  <table style="width:100%;border-collapse:collapse;font-size:.78rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem;border:1px solid var(--b)">
4808    <thead>
4809      <tr style="background:rgba(255,255,255,0.02);color:#fff;border-bottom:1px solid var(--b)">
4810        <th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">Funcionalidade</th>
4811        <th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">DadHacks (Linux)</th>
4812        <th style="padding:.5rem;text-align:left">AIVisionsLab (Windows Nativo)</th>
4813      </tr>
4814    </thead>
4815    <tbody>
4816      <tr style="border-bottom:1px solid var(--b)">
4817        <td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Hospedagem no Windows</td>
4818        <td style="padding:.5rem;border-right:1px solid var(--b)">❌ Não abordada</td>
4819        <td style="padding:.5rem;color:#22c55e">✅ Mapeamento via MSVC / Cmd executáveis</td>
4820      </tr>
4821      <tr style="border-bottom:1px solid var(--b)">
4822        <td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Integração Gráfica</td>
4823        <td style="padding:.5rem;border-right:1px solid var(--b)">❌ Apenas terminal CLI</td>
4824        <td style="padding:.5rem;color:#22c55e">✅ Servidor API + OpenWebUI / Docker link</td>
4825      </tr>
4826      <tr style="border-bottom:1px solid var(--b)">
4827        <td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Automação .bat</td>
4828        <td style="padding:.5rem;border-right:1px solid var(--b)">❌ Scripts manuais shell</td>
4829        <td style="padding:.5rem;color:#22c55e">✅ Scripts automáticos double-click no Desktop</td>
4830      </tr>
4831      <tr>
4832        <td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Segurança VRAM</td>
4833        <td style="padding:.5rem;border-right:1px solid var(--b)">⚠️ Limitação a base CLI</td>
4834        <td style="padding:.5rem;color:#22c55e">✅ Otimizações com VAE Tiling contra bugs OOM</td>
4835      </tr>
4836    </tbody>
4837  </table>
4838
4839  <div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem">
4840    <strong style="color:var(--r)">Crédito Comunitário Extensivo:</strong>
4840 Seção documental baseada na publicação original de <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">DH (DadHacks)</a>, intitulada <em>"AI Image Generation on RX 580 Using Vulkan"</em>. O conhecimento é livre e evolutivo.
4841  </div>`},falhas:{id:"falhas",title:"03. O QUE NÃO FUNCIONOU (O CEMITÉRIO TÉCNICO)",desc:"Análise detalhada de erros: os motivos técnicos da rejeição do DirectML nativo, OpenVINO e ROCm.",meta:{version:"1.0.0",type:"estudo_caso",category:"troubleshooting",subcategory:"historico",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fail","rocm-amd","openvino-intel"],last_reviewed:"2026-07-01",relationships:{prerequisites:["hardware"],previous:"hardware",next:"solucao",related:["troubleshooting","comfyui-directml"]}},html:`<div class="err">
4842    <div class="err-t">3.1 DirectML + ComfyUI Windows Nativo — ABANDONADO</div>
4843    <p><strong style="color:#e2e8f0">Tentativas:</strong> Invocação via <code>torch-directml</code> e flag <code>--directml</code>. O ecossistema foi detectado como <code>privateuseone0</code>, mas revelou instabilidade crônica devido à falta de atualizações estruturais da Microsoft.</p>
4844    <p style="margin-top:.45rem"><strong style="color:#e2e8f0">Logs de Erro Críticos:</strong></p>
4845    <div class="code"><span class="code-lang">stderr</span><pre>WARNING: torch-directml barely works, is very slow, has not been updated in over 1 year and might be removed soon, please don't use it.
4846
4847OSError: [WinError 127] Não foi possível encontrar o procedimento especificado
4848# Causado por um mismatch de DLL entre o torchaudio e a build de CPU do torch 2.4.1
4849
4850NotImplementedError: Cannot access storage of OpaqueTensorImpl
4851# CLIPTextEncode quebra ao tentar manipular tensores opacos gerados pelo DirectML</pre></div>
4852    <p style="margin-top:.45rem"><strong style="color:#e2e8f0">Causa Raiz:</strong> O DirectML gera tensores opacos incapazes de se comunicar com os backends de atenção modernos do ComfyUI. Além disso, o instalador força a importação do <code>torchaudio</code> dentro do módulo <code>audio_vae.py</code>, quebrando a inicialização mesmo que você não use áudio.</p>
4853  </div>
4854  <div class="err" style="margin-top:1rem">
4855    <div class="err-t">3.2 OpenVINO + Stable Diffusion Forge</div>
4856    <p><strong style="color:#e2e8f0">Tentativa:</strong> Acoplamento da extensão <code>sd-webui-openvino</code> desenvolvida pela Intel dentro do ecossistema Forge.</p>
4857    <div class="code"><span class="code-lang">stderr</span><pre>ModuleNotFoundError: No module named 'ldm'
4858ModuleNotFoundError: No module named 'sgm'
4859Error build_unet: Invalid backend: 'openvino'</pre></div>
4860    <p style="margin-top:.45rem"><strong style="color:#e2e8f0">Causa Raiz:</strong> A extensão foi desenhada para a arquitetura antiga do Automatic1111. Como o Forge reestruturou completamente o código e substituiu os módulos nativos de <code>ldm</code> e <code>sgm</code>, a injeção do backend OpenVINO falha por completo.</p>
4861  </div>
4862  <div class="err" style="margin-top:1rem">
4863    <div class="err-t">3.3 ROCm — Inviável por Design em Polaris</div>
4864    <ul>
4865      <li>A AMD encerrou oficialmente o suporte à arquitetura GCN4 (Polaris/RX 580) nas branches modernas do ROCm (v5.x+).</li>
4866      <li>Inexistência de suporte oficial para ROCm nativo em ambiente Windows.</li>
4867      <li>Camadas de compatibilidade via WSL2 para placas antigas geram Kernel Panics constantes em inferências de alta carga.</li>
4868    </ul>
4869  </div>
4870  <div class="err" style="margin-top:1rem">
4871    <div class="err-t">3.4 WebUI Forge em CPU Pura (HDD)</div>
4872    <p><strong style="color:#e2e8f0">Métricas:</strong> Startup time de 85 segundos. Tempo de renderização insustentável de ~19 minutos por imagem simples (512x512, 20 steps). O gargalo do HDD em concorrência com o gerenciamento de paginação do <code>memory_management.py</code> tornou o setup impraticável.</p>
4873  </div>`},"flux-vulkan":{id:"flux-vulkan",title:"25. EXPLORAÇÃO COMPLEMENTAR: FLUX VIA VULKAN",desc:"Aceleração alternativa de modelos Flux utilizando quantizações ultra-compactas em C++.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["flux-vulkan","cpp-native-inference","amd-acceleration"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshooting"],previous:"troubleshooting",next:"troubleshoot-comfyui",related:["flux_server","sdxl_vulkan"]}},html:`<div class="card">
4874    <p style="font-size:.88rem;color:#94a3b8;line-height:1.9">Embora o checkpoint nativo do FLUX.1 de 16GB exija o processamento robusto da CPU Xeon, é totalmente viável realizar inferências diretamente na GPU RX 580 utilizando o binário do <code>stable-diffusion.cpp</code> acoplado com quantizações agressivas de 3-bits:</p>
4875    <div class="note info" style="margin-top:.5rem">Peso Recomendado para Testes VRAM: <strong>flux1-schnell-Q3_K_S.gguf (~5.2GB)</strong>. Esta variação se acomoda com folga dentro do limite físico de 8GB da placa Polaris, entregando gerações SOTA aceleradas por hardware.</div>
4876  </div>`},flux_server:{id:"flux_server",title:"11. RODAR FLUX NO SD-SERVER (GPU + CPU HÍBRIDO)",desc:"Mapeamento e inicialização do ecossistema Flux de 12B parâmetros com arquitetura de memória segmentada.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"advanced",estimated_time_min:30,tags:["flux-schnell","servidor-imagem","gerenciamento-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdserver"],previous:"sdserver",next:"sd_bat_automation",related:["comfyui-flux","flux-vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O Flux exige segmentação precisa entre VRAM e RAM host. Utilizando as flags <code>--vae-on-cpu</code> e <code>--vae-tiling</code>, evitamos o estouro de memória (OOM) na RX 580 2048SP. O T5XXL (fp16) e o VAE residem na RAM; o modelo de difusão ocupa a VRAM.</p>
4877  <div class="tbl">
4878    <table>
4879      <thead>
4880        <tr><th>Componente</th><th>Arquivo Homologado</th><th>Alocação Final</th><th>Tamanho</th></tr>
4881      </thead>
4882      <tbody>
4883        <tr><td>Diffusion Model</td><td><code>flux1-schnell-q4_k.gguf</code></td><td><strong>GPU (VRAM)</strong></td><td>~6.5 GB</td></tr>
4884        <tr><td>VAE</td><td><code>ae.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~160 MB</td></tr>
4885        <tr><td>CLIP L</td><td><code>clip_l.safetensors</code></td><td><strong>GPU (VRAM)</strong></td><td>~235 MB</td></tr>
4886        <tr><td>T5XXL</td><td><code>t5xxl_fp16.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~9.3 GB</td></tr>
4887      </tbody>
4888    </table>
4889  </div>
4890  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-top:1.25rem">⚠️ <strong style="color:#fff">Notas de Estabilidade:</strong> A remoção da flag <code>--timeout</code> (não suportada pela versão atual) e a inclusão de <code>--vae-tiling</code> eliminaram os erros de <em>DeviceMemoryAllocation</em>. O uso de RAM total chega a ~9.5 GB (T5XXL fp16). Para economizar RAM, substituir por <code>t5xxl_fp8</code> reduz para ~5 GB.</p>
4891  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Comando de Produção (iniciar.bat):</strong></p>
4892  <pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
4893  --diffusion-model "E:\\ia_storage\\models\\Stable-diffusion\\flux1-schnell-q4_k.gguf" ^
4894  --vae "E:\\ia_storage\\models\\Stable-diffusion\\ae.safetensors" ^
4895  --clip_l "E:\\ia_storage\\models\\Stable-diffusion\\clip_l.safetensors" ^
4896  --t5xxl "E:\\ia_storage\\models\\Stable-diffusion\\t5xxl_fp16.safetensors" ^
4897  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre>
4898  <div class="tbl" style="margin-top:1.25rem; margin-bottom:1.25rem">
4899    <table>
4900      <thead>
4901        <tr><th>Etapa</th><th>Tempo Real</th></tr>
4902      </thead>
4903      <tbody>
4904        <tr><td>Condicionamento (T5XXL)</td><td>11.49s</td></tr>
4905        <tr><td>Sampling — 4 steps @ 1024x1024</td><td>~838s (~14 min)</td></tr>
4906        <tr><td>VAE Decode — 9 tiles</td><td>40.45s</td></tr>
4907        <tr><td><strong>Total por imagem</strong></td><td><strong>~838s (~14 min)</strong></td></tr>
4908      </tbody>
4909    </table>
4910  </div>
4911  <div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;">
4912    <span style="color:#22c55e; font-weight:bold">✅ STATUS: SERVIDOR EM PRODUÇÃO — IMAGEM GERADA COM SUCESSO</span><br>
4913    <span style="font-size:.8rem; color:#94a3b8">Listening on http://0.0.0.0:7860 | VRAM: 7.6/8.0 GB | RAM: ~9.5 GB | GPU: RX 580 2048SP | Temp: 66°C</span>
4914  </div>`}
4914,guia:{id:"guia",title:"22. GUIA ESTRATÉGICO POR CASO DE USO",desc:"Matriz de tomada de decisão: quando direcionar o processamento para a GPU ou para o Xeon.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:12,tags:["decision-making","workflows","hardware-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["scripts"],previous:"scripts",next:"benchmarks",related:["contexto","benchmarks"]}},html:`<div class="tbl"><table>
4915    <thead><tr><th>Objetivo do Workflow</th><th>Modelo Recomendado</th><th>Backend Alocado</th><th>Métrica Real de Geração</th></tr></thead>
4916    <tbody>
4917      <tr class="hig"><td>Chat de Texto e Assistência Local</td><td>Mistral 7B / Llama 3 8B GGUF</td><td>GPU RX 580 (Vulkan)</td><td>Alta Performance (15-16 tokens/s) ⚡</td></tr>
4918      <tr class="hig"><td>Geração de Imagens Veloz (512x512)</td><td>DreamShaper 8 (SD 1.5 GGUF)</td><td>GPU RX 580 (Vulkan)</td><td>Renderização Fluida (~72 segundos)</td></tr>
4919      <tr><td>Criação de Alta Resolução e Detalhe SOTA</td><td>FLUX.1 Schnell (16GB Weights)</td><td>CPU Xeon (WSL2)</td><td>Processamento Pesado (~24 minutos)</td></tr>
4920      <tr><td>Interpolação de Quadros e Animação Video</td><td>AnimateDiff Pipeline Standard</td><td>CPU Xeon (WSL2)</td><td>Processamento Estável (~141 segundos)</td></tr>
4921    </tbody>
4922  </table></div>`},hardware:{id:"hardware",title:"02. HARDWARE DO LABORATÓRIO",desc:"Configuração Master detalhada: Xeon E5-2690 v3, RX 580 8GB, 32GB RAM ECC e o impacto crítico do NVMe.",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"especificacoes",difficulty:"beginner",estimated_time_min:12,tags:["amd-polar","rx-580","intel-xeon","ram-ecc"],last_reviewed:"2026-07-01",relationships:{prerequisites:["contexto"],previous:"contexto",next:"falhas",related:["cpu","benchmarks"]}},html:`<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:.85rem;margin-bottom:1.25rem">
4923    <div class="stat"><div class="stat-icon">🖥️</div><div><div class="stat-lbl">GPU</div><div class="stat-val" style="font-size:.82rem">RX 580 2048SP</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">8GB GDDR5 VRAM</div></div></div>
4924    <div class="stat"><div class="stat-icon">⚙️</div><div><div class="stat-lbl">CPU</div><div class="stat-val" style="font-size:.82rem">Xeon E5-2690 v3</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">12c/24t · 3.5GHz boost</div></div></div>
4925    <div class="stat"><div class="stat-icon">💾</div><div><div class="stat-lbl">RAM</div><div class="stat-val" style="font-size:.82rem">32GB DDR4 REG ECC</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Quad Channel RDIMM</div></div></div>
4926    <div class="stat"><div class="stat-icon">📀</div><div><div class="stat-lbl">Storage</div><div class="stat-val" style="font-size:.82rem">NVMe E: 1TB</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">1.7–3.5 GB/s leitura</div></div></div>
4927    <div class="stat"><div class="stat-icon">🖥️</div><div><div class="stat-lbl">OS</div><div class="stat-val" style="font-size:.82rem">Windows 10 Pro</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">WSL2 Ubuntu 22.04.5</div></div></div>
4928    <div class="stat"><div class="stat-icon">🔧</div><div><div class="stat-lbl">Driver AMD</div><div class="stat-val" style="font-size:.82rem">31.0.21924.61</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Amdnolk (11/12/2025)</div></div></div>
4929  </div>
4930  <div class="tbl"><table>
4931    <thead><tr><th>Componente</th><th>Especificação no Ambiente</th></tr></thead>
4932    <tbody>
4933      <tr><td>Placa-mãe</td><td>Machinist MR9A Pro (Chipset X99, LGA 2011-3)</td></tr>
4934      <tr><td>Storage Secundário</td><td>HDD C: (Gargalo de I/O — modelos mantidos no NVMe E:)</td></tr>
4935      <tr><td>Kernel WSL2</td><td>6.6.87.2-microsoft-standard-WSL2</td></tr>
4936      <tr><td>Vulkan SDK</td><td>1.4.341.1</td></tr>
4937      <tr><td>CMake</td><td>4.3.2</td></tr>
4938      <tr><td>Visual Studio</td><td>2022/2026 Community (MSVC 19.50)</td></tr>
4939      <tr><td>Python (WSL2)</td><td>3.11.15</td></tr>
4940      <tr><td>PyTorch (WSL2)</td><td>2.4.1+cu121</td></tr>
4941      <tr><td>ComfyUI Versões</td><td>0.19.3 (WSL2 CPU) | 0.21.0 (Windows DirectML)</td></tr>
4942    </tbody>
4943  </table></div>
4944  <div class="card" style="margin-top:.9rem">
4945    <p style="font-size:.85rem;color:#64748b;line-height:1.9"><strong style="color:#fff">RX 580 2048SP:</strong> Variante com 2048 Shader Processors (vs 2304SP original). Placa extremamente comum de mineração que performa de forma impecável via Vulkan.</p>
4946    <p style="font-size:.85rem;color:#64748b;line-height:1.9;margin-top:.65rem"><strong style="color:#fff">NVMe vs HDD:</strong> A mudança para o NVMe reduziu o carregamento do LLM de 25 minutos para 4 minutos. No caso do FLUX (16GB), o carregamento caiu de 25 minutos no HDD para apenas ~30 segundos no NVMe. <strong style="color:var(--r)">O storage é tão crítico quanto a capacidade de processamento.</strong></p>
4947    <p style="font-size:.85rem;color:#64748b;line-height:1.9;margin-top:.65rem"><strong style="color:#fff">32GB REG ECC:</strong> Operando com o FLUX.1 Schnell FP8, o sistema consome 94% da memória disponível de forma contínua. A RAM de servidor ECC mantém estabilidade absoluta e evita corrupção de tensores s
4947ob carga extrema.</p>
4948  </div>`},jornada:{id:"jornada",title:"06. JORNADA COMPLETA — AS 5 FASES",desc:"A linha do tempo do laboratório: da lentidão inicial da CPU ao controle total do hardware de herança.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:10,tags:["linha-tempo","conquistas","roadmap"],last_reviewed:"2026-07-01",relationships:{prerequisites:["prereqs"],previous:"prereqs",next:"llama",related:["linhatempo","proximos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.75rem">O sucesso técnico do ecossistema local foi alcançado através de 5 marcos evolutivos e decisões estratégicas de hardware:</p>
4949  <div class="phase">
4950    <div class="phase-num">01</div>
4951    <div class="phase-body">
4952      <div class="phase-hdr"><span class="phase-title">WebUI Forge em CPU Pura (HDD)</span><span class="lbl lbl-b">BASELINE INICIAL</span></div>
4953      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Primeira infraestrutura funcional. Boot demorado de 85 segundos e tempos de renderização batendo ~19 minutos por imagem. Sistema completamente inviável para uso produtivo.</p>
4954    </div>
4955  </div>
4956  <div class="phase">
4957    <div class="phase-num">02</div>
4958    <div class="phase-body">
4959      <div class="phase-hdr"><span class="phase-title">Aceleração de LLM via Vulkan (RX 580)</span><span class="lbl lbl-r">BREAKTHROUGH TÉCNICO</span></div>
4960      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Compilação bem-sucedida do llama.cpp ativando a flag <code>-DGGML_VULKAN=ON</code>. O motor passou a identificar a placa de vídeo Polaris nativamente, saltando a taxa de inferência de 3-5 t/s para expressivos 15-16 t/s.</p>
4961    </div>
4962  </div>
4963  <div class="phase">
4964    <div class="phase-num">03</div>
4965    <div class="phase-body">
4966      <div class="phase-hdr"><span class="phase-title">Migração de Armazenamento Centralizado para NVMe</span><span class="lbl lbl-y">MARCO DECISIVO</span></div>
4967      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Substituição do HDD mecânico pelo drive NVMe de alta velocidade (1.7–3.5 GB/s). O tempo de carga na memória do modelo de linguagem caiu de 25 minutos para apenas 4 minutos, eliminando o principal gargalo de I/O do laboratório.</p>
4968    </div>
4969  </div>
4970  <div class="phase">
4971    <div class="phase-num">04</div>
4972    <div class="phase-body">
4973      <div class="phase-hdr"><span class="phase-title">stable-diffusion.cpp nativo via Vulkan</span><span class="lbl lbl-g">OBJETIVO GPU CONCLUÍDO ✅</span></div>
4974      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Primeira imagem renderizada localmente utilizando 100% da GPU RX 580 no ambiente Windows. Ciclo de geração do modelo de pesos quânticos SD 1.5 GGUF estabilizado na marca de ~72 segundos.</p>
4975    </div>
4976  </div>
4977  <div class="phase">
4978    <div class="phase-num">05</div>
4979    <div class="phase-body">
4980      <div class="phase-hdr"><span class="phase-title">Escalonamento do FLUX.1 Schnell via Xeon + RAM ECC</span><span class="lbl lbl-b">EXPANSÃO DE CAPACIDADE ✅</span></div>
4981      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Implementação estável do modelo SOTA de 16GB rodando no processador de servidor. Prova empírica de que uma infraestrutura corporativa de 2014 consegue processar de forma robusta inteligências artificiais de última geração de 2026.</p>
4982    </div>
4983  </div>`},limit_qwen_35b:{id:"limit_qwen_35b",title:"41. LEVANDO AO LIMITE QWEN3.5 35B Q6_K NA RX 580 8GB VIA VULKAN",desc:"Experimento de execução híbrida extrema de um modelo de 34.66B de parâmetros na GPU Polaris e Xeon de 2014.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:45,tags:["qwen-35b","offloading-extremo","vram-spillover"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_srt_ptbr"],previous:"audio_srt_ptbr",next:"proving_hypothesis_35b",related:["proving_hypothesis_35b","llama"]},part:1}
4983,html:`<div class="whisper-doc">
4984  <div class="hero">
4985    <div class="hero-title"><span>Leve ao Limite</span> — Qwen3.5 35B na RX 580</div>
4986    <div class="hero-sub">Experimento de execução híbrida extrema de um modelo de <strong>34,66B parâmetros</strong> na GPU de 8GB de VRAM e Xeon de 2014 via motor Vulkan.</div>
4987    <div class="hero-badges">
4988      <span class="badge badge-gpu">AMD RX 580 8GB</span>
4989      <span class="badge badge-win">Xeon E5-2690 v3</span>
4990      <span class="badge badge-ok">Vulkan Híbrido</span>
4991      <span class="badge badge-ok">34.66B parameters</span>
4992      <span class="badge badge-win">Q6_K Quantization</span>
4993    </div>
4994  </div>
4995
4996  <div class="stat-grid">
4997    <div class="stat">
4998      <div class="stat-label">Velocidade Geração</div>
4999      <div class="stat-value">5.64 tok/s</div>
5000      <div class="stat-sub">Sessão 2 (Estável)</div>
5001    </div>
5002    <div class="stat">
5003      <div class="stat-label">Prompt Eval</div>
5004      <div class="stat-value">34.13 tok/s</div>
5005      <div class="stat-sub">Tempo resposta ~107s</div>
5006    </div>
5007    <div class="stat">
5008      <div class="stat-label">Temperatura Máxima</div>
5009      <div class="stat-value">80°C</div>
5010      <div class="stat-sub">Sem Throttling (Alvo: 90°C)</div>
5011    </div>
5012    <div class="stat">
5013      <div class="stat-label">Custo Adicional</div>
5014      <div class="stat-value">R$ 0,00</div>
5015      <div class="stat-sub">Execução 100% local</div>
5016    </div>
5017  </div>
5018
5019  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.0 — Contexto e Motivação</h3>
5020  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5021    Em 15 de junho de 2026, o AIVisionsLab conduziou o experimento mais extremo da sua história: rodar um modelo de <strong>34,66 bilhões de parâmetros</strong> em modo híbrido numa GPU AMD Radeon RX 580 2048SP de 2017 com apenas 8GB de VRAM.
5022  </p>
5023  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
5024    "Se a RX 580 já roda Qwen3 4B a 35 tokens/s via Vulkan, até onde vai o limite?"
5025  </blockquote>
5026  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5027    A resposta documentada abaixo prova que o limite não é onde o mercado de hardware diz que é.
5028  </p>
5029
5030  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.1 — Hardware do Laboratório</h3>
5031  <div class="tbl">
5032    <table>
5033      <thead>
5034        <tr>
5035          <th>Componente</th>
5036          <th>Especificação</th>
5037        </tr>
5038      </thead>
5039      <tbody>
5040        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 cores / 24 threads · 3,05 GHz turbo (Lançado em 2014)</td></tr>
5041        <tr><td><strong>RAM</strong></td><td>31,8 GB DDR4 REG ECC (quad-channel)</td></tr>
5042        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (Lançado em 2017)</td></tr>
5043        <tr><td><strong>Storage 1</strong></td><td>SSD NVMe (Disco E:) — modelos GGUF (Leitura de 1.7–3.5 GB/s)</td></tr>
5044        <tr><td><strong>Storage 2</strong></td><td>HDD (Disco C: / F:) — sistema Windows + swap</td></tr>
5045        <tr><td><strong>Storage 3</strong></td><td>HDD (Disco D:) — arquivos secundários</td></tr>
5046        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — lançado em 20/05/2026</td></tr>
5047        <tr><td><strong>DirectX</strong></td><td>12 (Feature Level 12.0)</td></tr>
5048        <tr><td><strong>Barramento</strong></td><td>PCI Express 3, dispositivo 0, função 0</td></tr>
5049        <tr><td><strong>Sistema</strong></td><td>Windows 10/11 com WSL2 ativo</td></tr>
5050      </tbody>
5051    </table>
5052  </div>
5053  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
5054    *Nota histórica: O Xeon E5-2690 v3 é de 2014. A RX 580 é de 2017. O Qwen3.5 é de 2025. Hardware de datacenter de 10 anos atrás processando IA de última geração.
5055  </p>
5056
5057  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.2 — Software e Versões</h3>
5058  <div class="tbl">
5059    <table>
5060      <thead>
5061        <tr>
5062          <th>Software</th>
5063          <th>Versão / Detalhe</th>
5064        </tr>
5065      </thead>
5066      <tbody>
5067        <tr><td><strong>llama.cpp</strong></td><td>build b9049-2496f9c14</td></tr>
5068        <tr><td><strong>Compilador</strong></td><td>MSVC 14.51.36231 (Visual Studio)</td></tr>
5069        <tr><td><strong>Vulkan SDK</strong></td><td>1.4.350.0</td></tr>
5070        <tr><td><strong>OpenWebUI</strong></td><td>v0.9.6</td></tr>
5071        <tr><td><strong>SearXNG</strong></td><td>via Docker — integrado ao OpenWebUI</td></tr>
5072        <tr><td><strong>
5072Backend GPU</strong></td><td>Vulkan — <em>sem CUDA, sem ROCm, sem DirectML</em></td></tr>
5073        <tr><td><strong>Docker Desktop</strong></td><td>Ativo — containers open-webui + searxng</td></tr>
5074      </tbody>
5075    </table>
5076  </div>
5077
5078  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.3 — O Modelo: Qwen3.5-35B-A3B-Uncensored Q6_K</h3>
5079  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.1 — Especificações Técnicas</h4>
5080  <div class="tbl">
5081    <table>
5082      <thead>
5083        <tr>
5084          <th>Parâmetro</th>
5085          <th>Valor</th>
5086        </tr>
5087      </thead>
5088      <tbody>
5089        <tr><td><strong>Nome completo</strong></td><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K</td></tr>
5090        <tr><td><strong>Arquitetura</strong></td><td>qwen35moe — Mixture of Experts (MoE)</td></tr>
5091        <tr><td><strong>Parâmetros totais</strong></td><td>34,66 bilhões</td></tr>
5092        <tr><td><strong>Tamanho do arquivo</strong></td><td>26,55 GiB (6,58 bits por peso)</td></tr>
5093        <tr><td><strong>Quantização</strong></td><td>Q6_K — 432 tensores q6_K + 301 tensores f32</td></tr>
5094        <tr><td><strong>Experts totais</strong></td><td>256 experts</td></tr>
5095        <tr><td><strong>Experts ativos por token</strong></td><td>8 de 256 (apenas 3,1% ativados)</td></tr>
5096        <tr><td><strong>Contexto máximo de treino</strong></td><td>262.144 tokens</td></tr>
5097        <tr><td><strong>Vocabulário</strong></td><td>248.320 tokens (BPE, tokenizer qwen35)</td></tr>
5098        <tr><td><strong>Thinking mode padrão</strong></td><td>ATIVADO (<code>thinking = 1</code> no template Jinja2)</td></tr>
5099        <tr><td><strong>Intervalo de full attention</strong></td><td>A cada 4 layers</td></tr>
5100      </tbody>
5101    </table>
5102  </div>
5103
5104  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.2 — Por que MoE muda tudo</h4>
5105  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5106    Em um modelo denso de 35B, <strong>todos</strong> os 35 bilhões de parâmetros são ativados para cada token gerado. No Qwen3.5 MoE, apenas os <strong>8 experts mais relevantes</strong> de 256 são ativados — o equivalente a ~3B parâmetros ativos por token.
5107  </p>
5108  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5109    Isso explica por que um arquivo de 26GB consegue rodar numa máquina com 32GB de RAM: a maior parte dos pesos está na memória mas <strong>não é calculada simultaneamente</strong>.
5110  </p>
5111
5112  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.4 — Comando de Inicialização</h3>
5113  <div class="cmd">
5114# Sessão 1 (porta 8080 — erro corrigido depois)
5115.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
5115ort 8080
5116
5117# Sessão 2 (porta 8081 — correta)
5118.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --port 8081</div>
5119  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
5120    <strong>Nenhuma flag manual de camadas (<code>-ngl</code>).</strong> O llama.cpp fez todo o fitting automático.
5121  </p>
5122<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.5 — Das automatische Fitting: Wie llama.cpp 26GB in 1,15 Sekunden aufteilte</h3>
5123  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5124    Dies ist das technische Herzstück des Experiments. Ohne manuelle Eingriffe führte llama.cpp einen Optimierungsalgorithmus aus, der den verfügbaren VRAM analysierte und das Modell intelligent zwischen GPU und RAM verteilte.
5125  </p>
5126
5127  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.1 — Ausgangssituation (Vollständiges Laden in die GPU unmöglich)</h4>
5128  <div class="cmd">
5129Benötigter Speicher auf der GPU (vollständiges Modell): 32.961 MiB
5130Verfügbarer freier VRAM:                        7.366 MiB
5131Defizit:                                     26.618 MiB — unmöglich, dass die GPU alles fasst</div>
5132
5133  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.2 — Sequenz der Fitting-Entscheidungen (1,15 Sekunden)</h4>
5134  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5135    <strong>Schritt 1 — Kontextreduzierung:</strong>
5136  </p>
5137  <div class="cmd">Ursprünglicher Kontext:  262.144 tokens ➔ Automatisch reduzierter Kontext: 4.096 tokens (VRAM-Einsparung: 5.347 MiB)</div>
5138  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5139    <strong>Schritt 2 — Verschieben aller MoE-Experten in den RAM:</strong>
5140  </p>
5141  <div class="cmd">Vulkan0 mit den dichten residualen Schichten: 2.418 MiB (Verbleibend: 3.924 MiB freier VRAM)
5142Host-RAM (gemappte MoE-Experten): 25.613 MiB</div>
5143  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5144    <strong>Schritt 3 — Rückverlagerung der dichten Schichten auf die GPU (back-to-front):</strong>
5145  </p>
5146  <div class="cmd">41 dichte Schichten zurückverlagert ➔ GPU. Resultierende Nutzung: 3.048 MiB | Frei: 4.318 MiB</div>
5147  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5148    <strong>Schritt 4 — Filling front-to-back mit fraktioniertem Overflow:</strong>
5149  </p>
5150  <div class="cmd">Ergebnis: 41 Schichten (36 "overflowing") auf der GPU
5151Overflow-Typ: GATE (fraktioniert in der gate layer)
5152GPU-Endnutzung: 6.255 MiB | Frei: 1.111 MiB</div>
5153
5154  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.3 — Finale Gewichtsverteilung</h4>
5155  <div class="tbl">
5156    <table>
5157      <thead>
5158        <tr>
5159          <th>Buffer-Speicherort</th>
5160          <th>Gespeicherter Inhalt</th>
5161          <th>Mobilisierte Größe</th>
5162        </tr>
5163      </thead>
5164      <tbody>
5165        <tr><td><strong>Vulkan0 (RX 580 8GB)</strong></td><td>41 dichte Schichten + output layer</td><td><strong>5.154 MiB</strong></td></tr>
5166        <tr><td><strong>CPU_Mapped (RAM via mmap)</strong></td><td>256 MoE-Experten</td><td><strong>26.784 MiB</strong></td></tr>
5167      </tbody>
5168    </table>
5169  </div>
5170
5171  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.4 — Zusätzliche im VRAM zugewiesene Buffer</h4>
5172  <div class="tbl">
5173    <table>
5174      <thead>
5175        <tr>
5176          <th>Buffer-Typ</th>
5177          <th>Zugewiesene Größe</th>
5178          <th>Physische Beschreibung</th>
5179        </tr>
5180      </thead>
5181      <tbody>
5182        <tr><td><strong>KV Cache (Vulkan0)</strong></td><td>80,00 MiB</td><td>4.096 cells, 10 layers</td></tr>
5183        <tr><td><strong>RS Buffer (Vulkan0)</strong></td><td>251,25 MiB</td><td>rekurrent: 40 layers, 4 seqs</td></tr>
5184        <tr><td><strong>Compute Buffer (Vulkan0)</strong></td><td>770,02 MiB</td><td>Aktiviert während Compute-Graphen</td></tr>
5185        <tr><td><strong>Host Compute Buffer</strong></td><td>16,02 MiB</td><td>System-RAM</td></tr>
5186        <tr><td><strong>Output Buffer (Vulkan_Host)</strong></td><td>3,79 MiB</td><td>Token-Ausgabebuffer</td></tr>
5187      </tbody>
5188    </table>
5189  </div>
5190  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
5191    <strong>Effektive Gesamtauslastung im VRAM während der Inferenz: ~6,2–7,2 GB</strong> (77–90% der 8GB physisch verfügbaren Kapazität).
5192  </p>
5193
5194  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.5 — Automatisch aktivierte Features</h4>
5195  <div class="cmd">
5196✅ Flash Attention (auto ➔ ENABLED)
5197✅ Fused Gated Delta Net — autoregressive
5198✅ Fused Gated Delta Net — chunked
5199✅ Prompt cache (Limit: 8.192 MiB, ~89.715 MiB auf Festplatte gespeichert)
5200✅ Thinking mode (thinking = 1)
5201✅ 4 parallele Slots (n_seq_max = 4)
5202
5203Graph nodes: 3.729 | Graph splits: 106 (mit bs=512), 74 (mit bs=1)
5204Reserve: 137–183 ms</div>
5205
5206  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">
520633.6 — Die 4-Ebenen-Speicherarchitektur</h3>
5207  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5208    Erster dokumentierter Nachweis eines 35B-Modells, das <strong>4 Speicherebenen gleichzeitig</strong> für die Verarbeitung auf einer gewöhnlichen RX 580 nutzt:
5209  </p>
5210  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.8rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
5211    <div>⚡ <strong style="color:#ff9e64">EBENE 1 — VRAM RX 580 (8GB GDDR5):</strong> 5.154 MiB dichte Schichten | Zugriff: ~400 GB/s (GDDR5) | Latenz: Nanosekunden</div>
5212    <div style="margin-top:0.5rem">🧠 <strong style="color:#7aa2f7">EBENE 2 — RAM DDR4 ECC (32GB System):</strong> 26.784 MiB MoE-Experten via mmap | Zugriff: ~51 GB/s (quad-channel) | Latenz: zweistellige ns</div>
5213    <div style="margin-top:0.5rem">💾 <strong style="color:#22c55e">EBENE 3 — SSD NVMe (Laufwerk E:):</strong> 26,55 GiB Quell-.gguf-Datei | Zugriff: 1,7–3,5 GB/s | Genutzt während des initialen Ladens</div>
5214    <div style="margin-top:0.5rem">📁 <strong style="color:#e0af68">EBENE 4 — HDD (Laufwerk C: Swap):</strong> Windows-Swap aktiviert, wenn der RAM erschöpft ist (>97% Auslastung) | Zugriff: ~120–180 MB/s | Spitze bei 98–100% Auslastung während der Inferenz</div>
5215  </div>
5216
5217  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.7 — Konfiguration des geladenen Kontextes</h3>
5218  <div class="cmd">
5219n_ctx         = 4.096 tokens (durch Fitting von 262.144 reduziert)
5220n_batch       = 2.048
5221n_ubatch      = 512
5222n_seq_max     = 4 (parallele Slots)
5223flash_attn    = auto ➔ ENABLED
5224kv_unified    = true</div>
5225  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
5226    <strong>Dokumentierte kritische Einschränkung:</strong> Der Kontext von 4.096 tokens ist der Hauptengpass des Setups. Der Thinking mode von Qwen3.5 verbraucht allein über 3.000 tokens, bevor eine sichtbare Antwort generiert wird – was weniger als 1.000 freie tokens für die finale Antwort an den Client lässt.
5227  </p>
5228
5229  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.8 — Benchmark in zwei Sitzungen bestätigt</h3>
5230  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Generierungsgeschwindigkeit</h4>
5231  <div class="tbl">
5232    <table>
5233      <thead>
5234        <tr>
5235          <th>Sitzung</th>
5236          <th>Ungefähre Uhrzeit</th>
5237          <th>Prompt Eval Speed</th>
5238          <th>Generierungs-Speed</th>
5239          <th>Gesamt-Tokens</th>
5240          <th>Gesamtzeit</th>
5241        </tr>
5242      </thead>
5243      <tbody>
5244        <tr><td><strong>Sitzung 1</strong></td><td>~17:39 Uhr</td><td><strong>34,13 tok/s</strong></td><td><strong>5,57 tok/s</strong></td><td>1.377 tok</td><td>~107 Sekunden</td></tr>
5245        <tr><td><strong>Sitzung 2</strong></td><td>~21:34 Uhr</td><td>~40.00 tok/s</td><td><strong>5,64 tok/s</strong></td><td>2.929 tok</td><td>~533 Sekunden</td></tr>
5246      </tbody>
5247    </table>
5248  </div>
5249  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
5250    <strong>Bemerkenswerte Konsistenz:</strong> Aufrechterhaltung von ~5,6 tokens/Sekunde Generierungsrate, unabhängig davon, ob die Sitzung überlastet oder "kalt" war.
5251  </p>
5252<h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Registro de temperaturas registradas</h4>
5253  <div class="tbl">
5254    <table>
5255      <thead>
5256        <tr>
5257          <th>Momento do Teste</th>
5258          <th>GPU Temp (°C)</th>
5259        </tr>
5260      </thead>
5261      <tbody>
5262        <tr><td>Idle (modelo estacionado na VRAM)</td><td>33–41°C</td></tr>
5263        <tr><td>Inferência normal (sem Web Search ativo)</td><td>44–64°C</td></tr>
5264        <tr><td>Inferência carregada (com Web Search ativo)</td><td>70–75°C</td></tr>
5265        <tr><td><strong>Pico absoluto registrado</strong></td><td><strong>80°C</strong></td></tr>
5266        <tr><td>Após conclusão de resposta</td><td>71–73°C</td></tr>
5267      </tbody>
5268    </table>
5269  </div>
5270  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
5271    <strong>Temperatura de thermal throttling da RX 580:</strong> ~90°C. <strong>Margem de segurança operacional perfeitamente mantida!</strong>
5272  </p>
5273
5274  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Utilização de recursos na inferência física</h4>
5275  <div class="tbl">
5276    <table>
5277      <thead>
5278        <tr>
5279          <th>Recurso de Hardware</th>
5280          <th>Idle</th>
5281          <th>Durante Inferência</th>
5282          <th>Pico Registrado</th>
5283        </tr>
5284      </thead>
5285      <tbody>
5286        <tr><td>VRAM dedicada</td><td>6,7 / 8,0 GB</td><td>6,8 – 7,2 / 8,0 GB</td><td>7,4 GB / 8,0 GB</td></tr>
5287        <tr><td>RAM do Sistema</td><td>~29,0 GB</td><td>30,7 – 31,1 GB</td><td>31,2 / 31,8 GB (98% utiliz.)</td></tr>
5288        <tr><td>CPU Xeon v3</td><td>3%</td><td>62 – 70%</td><td>70%</td></tr>
5289        <tr><td>GPU utilização 3D</td><td>0%</td><td>1 – 3%</td><td>3% (Carga no barramento PCIe)</td></tr>
5290        <tr><td>
5290HDD C: (Atividade swap)</td><td>0%</td><td>13 – 42%</td><td>98 – 100% (Limiar swap)</td></tr>
5291      </tbody>
5292    </table>
5293  </div>
5294
5295  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.9 — Os 5 Testes: Histórico Completo de Engenharia</h3>
5296  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
5297    <strong>Pergunta de entrada enviada em todos os testes:</strong><br>
5298    "Explique detalhadamente como funciona o mecanismo de atenção em transformers e por que o MoE é mais eficiente que modelos densos. Responda em português."
5299  </blockquote>
5300
5301  <div style="display:flex;flex-direction:column;gap:1rem;margin-bottom:1.5rem">
5302    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
5303      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 1 — Sessão 1 · Raciocínio ON + Web Search ON + Geração Imagem ON</h5>
5304      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
5305        <strong>Resultado:</strong> ❌ Erro de protocolo (reposta não entregue) | <strong>Log do erro:</strong> <code>operator (): got exception: {"error":"code":400,"message":"Assistant response prefill is incompatible with enable_thinking."}</code>
5306      </p>
5307      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
5308        <strong>Análise:</strong> O modelo processou um pensamento por ~1 minuto recuperando 10 fontes do SearXNG, mas o OpenWebUI injetou um prefill incorreto incompatível com a flag de pensamento do Jinja2, forçando o cancelamento.
5309      </p>
5310    </div>
5311
5312    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
5313      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 2 — Sessão 2 · Raciocínio ON + Web Search ON (30 pesquisas consecutivas)</h5>
5314      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
5315        <strong>Resultado:</strong> ❌ Contexto esgotado | <strong>Log do erro:</strong> <code>stop processing: n_tokens = 3285, truncated = 1</code>
5316      </p>
5317      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
5318        <strong>Análise:</strong> As 30 pesquisas do SearXNG injetaram milhares de tokens de contexto na memória. O thinking mode tentou alocar seu próprio buffer e estourou os 4.096 limitantes do setup híbrido, forçando corte prematuro.
5319      </p>
5320    </div>
5321
5322    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
5323      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 3 — Sessão 2 · Raciocínio ON + Web Search ON (25 pesquisas, nova rodada acumulada)</h5>
5324      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
5325        <strong>Resultado:</strong> ❌ Contexto esgotado | <strong>Log do erro:</strong> <code>stop processing: n_tokens = 4095, truncated = 1</code>
5326      </p>
5327      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
5328        <strong>Análise:</strong> O OpenWebUI tentou reenviar acumulando o histórico de conversação anterior. O prompt cresceu tanto que atingiu o teto exato delimitado de hardware de 4.095 tokens no Fitting.
5329      </p>
5330    </div>
5331
5332    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
5333      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 4 — Sessão 2 · Raciocínio ON + Web Search OFF</h5>
5334      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
5335        <strong>Resultado:</strong> ❌ Timeout do Cliente | <strong>Log do erro:</strong> <code>stop: cancel task, id_task = 6887 (truncated = 0)</code>
5336      </p>
5337      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
5338        <strong>Análise:</strong> Sem web-search o consumo térmico despencou para estáveis 51°C e uso de swap caiu. Mas o processamento de raciocínio interno demorou tempo suficiente na CPU Xeon de 2014 para que a UI disparasse seu timeout de segurança de chamadas.
5339      </p>
5340    </div>
5341
5342    <div style="border:1px solid rgba(34, 197, 94, 0.2);background:rgba(0, 3, 1, 0.6);border-radius:6px;padding:1rem">
5343      <h5 style="color:#22c55e;font-weight:bold;font-size:0.85rem">✅ TESTE 5 — Sessão 2 · Raciocínio ON + Web Search OFF + Prompt Curto (45 tokens)</h5>
5344      <p style="font-size:0.8rem;color:#c2ffd2;line-height:1.6;margin-top:0.25rem">
5345        <strong>Resultado:</strong> SUCESSO ABSOLUTO ✅ | Resposta técnica profunda entregue integralmente em português brasileiro estruturado.
5346      </p>
5347      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
5348        <strong>Análise:</strong> Ao restringir o prompt inicial para 45 tokens e desativar barulhos complementares, o pensamento pôde rodar por 4 minutos completos sob o Xeon, realizando rascunho de equações e respondendo impecavelmente sobre Transformers (Softmax, Multiheads) e as eficiências do MoE.
5349      </p>
5350    </div>
5351  </div>
5352
5353  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.10 — Tabela Comparativa de Comportamento dos Testes</h3>
5354  <div class="tbl">
5355    <table>
5356      <thead>
5357        <tr>
5358          <th>ID</th>
5359          <th>Thinking</th>
5360          <th>Web Search</th>
5361          <th>Promo Token</th>
5362          <th>Status</th>
5363          <th>Causa Raiz Real da Falha</th>
5364        </tr>
5365      </thead>
5366      <tbody>
5367        <tr><td>1</td><td>ON</td><td>ON (10 fontes)</td><td>~936 tok</td><td>❌ Falha</td><td>Prefill de resposta incompatível with thinking=1</td></tr>
5368        <tr><td>2</td><td>ON</td><td>ON (30 pesq.)</td><td>~357 tok</td><td>❌ Falha</td><td>Esgotamento de contexto do Fitting (4.095 max)</td></tr>
5369        <tr><td>3</td><td>ON</td><td>ON (25 pesq.)</td><td>~3.385 tok</td><td>❌ Falha</td><td>Esgotamento de contexto imediato no reenvio</td></tr>
5370        <tr><td>4</td><td>ON</td><td>OFF</td><td>~350 tok</td><td>❌ Falha</td><td>Timeout nas requisições da OpenWebUI antes do output</td></tr>
5371        <tr style="background:rgba(34, 197, 94, 0.05)"><td><strong>5</strong></td><td><strong>ON</strong></td><td><strong>OFF</strong></td><td><strong>45 tok</strong></td><td><strong>✅ SUCESSO</strong></td><td><strong>Prompt enxuto coube integralmente na arquitetura de mmap</strong></td></tr>
5372      </tbody>
5373    </table>
5374  </div>
5375<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
5376    <strong>Conclusão Crítica:</strong> A RX 580 do laboratório de 2017 e o Xeon funcionaram estavelmente sem dar nenhum reset físico em todas as situações de stress. As falhas residiram estritamente na calibração lógica do software de front-end.
5377  </p>
5378
5379  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.11 — Coletas de Descobertas e Limitações Cruciais</h3>
5380  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
5381    <li><strong style="color:#fff">Incompatibilidade do Thinking com Contexto Curto:</strong> Por design de modelo, o pensamento consome cerca de 3.000 tokens e estoura rapidamente o KV Cache alocado de 4.096 se o prompt ou histórico for longo.</li>
5382    <li><strong style="color:#fff">O Fitting Automático do llama.cpp é Excepcional:</strong> Forçar o split por flags experimentais rígidas como <code>--override-tensor</code> prejudica as chamadas no Vulkan. O fitting por cálculo de grafos resolveu milimetricamente a distribuição de forma otimizada.</li>
5383    <li><strong style="color:#fff">Superaquecimento da GPU mitigado:</strong> Apenas a renderização profunda com dezenas de filtros simultâneos elevou a 80°C. Limitar a GPU para inferir frações densas mantém o chip a confortáveis 44-64°C.</li>
5384    <li><strong style="color:#fff font-weight:bold">O gargalo reside na taxa de I/O de Swap do HDD:</strong> Quando RAM estoura a 98%, a taxa cai para 5 tok/s devido ao HDD. Migrar o swap do host inteiro para unidades de estado sólido aumentará consideravelmente a velocidade de fluxo comb
5384inada.</li>
5385  </ul>
5386
5387  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.12 — Comparação Direta com Projetos de Comunidade</h3>
5388  <div class="tbl">
5389    <table>
5390      <thead>
5391        <tr>
5392          <th>Projeto / Autor</th>
5393          <th>Arquitetura Utilizada</th>
5394          <th>Modelo Testado</th>
5395          <th>Velocidade Geração</th>
5396          <th>Status de Autoria</th>
5397        </tr>
5398      </thead>
5399      <tbody>
5400        <tr><td><strong>Matheus Fertunani</strong></td><td>Linux Comercial / CPU Xeon pura (192GB RAM)</td><td>Qwen3.5 35B Q8</td><td>~7–8 tokens/s</td><td>Documentado no YouTube</td></tr>
5401        <tr><td><strong>AIVisionsLab (Nossos testes)</strong></td><td>Vulkan Híbrido (RX 580 8GB + 32GB RAM ECC)</td><td>Qwen3.5 35B Q6_K</td><td><strong>5,64 tokens/s</strong></td><td>✅ Validado e Registrado</td></tr>
5402      </tbody>
5403    </table>
5404  </div>
5405  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
5406    <strong>A grande vantagem arquitetural:</strong> O teste de CPU pura de Matheus exige hardwares profissionais de alto custo com mais de 100GB de RAM instalada. O ecossistema de Vulkan do AIVisionsLab provou-se operável em uma GPU de menos de R$ 400 em mercado secundário!
5407  </p>
5408
5409  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.13 — Configurações Recomendadas para Testes Futuros</h3>
5410  <div class="cmd">
5411# Teste 6 — Desativação explícita de thinking via servidor em versões de compilação recentes:
5412.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
5412ort 8081 --no-thinking
5413
5414# Teste 7 — Elevação estrita de buffers de contexto se a memória for redirecionada:
5415.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-...-Q6_K.gguf" --host 0.0.0.0 --port 8081 --ctx-size 8192
5416
5417# Teste 8 — Testar com quantizações menores como Q4_K_M (~21GB):
5418# Liberação de ~5GB adicionais na RAM host que reduz a dependência de swap no HDD e melhora consideravelmente a taxa de tok/s!</div>
5419
5420  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.14 — Lições Técnicas Consolidadas</h3>
5421  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
5422    <li><strong style="color:#fff">O silício de 2017 não é o limite:</strong> A placa de vídeo nunca crashou nos testes contínuos de estresse térmico, dezenas de vezes. O gargalo se provou uma mera calibração lógica de software.</li>
5423    <li><strong style="color:#fff">As esparsidades do MoE salvam a categoria:</strong> Sem MoE, seria impensável arrastar um modelo de 26GB de pesos ativos. O MoE faz com que apenas 3.1% dos neurônios fiquem de fato excitados por token.</li>
5424  </ul>
5425
5426  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.15 — Veredicto Geral do Laboratório</h3>
5427  <div class="tbl">
5428    <table>
5429      <thead>
5430        <tr>
5431          <th>Questão de Engenharia</th>
5432          <th>Veredicto Final</th>
5433        </tr>
5434      </thead>
5435      <tbody>
5436        <tr><td><strong>A RX 580 de 8GB suporta modelos de 35B parâmetros?</strong></td><td>✅ <strong>Sim</strong> (Em barramento híbrido mmap)</td></tr>
5437        <tr><td><strong>É prático para o dia a dia?</strong></td><td>⚠️ <strong>Não</strong> (5,6 tok/s e contexto de 4.096 tokens)</td></tr>
5438        <tr><td><strong>Vale como prova de conceito?</strong></td><td>✅ <strong>Absolutamente</strong></td></tr>
5439        <tr><td><strong>Houve throttling ou crash?</strong></td><td>✅ <strong>Zero ocorrências de instabilidade</strong></td></tr>
5440        <tr><td><strong>Temperatura máxima registrada</strong></td><td><strong>80°C</strong> (margem de segurança: ~90°C)</td></tr>
5441        <tr><td><strong>Velocidade de geração</strong></td><td><strong>~5,6 tokens/segundo</strong></td></tr>
5442        <tr><td><strong>Memória total mobilizada</strong></td><td><strong>~34 GB</strong> (VRAM + RAM + swap HDD)</td></tr>
5443      </tbody>
5444    </table>
5445  </div>
5446
5447  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.16 — Linha do Tempo do Experimento</h3>
5448  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
5449    <div>🕒 <strong>~17:39</strong> — Servidor sobe na porta 8080 (erro)</div>
5450    <div>🕒 <strong>~17:40</strong> — "Network Problem" no OpenWebUI (porta errada)</div>
5451    <div>🕒 <strong>~17:41</strong> — Servidor fechou ao trocar porta → reiniciado na 8081</div>
5452    <div>🕒 <strong>~17:42</strong> — Todas as ferramentas habilitadas no modelo (imagem, web, terminal)</div>
5453    <div>🕒 <strong>~17:43</strong> — <strong>TESTE 1</strong> inicia</div>
5454    <div>🕒 <strong>~17:44</strong> — Web search: 10 fontes recuperadas</div>
5455    <div>🕒 <strong>~17:44</strong> — Tentativa de gerar imagem → erro tratado → continua</div>
5456    <div>🕒 <strong>~17:45</strong> — "Pensado por um minuto" aparece no OpenWebUI</div>
5457    <div>🕒 <strong>~17:46</strong> — Resposta estruturada com título gerado internamente</div>
5458    <div>🕒 <strong>~17:50</strong> — Erro de protocolo (prefill + thinking) → sem entrega. Pico: 80°C</div>
5459    <div>🕒 <strong>~21:34</strong> — Sessão 2 inicia</div>
5460    <div>🕒 <strong>~21:34</strong> — <strong>TESTE 2</strong> inicia — web search ON (30 pesquisas). Contexto truncado.</div>
5461    <div>🕒 <strong>~21:48</strong>
5461 — <strong>TESTE 3</strong> automático — 25 pesquisas. Contexto truncado.</div>
5462    <div>🕒 <strong>~22:00</strong> — <strong>TESTE 4</strong> — web search OFF. Temperatura cai para 51°C. Timeout da UI.</div>
5463    <div>🕒 <strong>~23:06</strong> — <strong>TESTE 5</strong> — prompt de 45 tokens. Thinking decodificado com sucesso.</div>
5464    <div>🕒 <strong>~23:14</strong> — Resposta completa entregue em português ✅. GPU: 64°C | RAM: 96%</div>
5465  </div>
5466
5467  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.17 — Impacto para a Documentação do AIVisionsLab</h3>
5468<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5469    Dieses Experiment ergänzt das Projekt um: einen neuen robusten Benchmark von 5,6 tok/s für hybride 35B MoE-Modelle, die Bestätigung, dass das automatische Fitting von llama.cpp starre manuelle Konfigurationen via Vulkan übertrifft, die klare Identifizierung der Inkompatibilität des thinking-mode mit Kontexten unter 8.192 sowie die Beschreibung einer auf 4 Speicherebenen erweiterten Architektur.
5470  </p>
5471
5472  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.18 — Tags und Metadaten</h3>
5473  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
5474    <div>🏷️ <strong>Tags:</strong> hybrid, moe, vulkan, rx580, large-model, thinking-mode, limits, qwen35b, benchmark, fitting-automático, 4-memory-levels, sem-throttling</div>
5475    <div style="margin-top:0.5rem">💻 <strong>Hardware:</strong> RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
5476    <div style="margin-top:0.25rem">💿 <strong>Software:</strong> llama.cpp b9049 + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
5477    <div style="margin-top:0.25rem">📅 <strong>Datum:</strong> 15.06.2026</div>
5478    <div style="margin-top:0.25rem">⏱️ <strong>Sitzungen:</strong> 2 (17:39–18:24 Uhr und 21:34–23:14 Uhr)</div>
5479    <div style="margin-top:0.25rem">📊 <strong>Tests:</strong> 5 (4 Softwarefehler, 1 erfolgreiche vollständige Inferenz)</div>
5480    <div style="margin-top:0.25rem">📈 <strong>Benchmark:</strong> 5,57–5,64 tok/s (Generierung) | 34,13 tok/s (Prompt-Eval)</div>
5481    <div style="margin-top:0.25rem">🔥 <strong>Spitzentemperatur:</strong> 80°C</div>
5482    <div style="margin-top:0.25rem">🏆 <strong>Endstatus:</strong> ✅ HARDWARE BESTANDEN</div>
5483  </div>
5484
5485  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
5486    "Das Problem war nie die Hardware.<br>
5487    Es war die Kombination aus thinking + web search, die die 4.096 Kontext-Token erschöpfte.<br>
5488    Mit kurzem Prompt und ohne web search antwortet das Qwen3.5-35B Q6_K normal auf einer RX 580 von 2017."<br>
5489    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 15.06.2026</span>
5490  </blockquote>
5491
5492  <div class="footer">
5493    Dokumentation generiert durch Claude Sonnet 4.6 — 15.06.2026 · Basierend auf echten Logs, Screenshots, Benchmarks und Echtzeit-Beobachtungen · Sitzung 1: ~17:39–18:24 Uhr | Sitzung 2: ~21:34–23:14 Uhr · 5 dokumentierte Tests · 1 erfolgreich · Hardware von 2017 verarbeitet KI von 2025
5494  </div>
5495</div>`},linhatempo:{id:"linhatempo",title:"37. LINHA DO TEMPO COLETIVA — A EVOLUÇÃO DO RX 580 COMO PLATAFORMA DE IA",desc:"Análise histórica e comparativa unificada documentando a quebra de barreiras e obsolescência da RX 580 em três etapas revolucionárias (2025-2026).",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:25,tags:["evolucion-historica","rx580-timeline","comunidade-hacker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["meta"],previous:"meta",next:"audio_rvc",related:["jornada","comunidade"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O resgate técnico e a ascensão da AMD Radeon RX 580 como uma plataforma de inteligência artificial prática não é fruto de uma única mente, mas sim de uma <strong>evolução coletiva ascendente</strong>. Três projetos independentes, construídos sobre a base matemática comum do ecossistema <code>ggml</code>, pavimentaram esta jornada:</p>
5496
5497  <!-- Linha do Tempo Visual -->
5498  <div style="position:relative;margin:2rem 0;padding-left:1.5rem;border-left:2px solid var(--b)">
5499    <div style="margin-bottom:1.5rem;position:relative">
5500      <div style="position:absolute;
5500left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:var(--r);border:2px solid #07080a"></div>
5501      <span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:var(--r);font-weight:bold">JANEIRO DE 2025</span>
5502      <h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">Método Amihart (Debian Linux)</h5>
5503      <p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Primeiro marco documentado. Validou LLMs acelerados por Vulkan no <code>llama.cpp</code> obtendo 24.56 t/s. No entanto, declarou: <em>"Vulkan não funciona para Stable Diffusion"</em>, devido às limitações do software na época, recorrendo ao ROCm via Docker.</p>
5504    </div>
5505    <div style="margin-bottom:1.5rem;position:relative">
5506      <div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#eab308;border:2px solid #07080a"></div>
5507      <span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#eab308;font-weight:bold">DEZEMBRO DE 2025</span>
5508      <h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">Método DadHacks (Linux/Debian)</h5>
5509      <p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Refutou empiricamente a impossibilidade de Stable Diffusion via Vulkan. Utilizou o recém-lançado motor <code>stable-diffusion.cpp</code> com a flag compiladora <code>-DSD_VULKAN=ON</code> para rodar geração GGUF do Flux Schnell com segmentação CPU/GPU.</p>
5510    </div>
5511    <div style="position:relative">
5512      <div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#22c55e;border:2px solid #07080a"></div>
5513      <span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#22c55e;font-weight:bold">TEMPORADA 2026</span>
5514      <h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">AIVisionsLab (Windows Nativo + WSL2)</h5>
5515      <p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Unificação do ecossistema de produção. Desenvolveu automação nativa via <code>.bat</code>, integrou renderização Vulkan local a painéis amigáveis (OpenWebUI via Docker), documentou os fallbacks para CPU Xeon em modelos SOTA e mapeou de forma exaustiva os motivos de falhas do DirectML/ROCm no Windows.</p>
5516    </div>
5517  </div>
5518
5519  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:2rem 0 .75rem 0;text-transform:uppercase">A. A Pergunta que Cada Projeto Respondeu</h4>
5520  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">A evolução da maturidade técnica da RX 580 pode ser traduzida pelas premissas respondidas pelos autores:</p>
5521  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
5522    <li><strong style="color:#fff">Amihart (Jan 2025):</strong> <em>"É possível rodar LLMs de forma rápida na RX 580 sem ROCm oficial?"</em> <strong style="color:var(--r)">Sim</strong>, compilando o llama.cpp com Vulkan API puro.</li>
5523    <li><strong style="color:#fff">DadHacks (Dez 2025):</strong> <em>"É possível gerar imagens via IA aceleradas por Vulkan na RX 580?"</em> <strong style="color:var(--r)">Sim</strong>, compilando stable-diffusion.cpp e utilizando o formato alternativo estável GGUF.</li>
5524    <li><strong style="color:#fff">AIVisionsLab (2026):</strong> <em>"É possível colocar toda essa infraestrutura em produção integrada e amigável no Windows?"</em> <strong style="color:var(--r)">Sim</strong>, construindo pontes de rede de contêineres Docker, automações unificadas e fallbacks inteligentes de CPU para excedentes de VRAM.</li>
5525  </ul>
5526
5527  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. Tabela Mestre Comparativa Unificada</h4>
5528  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">Mapeamento estruturado cruzado das capacidades e conquistas cumulativas:</p>
5529  <div class="tbl" style="margin-bottom:1.5rem">
5530    <table>
5531      <thead>
5532        <tr>
5533          <th>Capacidade</th>
5534          <th>Amihart (2025)</th>
5535          <th>DadHacks (2025)</th>
5536          <th>AIVisionsLab (2026)</th>
5537        </tr>
5538      </thead>
5539      <tbody>
5540        <tr><td><strong>Sistema Base</strong></td><td>Debian Linux</td><td>Linux Debian</td><td>Windows 10 Pro + WSL2 Linux</td></tr>
5541        <tr><td><strong>Motor de LLM</strong></td><td>✅ Vulkan (24.56 t/s)</td><td>✅ Vulkan (llama.cpp)</td><td>✅ Vulkan (15-16 t/s)</td></tr>
5542        <tr><td><strong>Motor SD</strong></td><td>❌ Não viável em Vulkan</td><td>✅ Vulkan puro</td><td>✅ Vulkan puro (~72s SD1.5)</td></tr>
5543        <tr><td><strong>Flux GGUF</strong></td><td>❌ Inexistente</td><td>✅ Linha de comando</td><td>✅ Híbrido GPU/CPU Estável</td></tr>
5544        <tr><td><strong>Interface Gráfica</strong></td><td>
5544❌ Apenas Console / WebUI Docker</td><td>❌ Apenas CLI</td><td>✅ OpenWebUI + API integrada</td></tr>
5545        <tr><td><strong>Automação</strong></td><td>❌ Não desenvolvido</td><td>❌ Não desenvolvido</td><td>✅ Scripts .bat double-click</td></tr>
5546        <tr><td><strong>Estabilidade VRAM</strong></td><td>❌ Limitação física ROCm</td><td>⚠️ Manual CLI</td><td>✅ VAE Tiling integrado</td></tr>
5547        <tr><td><strong>Modelos &gt; 8GB</strong></td><td>❌ OOM crônicos</td><td>⚠️ CPU offload básico</td><td>✅ Quad-Channel REG ECC fallbacks</td></tr>
5548        <tr><td><strong>Animação Video</strong></td><td>❌ Não abordado</td><td>❌ Não abordado</td><td>✅ AnimateDiff WSL2 CPU Xeon</td></tr>
5549        <tr><td><strong>Detecção GGUF</strong></td><td>❌ Não abordado</td><td>❌ Não abordado</td><td>✅ Mapeamento leejet vs city96</td></tr>
5550      </tbody>
5551    </table>
5552  </div>
5553
5554  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">C. O Denominador Técnico Comum — Engine GGML</h4>
5555  <p style="font-size:.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">A tecnologia central de compressão e execução que viabilizou o aproveitamento de GPUs legacy foi o ecossistema desenvolvido por Georgi Gerganov (<strong>ggml / llama.cpp / stable-diffusion.cpp</strong>). Ao portar as operações tensoriais diretamente para a linguagem C/C++ e expor ganchos nativos à biblioteca gráfica aberta do <strong>Vulkan API</strong>, esta implementação permite que placas sem pacotes modernos de driver proprietário realizem cálculos massivos nativos (contornando drivers de vendor restritivos).</p>
5556 
5557   <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">D. Filosofia Convergente</h4>
5558   <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Manifestações diretas que eternizam o propósito livre destes pesquisadores:</p>
5559   <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem">
5560     <strong>Amihart:</strong> "Apesar de quão antiga é esta GPU, é tecnicamente possível utilizá-la para IA se adaptarmos o fluxo de execução... otimização de baixo nível é a chave para o reaproveitamento de hardware legado."
5561   </blockquote>
5562   <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem">
5563     <strong>DadHacks:</strong> "Esse setup fornece uma ponte viável de aproveitamento técnico dos investimentos existentes em hardware sem exigir upgrades caros ou dependência de pacotes de software inchados."
5564   </blockquote>
5565   <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
5566     <strong>AIVisionsLab:</strong> "A degradação por obsolescência de drivers e ecossistemas fechados é um fator comercial e não uma limitação material da placa. O hardware legado mantém sua utilidade operacional mediante suporte de software aberto."
5567   </blockquote>
5568 
5569   <div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem">
5570     <strong style="color:var(--r)">Crédito de Co-autoria e Referência:</strong> Linha do tempo técnica dedicada ao esforço experimental cumulativo de <strong>Amihart</strong>, <strong>DH (DadHacks)</strong>, <strong>leejet</strong>, <strong>ggerganov</strong>, <strong>woodrex</strong> e a todos os desenvolvedores independentes focados em reaproveitamento digital e preservação de hardware.
5571       </div>`},linux_nativo:{id:"linux_nativo",title:"43. LINUX NATIVO — Ubuntu 26.04 LTS + RX 580 + Vulkan",desc:"AIVisionsLab — Documentação da Stack Completa em Linux Real",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"sistema-operacional",difficulty:"advanced",estimated_time_min:40,tags:["ubuntu-native","linux-vulkan","low-level-compilation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_whisper"],previous:"audio_whisper",next:"audio_srt_ptbr",related:["comfyui-wsl","amihart"]},part:1},html:`<div class="card bg-red-950/20 border border-red-500/30 p-5 rounded-md my-6">
5572  <h4 style="color:#ef4444;font-weight:800;font-size:0.95rem;margin-bottom:0.6rem;display:flex;items-center;gap:0.4rem">
5573    🚨 INCIDENT REPORT (16/06/2026): O GRANDE DESASTRE DE ESPAÇO E A QUEDA DO GNOME
5574  </h4>
5575  <p style="font-size:0.82rem;color:#fca5a5;line-height:1.75;margin-bottom:0.75rem">
5576    <strong>Status Crítico:</strong> Durante os testes de pipelines extremos e download massivo de modelos GGUF pesados na partição dedicada de 97GB, o espaço físico foi totalmente exaurido (0 bytes livres no swap/root). Em uma tentativa rápida de liberação de cache e limpeza forçada via terminal, dependências críticas do ambiente gráfico foram corrompidas.
5577  </p>
5578  <ul style="padding-left:1.2rem;font-size:.8rem;color:#fbcfe8;line-height:1.8;margin-bottom:1rem">
5579    <li><strong>Sintoma:</strong> O gerenciador de Janelas <strong>GNOME</strong> quebrou por completo, resultando em loops de login e tela preta terminal sem carregamento de interface de vídeo.</li>
5580    <li><strong>Ação de Recuperação:</strong> Formatação física e reinstalação imediata do sistema Linux Bare-Metal do zero para reconstrução limpa e redimensionamento adequado de partições.</li>
5581    <li><strong>O Veredicto Existencial:</strong> <em>"Definitivamente preciso aprender Linux!"</em> — A jornada do AIVisionsLab prova que dominar o terminal e a alocação de espaço sob LVM é tão crucial quanto conhecer os shaders de backend do Vulkan.</li>
5582  </ul>
5583</div>
5584
5585<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
5586  Documentação detalhada e homologada de execução direta em Linux nativo. Sem WSL2, sem emulação de contêiner ou Docker Passthrough: acesso bare-metal real através de drivers open-source <strong>Mesa RADV</strong> sobre o novíssimo <strong>Ubuntu 26.04 LTS (Resolute Raccoon)</strong> rodando o kernel Linux 7.0.
5587</p>
5588
5589<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:.85rem;margin-bottom:1.25rem">
5590  <div class="stat"><div class="stat-icon">🐧</div><div><div class="stat-lbl">Plataforma Linux</div><div class="stat-val" style="font-size:.82rem">Ubuntu 26.04 LTS</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Kernel 7.0 (Resolute)</div></div></div>
5591  <div class="stat"><div class="stat-icon">🎛️</div><div><div class="stat-lbl">Vulkan Driver</div><div class="stat-val" style="font-size:.82rem">Mesa RADV 26.0.3</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Vulkan Core version 1.4.341</div></div></div>
5592  <div class="stat"><div class="stat-icon">💽</div><div><div class="stat-lbl">Particionamento</div><div class="stat-val" style="font-size:.82rem">Ext4 dedidada 97GB</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">HDD sdb6 Dual Boot</div></div></div>
5593  <div class="stat"><div class="stat-icon">📦</div><div><div class="stat-lbl">
5593Docker Runtime</div><div class="stat-val" style="font-size:.82rem">Nativo Linux Engine</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Pontes OpenWebUI a 100%</div></div></div>
5594</div>
5595
5596<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Tabela Comparativa Bruta: Windows 10 vs Linux Nativo</h3>
5597<div class="tbl">
5598  <table>
5599    <thead>
5600      <tr>
5601        <th>Cenário / Carga de Trabalho</th>
5602        <th>Windows 10 (AMD oficial)</th>
5603        <th>Linux Ubuntu 26.04 (Mesa RADV)</th>
5604        <th>Vencedor Crucial</th>
5605      </tr>
5606    </thead>
5607    <tbody>
5608      <tr>
5609        <td><strong>LLM (Qwen3 4B GGUF) @ 99 layers</strong></td>
5610        <td>~15-17 tokens/s</td>
5611        <td><strong>~35 tokens/s (RADV engine)</strong></td>
5612        <td>🏆 <strong>Linux (2x mais veloz)</strong></td>
5613      </tr>
5614      <tr>
5615        <td><strong>LLM Grande (Qwen3.6 35B) @ Max layers</strong></td>
5616        <td><strong>7.62 tokens/s (max 10 layers)</strong></td>
5617        <td>5.18 tokens/s (max 20 layers)</td>
5618        <td>⚖️ <strong>Empate Técnico</strong> (Linux permite 2x mais layers, Windows é mais rápido por layer)</td>
5619      </tr>
5620      <tr>
5621        <td><strong>Stable Diffusion (Dreamshaper8 - 50st)</strong></td>
5622        <td><strong>~72 segundos (1.44s/it)</strong></td>
5623        <td>~85 segundos (1.65s/it)</td>
5624        <td>🏆 <strong>Windows (estável por driver)</strong></td>
5625      </tr>
5626      <tr>
5627        <td><strong>Flux Schnell (4 steps, 512x512)</strong></td>
5628        <td>~84 segundos (OOM se 1024x1024)</td>
5629        <td><strong>~52 segundos sampling (Total: 95s)</strong></td>
5630        <td>🏆 <strong>Linux (melhor swap VRAM)</strong></td>
5631      </tr>
5632      <tr>
5633        <td><strong>whisper.cpp (large-v3-turbo, áudio 106s)</strong></td>
5634        <td>307 s (Uso de VRAM: 2.6 GB)</td>
5635        <td><strong>23.58 s (Uso de VRAM: 1.6 GB)</strong></td>
5636        <td>🏆 <strong>Linux (Absurdamente superior)</strong></td>
5637      </tr>
5638    </tbody>
5639  </table>
5640</div>
5641
5642<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Instalação e Dual-Boot sem Sobrescrever Registros</h3>
5643<p style="font-size:.82rem;color:#94a3b8;line-height:1.75">
5644  1. No Windows, libere espaço usando o Gerenciador de Discos (Diminuir Volume).<br>
5645  2. Prepare o pendrive com a ISO desktop do <strong>Ubuntu 26.04 amd64</strong>.<br>
5646  3. No instalador do Ubuntu, selecione a opção "Instalar ao lado do Windows Boot Manager". O instalador criará a partição e configurará o menu GRUB para permitir a seleção de boot em cada reinicialização automaticamente.
5647</p>
5648
5649<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Pós-Instalação: Validação Bare-Metal da GPU Polaris</h3>
5650<div class="code">
5651  <span class="code-lang">bash</span>
5652  <pre>lspci | grep -i vga
5653# AMD Radeon RX 580 2048SP detectada!
5654
5655vulkaninfo --summary 2>/dev/null | grep -A5 "Devices"
5656# Deve exibir: GPU0: DRIVER_ID_MESA_RADV | driverInfo = Mesa 26.0.3 ✅</pre>
5657</div>
5658
5659<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Pilha de Comandos de Execução Homologados no Ubuntu</h3>
5660
5661<h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">1. Inicializando llama-server via Vulkan</h4>
5662<div class="code">
5663  <span class="code-lang">bash</span>
5664  <pre>~/llama.cpp/build/bin/llama-server \\
5665  -m "/run/media/aivisions-lab-studio/NVMe/models/qwen3/Qwen3-4B-Q4_K_M.gguf" \\
5666  --host 0.0.0.0 --port 8081 \\
5667  -ngl 99 -t 24</pre>
5668</div>
5669
5670<h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">2. Geração de Imagens (Flux Schnell) — Segredos Contra Travamento do GNOME</h4>
5671<div class="code">
5672  <span class="code-lang">bash</span>
5673  <pre>~/stable-diffusion.cpp/build/bin/sd-server \\
5674  --listen-ip 0.0.0.0 --listen-port 7860 \\
5675  --diffusion-model /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/flux1-schnell-q4_k.gguf \\
5676  --vae /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/ae.safetensors \\
5677  --clip_l /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/clip_l.safetensors \\
5678  --t5xxl /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/t5xxl_fp16.safetensors \\
5679  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre>
5680</div>
5681<p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-top:.35rem">
5682  💡 <strong>Flags Críticas:</strong> O parâmetro <code>--vae-tiling</code> é estritamente obrigatório. Sem ele, a decodificação do VAE estoura o limite de memória física e trava o ambiente gráfico GNOME. Evite usar <code>--backend vulkan0</code> para este modelo pesado no Linux, pois gera bugs de contexto perdidos.
5683</p>
5684
5685<h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">3. Transcrição Rápida de Áudio via whisper.cpp</h4>
5686<div class="code">
5687  <span class="code-lang">bash</span>
5688  <pre>~/whisper.cpp/build/bin/whisper-cli \\
5689  -m ~/whisper.cpp/models/ggml-large-v3-turbo.bin \\
5690  -f "/caminho/para/audio.wav" \\
5691  -l pt --output-txt</pre>
5692</div>
5693
5694<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Serviços e Contêineres Docker Rodando Paralelos</h3>
5695<div class="tbl">
5696  <table>
5697    <thead>
5698      <tr>
5699        <th>Contêiner ativo</th>
5700        <th>Imagem Base</th>
5701        <th>Porta Mapeada</th>
5702        <th>Finalidade</th>
5703      </tr>
5704    </thead>
5705    <tbody>
5706      <tr>
5707        <td><strong>open-webui</strong></td>
5708        <td>ghcr.io/open-webui/open-webui:main</td>
5709        <td>3000 -> 8080</td>
5710        <td>Painel unificado de Chat com LLM e render SD</td>
5711      </tr>
5712      <tr>
5713        <td><strong>portainer</strong></td>
5714        <td>portainer/portainer-ce</td>
5715        <td>9000</td>
5716        <td>Gerenciamento visual de processos e pilhas Docker</td>
5717      </tr>
5718      <tr>
5719        <td><strong>searxng</strong></td>
5720        <td>searxng/searxng:latest</td>
5721        <td>8080</td>
5722        <td>Mecanismo de busca privado para as respostas ancoradas de IA</td>
5723      </tr>
5724    </tbody>
5725  </table>
5726</div>
5727
5728<div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4">
5729  <h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Lições Autônomas Aprendidas em Linux</h4>
5730  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7">
5731    <strong>ROCm Abandonado:</strong> Placas GCN4 / Polaris como a RX 580 não têm mais suporte no SDK ROCm oficial. Tentar rodar Ollama oficial via GPU Docker nela falhará. A rota de ouro é rodar o <strong>Ollama na CPU Xeon</strong> ou usar o <strong>llama-server nativo compilado com Vulkan</strong>! Docker só deve ser empregado para frontends e servidores secundários livres.
5732  </p>
5733</div>`},llama:{id:"llama",title:"07. COMPILAÇÃO DO LLAMA.CPP (BACKEND VULKAN)",desc:"Passo a passo com os comandos mestre para gerar os binários otimizados de LLM para a RX 580.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["llamacpp","vulkan-acceleration","compilacao-cpp"],last_reviewed:"2026-07-01",relationships:{prerequisites:["jornada"],previous:"jornada",next:"sdcpp",related:["modelos","limit_qwen_35b"]}},html:`<div class="note">⚠ Certifique-se de executar os comandos abaixo exclusivamente dentro do <strong>Developer PowerShell do Visual Studio</strong></div>
5734  <div class="code"><pre># Navegar para a partição de alta velocidade e clonar o repositório oficial
5735cd E:\\
5736git clone https://github.com/ggerganov/llama.cpp
5737cd llama.cpp
5738
5739# Instanciar o diretório de build injetando a flag compiladora do backend Vulkan
5740cmake -B build -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
5741
5742# Disparar a compilação utilizando 20 threads paralelas do processador Xeon
5743cmake --build build --config Release -j20</pre></div>
5744  <h4 class="s" style="margin-top:1rem;margin-bottom:.5rem;color:#fff">Comando de Validação do Dispositivo de Aceleração</h4>
5745  <div class="code"><pre>cd build\\bin\\Release
5746.\\llama-cli.exe --list-devices
5747# Retorno esperado do console: Vulkan0: AMD Radeon RX 580 2048SP ✅</pre></div>`},meta:{id:"meta",title:"36. REFERÊNCIAS E METADADOS DO DOCUMENTO",desc:"Análise técnica do ciclo de vida físico do hardware legado e filosofia de reaproveitamento do laboratório.",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"metadados",difficulty:"beginner",estimated_time_min:10,tags:["silicon-governance","metadata-specs","efficie
5747ncy-telemetry"],last_reviewed:"2026-07-01",relationships:{prerequisites:["arquivos"],previous:"arquivos",next:"linhatempo",related:["arquivos","proximos"]}},html:`<blockquote style="font-size:.9rem;color:#94a3b8;font-style:italic;line-height:1.9;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">
5748    "A obsolescência programada comercial é uma escolha de mercado, não uma barreira de engenharia. O hardware de herança não morre; ele é libertado pelo software correto."
5749  </blockquote>
5750  <div class="tbl" style="margin-top:.9rem"><table>
5751    <thead><tr><th>Metadado do Sistema</th><th>Registro de Auditoria</th></tr></thead>
5752    <tbody>
5753      <tr><td>Versão do Deploy</td><td>VULKAN_DEPLOY_V3.0_COMPLETO</td></tr>
5754      <tr><td>Ano do Registro</td><td>Histórico Consolidado // Temporada 2026</td></tr>
5755      <tr><td>Escopo de Autoria</td><td>Arquitetura de Sistemas Black Tuxedo AI Solutions</td></tr>
5756    </tbody>
5757  </table></div>`},modelos:{id:"modelos",title:"09. CONVERSÃO DE MODELOS PARA FORMATO GGUF",desc:"Otimização e quantização de arquivos .safetensors padrão para o formato aceito pela engine ggml.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"quantizacao",difficulty:"intermediate",estimated_time_min:15,tags:["gguf","quantizacao-modelos","vram-8gb"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdcpp"],previous:"sdcpp",next:"sdserver",related:["llama","comfyui-modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.9rem">Os runtimes otimizados em C++ do <code>stable-diffusion.cpp</code> exigem o formato de arquivo estruturado em <code style="color:var(--r)">.gguf</code>. Modelos tradicionais baixados do Civitai (.safetensors) precisam passar pelo conversor nativo:</p>
5758  <div class="code"><pre># Comando para conversão direta e aplicação de quantização estável em 8-bits (q8_0)
5759.\\sd-cli.exe -M convert -m "E:\\models\\DreamShaper_8.safetensors" -o "E:\\models\\dreamshaper8.gguf" --type q8_0</pre></div>
5760  <div class="code ok" style="margin-top:.75rem"><pre># Log de encerramento do processo:
5761[INFO] convert 'DreamShaper_8.safetensors' to 'dreamshaper8.gguf' success ✅</pre></div>`},prereqs:{id:"prereqs",title:"05. PRÉ-REQUISITOS DO SISTEMA",desc:"Ferramental necessário para compilar os binários abertos e subir os servidores locais.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"dependencias",difficulty:"intermediate",estimated_time_min:20,tags:["cmake","git","msvc-compiler","gcc","vulkan-sdk"],last_reviewed:"2026-07-01",relationships:{prerequisites:["solucao"],previous:"solucao",next:"jornada",related:["llama","sdcpp"]}},html:`<div class="c2">
5762    <div class="card"><p style="font-size:.58rem;color:var(--r);text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">⚠ AMBIENTE DE COMPILAÇÃO (GPU)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">Developer PowerShell do VS</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">Abre através do Menu Iniciar → "Developer PowerShell for VS 2022"</p></div>
5763    <div class="card"><p style="font-size:.58rem;color:#22c55e;text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">✅ AMBIENTE DE EXECUÇÃO (RUNTIME)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">PowerShell Padrão do Windows</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">Executa os binários finais compilados sem overhead do ecossistema dev</p></div>
5764  </div>
5765  <div class="tbl" style="margin-top:1rem"><table>
5766    <thead><tr><th>Software / SDK</th><th>Versão Homologada</th><th>Notas de Configuração Essenciais</th></tr></thead>
5767    <tbody>
5768      <tr><td>Visual Studio Community</td><td>2022 ou 2026</td><td>Obrigatório marcar a carga de trabalho: "Desenvolvimento para desktop com C++"</td></tr>
5769      <tr><td>CMake Compiler</td><td>v4.3.2+</td><td>Disponível em cmake.org. Lembrar de marcar: "Add CMake to system PATH"</td></tr>
5770      <tr><td>Vulkan SDK</td><td>v1.4.341.1</td><td>Baixar via LunarG. Instalação padrão obrigatoriamente em <code>C:\\VulkanSDK\\</code></td></tr>
5771      <tr><td>Git Windows</td><td>Última estável</td><td>Instalador oficial para clonagem dos repositórios open-source</td></tr>
5772      <tr><td>Docker Desktop</td><td>v4.x+</td><td>Necessário para rodar o ecossistema OpenWebUI e pipelines auxiliares como SearXNG</td></tr>
5773      <tr><td>WSL2 Subsystem</td><td>Ubuntu 22.04.5 LTS</td><td>Base de execução estável para o ambiente Python do ComfyUI e Ollama</td></tr>
5774      <tr><td>Miniconda Linux</td><td>Branch Python 3.11</td><td>Gerenciador isolado de pacotes rodando dentro do subsistema Linux WSL2</td></tr>
5775    </tbody>
5776  </table></div>
5777  <div class="code"><pre># Comandos de validação do ambiente de compilação
5778cmake --version
5779# Retorno esperado: cmake version 4.3.2 ✅
5780
5781dir C:\\VulkanSDK
5782# Retorno esperado: exibição do diretório da versão 1.4.341.1 ✅</pre></div>`},proving_hypothesis_35b:{id:"proving_hypothesis_35b",title:"42. PROVANDO A HIPÓTESE: CURL, CTX-SIZE 8192 E A PRIMEIRA RESPOSTA COMPLETA",desc:"Continuação direta da Seção 33 · 3 testes · Hipótese confirmada · Hardware de 2017",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:35,tags:["context-length","offloading-layer","matematica-tensores"],last_reviewed:"2026-07-01",relationships:{prerequisites:["limit_qwen_35b"],previous:"limit_qwen_35b",next:"sdxl_vulkan",related:["limit_qwen_35b","cpu"]},part:1}
5782,html:`<div class="whisper-doc">
5783  <div class="hero">
5784    <div class="hero-title"><span>Provando a Hipótese</span> — Qwen3.5 35B</div>
5785    <div class="hero-sub">Experimentos conclusivos validando preenchimento de contexto, timeouts de cliente e comparação Q4_K_M vs Q6_K no silício de 2017.</div>
5786    <div class="hero-badges">
5787      <span class="badge badge-gpu">AMD RX 580 8GB</span>
5788      <span class="badge badge-win">Xeon E5-2690 v3</span>
5789      <span class="badge badge-ok">Hipótese Provada</span>
5790      <span class="badge badge-ok">--ctx-size 8192</span>
5791      <span class="badge badge-win">Q4_K_M vs Q6_K</span>
5792    </div>
5793  </div>
5794
5795  <div class="stat-grid">
5796    <div class="stat">
5797      <div class="stat-label">Velocidade (Q4_K_M)</div>
5798      <div class="stat-value">6.42 - 6.65 tok/s</div>
5799      <div class="stat-sub">Sem Swap Ativo</div>
5800    </div>
5801    <div class="stat">
5802      <div class="stat-label">Contexto Provado</div>
5803      <div class="stat-value">8.192 tokens</div>
5804      <div class="stat-sub">Acomoda modo de Raciocínio</div>
5805    </div>
5806    <div class="stat">
5807      <div class="stat-label">Temperatura Máxima</div>
5808      <div class="stat-value">74°C</div>
5809      <div class="stat-sub">10°C mais frio com Q4_K_M</div>
5810    </div>
5811    <div class="stat">
5812      <div class="stat-label">Status do Hardware</div>
5813      <div class="stat-value">100% Aprovado</div>
5814      <div class="stat-sub">Zero crashes / 4 slots paralelos</div>
5815    </div>
5816  </div>
5817
5818  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.0 — Contexto e Motivação</h3>
5819  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5820    A Seção 33 terminou com uma hipótese clara: <em>"O problema nunca foi o hardware. Foi a combinação de thinking + web search esgotando os 4.096 tokens de contexto. Com prompt curto e sem web search, o Qwen3.5-35B Q6_K responde normalmente numa RX 580 de 2017."</em>
5821  </p>
5822  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
5823    Em 16 de junho de 2026, o AIVisionsLab executou os testes pendentes sugeridos para provar essa hipótese ao vivo, avaliando o comportamento com curl direto (sem timeout do cliente), habilitando a flag de tamanho de contexto ampliado e testando quantizações mais eficientes.
5824  </blockquote>
5825
5826  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.1 — Hardware do Laboratório</h3>
5827  <div class="tbl">
5828    <table>
5829      <thead>
5830        <tr>
5831          <th>Componente</th>
5832          <th>Especificação</th>
5833        </tr>
5834      </thead>
5835      <tbody>
5836        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 cores / 24 threads · 3,05 GHz turbo (Lançado em 2014)</td></tr>
5837        <tr><td><strong>RAM</strong></td><td>31,8 GB DDR4 REG ECC (quad-channel)</td></tr>
5838        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (Lançado em 2017)</td></tr>
5839        <tr><td><strong>Storage NVMe</strong></td><td>SSD NVMe (Disco E:) — modelos GGUF (Leitura de 1.7–3.5 GB/s)</td></tr>
5840        <tr><td><strong>Storage HDD</strong></td><td>HDD (Disco C: / F:) — sistema Windows + swap</td></tr>
5841        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — lançado em 20/05/2026</td></tr>
5842        <tr><td><strong>Sistema</strong></td><td>Windows 10 Pro com WSL2 activo</td></tr>
5843      </tbody>
5844    </table>
5845  </div>
5846
5847  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.2 — Modelos Testados</h3>
5848  <div class="tbl">
5849    <table>
5850      <thead>
5851        <tr>
5852          <th>Modelo</th>
5853          <th>Quantização</th>
5854          <th>Tamanho do Arquivo</th>
5855          <th>Parâmetros da Arquitetura</th>
5856        </tr>
5857      </thead>
5858      <tbody>
5859        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q6_K</strong></td><td>6 bits</td><td>28,51 GB</td><td>34,66B (MoE)</td></tr>
5860        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M</strong></td><td>4 bits (Medium)</td><td><strong>21,17 GB</strong></td><td>34,66B (MoE)</td></tr>
5861        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q5_K_M</strong></td><td>5 bits (Medium)</td><td>24,76 GB</td><td>34,66B (MoE)</td></tr>
5862      </tbody>
5863    </table>
5864  </div>
5865  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
5866    *Nota: Todos os modelos possuem arquitetura idêntica de Mixture of Experts (MoE), variando apenas a compressão matemática de seus pesos.
5867  </p>
5868
5869  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.3 — Localizando os Executáveis</h3>
5870  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5871    Antes de testar, foi necessário localizar as compilações otimizadas do <code>llama-server</code>. No PowerShell do laboratório:
5872  </p>
5873  <div class="cmd">Get-ChildItem -Path E:\\ -Recurse -Filter "llama-server.exe" -ErrorAction SilentlyContinue
5874 
5875# Resultado:
5876E:\\llama.cpp\\llama-server.exe (stub de 9KB)
5877E:\\llama.cpp\\build\\bin\\Release\\llama-server.exe (Executável real de 7.5MB) ◀</div>
5878
5879  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.4 — Teste 9: Curl Direto Sem Timeout</h3>
5880  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.1 — Motivação</h4>
5881  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5882    Identificar se o gargalo de timeout relatado no Teste 4 residia no servidor ou estritamente nas requisições AJAX do cliente OpenWebUI.
5883  </p>
5884
5885  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.2 — Inicialização do Servidor</h4>
5886  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
5887.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --port 8081</div>
5888
5889  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.3 — Resolvendo Escaping de JSON no PowerShell</h4>
5890  <div class="cmd">'{"model":"any","messages":[{"role":"user","content":"Explique MoE em 3 paragrafos"}]}' | Out-File -Encoding utf8 -FilePath "E:\\teste.json"</div>
5891
5892  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.4 — Executando a Chamada de Longa Duração</h4>
5893  <div class="cmd">curl.exe -X POST http://localhost:8081/v1/chat/completions -H "Content-Type: application/json" --max-time 600 -d "@E:\\teste.json"</div>
5894
5895  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.5 — Resultado Analítico</h4>
5896  <div class="cmd">truncated = 0  ◀ RESPOSTA COMPLETA ENTREGUE COM SUCESSO
5897total time = 266.42 s / 1955 tokens
5898eval time  = 255.97 s / 1683 tokens @ 6.57 t/s</div>
5899  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
5900    <strong>Veredicto técnico:</strong> O hardware de 2017 processou e entregou a resposta perfeitamente! O problema anterior era o tempo limite do navegador desistindo da conexão TCP, enquanto o servidor continuava gerando em background.
5901  </p>
5902
5903  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.5 — Paralelismo Real: 4 Slots de Computação</h3>
5904  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5905    Durante o Teste 9, o OpenWebUI foi conectado paralelamente disparando a mesma pergunta. O motor de agendamento do llama.cpp processou de forma concorrente sem travamentos:
5906  </p>
5907  <div class="cmd">Task 0 (curl)      — n_decoded = 1125, tg = 5.96 t/s
5908Task 875 (OpenWebUI) — n_decoded = 243,  tg = 5.08 t/s</div>
5909<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5910    A arquitetura resistiu de forma estável (GPU: 63°C, VRAM: 7.1/8.0 GB, RAM: 91% de uso de sistema total seguro, sem travar o Windows).
5911  </p>
5912
5913  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.6 — Teste 7: Habilitando Contexto Extremo (--ctx-size 8192)</h3>
5914  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.1 — O Comando Otimizado</h4>
5915  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
5916.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --p
5916ort 8081 --ctx-size 8192</div>
5917
5918  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.2 — Prompt de Teste e Comportamento do Thinking</h4>
5919  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">
5920    "Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."
5921  </blockquote>
5922  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5923    Ao receber o prompt, o processador de pensamento rodou por longos 9 minutos em background na CPU trabalhando com o contexto de 8192 tokens. A análise interna destrinchou a matemática da VRAM (calculou que 35B em INT4 exige 17,5GB de peso puro) para desvendar as complexidades de esparsidade de ativação.
5924  </p>
5925
5926  <h4 style="color:rgba(225,29,72,0.9);font-weight:700;font-size:0.95rem;margin-top:2rem;margin-bottom:0.5rem">34.6.2-A — O Raciocínio Interno do Modelo: Análise Comparativa dos Três Thinking Blocks</h4>
5927  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
5928    Durante as exaustivas sessões de ensaio das Seções 33 e 34, o Qwen3.5-35B gerou três blocos independentes de raciocínio de bastidores (<code>&lt;think&gt;</code>) que foram capturados via interceptação direta de pacotes brutos. A tabulação e o mapeamento sistemático dessas sessões fornecem evidências fundamentais de análise cognitiva do modelo:
5929  </p>
5930
5931  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">1. Thinking Block 1 — Quantização Q6_K — Sessão 1 (23:06 de 15/06)</h5>
5932  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
5933    <strong>Prompt:</strong> <em>"Explique detalhadamente o mecanismo de atenção nos Transformers e por que MoE é mais eficiente que modelos densos."</em><br>
5934    <strong>Tempo de Raciocínio:</strong> ~4 minutos | <strong>Tokens do Bloco:</strong> ~2.000 | <strong>Status:</strong> ✅ Concluído com Sucesso.
5935  </p>
5936  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
5937    <span style="color:#e11d48">// Linha de Pensamento do Qwen3.5 (Q6_K):</span><br>
5938    - Deconstruct query into structured chunks: Attention math, Multi-head, MoE, benefits vs dense.<br>
5939    - Detail Attention: Focus on Scaled Dot-Product mathematical formulation (Q, K, V). Show why division by sqrt(d_k) is required to prevent vanishing gradients during Softmax.<br>
5940    - Explain Multi-Head as parallel subspace projections (capturing both strict syntactic dependencies and semantic references).<br>
5941    - Deconstruct MoE: Discuss role of Router/Gating network, Routing sparsity (top-k selection), and load balancing to prevent routing collapse (unused experts).<br>
5942    - <span style="color:#a3e635">[Autocorreção Interna]</span>: "Wait, I must check if MoE is always faster. I should explicitly note that MoE is memory-intensive for routing/loading but highly sparse computationally. If memory bandwidth is bottlenecked under dual-system offloading, token generation speed depends strongly on mmap performance."
5943  </div>
5944
5945  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">2. Thinking Block 2 — Quantização Q4_K_M — Sessão 2 (05:05 de 16/06)</h5>
5946  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
5947    <strong>Prompt:</strong> <em>"Qual a diferença entre MoE e modelo denso, e por que MoE permite rodar 35B numa GPU de 8GB?"</em><br>
5948    <strong>Tempo de Raciocínio:</strong> ~11 minutos | <strong>Tokens do Bloco:</strong> ~3.500 | <strong>Status:</strong> ❌ Interrompido por esgotamento de contexto (Límite 4096).
5949  </p>
5950  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
5951    <span style="color:#e11d48">// Linha de Pensamento do Qwen3.5 (Q4_K_M):</span><br>
5952    - Analysis of premise: Running 35 billion parameter model in 8GB VRAM.<br>
5953    - <span style="color:#f43f5e">
5953[Cálculo Físico Espontâneo]</span>:<br>
5954      * FP32 weights: 35B * 4 bytes = 140 GB. Impossible.<br>
5955      * FP16 weights: 35B * 2 bytes = 70 GB. Impossible.<br>
5956      * INT8 quant:  35B * 1 byte = 35 GB. Impossible.<br>
5957      * INT4 quant:  35B * 0.5 bytes = 17.5 GB. Still larger than 8GB. This doesn't fit natively.<br>
5958    - Challenge the premise: "Wait, if the model indeed runs on 8GB, there must be extreme offloading, sparse activation memory loading, or aggressive hybrid quantization."<br>
5959    - <span style="color:#a3e635">[Autocorreção Crítica]</span>: "Ah! The user says 'por que o MoE permite rodar'. But actually, MoE weights are typically larger than equivalent dense models. A 35B MoE has 35B total parameters but only roughly 6B-8B active parameters per token. If we offload the inactive experts to system memory (RAM/mmap swap) and only load the active experts or the shared dense blocks onto the GPU, then the GPU memory footprint during active tensor computation is massively reduced. Let me structure this hypothesis."<br>
5960    - <span style="color:#d946ef">[Análise Meta-Arquitetural]</span>: Elaborating on the split mechanism. Router stays in VRAM for instant routing, shared blocks in VRAM, active experts fetched from RAM dynamically during forward pass.
5961  </div>
5962  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
5963    <em>Nota Conclusiva de Engenharia:</em> Enquanto o modelo formulava esse raciocínio fascinante na CPU, ele estava descrevendo em profundidade matemática exatamente o sistema de mmap distribuído e a arquitetura Vulkan de 4 níveis de memória que o sustentava em tempo real — sem possuir acesso direto aos metadados do container ou ao sistema de arquivos do laboratório.
5964  </p>
5965
5966  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">3. Thinking Block 3 — Quantização Q4_K_M — Sessão 2 (05:24 de 16/06)</h5>
5967  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
5968    <strong>Prompt:</strong> <em>"Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."</em><br>
5969    <strong>Tempo de Raciocínio:</strong> ~9 minutos | <strong>Tokens do Bloco:</strong> ~3.000 | <strong>Status:</strong> ✅ Concluído com Sucesso (--ctx-size 8192).
5970  </p>
5971  <div style="background:#090a0f;border:1px solid rgba(34,197,94,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a3e635;margin-bottom:1rem">
5972    <span style="color:#a3e635">// Linha de Pensamento do Qwen3.5 (Q4_K_M com limite otimizado):</span><br>
5973    - Prompt requests: Portuguese, direct, concise.<br>
5974    - Challenge VRAM claim again internally: MoE total size is bigger than dense, but active size is smaller. VRAM savings must come from smaller activation graphs (fewer experts evaluated simultaneously) and CPU-offloaded weight mapping.<br>
5975    - Work step-by-step to compress explanation to fit "direto e conciso":<br>
5976      * <span style="color:#cbd5e1">Rascunho v1:</span> Long theoretical detail on Router and CPU/VRAM exchange metrics.<br>
5977      * <span style="color:#cbd5e1">Refinamento v2:</span> Cut down router math, focus on "Ativação Esparsa" (activation memory bounds).<br>
5978      * <span style="color:#cbd5e1">Compressão Final:</span> Produce 3 crisp, highly readable Portuguese bullet points summarizing Active Parameters, Activation Garty/Memory limit, and Compute Scalability.
5979  </div>
5980<h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">Tabela Comparativa de Comportamento Cognitivo</h5>
5981  <div class="tbl">
5982    <table>
5983      <thead>
5984        <tr>
5985          <th>Métrica de Profiling</th>
5986          <th>Sessão 1 (Q6_K)</th>
5987          <th>Sessão 2-A (Q4_K_M)</th>
5988          <th>Sessão 2-B (Q4_K_M / ctx 8192)</th>
5989        </tr>
5990      </thead>
5991      <tbody>
5992        <tr><td><strong>Duração do Raciocínio</strong></td><td>~4 minutos</td><td><strong>~11 minutos</strong></td><td>~9 minutos</td></tr>
5993        <tr><td><strong>Volume do Bloco &lt;think&gt;</strong></td><td>~2.000 tokens</td><td><strong>~3.500 tokens</strong></td><td>~3.000 tokens</td></tr>
5994        <tr><td><strong>Autocorreções Efetuadas</strong></td><td>2</td><td><strong>7 (Autocorreções profundas)</strong></td><td>4 (Foco em concisão)</td></tr>
5995        <tr><td><strong>Questionamento de Premissa?</strong></td><td>Não</td><td><strong>✅ Sim (Provou erro matemático do prompt)</strong></td><td>Sim (reajuste técnico)</td></tr>
5996        <tr><td><strong>Raciocínio Matemático</strong></td><td>Equação Transformers</td><td><strong>Cálculo do tamanho de pesos reais</strong></td><td>Cálculo de buffers de ativação</td></tr>
5997        <tr><td><strong>Entrega do Texto</strong></td><td>✅ Sucesso</td><td>❌ Estouro (4096 esgotados)</td><td><strong>✅ Sucesso Absoluto (Zero cortes)</strong></td></tr>
5998      </tbody>
5999    </table>
6000  </div>
6001
6002  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.8 — Cronograma Histórico do Laboratório</h3>
6003  <div class="tbl">
6004    <table>
6005      <thead>
6006        <tr>
6007          <th>Sessão do Experimento</th>
6008          <th>ID</th>
6009          <th>Parâmetros de Ctx</th>
6010          <th>Geração (tok/s)</th>
6011          <th>Corte de Fluxo (truncated)</th>
6012          <th>Resultado Efetivo</th>
6013        </tr>
6014      </thead>
6015      <tbody>
6016        <tr><td>Seção 34 — Teste 5</td><td>Q6_K</td><td>4096 tokens</td><td>5,57 t/s</td><td>0 (prompt enxuto)</td><td>✅ Resposta entregue (contexto enxuto)</td></tr>
6017        <tr><td>Seção 34 — Teste 9 (curl)</td><td>Q4_K_M</td><td>4096 tokens</td><td><strong>6,57 t/s</strong></td><td>0 (sem timeout)</td><td>
6017✅ Resposta integral por canal direto</td></tr>
6018        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Seção 34 — Teste 7 (WebUI)</strong></td><td>Q4_K_M</td><td>8192 tokens</td><td>6,42 t/s</td><td>0</td><td>✅ Resposta completa com raciocínio expandido</td></tr>
6019      </tbody>
6020    </table>
6021  </div>
6022
6023  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.9 — Nova Coleção de Lições Técnicas Consolidadas</h3>
6024  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
6025    <li><strong style="color:#fff">Lição 6 — O fator Timeout do Cliente:</strong> A maior parte dos erros apontados por testadores não decorre de incapacidade física da GPU, mas sim da persistência HTTP falha de interfaces que desistem antes da decodificação final.</li>
6026    <li><strong style="color:#fff">Lição 7 — Ajuste de Buffers de Contexto:</strong> Ativar a diretiva <code>--ctx-size 8192</code> remove o limite asfixiante do buffer de raciocínio, oferecendo fôlego de processamento para os mais de 3.500 tokens exigidos de raciocínio lógico interno.</li>
6027    <li><strong style="color:#fff">Lição 8 — Supremacia de Carregamento da Quantização Média:</strong> Rodar 35B com quantização de 4 bits economiza 7GB cruciais na carga física de RAM da CPU, reduzindo o I/O do Swap do disco e otimizando a temperatura.</li>
6028    <li><strong style="color:#fff">Lição 9 — Raciocínio de Modelo Crítico:</strong> O Qwen3.5 MoE questionou a premissa errônea presente no prompt, calculando pesos em tempo real e rebatendo sobre o offloading híbrido, o que prova comportamento de atenção e alinhamento impecáveis.</li>
6029    <li><strong style="color:#fff">Lição 10 — Paralelismo nativo estável:</strong> A coexistência de chamadas em canais concorrentes prova a maturidade das implementações de pipeline de shaders Vulkan no llama.cpp.</li>
6030  </ul>
6031
6032  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.10 — Setup Recomendado para Implementações Futuras</h3>
6033  <div class="cmd"># Script do Laboratório para inicialização de produção
6034cd E:\\llama.cpp\\build\\bin\\Release
6035 
6036.\\llama-server.exe \`
6037  -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" \`
6038  --host 0.0.0.0 \`
6039  --port 8081 \`
6040  --ctx-size 8192</div>
6041  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
6042    *Instruções de interface complementares: Desativação estrita de Web Search e geração e imagens durante o processamento híbrido extremo.
6043  </p>
6044
6045  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.11 — Veredicto Geral do Laboratório (Provando a Hipótese)</h3>
6046  <div class="tbl">
6047    <table>
6048      <thead>
6049        <tr>
6050          <th>Questão de Engenharia</th>
6051          <th>Veredicto Final</th>
6052        </tr>
6053      </thead>
6054      <tbody>
6055        <tr><td><strong>O curl resolve o timeout do OpenWebUI?</strong></td><td>✅ <strong>Sim</strong> (truncated = 0, resposta 100% íntegra)</td></tr>
6056        <tr><td><strong>CTX-SIZE de 8.192 resolve o thinking mode esmagado?</strong></td><td>✅ <strong>Sim</strong> (Acomoda com folga raciocínios longos)</td></tr>
6057        <tr><td><strong>Q4_K_M é superior para o cenário de 32GB de RAM?</strong></td><td>✅ <strong>Sim</strong> (Mais rápido, mais frio, menor swap)</td></tr>
6058        <tr><td><strong>A hipótese de esgotamento de contexto foi confirmada?</strong></td><td>✅ <strong>Absolutamente</strong></td></tr>
6059        <tr><td><strong>Sobrecusto financeiro para otimização em 2026?</strong></td><td>✅ <strong>R$ 0,00</strong> (Solução lógica via flags)</td></tr>
6060      </tbody>
6061    </table>
6062  </div>
6063
6064  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.12 — Tags e Metadados</h3>
6065  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
6066    <div>🏷️ <strong>Tags:</strong> curl, ctx-size, timeout, openwebui, q4km, q6k, paralelismo, thinking-mode, resposta-completa, hipotese-confirmada, rx580</div>
6067    <div style="margin-top:0.5rem">💻 <strong>Hardware:</strong>
6067 RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
6068    <div style="margin-top:0.25rem">💿 <strong>Software:</strong> llama.cpp (build\\bin\\Release) + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
6069    <div style="margin-top:0.25rem">📅 <strong>Data:</strong> 16/06/2026</div>
6070    <div style="margin-top:0.25rem">📊 <strong>Testes:</strong> 3 (Teste 9 curl, paralelismo real, Teste 7 ctx8192)</div>
6071    <div style="margin-top:0.25rem">📈 <strong>Benchmark:</strong> 6,42–6,65 tok/s (Q4_K_M) | truncated = 0</div>
6072    <div style="margin-top:0.25rem">🔥 <strong>Temperatura pico:</strong> 74°C</div>
6073    <div style="margin-top:0.25rem">🏆 <strong>Status final:</strong> ✅ HIPÓTESE CONFIRMADA</div>
6074  </div>
6075
6076  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
6077    "O problema nunca foi o hardware. Era uma flag e um timeout."<br>
6078    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 16/06/2026</span>
6079  </blockquote>
6080
6081  <div class="footer">
6082    Documentação gerada por Claude Sonnet 4.6 — 16/06/2026 · Baseada em logs reais, screenshots e benchmarks ao vivo · 3 testes documentados · Hipótese confirmada · Hardware de 2017 processando IA de 2025
6083  </div>
6084</div>`},proximos:{id:"proximos",title:"34. PRÓXIMOS PASSOS (ROADMAP 2027)",desc:"Próximas metas de desenvolvimento: Clusters Multi-GPU Vulkan e malha local de agentes autônomos.",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"planejamento",difficulty:"beginner",estimated_time_min:10,tags:["roadmap-2027","planejamento-tecnico","novas-verticais"],last_reviewed:"2026-07-01",relationships:{prerequisites:["codacus"],previous:"codacus",next:"arquivos",related:["jornada","meta"]}},html:`<div class="card" style="border-left:3px solid #22c55e">
6085    <p style="font-size:.88rem;color:#fff;font-weight:600">Planejamento de Expansão do Infraestrutura Computacional:</p>
6086    <ul style="padding-left:1.2rem;margin-top:.45rem;font-size:.85rem;color:#94a3b8;line-height:2">
6087      <li><strong style="color:#fff">[ ] Homologação de Cluster Multi-GPU:</strong> Acoplamento de uma segunda placa de vídeo RX 580 em paralelo via Vulkan para distribuição de tensores de peso.</li>
6088      <li><strong style="color:#fff">[ ] Mapeamento de Agentes Locais Autônomos:</strong> Integração completa do framework CrewAI rodando nativamente sobre a API do OpenWebUI para automação empresarial.</li>
6089    </ul>
6090  </div>`},scripts:{id:"scripts",title:"21. SKRIPTE UND AUTOMATISIERUNG",desc:"Batch-Skripte zum Bereinigen des Videospeichers und zum konfliktfreien Starten lokaler Server.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:15,tags:["reboot-stack","memory-flush","manutencao-servidor"],last_reviewed:"2026-07-01",relationships:{prerequisites:["stack"],previous:"stack",next:"guia",related:["reboot_stack","sd_bat_automation"]}},html:`<h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">19.A — Master-Skript (Alle Dienste)</h4>
6091  <div class="code"><span class="code-lang">batch</span><pre>@echo off
6092title INFRASTRUCTURE IA - REBOOT STACK
6093cls
6094echo Erzwinge Beenden aktiver Hintergrundinstanzen...
6095taskkill /F /IM sd-server.exe 2>nul
6096taskkill /F /IM llama-server.exe 2>nul
6097timeout /t 2 /nobreak >nul
6098
6099echo Initialisiere LLM via Vulkan auf der RX 580 (Port 8081)...
6100start "LLM Server - Vulkan RX580" C:\\llama.cpp\\build\\bin\\Release\\llama-server.exe ^
6101  -m "E:\\MODELO LLM PARA GPU\\Mistral-7B-Q4_K_M.gguf" ^
6102  --host 0.0.0.0 ^
6103  --port 8081 ^
6104  --device Vulkan0
6105
6106timeout /t 3 /nobreak >nul
6107
6108echo Initialisiere SD Server via Vulkan auf der RX 580 (Port 7860)...
6109E:
6110cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
6111sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
6112  -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
6113
6114pause</pre></div>
6115
6116  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.B — LLM mit OpenWebUI verbinden</h4>
6117  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">
6117Nachdem der llama-server gestartet wurde, verbinden Sie ihn mit OpenWebUI:</p>
6118  <ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:.75rem">
6119    <li>Rufen Sie <code style="color:var(--r)">http://localhost:3000</code> auf</li>
6120    <li>Klicken Sie auf den Avatar → <strong style="color:#fff">Administrationsbereich</strong></li>
6121    <li>Gehen Sie zu <strong style="color:#fff">Einstellungen → Verbindungen</strong></li>
6122    <li>Klicken Sie im Abschnitt <strong style="color:#fff">OpenAI API</strong> auf <strong style="color:#fff">"+"</strong></li>
6123    <li>Füllen Sie die folgenden Felder aus:</li>
6124  </ol>
6125  <div class="tbl"><table>
6126    <thead><tr><th>Feld</th><th>Wert</th></tr></thead>
6127    <tbody>
6128      <tr><td>URL</td><td><code>http://host.docker.internal:8081/v1</code></td></tr>
6129      <tr><td>API Key</td><td><code>sk-local</code></td></tr>
6130    </tbody>
6131  </table></div>
6132  <ol start="6" style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-top:.75rem">
6133    <li>Klicken Sie auf das <strong style="color:#fff">Aktualisieren</strong>-Symbol — es sollte ein grüner Balken erscheinen ✅</li>
6134    <li>Speichern</li>
6135  </ol>
6136  <div class="card" style="margin-top:.75rem;border-left:3px solid #eab308;padding-left:.9rem">
6137    <p style="font-size:.85rem;color:#94a3b8;line-height:1.8"><strong style="color:#eab308">⚠️ Verwenden Sie nicht <code>127.0.0.1</code></strong> — Docker läuft in einem isolierten WSL2-Netzwerk und kann den Windows-localhost nicht sehen. Verwenden Sie immer <code style="color:var(--r)">host.docker.internal</code>.</p>
6138  </div>
6139
6140  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.C — Validierung im Chat</h4>
6141  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Öffnen Sie nach dem Speichern einen <strong style="color:#fff">Neuen Chat</strong> in OpenWebUI:</p>
6142  <ul style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem">
6143    <li>Das Modell <code style="color:var(--r)">Mistral-7B-Q4_K_M.gguf</code> erscheint in der Liste unter <strong style="color:#fff">Extern</strong></li>
6144    <li>Wählen Sie es aus und chatten Sie wie gewohnt</li>
6145    <li>Das Modell läuft zu 100% auf der <strong style="color:#fff">RX 580 via Vulkan</strong> — nicht über Ollama</li>
6146  </ul>
6147
6148  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.D — Überprüfung der GPU-Nutzung (statt CPU)</h4>
6149  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem">Bestätigen Sie dies im Terminal des llama-server:</p>
6150  <div class="code"><span class="code-lang">log</span><pre>ggml_vulkan: Found 1 Vulkan device(s)
6151ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
6152llama server listening at http://0.0.0.0:8081</pre></div>
6153  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:.75rem 0 .5rem 0">Und während der Inferenz erscheint der Benchmark:</p>
6154  <div class="code"><span class="code-lang">log</span><pre>17.77 t/s  ← RX 580 Vulkan ✅</pre></div>
6155  <div class="card" style="margin-top:.75rem">
6156    <p style="font-size:.85rem;color:#64748b;line-height:1.8">Wenn nur <code>3-5 t/s</code> ohne die Zeile <code>ggml_vulkan</code> angezeigt werden, läuft es auf der CPU. Überprüfen Sie, ob <code style="color:var(--r)">--device Vulkan0</code> im Befehl enthalten ist.</p>
6157  </div>
6158
6159  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.E — Drei verfügbare Schnittstellen</h4>
6160  <div class="tbl"><table>
6161    <thead><tr><th>Schnittstelle</th><th>URL</th><th>Verwendung</th></tr></thead>
6162    <tbody>
6163      <tr><td><strong style="color:#fff">llama.cpp native UI</strong></td><td><code>http://127.0.0.1:8081</code></td><td>Schnelltests direkt im Browser</td></tr>
6164      <tr class="hig"><td><strong style="color:#fff">OpenWebUI</strong></td><td><code>http://localhost:3000</code></td><td>Täglicher Gebrauch mit Verlauf und RAG</td></tr>
6165      <tr><td><strong style="color:#fff">Direkte API</strong></td><td><code>http://192.168.15.68:8081/v1</code></td><td>Integration mit anderen Apps</td></tr>
6166    </tbody>
6167  </table></div>
6168
6169  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.F — Kritische Skriptregeln</h4>
6170  <div class="tbl"><table>
6171    <thead><tr><th>
6171Regel</th><th>Grund</th></tr></thead>
6172    <tbody>
6173      <tr class="hig"><td><code>--host 0.0.0.0</code> erforderlich</td><td><code>127.0.0.1</code> blockiert Docker</td></tr>
6174      <tr class="hig"><td><code>--device Vulkan0</code> erforderlich</td><td>Ohne dies erfolgt Fallback auf CPU (3-5 t/s)</td></tr>
6175      <tr><td><code>taskkill</code> vor dem Start</td><td>Gibt VRAM von hängengebliebenen Prozessen frei</td></tr>
6176      <tr><td><code>host.docker.internal</code> in OpenWebUI</td><td>Einzige Adresse, die Docker auf dem Windows-Host sieht</td></tr>
6177    </tbody>
6178  </table></div>`},sd_bat_automation:{id:"sd_bat_automation",title:"12. SD-SERVER LOCAL / BOOT SEQUENCE",desc:"Script de lote dedicado para inicialização segura e reproduzível do servidor de IA.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:12,tags:["batch-automation","loop-monitoramento","gerenciamento-portas"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux_server"],previous:"flux_server",next:"sd_openwebui_integration",related:["scripts","reboot_stack"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Para evitar erros manuais, caminhos incorretos ou portas presas na VRAM ao reiniciar o Windows, o servidor deve ser iniciado exclusivamente via arquivo <code>.bat</code> na Área de Trabalho.</p>
6179
6180<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Script de Produção (iniciar_ia_server.bat):</strong></p>
6181<pre style="font-family:'JetBrains Mono',monospace;font-size:11px">@echo off
6182title Servidor Stable Diffusion Local - Producao
6183cls
6184
6185:: 1. Limpeza de processos fantasmas na VRAM/RAM
6186taskkill /f /im sd-server.exe 2>nul
6187taskkill /f /im sd-cli.exe 2>nul
6188timeout /t 2 /nobreak >nul
6189
6190:: 2. Salto de unidade e rota nativa (CMD syntax)
6191E:
6192cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
6193
6194:: 3. Execucao com escuta aberta para Docker
6195sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
6196
6197pause</pre>
6198
6199<div class="tbl" style="margin:1.25rem 0">
6200  <table>
6201    <thead>
6202      <tr><th>Regra</th><th>Motivo</th></tr>
6203    </thead>
6204    <tbody>
6205      <tr><td>Nunca usar <code>.\\</code> antes do executável</td><td>CMD tradicional não reconhece — quebra o terminal</td></tr>
6206      <tr><td>Bloco <code>taskkill</code> obrigatório</td><td>Libera porta 7860 travada em processos background</td></tr>
6207      <tr><td>Salto de unidade (<code>E:</code>) antes do <code>cd</code></td><td>CMD não muda de drive sem o salto explícito</td></tr>
6208    </tbody>
6209  </table>
6210</div>
6211
6212<div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;">
6213  <span style="color:#22c55e; font-weight:bold">✅ STATUS: AUTOMAÇÃO VALIDADA EM PRODUÇÃO</span><br>
6214  <span style="font-size:.8rem; color:#94a3b8">Dois cliques no .bat inicializam o ecossistema completo — limpeza, rota e bind de porta em sequência</span>
6215</div>`},sd_openwebui_integration:{id:"sd_openwebui_integration",title:"13. INTEGRAÇÃO OPENWEBUI + DOCKER",desc:"Ponte de rede entre o contêiner Docker do OpenWebUI e o motor C++ nativo rodando na GPU do host.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"integracao",difficulty:"advanced",estimated_time_min:35,tags:["open-webui","docker-compose","networking-docker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_bat_automation"],previous:"sd_bat_automation",next:"comfyui-wsl",related:["sdserver","comfyui-wsl"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Quando o motor de geração roda fora do contêiner Docker, a comunicação local padrão (<code>127.0.0.1</code>) é bloqueada pelo isolamento de rede e pelo Firewall do Windows. A inicialização e a rota precisam ser explícitas.</p>
6216
6217<p style="font-size:.88rem;color:#fff;margin-bottom:.5rem">⚙️ <strong>Parâmetros Críticos de Inicialização</strong></p>
6218<div class="tbl" style="margin-bottom:1.25rem">
6219  <table>
6220    <thead>
6221      <tr><th>Flag</th><th>Valor</th><th>Descrição</th></tr>
6222    </thead>
6223    <tbody>
6224      <tr><td><code>--listen-ip</code></td><td><code>0.0.0.0</code></td><td>Abre escuta para requisições externas ao host (Docker)</td></tr>
6225      <tr><td><code>--listen-port</code></td><td><code>7860</code></td><td>Porta padrão de integração com OpenWebUI</td></tr>
6226      <tr><td><code>-m</code></td><td>caminho absoluto</td><td>Modelo SD 1.5 / XL em <code>.safetensors</code> ou <code>.gguf</code></td></tr>
6227    </tbody>
6228  </table>
6229</div>
6230
6231<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Comando de Produção — SD 1.5 / DreamShaper:</strong></p>
6232<pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"</pre>
6233
6234<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:1rem 0">⚠️ <strong style="color:#fff">Nota de Arquitetura:</strong> Modelos Flux.1 não são compatíveis com esta build via flag <code>-m</code> simples — retornam <code>[ERROR] main.cpp:92 - new_sd_ctx_t failed</code>. Para Flux, use o comando dedicado da seção 10.A com flags <code>--diffusion-model</code>, <code>--vae</code>, <code>--clip_l</code> e <code>--t5xxl</code> separadamente.</p>
6235
6236<p style="font-size:.88rem;color:#fff;margin-bottom:.75rem">🔌 <strong>Configuração de Rota no OpenWebUI</strong></p>
6237<ol style="font-size:.88rem;color:#94a3b8;line-height:2;margin-left:1.25rem">
6238  <li>Acesse <code>http://localhost:3000</code></li>
6239  <li>Vá em <strong>Configurações &gt; Imagens</strong> (Painel do Administrador)</li>
6240  <li>Selecione o motor <strong>Automatic1111</strong></li>
6241  <li>Insira o IP local da máquina com <code>/</code> obrigatório no final:<br>
6242    <code style="color:#22c55e">http://192.168.15.68:7860/</code>
6243  </li>
6244  <li>Clique em <strong>Salvar</strong> — tarja verde confirmará a ponte de rede</li>
6245</ol>
6246
6247<div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin:1.25rem 0">
6248  <strong style="color:#ef4444;display:block;margin-bottom:.4rem">🔒 Liberação Obrigatória no Windows Defender Firewall</strong>
6249  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem">O Windows Defender bloqueia silenciosamente conexões vindas da subrede interna do Docker (<code>172.17.0.0/16</code>) e do WSL2 (<code>172.x.x.x</code>) por padrão. Sem esta regra, o OpenWebUI não consegue alcançar o sd-server mesmo com <code>--listen-ip 0.0.0.0</code> ativo.</p>
6250  <p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>Método 1 — Interface Gráfica (recomendado para primeira instalação):</strong></p>
6251  <ol style="font-size:.82rem;color:#94a3b8;line-height:1.6;margin-left:1.25rem;margin-bottom:.5rem">
6252    <li>Abra: <code>Painel de Controle → Windows Defender Firewall → Configurações Avançadas</code></li>
6253    <li>Clique em: <code>
6253Regras de Entrada → Nova Regra</code></li>
6254    <li>Tipo: <code>Porta</code></li>
6255    <li>Protocolo: <code>TCP</code> | Porta: <code>7860</code></li>
6256    <li>Ação: <code>Permitir a conexão</code></li>
6257    <li>Perfis: marque <code>Domínio</code>, <code>Privado</code> e <code>Público</code></li>
6258    <li>Nome: <code>sd-server AIVisionsLab</code></li>
6259  </ol>
6260  <p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>Método 2 — PowerShell (uma linha, execução como Administrador):</strong></p>
6261  <pre style="font-family:'JetBrains Mono',monospace;font-size:10px;margin-bottom:.5rem">New-NetFirewallRule -DisplayName "sd-server AIVisionsLab" -Direction Inbound -Protocol TCP -LocalPort 7860 -Action Allow</pre>
6262  <p style="font-size:.82rem;color:#94a3b8;margin:0"><strong>Validação:</strong> Após criar a regra, reinicie o sd-server e tente gerar uma imagem pelo OpenWebUI. A tarja verde na configuração de imagens confirma a ponte ativa.</p>
6263</div>
6264
6265<p style="font-size:.88rem;color:#fff;margin:1rem 0 .5rem">📊 <strong>Logs de Sucesso Esperados</strong></p>
6266<pre style="font-family:'JetBrains Mono',monospace;font-size:11px">[INFO] main.cpp:148 - listening on: http://0.0.0.0:7860
6267[INFO] stable-diffusion.cpp:3987 - generate_image 512x512
6268[INFO] stable-diffusion.cpp:4218 - generate_image completed in X.XXs</pre>
6269
6270<div class="card" style="border-left:3px dashed var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);margin-top:1.25rem">
6271  <strong style="color:#fff;display:block;margin-bottom:.4rem">⚠️ Nota de Compatibilidade de Flags — sd-server</strong>
6272  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem">O repositório <code>leejet/stable-diffusion.cpp</code> passou por renomeação de argumentos CLI ao longo de suas versões. Dependendo do commit compilado:</p>
6273  <div class="tbl" style="margin-bottom:.75rem">
6274    <table>
6275      <thead>
6276        <tr><th>Versão / Build</th><th>Flags Corretas</th></tr>
6277      </thead>
6278      <tbody>
6279        <tr><td>Builds antigas (pré master-600)</td><td><code>
6279--host 0.0.0.0 --port 7860</code></td></tr>
6280        <tr><td>Builds recentes (master-600+)</td><td><code>--listen-ip 0.0.0.0 --listen-port 7860</code></td></tr>
6281      </tbody>
6282    </table>
6283  </div>
6284  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem"><strong>Diagnóstico rápido:</strong> Se o terminal retornar <code>error: unknown argument '--listen-ip'</code>, substitua imediatamente por <code>--host</code> e <code>--port</code>. O comportamento de rede é idêntico — apenas a nomenclatura do argumento foi atualizada.</p>
6285  <p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>Validação da sua versão:</strong></p>
6286  <pre style="font-family:'JetBrains Mono',monospace;font-size:10px;margin:0">E:\\stable-diffusion.cpp\\build\\bin\\Release\\sd-server.exe --help
6287# Procure na listagem: se aparecer "--listen-ip", use a sintaxe nova.
6288# Se aparecer "--host", use a sintaxe antiga.</pre>
6289</div>`},sdcpp:{id:"sdcpp",title:"08. COMPILAÇÃO DO STABLE-DIFFUSION.CPP",desc:"Gerando o motor limpo em C++ para renderização de imagens acelerada por GPU sem dependências CUDA.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["sdcpp","stable-diffusion-cpp","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["llama"],previous:"llama",next:"modelos",related:["sdserver","flux_server"]}},html:`<div class="note">⚠ Compilação via <strong>Developer PowerShell</strong> · Execução posterior via <strong>PowerShell Comum</strong></div>
6290  <div class="code"><pre># Clonagem estruturada trazendo todos os submódulos de dependência vinculados
6291git clone --recursive https://github.com/leejet/stable-diffusion.cpp
6292cd stable-diffusion.cpp
6293mkdir build
6294cd build
6295
6296# Mapear o compilador ativando a engine Vulkan e compilar os binários em modo de performance
6297cmake .. -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
6298cmake --build . --config Release -j20</pre></div>
6299  <div class="code ok" style="margin-top:.75rem"><pre># Logs finais de compilação bem-sucedida:
6300-- Found Vulkan: C:/VulkanSDK/1.4.341.1/Lib/vulkan-1.lib
6301[100%] Built target sd-server ✅</pre></div>`},sdserver:{id:"sdserver",title:"10. INICIALIZAÇÃO DO SERVIDOR SD-SERVER (GPU)",desc:"Ativação do serviço de imagem na porta local para escuta das chamadas de API da interface gráfica.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"intermediate",estimated_time_min:15,tags:["sd-server","api-rest","inferenca-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["modelos"],previous:"modelos",next:"flux_server",related:["sd_bat_automation","sd_openwebui_integration"]}},html:`<div class="note ok">
6301✅ Inicialização homologada: Execute este bloco de código dentro do <strong>PowerShell Comum</strong></div>
6302  <div class="code"><pre># Levantar o servidor apontando para o modelo quantizado e definindo o host de escuta
6303E:\\stable-diffusion.cpp\\build\\bin\\Release\\sd-server.exe \\
6304  -m "E:\\models\\dreamshaper8.gguf" \\
6305  --host 0.0.0.0 \\
6306  --port 7860</pre></div>
6307  <div class="code ok" style="margin-top:.75rem"><pre># Monitoramento do terminal:
6308ggml_vulkan: Found 1 Vulkan device(s)
6309ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
6310Server listening on http://0.0.0.0:7860 ✅</pre></div>`},sdxl_vulkan:{id:"sdxl_vulkan",title:"26. SDXL & FLUX.1 VULKAN: HOHE AUFLÖSUNG AUF POLARIS",desc:"Vollständige Abbildung der Herausforderung für hochauflösende Diffusion (1024x1024) via Vulkan und strukturiertes Tensor-Offloading auf 8GB-Silizium.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:40,tags:["sdxl","vulkan-diffusion","segmentacao-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proving_hypothesis_35b"],previous:"proving_hypothesis_35b",next:"",related:["animatediff-video","flux-vulkan"]}},html:`<div class="page">
6311
6312  <div class="hero">
6313    <div class="hero-eyebrow">AIVisionsLab — Abschnitt 26</div>
6314    <div class="hero-title">SDXL 1024×1024 auf RX 580 via Vulkan:<br>die Herausforderung von AMD, live beantwortet</div>
6315    <div class="hero-sub">AMD RX 580 8GB (2017) · stable-diffusion.cpp (leejet) · Vulkan · kein CUDA · kein ROCm · hybrider CPU/GPU-Split · fotorealistischer Output bestätigt</div>
6316  </div>
6317
6318  <div class="badges">
6319    <span class="badge badge-red">RX 580 · GCN 4th gen</span>
6320    <span class="badge badge-blue">Vulkan backend</span>
6321    <span class="badge badge-gray">stable-diffusion.cpp</span>
6322    <span class="badge badge-green">SDXL 1024×1024 ✓</span>
6323    <span class="badge badge-amber">hybrider CPU/GPU-Split</span>
6324  </div>
6325
6326  <h2>Kontext: Die Herausforderung kam aus dem AMD Discord</h2>
6327  <p>Während wir im offiziellen Server der AMD Developer Community über ROCm vs. Vulkan diskutierten, hinterfragte ein Mitglied live die Grenzen des Stacks. Die Antwort war keine Spekulation — wir führten den Benchmark in Echtzeit durch und posteten das Ergebnis mit Screenshots, Logs und dem generierten Bild direkt im AMD-Server.</p>
6328
6329  <div class="discord-card">
6330    <div class="discord-header"><i class="ti ti-brand-discord" aria-hidden="true"></i> AMD Developer Community · #rocm-ai-assistant</div>
6331    <div class="discord-body">
6332      <div class="discord-quote">
6333        <div class="author">POIZONE 🔥</div>
6334        <p>"Love the RX 580 flex. Which SD backend are you using, stable-diffusion.cpp on Vulkan? And does it support SDXL or Flux, or only SD1.5?"</p>
6335      </div>
6336      <div class="discord-reply">Antwort: Wir haben den Test live während des Gesprächs durchgeführt. Das Ergebnis — SDXL 1.0 @ 1024×1024 bestätigt, inklusive Logs, Task-Manager-Screenshots und generiertem Bild — wurde im selben Kanal gepostet. Der ROCm AI Assistant (offizieller AMD-Bot) antwortete und erkannte an, dass Vulkan die legitime Wahl für Hardware außerhalb des ROCm-Supports ist.</div>
6337    </div>
6338  </div>
6339
6340  <h2>Das Problem: 6,9 GB Modell, 8 GB VRAM</h2>
6341  <p>Das SDXL-Basismodell wiegt ca. 6,9 GB in FP16. Mit Aktivierungs-Buffern während der Inferenz sprengt dies die 8 GB der RX 580, wenn alles in die GPU geladen wird. Die Lösung ist ein selektives Offloading nach Komponenten — stable-diffusion.cpp (leejet-Fork) unterstützt dies nativ, mit derselben Logik, die wir bereits für FLUX.1-schnell mit <code>--clip-on-cpu</code> verwenden.</p>
6342  <p>Ein zweites, stilles Problem: Der originale VAE von SDXL erzeugt NaN in FP16, und der ggml_conv_2d von sd.cpp arbeitet nur in FP16. Ohne den korrekten Fix bleibt das Bild schwarz — ohne sichtbare Fehlermeldung im Log.</p>
6343
6344  <div class="gotcha-box">
6345    <div class="gotcha-title">⚠ Obligatorisches Gotcha — VAE FP16 Fix</div>
6346    <p>Verwenden Sie immer <strong>sdxl_vae-fp16-fix.safetensors</strong> (madebyollin) anstelle des originalen VAE. Ohne diesen: schwarzes Bild, lautlos, bei jedem Render. Das Flag <code>--vae</code> verweist auf diese Datei, nicht auf den im Checkpoint eingebetteten VAE.</p>
6347  </div>
6348
6349  <h2>Lösung: Hybrider CPU/GPU-Split</h2>
6350  <p>UNet vollständig im VRAM. Text-Encoder und VAE-Decode im RAM. Das Flag <code>--vae-tiling</code>
6350 unterteilt die Dekodierung in 32×32-Tiles, um die Speicherspitze in der letzten Pipeline-Phase zu eliminieren.</p>
6351
6352  <div class="code-block">
6353    <div class="code-label">PowerShell — E:\\stable-diffusion.cpp\\build\\bin\\Release\\</div>
6354    <pre>.\\sd-server.exe \`
6355  --listen-ip 0.0.0.0 \`
6356  --listen-port 8081 \`
6357  -m E:\\models\\sd_xl_base_1.0.safetensors \`
6358  --vae E:\\models\\sdxl_vae-fp16-fix.safetensors \`
6359  --clip-on-cpu \`
6360  --vae-on-cpu \`
6361  --vae-tiling \`
6362  -H 1024 -W 1024 -v</pre>
6363  </div>
6364
6365  <table class="flag-table">
6366    <thead><tr><th>Flag</th><th>Effekt</th><th>Freigegebener VRAM</th></tr></thead>
6367    <tbody>
6368      <tr><td>--clip-on-cpu</td><td>CLIP-L + OpenCLIP-bigG laufen während des Conditioners im RAM</td><td>~1,56 GB</td></tr>
6369      <tr><td>--vae-on-cpu</td><td>VAE-Decode läuft auf CPU/RAM — eliminiert Spitze am Pipeline-Ende</td><td>~416 MB</td></tr>
6370      <tr><td>--vae-tiling</td><td>Unterteilt Decode in 32×32-Tiles (49 Tiles bei 1024×1024)</td><td>— (reduziert RAM-Spitze)</td></tr>
6371    </tbody>
6372  </table>
6373
6374  <h2>Speicher-Split in den Logs bestätigt</h2>
6375
6376  <div class="log-block">
6377    <pre><span class="comment"># Ausgabe von sd-server nach vollständigem Laden des Modells:</span>
6378
6379total params memory size = 6624.11MB
6380<span class="highlight">  VRAM  4900.07MB  →  diffusion_model (UNet)</span>
6381<span class="highlight">  RAM   1564.36MB  →  text_encoders (CLIP-L + OpenCLIP-bigG)</span>
6382<span class="highlight">  RAM    159.68MB  →  vae</span>
6383
6384listening on: http://0.0.0.0:8081</pre>
6385  </div>
6386
6387  <div class="memory-split">
6388    <div class="mem-card gpu">
6389      <div class="mem-label">GPU · VRAM</div>
6390      <div class="mem-value">4,9 GB</div>
6391      <div class="mem-sub">UNet (diffusion_model)</div>
6392    </div>
6393    <div class="mem-card ram">
6394      <div class="mem-label">CPU · RAM</div>
6395      <div class="mem-value">1,56 GB</div>
6396      <div class="mem-sub">CLIP-L + OpenCLIP-bigG</div>
6397    </div>
6398    <div class="mem-card ram">
6399      <div class="mem-label">CPU · RAM</div>
6400      <div class="mem-value">160 MB</div>
6401      <div class="mem-sub">VAE decode (49 tiles)</div>
6402    </div>
6403  </div>
6404
6405  <h2>Generierungstest via PowerShell</h2>
6406  <p>Warum wir nicht Open WebUI nutzen: Es war bereits für FLUX.1-schnell auf einem anderen Port konfiguriert. Eine Neukonfiguration hätte ein funktionierendes Setup gefährdet. Das Terminal ist schneller, ohne zu speichernden Status und ohne Port-Konflikte.</p>
6407
6408  <div class="code-block">
6409    <div class="code-label">PowerShell — Prompt-Versand via A1111-kompatibler API</div>
6410    <pre>$body = @{
6411    prompt         = "a lovely cat, detailed fur, studio lighting"
6412    negative_prompt = ""
6413    width          = 1024
6414    height         = 1024
6415    steps          = 20
6416    cfg_scale      = 7
6417    sampler_name   = "Euler a"
6418} | ConvertTo-Json
6419
6420$response = Invoke-RestMethod \`
6421    -Uri "http://localhost:8081/sdapi/v1/txt2img" \`
6422    -Method Post \`
6423    -ContentType "application/json" \`
6424    -Body $body
6425
6426$bytes = [Convert]::FromBase64String($response.images[0])
6427[IO.File]::WriteAllBytes("E:\\models\\teste_sdxl_1024.png", $bytes)</pre>
6428  </div>
6429
6430  <h2>Vollständiger Benchmark</h2>
6431
6432  <div class="bench-grid">
6433    <div class="bench-card">
6434      <div class="bench-phase">Conditioner (CLIP)</div>
6435      <div class="bench-time">~4s</div>
6436      <div class="bench-detail">CPU/RAM · CLIP-L + OpenCLIP-bigG</div>
6437    </div>
6438    <div class="bench-card">
6439      <div class="bench-phase">UNet sampling</div>
6440      <div class="bench-time">267s</div>
6441      <div class="bench-detail">20 steps · Euler A · 13.37s/it · RX 580 Vulkan</div>
6442    </div>
6443    <div class="bench-card">
6444      <div class="bench-phase">VAE decode</div>
6445      <div class="bench-time">~390s</div>
6446      <div class="bench-detail">49 tiles 32×32 · ~8s/tile · CPU/RAM</div>
6447    </div>
6448    <div class="bench-card">
6449      <div class="bench-phase">VRAM-Spitze</div>
6450      <div class="bench-time">5,7 GB</div>
6451      <div class="bench-detail">von 8,0 GB verfügbar · 2,3 GB Puffer</div>
6452    </div>
6453    <div class="bench-card total">
6454      <div class="bench-phase">
6454Gesamt end-to-end</div>
6455      <div class="bench-time">662s · ~11 Minuten</div>
6456      <div class="bench-detail">Temperatur Spitze 67°C → 39°C idle · RAM genutzt 17,7/31,8 GB</div>
6457    </div>
6458  </div>
6459
6460  <h2>Geschwindigkeitskontext</h2>
6461  <p>Es ist nicht schnell. Das ist nicht der Punkt.</p>
6462
6463  <table class="comparison-table">
6464    <thead><tr><th>Hardware</th><th>Stack</th><th>Zeit SDXL 1024×1024</th></tr></thead>
6465    <tbody>
6466      <tr><td>RTX 4090</td><td>CUDA</td><td>~8s</td></tr>
6467      <tr><td>RTX 3080</td><td>CUDA</td><td>~25s</td></tr>
6468      <tr class="highlight-row"><td>RX 580 8GB (2017)</td><td>Vulkan · kein CUDA · kein ROCm</td><td>662s <span class="tag">funktioniert</span></td></tr>
6469      <tr><td>CPU pur (Xeon E5-2690 v3)</td><td>AVX2</td><td>ähnlicher Bereich wie oben</td></tr>
6470    </tbody>
6471  </table>
6472
6473  <h2>Generierter Output</h2>
6474  <p>Prompt: <em>"a lovely cat, detailed fur, studio lighting"</em></p>
6475  <p>Ergebnis: Fotorealistische Maine Coon, einzelne Haare sichtbar, scharfe Augen, Bokeh, Studiobeleuchtung mit dramatischem Kontrast. Keine Artefakte, kein Rauschen, kein schwarzes Bild. Der VAE FP16 Fix funktionierte exakt wie dokumentiert.</p>
6476
6477  <div class="result-box">
6478    <p>✓ SDXL 1.0 @ 1024×1024 — bestätigt auf RX 580 8GB via reinem Vulkan. Hardware von 2017, außerhalb des offiziellen ROCm-Supports, ohne proprietäre Vendor-Abhängigkeiten. Der hybride CPU/GPU-Split mit --clip-on-cpu + --vae-on-cpu + --vae-tiling ist die Kombination, die dies innerhalb der 8 GB VRAM ermöglicht.</p>
6479  </div>
6480
6481  <h2>Die Antwort der AMD Developer Community</h2>
6482  <p>Der Benchmark wurde im offiziellen AMD-Server mit Logs, Task-Manager-Screenshots während der Inferenz und dem generierten Bild gepostet, als direkte Antwort auf die Frage von POIZONE im Kanal #rocm-ai-assistant. Die Reaktion war unmittelbar: <em>"wow, that was fast thanks alot, and also pretty good results"</em>.</p>
6483  <p>Im Anschluss, als Antwort auf eine längere Nachricht über die Motivation des Projekts — Zugang zu Legacy-Hardware, das Ende von Polaris durch ROCm und DirectML, und die Philosophie "Hardware stirbt nicht, nur der offizielle Support verschwindet" — kommentierte POIZONE: <em>"Today, someone who wanted to run local AI and couldn't — now can. That's what matters. — this is exactly why i like this idea"</em>.</p>
6484
6485  <h2>Modell-Downloads</h2>
6486  <div class="code-block">
6487    <div class="code-label">PowerShell — Download nach E:\\models\\</div>
6488    <pre>cd E:\\models\\
6489
6490# SDXL Basismodell (~6,9 GB)
6491curl.exe -L -o sd_xl_base_1.0.safetensors \`
6492  https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
6493
6494# VAE FP16 Fix — obligatorisch (~319 MB)
6495curl.exe -L -o sdxl_vae-fp16-fix.safetensors \`
6496  https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors</pre>
6497  </div>
6498
6499  <div class="footer-note">
6500    AIVisionsLab · Abschnitt 26 von 36 · Hardware: AMD RX 580 8GB (2017) + Xeon E5-2690 v3 + 32 GB DDR4 ECC · Windows 10 Pro + WSL2 · stable-diffusion.cpp fork leejet · Vulkan backend · Getestet und dokumentiert live als Antwort auf eine Herausforderung im AMD Developer Community Discord.
6501  </div>
6502
6503</div>`},solucao:{id:"solucao",title:"04. A SOLUÇÃO — ARQUITETURA DUPLA",desc:"A estratégia de engenharia definitiva: Divisão inteligente de workloads entre GPU Vulkan e CPU Xeon.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"arquitetura",difficulty:"intermediate",estimated_time_min:15,tags:["vulkan-api","co-processamento","otimizacao-barramento"],last_reviewed:"2026-07-01",relationships:{prerequisites:["falhas"],previous:"falhas",next:"prereqs",related:["contexto","stack"]}},html:`<div class="card acc">
6504    <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-bottom:.9rem">Lógica de Fluxo do Sistema</h3>
6505    <div class="code"><pre>CAMINHO 1 — GPU VULKAN (Aceleração Local RX 580):
6506O ecossistema llama.cpp mapeia a GPU via chamadas nativas Vulkan
6507        ↓
6508O stable-diffusion.cpp herda e compartilha a mesma base limpa da engine ggml
6509        ↓
6510Modelos SD 1.5 convertidos para GGUF geram imagens estáveis em ~72 segundos ✅
6511
6512CAMINHO 2 — CPU XEON (Escalonamento para Modelos SOTA Pesados):
6513O modelo FLUX.1 Schnell FP8 exige 16GB e excede os 8GB de VRAM física da placa
6514        ↓
6515Mapeamento do workflow para o ComfyUI rodando via CPU dentro do WSL2 Linux
6516        ↓
6517A memória RAM DDR4 REG ECC atua como uma "VRAM virtual de alta estabilidade"
6518        ↓
6519Geração completa do FLUX.1 em resolução 768x768 finalizada em ~24 minutos ✅</pre></div>
6520  </div>
6521  <h4 class="s" style="margin-top:1.25rem;margin-bottom:.6rem;color:#fff;font-family:'Syne',sans-serif">Mapeamento de Portas e Serviços Coordenados</h4>
6522  <div class="code"><pre>Interface do Usuário (OpenWebUI via Docker — Porta :3000)
6523        │
6524        ├──► Orquestração de Texto: llama-server.exe (Porta :8081 — Backend Vulkan na RX 580)
6525        │     └── Alternativa de Contingência: Ollama Engine (Porta :11434 — Modo CPU Pura)
6526        │
6527        └──► Orquestração de Imagem (Rotas Dinâmicas de Prompt):
6528              ├──► Demanda Ultra Rápida (SD 1.5 GGUF): sd-server.exe (Porta :7860 — Backend Vulkan)
6529              └──► Demanda SOTA/Complexa (FLUX.1): ComfyUI Server (Porta :8188 — WSL2 CPU Xeon)</pre></div>`},stack:{id:"stack",title:"20. MAPA DE SERVIÇOS DO STACK INTEGRADO",desc:"Tabela de monitoramento de infraestrutura, roteamento de tráfego local e backends ativos.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"monitoramento",difficulty:"beginner",estimated_time_min:10,tags:["network-stack","ports-mapping","security-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["animatediff-video"],previous:"animatediff-video",next:"scripts",related:["sd_bat_automation","scripts"]}},html:`<div class="tbl"><table>
6530    <thead><tr><th>Serviço de IA</th><th>Porta de Acesso</th><th>Protocolo / Engine</th><th>Backend de Hardware Ativo</th></tr></thead>
6531    <tbody>
6532      <tr><td><strong>Open WebUI</strong></td><td><code>:3000</code></td><td>Docker Container</td><td>Ambiente Virtualizado WSL2</td></tr>
6533      <tr class="hig"><td><strong>llama-server</strong></td><td><code>:8081</code></td><td>Nativo ggml Executável</td><td>GPU AMD Radeon RX 580 (Vulkan 1.x)</td></tr>
6534      <tr class="hig"><td><strong>sd-server</strong></td><td><code>:7860</code></td><td>Nativo ggml Executável</td><td>GPU AMD Radeon RX 580 (Vulkan 1.x)</td></tr>
6535      <tr><td><strong>ComfyUI Server</strong></td><td><code>:8188</code></td><td>Python Runtime Isolado</td><td>CPU Xeon E5-2690 v3 (Modo Pure CPU)</td></tr>
6536      <tr><td><strong>Ollama Engine</strong></td><td><code>:11434</code></td><td>Serviço de Contingência</td><td>CPU Xeon E5-2690 v3 (Modo Pure CPU)</td></tr>
6537    </tbody>
6538  </table></div>`},"troubleshoot-comfyui":{id:"troubleshoot-comfyui",title:"28. CATASTROFE DE MEMÓRIA NO COMFYUI WINDOWS",desc:"Tratamento de estouros de alocação física de VRAM e uso emergencial de sinalizadores de paginação.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["vram-spillfix","pagefile-allocation","comfyui-out-of-memory"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux-vulkan"],previous:"flux-vulkan",next:"comfyui-portable-amd",related:["comfyui-directml","comfyui-directml-func"]}},html:`<div class="err">
6539    <div class="err-t">Exceção de Runtime: RuntimeError: Could not allocate tensor with...</div>
6540    <p style="margin-top:.35rem"><strong style="color:#e2e8f0">Mecanismo da Falha:</strong> Ocorre ao tentar rodar fluxos de imagem complexos no Windows utilizando backends de aceleração instáveis que tentam reservar mais blocos contínuos de memória do que a placa dispõe livremente no momento.</p>
6541    <p style="margin-top:.35rem"><strong style="color:#fff">Flags de Sobrevivência:</strong> Altere a chamada do arquivo de inicialização injetando os comandos de fragmentação de carga: <code>--lowvram</code> ou <code>--normalvram</code>. Isso força o gerenciador do ComfyUI a descarregar as camadas do CLIP da memória de vídeo antes de inicializar o processamento do KSampler.</p>
6542  </div>`}
6542,troubleshooting:{id:"troubleshooting",title:"27. GUIA DE RESOLUÇÃO DE PROBLEMAS (TROUBLESHOOTING)",desc:"Diagnósticos rápidos para contornar falhas de timeout de API e sementes nulas no servidor.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"geral",difficulty:"beginner",estimated_time_min:10,tags:["port-fixing","network-troubleshoot","timeout-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["cpu"],previous:"cpu",next:"flux-vulkan",related:["falhas","troubleshoot-comfyui"]}},html:`<div class="err">
6543    <div class="err-t">Sintoma Crítico: generate_image returned no results / Terminal congelado</div>
6544    <p style="margin-top:.35rem"><strong style="color:#e2e8f0">Causa Identificada:</strong> O servidor <code>sd-server.exe</code> apresenta um bug de estouro numérico intermitente ao processar gerações enviadas com a semente configurada em modo randômico (Seed: -1).</p>
6545    <p style="margin-top:.35rem"><strong style="color:#22c55e">Ação Corretiva:</strong> Dentro da interface do OpenWebUI, desative a chave de semente dinâmica nas opções avançadas do prompt e force um valor numérico inteiro fixo e válido (Exemplo: <code>42</code>, <code>1337</code>).</p>
6546  </div>`}},en:{amihart:{id:"amihart",title:"31. MÉTODO AMIHART — INFERÊNCIA RX580 EM POLARIS/DEBIAN",desc:"Credit Note: Documentary section honoring the proof of concept by 艾米心 (Amihart), pioneer in validating Vulkan under Debian GCN4/Polaris.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:30,tags:["metodo-amihart","debian-polaris","vulkan-diagnostics"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comunidade"],previous:"comunidade",next:"dadhacks",related:["comunidade","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">In January 2025, developer <strong style="color:#fff">艾米心 (Amihart)</strong> published a technical study demonstrating that, despite official limitations imposed by AMD (end of official ROCm support for Polaris/GCN4 architectures), the RX 580 hardware still has full AI acceleration potential.</p><div style="display:grid;grid-template-columns:1fr 1fr;gap:.85rem;margin-bottom:1.25rem"><div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid var(--r)"><p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">AIVisionsLab Approach (Native Windows)</p><ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8"><li>Execution on host system (Windows).</li><li>Focus on high stability daily production.</li><li>Native Vulkan orchestration tuning.</li><li>Hybrid VRAM/CPU segmentation in WSL.</li></ul></div><div class="card" style="border-left:3px solid #22c55e;padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid #22c55e"><p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">The Amihart Method (Linux/Debian)</p><ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8"><li>Execution in Linux/Debian ecosystem.</li><li>Robust isolation via Docker containers.</li><li>Strict compilation with Vulkan API flags.</li><li>Adapted virtualized ROCm sandbox.</li></ul></div></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. LLM Setup — Vulkan on Debian</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">llama.cpp is compiled with pure Vulkan API to bypass the absence of ROCm driver:</p><div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Step 1: Install Vulkan drivers and compilation prerequisites
6547sudo apt install vulkan-tools libtcmalloc-minimal4 libcurl4-openssl-dev glslc cmake make git pkg-config libvul
6547kan-dev
6548
6549# Step 2: Clone and compile llama.cpp with Vulkan enabled
6550cd ~
6551git clone https://github.com/ggerganov/llama.cpp
6552cd llama.cpp && mkdir build && cd build
6553cmake .. -DGGML_VULKAN=on -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=ON
6554
6555# Step 3: Add binaries to execution PATH
6556echo 'export PATH=$PATH:'$(realpath bin) >> ~/.bashrc
6557source ~/.bashrc
6558
6559# Step 4: Run DeepSeek R1 8B (Vulkan0 Acceleration)
6560llama-cli -m deepseek-r1:8B --device Vulkan0 -ngl 100</code></pre></div><p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Performance Metric (Amihart):</strong> On a Celeron G6900 operating without GPU, response is 5.45 tokens/s. Using pure Vulkan acceleration on RX 580 with 100 layers offload, performance jumps to <strong style="color:var(--r)">24.56 tokens/s</strong>, making the model viable and agile.</p><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">B. Stable Diffusion Setup — Docker Sandbox</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Since image generators require ROCm dependencies, Amihart uses isolated virtual containers to run WebUI cleanly on Debian:</p><div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Step 1: Install Docker engine and strict keys
6561sudo apt update && sudo apt install -y ca-certificates curl
6562install -m 0755 -d /etc/apt/keyrings
6563curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
6564chmod a+r /etc/apt/keyrings/docker.asc
6565echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
6566sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io
6567
6568# Step 2: Clone WebUI and run under ROCm gfx803 isolation
6569cd ~
6570git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
6571cd ~/stable-diffusion-webui
6572
6573sudo docker run -it \\
6574  --network=host --device=/dev/kfd --device=/dev/dri \\
6575  --ipc=host --shm-size 16G --group-add video \\
6576  --cap-add=SYS_PTRACE \\
6577  --rm -v $(pwd)/cache:/root/.cache \\
6578  -v $(pwd)/data:/stable-diffusion-webui/data \\
6579  woodrex/sd-webui-for-gfx803:latest</code></pre></div><p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Amihart's Critical Cache Optimization:</strong> To avoid re-loading dependencies every time the container starts:</p><div class="code" style="margin-bottom:1.5rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Get active CONTAINER ID
6580sudo docker ps -l
6581# Commit state to a new persistent image
6582sudo docker commit [CONTAINER_ID]
6583# See persisted image ID and replace docker run call with it
6584sudo docker images</code></pre></div><div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem"><strong style="color:var(--r)">Metrics and Technical References:</strong> Routing based on original publication by <a href="https://amihart.medium.com/inference-with-an-rx580-13e9c1055472" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">艾米心 (Amihart)</a> (Medium, January 2025). Knowledge is open and useful to the community.</div>`},"animatediff-video":{id:"animatediff-video",title:"19. ANIMATEDIFF E INTERPOLAÇÃO DE QUADROS (VÍDEO)",desc:"Injecting temporal consistency into ComfyUI on legacy hardware to structure fluid loops co-processed on Intel Xeon.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"advanced",estimated_time_min:30,tags:["animatediff","geracao-video","motion-modules"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-modelos"],previous:"comfyui-modelos",next:"stack",related:["comfyui-flux","sdxl_vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">The <strong>AnimateDiff</strong> is a temporal modeling framework designed specifically to convert static diffusion models (like Stable Diffusion 1.5) into consistent video generators. It works by injecting overlapping temporal attention modules into ComfyUI/WSL2. This technique allows calculating adjacent frame transitions in a mathematically coordinated way, generating fluid loops and eliminating chaotic static flickering noise.</p><div style="display:grid;grid-template-columns:1fr 1fr;gap:1.25rem;margin-bottom:1.5rem"><div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px"><div style="font-size:1.8rem">🎬</div><div><div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">Video Pipeline</div><div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#fff">AnimateDiff (WSL2 Pure CPU)</div><div style="font-size:.65rem;color:#64748b;margin-top:2px">24 Threads Intel Xeon E5</div></div></div><div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px"><div style="font-size:1.8rem">⏳</div><div><div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">Processing Metric</div><div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#34d399">~141s per Second of Frame</div><div style="font-size:.65rem;color:#64748b;margin-top:2px">Interpolated temporal rendering</div></div></div></div><div style="background:#0F1115;border:1px solid rgba(255,255,255,0.04);border-radius:6px;padding:1.5rem;margin-bottom:1.5rem"><h4 style="font-size:.85rem;color:#fff;text-transform:uppercase;letter-spacing:1px;margin-bottom:1rem;display:flex;align-items:center;gap:.5rem;margin-top:0"><span>🎥</span> Interactive Generation Showcase (Local Cache Video Breathe-Loop)</h4><p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">Below are the two outputs rendered by your local AI stack. Hover to activate the interpolated video feel, or click the simulator button to start the synthetic Xeon render:</p><div style="display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-bottom:1.25rem"><div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1"><img src="/images/cyberpunk_alley_0_1779586391528.png" alt="Cyberpunk Neon Alley" referrerPolicy="no-referrer" class="animatediff-img-1" style="width:100%;height:100%;object-fit:cover;transition:transform 8s ease-in-out, filter 2s ease;filter:brightness(0.9)" /><div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem"><span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span><span>CYBER_STREET_00.GIF</span></div><div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.75rem .5rem .5rem .75rem;display:flex;justify-content:space-between;align-items:center"><span style="font-family:monospace;font-size:9px;color:#64748b">Stable Diffusion 1.5</span><span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">VULKAN_OK</span></div></div><div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1"><img src="/images/cosmic_glass_0_1779586410888.png" alt="Cosmic Glass Flask" referrerPolicy="no-referrer" class="animatediff-img-2" style="width:100%;height:100%;object-fit:cover;transition:transform 6s ease-in-out, filter 3s ease;filter:brightness(0.85)" /><div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem"><span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span><span>ALCHEM_COSMOS_01.GIF</span></div><div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.5rem .75rem;display:flex;justify-content:space-between;align-items:center"><span style="font-family:monospace;font-size:9px;color:#64748b">Pure Xeon Model</span><span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">THREADED_OK</span></div></div></div><div style="text-align:center;margin-top:.5rem"><button onclick="toggleAnimateDiffSim(this)" style="background:rgba(239, 68, 68, 0.1);border:1px solid rgba(239, 68, 68, 0.4);border-radius:3px;color:#fca5a5;font-family:monospace;padding:.5rem 1rem;font-size:.72rem;cursor:pointer;transition:all 0.2s;text-transform:uppercase">▶ Activate Motion Simulation</button></div><div id="sim-log-box" style="background:#07080a;border:1px solid rgba(255,255,255,0.01);border-radius:3px;padding:0.75rem;margin-top:1rem;font-family:monospace;font-size:10px;color:#475569;line-height:1.5;display:none;max-height:120px;overflow-y:auto;text-align:left"></div></div><style>
6584.video-preview-box:hover .animatediff-img-1{transform:scale(1.1) rotate(0.5deg);filter:brightness(1.1) saturate(1.15) !important}.video-preview-box:hover .animatediff-img-2{transform:scale(1.08) rotate(-0.5deg);filter:brightness(1.05) saturate(1.2) !important}.animate-active-1{animation:panCyberpunk 12s infinite alternate ease-in-out;filter:brightness(1.1) saturate(1.15) !important}.animate-active-2{animation:panGlass 10s infinite alternate ease-in-out;filter:brightness(1.05) saturate(1.2) !important}@keyframes panCyberpunk{0%{transform:scale(1);filter:hue-rotate(0deg)}50%{transform:scale(1.12) translate(5px, -3px);filter:hue-rotate(15deg)}100%{transform:scale(1.02) translate(-5px, 2px);filter:hue-rotate(-10deg)}}@keyframes panGlass{0%{transform:scale(1.02) rotate(0deg)}50%{transform:scale(1.15) translate(-2px, 4px) rotate(1deg);filter:hue-rotate(5deg)}100%{transform:scale(1.05) translate(4px, -2px) rotate(-0.5deg);filter:hue-rotate(-5deg)}}@keyframes heartbeat{0%,100%{opacity:0.4}50%{opacity:1}}.pulse-red{animation:heartbeat 1s infinite}</style>`},arquivos:{id:"arquivos",title:"35. TAXONOMIA E ESTRUTURA DE ARQUIVOS NVMe",desc:"Unified directory tree for tracking compiled binaries and shared models.",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"armazenamento",difficulty:"beginner",estimated_time_min:10,tags:["nvme-struct","model-directories","storage-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proximos"],previous:"proximos",next:"meta",related:["comfyui-modelos","meta"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Rigorous structural organization of physical paths maintained within the high-speed SSD partition:</p>
6585  <pre style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#e2e8f0;background:rgba(0,0,0,.3);padding:.9rem;border-radius:4px;border:1px solid var(--b)">
6586E:\\
6587├── llama.cpp\\
6588│   └── build\\bin\\Release\\
6589│       ├── llama-server.exe     <span style="color:#64748b"># Local Language Server</span>
6590│       └── llama-cli.exe        <span style="color:#64748b"># Diagnostic Utility</span>
6591├── stable-diffusion.cpp\\
6592│   └── build\\bin\\Release\\
6593│       ├── sd-server.exe        <span style="color:#64748b"># Vulkan Image Server</span>
6594│       └── sd-cli.exe           <span style="color:#64748b"># GGUF Model Converter</span>
6595└── models\\
6596    ├── mistral-7b-instruct.Q4_K_M.gguf
6597    └── dreamshaper8.gguf        <span style="color:#64748b"># Quantized SD 1.5 Checkpoint</span></pre>`},audio_rvc:{id:"audio_rvc",title:"38. VOICE CONVERSION LOCAL — APPLIO RVC EM AMD RX 580 (Fases Iniciais)",desc:"Pipeline de clonagem de voz no Windows sem CUDA NVIDIA - Configuração do ambiente e primeiras fases.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:35,tags:["applio","rvc-voice-clone","sintese-audio"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linhatempo"],previous:"linhatempo",next:"audio_whisper",related:["audio_whisper","audio_srt_ptbr"]},part:1},html:`<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
6598  Documentação honesta de uma instalação real, incluindo todas as tentativas, erros e soluções.<br />
6599  Conduzida em duas sessões: ChatGPT (fases iniciais) + Claude (fases finais).
6600</blockquote>
6601
6602<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">CONTEXTO DO PROJETO</h3>
6603<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O objetivo era montar um pipeline de produção audiovisual para canal do YouTube estilo dark/documentário:</p>
6604<div class="code" style="margin-bottom:1.25rem">
6605  <pre><code>Texto → Balabolka + Antônio Neural (TTS) → WAV → Applio/RVC → Yuri (voz clonada)</code></pre>
6606</div>
6607<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A ideia central: separar <strong>atuação</strong> de <strong>identidade vocal</strong>.</p>
6608<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
6609  <li><strong style="color:#fff">Antônio Neural</strong> faz a interpretação, prosódia e emoção (voz Microsoft Neural)</li>
6610  <li><strong style="color:#fff">Yuri</strong> (modelo RVC treinado) aplica a identidade vocal por cima</li>
6611</ul>
6612<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.5rem">Isso produz resultado muito mais natural que TTS generativo puro.</p>
6613
6614<div class="tbl" style="margin-bottom:1.5rem">
6615  <table>
6616    <thead>
6617      <tr>
6618        <th>Aspecto</th>
6619        <th>XTTS/TTS puro</th>
6620        <th>Antônio → Yuri (RVC)</th>
6621      </tr>
6622    </thead>
6623    <tbody>
6624      <tr>
6625        <td>Prosódia</td>
6626        <td>Artificial</td>
6627        <td>Humana (ator real)</td>
6628      </tr>
6629      <tr>
6630        <td>Termos técnicos</td>
6631        <td>Tropeça</td>
6632        <td>Lê corretamente</td>
6633      </tr>
6634      <tr>
6635        <td>Textos longos</td>
6636        <td>Degrada</td>
6637        <td>Estável</td>
6638      </tr>
6639      <tr>
6640        <td>Identidade vocal</td>
6641        <td>Genérica</td>
6642        <td>Clonada</td>
6643      </tr>
6644      <tr>
6645        <td>Naturalidade</td>
6646        <td>60-70%</td>
6647        <td>80-95%</td>
6648      </tr>
6649    </tbody>
6650  </table>
6651</div>
6652
6653<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">HARDWARE UTILIZADO</h3>
6654<div class="tbl" style="margin-bottom:1.5rem">
6655  <table>
6656    <thead>
6657      <tr>
6658        <th>Item</th>
6659        <th>Especificação</th>
6660      </tr>
6661    </thead>
6662    <tbody>
6663      <tr>
6664        <td>CPU</td>
6665        <td>Intel Xeon E5-2690 v3 (24 núcleos)</td>
6666      </tr>
6667      <tr>
6668        <td>GPU</td>
6669        <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
6670      </tr>
6671      <tr>
6672        <td>RAM</td>
6673        <td>31.8 GB DDR4 REG ECC</td>
6674      </tr>
6675      <tr>
6676        <td>OS</td>
6677        <td>Windows 11</td>
6678      </tr>
6679      <tr>
6680        <td>Storage</td>
6681        <td>SSD NVMe (E:)</td>
6682      </tr>
6683      <tr>
6684        <td>Python</td>
6685        <td>3.11.9</td>
6686      </tr>
6687    </tbody>
6688  </table>
6689</div>
6690
6691<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 0 — TENTATIVA COM DATASET DO ANTÔNIO (fracasso documentado)</h3>
6692<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A ideia original era treinar o modelo RVC com horas de áudio do Antônio Neural. Foi criado um script <code>split.py</code> com Whisper para segmentar automaticamente o áudio em clips de 6-12 segundos.</p>
6693<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-bottom:0.5rem"><strong>O problema: estouro de memória</strong></p>
6694<div class="code" style="margin-bottom:1.25rem">
6695  <pre><code>MemoryError
6696concurrent.futures.process.BrokenProcessPool</code></pre>
6697</div>
6698<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O pré-processamento de dataset grande (~2h34 de áudio) estourou RAM e VRAM simultaneamente. Mesmo quando terminava, o volume de 1000+ clips causava instabilidade no pipeline do Applio.</p>
6699<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem"><strong>Decisão:</strong> abandonar o dataset do Antônio e usar diretamente <strong>9 minutos de TTS do ElevenLabs</strong> com a voz do Yuri. Menor, mais limpo, mais controlado.</p>
6700
6701<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 1 — INSTALAÇÃO DO AMBIENTE BASE</h3>
6702<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Estrutura de pastas:</strong></p>
6703<div class="code" style="margin-bottom:1.25rem">
6704  <pre><code>E:\\tts-audio_pra_youtube\\
6705├── Applio\\
6706├── voices\\
6707│   └── YURI-TTS.wav  (9 minutos, ElevenLabs, voz Yuri)
6708├── output\\
6709└── scripts\\</code></pre>
6710</div>
6711
6712<div class="err" style="margin-bottom:1.25rem">
6713  <div class="err-t">⚠️ Problema: Python 3.10 incompatível</div>
6714  <p>O Applio moderno exige Python 3.11+. O numpy 2.4.4 requerido não existe para 3.10.</p>
6715</div>
6716
6717<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução:</strong> instalar Python 3.11 em paralelo sem remover o 3.10:</p>
6718<div class="code" style="margin-bottom:1.25rem">
6719  <span class="code-lang">powershell</span>
6720  <pre><code>py -0
6721# -V:3.11  Python 3.11 (64-bit)   ← usar esta
6722# -V:3.10  Python 3.10 (64-bit)   ← manter para outros projetos
6723
6724py -3.11 -m venv venv
6725venv\\Scripts\\activate
6726python --version
6727# Python 3.11.9  ✅</code></pre>
6728</div>
6729
6730<div class="err" style="margin-bottom:1.25rem">
6731  <div class="err-t">⚠️ Problema: requirements.txt com CUDA forçado</div>
6732  <div class="code" style="margin-top:0.5rem;margin-bottom:0.5rem">
6733    <pre><code># O Applio traz esta linha que quebra no AMD Windows:
6734torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'</code></pre>
6735  </div>
6736  <p>O sufixo <code>+cu128</code> é CUDA 12.8 exclusivo NVIDIA. No Windows (<code>win32</code>), essa condição sempre é verdadeira.</p>
6737</div>
6738
6739<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução:</strong> editar o <code>requirements.txt</code>:</p>
6740<div class="code" style="margin-bottom:1.25rem">
6741  <pre><code># REMOVER:
6742torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
6743torchaudio==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
6744torchvision==0.22.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
6745
6746# SUBSTITUIR POR:
6747torch==2.7.1; sys_platform == 'win32'
6748torchaudio==2.7.1; sys_platform == 'win32'
6749torchvision==0.22.1; sys_platform == 'win32'</code></pre>
6750</div>
6751
6752<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 2 — TENTATIVA DIRECTML (fracasso documentado)</h3>
6753<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Com o Applio rodando em CPU (~10 min por época), tentou-se acelerar com DirectML.</p>
6754<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Instalação e teste:</strong></p>
6755<div class="code" style="margin-bottom:1.25rem">
6756  <span class="code-lang">powershell</span>
6757  <pre><code>pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
6758pip install torch-directml
6759
6760python -c "import torch_directml; dml = torch_directml.device(); print(dml)"
6761# privateuseone:0  ✅  — RX 580 reconhecida</code></pre>
6762</div>
6763<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Resultado real:</strong></p>
6764<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
6765  <li>GPU uso: 7-10%</li>
6766  <li>VRAM: 1.2GB usada</li>
6767  <li>Velocidade com DirectML: <strong>4.27s/it</strong></li>
6768  <li>Velocidade sem DirectML (CPU): <strong>4.46s/it</strong></li>
6769  <li>Diferença real: <strong>~5%</strong> — irrelevante</li>
6770</ul>
6771<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Por que foi abandonado:</strong></p>
6772<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O <code>torch-directml</code> está preso na versão <code>0.2.5.dev240914</code> (setembro 2024) e exige <code>torch==2.4.1</code>. O Applio precisa de <code>torch==2.7.1</code>. Conflito irreconciliável:</p>
6773<div class="code" style="margin-bottom:1.25rem">
6774  <pre><code>torch-directml 0.2.5 requires torch==2.4.1
6775hyper-connections 0.4.11 requires torch>=2.5   ← conflito
6776torch-einops-utils 0.1.1 requires torch>=2.5   ← conflito</code></pre>
6777</div>
6778<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A Microsoft parou de investir no DirectML para IA. O projeto está essencialmente abandonado.</p>
6779<p style="font-size:.88rem;color:#10b981;line-height:1.9;margin-bottom:1.25rem">✅ <strong>Conclusão:</strong> DirectML para RVC em Windows AMD em 2026 = não vale a pena.</p>
6780
6781
6782</div>
6783<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 3 — ERRO CRÍTICO: VARIÁVEIS DE AMBIENTE</h3>
6784<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Durante tentativas de forçar CPU, foram usados comandos que <strong>silenciosamente quebravam a extração de características</strong>:</p>
6785<div class="code" style="margin-bottom:1.25rem">
6786  <span class="code-lang">powershell</span>
6787  <pre><code># ❌ NUNCA FAZER ISSO com Applio AMD:
6788set USE_DIRECTML=0
6789set CUDA_VISIBLE_DEVICES=-1
6790set ROCM_VISIBLE_DEVICES=-1
6791set HIP_VISIBLE_DEVICES=-1</code></pre>
6792</div>
6793<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Esses comandos deixavam a pasta <code>extracted</code> vazia após a extração. O treino terminava em <strong>segundos</strong> dizendo "Model trained successfully" sem gerar nenhum <code>.pth</code>.</p>
6794<div class="code" style="margin-bottom:1.25rem">
6795  <pre><code>Not enough data present in the training set.
6796Feature files in logs\\my-project\\extracted could not be loaded correctly.</code></pre>
6797</div>
6798<div class="err" style="margin-bottom:1.25rem">
6799  <div class="err-t">⚠️ Armadilha: "Model trained successfully" em segundos = treino fake.</div>
6800  <p>Sempre verificar se <code>logs/projeto/extracted/</code> tem arquivos <code>.npy</code> antes de treinar.</p>
6801</div>
6802
6803<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 4 — INSTALAÇÃO LIMPA (solução final)</h3>
6804<div class="code" style="margin-bottom:1.25rem">
6805  <span class="code-lang">powershell</span>
6806  <pre><code># 1. Destruir ambiente corrompido
6807deactivate
6808Remove-Item -Recurse -Force venv
6809Remove-Item -Recurse -Force logs
6810
6811# 2. Criar venv limpo
6812py -3.11 -m venv venv
6813venv\\Scripts\\activate
6814python -m pip install --upgrade pip
6815
6816# 3. Instalar torch base
6817pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
6818pip install torch-directml
6819
6820# 4. Instalar dependências sem sobrescrever torch
6821pip install -r requirements.txt --no-deps
6822
6823# 5. Corrigir dependências faltantes
6824pip install gradio-client==1.14.0
6825pip install cffi soupsieve local-attention
6826pip install "aiofiles&lt;25.0" "pandas&lt;3.0" "pydantic&lt;=2.12.3"
6827pip install "starlette&lt;1.0,&gt;=0.40.0" "tomlkit&lt;0.14.0"
6828pip install "tokenizers&gt;=0.22.0,&lt;=0.23.0"
6829pip install audioread decorator lazy-loader msgpack pooch scikit-learn resampy</code></pre>
6830</div>
6831<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>config.py — versão final (sem DirectML):</strong></p>
6832<div class="code" style="margin-bottom:1.25rem">
6833  <span class="code-lang">python</span>
6834  <pre><code>import torch
6835import json
6836import os
6837
6838@singleton
6839class Config:
6840    def __init__(self):
6841        self.device = "cuda:0" if torch.cuda.is_available() else "cpu"
6842        # No AMD Windows sem CUDA, usa "cpu" automaticamente</code></pre>
6843</div>
6844<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Iniciar:</strong></p>
6845<div class="code" style="margin-bottom:1.25rem">
6846  <span class="code-lang">powershell</span>
6847  <pre><code># PowerShell LIMPO, sem nenhum 'set' antes
6848python app.py
6849# * Running on local URL: http://127.0.0.1:6969  ✅</code></pre>
6850</div>
6851
6852<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 5 — ARQUIVOS MUTE FALTANDO</h3>
6853<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Na instalação via git, os arquivos de silêncio não são criados. Aparecem um por um durante o treino:</p>
6854<div class="code" style="margin-bottom:1.25rem">
6855  <pre><code>FileNotFoundError: logs\\mute\\sliced_audios\\mute40000.wav
6856FileNotFoundError: logs\\mute\\extracted\\mute.npy          ← shape errado causa crash
6857FileNotFoundError: logs\\mute\\f0\\mute.wav.npy
6858FileNotFoundError: logs\\mute\\f0_voiced\\mute.wav.npy
6859RuntimeError: tensor (100) must match size (768)</code></pre>
6860</div>
6861<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução — criar todos de uma vez:</strong></p>
6862<div class="code" style="margin-bottom:1.25rem">
6863  <span class="code-lang">powershell</span>
6864  <pre><code>python -c "
6865import numpy as np, soundfile as sf, os
6866[os.makedirs(d, exist_ok=True) for d in [
6867    'logs/mute/sliced_audios','logs/mute/extracted',
6868    'logs/mute/f0','logs/mute/f0_voiced'
6869]]
6870sf.write('logs/mute/sliced_audios/mute40000.wav', np.zeros(int(40000*3.7)), 40000)
6871sf.write('logs/mute/sliced_audios/mute48000.wav', np.zeros(int(48000*3.7)), 48000)
6872sf.write('logs/mute/sliced_audios/mute32000.wav', np.zeros(int(32000*3.7)), 32000)
6873np.save('logs/mute/extracted/mute.npy', np.zeros((196, 768)))
6874np.save('logs/mute/f0/mute.wav.npy', np.zeros(100))
6875np.save('logs/mute/f0_voiced/mute.wav.npy', np.zeros(100))
6876print('OK')
6877"</code></pre>
6878</div>
6879<div class="err" style="margin-bottom:1.25rem">
6880  <div class="err-t">⚠️ Crítico: mute.npy precisa ter shape (196, 768)</div>
6881  <p>dimensão 768 do embedder contentvec. Qualquer outro shape causa crash.</p>
6882</div>
6883
6884<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">
6884FASE 6 — DATASET E TREINO</h3>
6885<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Dataset usado:</strong></p>
6886<div class="tbl" style="margin-bottom:1.5rem">
6887  <table>
6888    <thead>
6889      <tr>
6890        <th>Parâmetro</th>
6891        <th>Valor</th>
6892      </tr>
6893    </thead>
6894    <tbody>
6895      <tr>
6896        <td>Arquivo</td>
6897        <td>YURI-TTS.wav</td>
6898      </tr>
6899      <tr>
6900        <td>Duração</td>
6901        <td>9 minutos</td>
6902      </tr>
6903      <tr>
6904        <td>Fonte</td>
6905        <td>ElevenLabs TTS</td>
6906      </tr>
6907      <tr>
6908        <td>Nota</td>
6909        <td>Mínimo aceitável. Ideal: 15-25 min</td>
6910      </tr>
6911    </tbody>
6912  </table>
6913</div>
6914
6915<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Configurações do Applio:</strong></p>
6916<div class="tbl" style="margin-bottom:1.5rem">
6917  <table>
6918    <thead>
6919      <tr>
6920        <th>Parâmetro</th>
6921        <th>Valor</th>
6922      </tr>
6923    </thead>
6924    <tbody>
6925      <tr>
6926        <td>Taxa de amostragem</td>
6927        <td>40000 Hz</td>
6928      </tr>
6929      <tr>
6930        <td>Vocoder</td>
6931        <td>HiFi-GAN</td>
6932      </tr>
6933      <tr>
6934        <td>Algoritmo de pitch</td>
6935        <td>RMVPE</td>
6936      </tr>
6937      <tr>
6938        <td>Embedder</td>
6939        <td>contentvec</td>
6940      </tr>
6941      <tr>
6942        <td>Tamanho do lote</td>
6943        <td>4</td>
6944      </tr>
6945      <tr>
6946        <td>Total de épocas</td>
6947        <td>200</td>
6948      </tr>
6949      <tr>
6950        <td>Número da GPU</td>
6951        <td><strong>vazio</strong> (não colocar 0, -1 ou cpu)</td>
6952      </tr>
6953    </tbody>
6954  </table>
6955</div>
6956
6957<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Métricas reais:</strong></p>
6958<div class="tbl" style="margin-bottom:1.5rem">
6959  <table>
6960    <thead>
6961      <tr>
6962        <th>Época</th>
6963        <th>Loss</th>
6964        <th>Tempo por época</th>
6965      </tr>
6966    </thead>
6967    <tbody>
6968      <tr>
6969        <td>1</td>
6970        <td>27.181</td>
6971        <td>7:21</td>
6972      </tr>
6973      <tr>
6974        <td>8</td>
6975        <td>17.93</td>
6976        <td>7:02</td>
6977      </tr>
6978      <tr>
6979        <td>20</td>
6980        <td>16.212</td>
6981        <td>7:43</td>
6982      </tr>
6983      <tr>
6984        <td>43</td>
6985        <td>15.785</td>
6986        <td>5:43</td>
6987      </tr>
6988    </tbody>
6989  </table>
6990</div>
6991<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
6992  <li>Velocidade: ~6 minutos por época</li>
6993  <li>Total: ~20 horas para 200 épocas</li>
6994  <li>Hardware efetivo: CPU Xeon 24 núcleos</li>
6995</ul>
6996<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
6997  <strong>ℹ️ Buffer do PowerShell:</strong> de treino overnight o terminal pode parecer travado. O treino continua normalmente — verificar o contador no Applio.
6998</blockquote>
6999
7000<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">LIÇÕES APRENDIDAS</h3>
7001<p style="font-size:.88rem;color:#10b981;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">✅ O que funciona:</p>
7002<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
7003  <li>Applio + CPU puro no AMD Windows — estável e funcional</li>
7004  <li>Python 3.11 obrigatório (não 3.10)</li>
7005  <li><code>requirements.txt</code> editado — remover <code>+cu128</code></li>
7006  <li>PowerShell limpo — sem variáveis <code>CUDA_VISIBLE_DEVICES</code></li>
7007  <li>Arquivos mute criados manualmente antes do treino</li>
7008  <li>Campo "Número da GPU" <strong>vazio</strong> no Applio</li>
7009</ol>
7010<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">❌ O que não funciona:</p>
7011<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
7012  <li>DirectML + torch 2.7.1 — incompatível em 2026</li>
7013  <li><code>set CUDA_VISIBLE_DEVICES=-1</code> — quebra a extração de features</li>
7014  <li><code>pip install -r requirements.txt</code> sem editar — instala CUDA e falha</li>
7015  <li>Dataset grande (horas de áudio) — estouro de RAM/VRAM</li>
7016</ol>
7017
7018<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">PIPELINE FINAL DE PRODUÇÃO</h3>
7019<div class="code" style="margin-bottom:1.25rem">
7020  <pre><code>1. Escrever roteiro
7021   ↓
70222. Balabolka + Antônio Neural → WAV com interpretação humana
7023   ↓
70243. Applio — Inferência
7025   Modelo: my-project_200e.pth
7026   Índice: my-project.index
7027   ↓
70284. Output: WAV com voz do Yuri
7029   ↓
70305. Edição e publicação no YouTube</code></pre>
7031</div>
7032<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Velocidade de inferência (pós-treino):</strong></p>
7033<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
7034  <li>~5-30 segundos por minuto de áudio</li>
7035  <li>2 horas de áudio → ~30 minutos de processamento</li>
7036  <li>Modo Lote disponível no Applio</li>
7037</ul>
7038
7039<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">CHECKLIST — REPRODUZINDO DO ZERO</h3>
7040<ul style="list-style-type:none;padding-left:0;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
7041  <li><span style="color:#475569">[ ]</span> Python 3.11 instalado</li>
7042  <li><span style="color:#475569">[ ]</span> Git instalado</li>
7043  <li><span style="color:#475569">[ ]</span> FFmpeg no PATH</li>
7044  <li><span style="color:#475569">[ ]</span> Dataset WAV limpo (mínimo 5 min, ideal 15-25 min)</li>
7045  <li><span style="color:#475569">[ ]</span> <code>requirements.txt</code> editado (remover <code>+cu128</code>)</li>
7046  <li><span style="color:#475569">[ ]</span> <code>config.py</code> sem referências ao <code>torch_directml</code></li>
7047  <li><span style="color:#475569">[ ]</span> Arquivos mute criados</li>
7048  <li><span style="color:#475569">[ ]</span> PowerShell limpo (sem <code>set CUDA_VISIBLE_DEVICES</code>)</li>
7049  <li><span style="color:#475569">[ ]</span> Campo "Número da GPU" <strong>vazio</strong> no Applio</li>
7050  <li><span style="color:#475569">[ ]</span> Após extração: verificar que <code>logs/projeto/extracted/</code> tem arquivos <code>.npy</code></li>
7051</ul>
7052
7053<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">AMD vs NVIDIA EM IA — POSIÇÃO DO APPLIO/RVC (2026)</h3>
7054<div class="tbl" style="margin-bottom:1.5rem">
7055  <table>
7056    <thead>
7057      <tr>
7058        <th>Plataforma</th>
7059        <th>Situação</th>
7060      </tr>
7061    </thead>
7062    <tbody>
7063      <tr>
7064        <td>NVIDIA CUDA</td>
7065        <td>✅ Excelente — suporte nativo</td>
7066      </tr>
7067      <tr>
7068        <td>AMD ROCm Linux</td>
7069        <td>⚠️ Razoável — funciona com esforço</td>
7070      </tr>
7071      <tr>
7072        <td>AMD Windows DirectML</td>
7073        <td>❌ Abandonado</td>
7074      </tr>
7075      <tr>
7076        <td>AMD Windows CPU</td>
7077        <td>✅ Funcional — lento mas estável</td>
7078      </tr>
7079    </tbody>
7080  </table>
7081</div>
7082<p style="font-size:.85rem;color:#94a3b8;font-style:italic;line-height:1.8"><em>*Hardware legado não morre — só precisa do backend certo.</em></p>`},audio_srt_ptbr:{id:"audio_srt_ptbr",title:"40. PIPELINE COMPLETO — TRANSCRIÇÃO + TRADUÇÃO PT-BR COM RX 580",desc:"Transcrição de vídeo em inglês com tradução automática para português brasileiro, do .mp4 ao .srt sem nenhum serviço pago.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:25,tags:["srt-generation","automacao-srt","ffmpeg-pipeline"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linux_nativo"],previous:"linux_nativo",next:"limit_qwen_35b",related:["audio_whisper","limit_qwen_35b"]},part:1}
7082,html:`<div class="whisper-doc">
7083  <div class="hero">
7084    <div class="hero-title"><span>Pipeline Completo</span> — Transcrição + Tradução EN➔PT-BR</div>
7085    <div class="hero-sub">Transcrição offline de vídeo em inglês com tradução automática para português brasileiro, do <code>.mp4</code> ao <code>.srt</code> de forma 100% gratuita usando a RX 580 via Vulkan.</div>
7086    <div class="hero-badges">
7087      <span class="badge badge-gpu">AMD RX 580 8GB</span>
7088      <span class="badge badge-win">Windows + PowerShell</span>
7089      <span class="badge badge-ok">Vulkan Backend</span>
7090      <span class="badge badge-ok">large-v3-turbo</span>
7091      <span class="badge badge-win">deep-translator (Gratuito)</span>
7092    </div>
7093  </div>
7094
7095  <div class="stat-grid">
7096    <div class="stat">
7097      <div class="stat-label">tempo total pipeline</div>
7098      <div class="stat-value">~8 min</div>
7099      <div class="stat-sub">Vídeo de 29m 51s</div>
7100    </div>
7101    <div class="stat">
7102      <div class="stat-label">VRAM Usada</div>
7103      <div class="stat-value">2.9 GB</div>
7104      <div class="stat-sub">de 8 GB Polaris</div>
7105    </div>
7106    <div class="stat">
7107      <div class="stat-label">Temp. Média GPU</div>
7108      <div class="stat-value">50°C</div>
7109      <div class="stat-sub">Fan Curve Otimizada</div>
7110    </div>
7111    <div class="stat">
7112      <div class="stat-label">Custo Cloud</div>
7113      <div class="stat-value">R$ 0,00</div>
7114      <div class="stat-sub">100% Local & Offline</div>
7115    </div>
7116  </div>
7117
7118  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Hardware Utilizado no Teste</h3>
7119  <div class="tbl">
7120    <table>
7121      <thead>
7122        <tr>
7123          <th>Componente</th>
7124          <th>Especificação</th>
7125        </tr>
7126      </thead>
7127      <tbody>
7128        <tr>
7129          <td><strong>GPU</strong></td>
7130          <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
7131        </tr>
7132        <tr>
7133          <td><strong>CPU</strong></td>
7134          <td>Intel Xeon E5-2690 v3 (24 threads / 12 Cores)</td>
7135        </tr>
7136        <tr>
7137          <td><strong>RAM</strong></td>
7138          <td>31.8 GB DDR4 REG ECC</td>
7139        </tr>
7140        <tr>
7141          <td><strong>OS</strong></td>
7142          <td>Windows 11 Professional</td>
7143        </tr>
7144        <tr>
7145          <td><strong>Driver</strong></td>
7146          <td>Adrenalin 31.0.21925.1001 (2026/05/20)</td>
7147        </tr>
7148      </tbody>
7149    </table>
7150  </div>
7151
7152  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Fluxo de Dados Unificado (Pipeline)</h3>
7153  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
7154    O objetivo é mapear um vídeo educacional em inglês para legenda em português compatível com software editor de vídeo (Filmora, Premiere, etc.), rodando a transcrição via GPU nativa e traduzindo cada timestamp sem limites de API de nuvem comercial:
7155  </p>
7156  <div class="cmd" style="white-space:normal; line-height:1.6; padding: 1rem;">
7157    <strong>video.mp4</strong> ➔ <code>FFmpeg (extração)</code> ➔ <strong>video_16k.wav</strong><br>
7158    ➔ <code>whisper-cli Vulkan (transcrição)</code> ➔ <strong>video.srt (English)</strong><br>
7159    ➔ <code>Python deep-translator (Google Translate)</code> ➔ <strong>video_ptbr.srt (Português)</strong><br>
7160    ➔ <code>Importar na Timeline do Filmora</code>
7161  </div>
7162
7163  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Performance e Timing Detalhado</h3>
7164  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
7165    Métricas reais obtidas transcrição de um vídeo educacional de <strong>29 minutos e 51 segundos</strong> (áudio em inglês, AAC, 480x360):
7166  </p>
7167  <div class="tbl" style="margin-bottom:1.5rem">
7168    <table>
7169      <thead>
7170        <tr>
7171          <th>Etapa do Pipeline</th>
7172          <th>Ferramenta</th>
7173          <th>Tempo Gasto</th>
7174        </tr>
7175      </thead>
7176      <tbody>
7177        <tr>
7178          <td><strong>1. Extração de Áudio WAV Sem Compressão</strong></td>
7179          <td>FFmpeg</td>
7180          <td><strong>1.7 segundos</strong></td>
7181        </tr>
7182        <tr>
7183          <td><strong>2. Transcrição de Áudio (EN)</strong></td>
7184          <td>Whisper.cpp + Vulkan</td>
7185          <td><strong>6 minutos e 07 segundos</strong></td>
7186        </tr>
7187        <tr>
7188          <td><strong>3. Tradução em Bloco do SRT (EN➔PT-BR)</strong></td>
7189          <td>Python + <code>deep-translator</code></td>
7190          <td><strong>~2 minutos</strong> (limitação de I/O de rede)</td>
7191        </tr>
7192        <tr style="border-top:1px solid rgba(255,255,255,0.15)">
7193          <td><strong>Métrica Total Consolidade</strong></td>
7194          <td><strong>Pipeline Completo</strong></td>
7195          <td><strong>~8 minutos</strong></td>
7196        </tr>
7197      </tbody>
7198    </table>
7199  </div>
7200
7201  <h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">Timings Internos do Core (whisper_print_timings)</h4>
7202  <div class="card bg-black/40 border border-white/5 p-4 rounded-md my-3 font-mono text-xs text-[#a7f3d0] leading-relaxed">
7203    load modelo : 3.687 ms<br>
7204    mel (áudio) : 2.305 ms<br>
7205    encode GPU  : 204.689 ms<br>
7206    decode      : 4.081 ms<br>
7207    batch total : 108.675 ms<br>
7208    total       : 367.432 ms (por batch de segmentação)
7209  </div>
7210
7211  <div class="section-title">Manual de Instruções Passo a Passo</div>
7212
7213  <div class="step">
7214    <div class="step-header">
7215      <div class="step-num">1</div>
7216      <div class="step-name">Extrair Áudio Compatível via FFmpeg</div>
7217      <div class="step-desc">WAV 16kHz Mono 16-bit</div>
7218    </div>
7219    <div class="step-body">
7220      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">O Whisper necessita estritamente de áudio WAV cru em 16.000 Hz, formato mono de 16 bits:</p>
7221      <div class="cmd">ffmpeg -i "E:\\MUSICAS SUNO AI\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\MUSICAS SUNO AI\\video_16k.wav"</div>
7222      <p class="note"><strong>Flags:</strong> <code>-ar 16000</code> força 16kHz · <code>-ac 1</code> converte para canal mono único · <code>-c:a pcm_s16le</code> define PCM de 16 bits sem perda.</p>
7223    </div>
7224  </div>
7225
7226  <div class="step">
7227    <div class="step-header">
7228      <div class="step-num">2</div>
7229      <div class="step-name">Transcrever via Vulkan</div>
7230      <div class="step-desc">
7230Carga pesada na GPU Polaris</div>
7231    </div>
7232    <div class="step-body">
7233      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">Chamar o executável compilado do Whisper para gerar o arquivo inicial de legendas SRT em inglês:</p>
7234      <div class="cmd">cd C:\\whisper.cpp</div>
7235      <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\MUSICAS SUNO AI\\video_16k.wav" -l en --output-srt</div>
7236      <p class="note"><strong>Verificação de atividade da GPU:</strong> Certifique-se de ver as linhas <code>ggml_vulkan: Found 1 Vulkan devices: AMD Radeon RX 580 2048SP</code> na inicialização para atestar que o encode pesado foi acoplado na GPU, reduzindo o uso de CPU para ~5%.</p>
7237    </div>
7238  </div>
7239
7240  <div class="step">
7241    <div class="step-header">
7242      <div class="step-num">3</div>
7243      <div class="step-name">Criar e Executar Script Python de Tradução</div>
7244      <div class="step-desc">Zero Keys, Zero Custos</div>
7245    </div>
7246    <div class="step-body">
7247      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">
7248        Instale a biblioteca de tradução sem chaves de API: <code>pip install deep-translator</code>. Crie e rode o arquivo <code>C:\\whisper.cpp\\traduzir.py</code> com este código:
7249      </p>
7250      <div class="cmd" style="white-space:pre-wrap; font-size:11px;">from deep_translator import GoogleTranslator
7251
7252def traduzir_srt(entrada, saida):
7253    with open(entrada, 'r', encoding='utf-8') as f:
7254        conteudo = f.read()
7255
7256    blocos = conteudo.strip().split('\\n\\n')
7257    resultado = []
7258
7259    for bloco in blocos:
7260        linhas = bloco.split('\\n')
7261        if len(linhas) >= 3:
7262            numero = linhas[0]
7263            timestamp = linhas[1]
7264            texto = ' '.join(linhas[2:])
7265            traduzido = GoogleTranslator(source='en', target='pt').translate(texto)
7266            resultado.append(f"{numero}\\n{timestamp}
7266\\n{traduzido}")
7267
7268    with open(saida, 'w', encoding='utf-8') as f:
7269        f.write('\\n\\n'.join(resultado))
7270    print("Pronto!")
7271
7272traduzir_srt(
7273    r'E:\\MUSICAS SUNO AI\\video_16k.wav.srt',
7274    r'E:\\MUSICAS SUNO AI\\video_16k_ptbr.srt'
7275)</div>
7276<p style="font-size:0.8rem;color:#94a3b8;margin-top:0.5rem">To run:</p>
7277      <div class="cmd">python traduzir.py</div>
7278    </div>
7279  </div>
7280
7281  <div class="step">
7282    <div class="step-header">
7283      <div class="step-num">4</div>
7284      <div class="step-name">Import Subtitle into Filmora</div>
7285      <div class="step-desc">Finalize Video Editing</div>
7286    </div>
7287    <div class="step-body">
7288      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6">
7289        1. In Wondershare Filmora, go to <strong>File ➔ Import ➔ Import subtitle files</strong>.<br>
7290        2. Select the generated file <code>video_16k_ptbr.srt</code>.<br>
7291        3. Drag and drop the subtitle track directly onto the timeline, overlaid on the original video track.
7292      </p>
7293    </div>
7294  </div>
7295
7296  <div class="section-title">Autonomous Lessons Learned During the Adventures</div>
7297  <div class="card-inner">
7298    <div class="lesson">
7299      <div class="lesson-icon">⚠️</div>
7300      <div class="lesson-text"><strong>Avoid using --translate for PT-BR directly in Whisper flags:</strong> The <code>--translate</code> parameter by design translates audio into English natively. To obtain high-quality Brazilian Portuguese subtitles, the correct approach is to extract English using <code>-l en</code> and translate with the <code>traduzir.py</code> algorithm.</div>
7301    </div>
7302    <div class="lesson">
7303      <div class="lesson-icon">⚠️</div>
7304      <div class="lesson-text"><strong>Incorrect Source Language Issues:</strong> Passing <code>-l pt</code> when the source audio is spoken in English forces Whisper to apply Portuguese phonetic patterns to the English audio, resulting in completely incomprehensible and nonsensical text. Always set the actual language of the input audio as the initial parameter.</div>
7305    </div>
7306    <div class="lesson">
7307      <div class="lesson-icon">ℹ️</div>
7308      <div class="lesson-text"><strong>Generated File Location:</strong> By default, in native builds, the <code>.srt</code> file is saved in the same physical folder as the processed WAV audio file, rather than inside the script or Whisper directory.</div>
7309    </div>
7310    <div class="lesson">
7311      <div class="lesson-icon">✅</div>
7312      <div class="lesson-text"><strong>8 GB of VRAM in 2026 Still Going Strong:</strong> The Whisper <code>large-v3-turbo</code> model consumes only 2.9 GB of physical VRAM in the ecosystem, leaving headroom for other activities on your machine or parallel rendering. Thousands of dollars saved on subscriptions and proprietary APIs.</div>
7313    </div>
7314  </div>
7315
7316  <div class="footer">
7317    RX 580 — 580 years old, but still active 🚀 · Adventures documented in June/2026
7318  </div>
7319</div>`},audio_whisper:{id:"audio_whisper",title:"39. WHISPER.CPP LOCAL — TRANSCRIÇÃO DE ÁUDIO EM AMD RX 580",desc:"Audio/video transcription accelerated by AMD GPU via Vulkan on Windows (large-v3-turbo model).",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:30,tags:["whispercpp","transcricao-audio","vulkan-whisper"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_rvc"],previous:"audio_rvc",next:"linux_nativo",related:["audio_rvc","audio_srt_ptbr"]},part:1},html:`<div class="whisper-doc">
7320<style>
7321.whisper-doc {
7322  --color-border-secondary: rgba(255, 255, 255, 0.05);
7323  --color-border-tertiary: rgba(255, 255, 255, 0.08);
7324  --color-background-secondary: #0c0d10;
7325  --color-background-primary: #07080a;
7326  --color-text-primary: #ffffff;
7327  --color-text-secondary: #94a3b8;
7328  font-family: inherit;
7329}
7330.whisper-doc * { box-sizing: border-box; }
7331.whisper-doc .badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 4px; letter-spacing: 0.04em; text-transform: uppercase; }
7332.whisper-doc .badge-gpu { background: rgba(225, 29, 72, 0.1); border: 1px solid rgba(225, 29, 72, 0.3); color: #fda4af; }
7333.whisper-doc .badge-win { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.2); color: #a7f3d0; }
7334.whisper-doc .badge-ok { background: rgba(14, 165, 233, 0.1); border: 1px solid rgba(14, 165, 233, 0.3); color: #bae6fd; }
7335.whisper-doc .badge-warn { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #fef08a; }
7336.whisper-doc .hero { border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 1.5rem; margin-bottom: 2rem; background: #0c0d10; }
7337.whisper-doc .hero-title { font-size: 26px; font-weight: 700; color: var(--color-text-primary); line-height: 1.2; margin-bottom: 0.5rem; font-family: 'Syne', var(--font-sans); text-transform: uppercase; }
7338.whisper-doc .hero-title span { color: #E11D48; }
7339.whisper-doc .hero-sub { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 1.25rem; line-height: 1.6; font-family: var(--font-sans); }
7340.whisper-doc .hero-badges { display: flex; flex-wrap: wrap; gap: 6px; }
7341.whisper-doc .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 2rem; }
7342.whisper-doc .stat { background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 0.875rem 1rem; }
7343.whisper-doc .stat-label { font-size: 11px; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; font-family: var(--font-sans); }
7344.whisper-doc .stat-value { font-size: 20px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-mono); }
7345.whisper-doc .stat-sub { font-size: 11px; color: var(--color-text-secondary); margin-top: 2px; font-family: var(--font-sans); }
7346.whisper-doc .section { margin-bottom: 2.5rem; }
7347.whisper-doc .section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #E11D48; margin-top: 2rem; margin-bottom: 1rem; font-family: var(--font-sans); padding-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
7348.whisper-doc .step { border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; margin-bottom: 10px; overflow: hidden; background: #050506; }
7349.whisper-doc .step-header { display: flex; align-items: center; gap: 10px; padding: 0.75rem 1rem; background: #0c0d10; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
7350.whisper-doc .step-num { width: 24px; height: 24px; border-radius: 50%; background: #E11D48; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-mono); }
7351.whisper-doc .step-name { font-size: 13px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-sans); }
7352.whisper-doc .step-desc { font-size: 11px; color: var(--color-text-secondary); font-family: var(--font-sans); margin-left: auto; }
7353.whisper-doc .step-body { padding: 0.875rem 1rem; }
7354.whisper-doc .cmd { background: #050506; border: 1px solid rgba(255, 255, 255, 0.03); border-radius: 4px; padding: 0.625rem 0.875rem; font-size: 12px; color: #fff; font-family: var(--font-mono); margin-bottom: 6px; overflow-x: auto; white-space: nowrap; border-left: 3px solid #E11D48; }
7355.whisper-doc .note { font-size: 12px; color: var(--color-text-secondary); font-family: var(--font-sans); line-height: 1.6; margin-top: 4px; padding-left: 8px; border-left: 2px solid #E11D48; }
7356.whisper-doc .flag-table { width: 100%; border-collapse: collapse; font-size: 12px; }
7357.whisper-doc .flag-table th { text-align: left; padding: 8px 10px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-sans); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: #111215; }
7358.whisper-doc .flag-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-family: var(--font-mono); }
7359.whisper-doc .flag-table td:first-child { color: #fda4af; }
7360.whisper-doc .flag-table td:last-child { font-family: var(--font-sans); color: var(--color-text-secondary); }
7361.whisper-doc .flag-table tr:last-child td { border-bottom: none; }
7362.whisper-doc .perf-bar-wrap { margin: 0.5rem 0 1rem; background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); padding: 1rem; border-radius: 6px; }
7363.whisper-doc .perf-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
7364.whisper-doc .perf-row:last-child { margin-bottom: 0; }
7365.whisper-doc .perf-label { font-size: 12px; color: var(--color-text-secondary); width: 120px; flex-shrink: 0; font-family: var(--font-sans); text-align: right; }
7366.whisper-doc .perf-bar-bg { flex: 1; height: 8px; background: rgba(255, 255, 255, 0.03); border-radius: 4px; overflow: hidden; }
7367.whisper-doc .perf-bar { height: 100%; border-radius: 4px; }
7368.whisper-doc .perf-time { font-size: 12px; font-family: var(--font-mono); color: var(--color-text-primary); width: 70px; flex-shrink: 0; margin-left: 8px; }
7369.whisper-doc .lesson { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); align-items: flex-start; }
7370.whisper-doc .lesson:last-child { border-bottom: none; }
7371.whisper-doc .lesson-icon { font-size: 16px; flex-shrink: 0;
7371 margin-top: 1px; }
7372.whisper-doc .lesson-text { font-size: 12.5px; color: var(--color-text-secondary); font-family: var(--font-sans); line-height: 1.6; }
7373.whisper-doc .lesson-text strong { font-weight: 700; color: var(--color-text-primary); }
7374.whisper-doc .footer { text-align: center; font-size: 11px; color: #475569; font-family: var(--font-mono); padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, 0.05); margin-top: 2rem; }
7375.whisper-doc .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
7376@media (max-width: 600px) { .whisper-doc .two-col { grid-template-columns: 1fr; } }
7377.whisper-doc .env-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-size: 12px; }
7378.whisper-doc .env-row:last-child { border-bottom: none; }
7379.whisper-doc .env-key { color: var(--color-text-secondary); font-family: var(--font-sans); }
7380.whisper-doc .env-val { font-family: var(--font-mono); color: var(--color-text-primary); text-align: right; }
7381.whisper-doc .card-inner { background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 1rem 1.25rem; }
7382</style>
7383
7384  <div class="hero">
7385    <div class="hero-title"><span>whisper.cpp</span> + RX 580 via Vulkan</div>
7386    <div class="hero-sub">Audio/video transcription with AMD GPU acceleration on Windows — using Vulkan to run Whisper models directly on the RX 580 VRAM. A 2017 GPU put to work in 2026.</div>
7387    <div class="hero-badges">
7388      <span class="badge badge-gpu">AMD RX 580 8GB</span>
7389      <span class="badge badge-win">Windows + PowerShell</span>
7390      <span class="badge badge-ok">Vulkan Backend</span>
7391      <span class="badge badge-ok">large-v3-turbo</span>
7392      <span class="badge badge-warn">FFmpeg req</span>
7393    </div>
7394  </div>
7395
7396  <div class="stat-grid">
7397    <div class="stat">
7398      <div class="stat-label">total time</div>
7399      <div class="stat-value">~5 min</div>
7400      <div class="stat-sub">for 15 min of video</div>
7401    </div>
7402    <div class="stat">
7403      <div class="stat-label">VRAM used</div>
7404      <div class="stat-value">2.6 GB</div>
7405<div class="stat-sub">de 8 GB disponíveis</div>
7406    </div>
7407    <div class="stat">
7408      <div class="stat-label">speedup vs CPU</div>
7409      <div class="stat-value">~150×</div>
7410      <div class="stat-sub">antes: 12h para 40min</div>
7411    </div>
7412    <div class="stat">
7413      <div class="stat-label">modelo</div>
7414      <div class="stat-value">1.6 GB</div>
7415      <div class="stat-sub">large-v3-turbo</div>
7416    </div>
7417  </div>
7418
7419  <div class="section">
7420    <div class="section-title">pré-requisitos verificados</div>
7421    <div class="card-inner">
7422      <div class="env-row"><span class="env-key">Vulkan SDK</span><span class="env-val">glslc v2026.1</span></div>
7423      <div class="env-row"><span class="env-key">Git</span><span class="env-val">2.54.0.windows.1</span></div>
7424      <div class="env-row"><span class="env-key">CMake</span><span class="env-val">4.3.2</span></div>
7425      <div class="env-row"><span class="env-key">MSVC (Build Tools)</span><span class="env-val">14.52.36328 — VS 2026</span></div>
7426      <div class="env-row"><span class="env-key">GPU detectada</span><span class="env-val">AMD Radeon RX 580 2048SP</span></div>
7427      <div class="env-row"><span class="env-key">FFmpeg</span><span class="env-val">2026-04-19 (Gyan full build)</span></div>
7428    </div>
7429    <p class="note" style="margin-top: 8px;">Verificar RX 580 no Vulkan: <span style="font-family:var(--font-mono); color:#fda4af;">vulkaninfo --summary</span> → deve aparecer AMD Radeon RX 580 2048SP</p>
7430  </div>
7431
7432  <div class="section">
7433    <div class="section-title">compilação — passo a passo</div>
7434
7435    <div class="step">
7436      <div class="step-header">
7437        <div class="step-num">1</div>
7438        <div class="step-name">ativar ambiente MSVC x64</div>
7439        <div class="step-desc">a cada nova sessão</div>
7440      </div>
7441      <div class="step-body">
7442        <div class="cmd">& "C:\\Program Files (x86)\\Microsoft Visual Studio\\18\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"</div>
7443        <p class="note">Precisa repetir toda vez que abrir um novo PowerShell antes de compilar. Saída esperada: "Environment initialized for: 'x64'"</p>
7444      </div>
7445    </div>
7446
7447    <div class="step">
7448      <div class="step-header">
7449        <div class="step-num">2</div>
7450        <div class="step-name">clonar repositório</div>
7451        <div class="step-desc">~40 MB</div>
7452      </div>
7453      <div class="step-body">
7454        <div class="cmd">cd C:\\</div>
7455        <div class="cmd">git clone https://github.com/ggml-org/whisper.cpp</div>
7456        <div class="cmd">cd whisper.cpp</div>
7457      </div>
7458    </div>
7459
7460    <div class="step">
7461      <div class="step-header">
7462        <div class="step-num">3</div>
7463        <div class="step-name">cmake com Vulkan habilitado</div>
7464        <div class="step-desc">flag crítica: -DGGML_VULKAN=ON</div>
7465      </div>
7466      <div class="step-body">
7467        <div class="cmd">cmake -B build -DGGML_VULKAN=ON -DGGML_HIPBLAS=OFF -DGGML_HIP=OFF -DGGML_CUDA=OFF</div>
7468        <div class="cmd">cmake --build build --config Release -j4</div>
7469        <p class="note">Dura ~5-10 min. Warnings de C4267/C4244 são normais — não afetam o funcionamento. Binários ficam em build\\bin\\Release\\</p>
7470      </div>
7471    </div>
7472
7473    <div class="step">
7474      <div class="step-header">
7475        <div class="step-num">4</div>
7476        <div class="step-name">baixar modelo large-v3-turbo</div>
7477        <div class="step-desc">~1.6 GB</div>
7478      </div>
7479      <div class="step-body">
7480        <div class="cmd">Invoke-WebRequest -Uri "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo.bin" -OutFile "models\\ggml-large-v3-turbo.bin"</div>
7481        <p class="note">Outros modelos: large-v3 (~6GB VRAM, melhor qualidade), medium (~2.5GB), small (~1GB)</p>
7482      </div>
7483    </div>
7484  </div>
7485
7486  <div class="section">
7487    <div class="section-title">uso — fluxo completo mp4 → txt</div>
7488
7489    <div class="step">
7490      <div class="step-header">
7491        <div class="step-num" style="background:#1D9E75;">1</div>
7492        <div class="step-name">extrair áudio com FFmpeg</div>
7493        <div class="step-desc">whisper não lê mp4 direto no Windows</div>
7494      </div>
7495      <div class="step-body">
7496        <div class="cmd">ffmpeg -i "E:\\videos\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\videos\\video.wav"</div>
7497        <p class="note">-ar 16000 = 16kHz (obrigatório para o Whisper) · -ac 1 = mono · -c:a pcm_s16le = WAV sem compressão</p>
7498      </div>
7499    </div>
7500
7501    <div class="step">
7502      <div class="step-header">
7503        <div class="step-num" style="background:#1D9E75;">2</div>
7504        <div class="step-name">transcrever / traduzir</div>
7505        <div class="step-desc">GPU cuida do resto</div>
7506      </div>
7507      <div class="step-body">
7508        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --output-txt</
7508div>
7509        <p style="font-size:12px; color:var(--color-text-secondary); margin: 6px 0 4px; font-family:var(--font-sans);">com tradução para inglês:</p>
7510        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --translate --output-txt</div>
7511        <p class="note">--translate sempre gera inglês (limitação do Whisper). Para outros idiomas de destino, usar etapa adicional de tradução.</p>
7512      </div>
7513    </div>
7514
7515    <div style="margin-top: 1rem;">
7516      <div class="section-title" style="margin-bottom: 0.75rem;">flags úteis</div>
7517      <div class="card-inner">
7518        <table class="flag-table">
7519          <thead><tr><th>flag</th><th>descrição</th></tr></thead>
7520          <tbody>
7521            <tr><td>-l pt</td><td>idioma fonte: português</td></tr>
7522            <tr><td>-l en</td><td>idioma fonte: inglês</td></tr>
7523            <tr><td>--translate</td><td>traduz tudo para inglês</td></tr>
7524            <tr><td>--output-txt</td><td>salva .txt com transcrição</td></tr>
7525            <tr><td>--output-srt</td><td>salva legendas .srt com timestamps</td></tr>
7526            <tr><td>--output-vtt</td><td>salva legendas .vtt</td></tr>
7527            <tr><td>-t 8</td><td>usa 8 threads de CPU (padrão: 4)</td></tr>
7528            <tr><td>--device 0</td><td>seleciona GPU 0 (padrão)</td></tr>
7529            <tr><td>--no-gpu</td><td>força CPU (modo lento)</td></tr>
7530          </tbody>
7531        </table>
7532      </div>
7533    </div>
7534  </div>
7535
7536  <div class="section">
7537    <div class="section-title">performance — vídeo de 15 min</div>
7538    <div class="perf-bar-wrap">
7539      <div class="perf-row">
7540        <div class="perf-label">load modelo</div>
7541        <div class="perf-bar-bg"><div class="perf-bar" style="width:1.3%; background:#E11D48;"></div></div>
7542        <div class="perf-time">4 s</div>
7543      </div>
7544      <div class="perf-row">
7545        <div class="perf-label">mel (áudio)</div>
7546        <div class="perf-bar-bg"><div class="perf-bar" style="width:0.4%; background:#E11D48;"></div></div>
7547        <div class="perf-time">1.2 s</div>
7548      </div>
7549      <div class="perf-row">
7550        <div class="perf-label">encode GPU</div>
7551        <div class="perf-bar-bg"><div class="perf-bar" style="width:23.7%; background:#1D9E75;"></div></div>
7552        <div class="perf-time">73 s</div>
7553      </div>
7554      <div class="perf-row">
7555        <div class="perf-label">decode + batch</div>
7556        <div class="perf-bar-bg"><div class="perf-bar" style="width:54.7%; background:#1D9E75;"></div></div>
7557        <div class="perf-time">168 s</div>
7558      </div>
7559      <div class="perf-row">
7560        <div class="perf-label" style="font-weight:700; color:var(--color-text-primary);">total</div>
7561        <div class="perf-bar-bg"><div class="perf-bar" style="width:100%; background:#E11D48;"></div></div>
7562        <div class="perf-time" style="font-weight:700;">307 s</div>
7563      </div>
7564    </div>
7565    <p class="note">CPU em ~5% durante toda a transcrição. VRAM: 2.6 GB de 8 GB. A GPU fez o trabalho — CPU ficou de molho.</p>
7566  </div>
7567
7568  <div class="section">
7569    <div class="section-title">lições aprendidas nas peripécias</div>
7570    <div class="card-inner">
7571      <div class="lesson">
7572        <div class="lesson-icon">⚠️</div>
7573<div class="lesson-text"><strong>WSL2 não expõe a RX 580 via Vulkan</strong> — usar sempre PowerShell/Windows nativo para aproveitar a GPU.</div>
7574      </div>
7575      <div class="lesson">
7576        <div class="lesson-icon">⚠️</div>
7577        <div class="lesson-text"><strong>Whisper não lê MP4 no Windows</strong> — sempre extrair o áudio com FFmpeg antes. Usar -ar 16000 -ac 1 -c:a pcm_s16le.</div>
7578      </div>
7579      <div class="lesson">
7580        <div class="lesson-icon">ℹ️</div>
7581        <div class="lesson-text"><strong>--translate só gera inglês</strong> — é limitação do Whisper, não da configuração. Para PT como destino, precisa de etapa extra.</div>
7582      </div>
7583      <div class="lesson">
7584        <div class="lesson-icon">ℹ️</div>
7585        <div class="lesson-text"><strong>vcvars64.bat precisa ser reativado</strong> a cada nova sessão do PowerShell antes de qualquer compilação.</div>
7586      </div>
7587      <div class="lesson">
7588        <div class="lesson-icon">✅</div>
7589        <div class="lesson-text"><strong>8 GB de VRAM em 2026 ainda é sólido</strong> — large-v3-turbo usa apenas 2.6 GB. GPU "velha" com VRAM decente bate GPU nova com 4 GB fácil.</div>
7590      </div>
7591      <div class="lesson">
7592        <div class="lesson-icon">✅</div>
7593        <div class="lesson-text"><strong>Warnings C4267/C4244 durante compilação são normais</strong> — conversões de tipo esperadas no código do ggml, não impactam funcionamento.</div>
7594      </div>
7595    </div>
7596  </div>
7597
7598  <div class="footer">
7599    RX 580 — velha de 580 anos, mas ainda na ativa 🚀 · Peripécias documentadas em junho/2026
7600  </div>
7601
7602</div>`},benchmarks:{id:"benchmarks",title:"23. BENCHMARKS REAIS DO LABORATÓRIO",desc:"Consolidated telemetry data measured directly in the inference logs of both architectures.",meta:{version:"1.0.0",type:"benchmark",category:"hardware",subcategory:"benchmarks",difficulty:"beginner",estimated_time_min:15,tags:["telemetria","gpu-benchmarks","performance-history"],last_reviewed:"2026-07-01",relationships:{prerequisites:["guia"],previous:"guia",next:"cpu",related:["hardware","cpu"]}},html:'<div class="tbl"><table><thead><tr><th>
7602Model Execution Mode</th><th>Allocated Architecture</th><th>Obtained Commercial Metric</th><th>Viability Status</th></tr></thead><tbody><tr><td>Common Text Inference</td><td>Pure Xeon CPU (No Acceleration)</td><td>3 to 5 tokens per second</td><td>❌ Inefficient / Slow Responses</td></tr><tr class="hig"><td>Compiled Text Inference</td><td>RX 580 8GB via Vulkan Backend</td><td>15 to 16 tokens per second</td><td>✅ Highly Productive / Instant</td></tr><tr><td>SD 1.5 Sampling (20 Steps)</td><td>ComfyUI Windows via DirectML</td><td>~450 seconds per image</td><td>❌ Unstable / Discarded due to Critical Error</td></tr><tr class="hig"><td>SD 1.5 Sampling (20 Steps)</td><td>stable-diffusion.cpp via Vulkan</td><td>72 seconds per image</td><td>✅ Optimized / Fast Response</td></tr></tbody></table></div>'},codacus:{id:"codacus",title:"33. MÉTODO CODACUS vs AIVisionsLab",desc:"Experiment of the 5 flags that saved a GTX 1060 — do they work on an RX 580?",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:25,tags:["gtx-1060","metodo-codacus","nvidia-pascal"],last_reviewed:"2026-07-01",relationships:{prerequisites:["dadhacks"],previous:"dadhacks",next:"proximos",related:["dadhacks","amihart"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">The Codacus channel published a highly impactful video demonstrating how to run a <strong>35B parameter model on a 6GB GTX 1060</strong> using 5 specific <code>llama.cpp</code> flags, jumping from 3.0 tokens/s baseline to 17.0 tokens/s post-optimizations. AIVisionsLab tested this hypothesis on the older <strong>RX 580 2048SP 8GB with Vulkan</strong> — comparing Windows and native Linux.</p><div class="tbl"><table><thead><tr><th>Metric / Configuration</th><th>Codacus Setup (Ref)</th><th>AIVisionsLab Setup</th></tr></thead><tbody><tr><td><strong>GPU</strong></td><td>Nvidia GTX 1060 6GB</td><td>AMD Radeon RX 580 2048SP 8GB</td></tr><tr><td><strong>Backend</strong></td><td>CUDA</td><td>Vulkan (Mesa RADV)</td></tr><tr><td><strong>OS</strong></td><td>Linux + Docker</td><td>Windows 10 / Ubuntu 26.04</td></tr><tr><td><strong>CPU</strong></td><td>Intel Core i3-8100</td><td>Intel Xeon E5-2690 v3 (12c/24t)</td></tr><tr><td><strong>Test Model</strong></td><td>Qwen3.6 35B-A3B Q4_K_M</td><td>Qwen3.6 35B-A3B Q4_K_M (Same model)</td></tr></tbody></table></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Impact of the 5 Flags on AMD Vulkan</h3><div class="tbl"><table><thead><tr><th>Applied Flag</th><th>Impact on GTX 1060 (CUDA)</th><th>Impact on RX 580 (Vulkan Windows)</th><th>Impact on RX 580 (Vulkan Linux Native)</th></tr></thead><tbody><tr><td><strong>Baseline</strong></td><td>3.0 tokens/s (-ngl 20)</td><td><strong>7.62 tokens/s (-ngl 10)</strong></td><td><strong>5.18 tokens/s (-ngl 20)</strong></td></tr><tr><td><code>--override-tensor exps=CPU</code></td><td>10.0 tokens/s (+233%)</td><td>6.92 tokens/s (❌ -9%)</td><td>4.62 tokens/s (❌ -11%)</td></tr><tr><td><code>--no-mmap</code> (or <code>-mmp 0</code>)</td><td>13.5 tokens/s (+35%)</td><td>7.44 tokens/s (❌ -2%)</td><td>4.86 tokens/s (❌ -6%)</td></tr><tr><td>KV cache quantization (<code>-ctk/ctv</code>)</td><td>17.0 tokens/s (+26%)</td><td>7.58 tokens/s (❌ -1%)</td><td><strong>5.41 tokens/s (✅ +4%)</strong></td></tr><tr><td><code>--mlock</code> / extra ngl</td><td>Expanded stability</td><td>OOM above ngl 10 (❌)</td><td>OOM above ngl 20 (❌)</td></tr></tbody></table></div><div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4"><h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Analysis of Technical Findings</h4><p style="font-size:0.8rem;color:#94a3b8;line-height:1.7"><strong>1. VRAM Allocation Model:</strong> Why did ngl 20 OOM on Windows but pass on Linux? AMD's proprietary driver on Windows allocates memory more conservatively, while the open-source <strong>Mesa RADV on Linux</strong> allows more layers to be offloaded to the buffer (real max ceiling of 20 layers vs 10 layers on Windows).</p><p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem"><strong>2. Backend Incompatibility:</strong> The <code>override-tensor exps=CPU</code>
7602 routing to isolate Mixtral/MoE experts from the GPU works spectacularly on CUDA due to Nvidia's native high-speed PCIe access. Under the Vulkan backend, the overhead of this movement destroys processing gains.</p><p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem"><strong>3. The Superior Xeon Compensated for the Backend:</strong> Even with lower VRAM optimization, AIVisionsLab's Xeon E5-2690 v3 (24 threads) CPU infrastructure guaranteed a superior original baseline of 7.62 tokens/s — beating Codacus's i3-8100 3.0 tokens/s baseline.</p></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Mistral 7B Comparative — Pure CPU vs Vulkan</h3><p style="font-size:.88rem;color:#94a3b8;line-height:1.9">To demonstrate the raw and absolute value of the Vulkan backend on legacy Polaris hardware:</p><div class="code ok"><pre>💻 WSL2 Ubuntu (Pure CPU)  ·  24 threads  ·  1.79 tokens/s
7603🎮 Windows 10 (Vulkan GPU)  ·  12 threads  ·  18.54 tokens/s (⚡ 10x Faster!)</pre></div><blockquote style="font-size:.82rem;color:#64748b;font-style:italic;line-height:1.8;border-left:3px solid #E11D48;padding-left:.9rem;margin-top:1rem">"Codacus's 5 flags work perfectly for NVIDIA + CUDA + Linux Docker brands. In the AMD + Vulkan ecosystem, our own recipe is different but incredibly solid!"</blockquote>`},"comfyui-directml-func":{id:"comfyui-directml-func",title:"17. FIXES DIRECTML",desc:"Installation of the specific development wheel to force operational stability.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-batch-fix","memoria-virtual","crash-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml"],previous:"comfyui-directml",next:"comfyui-flux",related:["comfyui-directml","scripts"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Should there be a need to run comparative tests on the DirectML layer without startup crashes, it is necessary to force the downgrade of the packages using the May 2024 development build:</p>
7604  <div class="code"><pre># Command to purge conflicting dependencies and install the stable dev wheel
7605pip uninstall torch torch-directml torchaudio
7606pip install torch==2.3.1+cpu --index-url https://download.pytorch.org/whl/cpu
7607pip install torch-directml==0.2.1.dev240521 --no-deps</pre></div>`},"comfyui-directml":{id:"comfyui-directml",title:"16. DIRECTML",desc:"Detailed technical explanation of chronic failures encountered during testing on the Windows branch.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fix","windows-driver","comfyui-windows"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-wsl"],previous:"comfyui-wsl",next:"comfyui-directml-func",related:["troubleshoot-comfyui","comfyui-portable-amd"]}},html:`<div class="err"><div class="err-t">Structural Failure — CLIPTextEncode Module Incompatibility</div><p>When loading the basic image generation workflows using the native DirectML installer for AMD cards, the console aborts execution, returning the following blocking exception:</p><div class="code"><span class="code-lang">stderr</span><pre>File "comfy\\utils.py", line 245, in encode_token
7608NotImplementedError: Cannot access storage of OpaqueTensorImpl</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Engineering Analysis:</strong> The DirectML driver encapsulates memory data into objects known as <code>OpaqueTensorImpl</code>. When ComfyUI's internal mathematical attention optimization functions attempt to read the raw content of these tensors in physical memory, the Microsoft ecosystem layer blocks access, interrupting the rendering pipeline.</p></div>`},"comfyui-flux":{id:"comfyui-flux",title:"18. PARAMETRIZAÇÃO CRÍTICA DO FLUX.1 SCHNELL",desc:"Mandatory mathematical configuration to process the SOTA model on CPU without blowing RAM limits.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:20,tags:["flux-fp8","comfyui-workflow","vram-allocation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml-func"],previous:"comfyui-directml-func",next:"comfyui-modelos",related:["flux_server","comfyui-modelos"]}},html:'<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Processing the 16GB FLUX.1 Schnell in CPU mode requires fixed sampling limits. Deviations from these rules cause the machine to freeze due to extreme memory saturation:</p><div class="tbl"><table><thead><tr><th>
7608Sampling Parameter</th><th>Mandatory Adjustment Value</th><th>Technical Explanation on Xeon</th></tr></thead><tbody><tr class="hig"><td>Sampling Steps</td><td>4 Steps</td><td>The Schnell model was designed to close noise convergence in just 4 interactions.</td></tr><tr class="hig"><td>CFG Scale</td><td>1.0</td><td>Values above 1.0 destroy texture fidelity and distort tensor distribution.</td></tr><tr><td>Scheduler Type</td><td>sgm_uniform</td><td>Guarantees linear interpolation of diffusion tensors optimized for AVX2 instructions.</td></tr></tbody></table></div>'},"comfyui-modelos":{id:"comfyui-modelos",title:"14. GESTÃO ZERO-COPY DE MODELOS NO NVMe",desc:"Symbolic link technique to unify storage of heavy checkpoints without duplicating files.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"armazenamento",difficulty:"intermediate",estimated_time_min:15,tags:["symlink","diretorios-compartilhados","espaco-disco"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-flux"],previous:"comfyui-flux",next:"animatediff-video",related:["arquivos","modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">To avoid wasting space on the NVMe SSD drive and eliminate the need to keep identical giant copies between Windows and Linux (WSL2), a direct symbolic link is created pointing to the cross file system:</p><div class="code"><span class="code-lang">bash</span><pre># Run this block inside the Ubuntu Linux subsystem terminal
7609cd ~/ComfyUI/models/checkpoints/
7610
7611# Create the virtual anchor point mirroring the physical file located on Windows partition E:
7612ln -s "/mnt/e/ComfyUI_Models/checkpoints/flux1-schnell-fp8.safetensors" ./flux1-schnell-fp8.safetensors</pre></div>`},"comfyui-portable-amd":{id:"comfyui-portable-amd",title:"29. COMFYUI PORTÁTIL v0.3.48 — IMPLEMENTAÇÃO AMD",desc:"Specific settings and environment variable injection for the Polaris architecture.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-portable","directml-setup","portable-workflow"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshoot-comfyui"],previous:"troubleshoot-comfyui",next:"comunidade",related:["comfyui-directml","comfyui-flux"]}},html:`<div class="card"><p style="font-size:.88rem;color:#94a3b8;line-height:1.9">For implementations using pre-compiled portable packages of ComfyUI focused on AMD DirectML compatibility on Windows, the Python interpreter needs help to correctly identify the hardware capabilities of the old GPU:</p><div class="code"><span class="code-lang">batch</span><pre># Insert at the top of run_nvidia_gpu.bat or custom portable script:
7613set HSA_OVERRIDE_GFX_VERSION=8.0.3
7614set DXVK_ASYNC=1
7615
7616.\\python_embeded\\python.exe main.py --directml</pre></div><p style="margin-top:.5rem;font-size:.82rem;color:#64748b;line-height:1.6">The <code>8.0.3</code> flag emulates the build architecture ID required for numerical libraries to process tensors without crashing the PCIe bus of the RX 500 series.</p></div>`},"comfyui-wsl":{id:"comfyui-wsl",title:"15. COMFYUI WSL2",desc:"Setting up the virtualized Linux environment to inherit the computational power of Xeon and ECC RAM.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"virtualizacao",difficulty:"advanced",estimated_time_min:30,tags:["wsl2-linux","comfyui-wsl","direct-vulkan"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_openwebui_integration"],previous:"sd_openwebui_integration",next:"comfyui-directml",related:["comfyui-flux","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">To circumvent the physical GPU VRAM limit in massive models, ComfyUI is instantiated within the Linux subsystem strictly pointing execution to the processor cores:</p>
7617  <div class="code"><span class="code-lang">bash</span><pre># Activate the isolated virtual environment via Miniconda in the Ubuntu terminal
7618conda activate comfy_env
7619
7620# Call the main script forcing the use of central processing hardware
7621python main.py --cpu --listen 0.0.0.0 --port 8188</pre></div>
7622  <div class="note info" style="margin-top:.75rem">The ComfyUI node panel will be fully available on the Windows side via the mapped route: <strong>http://localhost:8188</strong></div>`},comunidade:{id:"comunidade",title:"30. CONTEXTO E FONTES DA COMUNIDADE",desc:"Hacker knowledge repositories and forums dedicated to preserving and optimizing legacy hardware.",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"comunidade",difficulty:"beginner",estimated_time_min:10,tags:["comunidade-hacker","links-utiles","github-preservation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-portable-amd"],previous:"comfyui-portable-amd",next:"amihart",related:["amihart","dadhacks","codacus"]}},html:'<div class="card acc"><p style="font-size:.85rem;color:#94a3b8;line-height:1.9">The reverse engineering and technical viability of this lab are based on optimization discussions documented by communities focused on extracting maximum performance from low-cost components:</p><ul style="padding-left:1.2rem;margin-top:.5rem;font-size:.85rem;color:#e2e8f0;line-height:2"><li>Official AIVisionsLab Discord Server: <strong style="color:#5865F2"><a href="https://discord.gg/FmkxZjN8f" target="_blank" rel="noopener noreferrer" style="color:#5865F2;text-decoration:underline">discord.gg/FmkxZjN8f</a></strong></li><li>Global Heritage Server Engineering Community: <strong style="color:var(--r)">r/X99_Lab</strong></li><li>GGUF Compilation Optimization and Rhyme Discussions: <strong style="color:#fff">Github: ggerganov/llama.cpp/discussions</strong></li></ul></div>'},contexto:{id:"contexto",title:"01. CONTEXTO E PROBLEMA",desc:"Why one of the best-selling cards in history was being left behind in the AI era.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:10,tags:["obsolescencia-programada","hardware-livre","preservacao-silicio"],last_reviewed:"2026-07-01",relationships:{prerequisites:[],previous:"",next:"hardware",related:["solucao","jornada"]}},html:"<p>The RX 580 (and its twin sister, the RX 580 2048SP) was an absolute sales success. Thousands of people have it at home. But when the AI fever started, AMD focused only on new cards (RDNA3) and Linux. On Windows, the only option was DirectML, which is so slow it made AI impractical. The community then came together to create a solution that is abandonment-proof.</p>"},cpu:{id:"cpu",title:"24. PARAMETRIZAÇÃO E AJUSTES DO XEON",desc:"BIOS configurations and structural limits of fp32 instructions for the LGA 2011-3 processor.",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"processadores",difficulty:"intermediate",estimated_time_min:18,tags:["bios-tuning","avx-optimization","intel-xeon-tuning"],last_reviewed:"2026-07-01",relationships:{prerequisites:["benchmarks"],previous:"benchmarks",next:"troubleshooting",related:["hardware","benchmarks"]}},html:'<div class="card acc"><p style="font-size:.88rem;color:#e2e8f0;font-weight:600;line-height:1.6">Technical Guidelines for Haswell Microarchitecture Xeon Processors (v3):</p><p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">The Intel Xeon E5-2690 v3 processor released in 2014 has native support for the <strong style="color:#fff">AVX2</strong> vector instruction set. However, it lacks dedicated hardware for reduced precision math calculations in <strong style="color:var(--r)">FP16 (Half-Precision)</strong>.</p><p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">When instantiating model loaders inside ComfyUI on Linux, make sure to set the calculation precision to <strong style="color:#22c55e">FP32 (Single-Precision)</strong>. If you force FP16 execution, the processor will need to emulate instructions via software, halving processing speed.</p></div>'},dadhacks:{id:"dadhacks",title:"32. MÉTODO DADHACKS — AI IMAGE GENERATION ON RX 580 USING VULKAN: A COST-EFFECTIVE SOLUTION",desc:"Analysis of the experimental consolidation by DH (DadHacks) in December 2025, establishing compatibility paths for image generation on legacy GPU.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"intermediate",estimated_time_min:20,tags:["dadhacks-method","estetica-baixo-custo","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["amihart"],previous:"amihart",next:"codacus",related:["amihart","codacus"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">On December 5, 2025, developer <strong style="color:#fff">DH (DadHacks)</strong> published an innovative technical guide on <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline">dadhacks.org</a> demonstrating that the 8GB AMD RX 580 GPU is perfectly viable for modern AI generation without relying on proprietary software solutions or ROCm.</p><div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);margin-bottom:1.25rem"><strong style="color:#fff;display:block;margin-bottom:.4rem">📌 Technical Validation Results:</strong><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">DadHacks' study experimentally demonstrated that running Stable Diffusion via Vulkan is viable, refining the preliminary conclusion from January 2025. The gradual maturity of the <code>stable-diffusion.cpp</code> ecosystem amplified throughput rates by the end of 2025.</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. Engine Compilation — stable-diffusion.cpp</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">DH detailed the compilation flow on Linux using the native compiler flag <code>-DSD_VULKAN=ON</code>:</p><div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span>
7622<pre># Clone recursively (mandatory to bring ggml submodules)
7623git clone --recursive https://github.com/leejet/stable-diffusion.cpp
7624cd stable-diffusion.cpp && mkdir build && cd build
7625
7626# Configure CMake using enabled Vulkan
7627cmake .. -DSD_VULKAN=ON
7628
7629# Build binaries
7630cmake --build . --config Release</pre></div><p style="font-size:.82rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">🧬 <strong>Documented Flag Divergence:</strong> DadHacks used <code>-DSD_VULKAN=ON</code> (application layer), while AIVisionsLab homologated <code>-DGGML_VULKAN=ON</code> (tensor engine layer). Both generate the same efficient binary in practice, but reference different paths of the leejet repository evolution.</p><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. Original Generation Commands (DadHacks)</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Original demonstration of offline terminal call for Flux Schnell (4-bit quantized model) and Flux Dev, using memory segmentation to save VRAM:</p><div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># Run Flux Schnell (4 sampling steps)
7631sd --diffusion-model SD-Models/flux1-schnell-q4_0.gguf \\
7632   --vae SD-Models/ae.safetensors \\
7633   --clip_l SD-Models/clip_l.safetensors \\
7634   --t5xxl SD-Models/t5xxl_fp16.safetensors \\
7635   -p "a lovely beagle holding a sign says 'hello'" \\
7636   --cfg-scale 1.0 \\
7637   --sampling-method euler \\
7638   -v --steps 4 \\
7639   --clip-on-cpu</pre></div><div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin-bottom:1.25rem"><strong style="color:#ef4444;display:block;margin-bottom:.4rem">🚨 CRITICAL ALERT: GGUF Incompatibility (AIVisionsLab Discovery)</strong><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">DadHacks did not list a very common format incompatibility: GGUF weights published by maintainer <strong>city96</strong> are compatible <em>only</em> with ComfyUI. For execution in stable-diffusion.cpp / sd-server, it is mandatory to use models officially published by maintainer <strong>leejet</strong> (ex: <code style="color:#fff">FLUX.1-schnell-gguf</code>).</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">C. What DadHacks Didn't Cover (That AIVisionsLab Expanded)</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">DadHacks' original guide focused on the Linux/terminal ecosystem with manual commands. AIVisionsLab aggressively expanded this technical base:</p><table style="width:100%;border-collapse:collapse;font-size:.78rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem;border:1px solid var(--b)"><thead><tr style="background:rgba(255,255,255,0.02);color:#fff;border-bottom:1px solid var(--b)"><th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">Feature</th><th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">DadHacks (Linux)</th><th style="padding:.5rem;text-align:left">AIVisionsLab (Native Windows)</th></tr></thead><tbody><tr style="border-bottom:1px solid var(--b)"><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Windows Hosting</td><td style="padding:.5rem;border-right:1px solid var(--b)">❌ Not addressed</td><td style="padding:.5rem;color:#22c55e">✅ Mapping via MSVC / Cmd executables</td></tr><tr style="border-bottom:1px solid var(--b)"><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Graphical Integration</td><td style="padding:.5rem;border-right:1px solid var(--b)">❌ CLI terminal only</td><td style="padding:.5rem;color:#22c55e">✅ API Server + OpenWebUI / Docker link</td></tr><tr style="border-bottom:1px solid var(--b)"><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">.bat Automation</td><td style="padding:.5rem;border-right:1px solid var(--b)">❌ Manual shell scripts</td><td style="padding:.5rem;color:#22c55e">✅ Automatic double-click scripts on Desktop</td></tr><tr><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">VRAM Security</td><td style="padding:.5rem;border-right:1px solid var(--b)">⚠️ Limited to CLI base</td><td style="padding:.5rem;color:#22c55e">✅ Optimizations with VAE Tiling against OOM bugs</td></tr></tbody></table><div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem"><strong style="color:var(--r)">Extensive Community Credit:</strong> Documentary section based on original publication by <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">DH (DadHacks)</a>, titled <em>"AI Image Generation on RX 580 Using Vulkan"</em>. Knowledge is free and evolutionary.</div>`},falhas:{id:"falhas",title:"03. O QUE NÃO FUNCIONOU (O CEMITÉRIO TÉCNICO)",desc:"Detailed analysis of failures: technical reasons for rejecting native DirectML, OpenVINO and ROCm.",meta:{version:"1.0.0",type:"estudo_caso",category:"troubleshooting",subcategory:"historico",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fail","rocm-amd","openvino-intel"],last_reviewed:"2026-07-01",relationships:{prerequisites:["hardware"],previous:"hardware",next:"solucao",related:["troubleshooting","comfyui-directml"]}},html:`<div class="err">
7639<div class="err-t">3.1 DirectML + Native Windows ComfyUI — ABANDONED</div><p><strong style="color:#e2e8f0">Attempts:</strong> Invocation via <code>torch-directml</code> and flag <code>--directml</code>. The ecosystem was detected as <code>privateuseone0</code>, but revealed chronic instability due to lack of structural updates from Microsoft.</p><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Critical Error Logs:</strong></p><div class="code"><span class="code-lang">stderr</span><pre>WARNING: torch-directml barely works, is very slow, has not been updated in over 1 year and might be removed soon, please don't use it.
7640
7641OSError: [WinError 127] The specified procedure could not be found
7642# Caused by a DLL mismatch between torchaudio and the torch 2.4.1 CPU build
7643
7644NotImplementedError: Cannot access storage of OpaqueTensorImpl
7645# CLIPTextEncode breaks when trying to manipulate opaque tensors generated by DirectML</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Root Cause:</strong> DirectML generates opaque tensors incapable of communicating with ComfyUI's modern attention backends. Additionally, the installer forces the import of <code>torchaudio</code> inside the <code>audio_vae.py</code> module, breaking initialization even if you don't use audio.</p></div><div class="err" style="margin-top:1rem"><div class="err-t">3.2 OpenVINO + Stable Diffusion Forge</div><p><strong style="color:#e2e8f0">Attempt:</strong> Coupling the <code>sd-webui-openvino</code> extension developed by Intel into the Forge ecosystem.</p><div class="code"><span class="code-lang">stderr</span><pre>ModuleNotFoundError: No module named 'ldm'
7646ModuleNotFoundError: No module named 'sgm'
7647Error build_unet: Invalid backend: 'openvino'</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Root Cause:</strong> The extension was designed for the old Automatic1111 architecture. Since Forge completely restructured the code and replaced native <code>ldm</code> and <code>sgm</code> modules, the OpenVINO backend injection fails completely.</p></div><div class="err" style="margin-top:1rem"><div class="err-t">3.3 ROCm — Unviable by Design on Polaris</div><ul><li>AMD officially ended support for the GCN4 architecture (Polaris/RX 580) in modern ROCm branches (v5.x+).</li><li>No official support for native ROCm on Windows.</li><li>Compatibility layers via WSL2 for older cards cause constant Kernel Panics during high-load inferences.</li></ul></div><div class="err" style="margin-top:1rem"><div class="err-t">3.4 WebUI Forge on Pure CPU (HDD)</div><p><strong style="color:#e2e8f0">Metrics:</strong> Startup time of 85 seconds. Unsustainable render time of ~19 minutes per simple image (512x512, 20 steps). The HDD bottleneck competing with the paging management of <code>memory_management.py</code> made the setup unworkable.</p></div>`},"flux-vulkan":{id:"flux-vulkan",title:"25. EXPLORAÇÃO COMPLEMENTAR: FLUX VIA VULKAN",desc:"Alternative acceleration of Flux models using ultra-compact quantizations in C++.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["flux-vulkan","cpp-native-inference","amd-acceleration"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshooting"],previous:"troubleshooting",next:"troubleshoot-comfyui",related:["flux_server","sdxl_vulkan"]}},html:'<div class="card"><p style="font-size:.88rem;color:#94a3b8;line-height:1.9">Although the native 16GB FLUX.1 checkpoint requires the robust processing of the Xeon CPU, it is entirely viable to run inferences directly on the RX 580 GPU using the <code>stable-diffusion.cpp</code> binary coupled with aggressive 3-bit quantizations:</p><div class="note info" style="margin-top:.5rem">Recommended Weight for VRAM Tests: <strong>flux1-schnell-Q3_K_S.gguf (~5.2GB)</strong>. This variation fits comfortably within the 8GB physical limit of the Polaris card, delivering hardware-accelerated SOTA generations.</div></div>'},flux_server:{id:"flux_server",title:"11. RODAR FLUX NO SD-SERVER (GPU + CPU HÍBRIDO)",desc:"Mapping and initialization of the 12B-parameter Flux ecosystem with segmented memory architecture.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"advanced",estimated_time_min:30,tags:["flux-schnell","servidor-imagem","gerenciamento-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdserver"],previous:"sdserver",next:"sd_bat_automation",related:["comfyui-flux","flux-vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Flux requires precise segmentation between VRAM and host RAM. Using the flags <code>--vae-on-cpu</code> and <code>--vae-tiling</code>, we avoid out-of-memory (OOM) errors on the RX 580 2048SP. The T5XXL (fp16) and VAE reside in RAM; the diffusion model occupies VRAM.</p><div class="tbl"><table><thead><tr><th>
7647Component</th><th>Homologated File</th><th>Final Allocation</th><th>Size</th></tr></thead><tbody><tr><td>Diffusion Model</td><td><code>flux1-schnell-q4_k.gguf</code></td><td><strong>GPU (VRAM)</strong></td><td>~6.5 GB</td></tr><tr><td>VAE</td><td><code>ae.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~160 MB</td></tr><tr><td>CLIP L</td><td><code>clip_l.safetensors</code></td><td><strong>GPU (VRAM)</strong></td><td>~235 MB</td></tr><tr><td>T5XXL</td><td><code>t5xxl_fp16.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~9.3 GB</td></tr></tbody></table></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-top:1.25rem">⚠️ <strong style="color:#fff">Stability Notes:</strong> Removing the <code>--timeout</code> flag (unsupported by the current version) and adding <code>--vae-tiling</code> eliminated <em>DeviceMemoryAllocation</em> errors. Total RAM usage reaches ~9.5 GB (T5XXL fp16). To save RAM, replacing it with <code>t5xxl_fp8</code> reduces it to ~5 GB.</p><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Production Command (iniciar.bat):</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
7648  --diffusion-model "E:\\ia_storage\\models\\Stable-diffusion\\flux1-schnell-q4_k.gguf" ^
7649  --vae "E:\\ia_storage\\models\\Stable-diffusion\\ae.safetensors" ^
7650  --clip_l "E:\\ia_storage\\models\\Stable-diffusion\\clip_l.safetensors" ^
7651  --t5xxl "E:\\ia_storage\\models\\Stable-diffusion\\t5xxl_fp16.safetensors" ^
7652  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre><div class="tbl" style="margin-top:1.25rem; margin-bottom:1.25rem"><table><thead><tr><th>Step</th><th>Real Time</th></tr></thead><tbody><tr><td>Conditioning (T5XXL)</td><td>11.49s</td></tr><tr><td>Sampling — 4 steps @ 1024x1024</td><td>~838s (~14 min)</td></tr><tr><td>VAE Decode — 9 tiles</td><td>40.45s</td></tr><tr><td><strong>Total per image</strong></td><td><strong>~838s (~14 min)</strong></td></tr></tbody></table></div><div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;"><span style="color:#22c55e; font-weight:bold">✅ STATUS: SERVER IN PRODUCTION — IMAGE GENERATED SUCCESSFULLY</span><br><span style="font-size:.8rem; color:#94a3b8">Listening on http://0.0.0.0:7860 | VRAM: 7.6/8.0 GB | RAM: ~9.5 GB | GPU: RX 580 2048SP | Temp: 66°C</span></div>`},guia:{id:"guia",title:"22. GUIA ESTRATÉGICO POR CASO DE USO",desc:"Decision matrix: when to direct processing to the GPU or to the Xeon.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:12,tags:["decision-making","workflows","hardware-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["scripts"],previous:"scripts",next:"benchmarks",related:["contexto","benchmarks"]}},html:'<div class="tbl"><table><thead><tr><th>Workflow Objective</th><th>Recommended Model</th><th>Allocated Backend</th><th>Real Generation Metric</th></tr></thead><tbody><tr class="hig"><td>Local Text Chat & Assistance</td><td>Mistral 7B / Llama 3 8B GGUF</td><td>RX 580 GPU (Vulkan)</td><td>High Performance (15-16 tokens/s) ⚡</td></tr><tr class="hig"><td>Fast Image Generation (512x512)</td><td>DreamShaper 8 (SD 1.5 GGUF)</td><td>RX 580 GPU (Vulkan)</td><td>Fluid Rendering (~72 seconds)</td></tr><tr><td>High Resolution & SOTA Detail Creation</td><td>FLUX.1 Schnell (16GB Weights)</td><td>Xeon CPU (WSL2)</td><td>Heavy Processing (~24 minutes)</td></tr><tr><td>Frame Interpolation & Video Animation</td><td>AnimateDiff Pipeline Standard</td><td>Xeon CPU (WSL2)</td><td>Stable Processing (~141 seconds)</td></tr></tbody></table></div>'},hardware:{id:"hardware",title:"02. HARDWARE DO LABORATÓRIO",desc:"The specs of our low-cost 'Frankenstein' that serves as the base for this tutorial.",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"especificacoes",difficulty:"beginner",estimated_time_min:12,tags:["amd-polar","rx-580","intel-xeon","ram-ecc"],last_reviewed:"2026-07-01",relationships:{prerequisites:["contexto"],previous:"contexto",next:"falhas",related:["cpu","benchmarks"]}},html:`<div class="card acc">
7653  <div class="stat">
7654    <span class="stat-icon">🎮</span>
7655    <span class="stat-lbl">GPU</span>
7656    <span class="stat-val">RX 580 2048SP</span>
7657    <small>8GB VRAM (Vulkan)</small>
7658  </div>
7659  <div class="stat">
7660    <span class="stat-icon">🧠</span>
7661    <span class="stat-lbl">CPU</span>
7662    <span class="stat-val">Intel Xeon</span>
7663    <small>Cheap server reject</small>
7664  </div>
7665  <div class="stat">
7666    <span class="stat-icon">💾</span>
7667    <span class="stat-lbl">RAM</span>
7668    <span class="stat-val">32GB DDR4</span>
7669    <small>Vital for running FLUX on CPU</small>
7670  </div>
7671</div>
7672<p>8GB of VRAM is the 'sweet spot'. It's enough to run 7B LLMs and standard image models. The 32GB RAM is our safety belt for giant models.</p>`},jornada:{id:"jornada",title:"06. JORNADA COMPLETA — AS 5 FASES",desc:"The lab timeline: from initial CPU slowness to total control of legacy hardware.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:10,tags:["linha-tempo","conquistas","roadmap"],last_reviewed:"2026-07-01",relationships:{prerequisites:["prereqs"],previous:"prereqs",next:"llama",related:["linhatempo","proximos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.75rem">The technical success of the local ecosystem was achieved through 5 evolutionary milestones and strategic hardware decisions:</p><div class="phase"><div class="phase-num">01</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">WebUI Forge on Pure CPU (HDD)</span><span class="lbl lbl-b">INITIAL BASELINE</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">
7672First functional infrastructure. Slow boot of 85 seconds and rendering marks hitting ~19 minutes per image. Completely unviable system for productive use.</p></div></div><div class="phase"><div class="phase-num">02</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">LLM Acceleration via Vulkan (RX 580)</span><span class="lbl lbl-r">TECHNICAL BREAKTHROUGH</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Successful compilation of llama.cpp enabling flag <code>-DGGML_VULKAN=ON</code>. The engine started identifying the Polaris graphics card natively, jumping inference rate from 3-5 t/s to 15-16 t/s.</p></div></div><div class="phase"><div class="phase-num">03</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">Centralized Storage Migration to NVMe</span><span class="lbl lbl-y">DECISIVE MILESTONE</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Replacement of mechanical HDD with high-speed NVMe drive (1.7–3.5 GB/s). Language model memory load time dropped from 25 minutes to just 4 minutes, eliminating the lab's main I/O bottleneck.</p></div></div><div class="phase"><div class="phase-num">04</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">native stable-diffusion.cpp via Vulkan</span><span class="lbl lbl-g">GPU OBJECTIVE COMPLETED ✅</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">First image rendered locally using 100% of the RX 580 GPU on Windows. Generation cycle of the quantized weight model SD 1.5 GGUF stabilized at ~72 seconds.</p></div></div><div class="phase"><div class="phase-num">05</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">FLUX.1 Schnell Scaling via Xeon + ECC RAM</span><span class="lbl lbl-b">CAPACITY EXPANSION ✅</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Stable implementation of the 16GB SOTA model running on server processor. Empirical proof that 2014 corporate infrastructure can robustly process 2026 state-of-the-art artificial intelligence.</p></div></div>`},limit_qwen_35b:{id:"limit_qwen_35b",title:"41. LEVANDO AO LIMITE QWEN3.5 35B Q6_K NA RX 580 8GB VIA VULKAN",desc:"Experimento de execução híbrida extrema de um modelo de 34.66B de parâmetros na GPU Polaris e Xeon de 2014.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:45,tags:["qwen-35b","offloading-extremo","vram-spillover"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_srt_ptbr"],previous:"audio_srt_ptbr",next:"proving_hypothesis_35b",related:["proving_hypothesis_35b","llama"]},part:1},html:`<div class="whisper-doc">
7673  <div class="hero">
7674    <div class="hero-title"><span>Leve ao Limite</span> — Qwen3.5 35B na RX 580</div>
7675    <div class="hero-sub">Experimento de execução híbrida extrema de um modelo de <strong>34,66B parâmetros</strong> na GPU de 8GB de VRAM e Xeon de 2014 via motor Vulkan.</div>
7676    <div class="hero-badges">
7677      <span class="badge badge-gpu">AMD RX 580 8GB</span>
7678      <span class="badge badge-win">Xeon E5-2690 v3</span>
7679      <span class="badge badge-ok">Vulkan Híbrido</span>
7680      <span class="badge badge-ok">34.66B parameters</span>
7681      <span class="badge badge-win">Q6_K Quantization</span>
7682    </div>
7683  </div>
7684
7685  <div class="stat-grid">
7686    <div class="stat">
7687      <div class="stat-label">Velocidade Geração</div>
7688      <div class="stat-value">5.64 tok/s</div>
7689      <div class="stat-sub">Sessão 2 (Estável)</div>
7690    </div>
7691    <div class="stat">
7692      <div class="stat-label">Prompt Eval</div>
7693      <div class="stat-value">34.13 tok/s</div>
7694      <div class="stat-sub">Tempo resposta ~107s</div>
7695    </div>
7696    <div class="stat">
7697      <div class="stat-label">Temperatura Máxima</div>
7698      <div class="stat-value">80°C</div>
7699      <div class="stat-sub">Sem Throttling (Alvo: 90°C)</div>
7700    </div>
7701    <div class="stat">
7702      <div class="stat-label">Custo Adicional</div>
7703      <div class="stat-value">R$ 0,00</div>
7704      <div class="stat-sub">Execução 100% local</div>
7705    </div>
7706  </div>
7707
7708  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.0 — Contexto e Motivação</h3>
7709  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
7710    Em 15 de junho de 2026, o AIVisionsLab conduziou o experimento mais extremo da sua história: rodar um modelo de <strong>34,66 bilhões de parâmetros</strong> em modo híbrido numa GPU AMD Radeon RX 580 2048SP de 2017 com apenas 8GB de VRAM.
7711  </p>
7712  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
7713    "Se a RX 580 já roda Qwen3 4B a 35 tokens/s via Vulkan, até onde vai o limite?"
7714  </blockquote>
7715  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
7716    A resposta documentada abaixo prova que o limite não é onde o mercado de hardware diz que é.
7717  </p>
7718
7719  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.1 — Hardware do Laboratório</h3>
7720  <div class="tbl">
7721    <table>
7722      <thead>
7723        <tr>
7724          <th>Componente</th>
7725          <th>Especificação</th>
7726        </tr>
7727      </thead>
7728      <tbody>
7729        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 cores / 24 threads · 3,05 GHz turbo (Lançado em 2014)</td></tr>
7730        <tr><td><strong>RAM</strong></td><td>
773031,8 GB DDR4 REG ECC (quad-channel)</td></tr>
7731        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (Lançado em 2017)</td></tr>
7732        <tr><td><strong>Storage 1</strong></td><td>SSD NVMe (Disco E:) — modelos GGUF (Leitura de 1.7–3.5 GB/s)</td></tr>
7733        <tr><td><strong>Storage 2</strong></td><td>HDD (Disco C: / F:) — sistema Windows + swap</td></tr>
7734        <tr><td><strong>Storage 3</strong></td><td>HDD (Disco D:) — arquivos secundários</td></tr>
7735        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — lançado em 20/05/2026</td></tr>
7736        <tr><td><strong>DirectX</strong></td><td>12 (Feature Level 12.0)</td></tr>
7737        <tr><td><strong>Barramento</strong></td><td>PCI Express 3, dispositivo 0, função 0</td></tr>
7738        <tr><td><strong>Sistema</strong></td><td>Windows 10/11 com WSL2 ativo</td></tr>
7739      </tbody>
7740    </table>
7741  </div>
7742  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
7743    *Nota histórica: O Xeon E5-2690 v3 é de 2014. A RX 580 é de 2017. O Qwen3.5 é de 2025. Hardware de datacenter de 10 anos atrás processando IA de última geração.
7744  </p>
7745
7746  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.2 — Software e Versões</h3>
7747  <div class="tbl">
7748    <table>
7749      <thead>
7750        <tr>
7751          <th>Software</th>
7752          <th>Versão / Detalhe</th>
7753        </tr>
7754      </thead>
7755      <tbody>
7756        <tr><td><strong>llama.cpp</strong></td><td>build b9049-2496f9c14</td></tr>
7757        <tr><td><strong>Compilador</strong></td><td>MSVC 14.51.36231 (Visual Studio)</td></tr>
7758        <tr><td><strong>Vulkan SDK</strong></td><td>1.4.350.0</td></tr>
7759        <tr><td><strong>OpenWebUI</strong></td><td>v0.9.6</td></tr>
7760        <tr><td><strong>SearXNG</strong></td><td>via Docker — integrado ao OpenWebUI</td></tr>
7761        <tr><td><strong>Backend GPU</strong></td><td>Vulkan — <em>sem CUDA, sem ROCm, sem DirectML</em></td></tr>
7762        <tr><td><strong>Docker Desktop</strong></td><td>Ativo — containers open-webui + searxng</td></tr>
7763      </tbody>
7764    </table>
7765  </div>
7766
7767  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.3 — O Modelo: Qwen3.5-35B-A3B-Uncensored Q6_K</h3>
7768  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.1 — Especificações Técnicas</h4>
7769  <div class="tbl">
7770    <table>
7771      <thead>
7772        <tr>
7773          <th>Parâmetro</th>
7774          <th>Valor</th>
7775        </tr>
7776      </thead>
7777      <tbody>
7778        <tr><td><strong>Nome completo</strong></td><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K</td></tr>
7779        <tr><td><strong>Arquitetura</strong></td><td>qwen35moe — Mixture of Experts (MoE)</td></tr>
7780        <tr><td><strong>Parâmetros totais</strong></td><td>34,66 bilhões</td></tr>
7781        <tr><td><strong>Tamanho do arquivo</strong></td><td>26,55 GiB (6,58 bits por peso)</td></tr>
7782        <tr><td><strong>Quantização</strong></td><td>Q6_K — 432 tensores q6_K + 301 tensores f32</td></tr>
7783        <tr><td><strong>Experts totais</strong></td><td>256 experts</td></tr>
7784        <tr><td><strong>Experts ativos por token</strong></td><td>8 de 256 (apenas 3,1% ativados)</td></tr>
7785        <tr><td><strong>Contexto máximo de treino</strong></td><td>262.144 tokens</td></tr>
7786        <tr><td><strong>Vocabulário</strong></td><td>248.320 tokens (BPE, tokenizer qwen35)</td></tr>
7787        <tr><td><strong>Thinking mode padrão</strong></td><td>ATIVADO (<code>thinking = 1</code> no template Jinja2)</td></tr>
7788        <tr><td><strong>Intervalo de full attention</strong></td><td>A cada 4 layers</td></tr>
7789      </tbody>
7790    </table>
7791  </div>
7792
7793  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.2 — Por que MoE muda tudo</h4>
7794  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
7795    Em um modelo denso de 35B, <strong>todos</strong> os 35 bilhões de parâmetros são ativados para cada token gerado. No Qwen3.5 MoE, apenas os <strong>8 experts mais relevantes</strong> de 256 são ativados — o equivalente a ~3B parâmetros ativos por token.
7796  </p>
7797  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
7798    Isso explica por que um arquivo de 26GB consegue rodar numa máquina com 32GB de RAM: a maior parte dos pesos está na memória mas <strong>não é calculada simultaneamente</strong>.
7799  </p>
7800
7801  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.4 — Comando de Inicialização</h3>
7802  <div class="cmd">
7803# Sessão 1 (porta 8080 — erro corrigido depois)
7804.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
7804ort 8080
7805
7806# Sessão 2 (porta 8081 — correta)
7807.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --port 8081</div>
7808  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
7809    <strong>Nenhuma flag manual de camadas (<code>-ngl</code>).</strong> O llama.cpp fez todo o fitting automático.
7810  </p>
7811<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.5 — O Fitting Automático: Como o llama.cpp dividiu 26GB em 1,15 segundos</h3>
7812  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
7813    Este é o coração técnico do experimento. Sem nenhuma intervenção manual, o llama.cpp executou um algoritmo de otimização que analisou a VRAM disponível e distribuiu o modelo entre GPU e RAM de forma inteligente.
7814  </p>
7815
7816  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.1 — Situação Inicial (Impossível carregar inteiro na GPU)</h4>
7817  <div class="cmd">
7818Memória necessária na GPU (modelo completo): 32.961 MiB
7819VRAM livre disponível:                        7.366 MiB
7820Déficit:                                     26.618 MiB — impossível da GPU conter tudo</div>
7821
7822  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.2 — Sequência de Decisões do Fitting (1,15 segundos)</h4>
7823  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
7824    <strong>Passo 1 — Redução de contexto:</strong>
7825  </p>
7826  <div class="cmd">Contexto original:  262.144 tokens ➔ Contexto reduzido automaticamente: 4.096 tokens (Economia de VRAM: 5.347 MiB)</div>
7827  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
7828    <strong>Passo 2 — Mover todos os experts MoE para RAM:</strong>
7829  </p>
7830  <div class="cmd">Vulkan0 com as camadas densas residuais: 2.418 MiB (Sobra 3.924 MiB VRAM livre)
7831RAM host (experts MoE mapeados): 25.613 MiB</div>
7832  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
7833    <strong>Passo 3 — Realocar camadas densas de volta para GPU (back-to-front):</strong>
7834  </p>
7835  <div class="cmd">41 camadas densas realocadas ➔ GPU. Uso resultante: 3.048 MiB | Livre: 4.318 MiB</div>
7836  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
7837    <strong>Passo 4 — Filling front-to-back com overflow fracionado:</strong>
7838  </p>
7839  <div class="cmd">Resultado: 41 camadas (36 "overflowing") na GPU
7840Tipo de overflow: GATE (fracionado no gate layer)
7841Uso final GPU: 6.255 MiB | Livre: 1.111 MiB</div>
7842
7843  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.3 — Distribuição Final dos Pesos</h4>
7844  <div class="tbl">
7845    <table>
7846      <thead>
7847        <tr>
7848          <th>Localização do Buffer</th>
7849          <th>Conteúdo Armazenado</th>
7850          <th>Tamanho Mobilizado</th>
7851        </tr>
7852      </thead>
7853      <tbody>
7854        <tr><td><strong>Vulkan0 (RX 580 8GB)</strong></td><td>41 camadas densas + output layer</td><td><strong>5.154 MiB</strong></td></tr>
7855        <tr><td><strong>CPU_Mapped (RAM via mmap)</strong></td><td>256 experts MoE</td><td><strong>26.784 MiB</strong></td></tr>
7856      </tbody>
7857    </table>
7858  </div>
7859
7860  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.4 — Buffers Adicionais alocados na VRAM</h4>
7861  <div class="tbl">
7862    <table>
7863      <thead>
7864        <tr>
7865          <th>Buffer Tipo</th>
7866          <th>Tamanho Alocado</th>
7867          <th>Descrição Física</th>
7868        </tr>
7869      </thead>
7870      <tbody>
7871        <tr><td><strong>KV Cache (Vulkan0)</strong></td><td>80,00 MiB</td><td>4.096 cells, 10 layers</td></tr>
7872        <tr><td><strong>RS Buffer (Vulkan0)</strong></td><td>251,25 MiB</td><td>recorrente: 40 layers, 4 seqs</td></tr>
7873        <tr><td><strong>Compute Buffer (Vulkan0)</strong></td><td>770,02 MiB</td><td>Ativado durante grafos de computação</td></tr>
7874        <tr><td><strong>Host Compute Buffer</strong></td><td>16,02 MiB</td><td>RAM do sistema</td></tr>
7875        <tr><td><strong>Output Buffer (Vulkan_Host)</strong></td><td>3,79 MiB</td><td>Buffer de saída de tokens</td></tr>
7876      </tbody>
7877    </table>
7878  </div>
7879  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
7880    <strong>Total efetivo na VRAM durante inferência: ~6,2–7,2 GB</strong> (77–90% dos 8GB físicos livres).
7881  </p>
7882
7883  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.5 — Features habilitadas automaticamente</h4>
7884  <div class="cmd">
7885✅ Flash Attention (auto ➔ ENABLED)
7886✅ Fused Gated Delta Net — autoregressive
7887✅ Fused Gated Delta Net — chunked
7888✅ Prompt cache (limite: 8.192 MiB, ~89.715 MiB salvos em disco)
7889✅ Thinking mode (thinking = 1)
7890✅ 4 slots paralelos (n_seq_max = 4)
7891
7892Graph nodes: 3.729 | Graph splits: 106 (com bs=512), 74 (com bs=1)
7893Reserve: 137–183 ms</div>
7894
7895  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.6 — A Arquitetura de 4 Níveis de Memória</h3>
7896  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
7897    Primeiro registro documentado de um modelo 35B usando <strong>4 camadas de memória simultaneamente</strong> para processamento numa RX 580 comum:
7898  </p>
7899  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.8rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
7900    <div>⚡ <strong style="color:#ff9e64">
7900NÍVEL 1 — VRAM RX 580 (8GB GDDR5):</strong> 5.154 MiB de camadas densas | Acesso: ~400 GB/s (GDDR5) | Latência: nanosegundos</div>
7901    <div style="margin-top:0.5rem">🧠 <strong style="color:#7aa2f7">NÍVEL 2 — RAM DDR4 ECC (32GB Sytem):</strong> 26.784 MiB de experts MoE via mmap | Acesso: ~51 GB/s (quad-channel) | Latência: dezenas de ns</div>
7902    <div style="margin-top:0.5rem">💾 <strong style="color:#22c55e">NÍVEL 3 — SSD NVMe (Disco E:):</strong> 26,55 GiB de arquivo .gguf fonte | Acesso: 1,7–3,5 GB/s | Usado durante carregamento inicial</div>
7903    <div style="margin-top:0.5rem">📁 <strong style="color:#e0af68">NÍVEL 4 — HDD (Disco C: Swap):</strong> Swap do Windows ativado quando a RAM esgota (>97% de uso) | Acesso: ~120–180 MB/s | Pico de 98–100% de uso na inferência</div>
7904  </div>
7905
7906  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.7 — Configuração do Contexto Carregado</h3>
7907  <div class="cmd">
7908n_ctx         = 4.096 tokens (reduzido de 262.144 pelo fitting)
7909n_batch       = 2.048
7910n_ubatch      = 512
7911n_seq_max     = 4 (slots paralelos)
7912flash_attn    = auto ➔ ENABLED
7913kv_unified    = true</div>
7914  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
7915    <strong>Limitação crítica documentada:</strong> O contexto de 4.096 tokens é o principal gargalo do setup. O thinking mode (modo raciocínio) do Qwen3.5 consome 3.000+ tokens sozinho antes de gerar qualquer resposta visível — deixando menos de 1.000 tokens livres para a resposta final ao cliente.
7916  </p>
7917
7918  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.8 — Benchmark Confirmado em Duas Sessões</h3>
7919  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Velocidade de geração</h4>
7920  <div class="tbl">
7921    <table>
7922      <thead>
7923        <tr>
7924          <th>Sessão</th>
7925          <th>Horário aproximado</th>
7926          <th>Prompt Eval Speed</th>
7927          <th>Geração Speed</th>
7928          <th>Total Tokens</th>
7929          <th>Tempo Total</th>
7930        </tr>
7931      </thead>
7932      <tbody>
7933        <tr><td><strong>Sessão 1</strong></td><td>~17h39</td><td><strong>34,13 tok/s</strong></td><td><strong>5,57 tok/s</strong></td><td>1.377 tok</td><td>~107 segundos</td></tr>
7934        <tr><td><strong>Sessão 2</strong></td><td>~21h34</td><td>~40.00 tok/s</td><td><strong>5,64 tok/s</strong></td><td>2.929 tok</td><td>~533 segundos</td></tr>
7935      </tbody>
7936    </table>
7937  </div>
7938  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
7939    <strong>Consistência notável:</strong> Manutenção na linha de ~5,6 tokens/segundo de geração independente da sessão estar sobrecarregada ou fria.
7940  </p>
7941<h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Registro de temperaturas registradas</h4>
7942  <div class="tbl">
7943    <table>
7944      <thead>
7945        <tr>
7946          <th>Momento do Teste</th>
7947          <th>GPU Temp (°C)</th>
7948        </tr>
7949      </thead>
7950      <tbody>
7951        <tr><td>Idle (modelo estacionado na VRAM)</td><td>33–41°C</td></tr>
7952        <tr><td>Inferência normal (sem Web Search ativo)</td><td>44–64°C</td></tr>
7953        <tr><td>Inferência carregada (com Web Search ativo)</td><td>70–75°C</td></tr>
7954        <tr><td><strong>Pico absoluto registrado</strong></td><td><strong>80°C</strong></td></tr>
7955        <tr><td>Após conclusão de resposta</td><td>71–73°C</td></tr>
7956      </tbody>
7957    </table>
7958  </div>
7959  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
7960    <strong>Temperatura de thermal throttling da RX 580:</strong> ~90°C. <strong>Margem de segurança operacional perfeitamente mantida!</strong>
7961  </p>
7962
7963  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Utilização de recursos na inferência física</h4>
7964  <div class="tbl">
7965    <table>
7966      <thead>
7967        <tr>
7968          <th>Recurso de Hardware</th>
7969          <th>Idle</th>
7970          <th>Durante Inferência</th>
7971          <th>Pico Registrado</th>
7972        </tr>
7973      </thead>
7974      <tbody>
7975        <tr><td>VRAM dedicada</td><td>6,7 / 8,0 GB</td><td>6,8 – 7,2 / 8,0 GB</td><td>7,4 GB / 8,0 GB</td></tr>
7976        <tr><td>RAM do Sistema</td><td>~29,0 GB</td><td>30,7 – 31,1 GB</td><td>31,2 / 31,8 GB (98% utiliz.)</td></tr>
7977        <tr><td>CPU Xeon v3</td><td>3%</td><td>62 – 70%</td><td>70%</td></tr>
7978        <tr><td>GPU utilização 3D</td><td>0%</td><td>1 – 3%</td><td>3% (Carga no barramento PCIe)</td></tr>
7979        <tr><td>
7979HDD C: (Atividade swap)</td><td>0%</td><td>13 – 42%</td><td>98 – 100% (Limiar swap)</td></tr>
7980      </tbody>
7981    </table>
7982  </div>
7983
7984  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.9 — Os 5 Testes: Histórico Completo de Engenharia</h3>
7985  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
7986    <strong>Pergunta de entrada enviada em todos os testes:</strong><br>
7987    "Explique detalhadamente como funciona o mecanismo de atenção em transformers e por que o MoE é mais eficiente que modelos densos. Responda em português."
7988  </blockquote>
7989
7990  <div style="display:flex;flex-direction:column;gap:1rem;margin-bottom:1.5rem">
7991    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
7992      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 1 — Sessão 1 · Raciocínio ON + Web Search ON + Geração Imagem ON</h5>
7993      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
7994        <strong>Resultado:</strong> ❌ Erro de protocolo (reposta não entregue) | <strong>Log do erro:</strong> <code>operator (): got exception: {"error":"code":400,"message":"Assistant response prefill is incompatible with enable_thinking."}</code>
7995      </p>
7996      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
7997        <strong>Análise:</strong> O modelo processou um pensamento por ~1 minuto recuperando 10 fontes do SearXNG, mas o OpenWebUI injetou um prefill incorreto incompatível com a flag de pensamento do Jinja2, forçando o cancelamento.
7998      </p>
7999    </div>
8000
8001    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
8002      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 2 — Sessão 2 · Raciocínio ON + Web Search ON (30 pesquisas consecutivas)</h5>
8003      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
8004        <strong>Resultado:</strong> ❌ Contexto esgotado | <strong>Log do erro:</strong> <code>stop processing: n_tokens = 3285, truncated = 1</code>
8005      </p>
8006      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
8007        <strong>Análise:</strong> As 30 pesquisas do SearXNG injetaram milhares de tokens de contexto na memória. O thinking mode tentou alocar seu próprio buffer e estourou os 4.096 limitantes do setup híbrido, forçando corte prematuro.
8008      </p>
8009    </div>
8010
8011    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
8012      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 3 — Sessão 2 · Raciocínio ON + Web Search ON (25 pesquisas, nova rodada acumulada)</h5>
8013      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
8014        <strong>Resultado:</strong> ❌ Contexto esgotado | <strong>Log do erro:</strong> <code>stop processing: n_tokens = 4095, truncated = 1</code>
8015      </p>
8016      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
8017        <strong>Análise:</strong> O OpenWebUI tentou reenviar acumulando o histórico de conversação anterior. O prompt cresceu tanto que atingiu o teto exato delimitado de hardware de 4.095 tokens no Fitting.
8018      </p>
8019    </div>
8020
8021    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
8022      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 4 — Sessão 2 · Raciocínio ON + Web Search OFF</h5>
8023      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
8024        <strong>Resultado:</strong> ❌ Timeout do Cliente | <strong>Log do erro:</strong> <code>stop: cancel task, id_task = 6887 (truncated = 0)</code>
8025      </p>
8026      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
8027        <strong>Análise:</strong> Sem web-search o consumo térmico despencou para estáveis 51°C e uso de swap caiu. Mas o processamento de raciocínio interno demorou tempo suficiente na CPU Xeon de 2014 para que a UI disparasse seu timeout de segurança de chamadas.
8028      </p>
8029    </div>
8030
8031    <div style="border:1px solid rgba(34, 197, 94, 0.2);background:rgba(0, 3, 1, 0.6);border-radius:6px;padding:1rem">
8032      <h5 style="color:#22c55e;font-weight:bold;font-size:0.85rem">✅ TESTE 5 — Sessão 2 · Raciocínio ON + Web Search OFF + Prompt Curto (45 tokens)</h5>
8033      <p style="font-size:0.8rem;color:#c2ffd2;line-height:1.6;margin-top:0.25rem">
8034        <strong>Resultado:</strong> SUCESSO ABSOLUTO ✅ | Resposta técnica profunda entregue integralmente em português brasileiro estruturado.
8035      </p>
8036      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
8037        <strong>Análise:</strong> Ao restringir o prompt inicial para 45 tokens e desativar barulhos complementares, o pensamento pôde rodar por 4 minutos completos sob o Xeon, realizando rascunho de equações e respondendo impecavelmente sobre Transformers (Softmax, Multiheads) e as eficiências do MoE.
8038      </p>
8039    </div>
8040  </div>
8041
8042  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.10 — Tabela Comparativa de Comportamento dos Testes</h3>
8043  <div class="tbl">
8044    <table>
8045      <thead>
8046        <tr>
8047          <th>ID</th>
8048          <th>Thinking</th>
8049          <th>Web Search</th>
8050          <th>Promo Token</th>
8051          <th>Status</th>
8052          <th>Causa Raiz Real da Falha</th>
8053        </tr>
8054      </thead>
8055      <tbody>
8056        <tr><td>1</td><td>ON</td><td>ON (10 fontes)</td><td>~936 tok</td><td>❌ Falha</td><td>Prefill de resposta incompatível with thinking=1</td></tr>
8057        <tr><td>2</td><td>ON</td><td>ON (30 pesq.)</td><td>~357 tok</td><td>❌ Falha</td><td>Esgotamento de contexto do Fitting (4.095 max)</td></tr>
8058        <tr><td>3</td><td>ON</td><td>ON (25 pesq.)</td><td>~3.385 tok</td><td>❌ Falha</td><td>Esgotamento de contexto imediato no reenvio</td></tr>
8059        <tr><td>4</td><td>ON</td><td>OFF</td><td>~350 tok</td><td>❌ Falha</td><td>Timeout nas requisições da OpenWebUI antes do output</td></tr>
8060        <tr style="background:rgba(34, 197, 94, 0.05)"><td><strong>5</strong></td><td><strong>ON</strong></td><td><strong>OFF</strong></td><td><strong>45 tok</strong></td><td><strong>✅ SUCESSO</strong></td><td><strong>Prompt enxuto coube integralmente na arquitetura de mmap</strong></td></tr>
8061      </tbody>
8062    </table>
8063  </div>
8064<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
8065    <strong>Conclusão Crítica:</strong> A RX 580 do laboratório de 2017 e o Xeon funcionaram estavelmente sem dar nenhum reset físico em todas as situações de stress. As falhas residiram estritamente na calibração lógica do software de front-end.
8066  </p>
8067
8068  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.11 — Coletas de Descobertas e Limitações Cruciais</h3>
8069  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
8070    <li><strong style="color:#fff">Incompatibilidade do Thinking com Contexto Curto:</strong> Por design de modelo, o pensamento consome cerca de 3.000 tokens e estoura rapidamente o KV Cache alocado de 4.096 se o prompt ou histórico for longo.</li>
8071    <li><strong style="color:#fff">O Fitting Automático do llama.cpp é Excepcional:</strong> Forçar o split por flags experimentais rígidas como <code>--override-tensor</code> prejudica as chamadas no Vulkan. O fitting por cálculo de grafos resolveu milimetricamente a distribuição de forma otimizada.</li>
8072    <li><strong style="color:#fff">Superaquecimento da GPU mitigado:</strong> Apenas a renderização profunda com dezenas de filtros simultâneos elevou a 80°C. Limitar a GPU para inferir frações densas mantém o chip a confortáveis 44-64°C.</li>
8073    <li><strong style="color:#fff font-weight:bold">O gargalo reside na taxa de I/O de Swap do HDD:</strong> Quando RAM estoura a 98%, a taxa cai para 5 tok/s devido ao HDD. Migrar o swap do host inteiro para unidades de estado sólido aumentará consideravelmente a velocidade de fluxo comb
8073inada.</li>
8074  </ul>
8075
8076  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.12 — Comparação Direta com Projetos de Comunidade</h3>
8077  <div class="tbl">
8078    <table>
8079      <thead>
8080        <tr>
8081          <th>Projeto / Autor</th>
8082          <th>Arquitetura Utilizada</th>
8083          <th>Modelo Testado</th>
8084          <th>Velocidade Geração</th>
8085          <th>Status de Autoria</th>
8086        </tr>
8087      </thead>
8088      <tbody>
8089        <tr><td><strong>Matheus Fertunani</strong></td><td>Linux Comercial / CPU Xeon pura (192GB RAM)</td><td>Qwen3.5 35B Q8</td><td>~7–8 tokens/s</td><td>Documentado no YouTube</td></tr>
8090        <tr><td><strong>AIVisionsLab (Nossos testes)</strong></td><td>Vulkan Híbrido (RX 580 8GB + 32GB RAM ECC)</td><td>Qwen3.5 35B Q6_K</td><td><strong>5,64 tokens/s</strong></td><td>✅ Validado e Registrado</td></tr>
8091      </tbody>
8092    </table>
8093  </div>
8094  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
8095    <strong>A grande vantagem arquitetural:</strong> O teste de CPU pura de Matheus exige hardwares profissionais de alto custo com mais de 100GB de RAM instalada. O ecossistema de Vulkan do AIVisionsLab provou-se operável em uma GPU de menos de R$ 400 em mercado secundário!
8096  </p>
8097
8098  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.13 — Configurações Recomendadas para Testes Futuros</h3>
8099  <div class="cmd">
8100# Teste 6 — Desativação explícita de thinking via servidor em versões de compilação recentes:
8101.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
8101ort 8081 --no-thinking
8102
8103# Teste 7 — Elevação estrita de buffers de contexto se a memória for redirecionada:
8104.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-...-Q6_K.gguf" --host 0.0.0.0 --port 8081 --ctx-size 8192
8105
8106# Teste 8 — Testar com quantizações menores como Q4_K_M (~21GB):
8107# Liberação de ~5GB adicionais na RAM host que reduz a dependência de swap no HDD e melhora consideravelmente a taxa de tok/s!</div>
8108
8109  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.14 — Lições Técnicas Consolidadas</h3>
8110  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
8111    <li><strong style="color:#fff">O silício de 2017 não é o limite:</strong> A placa de vídeo nunca crashou nos testes contínuos de estresse térmico, dezenas de vezes. O gargalo se provou uma mera calibração lógica de software.</li>
8112    <li><strong style="color:#fff">As esparsidades do MoE salvam a categoria:</strong> Sem MoE, seria impensável arrastar um modelo de 26GB de pesos ativos. O MoE faz com que apenas 3.1% dos neurônios fiquem de fato excitados por token.</li>
8113  </ul>
8114
8115  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.15 — Veredicto Geral do Laboratório</h3>
8116  <div class="tbl">
8117    <table>
8118      <thead>
8119        <tr>
8120          <th>Questão de Engenharia</th>
8121          <th>Veredicto Final</th>
8122        </tr>
8123      </thead>
8124      <tbody>
8125        <tr><td><strong>A RX 580 de 8GB suporta modelos de 35B parâmetros?</strong></td><td>✅ <strong>Sim</strong> (Em barramento híbrido mmap)</td></tr>
8126        <tr><td><strong>É prático para o dia a dia?</strong></td><td>⚠️ <strong>Não</strong> (5,6 tok/s e contexto de 4.096 tokens)</td></tr>
8127        <tr><td><strong>Vale como prova de conceito?</strong></td><td>✅ <strong>Absolutamente</strong></td></tr>
8128        <tr><td><strong>Houve throttling ou crash?</strong></td><td>✅ <strong>Zero ocorrências de instabilidade</strong></td></tr>
8129        <tr><td><strong>Temperatura máxima registrada</strong></td><td><strong>80°C</strong> (margem de segurança: ~90°C)</td></tr>
8130        <tr><td><strong>Velocidade de geração</strong></td><td><strong>~5,6 tokens/segundo</strong></td></tr>
8131        <tr><td><strong>Memória total mobilizada</strong></td><td><strong>~34 GB</strong> (VRAM + RAM + swap HDD)</td></tr>
8132      </tbody>
8133    </table>
8134  </div>
8135
8136  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.16 — Linha do Tempo do Experimento</h3>
8137  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
8138    <div>🕒 <strong>~17:39</strong> — Servidor sobe na porta 8080 (erro)</div>
8139    <div>🕒 <strong>~17:40</strong> — "Network Problem" no OpenWebUI (porta errada)</div>
8140    <div>🕒 <strong>~17:41</strong> — Servidor fechou ao trocar porta → reiniciado na 8081</div>
8141    <div>🕒 <strong>~17:42</strong> — Todas as ferramentas habilitadas no modelo (imagem, web, terminal)</div>
8142    <div>🕒 <strong>~17:43</strong> — <strong>TESTE 1</strong> inicia</div>
8143    <div>🕒 <strong>~17:44</strong> — Web search: 10 fontes recuperadas</div>
8144    <div>🕒 <strong>~17:44</strong> — Tentativa de gerar imagem → erro tratado → continua</div>
8145    <div>🕒 <strong>~17:45</strong> — "Pensado por um minuto" aparece no OpenWebUI</div>
8146    <div>🕒 <strong>~17:46</strong> — Resposta estruturada com título gerado internamente</div>
8147    <div>🕒 <strong>~17:50</strong> — Erro de protocolo (prefill + thinking) → sem entrega. Pico: 80°C</div>
8148    <div>🕒 <strong>~21:34</strong> — Sessão 2 inicia</div>
8149    <div>🕒 <strong>~21:34</strong> — <strong>TESTE 2</strong> inicia — web search ON (30 pesquisas). Contexto truncado.</div>
8150    <div>🕒 <strong>~21:48</strong>
8150 — <strong>TESTE 3</strong> automático — 25 pesquisas. Contexto truncado.</div>
8151    <div>🕒 <strong>~22:00</strong> — <strong>TESTE 4</strong> — web search OFF. Temperatura cai para 51°C. Timeout da UI.</div>
8152    <div>🕒 <strong>~23:06</strong> — <strong>TESTE 5</strong> — prompt de 45 tokens. Thinking decodificado com sucesso.</div>
8153    <div>🕒 <strong>~23:14</strong> — Resposta completa entregue em português ✅. GPU: 64°C | RAM: 96%</div>
8154  </div>
8155
8156  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.17 — Impacto para a Documentação do AIVisionsLab</h3>
8157<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
8158    Este experimento adiciona ao projeto: um novo benchmark robusto de 5,6 tok/s para modelos 35B MoE híbridos, a confirmação de que o fitting automático do llama.cpp supera configurações manuais rígidas via Vulkan, a identificação clara de incompatibilidade do modo thinking com contextos inferiores a 8.192 e a descrição de uma arquitetura estendida a 4 níveis de memória.
8159  </p>
8160
8161  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.18 — Tags e Metadados</h3>
8162  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
8163    <div>🏷️ <strong>Tags:</strong> hybrid, moe, vulkan, rx580, large-model, thinking-mode, limits, qwen35b, benchmark, fitting-automático, 4-memory-levels, sem-throttling</div>
8164    <div style="margin-top:0.5rem">💻 <strong>Hardware:</strong> RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
8165    <div style="margin-top:0.25rem">💿 <strong>Software:</strong> llama.cpp b9049 + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
8166    <div style="margin-top:0.25rem">📅 <strong>Data:</strong> 15/06/2026</div>
8167    <div style="margin-top:0.25rem">⏱️ <strong>Sessões:</strong> 2 (17h39–18h24 e 21h34–23h14)</div>
8168    <div style="margin-top:0.25rem">📊 <strong>Testes:</strong> 5 (4 falhas de software, 1 sucesso de inferência completa)</div>
8169    <div style="margin-top:0.25rem">📈 <strong>Benchmark:</strong> 5,57–5,64 tok/s (geração) | 34,13 tok/s (prompt eval)</div>
8170    <div style="margin-top:0.25rem">🔥 <strong>Temperatura pico:</strong> 80°C</div>
8171    <div style="margin-top:0.25rem">🏆 <strong>Status final:</strong> ✅ HARDWARE APROVADO</div>
8172  </div>
8173
8174  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
8175    "O problema nunca foi o hardware.<br>
8176    Foi a combinação de thinking + web search esgotando os 4.096 tokens de contexto.<br>
8177    Com prompt curto e sem web search, o Qwen3.5-35B Q6_K responde normalmente numa RX 580 de 2017."<br>
8178    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 15/06/2026</span>
8179  </blockquote>
8180
8181  <div class="footer">
8182    Documentação gerada por Claude Sonnet 4.6 — 15/06/2026 · Baseada em logs reais, screenshots, benchmarks e observações em tempo real · Sessão 1: ~17h39–18h24 | Sessão 2: ~21h34–23h14 · 5 testes documentados · 1 bem-sucedido · Hardware de 2017 processando IA de 2025
8183  </div>
8184</div>`},linhatempo:{id:"linhatempo",title:"37. LINHA DO TEMPO COLETIVA — A EVOLUÇÃO DO RX 580 COMO PLATAFORMA DE IA",desc:"Unified historical and comparative analysis documenting the breaking of barriers and obsolescence of the RX 580 in three revolutionary stages (2025-2026).",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:25,tags:["evolucion-historica","rx580-timeline","comunidade-hacker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["meta"],previous:"meta",next:"audio_rvc",related:["jornada","comunidade"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">The technical rescue and rise of the AMD Radeon RX 580 as a practical artificial intelligence platform is not the fruit of a single mind, but of an <strong>ascending collective evolution</strong>. Three independent projects, built on the common mathematical base of the <code>ggml</code> ecosystem, paved this journey:</p><div style="position:relative;margin:2rem 0;padding-left:1.5rem;border-left:2px solid var(--b)"><div style="margin-bottom:1.5rem;position:relative"><div style="position:absolute;
8184left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:var(--r);border:2px solid #07080a"></div><span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:var(--r);font-weight:bold">JANUARY 2025</span><h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">Amihart Method (Debian Linux)</h5><p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">First documented milestone. Validated Vulkan-accelerated LLMs in <code>llama.cpp</code> achieving 24.56 t/s. However, declared: <em>"Vulkan doesn't work for Stable Diffusion"</em>, due to software limitations at the time, resorting to ROCm via Docker.</p></div><div style="margin-bottom:1.5rem;position:relative"><div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#eab308;border:2px solid #07080a"></div><span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#eab308;font-weight:bold">DECEMBER 2025</span><h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">DadHacks Method (Linux/Debian)</h5><p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Empirically refuted the impossibility of Stable Diffusion via Vulkan. Used the newly launched <code>stable-diffusion.cpp</code> engine with compiler flag <code>-DSD_VULKAN=ON</code> to run Flux Schnell GGUF generation with CPU/GPU segmentation.</p></div><div style="position:relative"><div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#22c55e;border:2px solid #07080a"></div><span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#22c55e;font-weight:bold">2026 SEASON</span><h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">AIVisionsLab (Native Windows + WSL2)</h5><p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Production ecosystem unification. Developed native <code>.bat</code> automation, integrated local Vulkan rendering to user-friendly panels (OpenWebUI via Docker), documented CPU Xeon fallbacks for SOTA models and exhaustively mapped DirectML/ROCm failure reasons on Windows.</p></div></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:2rem 0 .75rem 0;text-transform:uppercase">A. The Question Each Project Answered</h4><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">The evolution of RX 580's technical maturity can be translated by the premises answered by the authors:</p><ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem"><li><strong style="color:#fff">Amihart (Jan 2025):</strong> <em>"Is it possible to run LLMs fast on RX 580 without official ROCm?"</em> <strong style="color:var(--r)">Yes</strong>, compiling llama.cpp with pure Vulkan API.</li><li><strong style="color:#fff">DadHacks (Dec 2025):</strong> <em>"Is it possible to generate AI images accelerated by Vulkan on RX 580?"</em> <strong style="color:var(--r)">Yes</strong>, compiling stable-diffusion.cpp and using the stable alternative GGUF format.</li><li><strong style="color:#fff">AIVisionsLab (2026):</strong> <em>"Is it possible to put all this infrastructure into integrated and friendly production on Windows?"</em> <strong style="color:var(--r)">Yes</strong>, building Docker container network bridges, unified automations and intelligent CPU fallbacks for VRAM excess.</li></ul><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. Unified Master Comparative Table</h4><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">Crossed structural mapping of cumulative capabilities and achievements:</p><div class="tbl" style="margin-bottom:1.5rem"><table><thead><tr><th>Capability</th><th>Amihart (2025)</th><th>DadHacks (2025)</th><th>AIVisionsLab (2026)</th></tr></thead><tbody><tr><td><strong>Base System</strong></td><td>Debian Linux</td><td>Linux Debian</td><td>Windows 10 Pro + WSL2 Linux</td></tr><tr><td><strong>LLM Engine</strong></td><td>✅ Vulkan (24.56 t/s)</td><td>✅ Vulkan (llama.cpp)</td><td>✅ Vulkan (15-16 t/s)</td></tr><tr><td><strong>SD Engine</strong></td><td>❌ Not viable in Vulkan</td><td>✅ Pure Vulkan</td><td>✅ Pure Vulkan (~72s SD1.5)</td></tr><tr><td><strong>Flux GGUF</strong></td><td>❌ Non-existent</td><td>✅ Command line</td><td>✅ Stable GPU/CPU Hybrid</td></tr><tr><td><strong>Graphical Interface</strong></td><td>❌ Console only / Docker WebUI</td><td>❌ CLI only</td><td>✅ OpenWebUI + integrated API</td></tr><tr><td><strong>Automation</strong></td><td>❌ Not developed</td><td>❌ Not developed</td><td>✅ Double-click .bat scripts</td></tr><tr><td><strong>VRAM Stability</strong></td><td>❌ Physical ROCm limitation</td><td>⚠️ Manual CLI</td><td>✅ Integrated VAE Tiling</td></tr><tr><td><strong>Models &gt; 8GB</strong></td><td>❌ Chronic OOM</td><td>⚠️ Basic CPU offload</td><td>✅ Quad-Channel REG ECC fallbacks</td></tr><tr><td><strong>Video Animation</strong></td><td>❌ Not addressed</td><td>❌ Not addressed</td><td>✅ AnimateDiff WSL2 CPU Xeon</td></tr><tr><td><strong>GGUF Detection</strong></td><td>❌ Not addressed</td><td>❌ Not addressed</td><td>✅ leejet vs city96 mapping</td></tr></tbody></table></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">C. The Common Technical Denominator — GGML Engine</h4><p style="font-size:.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">The central compression and execution technology that enabled legacy GPU utilization was the ecosystem developed by Georgi Gerganov (<strong>ggml / llama.cpp / stable-diffusion.cpp</strong>). By porting tensor operations directly to C/C++ language and exposing native hooks to the open <strong>Vulkan API</strong> graphics library, this implementation allows cards without modern proprietary driver packages to perform native massive calculations (bypassing restrictive vendor drivers).</p><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">D. Convergent Philosophy</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Direct manifestations that eternalize the free purpose of these researchers:</p><blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem"><strong>Amihart:</strong> "Despite how old this GPU is, it's technically possible to use it for AI if we adapt the execution flow... low-level optimization is the key to legacy hardware reuse."</blockquote><blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem"><strong>DadHacks:</strong>
8184 "This setup provides a viable bridge for technical utilization of existing hardware investments without requiring expensive upgrades or dependence on bloated software packages."</blockquote><blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem"><strong>AIVisionsLab:</strong> "Degradation by obsolescence of drivers and closed ecosystems is a commercial factor and not a material limitation of the card. Legacy hardware maintains its operational utility through open software support."</blockquote><div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem"><strong style="color:var(--r)">Co-authorship Credit and Reference:</strong> Technical timeline dedicated to the cumulative experimental effort of <strong>艾米心 (Amihart)</strong>, <strong>DH (DadHacks)</strong>, <strong>leejet</strong>, <strong>ggerganov</strong>, <strong>woodrex</strong>
8184 and all independent developers focused on digital reuse and hardware preservation.</div>`},linux_nativo:{id:"linux_nativo",title:"43. LINUX NATIVO — Ubuntu 26.04 LTS + RX 580 + Vulkan",desc:"AIVisionsLab — Complete Stack Documentation on Real Linux",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"sistema-operacional",difficulty:"advanced",estimated_time_min:40,tags:["ubuntu-native","linux-vulkan","low-level-compilation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_whisper"],previous:"audio_whisper",next:"audio_srt_ptbr",related:["comfyui-wsl","amihart"]},part:1},html:`<div class="card bg-red-950/20 border border-red-500/30 p-5 rounded-md my-6"><h4 style="color:#ef4444;font-weight:800;font-size:0.95rem;margin-bottom:0.6rem;display:flex;items-center;gap:0.4rem">🚨 INCIDENT REPORT (16/06/2026): THE GREAT SPACE DISASTER AND THE FALL OF GNOME</h4><p style="font-size:0.82rem;color:#fca5a5;line-height:1.75;margin-bottom:0.75rem"><strong>Critical Status:</strong> During tests of extreme pipelines and massive downloads of heavy GGUF models on the dedicated 97GB partition, physical space was completely exhausted (0 bytes free in swap/root). In a quick attempt to clear cache and force clean via terminal, critical dependencies of the graphical environment were corrupted.</p><ul style="padding-left:1.2rem;font-size:.8rem;color:#fbcfe8;line-height:1.8;margin-bottom:1rem"><li><strong>Symptom:</strong> The <strong>GNOME</strong> Window Manager broke completely, resulting in login loops and a black terminal screen without loading the video interface.</li><li><strong>Recovery Action:</strong> Physical formatting and immediate clean reinstall of the Bare-Metal Linux system from scratch for clean reconstruction and proper partition resizing.</li><li><strong>The Existential Verdict:</strong> <em>"I definitely need to learn Linux!"</em> — AIVisionsLab's journey proves that mastering the terminal and space allocation under LVM is just as crucial as knowing the Vulkan backend shaders.</li></ul></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Detailed and homologated documentation of direct execution on native Linux. No WSL2, no container emulation or Docker Passthrough: real bare-metal access via open-source <strong>Mesa RADV</strong> drivers over the brand new <strong>Ubuntu 26.04 LTS (Resolute Raccoon)</strong> running Linux kernel 7.0.</p><div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:.85rem;margin-bottom:1.25rem"><div class="stat"><div class="stat-icon">🐧</div><div><div class="stat-lbl">Linux Platform</div><div class="stat-val" style="font-size:.82rem">Ubuntu 26.04 LTS</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Kernel 7.0 (Resolute)</div></div></div><div class="stat"><div class="stat-icon">🎛️</div><div><div class="stat-lbl">Vulkan Driver</div><div class="stat-val" style="font-size:.82rem">Mesa RADV 26.0.3</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Vulkan Core version 1.4.341</div></div></div><div class="stat"><div class="stat-icon">💽</div><div><div class="stat-lbl">Partitioning</div><div class="stat-val" style="font-size:.82rem">Ext4 dedicated 97GB</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">HDD sdb6 Dual Boot</div></div></div><div class="stat"><div class="stat-icon">📦</div><div><div class="stat-lbl">Docker Runtime</div><div class="stat-val" style="font-size:.82rem">Native Linux Engine</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">OpenWebUI bridges at 100%</div></div></div></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Brute Comparative Table: Windows 10 vs Native Linux</h3><div class="tbl"><table><thead><tr><th>Scenario / Workload</th><th>Windows 10 (Official AMD)</th><th>Linux Ubuntu 26.04 (Mesa RADV)</th><th>Crucial Winner</th></tr></thead><tbody><tr><td><strong>LLM (Qwen3 4B GGUF) @ 99 layers</strong></td><td>~15-17 tokens/s</td><td><strong>~35 tokens/s (RADV engine)</strong></td><td>🏆 <strong>Linux (2x faster)</strong></td></tr><tr><td><strong>Large LLM (Qwen3.6 35B) @ Max layers</strong></td><td><strong>7.62 tokens/s (max 10 layers)</strong></td><td>
81845.18 tokens/s (max 20 layers)</td><td>⚖️ <strong>Technical Tie</strong> (Linux allows 2x more layers, Windows is faster per layer)</td></tr><tr><td><strong>Stable Diffusion (Dreamshaper8 - 50st)</strong></td><td><strong>~72 seconds (1.44s/it)</strong></td><td>~85 seconds (1.65s/it)</td><td>🏆 <strong>Windows (stable by driver)</strong></td></tr><tr><td><strong>Flux Schnell (4 steps, 512x512)</strong></td><td>~84 seconds (OOM if 1024x1024)</td><td><strong>~52 seconds sampling (Total: 95s)</strong></td><td>🏆 <strong>Linux (better VRAM swap)</strong></td></tr><tr><td><strong>whisper.cpp (large-v3-turbo, 106s audio)</strong></td><td>307 s (VRAM Usage: 2.6 GB)</td><td><strong>23.58 s (VRAM Usage: 1.6 GB)</strong></td><td>🏆 <strong>Linux (Absurdly superior)</strong></td></tr></tbody></table></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Installation and Dual-Boot Without Overwriting Records</h3><p style="font-size:.82rem;color:#94a3b8;line-height:1.75">1. In Windows, free up space using Disk Management (Shrink Volume).<br>2. Prepare the pendrive with the <strong>Ubuntu 26.04 amd64</strong> desktop ISO.<br>3. In the Ubuntu installer, select the "Install alongside Windows Boot Manager" option. The installer will create the partition and configure the GRUB menu to allow boot selection at each restart automatically.</p><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Post-Installation: Bare-Metal Polaris GPU Validation</h3><div class="code"><span class="code-lang">bash</span><pre>lspci | grep -i vga
8185# AMD Radeon RX 580 2048SP detected!
8186
8187vulkaninfo --summary 2>/dev/null | grep -A5 "Devices"
8188# Should show: GPU0: DRIVER_ID_MESA_RADV | driverInfo = Mesa 26.0.3 ✅</pre></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Homologated Execution Command Stack on Ubuntu</h3><h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">1. Initializing llama-server via Vulkan</h4><div class="code"><span class="code-lang">bash</span><pre>~/llama.cpp/build/bin/llama-server \\
8189  -m "/run/media/aivisions-lab-studio/NVMe/models/qwen3/Qwen3-4B-Q4_K_M.gguf" \\
8190  --host 0.0.0.0 --port 8081 \\
8191  -ngl 99 -t 24</pre></div><h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">2. Image Generation (Flux Schnell) — Secrets Against GNOME Crashing</h4><div class="code"><span class="code-lang">bash</span><pre>~/stable-diffusion.cpp/build/bin/sd-server \\
8192  --listen-ip 0.0.0.0 --listen-port 7860 \\
8193  --diffusion-model /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/flux1-schnell-q4_k.gguf \\
8194  --vae /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/ae.safetensors \\
8195  --clip_l /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/clip_l.safetensors \\
8196  --t5xxl /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/t5xxl_fp16.safetensors \\
8197  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre></div><p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-top:.35rem">💡 <strong>Critical Flags:</strong> The <code>--vae-tiling</code> parameter is strictly mandatory. Without it, VAE decoding exceeds the physical memory limit and crashes the GNOME graphical environment. Avoid using <code>--backend vulkan0</code> for this heavy model on Linux, as it generates lost context bugs.</p><h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">3. Fast Audio Transcription via whisper.cpp</h4><div class="code"><span class="code-lang">bash</span><pre>~/whisper.cpp/build/bin/whisper-cli \\
8198  -m ~/whisper.cpp/models/ggml-large-v3-turbo.bin \\
8199  -f "/path/to/audio.wav" \\
8200  -l pt --output-txt</pre></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Parallel Running Docker Services and Containers</h3><div class="tbl"><table><thead><tr><th>Active Container</th><th>Base Image</th><th>Mapped Port</th><th>Purpose</th></tr></thead><tbody><tr><td><strong>open-webui</strong></td><td>ghcr.io/open-webui/open-webui:main</td><td>3000 -> 8080</td><td>Unified LLM Chat and SD render panel</td></tr><tr><td><strong>portainer</strong></td><td>portainer/portainer-ce</td><td>9000</td><td>Visual management of Docker processes and stacks</td></tr><tr><td><strong>searxng</strong></td><td>searxng/searxng:latest</td><td>8080</td><td>Private search engine for anchored AI responses</td></tr></tbody></table></div><div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4"><h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Autonomous Lessons Learned on Linux</h4><p style="font-size:0.8rem;color:#94a3b8;line-height:1.7"><strong>Abandoned ROCm:</strong> GCN4 / Polaris cards like the RX 580 are no longer supported in the official ROCm SDK. Trying to run official Ollama via GPU Docker on it will fail. The golden route is to run <strong>Ollama on the Xeon CPU</strong> or use <strong>native llama-server compiled with Vulkan</strong>! Docker should only be used for frontends and free secondary servers.</p></div>
8201</div>
8202
8203<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Serviços e Contêineres Docker Rodando Paralelos</h3>
8204<div class="tbl">
8205  <table>
8206    <thead>
8207      <tr>
8208        <th>Contêiner ativo</th>
8209        <th>Imagem Base</th>
8210        <th>Porta Mapeada</th>
8211        <th>Finalidade</th>
8212      </tr>
8213    </thead>
8214    <tbody>
8215      <tr>
8216        <td><strong>open-webui</strong></td>
8217        <td>ghcr.io/open-webui/open-webui:main</td>
8218        <td>3000 -> 8080</td>
8219        <td>Painel unificado de Chat com LLM e render SD</td>
8220      </tr>
8221      <tr>
8222        <td><strong>portainer</strong></td>
8223        <td>portainer/portainer-ce</td>
8224        <td>9000</td>
8225        <td>Gerenciamento visual de processos e pilhas Docker</td>
8226      </tr>
8227      <tr>
8228        <td><strong>searxng</strong></td>
8229        <td>searxng/searxng:latest</td>
8230        <td>8080</td>
8231        <td>Mecanismo de busca privado para as respostas ancoradas de IA</td>
8232      </tr>
8233    </tbody>
8234  </table>
8235</div>
8236
8237<div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4">
8238  <h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Lições Autônomas Aprendidas em Linux</h4>
8239  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7">
8240    <strong>ROCm Abandonado:</strong> Placas GCN4 / Polaris como a RX 580 não têm mais suporte no SDK ROCm oficial. Tentar rodar Ollama oficial via GPU Docker nela falhará. A rota de ouro é rodar o <strong>Ollama na CPU Xeon</strong> ou usar o <strong>llama-server nativo compilado com Vulkan</strong>! Docker só deve ser empregado para frontends e servidores secundários livres.
8241  </p>
8242</div>`},llama:{id:"llama",title:"07. COMPILAÇÃO DO LLAMA.CPP (BACKEND VULKAN)",desc:"Step-by-step master commands to generate LLM-optimized binaries for the RX 580.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["llamacpp","vulkan-acceleration","compilacao-cpp"],last_reviewed:"2026-07-01",relationships:{prerequisites:["jornada"],previous:"jornada",next:"sdcpp",related:["modelos","limit_qwen_35b"]}},html:`<div class="note">⚠ Make sure to run the commands below exclusively inside <strong>Visual Studio's Developer PowerShell</strong></div><div class="code"><pre># Navigate to high-speed partition and clone official repository
8243cd E:\\
8244git clone https://github.com/ggerganov/llama.cpp
8245cd llama.cpp
8246
8247# Instantiate build directory injecting Vulkan backend compiler flag
8248cmake -B build -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
8249
8250# Trigger compilation using 20 parallel threads from Xeon processor
8251cmake --build build --config Release -j20</pre></div><h4 class="s" style="margin-top:1rem;margin-bottom:.5rem;color:#fff">Acceleration Device Validation Command</h4><div class="code"><pre>cd build\\bin\\Release
8252.\\llama-cli.exe --list-devices
8253# Expected console return: Vulkan0: AMD Radeon RX 580 2048SP ✅</pre></div>`},meta:{id:"meta",title:"36. REFERÊNCIAS E METADADOS DO DOCUMENTO",desc:"Technical analysis of the physical lifecycle of legacy hardware and the lab's reuse philosophy.",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"metadados",difficulty:"beginner",estimated_time_min:10,tags:["silicon-governance","metadata-specs","efficiency-telemetry"],last_reviewed:"2026-07-01",relationships:{prerequisites:["arquivos"],previous:"arquivos",next:"linhatempo",related:["arquivos","proximos"]}},html:'<blockquote style="font-size:.9rem;color:#94a3b8;font-style:italic;line-height:1.9;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">"Commercial planned obsolescence is a market choice, not an engineering barrier. Heritage hardware does not die; it is liberated by the right software."</blockquote><div class="tbl" style="margin-top:.9rem"><table><thead><tr><th>System Metadata</th><th>Audit Record</th></tr></thead><tbody><tr><td>Deploy Version</td><td>VULKAN_DEPLOY_V3.0_COMPLETO</td></tr><tr><td>Record Year</td><td>Consolidated History // 2026 Season</td></tr><tr><td>Authoring Scope</td><td>Black Tuxedo AI Solutions Systems Architecture</td></tr></tbody></table></div>'},modelos:{id:"modelos",title:"09. CONVERSÃO DE MODELOS PARA FORMATO GGUF",desc:"Optimization and quantization of standard .safetensors files to the format accepted by the ggml engine.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"quantizacao",difficulty:"intermediate",estimated_time_min:15,tags:["gguf","quantizacao-modelos","vram-8gb"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdcpp"],previous:"sdcpp",next:"sdserver",related:["llama","comfyui-modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.9rem">The optimized C++ runtimes of <code>stable-diffusion.cpp</code> require the structured file format in <code style="color:var(--r)">.gguf</code>. Traditional models downloaded from Civitai (.safetensors) need to pass through the native converter:</p><div class="code"><pre># Command for direct conversion and applying stable 8-bit quantization (q8_0)
8254.\\sd-cli.exe -M convert -m "E:\\models\\DreamShaper_8.safetensors" -o "E:\\models\\dreamshaper8.gguf" --type q8_0</pre></div><div class="code ok" style="margin-top:.75rem"><pre># Process completion log:
8255[INFO] convert 'DreamShaper_8.safetensors' to 'dreamshaper8.gguf' success ✅</pre></div>`},prereqs:{id:"prereqs",title:"05. PRÉ-REQUISITOS DO SISTEMA",desc:"Tooling required to compile open binaries and spin up local servers.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"dependencias",difficulty:"intermediate",estimated_time_min:20,tags:["cmake","git","msvc-compiler","gcc","vulkan-sdk"],last_reviewed:"2026-07-01",relationships:{prerequisites:["solucao"],previous:"solucao",next:"jornada",related:["llama","sdcpp"]}},html:`<div class="c2"><div class="card"><p style="font-size:.58rem;color:var(--r);text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">⚠ COMPILATION ENVIRONMENT (GPU)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">VS Developer PowerShell</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">Opens via Start Menu → "Developer PowerShell for VS 2022"</p></div><div class="card"><p style="font-size:.58rem;color:#22c55e;text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">✅ RUNTIME EXECUTION ENVIRONMENT</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">Standard Windows PowerShell</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">Runs the final compiled binaries without dev ecosystem overhead</p></div></div><div class="tbl" style="margin-top:1rem"><table><thead><tr><th>
8255Software / SDK</th><th>Homologated Version</th><th>Essential Configuration Notes</th></tr></thead><tbody><tr><td>Visual Studio Community</td><td>2022 or 2026</td><td>Must check workload: "Desktop development with C++"</td></tr><tr><td>CMake Compiler</td><td>v4.3.2+</td><td>Available at cmake.org. Remember to check: "Add CMake to system PATH"</td></tr><tr><td>Vulkan SDK</td><td>v1.4.341.1</td><td>Download via LunarG. Standard installation mandatory in <code>C:\\VulkanSDK\\</code></td></tr><tr><td>Git Windows</td><td>Latest stable</td><td>Official installer for cloning open-source repositories</td></tr><tr><td>Docker Desktop</td><td>v4.x+</td><td>Required to run OpenWebUI ecosystem and auxiliary pipelines like SearXNG</td></tr><tr><td>WSL2 Subsystem</td><td>Ubuntu 22.04.5 LTS</td><td>Stable execution base for ComfyUI and Ollama Python environment</td></tr><tr><td>Miniconda Linux</td><td>Python 3.11 Branch</td><td>Isolated package manager running inside WSL2 Linux subsystem</td></tr></tbody></table></div><div class="code"><pre># Compilation environment validation commands
8256cmake --version
8257# Expected return: cmake version 4.3.2 ✅
8258
8259dir C:\\VulkanSDK
8260# Expected return: displaying directory of version 1.4.341.1 ✅</pre></div>`},proving_hypothesis_35b:{id:"proving_hypothesis_35b",title:"42. PROVANDO A HIPÓTESE: CURL, CTX-SIZE 8192 E A PRIMEIRA RESPOSTA COMPLETA",desc:"Continuação direta da Seção 33 · 3 testes · Hipótese confirmada · Hardware de 2017",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:35,tags:["context-length","offloading-layer","matematica-tensores"],last_reviewed:"2026-07-01",relationships:{prerequisites:["limit_qwen_35b"],previous:"limit_qwen_35b",next:"sdxl_vulkan",related:["limit_qwen_35b","cpu"]},part:1},html:`<div class="whisper-doc">
8261  <div class="hero">
8262    <div class="hero-title"><span>Provando a Hipótese</span> — Qwen3.5 35B</div>
8263    <div class="hero-sub">Experimentos conclusivos validando preenchimento de contexto, timeouts de cliente e comparação Q4_K_M vs Q6_K no silício de 2017.</div>
8264    <div class="hero-badges">
8265      <span class="badge badge-gpu">AMD RX 580 8GB</span>
8266      <span class="badge badge-win">Xeon E5-2690 v3</span>
8267      <span class="badge badge-ok">Hipótese Provada</span>
8268      <span class="badge badge-ok">--ctx-size 8192</span>
8269      <span class="badge badge-win">Q4_K_M vs Q6_K</span>
8270    </div>
8271  </div>
8272
8273  <div class="stat-grid">
8274    <div class="stat">
8275      <div class="stat-label">Velocidade (Q4_K_M)</div>
8276      <div class="stat-value">6.42 - 6.65 tok/s</div>
8277      <div class="stat-sub">Sem Swap Ativo</div>
8278    </div>
8279    <div class="stat">
8280      <div class="stat-label">Contexto Provado</div>
8281      <div class="stat-value">8.192 tokens</div>
8282      <div class="stat-sub">Acomoda modo de Raciocínio</div>
8283    </div>
8284    <div class="stat">
8285      <div class="stat-label">Temperatura Máxima</div>
8286      <div class="stat-value">74°C</div>
8287      <div class="stat-sub">10°C mais frio com Q4_K_M</div>
8288    </div>
8289    <div class="stat">
8290      <div class="stat-label">Status do Hardware</div>
8291      <div class="stat-value">100% Aprovado</div>
8292      <div class="stat-sub">Zero crashes / 4 slots paralelos</div>
8293    </div>
8294  </div>
8295
8296  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.0 — Contexto e Motivação</h3>
8297  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
8298    A Seção 33 terminou com uma hipótese clara: <em>"O problema nunca foi o hardware. Foi a combinação de thinking + web search esgotando os 4.096 tokens de contexto. Com prompt curto e sem web search, o Qwen3.5-35B Q6_K responde normalmente numa RX 580 de 2017."</em>
8299  </p>
8300  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
8301    Em 16 de junho de 2026, o AIVisionsLab executou os testes pendentes sugeridos para provar essa hipótese ao vivo, avaliando o comportamento com curl direto (sem timeout do cliente), habilitando a flag de tamanho de contexto ampliado e testando quantizações mais eficientes.
8302  </blockquote>
8303
8304  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.1 — Hardware do Laboratório</h3>
8305  <div class="tbl">
8306    <table>
8307      <thead>
8308        <tr>
8309          <th>Componente</th>
8310          <th>Especificação</th>
8311        </tr>
8312      </thead>
8313      <tbody>
8314        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 cores / 24 threads · 3,05 GHz turbo (Lançado em 2014)</td></tr>
8315        <tr><td><strong>RAM</strong></td><td>
831531,8 GB DDR4 REG ECC (quad-channel)</td></tr>
8316        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (Lançado em 2017)</td></tr>
8317        <tr><td><strong>Storage NVMe</strong></td><td>SSD NVMe (Disco E:) — modelos GGUF (Leitura de 1.7–3.5 GB/s)</td></tr>
8318        <tr><td><strong>Storage HDD</strong></td><td>HDD (Disco C: / F:) — sistema Windows + swap</td></tr>
8319        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — lançado em 20/05/2026</td></tr>
8320        <tr><td><strong>Sistema</strong></td><td>Windows 10 Pro com WSL2 activo</td></tr>
8321      </tbody>
8322    </table>
8323  </div>
8324
8325  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.2 — Modelos Testados</h3>
8326  <div class="tbl">
8327    <table>
8328      <thead>
8329        <tr>
8330          <th>Modelo</th>
8331          <th>Quantização</th>
8332          <th>Tamanho do Arquivo</th>
8333          <th>Parâmetros da Arquitetura</th>
8334        </tr>
8335      </thead>
8336      <tbody>
8337        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q6_K</strong></td><td>6 bits</td><td>28,51 GB</td><td>34,66B (MoE)</td></tr>
8338        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M</strong></td><td>4 bits (Medium)</td><td><strong>21,17 GB</strong></td><td>34,66B (MoE)</td></tr>
8339        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q5_K_M</strong></td><td>5 bits (Medium)</td><td>24,76 GB</td><td>34,66B (MoE)</td></tr>
8340      </tbody>
8341    </table>
8342  </div>
8343  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
8344    *Nota: Todos os modelos possuem arquitetura idêntica de Mixture of Experts (MoE), variando apenas a compressão matemática de seus pesos.
8345  </p>
8346
8347  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.3 — Localizando os Executáveis</h3>
8348  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
8349    Antes de testar, foi necessário localizar as compilações otimizadas do <code>llama-server</code>. No PowerShell do laboratório:
8350  </p>
8351  <div class="cmd">Get-ChildItem -Path E:\\ -Recurse -Filter "llama-server.exe" -ErrorAction SilentlyContinue
8352 
8353# Resultado:
8354E:\\llama.cpp\\llama-server.exe (stub de 9KB)
8355E:\\llama.cpp\\build\\bin\\Release\\llama-server.exe (Executável real de 7.5MB) ◀</div>
8356
8357  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.4 — Teste 9: Curl Direto Sem Timeout</h3>
8358  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.1 — Motivação</h4>
8359  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
8360    Identificar se o gargalo de timeout relatado no Teste 4 residia no servidor ou estritamente nas requisições AJAX do cliente OpenWebUI.
8361  </p>
8362
8363  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.2 — Inicialização do Servidor</h4>
8364  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
8365.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --p
8365ort 8081</div>
8366
8367  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.3 — Resolvendo Escaping de JSON no PowerShell</h4>
8368  <div class="cmd">'{"model":"any","messages":[{"role":"user","content":"Explique MoE em 3 paragrafos"}]}' | Out-File -Encoding utf8 -FilePath "E:\\teste.json"</div>
8369
8370  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.4 — Executando a Chamada de Longa Duração</h4>
8371  <div class="cmd">curl.exe -X POST http://localhost:8081/v1/chat/completions -H "Content-Type: application/json" --max-time 600 -d "@E:\\teste.json"</div>
8372
8373  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.5 — Resultado Analítico</h4>
8374  <div class="cmd">truncated = 0  ◀ RESPOSTA COMPLETA ENTREGUE COM SUCESSO
8375total time = 266.42 s / 1955 tokens
8376eval time  = 255.97 s / 1683 tokens @ 6.57 t/s</div>
8377  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
8378    <strong>Veredicto técnico:</strong> O hardware de 2017 processou e entregou a resposta perfeitamente! O problema anterior era o tempo limite do navegador desistindo da conexão TCP, enquanto o servidor continuava gerando em background.
8379  </p>
8380
8381  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.5 — Paralelismo Real: 4 Slots de Computação</h3>
8382  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
8383    Durante o Teste 9, o OpenWebUI foi conectado paralelamente disparando a mesma pergunta. O motor de agendamento do llama.cpp processou de forma concorrente sem travamentos:
8384  </p>
8385  <div class="cmd">Task 0 (curl)      — n_decoded = 1125, tg = 5.96 t/s
8386Task 875 (OpenWebUI) — n_decoded = 243,  tg = 5.08 t/s</div>
8387<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
8388    A arquitetura resistiu de forma estável (GPU: 63°C, VRAM: 7.1/8.0 GB, RAM: 91% de uso de sistema total seguro, sem travar o Windows).
8389  </p>
8390
8391  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.6 — Teste 7: Habilitando Contexto Extremo (--ctx-size 8192)</h3>
8392  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.1 — O Comando Otimizado</h4>
8393  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
8394.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --p
8394ort 8081 --ctx-size 8192</div>
8395
8396  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.2 — Prompt de Teste e Comportamento do Thinking</h4>
8397  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">
8398    "Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."
8399  </blockquote>
8400  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
8401    Ao receber o prompt, o processador de pensamento rodou por longos 9 minutos em background na CPU trabalhando com o contexto de 8192 tokens. A análise interna destrinchou a matemática da VRAM (calculou que 35B em INT4 exige 17,5GB de peso puro) para desvendar as complexidades de esparsidade de ativação.
8402  </p>
8403
8404  <h4 style="color:rgba(225,29,72,0.9);font-weight:700;font-size:0.95rem;margin-top:2rem;margin-bottom:0.5rem">34.6.2-A — O Raciocínio Interno do Modelo: Análise Comparativa dos Três Thinking Blocks</h4>
8405  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
8406    Durante as exaustivas sessões de ensaio das Seções 33 e 34, o Qwen3.5-35B gerou três blocos independentes de raciocínio de bastidores (<code>&lt;think&gt;</code>) que foram capturados via interceptação direta de pacotes brutos. A tabulação e o mapeamento sistemático dessas sessões fornecem evidências fundamentais de análise cognitiva do modelo:
8407  </p>
8408
8409  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">1. Thinking Block 1 — Quantização Q6_K — Sessão 1 (23:06 de 15/06)</h5>
8410  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
8411    <strong>Prompt:</strong> <em>"Explique detalhadamente o mecanismo de atenção nos Transformers e por que MoE é mais eficiente que modelos densos."</em><br>
8412    <strong>Tempo de Raciocínio:</strong> ~4 minutos | <strong>Tokens do Bloco:</strong> ~2.000 | <strong>Status:</strong> ✅ Concluído com Sucesso.
8413  </p>
8414  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
8415    <span style="color:#e11d48">// Linha de Pensamento do Qwen3.5 (Q6_K):</span><br>
8416    - Deconstruct query into structured chunks: Attention math, Multi-head, MoE, benefits vs dense.<br>
8417    - Detail Attention: Focus on Scaled Dot-Product mathematical formulation (Q, K, V). Show why division by sqrt(d_k) is required to prevent vanishing gradients during Softmax.<br>
8418    - Explain Multi-Head as parallel subspace projections (capturing both strict syntactic dependencies and semantic references).<br>
8419    - Deconstruct MoE: Discuss role of Router/Gating network, Routing sparsity (top-k selection), and load balancing to prevent routing collapse (unused experts).<br>
8420    - <span style="color:#a3e635">[Autocorreção Interna]</span>: "Wait, I must check if MoE is always faster. I should explicitly note that MoE is memory-intensive for routing/loading but highly sparse computationally. If memory bandwidth is bottlenecked under dual-system offloading, token generation speed depends strongly on mmap performance."
8421  </div>
8422
8423  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">2. Thinking Block 2 — Quantização Q4_K_M — Sessão 2 (05:05 de 16/06)</h5>
8424  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
8425    <strong>Prompt:</strong> <em>"Qual a diferença entre MoE e modelo denso, e por que MoE permite rodar 35B numa GPU de 8GB?"</em><br>
8426    <strong>Tempo de Raciocínio:</strong> ~11 minutos | <strong>Tokens do Bloco:</strong> ~3.500 | <strong>Status:</strong> ❌ Interrompido por esgotamento de contexto (Límite 4096).
8427  </p>
8428  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
8429    <span style="color:#e11d48">// Linha de Pensamento do Qwen3.5 (Q4_K_M):</span><br>
8430    - Analysis of premise: Running 35 billion parameter model in 8GB VRAM.<br>
8431    - <span style="color:#f43f5e">
8431[Cálculo Físico Espontâneo]</span>:<br>
8432      * FP32 weights: 35B * 4 bytes = 140 GB. Impossible.<br>
8433      * FP16 weights: 35B * 2 bytes = 70 GB. Impossible.<br>
8434      * INT8 quant:  35B * 1 byte = 35 GB. Impossible.<br>
8435      * INT4 quant:  35B * 0.5 bytes = 17.5 GB. Still larger than 8GB. This doesn't fit natively.<br>
8436    - Challenge the premise: "Wait, if the model indeed runs on 8GB, there must be extreme offloading, sparse activation memory loading, or aggressive hybrid quantization."<br>
8437    - <span style="color:#a3e635">[Autocorreção Crítica]</span>: "Ah! The user says 'por que o MoE permite rodar'. But actually, MoE weights are typically larger than equivalent dense models. A 35B MoE has 35B total parameters but only roughly 6B-8B active parameters per token. If we offload the inactive experts to system memory (RAM/mmap swap) and only load the active experts or the shared dense blocks onto the GPU, then the GPU memory footprint during active tensor computation is massively reduced. Let me structure this hypothesis."<br>
8438    - <span style="color:#d946ef">[Análise Meta-Arquitetural]</span>: Elaborating on the split mechanism. Router stays in VRAM for instant routing, shared blocks in VRAM, active experts fetched from RAM dynamically during forward pass.
8439  </div>
8440  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
8441    <em>Nota Conclusiva de Engenharia:</em> Enquanto o modelo formulava esse raciocínio fascinante na CPU, ele estava descrevendo em profundidade matemática exatamente o sistema de mmap distribuído e a arquitetura Vulkan de 4 níveis de memória que o sustentava em tempo real — sem possuir acesso direto aos metadados do container ou ao sistema de arquivos do laboratório.
8442  </p>
8443
8444  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">3. Thinking Block 3 — Quantização Q4_K_M — Sessão 2 (05:24 de 16/06)</h5>
8445  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
8446    <strong>Prompt:</strong> <em>"Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."</em><br>
8447    <strong>Tempo de Raciocínio:</strong> ~9 minutos | <strong>Tokens do Bloco:</strong> ~3.000 | <strong>Status:</strong> ✅ Concluído com Sucesso (--ctx-size 8192).
8448  </p>
8449  <div style="background:#090a0f;border:1px solid rgba(34,197,94,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a3e635;margin-bottom:1rem">
8450    <span style="color:#a3e635">// Linha de Pensamento do Qwen3.5 (Q4_K_M com limite otimizado):</span><br>
8451    - Prompt requests: Portuguese, direct, concise.<br>
8452    - Challenge VRAM claim again internally: MoE total size is bigger than dense, but active size is smaller. VRAM savings must come from smaller activation graphs (fewer experts evaluated simultaneously) and CPU-offloaded weight mapping.<br>
8453    - Work step-by-step to compress explanation to fit "direto e conciso":<br>
8454      * <span style="color:#cbd5e1">Rascunho v1:</span> Long theoretical detail on Router and CPU/VRAM exchange metrics.<br>
8455      * <span style="color:#cbd5e1">Refinamento v2:</span> Cut down router math, focus on "Ativação Esparsa" (activation memory bounds).<br>
8456      * <span style="color:#cbd5e1">Compressão Final:</span> Produce 3 crisp, highly readable Portuguese bullet points summarizing Active Parameters, Activation Garty/Memory limit, and Compute Scalability.
8457  </div>
8458<h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">Tabela Comparativa de Comportamento Cognitivo</h5>
8459  <div class="tbl">
8460    <table>
8461      <thead>
8462        <tr>
8463          <th>Métrica de Profiling</th>
8464          <th>Sessão 1 (Q6_K)</th>
8465          <th>Sessão 2-A (Q4_K_M)</th>
8466          <th>Sessão 2-B (Q4_K_M / ctx 8192)</th>
8467        </tr>
8468      </thead>
8469      <tbody>
8470        <tr><td><strong>Duração do Raciocínio</strong></td><td>~4 minutos</td><td><strong>~11 minutos</strong></td><td>~9 minutos</td></tr>
8471        <tr><td><strong>Volume do Bloco &lt;think&gt;</strong></td><td>~2.000 tokens</td><td><strong>~3.500 tokens</strong></td><td>~3.000 tokens</td></tr>
8472        <tr><td><strong>Autocorreções Efetuadas</strong></td><td>2</td><td><strong>7 (Autocorreções profundas)</strong></td><td>4 (Foco em concisão)</td></tr>
8473        <tr><td><strong>Questionamento de Premissa?</strong></td><td>Não</td><td><strong>✅ Sim (Provou erro matemático do prompt)</strong></td><td>Sim (reajuste técnico)</td></tr>
8474        <tr><td><strong>Raciocínio Matemático</strong></td><td>Equação Transformers</td><td><strong>Cálculo do tamanho de pesos reais</strong></td><td>Cálculo de buffers de ativação</td></tr>
8475        <tr><td><strong>Entrega do Texto</strong></td><td>✅ Sucesso</td><td>❌ Estouro (4096 esgotados)</td><td><strong>✅ Sucesso Absoluto (Zero cortes)</strong></td></tr>
8476      </tbody>
8477    </table>
8478  </div>
8479
8480  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.8 — Cronograma Histórico do Laboratório</h3>
8481  <div class="tbl">
8482    <table>
8483      <thead>
8484        <tr>
8485          <th>Sessão do Experimento</th>
8486          <th>ID</th>
8487          <th>Parâmetros de Ctx</th>
8488          <th>Geração (tok/s)</th>
8489          <th>Corte de Fluxo (truncated)</th>
8490          <th>Resultado Efetivo</th>
8491        </tr>
8492      </thead>
8493      <tbody>
8494        <tr><td>Seção 34 — Teste 5</td><td>Q6_K</td><td>4096 tokens</td><td>5,57 t/s</td><td>0 (prompt enxuto)</td><td>✅ Resposta entregue (contexto enxuto)</td></tr>
8495        <tr><td>Seção 34 — Teste 9 (curl)</td><td>Q4_K_M</td><td>4096 tokens</td><td><strong>6,57 t/s</strong></td><td>0 (sem timeout)</td><td>
8495✅ Resposta integral por canal direto</td></tr>
8496        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Seção 34 — Teste 7 (WebUI)</strong></td><td>Q4_K_M</td><td>8192 tokens</td><td>6,42 t/s</td><td>0</td><td>✅ Resposta completa com raciocínio expandido</td></tr>
8497      </tbody>
8498    </table>
8499  </div>
8500
8501  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.9 — Nova Coleção de Lições Técnicas Consolidadas</h3>
8502  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
8503    <li><strong style="color:#fff">Lição 6 — O fator Timeout do Cliente:</strong> A maior parte dos erros apontados por testadores não decorre de incapacidade física da GPU, mas sim da persistência HTTP falha de interfaces que desistem antes da decodificação final.</li>
8504    <li><strong style="color:#fff">Lição 7 — Ajuste de Buffers de Contexto:</strong> Ativar a diretiva <code>--ctx-size 8192</code> remove o limite asfixiante do buffer de raciocínio, oferecendo fôlego de processamento para os mais de 3.500 tokens exigidos de raciocínio lógico interno.</li>
8505    <li><strong style="color:#fff">Lição 8 — Supremacia de Carregamento da Quantização Média:</strong> Rodar 35B com quantização de 4 bits economiza 7GB cruciais na carga física de RAM da CPU, reduzindo o I/O do Swap do disco e otimizando a temperatura.</li>
8506    <li><strong style="color:#fff">Lição 9 — Raciocínio de Modelo Crítico:</strong> O Qwen3.5 MoE questionou a premissa errônea presente no prompt, calculando pesos em tempo real e rebatendo sobre o offloading híbrido, o que prova comportamento de atenção e alinhamento impecáveis.</li>
8507    <li><strong style="color:#fff">Lição 10 — Paralelismo nativo estável:</strong> A coexistência de chamadas em canais concorrentes prova a maturidade das implementações de pipeline de shaders Vulkan no llama.cpp.</li>
8508  </ul>
8509
8510  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.10 — Setup Recomendado para Implementações Futuras</h3>
8511  <div class="cmd"># Script do Laboratório para inicialização de produção
8512cd E:\\llama.cpp\\build\\bin\\Release
8513 
8514.\\llama-server.exe \`
8515  -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" \`
8516  --host 0.0.0.0 \`
8517  --port 8081 \`
8518  --ctx-size 8192</div>
8519  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
8520    *Instruções de interface complementares: Desativação estrita de Web Search e geração e imagens durante o processamento híbrido extremo.
8521  </p>
8522
8523  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.11 — Veredicto Geral do Laboratório (Provando a Hipótese)</h3>
8524  <div class="tbl">
8525    <table>
8526      <thead>
8527        <tr>
8528          <th>Questão de Engenharia</th>
8529          <th>Veredicto Final</th>
8530        </tr>
8531      </thead>
8532      <tbody>
8533        <tr><td><strong>O curl resolve o timeout do OpenWebUI?</strong></td><td>✅ <strong>Sim</strong> (truncated = 0, resposta 100% íntegra)</td></tr>
8534        <tr><td><strong>CTX-SIZE de 8.192 resolve o thinking mode esmagado?</strong></td><td>✅ <strong>Sim</strong> (Acomoda com folga raciocínios longos)</td></tr>
8535        <tr><td><strong>Q4_K_M é superior para o cenário de 32GB de RAM?</strong></td><td>✅ <strong>Sim</strong> (Mais rápido, mais frio, menor swap)</td></tr>
8536        <tr><td><strong>A hipótese de esgotamento de contexto foi confirmada?</strong></td><td>✅ <strong>Absolutamente</strong></td></tr>
8537        <tr><td><strong>Sobrecusto financeiro para otimização em 2026?</strong></td><td>✅ <strong>R$ 0,00</strong> (Solução lógica via flags)</td></tr>
8538      </tbody>
8539    </table>
8540  </div>
8541
8542  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.12 — Tags e Metadados</h3>
8543  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
8544    <div>🏷️ <strong>Tags:</strong> curl, ctx-size, timeout, openwebui, q4km, q6k, paralelismo, thinking-mode, resposta-completa, hipotese-confirmada, rx580</div>
8545    <div style="margin-top:0.5rem">💻 <strong>Hardware:</strong>
8545 RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
8546    <div style="margin-top:0.25rem">💿 <strong>Software:</strong> llama.cpp (build\\bin\\Release) + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
8547    <div style="margin-top:0.25rem">📅 <strong>Data:</strong> 16/06/2026</div>
8548    <div style="margin-top:0.25rem">📊 <strong>Testes:</strong> 3 (Teste 9 curl, paralelismo real, Teste 7 ctx8192)</div>
8549    <div style="margin-top:0.25rem">📈 <strong>Benchmark:</strong> 6,42–6,65 tok/s (Q4_K_M) | truncated = 0</div>
8550    <div style="margin-top:0.25rem">🔥 <strong>Temperatura pico:</strong> 74°C</div>
8551    <div style="margin-top:0.25rem">🏆 <strong>Status final:</strong> ✅ HIPÓTESE CONFIRMADA</div>
8552  </div>
8553
8554  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
8555    "O problema nunca foi o hardware. Era uma flag e um timeout."<br>
8556    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 16/06/2026</span>
8557  </blockquote>
8558
8559  <div class="footer">
8560    Documentação gerada por Claude Sonnet 4.6 — 16/06/2026 · Baseada em logs reais, screenshots e benchmarks ao vivo · 3 testes documentados · Hipótese confirmada · Hardware de 2017 processando IA de 2025
8561  </div>
8562</div>`},proximos:{id:"proximos",title:"34. PRÓXIMOS PASSOS (ROADMAP 2027)",desc:"Next development goals: Vulkan Multi-GPU Clusters and local mesh of autonomous agents.",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"planejamento",difficulty:"beginner",estimated_time_min:10,tags:["roadmap-2027","planejamento-tecnico","novas-verticais"],last_reviewed:"2026-07-01",relationships:{prerequisites:["codacus"],previous:"codacus",next:"arquivos",related:["jornada","meta"]}},html:'<div class="card" style="border-left:3px solid #22c55e"><p style="font-size:.88rem;color:#fff;font-weight:600">Computational Infrastructure Expansion Planning:</p><ul style="padding-left:1.2rem;margin-top:.45rem;font-size:.85rem;color:#94a3b8;line-height:2"><li><strong style="color:#fff">[ ] Multi-GPU Cluster Homologation:</strong> Coupling a second RX 580 graphics card in parallel via Vulkan for weight tensor distribution.</li><li><strong style="color:#fff">[ ] Autonomous Local Agents Mapping:</strong> Full integration of the CrewAI framework running natively on the OpenWebUI API for enterprise automation.</li></ul></div>'},scripts:{id:"scripts",title:"21. SCRIPTS E AUTOMAÇÃO",desc:"Batch scripts to clean video memory and initialize local servers without conflicts.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:15,tags:["reboot-stack","memory-flush","manutencao-servidor"],last_reviewed:"2026-07-01",relationships:{prerequisites:["stack"],previous:"stack",next:"guia",related:["reboot_stack","sd_bat_automation"]}},html:`<h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">19.A — Master Script (All Services)</h4><div class="code"><span class="code-lang">batch</span><pre>@echo off
8563title INFRASTRUCTURE IA - REBOOT STACK
8564cls
8565echo Forcing termination of active background instances...
8566taskkill /F /IM sd-server.exe 2>nul
8567taskkill /F /IM llama-server.exe 2>nul
8568timeout /t 2 /nobreak >nul
8569
8570echo Initializing LLM via Vulkan on RX 580 (port 8081)...
8571start "LLM Server - Vulkan RX580" C:\\llama.cpp\\build\\bin\\Release\\llama-server.exe ^
8572  -m "E:\\MODELO LLM PARA GPU\\Mistral-7B-Q4_K_M.gguf" ^
8573  --host 0.0.0.0 ^
8574  --port 8081 ^
8575  --device Vulkan0
8576
8577timeout /t 3 /nobreak >nul
8578
8579echo Initializing SD Server via Vulkan on RX 580 (port 7860)...
8580E:
8581cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
8582sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
8583  -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
8584
8585pause</pre></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.B — Connect LLM to OpenWebUI</h4><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">After starting llama-server, connect it to OpenWebUI:</p><ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:.75rem"><li>Access <code style="color:var(--r)">http://localhost:3000</code></li><li>Click avatar → <strong style="color:#fff">Admin Panel</strong></li><li>Go to <strong style="color:#fff">Settings → Connections</strong></li><li>In <strong style="color:#fff">OpenAI API</strong> section click <strong style="color:#fff">"+"</strong></li><li>Fill in the fields below:</li></ol><div class="tbl"><table><thead><tr><th>
8585Field</th><th>Value</th></tr></thead><tbody><tr><td>URL</td><td><code>http://host.docker.internal:8081/v1</code></td></tr><tr><td>API Key</td><td><code>sk-local</code></td></tr></tbody></table></div><ol start="6" style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-top:.75rem"><li>Click the <strong style="color:#fff">refresh</strong> icon — a green banner should appear ✅</li><li>Save</li></ol><div class="card" style="margin-top:.75rem;border-left:3px solid #eab308;padding-left:.9rem"><p style="font-size:.85rem;color:#94a3b8;line-height:1.8"><strong style="color:#eab308">⚠️ Do not use <code>127.0.0.1</code></strong> — Docker runs on an isolated WSL2 network and cannot see Windows localhost. Always use <code style="color:var(--r)">host.docker.internal</code>.</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.C — Chat Validation</h4><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">After saving, open a <strong style="color:#fff">New Chat</strong> in OpenWebUI:</p><ul style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem"><li>The <code style="color:var(--r)">Mistral-7B-Q4_K_M.gguf</code> model appears in the list under <strong style="color:#fff">External</strong></li><li>Select it and chat normally</li><li>The model runs 100% on the <strong style="color:#fff">RX 580 via Vulkan</strong> — not on Ollama</li></ul><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.D — Verify it's on GPU (not CPU)</h4><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem">In the llama-server terminal, confirm:</p><div class="code"><span class="code-lang">log</span><pre>ggml_vulkan: Found 1 Vulkan device(s)
8586ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
8587llama server listening at http://0.0.0.0:8081</pre></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:.75rem 0 .5rem 0">And during inference the benchmark appears:</p><div class="code"><span class="code-lang">log</span><pre>17.77 t/s  ← RX 580 Vulkan ✅</pre></div><div class="card" style="margin-top:.75rem"><p style="font-size:.85rem;color:#64748b;line-height:1.8">If only <code>3-5 t/s</code> appears without the <code>ggml_vulkan</code> line — it's running on CPU. Make sure <code style="color:var(--r)">--device Vulkan0</code> is in the command.</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.E — Three Available Interfaces</h4><div class="tbl"><table><thead><tr><th>Interface</th><th>URL</th><th>When to Use</th></tr></thead><tbody><tr><td><strong style="color:#fff">Native llama.cpp UI</strong></td><td><code>http://127.0.0.1:8081</code></td><td>Quick tests directly in browser</td></tr><tr class="hig"><td><strong style="color:#fff">OpenWebUI</strong></td><td><code>http://localhost:3000</code></td><td>Daily use with history and RAG</td></tr><tr><td><strong style="color:#fff">Direct API</strong></td><td><code>http://192.168.15.68:8081/v1</code></td><td>Integration with other apps</td></tr></tbody></table></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.F — Critical Script Rules</h4><div class="tbl"><table><thead><tr><th>Rule</th><th>Reason</th></tr></thead><tbody><tr class="hig"><td>Mandatory <code>--host 0.0.0.0</code></td><td><code>127.0.0.1</code> blocks Docker</td></tr><tr class="hig"><td>Mandatory <code>--device Vulkan0</code></td><td>Without it drops to CPU (3-5 t/s)</td></tr><tr><td><code>taskkill</code> before starting</td><td>Frees VRAM from stuck processes</td></tr><tr><td><code>host.docker.internal</code> in OpenWebUI</td><td>Only address Docker sees on Windows host</td></tr></tbody></table></div>`},sd_bat_automation:{id:"sd_bat_automation",title:"12. SD-SERVER LOCAL / BOOT SEQUENCE",de
8587sc:"Dedicated batch script for safe and reproducible AI server initialization.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:12,tags:["batch-automation","loop-monitoramento","gerenciamento-portas"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux_server"],previous:"flux_server",next:"sd_openwebui_integration",related:["scripts","reboot_stack"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">To avoid manual errors, incorrect paths, or ports stuck in VRAM when restarting Windows, the server must be started exclusively via the <code>.bat</code> file on the Desktop.</p>
8588
8589<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Production Script (iniciar_ia_server.bat):</strong></p>
8590<pre style="font-family:'JetBrains Mono',monospace;font-size:11px">@echo off
8591title Local Stable Diffusion Server - Production
8592cls
8593
8594:: 1. Cleanup of phantom processes in VRAM/RAM
8595taskkill /f /im sd-server.exe 2>nul
8596taskkill /f /im sd-cli.exe 2>nul
8597timeout /t 2 /nobreak >nul
8598
8599:: 2. Drive jump and native path (CMD syntax)
8600E:
8601cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
8602
8603:: 3. Execution with open listener for Docker
8604sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
8605
8606pause</pre>
8607
8608<div class="tbl" style="margin:1.25rem 0">
8609  <table>
8610    <thead>
8611      <tr><th>Rule</th><th>Reason</th></tr>
8612    </thead>
8613    <tbody>
8614      <tr><td>Never use <code>.\\</code> before the executable</td><td>Traditional CMD does not recognize it — breaks the terminal</td></tr>
8615      <tr><td>Mandatory <code>taskkill</code> block</td><td>Frees port 7860 stuck in background processes</td></tr>
8616      <tr><td>Drive jump (<code>E:</code>) before <code>cd</code></td><td>CMD does not change drives without explicit jump</td></tr>
8617    </tbody>
8618  </table>
8619</div>
8620
8621<div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;">
8622  <span style="color:#22c55e; font-weight:bold">✅ STATUS: AUTOMATION VALIDATED IN PRODUCTION</span><br>
8623  <span style="font-size:.8rem; color:#94a3b8">Two clicks on the .bat initialize the complete ecosystem — cleanup, path, and port bind in sequence</span>
8624</div>`},sd_openwebui_integration:{id:"sd_openwebui_integration",title:"13. INTEGRAÇÃO OPENWEBUI + DOCKER",desc:"Network bridge between the OpenWebUI Docker container and the native C++ engine running on the host GPU.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"integracao",difficulty:"advanced",estimated_time_min:35,tags:["open-webui","docker-compose","networking-docker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_bat_automation"],previous:"sd_bat_automation",next:"comfyui-wsl",related:["sdserver","comfyui-wsl"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">When the generation engine runs outside the Docker container, standard local communication (<code>127.0.0.1</code>) is blocked by network isolation and the Windows Firewall. The initialization and route need to be explicit.</p><p style="font-size:.88rem;color:#fff;margin-bottom:.5rem">⚙️ <strong>Critical Initialization Parameters</strong></p><div class="tbl" style="margin-bottom:1.25rem"><table><thead><tr><th>Flag</th><th>Value</th><th>Description</th></tr></thead><tbody><tr><td><code>--listen-ip</code></td><td><code>0.0.0.0</code></td><td>Opens listening for requests external to the host (Docker)</td></tr><tr><td><code>--listen-port</code></td><td><code>7860</code></td><td>Standard integration port with OpenWebUI</td></tr><tr><td><code>-m</code></td><td>absolute path</td><td>SD 1.5 / XL model in <code>.safetensors</code> or <code>.gguf</code></td></tr></tbody></table></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Production Command — SD 1.5 / DreamShaper:</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"</pre><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:1rem 0">⚠️ <strong style="color:#fff">Architecture Note:</strong> Flux.1 models are not compatible with this build via the simple <code>-m</code> flag — they return <code>[ERROR] main.cpp:92 - new_sd_ctx_t failed</code>. For Flux, use the dedicated command from section 10.A with <code>--diffusion-model</code>, <code>--vae</code>, <code>--clip_l</code>, and <code>--t5xxl</code> separately.</p><p style="font-size:.88rem;color:#fff;margin-bottom:.75rem">🔌 <strong>Route Configuration in OpenWebUI</strong></p><ol style="font-size:.88rem;color:#94a3b8;line-height:2;margin-left:1.25rem"><li>Access <code>http://localhost:3000</code></li><li>Go to <strong>Settings &gt; Images</strong> (Admin Panel)</li><li>Select the <strong>Automatic1111</strong> engine</li><li>Enter the machine's local IP with mandatory <code>/</code> at the end:<br><code style="color:#22c55e">http://192.168.15.68:7860/</code></li><li>Click <strong>Save</strong>
8624 — a green banner will confirm the network bridge</li></ol><div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin:1.25rem 0"><strong style="color:#ef4444;display:block;margin-bottom:.4rem">🔒 Mandatory Windows Defender Firewall Release</strong><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem">Windows Defender silently blocks connections coming from the Docker internal subnet (<code>172.17.0.0/16</code>) and WSL2 (<code>172.x.x.x</code>) by default. Without this rule, OpenWebUI cannot reach sd-server even with <code>--listen-ip 0.0.0.0</code> active.</p><p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>Method 2 — PowerShell (one line, run as Administrator):</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:10px;margin-bottom:.5rem">New-NetFirewallRule -DisplayName "sd-server AIVisionsLab" -Direction Inbound -Protocol TCP -LocalPort 7860 -Action Allow</pre><p style="font-size:.82rem;color:#94a3b8;margin:0"><strong>Validation:</strong> After creating the rule, restart sd-server and try generating an image via OpenWebUI. The green banner in the image settings confirms the active bridge.</p></div>`},sdcpp:{id:"sdcpp",title:"08. COMPILAÇÃO DO STABLE-DIFFUSION.CPP",desc:"Building the clean C++ engine for GPU-accelerated image rendering without CUDA dependencies.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["sdcpp","stable-diffusion-cpp","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["llama"],previous:"llama",next:"modelos",related:["sdserver","flux_server"]}},html:`<div class="note">⚠ Compilation via <strong>Developer PowerShell</strong> · Later execution via <strong>Common PowerShell</strong></div><div class="code"><pre># Structured clone bringing all linked dependency submodules
8625git clone --recursive https://github.com/leejet/stable-diffusion.cpp
8626cd stable-diffusion.cpp
8627mkdir build
8628cd build
8629
8630# Map compiler enabling Vulkan engine and build binaries in performance mode
8631cmake .. -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
8632cmake --build . --config Release -j20</pre></div><div class="code ok" style="margin-top:.75rem"><pre># Final successful compilation logs:
8633-- Found Vulkan: C:/VulkanSDK/1.4.341.1/Lib/vulkan-1.lib
8634[100%] Built target sd-server ✅</pre></div>`},sdserver:{id:"sdserver",title:"10. INICIALIZAÇÃO DO SERVIDOR SD-SERVER (GPU)",desc:"Activation of the image service on the local port to listen for API calls from the graphical interface.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"intermediate",estimated_time_min:15,tags:["sd-server","api-rest","inferenca-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["modelos"],previous:"modelos",next:"flux_server",related:["sd_bat_automation","sd_openwebui_integration"]}},html:`<div class="note ok">✅ Homologated initialization: Run this code block inside <strong>Common PowerShell</strong></div><div class="code"><pre># Spin up the server pointing to the quantized model and defining the listening host
8635E:\\stable-diffusion.cpp\\build\\bin\\Release\\sd-server.exe \\
8636  -m "E:\\models\\dreamshaper8.gguf" \\
8637  --host 0.0.0.0 \\
8638  --port 7860</pre></div><div class="code ok" style="margin-top:.75rem"><pre># Terminal monitoring:
8639ggml_vulkan: Found 1 Vulkan device(s)
8640ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
8641Server listening on http://0.0.0.0:7860 ✅</pre></div>`},sdxl_vulkan:{id:"sdxl_vulkan",title:"26. SDXL & FLUX.1 VULKAN: ALTA RESOLUÇÃO NA POLARIS",desc:"Complete mapping of the high-resolution (1024x1024) diffusion challenge via Vulkan and structured tensor offloading on 8GB silicon.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:40,tags:["sdxl","vulkan-diffusion","segmentacao-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proving_hypothesis_35b"],previous:"proving_hypothesis_35b",next:"",related:["animatediff-video","flux-vulkan"]}},html:`<div class="page">
8642
8643  <div class="hero">
8644    <div class="hero-eyebrow">AIVisionsLab — Section 26</div>
8645    <div class="hero-title">SDXL 1024×1024 on RX 580 via Vulkan:<br>the challenge that came from AMD and was answered live</div>
8646    <div class="hero-sub">AMD RX 580 8GB (2017) · stable-diffusion.cpp (leejet) · Vulkan · no CUDA · no ROCm · hybrid CPU/GPU split · photorealistic output confirmed</div>
8647  </div>
8648
8649  <div class="badges">
8650    <span class="badge badge-red">RX 580 · GCN 4th gen</span>
8651    <span class="badge badge-blue">Vulkan backend</span>
8652    <span class="badge badge-gray">stable-diffusion.cpp</span>
8653    <span class="badge badge-green">SDXL 1024×1024 ✓</span>
8654    <span class="badge badge-amber">hybrid CPU/GPU split</span>
8655  </div>
8656
8657  <h2>Context: the challenge came from the AMD Discord</h2>
8658  <p>While we were discussing ROCm vs Vulkan on the official AMD Developer Community server, a member questioned the limits of the stack live. The response was not speculation — it was running the benchmark in real-time and posting the result with screenshots, logs, and the generated image, within the AMD server itself.</p>
8659
8660  <div class="discord-card">
8661    <div class="discord-header"><i class="ti ti-brand-discord" aria-hidden="true"></i> AMD Developer Community · #rocm-ai-assistant</div>
8662    <div class="discord-body">
8663      <div class="discord-quote">
8664        <div class="author">POIZONE 🔥</div>
8665        <p>"Love the RX 580 flex. Which SD backend are you using, stable-diffusion.cpp on Vulkan? And does it support SDXL or Flux, or only SD1.5?"</p>
8666      </div>
8667      <div class="discord-reply">Response: we ran the test live during the conversation. The result — SDXL 1.0 @ 1024×1024 confirmed, with logs, Task Manager screenshots, and generated image — was posted back in the same channel. The ROCm AI Assistant (official AMD bot) responded by acknowledging that Vulkan is the legitimate choice for hardware outside of ROCm support.</div>
8668    </div>
8669  </div>
8670
8671  <h2>The problem: 6.9 GB model, 8 GB VRAM</h2>
8672  <p>The base SDXL weighs ~6.9 GB in fp16. With activation buffers during inference, this exceeds the 8 GB of the RX 580 if everything is loaded onto the GPU. The solution is selective offloading by component — stable-diffusion.cpp (leejet fork) supports this natively, with the same logic we already use for FLUX.1-schnell with <code>--clip-on-cpu</code>.</p>
8673  <p>A second silent problem: the original SDXL VAE produces NaN in FP16, and the ggml_conv_2d in sd.cpp only operates in FP16. Without the correct fix, the image comes out black — with no visible error in the log.</p>
8674
8675  <div class="gotcha-box">
8676    <div class="gotcha-title">⚠ mandatory gotcha — VAE FP16 fix</div>
8677    <p>Always use <strong>sdxl_vae-fp16-fix.safetensors</strong> (madebyollin) instead of the original VAE. Without it: black image, silently, in every single render. The <code>--vae</code> flag points to this file, not to the VAE embedded in the checkpoint.</p>
8678  </div>
8679
8680  <h2>Solution: hybrid CPU/GPU split</h2>
8681  <p>Entire UNet in VRAM. Text encoders and VAE decode in RAM. The <code>--vae-tiling</code> splits the decode into 32×32 tiles to eliminate the memory spike in the final stage of the pipeline.</p>
8682
8683  <div class="code-block">
8684    <div class="code-label">PowerShell — E:\\stable-diffusion.cpp\\build\\bin\\Release\\</div>
8685    <pre>.\\sd-server.exe \`
8686  --listen-ip 0.0.0.0 \`
8687  --listen-port 8081 \`
8688  -m E:\\models\\sd_xl_base_1.0.safetensors \`
8689  --vae E:\\models\\sdxl_vae-fp16-fix.safetensors \`
8690  --clip-on-cpu \`
8691  --vae-on-cpu \`
8692  --vae-tiling \`
8693  -H 1024 -W 1024 -v</pre>
8694  </div>
8695
8696  <table class="flag-table">
8697    <thead><tr><th>Flag</th><th>
8697Effect</th><th>VRAM memory freed</th></tr></thead>
8698    <tbody>
8699      <tr><td>--clip-on-cpu</td><td>CLIP-L + OpenCLIP-bigG run on RAM during conditioner</td><td>~1.56 GB</td></tr>
8700      <tr><td>--vae-on-cpu</td><td>VAE decode runs on CPU/RAM — eliminates spike at the end of the pipeline</td><td>~416 MB</td></tr>
8701      <tr><td>--vae-tiling</td><td>Splits decode into 32×32 tiles (49 tiles at 1024×1024)</td><td>— (reduces RAM spike)</td></tr>
8702    </tbody>
8703  </table>
8704
8705  <h2>Memory split confirmed in logs</h2>
8706
8707  <div class="log-block">
8708    <pre><span class="comment"># sd-server output after full model load:</span>
8709
8710total params memory size = 6624.11MB
8711<span class="highlight">  VRAM  4900.07MB  →  diffusion_model (UNet)</span>
8712<span class="highlight">  RAM   1564.36MB  →  text_encoders (CLIP-L + OpenCLIP-bigG)</span>
8713<span class="highlight">  RAM    159.68MB  →  vae</span>
8714
8715listening on: http://0.0.0.0:8081</pre>
8716  </div>
8717
8718  <div class="memory-split">
8719    <div class="mem-card gpu">
8720      <div class="mem-label">GPU · VRAM</div>
8721      <div class="mem-value">4.9 GB</div>
8722      <div class="mem-sub">UNet (diffusion_model)</div>
8723    </div>
8724    <div class="mem-card ram">
8725      <div class="mem-label">CPU · RAM</div>
8726      <div class="mem-value">1.56 GB</div>
8727      <div class="mem-sub">CLIP-L + OpenCLIP-bigG</div>
8728    </div>
8729    <div class="mem-card ram">
8730      <div class="mem-label">CPU · RAM</div>
8731      <div class="mem-value">160 MB</div>
8732      <div class="mem-sub">VAE decode (49 tiles)</div>
8733    </div>
8734  </div>
8735
8736  <h2>Generation test via PowerShell</h2>
8737  <p>Why we didn't use Open WebUI: it was already configured pointing to FLUX.1-schnell on another port. Reconfiguring risked breaking a setup that was already working. The terminal resolves faster, with no saved state to preserve and no port conflict.</p>
8738
8739  <div class="code-block">
8740    <div class="code-label">PowerShell — sending prompt via A1111-compatible API</div>
8741    <pre>$body = @{
8742    prompt         = "a lovely cat, detailed fur, studio lighting"
8743    negative_prompt = ""
8744    width          = 1024
8745    height         = 1024
8746    steps          = 20
8747    cfg_scale      = 7
8748    sampler_name   = "Euler a"
8749} | ConvertTo-Json
8750
8751$response = Invoke-RestMethod \`
8752    -Uri "http://localhost:8081/sdapi/v1/txt2img" \`
8753    -Method Post \`
8754    -ContentType "application/json" \`
8755    -Body $body
8756
8757$bytes = [Convert]::FromBase64String($response.images[0])
8758[IO.File]::WriteAllBytes("E:\\models\\teste_sdxl_1024.png", $bytes)</pre>
8759  </div>
8760
8761  <h2>Full benchmark</h2>
8762
8763  <div class="bench-grid">
8764    <div class="bench-card">
8765      <div class="bench-phase">Conditioner (CLIP)</div>
8766      <div class="bench-time">~4s</div>
8767      <div class="bench-detail">CPU/RAM · CLIP-L + OpenCLIP-bigG</div>
8768    </div>
8769    <div class="bench-card">
8770      <div class="bench-phase">UNet sampling</div>
8771      <div class="bench-time">267s</div>
8772      <div class="bench-detail">20 steps · Euler A · 13.37s/it · RX 580 Vulkan</div>
8773    </div>
8774    <div class="bench-card">
8775      <div class="bench-phase">VAE decode</div>
8776      <div class="bench-time">~390s</div>
8777      <div class="bench-detail">49 tiles 32×32 · ~8s/tile · CPU/RAM</div>
8778    </div>
8779    <div class="bench-card">
8780      <div class="bench-phase">VRAM peak</div>
8781      <div class="bench-time">5.7 GB</div>
8782      <div class="bench-detail">of 8.0 GB available · 2.3 GB margin</div>
8783    </div>
8784    <div class="bench-card total">
8785      <div class="bench-phase">Total end-to-end</div>
8786      <div class="bench-time">662s · ~11 minutes</div>
8787      <div class="bench-detail">Peak temperature 67°C → 39°C idle · RAM used 17.7/31.8 GB</div>
8788    </div>
8789  </div>
8790
8791  <h2>Speed context</h2>
8792  <p>It is not fast. That is not the point.</p>
8793
8794  <table class="comparison-table">
8795    <thead><tr><th>Hardware</th><th>Stack</th><th>SDXL 1024×1024 Time</th></tr></thead>
8796    <tbody>
8797      <tr><td>RTX 4090</td><td>CUDA</td><td>~8s</td></tr>
8798      <tr><td>RTX 3080</td><td>CUDA</td><td>~25s</td></tr>
8799      <tr class="highlight-row"><td>RX 580 8GB (2017)</td><td>Vulkan · no CUDA · no ROCm</td><td>662s <span class="tag">works</span></td></tr>
8800      <tr><td>Pure CPU (Xeon E5-2690 v3)</td><td>AVX2</td><td>similar range to the setup above</td></tr>
8801    </tbody>
8802  </table>
8803
8804  <h2>Generated output</h2>
8805  <p>Prompt: <em>"a lovely cat, detailed fur, studio lighting"</em></p>
8806  <p>Result: Photorealistic Maine Coon, individual hairs visible, sharp eyes, bokeh, studio lighting with dramatic contrast. No artifacts, no noise, no black image. The VAE FP16 fix worked exactly as documented.</p>
8807
8808  <div class="result-box">
8809    <p>✓ SDXL 1.0 @ 1024×1024 — confirmed on RX 580 8GB via pure Vulkan. Hardware released in 2017, outside official ROCm support, without any proprietary vendor dependencies. The hybrid CPU/GPU split with --clip-on-cpu + --vae-on-cpu + --vae-tiling is the combination that makes this possible within 8 GB of VRAM.</p>
8810  </div>
8811
8812  <h2>The AMD Developer Community response</h2>
8813  <p>The benchmark was posted on the official AMD server with logs, Task Manager screenshots during inference, and the generated image, in direct response to POIZONE's question in the #rocm-ai-assistant channel. The reaction was immediate: <em>"wow, that was fast thanks alot, and also pretty good results"</em>.</p>
8814  <p>Subsequently, in response to a longer message about the project's motivation — access to legacy hardware, the abandonment of Polaris by ROCm and DirectML, and the philosophy that "hardware doesn't die, official support just disappears" — POIZONE commented: <em>"Today, someone who wanted to run local AI and couldn't — now can. That's what matters. — this is exactly why i like this idea"</em>.</p>
8815
8816  <h2>Model downloads</h2>
8817  <div class="code-block">
8818    <div class="code-label">PowerShell — download to E:\\models\\</div>
8819    <pre>cd E:\\models\\
8820
8821# SDXL base model (~6.9 GB)
8822curl.exe -L -o sd_xl_base_1.0.safetensors \`
8823  https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
8824
8825# VAE FP16 fix — mandatory (~319 MB)
8826curl.exe -L -o sdxl_vae-fp16-fix.safetensors \`
8827  https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors</pre>
8828  </div>
8829
8830  <div class="footer-note">
8831    AIVisionsLab · Section 26 of 36 · Hardware: AMD RX 580 8GB (2017) + Xeon E5-2690 v3 + 32 GB DDR4 ECC · Windows 10 Pro + WSL2 · stable-diffusion.cpp fork leejet · Vulkan backend · Tested and documented live in response to a challenge on the AMD Developer Community Discord.
8832  </div>
8833
8834</div>`},solucao:{id:"solucao",title:"04. A SOLUÇÃO — ARQUITETURA DUPLA",desc:"How we split processing between GPU Vulkan and WSL2 CPU to avoid Blue Screens.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"arquitetura",difficulty:"intermediate",estimated_time_min:15,tags:["vulkan-api","co-processamento","otimizacao-barramento"],last_reviewed:"2026-07-01",relationships:{prerequisites:["falhas"],previous:"falhas",next:"prereqs",related:["contexto","stack"]}},html:`<p>Since AMD didn't give us official tools, we created our own engineering:</p>
8835<ol style="color:#94a3b8; font-size:16px; line-height:1.8;">
8836  <li><strong>The Vulkan Engine (C++):</strong> We take the source code of Llama.cpp and Stable-Diffusion.cpp and compile it with the Vulkan flag. This makes the AI run directly on the GPU at maximum speed, bypassing AMD's locks.</li>
8837  <li><strong>The WSL2 Backup (Linux on Windows):</strong> For 16GB models (like FLUX.1) that would 'Blue Screen' due to lack of VRAM, we use Linux inside Windows. We offload processing to the Xeon and 32GB RAM. It takes time, but it doesn't crash.</li>
8838</ol>
8839<p style="color:#22c55e; font-weight:bold;">With this combo, we turned an 'obsolete' card into a state-of-the-art AI machine!</p>`},stack:{id:"stack",title:"20. MAPA DE SERVIÇOS DO STACK INTEGRADO",desc:"Infrastructure monitoring table, local traffic routing and active backends.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"monitoramento",difficulty:"beginner",estimated_time_min:10,tags:["network-stack","ports-mapping","security-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["animatediff-video"],previous:"animatediff-video",next:"scripts",related:["sd_bat_automation","scripts"]}},html:'<div class="tbl"><table><thead><tr><th>AI Service</th><th>Access Port</th><th>Protocol / Engine</th><th>Active Hardware Backend</th></tr></thead><tbody><tr><td><strong>Open WebUI</strong></td><td><code>:3000</code></td><td>Docker Container</td><td>WSL2 Virtualized Environment</td></tr><tr class="hig"><td><strong>llama-server</strong></td><td><code>:8081</code></td><td>Native ggml Executable</td><td>AMD Radeon RX 580 GPU (Vulkan 1.x)</td></tr><tr class="hig"><td><strong>sd-server</strong></td><td><code>:7860</code></td><td>Native ggml Executable</td><td>AMD Radeon RX 580 GPU (Vulkan 1.x)</td></tr><tr><td><strong>ComfyUI Server</strong></td><td><code>:8188</code></td><td>
8839Isolated Python Runtime</td><td>Xeon E5-2690 v3 CPU (Pure CPU Mode)</td></tr><tr><td><strong>Ollama Engine</strong></td><td><code>:11434</code></td><td>Contingency Service</td><td>Xeon E5-2690 v3 CPU (Pure CPU Mode)</td></tr></tbody></table></div>'},"troubleshoot-comfyui":{id:"troubleshoot-comfyui",title:"28. CATASTROFE DE MEMÓRIA NO COMFYUI WINDOWS",desc:"Handling physical VRAM allocation overflows and emergency use of paging flags.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["vram-spillfix","pagefile-allocation","comfyui-out-of-memory"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux-vulkan"],previous:"flux-vulkan",next:"comfyui-portable-amd",related:["comfyui-directml","comfyui-directml-func"]}},html:'<div class="err"><div class="err-t">Runtime Exception: RuntimeError: Could not allocate tensor with...</div><p style="margin-top:.35rem"><strong style="color:#e2e8f0">Failure Mechanism:</strong> Occurs when trying to run complex image flows on Windows using unstable acceleration backends that try to reserve more contiguous memory blocks than the card has free at the moment.</p><p style="margin-top:.35rem"><strong style="color:#fff">Survival Flags:</strong> Change the initialization file call by injecting the load fragmentation commands: <code>--lowvram</code> or <code>--normalvram</code>. This forces the ComfyUI manager to unload CLIP layers from video memory before initializing KSampler processing.</p></div>'},troubleshooting:{id:"troubleshooting",title:"27. GUIA DE RESOLUÇÃO DE PROBLEMAS (TROUBLESHOOTING)",desc:"Quick diagnostics to work around API timeout failures and null seeds on the server.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"geral",difficulty:"beginner",estimated_time_min:10,tags:["port-fixing","network-troubleshoot","timeout-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["cpu"],previous:"cpu",next:"flux-vulkan",related:["falhas","troubleshoot-comfyui"]}},html:'<div class="err"><div class="err-t">Critical Symptom: generate_image returned no results / Frozen terminal</div><p style="margin-top:.35rem"><strong style="color:#e2e8f0">Identified Cause:</strong> The <code>sd-server.exe</code> server has an intermittent numerical overflow bug when processing generations sent with the seed configured in random mode (Seed: -1).</p><p style="margin-top:.35rem"><strong style="color:#22c55e">Corrective Action:</strong> Inside the OpenWebUI interface, disable the dynamic seed key in the advanced prompt options and force a fixed valid integer value (Example: <code>42</code>, <code>1337</code>).</p></div>'}},es:{amihart:{id:"amihart",title:"31. MÉTODO AMIHART — INFERÊNCIA RX580 EM POLARIS/DEBIAN",desc:"Nota de Crédito: Sección documental en homenaje a la prueba de concepto realizada por 艾米心 (Amihart), pionera en validar Vulkan bajo Debian GCN4/Polaris.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:30,tags:["metodo-amihart","debian-polaris","vulkan-diagnostics"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comunidade"],previous:"comunidade",next:"dadhacks",related:["comunidade","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">En enero de 2025, el desarrollador <strong style="color:#fff">艾米心 (Amihart)</strong> publicó un estudio técnico demostrando que, a pesar de las limitaciones oficiales impuestas por AMD (fin del soporte oficial de ROCm para arquitecturas Polaris/GCN4), el hardware RX 580 aún posee pleno potencial de aceleración de IA.</p><div style="display:grid;grid-template-columns:1fr 1fr;gap:.85rem;margin-bottom:1.25rem"><div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid var(--r)"><p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">Enfoque AIVisionsLab (Windows Nativo)</p><ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8"><li>Ejecución en sistema host (Windows).</li><li>Enfoque en producción diaria de alta estabilidad.</li><li>Afinación de orquestación Vulkan nativo.</li><li>Segmentación híbrida VRAM/CPU en WSL.</li></ul></div><div class="card" style="border-left:3px solid #22c55e;padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid #22c55e"><p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">El Método Amihart (Linux/Debian)</p><ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8"><li>Ejecución en ecosistema Linux/Debian.</li><li>Aislamiento robusto vía contenedores Docker.</li><li>Compilación estricta con flags de Vulkan API.</li><li>Sandbox ROCm adaptado virtualizado.</li></ul></div></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. Setup de LLM — Vulkan en Debian</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">llama.cpp se compila con Vulkan API puro para sortear la ausencia del driver ROCm:</p><div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Paso 1: Instalar drivers Vulkan y prerrequisitos de compilación
8840sudo apt install vulkan-tools libtcmalloc-minimal4 libcurl4-openssl-dev glslc cmake make git pkg-config libvul
8840kan-dev
8841
8842# Paso 2: Clonar y compilar llama.cpp con Vulkan habilitado
8843cd ~
8844git clone https://github.com/ggerganov/llama.cpp
8845cd llama.cpp && mkdir build && cd build
8846cmake .. -DGGML_VULKAN=on -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=ON
8847
8848# Paso 3: Añadir binarios al PATH de ejecución
8849echo 'export PATH=$PATH:'$(realpath bin) >> ~/.bashrc
8850source ~/.bashrc
8851
8852# Paso 4: Ejecutar DeepSeek R1 8B (Aceleración Vulkan0)
8853llama-cli -m deepseek-r1:8B --device Vulkan0 -ngl 100</code></pre></div><p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Métrica de Desempeño (Amihart):</strong> En un Celeron G6900 operando sin GPU, la respuesta es de 5,45 tokens/s. Utilizando aceleración Vulkan pura en RX 580 con 100 capas offload, el rendimiento sube a <strong style="color:var(--r)">24,56 tokens/s</strong>, haciendo el modelo viable y ágil.</p><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">B. Setup de Stable Diffusion — Sandbox Docker</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Como los generadores de imagen exigen dependencias ROCm, Amihart utiliza contenedores virtuales aislados para correr la WebUI de forma limpia en Debian:</p><div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Paso 1: Instalación del motor Docker y claves estrictas
8854sudo apt update && sudo apt install -y ca-certificates curl
8855install -m 0755 -d /etc/apt/keyrings
8856curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
8857chmod a+r /etc/apt/keyrings/docker.asc
8858echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
8859sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io
8860
8861# Paso 2: Clonación de WebUI y ejecución bajo aislamiento ROCm gfx803
8862cd ~
8863git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
8864cd ~/stable-diffusion-webui
8865
8866sudo docker run -it \\
8867  --network=host --device=/dev/kfd --device=/dev/dri \\
8868  --ipc=host --shm-size 16G --group-add video \\
8869  --cap-add=SYS_PTRACE \\
8870  --rm -v $(pwd)/cache:/root/.cache \\
8871  -v $(pwd)/data:/stable-diffusion-webui/data \\
8872  woodrex/sd-webui-for-gfx803:latest</code></pre></div><p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Optimización Crítica del Caché Amihart:</strong> Para evitar recargas de dependencias todas las veces que el contenedor inicie:</p><div class="code" style="margin-bottom:1.5rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Obtener el CONTAINER ID activo
8873sudo docker ps -l
8874# Cometer el estado a una nueva imagen persistente
8875sudo docker commit [CONTAINER_ID]
8876# Ver el ID de la imagen persistida y sustituir la llamada de docker run por él
8877sudo docker images</code></pre></div><div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem"><strong style="color:var(--r)">Métricas y Referencias Técnicas:</strong> Ruteo basado en la publicación original de <a href="https://amihart.medium.com/inference-with-an-rx580-13e9c1055472" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">艾米心 (Amihart)</a> (Medium, Enero de 2025). El conocimiento es abierto y útil para la comunidad.</div>`},"animatediff-video":{id:"animatediff-video",title:"19. ANIMATEDIFF E INTERPOLAÇÃO DE QUADROS (VÍDEO)",desc:"Inyectando consistencia temporal en ComfyUI sobre hardware heredado para estructurar loops fluidos coprocesados en Intel Xeon.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"advanced",estimated_time_min:30,tags:["animatediff","geracao-video","motion-modules"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-modelos"],previous:"comfyui-modelos",next:"stack",related:["comfyui-flux","sdxl_vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">El <strong>AnimateDiff</strong> es un framework de modelado temporal proyectado específicamente para convert
8877ir modelos de difusión estática (como Stable Diffusion 1.5) en generadores de vídeo consistentes. Funciona inyectando módulos de atención temporal superpuestos en ComfyUI/WSL2. Esta técnica permite calcular transiciones de fotogramas adyacentes de forma matemáticamente coordinada, generando loops fluidos y eliminando los efectos estáticos caóticos de ruido centelleante.</p><div style="display:grid;grid-template-columns:1fr 1fr;gap:1.25rem;margin-bottom:1.5rem"><div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px"><div style="font-size:1.8rem">🎬</div><div><div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">Pipeline de Vídeo</div><div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#fff">AnimateDiff (WSL2 Pure CPU)</div><div style="font-size:.65rem;color:#64748b;margin-top:2px">24 Threads Intel Xeon E5</div></div></div><div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px"><div style="font-size:1.8rem">⏳</div><div><div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">Métrica de Procesamiento</div><div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#34d399">~141s por Segundo de Frame</div><div style="font-size:.65rem;color:#64748b;margin-top:2px">Renderizado temporal interpolado</div></div></div></div><div style="background:#0F1115;border:1px solid rgba(255,255,255,0.04);border-radius:6px;padding:1.5rem;margin-bottom:1.5rem"><h4 style="font-size:.85rem;color:#fff;text-transform:uppercase;letter-spacing:1px;margin-bottom:1rem;display:flex;align-items:center;gap:.5rem;margin-top:0"><span>🎥</span> Vitrina Interactiva de Generación (Breathe-Loop de Vídeo por Caché Local)</h4><p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">Abajo están representados los dos outputs renderizados por tu pila de IA local. Pasa el ratón para activar la sensación de vídeo interpolada, o haz clic en el botón simulador para iniciar el render sintético del Xeon:</p><div style="display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-bottom:1.25rem"><div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1"><img src="/images/cyberpunk_alley_0_1779586391528.png" alt="Cyberpunk Neon Alley" referrerPolicy="no-referrer" class="animatediff-img-1" style="width:100%;height:100%;object-fit:cover;transition:transform 8s ease-in-out, filter 2s ease;filter:brightness(0.9)" /><div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem"><span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span><span>CYBER_STREET_00.GIF</span></div><div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.75rem .5rem .5rem .75rem;display:flex;justify-content:space-between;align-items:center"><span style="font-family:monospace;font-size:9px;color:#64748b">Stable Diffusion 1.5</span><span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">VULKAN_OK</span></div></div><div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1"><img src="/images/cosmic_glass_0_1779586410888.png" alt="Cosmic Glass Flask" referrerPolicy="no-referrer" class="animatediff-img-2" style="width:100%;height:100%;object-fit:cover;transition:transform 6s ease-in-out, filter 3s ease;filter:brightness(0.85)" /><div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem"><span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span><span>ALCHEM_COSMOS_01.GIF</span></div><div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.5rem .75rem;display:flex;justify-content:space-between;align-items:center"><span style="font-family:monospace;font-size:9px;color:#64748b">Pure Xeon Model</span><span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">THREADED_OK</span></div></div></div><div style="text-align:center;margin-top:.5rem"><button onclick="toggleAnimateDiffSim(this)" style="background:rgba(239, 68, 68, 0.1);border:1px solid rgba(239, 68, 68, 0.4);border-radius:3px;color:#fca5a5;font-family:monospace;padding:.5rem 1rem;font-size:.72rem;cursor:pointer;transition:all 0.2s;text-transform:uppercase">▶ Activar Simulación de Movimiento</button></div><div id="sim-log-box" style="background:#07080a;border:1px solid rgba(255,255,255,0.01);border-radius:3px;padding:0.75rem;margin-top:1rem;font-family:monospace;font-size:10px;color:#475569;line-height:1.5;display:none;max-height:120px;overflow-y:auto;text-align:left"></div></div><style>
8877.video-preview-box:hover .animatediff-img-1{transform:scale(1.1) rotate(0.5deg);filter:brightness(1.1) saturate(1.15) !important}.video-preview-box:hover .animatediff-img-2{transform:scale(1.08) rotate(-0.5deg);filter:brightness(1.05) saturate(1.2) !important}.animate-active-1{animation:panCyberpunk 12s infinite alternate ease-in-out;filter:brightness(1.1) saturate(1.15) !important}.animate-active-2{animation:panGlass 10s infinite alternate ease-in-out;filter:brightness(1.05) saturate(1.2) !important}@keyframes panCyberpunk{0%{transform:scale(1);filter:hue-rotate(0deg)}50%{transform:scale(1.12) translate(5px, -3px);filter:hue-rotate(15deg)}100%{transform:scale(1.02) translate(-5px, 2px);filter:hue-rotate(-10deg)}}@keyframes panGlass{0%{transform:scale(1.02) rotate(0deg)}50%{transform:scale(1.15) translate(-2px, 4px) rotate(1deg);filter:hue-rotate(5deg)}100%{transform:scale(1.05) translate(4px, -2px) rotate(-0.5deg);filter:hue-rotate(-5deg)}}@keyframes heartbeat{0%,100%{opacity:0.4}50%{opacity:1}}.pulse-red{animation:heartbeat 1s infinite}</style>`},arquivos:{id:"arquivos",title:"35. TAXONOMIA E ESTRUTURA DE ARQUIVOS NVMe",desc:"Árbol de directorios unificado para rastrear binarios compilados y modelos compartidos.",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"armazenamento",difficulty:"beginner",estimated_time_min:10,tags:["nvme-struct","model-directories","storage-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proximos"],previous:"proximos",next:"meta",related:["comfyui-modelos","meta"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Organización estructural rigurosa de las rutas físicas mantenidas dentro de la partición de alta velocidad del SSD:</p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#e2e8f0;background:rgba(0,0,0,.3);padding:.9rem;border-radius:4px;border:1px solid var(--b)">E:\\
8878├── llama.cpp\\
8879│   └── build\\bin\\Release\\
8880│       ├── llama-server.exe     <span style="color:#64748b"># Servidor de Lenguaje Local</span>
8881│       └── llama-cli.exe        <span style="color:#64748b"># Utilitario de Diagnóstico</span>
8882├── stable-diffusion.cpp\\
8883│   └── build\\bin\\Release\\
8884│       ├── sd-server.exe        <span style="color:#64748b"># Servidor de Imagen Vulkan</span>
8885│       └── sd-cli.exe           <span style="color:#64748b"># Conversor de Modelos GGUF</span>
8886└── models\\
8887    ├── mistral-7b-instruct.Q4_K_M.gguf
8888    └── dreamshaper8.gguf        <span style="color:#64748b"># Checkpoint SD 1.5 Cuantizado</span></pre>`},audio_rvc:{id:"audio_rvc",title:"38. VOICE CONVERSION LOCAL — APPLIO RVC EM AMD RX 580 (Fases Iniciais)",desc:"Pipeline de clonagem de voz no Windows sem CUDA NVIDIA - Configuração do ambiente e primeiras fases.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:35,tags:["applio","rvc-voice-clone","sintese-audio"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linhatempo"],previous:"linhatempo",next:"audio_whisper",related:["audio_whisper","audio_srt_ptbr"]},part:1},html:`<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
8889  Documentação honesta de uma instalação real, incluindo todas as tentativas, erros e soluções.<br />
8890  Conduzida em duas sessões: ChatGPT (fases iniciais) + Claude (fases finais).
8891</blockquote>
8892
8893<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">CONTEXTO DO PROJETO</h3>
8894<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O objetivo era montar um pipeline de produção audiovisual para canal do YouTube estilo dark/documentário:</p>
8895<div class="code" style="margin-bottom:1.25rem">
8896  <pre><code>Texto → Balabolka + Antônio Neural (TTS) → WAV → Applio/RVC → Yuri (voz clonada)</code></pre>
8897</div>
8898<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A ideia central: separar <strong>atuação</strong> de <strong>identidade vocal</strong>.</p>
8899<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
8900  <li><strong style="color:#fff">Antônio Neural</strong> faz a interpretação, prosódia e emoção (voz Microsoft Neural)</li>
8901  <li><strong style="color:#fff">Yuri</strong> (modelo RVC treinado) aplica a identidade vocal por cima</li>
8902</ul>
8903<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.5rem">Isso produz resultado muito mais natural que TTS generativo puro.</p>
8904
8905<div class="tbl" style="margin-bottom:1.5rem">
8906  <table>
8907    <thead>
8908      <tr>
8909        <th>Aspecto</th>
8910        <th>XTTS/TTS puro</th>
8911        <th>Antônio → Yuri (RVC)</th>
8912      </tr>
8913    </thead>
8914    <tbody>
8915      <tr>
8916        <td>Prosódia</td>
8917        <td>Artificial</td>
8918        <td>Humana (ator real)</td>
8919      </tr>
8920      <tr>
8921        <td>Termos técnicos</td>
8922        <td>Tropeça</td>
8923        <td>Lê corretamente</td>
8924      </tr>
8925      <tr>
8926        <td>Textos longos</td>
8927        <td>Degrada</td>
8928        <td>Estável</td>
8929      </tr>
8930      <tr>
8931        <td>Identidade vocal</td>
8932        <td>Genérica</td>
8933        <td>Clonada</td>
8934      </tr>
8935      <tr>
8936        <td>Naturalidade</td>
8937        <td>60-70%</td>
8938        <td>80-95%</td>
8939      </tr>
8940    </tbody>
8941  </table>
8942</div>
8943
8944<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">HARDWARE UTILIZADO</h3>
8945<div class="tbl" style="margin-bottom:1.5rem">
8946  <table>
8947    <thead>
8948      <tr>
8949        <th>Item</th>
8950        <th>Especificação</th>
8951      </tr>
8952    </thead>
8953    <tbody>
8954      <tr>
8955        <td>CPU</td>
8956        <td>Intel Xeon E5-2690 v3 (24 núcleos)</td>
8957      </tr>
8958      <tr>
8959        <td>GPU</td>
8960        <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
8961      </tr>
8962      <tr>
8963        <td>RAM</td>
8964        <td>31.8 GB DDR4 REG ECC</td>
8965      </tr>
8966      <tr>
8967        <td>OS</td>
8968        <td>Windows 11</td>
8969      </tr>
8970      <tr>
8971        <td>Storage</td>
8972        <td>SSD NVMe (E:)</td>
8973      </tr>
8974      <tr>
8975        <td>Python</td>
8976        <td>3.11.9</td>
8977      </tr>
8978    </tbody>
8979  </table>
8980</div>
8981
8982<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 0 — TENTATIVA COM DATASET DO ANTÔNIO (fracasso documentado)</h3>
8983<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A ideia original era treinar o modelo RVC com horas de áudio do Antônio Neural. Foi criado um script <code>split.py</code> com Whisper para segmentar automaticamente o áudio em clips de 6-12 segundos.</p>
8984<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-bottom:0.5rem"><strong>O problema: estouro de memória</strong></p>
8985<div class="code" style="margin-bottom:1.25rem">
8986  <pre><code>MemoryError
8987concurrent.futures.process.BrokenProcessPool</code></pre>
8988</div>
8989<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O pré-processamento de dataset grande (~2h34 de áudio) estourou RAM e VRAM simultaneamente. Mesmo quando terminava, o volume de 1000+ clips causava instabilidade no pipeline do Applio.</p>
8990<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem"><strong>Decisão:</strong> abandonar o dataset do Antônio e usar diretamente <strong>9 minutos de TTS do ElevenLabs</strong> com a voz do Yuri. Menor, mais limpo, mais controlado.</p>
8991
8992<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 1 — INSTALAÇÃO DO AMBIENTE BASE</h3>
8993<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Estrutura de pastas:</strong></p>
8994<div class="code" style="margin-bottom:1.25rem">
8995  <pre><code>E:\\tts-audio_pra_youtube\\
8996├── Applio\\
8997├── voices\\
8998│   └── YURI-TTS.wav  (9 minutos, ElevenLabs, voz Yuri)
8999├── output\\
9000└── scripts\\</code></pre>
9001</div>
9002
9003<div class="err" style="margin-bottom:1.25rem">
9004  <div class="err-t">⚠️ Problema: Python 3.10 incompatível</div>
9005  <p>O Applio moderno exige Python 3.11+. O numpy 2.4.4 requerido não existe para 3.10.</p>
9006</div>
9007
9008<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução:</strong> instalar Python 3.11 em paralelo sem remover o 3.10:</p>
9009<div class="code" style="margin-bottom:1.25rem">
9010  <span class="code-lang">powershell</span>
9011  <pre><code>py -0
9012# -V:3.11  Python 3.11 (64-bit)   ← usar esta
9013# -V:3.10  Python 3.10 (64-bit)   ← manter para outros projetos
9014
9015py -3.11 -m venv venv
9016venv\\Scripts\\activate
9017python --version
9018# Python 3.11.9  ✅</code></pre>
9019</div>
9020
9021<div class="err" style="margin-bottom:1.25rem">
9022  <div class="err-t">⚠️ Problema: requirements.txt com CUDA forçado</div>
9023  <div class="code" style="margin-top:0.5rem;margin-bottom:0.5rem">
9024    <pre><code># O Applio traz esta linha que quebra no AMD Windows:
9025torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'</code></pre>
9026  </div>
9027  <p>O sufixo <code>+cu128</code> é CUDA 12.8 exclusivo NVIDIA. No Windows (<code>win32</code>), essa condição sempre é verdadeira.</p>
9028</div>
9029
9030<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução:</strong> editar o <code>requirements.txt</code>:</p>
9031<div class="code" style="margin-bottom:1.25rem">
9032  <pre><code># REMOVER:
9033torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
9034torchaudio==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
9035torchvision==0.22.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
9036
9037# SUBSTITUIR POR:
9038torch==2.7.1; sys_platform == 'win32'
9039torchaudio==2.7.1; sys_platform == 'win32'
9040torchvision==0.22.1; sys_platform == 'win32'</code></pre>
9041</div>
9042
9043<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 2 — TENTATIVA DIRECTML (fracasso documentado)</h3>
9044<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Com o Applio rodando em CPU (~10 min por época), tentou-se acelerar com DirectML.</p>
9045<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Instalação e teste:</strong></p>
9046<div class="code" style="margin-bottom:1.25rem">
9047  <span class="code-lang">powershell</span>
9048  <pre><code>pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
9049pip install torch-directml
9050
9051python -c "import torch_directml; dml = torch_directml.device(); print(dml)"
9052# privateuseone:0  ✅  — RX 580 reconhecida</code></pre>
9053</div>
9054<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Resultado real:</strong></p>
9055<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
9056  <li>GPU uso: 7-10%</li>
9057  <li>VRAM: 1.2GB usada</li>
9058  <li>Velocidade com DirectML: <strong>4.27s/it</strong></li>
9059  <li>Velocidade sem DirectML (CPU): <strong>4.46s/it</strong></li>
9060  <li>Diferença real: <strong>~5%</strong> — irrelevante</li>
9061</ul>
9062<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Por que foi abandonado:</strong></p>
9063<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O <code>torch-directml</code> está preso na versão <code>0.2.5.dev240914</code> (setembro 2024) e exige <code>torch==2.4.1</code>. O Applio precisa de <code>torch==2.7.1</code>. Conflito irreconciliável:</p>
9064<div class="code" style="margin-bottom:1.25rem">
9065  <pre><code>torch-directml 0.2.5 requires torch==2.4.1
9066hyper-connections 0.4.11 requires torch>=2.5   ← conflito
9067torch-einops-utils 0.1.1 requires torch>=2.5   ← conflito</code></pre>
9068</div>
9069<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A Microsoft parou de investir no DirectML para IA. O projeto está essencialmente abandonado.</p>
9070<p style="font-size:.88rem;color:#10b981;line-height:1.9;margin-bottom:1.25rem">✅ <strong>Conclusão:</strong> DirectML para RVC em Windows AMD em 2026 = não vale a pena.</p>
9071
9072
9073</div>
9074<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 3 — ERRO CRÍTICO: VARIÁVEIS DE AMBIENTE</h3>
9075<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Durante tentativas de forçar CPU, foram usados comandos que <strong>silenciosamente quebravam a extração de características</strong>:</p>
9076<div class="code" style="margin-bottom:1.25rem">
9077  <span class="code-lang">powershell</span>
9078  <pre><code># ❌ NUNCA FAZER ISSO com Applio AMD:
9079set USE_DIRECTML=0
9080set CUDA_VISIBLE_DEVICES=-1
9081set ROCM_VISIBLE_DEVICES=-1
9082set HIP_VISIBLE_DEVICES=-1</code></pre>
9083</div>
9084<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Esses comandos deixavam a pasta <code>extracted</code> vazia após a extração. O treino terminava em <strong>segundos</strong> dizendo "Model trained successfully" sem gerar nenhum <code>.pth</code>.</p>
9085<div class="code" style="margin-bottom:1.25rem">
9086  <pre><code>Not enough data present in the training set.
9087Feature files in logs\\my-project\\extracted could not be loaded correctly.</code></pre>
9088</div>
9089<div class="err" style="margin-bottom:1.25rem">
9090  <div class="err-t">⚠️ Armadilha: "Model trained successfully" em segundos = treino fake.</div>
9091  <p>Sempre verificar se <code>logs/projeto/extracted/</code> tem arquivos <code>.npy</code> antes de treinar.</p>
9092</div>
9093
9094<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 4 — INSTALAÇÃO LIMPA (solução final)</h3>
9095<div class="code" style="margin-bottom:1.25rem">
9096  <span class="code-lang">powershell</span>
9097  <pre><code># 1. Destruir ambiente corrompido
9098deactivate
9099Remove-Item -Recurse -Force venv
9100Remove-Item -Recurse -Force logs
9101
9102# 2. Criar venv limpo
9103py -3.11 -m venv venv
9104venv\\Scripts\\activate
9105python -m pip install --upgrade pip
9106
9107# 3. Instalar torch base
9108pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
9109pip install torch-directml
9110
9111# 4. Instalar dependências sem sobrescrever torch
9112pip install -r requirements.txt --no-deps
9113
9114# 5. Corrigir dependências faltantes
9115pip install gradio-client==1.14.0
9116pip install cffi soupsieve local-attention
9117pip install "aiofiles&lt;25.0" "pandas&lt;3.0" "pydantic&lt;=2.12.3"
9118pip install "starlette&lt;1.0,&gt;=0.40.0" "tomlkit&lt;0.14.0"
9119pip install "tokenizers&gt;=0.22.0,&lt;=0.23.0"
9120pip install audioread decorator lazy-loader msgpack pooch scikit-learn resampy</code></pre>
9121</div>
9122<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>config.py — versão final (sem DirectML):</strong></p>
9123<div class="code" style="margin-bottom:1.25rem">
9124  <span class="code-lang">python</span>
9125  <pre><code>import torch
9126import json
9127import os
9128
9129@singleton
9130class Config:
9131    def __init__(self):
9132        self.device = "cuda:0" if torch.cuda.is_available() else "cpu"
9133        # No AMD Windows sem CUDA, usa "cpu" automaticamente</code></pre>
9134</div>
9135<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Iniciar:</strong></p>
9136<div class="code" style="margin-bottom:1.25rem">
9137  <span class="code-lang">powershell</span>
9138  <pre><code># PowerShell LIMPO, sem nenhum 'set' antes
9139python app.py
9140# * Running on local URL: http://127.0.0.1:6969  ✅</code></pre>
9141</div>
9142
9143<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 5 — ARQUIVOS MUTE FALTANDO</h3>
9144<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Na instalação via git, os arquivos de silêncio não são criados. Aparecem um por um durante o treino:</p>
9145<div class="code" style="margin-bottom:1.25rem">
9146  <pre><code>FileNotFoundError: logs\\mute\\sliced_audios\\mute40000.wav
9147FileNotFoundError: logs\\mute\\extracted\\mute.npy          ← shape errado causa crash
9148FileNotFoundError: logs\\mute\\f0\\mute.wav.npy
9149FileNotFoundError: logs\\mute\\f0_voiced\\mute.wav.npy
9150RuntimeError: tensor (100) must match size (768)</code></pre>
9151</div>
9152<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução — criar todos de uma vez:</strong></p>
9153<div class="code" style="margin-bottom:1.25rem">
9154  <span class="code-lang">powershell</span>
9155  <pre><code>python -c "
9156import numpy as np, soundfile as sf, os
9157[os.makedirs(d, exist_ok=True) for d in [
9158    'logs/mute/sliced_audios','logs/mute/extracted',
9159    'logs/mute/f0','logs/mute/f0_voiced'
9160]]
9161sf.write('logs/mute/sliced_audios/mute40000.wav', np.zeros(int(40000*3.7)), 40000)
9162sf.write('logs/mute/sliced_audios/mute48000.wav', np.zeros(int(48000*3.7)), 48000)
9163sf.write('logs/mute/sliced_audios/mute32000.wav', np.zeros(int(32000*3.7)), 32000)
9164np.save('logs/mute/extracted/mute.npy', np.zeros((196, 768)))
9165np.save('logs/mute/f0/mute.wav.npy', np.zeros(100))
9166np.save('logs/mute/f0_voiced/mute.wav.npy', np.zeros(100))
9167print('OK')
9168"</code></pre>
9169</div>
9170<div class="err" style="margin-bottom:1.25rem">
9171  <div class="err-t">⚠️ Crítico: mute.npy precisa ter shape (196, 768)</div>
9172  <p>dimensão 768 do embedder contentvec. Qualquer outro shape causa crash.</p>
9173</div>
9174
9175<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">
9175FASE 6 — DATASET E TREINO</h3>
9176<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Dataset usado:</strong></p>
9177<div class="tbl" style="margin-bottom:1.5rem">
9178  <table>
9179    <thead>
9180      <tr>
9181        <th>Parâmetro</th>
9182        <th>Valor</th>
9183      </tr>
9184    </thead>
9185    <tbody>
9186      <tr>
9187        <td>Arquivo</td>
9188        <td>YURI-TTS.wav</td>
9189      </tr>
9190      <tr>
9191        <td>Duração</td>
9192        <td>9 minutos</td>
9193      </tr>
9194      <tr>
9195        <td>Fonte</td>
9196        <td>ElevenLabs TTS</td>
9197      </tr>
9198      <tr>
9199        <td>Nota</td>
9200        <td>Mínimo aceitável. Ideal: 15-25 min</td>
9201      </tr>
9202    </tbody>
9203  </table>
9204</div>
9205
9206<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Configurações do Applio:</strong></p>
9207<div class="tbl" style="margin-bottom:1.5rem">
9208  <table>
9209    <thead>
9210      <tr>
9211        <th>Parâmetro</th>
9212        <th>Valor</th>
9213      </tr>
9214    </thead>
9215    <tbody>
9216      <tr>
9217        <td>Taxa de amostragem</td>
9218        <td>40000 Hz</td>
9219      </tr>
9220      <tr>
9221        <td>Vocoder</td>
9222        <td>HiFi-GAN</td>
9223      </tr>
9224      <tr>
9225        <td>Algoritmo de pitch</td>
9226        <td>RMVPE</td>
9227      </tr>
9228      <tr>
9229        <td>Embedder</td>
9230        <td>contentvec</td>
9231      </tr>
9232      <tr>
9233        <td>Tamanho do lote</td>
9234        <td>4</td>
9235      </tr>
9236      <tr>
9237        <td>Total de épocas</td>
9238        <td>200</td>
9239      </tr>
9240      <tr>
9241        <td>Número da GPU</td>
9242        <td><strong>vazio</strong> (não colocar 0, -1 ou cpu)</td>
9243      </tr>
9244    </tbody>
9245  </table>
9246</div>
9247
9248<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Métricas reais:</strong></p>
9249<div class="tbl" style="margin-bottom:1.5rem">
9250  <table>
9251    <thead>
9252      <tr>
9253        <th>Época</th>
9254        <th>Loss</th>
9255        <th>Tempo por época</th>
9256      </tr>
9257    </thead>
9258    <tbody>
9259      <tr>
9260        <td>1</td>
9261        <td>27.181</td>
9262        <td>7:21</td>
9263      </tr>
9264      <tr>
9265        <td>8</td>
9266        <td>17.93</td>
9267        <td>7:02</td>
9268      </tr>
9269      <tr>
9270        <td>20</td>
9271        <td>16.212</td>
9272        <td>7:43</td>
9273      </tr>
9274      <tr>
9275        <td>43</td>
9276        <td>15.785</td>
9277        <td>5:43</td>
9278      </tr>
9279    </tbody>
9280  </table>
9281</div>
9282<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
9283  <li>Velocidade: ~6 minutos por época</li>
9284  <li>Total: ~20 horas para 200 épocas</li>
9285  <li>Hardware efetivo: CPU Xeon 24 núcleos</li>
9286</ul>
9287<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
9288  <strong>ℹ️ Buffer do PowerShell:</strong> de treino overnight o terminal pode parecer travado. O treino continua normalmente — verificar o contador no Applio.
9289</blockquote>
9290
9291<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">LIÇÕES APRENDIDAS</h3>
9292<p style="font-size:.88rem;color:#10b981;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">✅ O que funciona:</p>
9293<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
9294  <li>Applio + CPU puro no AMD Windows — estável e funcional</li>
9295  <li>Python 3.11 obrigatório (não 3.10)</li>
9296  <li><code>requirements.txt</code> editado — remover <code>+cu128</code></li>
9297  <li>PowerShell limpo — sem variáveis <code>CUDA_VISIBLE_DEVICES</code></li>
9298  <li>Arquivos mute criados manualmente antes do treino</li>
9299  <li>Campo "Número da GPU" <strong>vazio</strong> no Applio</li>
9300</ol>
9301<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">❌ O que não funciona:</p>
9302<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
9303  <li>DirectML + torch 2.7.1 — incompatível em 2026</li>
9304  <li><code>set CUDA_VISIBLE_DEVICES=-1</code> — quebra a extração de features</li>
9305  <li><code>pip install -r requirements.txt</code> sem editar — instala CUDA e falha</li>
9306  <li>Dataset grande (horas de áudio) — estouro de RAM/VRAM</li>
9307</ol>
9308
9309<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">PIPELINE FINAL DE PRODUÇÃO</h3>
9310<div class="code" style="margin-bottom:1.25rem">
9311  <pre><code>1. Escrever roteiro
9312   ↓
93132. Balabolka + Antônio Neural → WAV com interpretação humana
9314   ↓
93153. Applio — Inferência
9316   Modelo: my-project_200e.pth
9317   Índice: my-project.index
9318   ↓
93194. Output: WAV com voz do Yuri
9320   ↓
93215. Edição e publicação no YouTube</code></pre>
9322</div>
9323<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Velocidade de inferência (pós-treino):</strong></p>
9324<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
9325  <li>~5-30 segundos por minuto de áudio</li>
9326  <li>2 horas de áudio → ~30 minutos de processamento</li>
9327  <li>Modo Lote disponível no Applio</li>
9328</ul>
9329
9330<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">CHECKLIST — REPRODUZINDO DO ZERO</h3>
9331<ul style="list-style-type:none;padding-left:0;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
9332  <li><span style="color:#475569">[ ]</span> Python 3.11 instalado</li>
9333  <li><span style="color:#475569">[ ]</span> Git instalado</li>
9334  <li><span style="color:#475569">[ ]</span> FFmpeg no PATH</li>
9335  <li><span style="color:#475569">[ ]</span> Dataset WAV limpo (mínimo 5 min, ideal 15-25 min)</li>
9336  <li><span style="color:#475569">[ ]</span> <code>requirements.txt</code> editado (remover <code>+cu128</code>)</li>
9337  <li><span style="color:#475569">[ ]</span> <code>config.py</code> sem referências ao <code>torch_directml</code></li>
9338  <li><span style="color:#475569">[ ]</span> Arquivos mute criados</li>
9339  <li><span style="color:#475569">[ ]</span> PowerShell limpo (sem <code>set CUDA_VISIBLE_DEVICES</code>)</li>
9340  <li><span style="color:#475569">[ ]</span> Campo "Número da GPU" <strong>vazio</strong> no Applio</li>
9341  <li><span style="color:#475569">[ ]</span> Após extração: verificar que <code>logs/projeto/extracted/</code> tem arquivos <code>.npy</code></li>
9342</ul>
9343
9344<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">AMD vs NVIDIA EM IA — POSIÇÃO DO APPLIO/RVC (2026)</h3>
9345<div class="tbl" style="margin-bottom:1.5rem">
9346  <table>
9347    <thead>
9348      <tr>
9349        <th>Plataforma</th>
9350        <th>Situação</th>
9351      </tr>
9352    </thead>
9353    <tbody>
9354      <tr>
9355        <td>NVIDIA CUDA</td>
9356        <td>✅ Excelente — suporte nativo</td>
9357      </tr>
9358      <tr>
9359        <td>AMD ROCm Linux</td>
9360        <td>⚠️ Razoável — funciona com esforço</td>
9361      </tr>
9362      <tr>
9363        <td>AMD Windows DirectML</td>
9364        <td>❌ Abandonado</td>
9365      </tr>
9366      <tr>
9367        <td>AMD Windows CPU</td>
9368        <td>✅ Funcional — lento mas estável</td>
9369      </tr>
9370    </tbody>
9371  </table>
9372</div>
9373<p style="font-size:.85rem;color:#94a3b8;font-style:italic;line-height:1.8"><em>*Hardware legado não morre — só precisa do backend certo.</em></p>`},audio_srt_ptbr:{id:"audio_srt_ptbr",title:"40. PIPELINE COMPLETO — TRANSCRIÇÃO + TRADUÇÃO PT-BR COM RX 580",desc:"Transcrição de vídeo em inglês com tradução automática para português brasileiro, do .mp4 ao .srt sem nenhum serviço pago.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:25,tags:["srt-generation","automacao-srt","ffmpeg-pipeline"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linux_nativo"],previous:"linux_nativo",next:"limit_qwen_35b",related:["audio_whisper","limit_qwen_35b"]},part:1}
9373,html:`<div class="whisper-doc">
9374  <div class="hero">
9375    <div class="hero-title"><span>Pipeline Completo</span> — Transcrição + Tradução EN➔PT-BR</div>
9376    <div class="hero-sub">Transcrição offline de vídeo em inglês com tradução automática para português brasileiro, do <code>.mp4</code> ao <code>.srt</code> de forma 100% gratuita usando a RX 580 via Vulkan.</div>
9377    <div class="hero-badges">
9378      <span class="badge badge-gpu">AMD RX 580 8GB</span>
9379      <span class="badge badge-win">Windows + PowerShell</span>
9380      <span class="badge badge-ok">Vulkan Backend</span>
9381      <span class="badge badge-ok">large-v3-turbo</span>
9382      <span class="badge badge-win">deep-translator (Gratuito)</span>
9383    </div>
9384  </div>
9385
9386  <div class="stat-grid">
9387    <div class="stat">
9388      <div class="stat-label">tempo total pipeline</div>
9389      <div class="stat-value">~8 min</div>
9390      <div class="stat-sub">Vídeo de 29m 51s</div>
9391    </div>
9392    <div class="stat">
9393      <div class="stat-label">VRAM Usada</div>
9394      <div class="stat-value">2.9 GB</div>
9395      <div class="stat-sub">de 8 GB Polaris</div>
9396    </div>
9397    <div class="stat">
9398      <div class="stat-label">Temp. Média GPU</div>
9399      <div class="stat-value">50°C</div>
9400      <div class="stat-sub">Fan Curve Otimizada</div>
9401    </div>
9402    <div class="stat">
9403      <div class="stat-label">Custo Cloud</div>
9404      <div class="stat-value">R$ 0,00</div>
9405      <div class="stat-sub">100% Local & Offline</div>
9406    </div>
9407  </div>
9408
9409  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Hardware Utilizado no Teste</h3>
9410  <div class="tbl">
9411    <table>
9412      <thead>
9413        <tr>
9414          <th>Componente</th>
9415          <th>Especificação</th>
9416        </tr>
9417      </thead>
9418      <tbody>
9419        <tr>
9420          <td><strong>GPU</strong></td>
9421          <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
9422        </tr>
9423        <tr>
9424          <td><strong>CPU</strong></td>
9425          <td>Intel Xeon E5-2690 v3 (24 threads / 12 Cores)</td>
9426        </tr>
9427        <tr>
9428          <td><strong>RAM</strong></td>
9429          <td>31.8 GB DDR4 REG ECC</td>
9430        </tr>
9431        <tr>
9432          <td><strong>OS</strong></td>
9433          <td>Windows 11 Professional</td>
9434        </tr>
9435        <tr>
9436          <td><strong>Driver</strong></td>
9437          <td>Adrenalin 31.0.21925.1001 (2026/05/20)</td>
9438        </tr>
9439      </tbody>
9440    </table>
9441  </div>
9442
9443  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Fluxo de Dados Unificado (Pipeline)</h3>
9444  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
9445    O objetivo é mapear um vídeo educacional em inglês para legenda em português compatível com software editor de vídeo (Filmora, Premiere, etc.), rodando a transcrição via GPU nativa e traduzindo cada timestamp sem limites de API de nuvem comercial:
9446  </p>
9447  <div class="cmd" style="white-space:normal; line-height:1.6; padding: 1rem;">
9448    <strong>video.mp4</strong> ➔ <code>FFmpeg (extração)</code> ➔ <strong>video_16k.wav</strong><br>
9449    ➔ <code>whisper-cli Vulkan (transcrição)</code> ➔ <strong>video.srt (English)</strong><br>
9450    ➔ <code>Python deep-translator (Google Translate)</code> ➔ <strong>video_ptbr.srt (Português)</strong><br>
9451    ➔ <code>Importar na Timeline do Filmora</code>
9452  </div>
9453
9454  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Performance e Timing Detalhado</h3>
9455  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
9456    Métricas reais obtidas transcrição de um vídeo educacional de <strong>29 minutos e 51 segundos</strong> (áudio em inglês, AAC, 480x360):
9457  </p>
9458  <div class="tbl" style="margin-bottom:1.5rem">
9459    <table>
9460      <thead>
9461        <tr>
9462          <th>Etapa do Pipeline</th>
9463          <th>Ferramenta</th>
9464          <th>Tempo Gasto</th>
9465        </tr>
9466      </thead>
9467      <tbody>
9468        <tr>
9469          <td><strong>1. Extração de Áudio WAV Sem Compressão</strong></td>
9470          <td>FFmpeg</td>
9471          <td><strong>1.7 segundos</strong></td>
9472        </tr>
9473        <tr>
9474          <td><strong>2. Transcrição de Áudio (EN)</strong></td>
9475          <td>Whisper.cpp + Vulkan</td>
9476          <td><strong>6 minutos e 07 segundos</strong></td>
9477        </tr>
9478        <tr>
9479          <td><strong>3. Tradução em Bloco do SRT (EN➔PT-BR)</strong></td>
9480          <td>Python + <code>deep-translator</code></td>
9481          <td><strong>~2 minutos</strong> (limitação de I/O de rede)</td>
9482        </tr>
9483        <tr style="border-top:1px solid rgba(255,255,255,0.15)">
9484          <td><strong>Métrica Total Consolidade</strong></td>
9485          <td><strong>Pipeline Completo</strong></td>
9486          <td><strong>~8 minutos</strong></td>
9487        </tr>
9488      </tbody>
9489    </table>
9490  </div>
9491
9492  <h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">Timings Internos do Core (whisper_print_timings)</h4>
9493  <div class="card bg-black/40 border border-white/5 p-4 rounded-md my-3 font-mono text-xs text-[#a7f3d0] leading-relaxed">
9494    load modelo : 3.687 ms<br>
9495    mel (áudio) : 2.305 ms<br>
9496    encode GPU  : 204.689 ms<br>
9497    decode      : 4.081 ms<br>
9498    batch total : 108.675 ms<br>
9499    total       : 367.432 ms (por batch de segmentação)
9500  </div>
9501
9502  <div class="section-title">Manual de Instruções Passo a Passo</div>
9503
9504  <div class="step">
9505    <div class="step-header">
9506      <div class="step-num">1</div>
9507      <div class="step-name">Extrair Áudio Compatível via FFmpeg</div>
9508      <div class="step-desc">WAV 16kHz Mono 16-bit</div>
9509    </div>
9510    <div class="step-body">
9511      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">O Whisper necessita estritamente de áudio WAV cru em 16.000 Hz, formato mono de 16 bits:</p>
9512      <div class="cmd">ffmpeg -i "E:\\MUSICAS SUNO AI\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\MUSICAS SUNO AI\\video_16k.wav"</div>
9513      <p class="note"><strong>Flags:</strong> <code>-ar 16000</code> força 16kHz · <code>-ac 1</code> converte para canal mono único · <code>-c:a pcm_s16le</code> define PCM de 16 bits sem perda.</p>
9514    </div>
9515  </div>
9516
9517  <div class="step">
9518    <div class="step-header">
9519      <div class="step-num">2</div>
9520      <div class="step-name">Transcrever via Vulkan</div>
9521      <div class="step-desc">
9521Carga pesada na GPU Polaris</div>
9522    </div>
9523    <div class="step-body">
9524      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">Chamar o executável compilado do Whisper para gerar o arquivo inicial de legendas SRT em inglês:</p>
9525      <div class="cmd">cd C:\\whisper.cpp</div>
9526      <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\MUSICAS SUNO AI\\video_16k.wav" -l en --output-srt</div>
9527      <p class="note"><strong>Verificação de atividade da GPU:</strong> Certifique-se de ver as linhas <code>ggml_vulkan: Found 1 Vulkan devices: AMD Radeon RX 580 2048SP</code> na inicialização para atestar que o encode pesado foi acoplado na GPU, reduzindo o uso de CPU para ~5%.</p>
9528    </div>
9529  </div>
9530
9531  <div class="step">
9532    <div class="step-header">
9533      <div class="step-num">3</div>
9534      <div class="step-name">Criar e Executar Script Python de Tradução</div>
9535      <div class="step-desc">Zero Keys, Zero Custos</div>
9536    </div>
9537    <div class="step-body">
9538      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">
9539        Instale a biblioteca de tradução sem chaves de API: <code>pip install deep-translator</code>. Crie e rode o arquivo <code>C:\\whisper.cpp\\traduzir.py</code> com este código:
9540      </p>
9541      <div class="cmd" style="white-space:pre-wrap; font-size:11px;">from deep_translator import GoogleTranslator
9542
9543def traduzir_srt(entrada, saida):
9544    with open(entrada, 'r', encoding='utf-8') as f:
9545        conteudo = f.read()
9546
9547    blocos = conteudo.strip().split('\\n\\n')
9548    resultado = []
9549
9550    for bloco in blocos:
9551        linhas = bloco.split('\\n')
9552        if len(linhas) >= 3:
9553            numero = linhas[0]
9554            timestamp = linhas[1]
9555            texto = ' '.join(linhas[2:])
9556            traduzido = GoogleTranslator(source='en', target='pt').translate(texto)
9557            resultado.append(f"{numero}\\n{timestamp}
9557\\n{traduzido}")
9558
9559    with open(saida, 'w', encoding='utf-8') as f:
9560        f.write('\\n\\n'.join(resultado))
9561    print("Pronto!")
9562
9563traduzir_srt(
9564    r'E:\\MUSICAS SUNO AI\\video_16k.wav.srt',
9565    r'E:\\MUSICAS SUNO AI\\video_16k_ptbr.srt'
9566)</div>
9567<p style="font-size:0.8rem;color:#94a3b8;margin-top:0.5rem">Para ejecutar:</p>
9568      <div class="cmd">python traduzir.py</div>
9569    </div>
9570  </div>
9571
9572  <div class="step">
9573    <div class="step-header">
9574      <div class="step-num">4</div>
9575      <div class="step-name">Importar subtítulos en Filmora</div>
9576      <div class="step-desc">Finalizar edición de video</div>
9577    </div>
9578    <div class="step-body">
9579      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6">
9580        1. En Wondershare Filmora, acceda a <strong>Archivo ➔ Importar ➔ Importar archivos de subtítulos</strong>.<br>
9581        2. Seleccione el archivo generado <code>video_16k_ptbr.srt</code>.<br>
9582        3. Arrastre y suelte la pista de subtítulos directamente en la línea de tiempo, superpuesta a la pista de video original.
9583      </p>
9584    </div>
9585  </div>
9586
9587  <div class="section-title">Lecciones autónomas aprendidas en las peripecias</div>
9588  <div class="card-inner">
9589    <div class="lesson">
9590      <div class="lesson-icon">⚠️</div>
9591      <div class="lesson-text"><strong>Evite usar --translate para español directamente en las flags de Whisper:</strong> El parámetro <code>--translate</code> por diseño traduce el audio al inglés de forma nativa. Para obtener subtítulos en español de calidad, el enfoque correcto es extraer en inglés mediante <code>-l en</code> y traducir con el algoritmo <code>traduzir.py</code>.</div>
9592    </div>
9593    <div class="lesson">
9594      <div class="lesson-icon">⚠️</div>
9595      <div class="lesson-text"><strong>Problemas de idioma de origen incorrecto:</strong> Pasar <code>-l pt</code> cuando el audio de origen está hablado en inglés hace que Whisper fuerce patrones fonéticos portugueses en el audio en inglés, generando textos completamente incomprensibles y sin sentido. Defina siempre el idioma real del audio de entrada como parámetro inicial.</div>
9596    </div>
9597    <div class="lesson">
9598      <div class="lesson-icon">ℹ️</div>
9599      <div class="lesson-text"><strong>Ubicación del archivo generado:</strong> Por defecto, en compilados nativos, el archivo <code>.srt</code> se guarda en la misma carpeta física del archivo de audio WAV procesado, y no dentro del directorio del script o de Whisper.</div>
9600    </div>
9601    <div class="lesson">
9602      <div class="lesson-icon">✅</div>
9603      <div class="lesson-text"><strong>8 GB de VRAM en 2026 sigue firme:</strong> El modelo Whisper <code>large-v3-turbo</code> consume solo 2.9 GB de VRAM física en el ecosistema, permitiendo margen para otras actividades en su máquina o renderizado paralelo. Miles de dólares ahorrados en suscripciones y APIs propietarias.</div>
9604    </div>
9605  </div>
9606
9607  <div class="footer">
9608    RX 580 — vieja de 580 años, pero aún en activo 🚀 · Peripecias documentadas en junio/2026
9609  </div>
9610</div>`},audio_whisper:{id:"audio_whisper",title:"39. WHISPER.CPP LOCAL — TRANSCRIÇÃO DE ÁUDIO EM AMD RX 580",desc:"Transcripción de audio/video acelerada por GPU AMD mediante Vulkan en Windows (modelo large-v3-turbo).",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:30,tags:["whispercpp","transcricao-audio","vulkan-whisper"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_rvc"],previous:"audio_rvc",next:"linux_nativo",related:["audio_rvc","audio_srt_ptbr"]},part:1},html:`<div class="whisper-doc">
9611<style>
9612.whisper-doc {
9613  --color-border-secondary: rgba(255, 255, 255, 0.05);
9614  --color-border-tertiary: rgba(255, 255, 255, 0.08);
9615  --color-background-secondary: #0c0d10;
9616  --color-background-primary: #07080a;
9617  --color-text-primary: #ffffff;
9618  --color-text-secondary: #94a3b8;
9619  font-family: inherit;
9620}
9621.whisper-doc * { box-sizing: border-box; }
9622.whisper-doc .badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 4px; letter-spacing: 0.04em; text-transform: uppercase; }
9623.whisper-doc .badge-gpu { background: rgba(225, 29, 72, 0.1); border: 1px solid rgba(225, 29, 72, 0.3); color: #fda4af; }
9624.whisper-doc .badge-win { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.2); color: #a7f3d0; }
9625.whisper-doc .badge-ok { background: rgba(14, 165, 233, 0.1); border: 1px solid rgba(14, 165, 233, 0.3); color: #bae6fd; }
9626.whisper-doc .badge-warn { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #fef08a; }
9627.whisper-doc .hero { border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 1.5rem; margin-bottom: 2rem; background: #0c0d10; }
9628.whisper-doc .hero-title { font-size: 26px; font-weight: 700; color: var(--color-text-primary); line-height: 1.2; margin-bottom: 0.5rem; font-family: 'Syne', var(--font-sans); text-transform: uppercase; }
9629.whisper-doc .hero-title span { color: #E11D48; }
9630.whisper-doc .hero-sub { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 1.25rem; line-height: 1.6; font-family: var(--font-sans); }
9631.whisper-doc .hero-badges { display: flex; flex-wrap: wrap; gap: 6px; }
9632.whisper-doc .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 2rem; }
9633.whisper-doc .stat { background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 0.875rem 1rem; }
9634.whisper-doc .stat-label { font-size: 11px; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; font-family: var(--font-sans); }
9635.whisper-doc .stat-value { font-size: 20px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-mono); }
9636.whisper-doc .stat-sub { font-size: 11px; color: var(--color-text-secondary); margin-top: 2px; font-family: var(--font-sans); }
9637.whisper-doc .section { margin-bottom: 2.5rem; }
9638.whisper-doc .section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #E11D48; margin-top: 2rem; margin-bottom: 1rem; font-family: var(--font-sans); padding-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
9639.whisper-doc .step { border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; margin-bottom: 10px; overflow: hidden; background: #050506; }
9640.whisper-doc .step-header { display: flex; align-items: center; gap: 10px; padding: 0.75rem 1rem; background: #0c0d10; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
9641.whisper-doc .step-num { width: 24px; height: 24px; border-radius: 50%; background: #E11D48; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-mono); }
9642.whisper-doc .step-name { font-size: 13px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-sans); }
9643.whisper-doc .step-desc { font-size: 11px; color: var(--color-text-secondary); font-family: var(--font-sans); margin-left: auto; }
9644.whisper-doc .step-body { padding: 0.875rem 1rem; }
9645.whisper-doc .cmd { background: #050506; border: 1px solid rgba(255, 255, 255, 0.03); border-radius: 4px; padding: 0.625rem 0.875rem; font-size: 12px; color: #fff; font-family: var(--font-mono); margin-bottom: 6px; overflow-x: auto; white-space: nowrap; border-left: 3px solid #E11D48; }
9646.whisper-doc .note { font-size: 12px; color: var(--color-text-secondary); font-family: var(--font-sans); line-height: 1.6; margin-top: 4px; padding-left: 8px; border-left: 2px solid #E11D48; }
9647.whisper-doc .flag-table { width: 100%; border-collapse: collapse; font-size: 12px; }
9648.whisper-doc .flag-table th { text-align: left; padding: 8px 10px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-sans); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: #111215; }
9649.whisper-doc .flag-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-family: var(--font-mono); }
9650.whisper-doc .flag-table td:first-child { color: #fda4af; }
9651.whisper-doc .flag-table td:last-child { font-family: var(--font-sans); color: var(--color-text-secondary); }
9652.whisper-doc .flag-table tr:last-child td { border-bottom: none; }
9653.whisper-doc .perf-bar-wrap { margin: 0.5rem 0 1rem; background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); padding: 1rem; border-radius: 6px; }
9654.whisper-doc .perf-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
9655.whisper-doc .perf-row:last-child { margin-bottom: 0; }
9656.whisper-doc .perf-label { font-size: 12px; color: var(--color-text-secondary); width: 120px; flex-shrink: 0; font-family: var(--font-sans); text-align: right; }
9657.whisper-doc .perf-bar-bg { flex: 1; height: 8px; background: rgba(255, 255, 255, 0.03); border-radius: 4px; overflow: hidden; }
9658.whisper-doc .perf-bar { height: 100%; border-radius: 4px; }
9659.whisper-doc .perf-time { font-size: 12px; font-family: var(--font-mono); color: var(--color-text-primary); width: 70px; flex-shrink: 0; margin-left: 8px; }
9660.whisper-doc .lesson { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); align-items: flex-start; }
9661.whisper-doc .lesson:last-child { border-bottom: none; }
9662.whisper-doc .lesson-icon { font-size: 16px; flex-shrink: 0;
9662 margin-top: 1px; }
9663.whisper-doc .lesson-text { font-size: 12.5px; color: var(--color-text-secondary); font-family: var(--font-sans); line-height: 1.6; }
9664.whisper-doc .lesson-text strong { font-weight: 700; color: var(--color-text-primary); }
9665.whisper-doc .footer { text-align: center; font-size: 11px; color: #475569; font-family: var(--font-mono); padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, 0.05); margin-top: 2rem; }
9666.whisper-doc .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
9667@media (max-width: 600px) { .whisper-doc .two-col { grid-template-columns: 1fr; } }
9668.whisper-doc .env-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-size: 12px; }
9669.whisper-doc .env-row:last-child { border-bottom: none; }
9670.whisper-doc .env-key { color: var(--color-text-secondary); font-family: var(--font-sans); }
9671.whisper-doc .env-val { font-family: var(--font-mono); color: var(--color-text-primary); text-align: right; }
9672.whisper-doc .card-inner { background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 1rem 1.25rem; }
9673</style>
9674
9675  <div class="hero">
9676    <div class="hero-title"><span>whisper.cpp</span> + RX 580 vía Vulkan</div>
9677    <div class="hero-sub">Transcripción de audio/video con aceleración GPU AMD en Windows — usando Vulkan para ejecutar modelos Whisper directamente en la VRAM de la RX 580. Una GPU de 2017 trabajando en 2026.</div>
9678    <div class="hero-badges">
9679      <span class="badge badge-gpu">AMD RX 580 8GB</span>
9680      <span class="badge badge-win">Windows + PowerShell</span>
9681      <span class="badge badge-ok">Vulkan Backend</span>
9682      <span class="badge badge-ok">large-v3-turbo</span>
9683      <span class="badge badge-warn">FFmpeg pré-req</span>
9684    </div>
9685  </div>
9686
9687  <div class="stat-grid">
9688    <div class="stat">
9689      <div class="stat-label">tiempo total</div>
9690      <div class="stat-value">~5 min</div>
9691      <div class="stat-sub">para 15 min de video</div>
9692    </div>
9693    <div class="stat">
9694      <div class="stat-label">VRAM usada</div>
9695      <div class="stat-value">2.6 GB</div>
9696<div class="stat-sub">de 8 GB disponíveis</div>
9697    </div>
9698    <div class="stat">
9699      <div class="stat-label">speedup vs CPU</div>
9700      <div class="stat-value">~150×</div>
9701      <div class="stat-sub">antes: 12h para 40min</div>
9702    </div>
9703    <div class="stat">
9704      <div class="stat-label">modelo</div>
9705      <div class="stat-value">1.6 GB</div>
9706      <div class="stat-sub">large-v3-turbo</div>
9707    </div>
9708  </div>
9709
9710  <div class="section">
9711    <div class="section-title">pré-requisitos verificados</div>
9712    <div class="card-inner">
9713      <div class="env-row"><span class="env-key">Vulkan SDK</span><span class="env-val">glslc v2026.1</span></div>
9714      <div class="env-row"><span class="env-key">Git</span><span class="env-val">2.54.0.windows.1</span></div>
9715      <div class="env-row"><span class="env-key">CMake</span><span class="env-val">4.3.2</span></div>
9716      <div class="env-row"><span class="env-key">MSVC (Build Tools)</span><span class="env-val">14.52.36328 — VS 2026</span></div>
9717      <div class="env-row"><span class="env-key">GPU detectada</span><span class="env-val">AMD Radeon RX 580 2048SP</span></div>
9718      <div class="env-row"><span class="env-key">FFmpeg</span><span class="env-val">2026-04-19 (Gyan full build)</span></div>
9719    </div>
9720    <p class="note" style="margin-top: 8px;">Verificar RX 580 no Vulkan: <span style="font-family:var(--font-mono); color:#fda4af;">vulkaninfo --summary</span> → deve aparecer AMD Radeon RX 580 2048SP</p>
9721  </div>
9722
9723  <div class="section">
9724    <div class="section-title">compilação — passo a passo</div>
9725
9726    <div class="step">
9727      <div class="step-header">
9728        <div class="step-num">1</div>
9729        <div class="step-name">ativar ambiente MSVC x64</div>
9730        <div class="step-desc">a cada nova sessão</div>
9731      </div>
9732      <div class="step-body">
9733        <div class="cmd">& "C:\\Program Files (x86)\\Microsoft Visual Studio\\18\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"</div>
9734        <p class="note">Precisa repetir toda vez que abrir um novo PowerShell antes de compilar. Saída esperada: "Environment initialized for: 'x64'"</p>
9735      </div>
9736    </div>
9737
9738    <div class="step">
9739      <div class="step-header">
9740        <div class="step-num">2</div>
9741        <div class="step-name">clonar repositório</div>
9742        <div class="step-desc">~40 MB</div>
9743      </div>
9744      <div class="step-body">
9745        <div class="cmd">cd C:\\</div>
9746        <div class="cmd">git clone https://github.com/ggml-org/whisper.cpp</div>
9747        <div class="cmd">cd whisper.cpp</div>
9748      </div>
9749    </div>
9750
9751    <div class="step">
9752      <div class="step-header">
9753        <div class="step-num">3</div>
9754        <div class="step-name">cmake com Vulkan habilitado</div>
9755        <div class="step-desc">flag crítica: -DGGML_VULKAN=ON</div>
9756      </div>
9757      <div class="step-body">
9758        <div class="cmd">cmake -B build -DGGML_VULKAN=ON -DGGML_HIPBLAS=OFF -DGGML_HIP=OFF -DGGML_CUDA=OFF</div>
9759        <div class="cmd">cmake --build build --config Release -j4</div>
9760        <p class="note">Dura ~5-10 min. Warnings de C4267/C4244 são normais — não afetam o funcionamento. Binários ficam em build\\bin\\Release\\</p>
9761      </div>
9762    </div>
9763
9764    <div class="step">
9765      <div class="step-header">
9766        <div class="step-num">4</div>
9767        <div class="step-name">baixar modelo large-v3-turbo</div>
9768        <div class="step-desc">~1.6 GB</div>
9769      </div>
9770      <div class="step-body">
9771        <div class="cmd">Invoke-WebRequest -Uri "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo.bin" -OutFile "models\\ggml-large-v3-turbo.bin"</div>
9772        <p class="note">Outros modelos: large-v3 (~6GB VRAM, melhor qualidade), medium (~2.5GB), small (~1GB)</p>
9773      </div>
9774    </div>
9775  </div>
9776
9777  <div class="section">
9778    <div class="section-title">uso — fluxo completo mp4 → txt</div>
9779
9780    <div class="step">
9781      <div class="step-header">
9782        <div class="step-num" style="background:#1D9E75;">1</div>
9783        <div class="step-name">extrair áudio com FFmpeg</div>
9784        <div class="step-desc">whisper não lê mp4 direto no Windows</div>
9785      </div>
9786      <div class="step-body">
9787        <div class="cmd">ffmpeg -i "E:\\videos\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\videos\\video.wav"</div>
9788        <p class="note">-ar 16000 = 16kHz (obrigatório para o Whisper) · -ac 1 = mono · -c:a pcm_s16le = WAV sem compressão</p>
9789      </div>
9790    </div>
9791
9792    <div class="step">
9793      <div class="step-header">
9794        <div class="step-num" style="background:#1D9E75;">2</div>
9795        <div class="step-name">transcrever / traduzir</div>
9796        <div class="step-desc">GPU cuida do resto</div>
9797      </div>
9798      <div class="step-body">
9799        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --output-txt</
9799div>
9800        <p style="font-size:12px; color:var(--color-text-secondary); margin: 6px 0 4px; font-family:var(--font-sans);">com tradução para inglês:</p>
9801        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --translate --output-txt</div>
9802        <p class="note">--translate sempre gera inglês (limitação do Whisper). Para outros idiomas de destino, usar etapa adicional de tradução.</p>
9803      </div>
9804    </div>
9805
9806    <div style="margin-top: 1rem;">
9807      <div class="section-title" style="margin-bottom: 0.75rem;">flags úteis</div>
9808      <div class="card-inner">
9809        <table class="flag-table">
9810          <thead><tr><th>flag</th><th>descrição</th></tr></thead>
9811          <tbody>
9812            <tr><td>-l pt</td><td>idioma fonte: português</td></tr>
9813            <tr><td>-l en</td><td>idioma fonte: inglês</td></tr>
9814            <tr><td>--translate</td><td>traduz tudo para inglês</td></tr>
9815            <tr><td>--output-txt</td><td>salva .txt com transcrição</td></tr>
9816            <tr><td>--output-srt</td><td>salva legendas .srt com timestamps</td></tr>
9817            <tr><td>--output-vtt</td><td>salva legendas .vtt</td></tr>
9818            <tr><td>-t 8</td><td>usa 8 threads de CPU (padrão: 4)</td></tr>
9819            <tr><td>--device 0</td><td>seleciona GPU 0 (padrão)</td></tr>
9820            <tr><td>--no-gpu</td><td>força CPU (modo lento)</td></tr>
9821          </tbody>
9822        </table>
9823      </div>
9824    </div>
9825  </div>
9826
9827  <div class="section">
9828    <div class="section-title">performance — vídeo de 15 min</div>
9829    <div class="perf-bar-wrap">
9830      <div class="perf-row">
9831        <div class="perf-label">load modelo</div>
9832        <div class="perf-bar-bg"><div class="perf-bar" style="width:1.3%; background:#E11D48;"></div></div>
9833        <div class="perf-time">4 s</div>
9834      </div>
9835      <div class="perf-row">
9836        <div class="perf-label">mel (áudio)</div>
9837        <div class="perf-bar-bg"><div class="perf-bar" style="width:0.4%; background:#E11D48;"></div></div>
9838        <div class="perf-time">1.2 s</div>
9839      </div>
9840      <div class="perf-row">
9841        <div class="perf-label">encode GPU</div>
9842        <div class="perf-bar-bg"><div class="perf-bar" style="width:23.7%; background:#1D9E75;"></div></div>
9843        <div class="perf-time">73 s</div>
9844      </div>
9845      <div class="perf-row">
9846        <div class="perf-label">decode + batch</div>
9847        <div class="perf-bar-bg"><div class="perf-bar" style="width:54.7%; background:#1D9E75;"></div></div>
9848        <div class="perf-time">168 s</div>
9849      </div>
9850      <div class="perf-row">
9851        <div class="perf-label" style="font-weight:700; color:var(--color-text-primary);">total</div>
9852        <div class="perf-bar-bg"><div class="perf-bar" style="width:100%; background:#E11D48;"></div></div>
9853        <div class="perf-time" style="font-weight:700;">307 s</div>
9854      </div>
9855    </div>
9856    <p class="note">CPU em ~5% durante toda a transcrição. VRAM: 2.6 GB de 8 GB. A GPU fez o trabalho — CPU ficou de molho.</p>
9857  </div>
9858
9859  <div class="section">
9860    <div class="section-title">lições aprendidas nas peripécias</div>
9861    <div class="card-inner">
9862      <div class="lesson">
9863        <div class="lesson-icon">⚠️</div>
9864<div class="lesson-text"><strong>WSL2 não expõe a RX 580 via Vulkan</strong> — usar sempre PowerShell/Windows nativo para aproveitar a GPU.</div>
9865      </div>
9866      <div class="lesson">
9867        <div class="lesson-icon">⚠️</div>
9868        <div class="lesson-text"><strong>Whisper não lê MP4 no Windows</strong> — sempre extrair o áudio com FFmpeg antes. Usar -ar 16000 -ac 1 -c:a pcm_s16le.</div>
9869      </div>
9870      <div class="lesson">
9871        <div class="lesson-icon">ℹ️</div>
9872        <div class="lesson-text"><strong>--translate só gera inglês</strong> — é limitação do Whisper, não da configuração. Para PT como destino, precisa de etapa extra.</div>
9873      </div>
9874      <div class="lesson">
9875        <div class="lesson-icon">ℹ️</div>
9876        <div class="lesson-text"><strong>vcvars64.bat precisa ser reativado</strong> a cada nova sessão do PowerShell antes de qualquer compilação.</div>
9877      </div>
9878      <div class="lesson">
9879        <div class="lesson-icon">✅</div>
9880        <div class="lesson-text"><strong>8 GB de VRAM em 2026 ainda é sólido</strong> — large-v3-turbo usa apenas 2.6 GB. GPU "velha" com VRAM decente bate GPU nova com 4 GB fácil.</div>
9881      </div>
9882      <div class="lesson">
9883        <div class="lesson-icon">✅</div>
9884        <div class="lesson-text"><strong>Warnings C4267/C4244 durante compilação são normais</strong> — conversões de tipo esperadas no código do ggml, não impactam funcionamento.</div>
9885      </div>
9886    </div>
9887  </div>
9888
9889  <div class="footer">
9890    RX 580 — velha de 580 anos, mas ainda na ativa 🚀 · Peripécias documentadas em junho/2026
9891  </div>
9892
9893</div>`},benchmarks:{id:"benchmarks",title:"23. BENCHMARKS REAIS DO LABORATÓRIO",desc:"Datos consolidados de telemetría medidos directamente en los logs de inferencia de ambas arquitecturas.",meta:{version:"1.0.0",type:"benchmark",category:"hardware",subcategory:"benchmarks",difficulty:"beginner",estimated_time_min:15,tags:["telemetria","gpu-benchmarks","performance-history"],last_reviewed:"2026-07-01",relationships:{prerequisites:["guia"],previous:"guia",next:"cpu",related:["hardware","cpu"]}},html:'<div class="tbl"><table><thead><tr><th>
9893Modo de Ejecución del Modelo</th><th>Arquitectura Asignada</th><th>Métrica Comercial Obtenida</th><th>Estado de Viabilidad</th></tr></thead><tbody><tr><td>Inferencia de Texto Común</td><td>CPU Xeon Pura (Sin Aceleración)</td><td>3 a 5 tokens por segundo</td><td>❌ Ineficiente / Respuestas Lentas</td></tr><tr class="hig"><td>Inferencia de Texto Compilada</td><td>RX 580 8GB vía Vulkan Backend</td><td>15 a 16 tokens por segundo</td><td>✅ Altamente Productivo / Instantáneo</td></tr><tr><td>Muestreo SD 1.5 (20 Steps)</td><td>ComfyUI Windows vía DirectML</td><td>~450 segundos por imagen</td><td>❌ Inestable / Descartado por Error Crítico</td></tr><tr class="hig"><td>Muestreo SD 1.5 (20 Steps)</td><td>stable-diffusion.cpp vía Vulkan</td><td>72 segundos por imagen</td><td>✅ Optimizado / Respuesta Rápida</td></tr></tbody></table></div>'},codacus:{id:"codacus",title:"33. MÉTODO CODACUS vs AIVisionsLab",desc:"Experimento de las 5 flags que salvaron una GTX 1060 — ¿funcionan en una RX 580?",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:25,tags:["gtx-1060","metodo-codacus","nvidia-pascal"],last_reviewed:"2026-07-01",relationships:{prerequisites:["dadhacks"],previous:"dadhacks",next:"proximos",related:["dadhacks","amihart"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
9894  El canal Codacus publicó un video de gran repercusión demostrando cómo ejecutar un modelo de <strong>35B parámetros en una GTX 1060 de 6GB</strong> usando 5 flags específicas de <code>llama.cpp</code>, saltando de 3.0 tokens/s en el baseline a 17.0 tokens/s post-optimizaciones. AIVisionsLab probó esta hipótesis en la antigua <strong>RX 580 2048SP 8GB con Vulkan</strong> — comparando Windows y Linux nativo.
9895</p>
9896
9897<div class="tbl">
9898  <table>
9899    <thead>
9900      <tr>
9901        <th>Métrica / Configuración</th>
9902        <th>Configuración Codacus (Ref)</th>
9903        <th>Configuración AIVisionsLab</th>
9904      </tr>
9905    </thead>
9906    <tbody>
9907      <tr>
9908        <td><strong>GPU</strong></td>
9909        <td>Nvidia GTX 1060 6GB</td>
9910        <td>AMD Radeon RX 580 2048SP 8GB</td>
9911      </tr>
9912      <tr>
9913        <td><strong>Backend</strong></td>
9914        <td>CUDA</td>
9915        <td>Vulkan (Mesa RADV)</td>
9916      </tr>
9917      <tr>
9918        <td><strong>SO</strong></td>
9919        <td>Linux + Docker</td>
9920        <td>Windows 10 / Ubuntu 26.04</td>
9921      </tr>
9922      <tr>
9923        <td><strong>CPU</strong></td>
9924        <td>Intel Core i3-8100</td>
9925        <td>Intel Xeon E5-2690 v3 (12c/24t)</td>
9926      </tr>
9927      <tr>
9928        <td><strong>Modelo de Prueba</strong></td>
9929        <td>Qwen3.6 35B-A3B Q4_K_M</td>
9930        <td>Qwen3.6 35B-A3B Q4_K_M (Mismo modelo)</td>
9931      </tr>
9932    </tbody>
9933  </table>
9934</div>
9935
9936<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">El Impacto de las 5 Flags en Vulkan AMD</h3>
9937
9938<div class="tbl">
9939  <table>
9940    <thead>
9941      <tr>
9942        <th>Flag Aplicada</th>
9943        <th>Impacto en la GTX 1060 (CUDA)</th>
9944        <th>Impacto en la RX 580 (Vulkan Windows)</th>
9945        <th>Impacto en la RX 580 (Vulkan Linux Nativo)</th>
9946      </tr>
9947    </thead>
9948    <tbody>
9949      <tr>
9950        <td><strong>Baseline</strong></td>
9951        <td>3.0 tokens/s (-ngl 20)</td>
9952        <td><strong>7.62 tokens/s (-ngl 10)</strong></td>
9953        <td><strong>5.18 tokens/s (-ngl 20)</strong></td>
9954      </tr>
9955      <tr>
9956        <td><code>--override-tensor exps=CPU</code></td>
9957        <td>10.0 tokens/s (+233%)</td>
9958        <td>6.92 tokens/s (❌ -9%)</td>
9959        <td>4.62 tokens/s (❌ -11%)</td>
9960      </tr>
9961      <tr>
9962        <td><code>--no-mmap</code> (o <code>-mmp 0</code>)</td>
9963        <td>13.5 tokens/s (+35%)</td>
9964        <td>7.44 tokens/s (❌ -2%)</td>
9965        <td>4.86 tokens/s (❌ -6%)</td>
9966      </tr>
9967      <tr>
9968        <td>Cuantización KV cache (<code>-ctk/ctv</code>)</td>
9969        <td>17.0 tokens/s (+26%)</td>
9970        <td>7.58 tokens/s (❌ -1%)</td>
9971        <td><strong>5.41 tokens/s (✅ +4%)</strong></td>
9972      </tr>
9973      <tr>
9974        <td><code>--mlock</code> / ngl extra</td>
9975        <td>Estabilidad ampliada</td>
9976        <td>OOM por encima de ngl 10 (❌)</td>
9977        <td>OOM por encima de ngl 20 (❌)</td>
9978      </tr>
9979    </tbody>
9980  </table>
9981</div>
9982
9983<div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4">
9984  <h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Análisis de los Descubrimientos Técnicos</h4>
9985  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7">
9986    <strong>1. Modelo de Asignación de VRAM:</strong> ¿Por qué ngl 20 causaba OOM en Windows pero funcionaba en Linux? El driver propietario de AMD en Windows asigna la memoria de forma más conservadora, mientras que el driver de código abierto <strong>Mesa RADV en Linux</strong> permite que más layers sean descargados en el búfer (techo máximo real de 20 layers vs 10 layers en Windows).
9987  </p>
9988  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem">
9989    <strong>2. Incompatibilidad de Backend:</strong> El enrutamiento <code>override-tensor exps=CPU</code> para aislar expertos Mixtral/MoE de la GPU funciona de forma espectacular en CUDA debido al acceso PCIe de alta velocidad nativo de Nvidia. Bajo el backend Vulkan, el overhead de este movimiento destruye las ganancias de procesamiento.
9990  </p>
9991  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem">
9992    <strong>3. El Xeon Superior Compensó el Backend:</strong> Incluso con menor optimización de VRAM, la infraestructura de la CPU Xeon E5-2690 v3 (24 threads) de AIVisionsLab garantizó un baseline original superior de 7.62 tokens/s — superando los 3.0 tokens/s baselines del i3-8100 de Codacus.
9993  </p>
9994</div>
9995
9996<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Comparativa Mistral 7B — CPU Pura vs Vulkan</h3>
9997<p style="font-size:.88rem;color:#94a3b8;line-height:1.9">
9998  Para demostrar el valor bruto y absoluto del backend Vulkan en hardware legado Polaris:
9999</p>
10000<div class="code ok">
10001  <pre>💻 WSL2 Ubuntu (CPU Pura)  ·  24 threads  ·  1.79 tokens/s
10002🎮 Windows 10 (Vulkan GPU)  ·  12 threads  ·  18.54 tokens/s (⚡ ¡10x Más Rápido!)</pre>
10003</div>
10004<blockquote style="font-size:.82rem;color:#64748b;font-style:italic;line-height:1.8;border-left:3px solid #E11D48;padding-left:.9rem;margin-top:1rem">
10005  "Las 5 flags de Codacus funcionan perfectamente para marcas NVIDIA + CUDA + Linux Docker. En el ecosistema AMD + Vulkan, ¡nuestra propia receta es diferente pero increíblemente sólida!"
10006</blockquote>`},"comfyui-directml-func":{id:"comfyui-directml-func",title:"17. FIXES DIRECTML",desc:"Instalación de la rueda de desarrollo específica para forzar estabilidad operacional.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-batch-fix","memoria-virtual","crash-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml"],previous:"comfyui-directml",next:"comfyui-flux",related:["comfyui-directml","scripts"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Si hay necesidad de ejecutar pruebas comparativas en la capa DirectML sin cuelgues de inicialización, es preciso hacer un downgrade forzado de los paquetes utilizando el build de desarrollo de mayo de 2024:</p><div class="code"><pre># Comando para expurgar dependencias conflictivas e instalar el dev wheel estable
10007pip uninstall torch torch-directml torchaudio
10008pip install torch==2.3.1+cpu --index-url https://download.pytorch.org/whl/cpu
10009pip install torch-directml==0.2.1.dev240521 --no-deps</pre></div>`},"comfyui-directml":{id:"comfyui-directml",title:"16. DIRECTML",desc:"Explicación técnica detallada de las fallas crónicas encontradas durante las pruebas en la rama Windows.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fix","windows-driver","comfyui-windows"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-wsl"],previous:"comfyui-wsl",next:"comfyui-directml-func",related:["troubleshoot-comfyui","comfyui-portable-amd"]}},html:`<div class="err">
10009<div class="err-t">Falla Estructural — Incompatibilidad del Módulo CLIPTextEncode</div><p>Al cargar los flujos básicos de generación de imagen utilizando el instalador nativo DirectML para tarjetas AMD, la consola aborta la ejecución retornando la siguiente excepción impeditiva:</p><div class="code"><span class="code-lang">stderr</span><pre>File "comfy\\utils.py", line 245, in encode_token
10010NotImplementedError: Cannot access storage of OpaqueTensorImpl</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Análisis de Ingeniería:</strong> El driver DirectML encapsula los datos de memoria en objetos conocidos como <code>OpaqueTensorImpl</code>. Cuando las funciones internas de optimización de atención matemática de ComfyUI intentan leer el contenido bruto de esos tensores en la memoria física, la capa del ecosistema Microsoft bloquea el acceso, interrumpiendo el pipeline de renderizado.</p></div>`},"comfyui-flux":{id:"comfyui-flux",title:"18. PARAMETRIZAÇÃO CRÍTICA DO FLUX.1 SCHNELL",desc:"Configuración matemática obligatoria para procesar el modelo SOTA en CPU sin exceder los límites de RAM.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:20,tags:["flux-fp8","comfyui-workflow","vram-allocation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml-func"],previous:"comfyui-directml-func",next:"comfyui-modelos",related:["flux_server","comfyui-modelos"]}},html:'<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">El procesamiento del FLUX.1 Schnell de 16GB en modo CPU exige límites de muestreo fijos. Las desviaciones de estas reglas provocan el bloqueo de la máquina por saturación extrema de memoria:</p><div class="tbl"><table><thead><tr><th>Parámetro de Muestreo</th><th>Valor de Ajuste Obligatorio</th><th>Explicación Técnica en Xeon</th></tr></thead><tbody><tr class="hig"><td>Sampling Steps</td><td>4 Steps</td><td>El modelo Schnell fue diseñado para cerrar la convergencia de ruido en solo 4 interacciones.</td></tr><tr class="hig"><td>CFG Scale</td><td>1.0</td><td>Valores superiores a 1.0 destruyen la fidelidad de las texturas y distorsionan la distribución de tensores.</td></tr><tr><td>Scheduler Type</td><td>sgm_uniform</td><td>Garantiza la interpolación lineal de los tensores de difusión de forma optimizada para instrucciones AVX2.</td></tr></tbody></table></div>'},"comfyui-modelos":{id:"comfyui-modelos",title:"14. GESTÃO ZERO-COPY DE MODELOS NO NVMe",desc:"Técnica de enlaces simbólicos para unificar el almacenamiento de checkpoints pesados sin duplicar archivos.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"armazenamento",difficulty:"intermediate",estimated_time_min:15,tags:["symlink","diretorios-compartilhados","espaco-disco"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-flux"],previous:"comfyui-flux",next:"animatediff-video",related:["arquivos","modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Para evitar el desperdicio de espacio en la unidad SSD NVMe y eliminar la necesidad de mantener copias gigantes idénticas entre Windows y Linux (WSL2), se crea un enlace simbólico directo que apunta al sistema de archivos cruzado:</p>
10011  <div class="code"><span class="code-lang">bash</span><pre># Ejecutar este bloque dentro del terminal del subsistema Linux Ubuntu
10012cd ~/ComfyUI/models/checkpoints/
10013
10014# Crear el punto de anclaje virtual reflejando el archivo físico ubicado en la partición E: de Windows
10015ln -s "/mnt/e/ComfyUI_Models/checkpoints/flux1-schnell-fp8.safetensors" ./flux1-schnell-fp8.safetensors</pre></div>`},"comfyui-portable-amd":{id:"comfyui-portable-amd",title:"29. COMFYUI PORTÁTIL v0.3.48 — IMPLEMENTAÇÃO AMD",desc:"Configuraciones específicas e inyección de variables de entorno para la arquitectura Polaris.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-portable","directml-setup","portable-workflow"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshoot-comfyui"],previous:"troubleshoot-comfyui",next:"comunidade",related:["comfyui-directml","comfyui-flux"]}},html:`<div class="card">
10016    <p style="font-size:.88rem;color:#94a3b8;line-height:1.9">Para implementaciones que utilizan paquetes portátiles precompilados de ComfyUI enfocados en compatibilidad AMD DirectML en Windows, el intérprete Python necesita ayuda para identificar correctamente las capacidades de hardware de la GPU antigua:</p>
10017    <div class="code"><span class="code-lang">batch</span>
10017<pre># Insertar en la parte superior del archivo run_nvidia_gpu.bat o del script portátil personalizado:
10018set HSA_OVERRIDE_GFX_VERSION=8.0.3
10019set DXVK_ASYNC=1
10020
10021.\\python_embeded\\python.exe main.py --directml</pre></div>
10022    <p style="margin-top:.5rem;font-size:.82rem;color:#64748b;line-height:1.6">El indicador <code>8.0.3</code> emula el ID de arquitectura de compilación necesario para que las bibliotecas numéricas procesen tensores sin bloquear el bus PCIe de la serie RX 500.</p>
10023  </div>`},"comfyui-wsl":{id:"comfyui-wsl",title:"15. COMFYUI WSL2",desc:"Configurando el entorno Linux virtualizado para heredar el poder computacional del Xeon y RAM ECC.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"virtualizacao",difficulty:"advanced",estimated_time_min:30,tags:["wsl2-linux","comfyui-wsl","direct-vulkan"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_openwebui_integration"],previous:"sd_openwebui_integration",next:"comfyui-directml",related:["comfyui-flux","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Para sortear el límite de VRAM física de la GPU en modelos masivos, ComfyUI se instancia dentro del subsistema Linux apuntando la ejecución estrictamente a los núcleos del procesador:</p>
10024  <div class="code"><span class="code-lang">bash</span><pre># Activar el entorno virtual aislado vía Miniconda en el terminal de Ubuntu
10025conda activate comfy_env
10026
10027# Llamar al script principal forzando el uso del hardware de procesamiento central
10028python main.py --cpu --listen 0.0.0.0 --port 8188</pre></div>
10029  <div class="note info" style="margin-top:.75rem">El panel de nodos de ComfyUI estará totalmente disponible en el lado de Windows a través de la ruta mapeada: <strong>http://localhost:8188</strong></div>`},comunidade:{id:"comunidade",title:"30. CONTEXTO E FONTES DA COMUNIDADE",desc:"Repositorios de conocimiento hacker y foros dedicados a la preservación y optimización de hardware heredado.",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"comunidade",difficulty:"beginner",estimated_time_min:10,tags:["comunidade-hacker","links-utiles","github-preservation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-portable-amd"],previous:"comfyui-portable-amd",next:"amihart",related:["amihart","dadhacks","codacus"]}},html:`<div class="card acc">
10030    <p style="font-size:.85rem;color:#94a3b8;line-height:1.9">La ingeniería inversa y la viabilidad técnica de este laboratorio se basan en discusiones de optimización documentadas por comunidades enfocadas en la extracción de rendimiento máximo de componentes de bajo costo:</p>
10031    <ul style="padding-left:1.2rem;margin-top:.5rem;font-size:.85rem;color:#e2e8f0;line-height:2">
10032      <li>Comunidad Global de Ingeniería de Servidores Heredados: <strong style="color:var(--r)">r/X99_Lab</strong></li>
10033      <li>Discusiones de Optimización y Rimes de Compilación GGUF: <strong style="color:#fff">Github: ggerganov/llama.cpp/discussions</strong></li>
10034    </ul>
10035  </div>`},contexto:{id:"contexto",title:"01. CONTEXTO E PROBLEMA",desc:"Por qué una de las tarjetas más vendidas de la historia estaba siendo dejada atrás en la era de la IA.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:10,tags:["obsolescencia-programada","hardware-livre","preservacao-silicio"],last_reviewed:"2026-07-01",relationships:{prerequisites:[],previous:"",next:"hardware",related:["solucao","jornada"]}},html:"<p>La RX 580 (y su hermana gemela, la RX 580 2048SP) fue un éxito absoluto de ventas. Miles de personas la tienen en casa. Pero cuando comenzó la fiebre de la IA, AMD se centró solo en las tarjetas nuevas (RDNA3) y en Linux. En Windows, la única opción era DirectML, que es tan lento que hacía que la IA fuera impracticable. La comunidad entonces se unió para crear una solución a prueba de abandono.</p>"},cpu:{id:"cpu",title:"24. PARAMETRIZAÇÃO E AJUSTES DO XEON",desc:"Configuraciones de BIOS y límites estructurales de instrucciones fp32 para el procesador LGA 2011-3.",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"processadores",difficulty:"intermediate",estimated_time_min:18,tags:["bios-tuning","avx-optimization","intel-xeon-tuning"],last_reviewed:"2026-07-01",relationships:{prerequisites:["benchmarks"],previous:"benchmarks",next:"troubleshooting",related:["hardware","benchmarks"]}},html:'<div class="card acc"><p style="font-size:.88rem;color:#e2e8f0;font-weight:600;line-height:1.6">Directrices Técnicas para Procesadores Xeon de Microarquitectura Haswell (v3):</p><p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">El procesador Intel Xeon E5-2690 v3 lanzado en 2014 posee soporte nativo para el conjunto de instrucciones vectoriales <strong style="color:#fff">AVX2</strong>. Sin embargo, carece de hardware dedicado para cálculos matemáticos de precisión reducida en <strong style="color:var(--r)">FP16 (Half-Precision)</strong>.</p><p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">Al instanciar los loaders de modelos dentro de ComfyUI en Linux, asegúrate de configurar la precisión de cálculo a <strong style="color:#22c55e">FP32 (Single-Precision)</strong>. Si fuerzas la ejecución en FP16, el procesador necesitará emular las instrucciones vía software, reduciendo la velocidad de procesamiento a la mitad.</p></div>'},dadhacks:{id:"dadhacks",title:"32. MÉTODO DADHACKS — AI IMAGE GENERATION ON RX 580 USING VULKAN: A COST-EFFECTIVE SOLUTION",desc:"Análisis de la consolidación experimental realizada por DH (DadHacks) en diciembre de 2025, estableciendo caminos de compatibilidad para generación de imágenes en GPU heredada.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"intermediate",estimated_time_min:20,tags:["dadhacks-method","estetica-baixo-custo","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["amihart"],previous:"amihart",next:"codacus",related:["amihart","codacus"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">El 05 de diciembre de 2025, el desarrollador <strong style="color:#fff">DH (DadHacks)</strong> publicó una guía técnica innovadora en el sitio <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline">dadhacks.org</a> demostrando que la GPU AMD RX 580 de 8GB es perfectamente viable para generación de IA moderna sin depender de soluciones de softw
10035are propietarias o de ROCm.</p><div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);margin-bottom:1.25rem"><strong style="color:#fff;display:block;margin-bottom:.4rem">📌 Resultados de la Validación Técnica:</strong><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">El estudio de DadHacks demostró de forma experimental que es viable ejecutar Stable Diffusion vía Vulkan, refinando la conclusión preliminar de enero de 2025. La madurez gradual del ecosistema de <code>stable-diffusion.cpp</code> amplió las tasas de transferencia hasta finales de 2025.</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. Compilación del Motor — stable-diffusion.cpp</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">DH detalló el flujo de compilación en Linux utilizando la flag compiladora nativa <code>-DSD_VULKAN=ON</code>:</p><div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># Clonar de forma recursiva (obligatorio para traer submódulos de ggml)
10036git clone --recursive https://github.com/leejet/stable-diffusion.cpp
10037cd stable-diffusion.cpp && mkdir build && cd build
10038
10039# Configurar CMake usando Vulkan activado
10040cmake .. -DSD_VULKAN=ON
10041
10042# Compilar binarios
10043cmake --build . --config Release</pre></div><p style="font-size:.82rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">🧬 <strong>Divergencia de Flags Documentada:</strong> DadHacks usó <code>-DSD_VULKAN=ON</code> (capa de aplicación), mientras que AIVisionsLab homologó <code>-DGGML_VULKAN=ON</code> (capa de motor de tensores). Ambas generan el mismo binario eficiente en la práctica, pero referencian caminos diferentes de la evolución del repositorio leejet.</p><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. Comandos de Generación Originales (DadHacks)</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Demostración original de llamada offline vía terminal para Flux Schnell (modelo cuantizado de 4-bits) y Flux Dev, usando segmentación de memoria para ahorrar VRAM:</p><div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># Ejecutar Flux Schnell (4 steps de muestreo)
10044sd --diffusion-model SD-Models/flux1-schnell-q4_0.gguf \\
10045   --vae SD-Models/ae.safetensors \\
10046   --clip_l SD-Models/clip_l.safetensors \\
10047   --t5xxl SD-Models/t5xxl_fp16.safetensors \\
10048   -p "a lovely beagle holding a sign says 'hello'" \\
10049   --cfg-scale 1.0 \\
10050   --sampling-method euler \\
10051   -v --steps 4 \\
10052   --clip-on-cpu</pre></div><div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin-bottom:1.25rem"><strong style="color:#ef4444;display:block;margin-bottom:.4rem">🚨 ALERTA CRÍTICO: Incompatibilidad GGUF (Descubrimiento AIVisionsLab)</strong><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">DadHacks no listó una incompatibilidad de formato muy común: pesos GGUF publicados por el mantenedor <strong>city96</strong> son compatibles <em>únicamente</em> con ComfyUI. Para ejecución en stable-diffusion.cpp / sd-server, es obligatorio usar los modelos publicados oficialmente por el mantenedor <strong>leejet</strong> (ej: <code style="color:#fff">FLUX.1-schnell-gguf</code>).</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">C. Lo Que DadHacks No Cubrió (Que AIVisionsLab Expandió)</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">La guía original de DadHacks se enfocó en el ecosistema Linux/terminal con comandos manuales. AIVisionsLab expandió agresivamente esta base técnica:</p><table style="width:100%;border-collapse:collapse;font-size:.78rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem;border:1px solid var(--b)"><thead><tr style="background:rgba(255,255,255,0.02);color:#fff;border-bottom:1px solid var(--b)"><th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">Funcionalidad</th><th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">DadHacks (Linux)</th><th style="padding:.5rem;text-align:left">AIVisionsLab (Windows Nativo)</th></tr></thead><tbody><tr style="border-bottom:1px solid var(--b)"><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Hosting en Windows</td><td style="padding:.5rem;border-right:1px solid var(--b)">❌ No abordado</td><td style="padding:.5rem;color:#22c55e">✅ Mapeo vía MSVC / Cmd ejecutables</td></tr><tr style="border-bottom:1px solid var(--b)"><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Integración Gráfica</td><td style="padding:.5rem;border-right:1px solid var(--b)">❌ Solo terminal CLI</td><td style="padding:.5rem;color:#22c55e">✅ Servidor API + OpenWebUI / Docker link</td></tr><tr style="border-bottom:1px solid var(--b)"><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Automatización .bat</td><td style="padding:.5rem;border-right:1px solid var(--b)">❌ Scripts manuales shell</td><td style="padding:.5rem;color:#22c55e">✅ Scripts automáticos doble clic en Escritorio</td></tr><tr><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Seguridad VRAM</td><td style="padding:.5rem;border-right:1px solid var(--b)">⚠️ Limitación a base CLI</td><td style="padding:.5rem;color:#22c55e">✅ Optimizaciones con VAE Tiling contra bugs OOM</td></tr></tbody></table><div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem"><strong style="color:var(--r)">Crédito Comunitario Extensivo:</strong> Sección documental basada en la publicación original de <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">DH (DadHacks)</a>, titulada <em>"AI Image Generation on RX 580 Using Vulkan"</em>. El conocimiento es libre y evolutivo.</div>`},falhas:{id:"falhas",title:"03. O QUE NÃO FUNCIONOU (O CEMITÉRIO TÉCNICO)",desc:"Análisis detallado de errores: las razones técnicas del rechazo de DirectML nativo, OpenVINO y ROCm.",meta:{version:"1.0.0",type:"estudo_caso",category:"troubleshooting",subcategory:"historico",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fail","rocm-amd","openvino-intel"],last_reviewed:"2026-07-01",relationships:{prerequisites:["hardware"],previous:"hardware",next:"solucao",related:["troubleshooting","comfyui-directml"]}},html:`<div class="err">
10052<div class="err-t">3.1 DirectML + ComfyUI Windows Nativo — ABANDONADO</div><p><strong style="color:#e2e8f0">Intentos:</strong> Invocación vía <code>torch-directml</code> y flag <code>--directml</code>. El ecosistema fue detectado como <code>privateuseone0</code>, pero reveló inestabilidad crónica debido a la falta de actualizaciones estructurales de Microsoft.</p><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Logs de Error Críticos:</strong></p><div class="code"><span class="code-lang">stderr</span><pre>WARNING: torch-directml barely works, is very slow, has not been updated in over 1 year and might be removed soon, please don't use it.
10053
10054OSError: [WinError 127] No se pudo encontrar el procedimiento especificado
10055# Causado por un mismatch de DLL entre torchaudio y la build de CPU de torch 2.4.1
10056
10057NotImplementedError: Cannot access storage of OpaqueTensorImpl
10058# CLIPTextEncode se rompe al intentar manipular tensores opacos generados por DirectML</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Causa Raíz:</strong> DirectML genera tensores opacos incapaces de comunicarse con los backends de atención modernos de ComfyUI. Además, el instalador fuerza la importación de <code>torchaudio</code> dentro del módulo <code>audio_vae.py</code>, rompiendo la inicialización incluso si no usas audio.</p></div><div class="err" style="margin-top:1rem"><div class="err-t">3.2 OpenVINO + Stable Diffusion Forge</div><p><strong style="color:#e2e8f0">Intento:</strong> Acoplamiento de la extensión <code>sd-webui-openvino</code> desarrollada por Intel dentro del ecosistema Forge.</p><div class="code"><span class="code-lang">stderr</span><pre>ModuleNotFoundError: No module named 'ldm'
10059ModuleNotFoundError: No module named 'sgm'
10060Error build_unet: Invalid backend: 'openvino'</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Causa Raíz:</strong> La extensión fue diseñada para la antigua arquitectura de Automatic1111. Como Forge reestructuró completamente el código y reemplazó los módulos nativos <code>ldm</code> y <code>sgm</code>, la inyección del backend OpenVINO falla por completo.</p></div><div class="err" style="margin-top:1rem"><div class="err-t">3.3 ROCm — Inviável por Diseño en Polaris</div><ul><li>AMD finalizó oficialmente el soporte para la arquitectura GCN4 (Polaris/RX 580) en las ramas modernas de ROCm (v5.x+).</li><li>Inexistencia de soporte oficial para ROCm nativo en entorno Windows.</li><li>Capas de compatibilidad vía WSL2 para tarjetas antiguas generan Kernel Panics constantes en inferencias de alta carga.</li></ul></div><div class="err" style="margin-top:1rem"><div class="err-t">3.4 WebUI Forge en CPU Pura (HDD)</div><p><strong style="color:#e2e8f0">Métricas:</strong> Tiempo de inicio de 85 segundos. Tiempo de renderización insostenible de ~19 minutos por imagen simple (512x512, 20 steps). El cuello de botella del HDD compitiendo con la gestión de paginación de <code>memory_management.py</code> hizo el setup impracticable.</p></div>`},"flux-vulkan":{id:"flux-vulkan",title:"25. EXPLORAÇÃO COMPLEMENTAR: FLUX VIA VULKAN",desc:"Aceleración alternativa de modelos Flux utilizando cuantizaciones ultra-compactas en C++.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["flux-vulkan","cpp-native-inference","amd-acceleration"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshooting"],previous:"troubleshooting",next:"troubleshoot-comfyui",related:["flux_server","sdxl_vulkan"]}},html:'<div class="card"><p style="font-size:.88rem;color:#94a3b8;line-height:1.9">Aunque el checkpoint nativo de FLUX.1 de 16GB exige el procesamiento robusto de la CPU Xeon, es totalmente viable realizar inferencias directamente en la GPU RX 580 utilizando el binario de <code>stable-diffusion.cpp</code> acoplado con cuantizaciones agresivas de 3-bits:</p><div class="note info" style="margin-top:.5rem">Peso Recomendado para Pruebas VRAM: <strong>flux1-schnell-Q3_K_S.gguf (~5.2GB)</strong>. Esta variación se acomoda con holgura dentro del límite físico de 8GB de la tarjeta Polaris, entregando generaciones SOTA aceleradas por hardware.</div></div>'},flux_server:{id:"flux_server",title:"11. RODAR FLUX NO SD-SERVER (GPU + CPU HÍBRIDO)",desc:"Mapeo e inicialización del ecosistema Flux de 12B parámetros con arquitectura de memoria segmentada.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"advanced",estimated_time_min:30,tags:["flux-schnell","servidor-imagem","gerenciamento-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdserver"],previous:"sdserver",next:"sd_bat_automation",related:["comfyui-flux","flux-vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Flux exige segmentación precisa entre VRAM y RAM host. Utilizando las flags <code>--vae-on-cpu</code> y <code>--vae-tiling</code>, evitamos el desbordamiento de memoria (OOM) en la RX 580 2048SP. El T5XXL (fp16) y el VAE residen en RAM; el modelo de difusión ocupa la VRAM.</p><div class="tbl"><table><thead><tr><th>
10060Componente</th><th>Archivo Homologado</th><th>Asignación Final</th><th>Tamaño</th></tr></thead><tbody><tr><td>Modelo de Difusión</td><td><code>flux1-schnell-q4_k.gguf</code></td><td><strong>GPU (VRAM)</strong></td><td>~6.5 GB</td></tr><tr><td>VAE</td><td><code>ae.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~160 MB</td></tr><tr><td>CLIP L</td><td><code>clip_l.safetensors</code></td><td><strong>GPU (VRAM)</strong></td><td>~235 MB</td></tr><tr><td>T5XXL</td><td><code>t5xxl_fp16.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~9.3 GB</td></tr></tbody></table></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-top:1.25rem">⚠️ <strong style="color:#fff">Notas de Estabilidad:</strong> La remoción de la flag <code>--timeout</code> (no soportada por la versión actual) y la inclusión de <code>--vae-tiling</code> eliminaron los errores de <em>DeviceMemoryAllocation</em>. El uso total de RAM llega a ~9.5 GB (T5XXL fp16). Para ahorrar RAM, sustituir por <code>t5xxl_fp8</code> reduce a ~5 GB.</p><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Comando de Producción (iniciar.bat):</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
10061  --diffusion-model "E:\\ia_storage\\models\\Stable-diffusion\\flux1-schnell-q4_k.gguf" ^
10062  --vae "E:\\ia_storage\\models\\Stable-diffusion\\ae.safetensors" ^
10063  --clip_l "E:\\ia_storage\\models\\Stable-diffusion\\clip_l.safetensors" ^
10064  --t5xxl "E:\\ia_storage\\models\\Stable-diffusion\\t5xxl_fp16.safetensors" ^
10065  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre><div class="tbl" style="margin-top:1.25rem; margin-bottom:1.25rem"><table><thead><tr><th>Etapa</th><th>Tiempo Real</th></tr></thead><tbody><tr><td>Condicionamiento (T5XXL)</td><td>11.49s</td></tr><tr><td>Sampling — 4 steps @ 1024x1024</td><td>~838s (~14 min)</td></tr><tr><td>VAE Decode — 9 tiles</td><td>40.45s</td></tr><tr><td><strong>Total por imagen</strong></td><td><strong>~838s (~14 min)</strong></td></tr></tbody></table></div><div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;"><span style="color:#22c55e; font-weight:bold">✅ ESTADO: SERVIDOR EN PRODUCCIÓN — IMAGEN GENERADA CON ÉXITO</span><br><span style="font-size:.8rem; color:#94a3b8">Listening on http://0.0.0.0:7860 | VRAM: 7.6/8.0 GB | RAM: ~9.5 GB | GPU: RX 580 2048SP | Temp: 66°C</span></div>`},guia:{id:"guia",title:"22. GUIA ESTRATÉGICO POR CASO DE USO",desc:"Matriz de toma de decisiones: cuándo dirigir el procesamiento a la GPU o al Xeon.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:12,tags:["decision-making","workflows","hardware-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["scripts"],previous:"scripts",next:"benchmarks",related:["contexto","benchmarks"]}},html:'<div class="tbl"><table><thead><tr><th>Objetivo del Workflow</th><th>Modelo Recomendado</th><th>Backend Asignado</th><th>Métrica Real de Generación</th></tr></thead><tbody><tr class="hig"><td>Chat de Texto y Asistencia Local</td><td>Mistral 7B / Llama 3 8B GGUF</td><td>GPU RX 580 (Vulkan)</td><td>Alto Rendimiento (15-16 tokens/s) ⚡</td></tr><tr class="hig"><td>Generación Rápida de Imágenes (512x512)</td><td>DreamShaper 8 (SD 1.5 GGUF)</td><td>GPU RX 580 (Vulkan)</td><td>Renderizado Fluido (~72 segundos)</td></tr><tr><td>Creación de Alta Resolución y Detalle SOTA</td><td>FLUX.1 Schnell (16GB Weights)</td><td>CPU Xeon (WSL2)</td><td>Procesamiento Pesado (~24 minutos)</td></tr><tr><td>Interpolación de Fotogramas y Animación Video</td><td>AnimateDiff Pipeline Standard</td><td>CPU Xeon (WSL2)</td><td>Procesamiento Estable (~141 segundos)</td></tr></tbody></table></div>'},hardware:{id:"hardware",title:"02. HARDWARE DO LABORATÓRIO",desc:"Las especificaciones de nuestro 'Frankenstein' de bajo coste que sirve de base para este tutorial.",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"especificacoes",difficulty:"beginner",estimated_time_min:12,tags:["amd-polar","rx-580","intel-xeon","ram-ecc"],last_reviewed:"2026-07-01",relationships:{prerequisites:["contexto"],previous:"contexto",next:"falhas",related:["cpu","benchmarks"]}},html:`<div class="card acc">
10066  <div class="stat">
10067    <span class="stat-icon">🎮</span>
10068    <span class="stat-lbl">GPU</span>
10069    <span class="stat-val">RX 580 2048SP</span>
10070    <small>8GB VRAM (Vulkan)</small>
10071  </div>
10072  <div class="stat">
10073    <span class="stat-icon">🧠</span>
10074    <span class="stat-lbl">CPU</span>
10075    <span class="stat-val">Intel Xeon</span>
10076    <small>Resto de servidor barato</small>
10077  </div>
10078  <div class="stat">
10079    <span class="stat-icon">💾</span>
10080    <span class="stat-lbl">RAM</span>
10081    <span class="stat-val">32GB DDR4</span>
10082    <small>Vital para ejecutar FLUX en CPU</small>
10083  </div>
10084</div>
10085<p>8GB de VRAM es el 'punto óptimo'. Es suficiente para ejecutar LLMs de 7B y modelos de imagen estándar. Los 32GB de RAM son nuestro cinturón de seguridad para los modelos gigantes.</p>`},jornada:{id:"jornada",title:"06. JORNADA COMPLETA — AS 5 FASES",desc:"La línea de tiempo del laboratorio: de la lentitud inicial de la CPU al control total del hardware heredado.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:10,tags:["linha-tempo","conquistas","roadmap"],last_reviewed:"2026-07-01",relationships:{prerequisites:["prereqs"],previous:"prereqs",next:"llama",related:["linhatempo","proximos"]}},html:'<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.75rem">El éxito técnico del ecosistema local se logró a través de 5 hitos evolutivos y decisiones estratég
10085icas de hardware:</p><div class="phase"><div class="phase-num">01</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">WebUI Forge en CPU Pura (HDD)</span><span class="lbl lbl-b">BASELINE INICIAL</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Primera infraestructura funcional. Arranque lento de 85 segundos y marcas de renderizado golpeando ~19 minutos por imagen. Sistema completamente inviable para uso productivo.</p></div></div><div class="phase"><div class="phase-num">02</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">Aceleración de LLM vía Vulkan (RX 580)</span><span class="lbl lbl-r">BREAKTHROUGH TÉCNICO</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Compilación exitosa de llama.cpp activando la flag <code>-DGGML_VULKAN=ON</code>. El motor empezó a identificar la tarjeta gráfica Polaris nativamente, saltando la tasa de inferencia de 3-5 t/s a 15-16 t/s.</p></div></div><div class="phase"><div class="phase-num">03</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">Migración de Almacenamiento Centralizado a NVMe</span><span class="lbl lbl-y">HITO DECISIVO</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Reemplazo del HDD mecánico por unidad NVMe de alta velocidad (1.7–3.5 GB/s). El tiempo de carga en memoria del modelo de lenguaje cayó de 25 minutos a solo 4 minutos, eliminando el principal cuello de botella de I/O del laboratorio.</p></div></div><div class="phase"><div class="phase-num">04</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">stable-diffusion.cpp nativo vía Vulkan</span><span class="lbl lbl-g">OBJETIVO GPU CONCLUIDO ✅</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Primera imagen renderizada localmente utilizando 100% de la GPU RX 580 en entorno Windows. Ciclo de generación del modelo de pesos cuantizados SD 1.5 GGUF estabilizado en ~72 segundos.</p></div></div><div class="phase"><div class="phase-num">05</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">Escalado de FLUX.1 Schnell vía Xeon + RAM ECC</span><span class="lbl lbl-b">EXPANSIÓN DE CAPACIDAD ✅</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Implementación estable del modelo SOTA de 16GB corriendo en el procesador de servidor. Prueba empírica de que una infraestructura corporativa de 2014 logra procesar de forma robusta inteligencias artificiales de última generación de 2026.</p></div></div>'},limit_qwen_35b:{id:"limit_qwen_35b",title:"41. LEVANDO AO LIMITE QWEN3.5 35B Q6_K NA RX 580 8GB VIA VULKAN",desc:"Experimento de execução híbrida extrema de um modelo de 34.66B de parâmetros na GPU Polaris e Xeon de 2014.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:45,tags:["qwen-35b","offloading-extremo","vram-spillover"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_srt_ptbr"],previous:"audio_srt_ptbr",next:"proving_hypothesis_35b",related:["proving_hypothesis_35b","llama"]},part:1},html:`<div class="whisper-doc">
10086  <div class="hero">
10087    <div class="hero-title"><span>Leve ao Limite</span> — Qwen3.5 35B na RX 580</div>
10088    <div class="hero-sub">Experimento de execução híbrida extrema de um modelo de <strong>34,66B parâmetros</strong> na GPU de 8GB de VRAM e Xeon de 2014 via motor Vulkan.</div>
10089    <div class="hero-badges">
10090      <span class="badge badge-gpu">AMD RX 580 8GB</span>
10091      <span class="badge badge-win">Xeon E5-2690 v3</span>
10092      <span class="badge badge-ok">Vulkan Híbrido</span>
10093      <span class="badge badge-ok">34.66B parameters</span>
10094      <span class="badge badge-win">Q6_K Quantization</span>
10095    </div>
10096  </div>
10097
10098  <div class="stat-grid">
10099    <div class="stat">
10100      <div class="stat-label">Velocidade Geração</div>
10101      <div class="stat-value">5.64 tok/s</div>
10102      <div class="stat-sub">Sessão 2 (Estável)</div>
10103    </div>
10104    <div class="stat">
10105      <div class="stat-label">Prompt Eval</div>
10106      <div class="stat-value">34.13 tok/s</div>
10107      <div class="stat-sub">Tempo resposta ~107s</div>
10108    </div>
10109    <div class="stat">
10110      <div class="stat-label">Temperatura Máxima</div>
10111      <div class="stat-value">80°C</div>
10112      <div class="stat-sub">Sem Throttling (Alvo: 90°C)</div>
10113    </div>
10114    <div class="stat">
10115      <div class="stat-label">Custo Adicional</div>
10116      <div class="stat-value">R$ 0,00</div>
10117      <div class="stat-sub">Execução 100% local</div>
10118    </div>
10119  </div>
10120
10121  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.0 — Contexto e Motivação</h3>
10122  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10123    Em 15 de junho de 2026, o AIVisionsLab conduziou o experimento mais extremo da sua história: rodar um modelo de <strong>34,66 bilhões de parâmetros</strong> em modo híbrido numa GPU AMD Radeon RX 580 2048SP de 2017 com apenas 8GB de VRAM.
10124  </p>
10125  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
10126    "Se a RX 580 já roda Qwen3 4B a 35 tokens/s via Vulkan, até onde vai o limite?"
10127  </blockquote>
10128  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10129    A resposta documentada abaixo prova que o limite não é onde o mercado de hardware diz que é.
10130  </p>
10131
10132  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.1 — Hardware do Laboratório</h3>
10133  <div class="tbl">
10134    <table>
10135      <thead>
10136        <tr>
10137          <th>Componente</th>
10138          <th>Especificação</th>
10139        </tr>
10140      </thead>
10141      <tbody>
10142        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 cores / 24 threads · 3,05 GHz turbo (Lançado em 2014)</td></tr>
10143        <tr><td><strong>RAM</strong></td><td>
1014331,8 GB DDR4 REG ECC (quad-channel)</td></tr>
10144        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (Lançado em 2017)</td></tr>
10145        <tr><td><strong>Storage 1</strong></td><td>SSD NVMe (Disco E:) — modelos GGUF (Leitura de 1.7–3.5 GB/s)</td></tr>
10146        <tr><td><strong>Storage 2</strong></td><td>HDD (Disco C: / F:) — sistema Windows + swap</td></tr>
10147        <tr><td><strong>Storage 3</strong></td><td>HDD (Disco D:) — arquivos secundários</td></tr>
10148        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — lançado em 20/05/2026</td></tr>
10149        <tr><td><strong>DirectX</strong></td><td>12 (Feature Level 12.0)</td></tr>
10150        <tr><td><strong>Barramento</strong></td><td>PCI Express 3, dispositivo 0, função 0</td></tr>
10151        <tr><td><strong>Sistema</strong></td><td>Windows 10/11 com WSL2 ativo</td></tr>
10152      </tbody>
10153    </table>
10154  </div>
10155  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
10156    *Nota histórica: O Xeon E5-2690 v3 é de 2014. A RX 580 é de 2017. O Qwen3.5 é de 2025. Hardware de datacenter de 10 anos atrás processando IA de última geração.
10157  </p>
10158
10159  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.2 — Software e Versões</h3>
10160  <div class="tbl">
10161    <table>
10162      <thead>
10163        <tr>
10164          <th>Software</th>
10165          <th>Versão / Detalhe</th>
10166        </tr>
10167      </thead>
10168      <tbody>
10169        <tr><td><strong>llama.cpp</strong></td><td>build b9049-2496f9c14</td></tr>
10170        <tr><td><strong>Compilador</strong></td><td>MSVC 14.51.36231 (Visual Studio)</td></tr>
10171        <tr><td><strong>Vulkan SDK</strong></td><td>1.4.350.0</td></tr>
10172        <tr><td><strong>OpenWebUI</strong></td><td>v0.9.6</td></tr>
10173        <tr><td><strong>SearXNG</strong></td><td>via Docker — integrado ao OpenWebUI</td></tr>
10174        <tr><td><strong>Backend GPU</strong></td><td>Vulkan — <em>sem CUDA, sem ROCm, sem DirectML</em></td></tr>
10175        <tr><td><strong>Docker Desktop</strong></td><td>Ativo — containers open-webui + searxng</td></tr>
10176      </tbody>
10177    </table>
10178  </div>
10179
10180  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.3 — O Modelo: Qwen3.5-35B-A3B-Uncensored Q6_K</h3>
10181  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.1 — Especificações Técnicas</h4>
10182  <div class="tbl">
10183    <table>
10184      <thead>
10185        <tr>
10186          <th>Parâmetro</th>
10187          <th>Valor</th>
10188        </tr>
10189      </thead>
10190      <tbody>
10191        <tr><td><strong>Nome completo</strong></td><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K</td></tr>
10192        <tr><td><strong>Arquitetura</strong></td><td>qwen35moe — Mixture of Experts (MoE)</td></tr>
10193        <tr><td><strong>Parâmetros totais</strong></td><td>34,66 bilhões</td></tr>
10194        <tr><td><strong>Tamanho do arquivo</strong></td><td>26,55 GiB (6,58 bits por peso)</td></tr>
10195        <tr><td><strong>Quantização</strong></td><td>Q6_K — 432 tensores q6_K + 301 tensores f32</td></tr>
10196        <tr><td><strong>Experts totais</strong></td><td>256 experts</td></tr>
10197        <tr><td><strong>Experts ativos por token</strong></td><td>8 de 256 (apenas 3,1% ativados)</td></tr>
10198        <tr><td><strong>Contexto máximo de treino</strong></td><td>262.144 tokens</td></tr>
10199        <tr><td><strong>Vocabulário</strong></td><td>248.320 tokens (BPE, tokenizer qwen35)</td></tr>
10200        <tr><td><strong>Thinking mode padrão</strong></td><td>ATIVADO (<code>thinking = 1</code> no template Jinja2)</td></tr>
10201        <tr><td><strong>Intervalo de full attention</strong></td><td>A cada 4 layers</td></tr>
10202      </tbody>
10203    </table>
10204  </div>
10205
10206  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.2 — Por que MoE muda tudo</h4>
10207  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10208    Em um modelo denso de 35B, <strong>todos</strong> os 35 bilhões de parâmetros são ativados para cada token gerado. No Qwen3.5 MoE, apenas os <strong>8 experts mais relevantes</strong> de 256 são ativados — o equivalente a ~3B parâmetros ativos por token.
10209  </p>
10210  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10211    Isso explica por que um arquivo de 26GB consegue rodar numa máquina com 32GB de RAM: a maior parte dos pesos está na memória mas <strong>não é calculada simultaneamente</strong>.
10212  </p>
10213
10214  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.4 — Comando de Inicialização</h3>
10215  <div class="cmd">
10216# Sessão 1 (porta 8080 — erro corrigido depois)
10217.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
10217ort 8080
10218
10219# Sessão 2 (porta 8081 — correta)
10220.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --port 8081</div>
10221  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
10222    <strong>Nenhuma flag manual de camadas (<code>-ngl</code>).</strong> O llama.cpp fez todo o fitting automático.
10223  </p>
10224<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.5 — O Fitting Automático: Como o llama.cpp dividiu 26GB em 1,15 segundos</h3>
10225  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10226    Este é o coração técnico do experimento. Sem nenhuma intervenção manual, o llama.cpp executou um algoritmo de otimização que analisou a VRAM disponível e distribuiu o modelo entre GPU e RAM de forma inteligente.
10227  </p>
10228
10229  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.1 — Situação Inicial (Impossível carregar inteiro na GPU)</h4>
10230  <div class="cmd">
10231Memória necessária na GPU (modelo completo): 32.961 MiB
10232VRAM livre disponível:                        7.366 MiB
10233Déficit:                                     26.618 MiB — impossível da GPU conter tudo</div>
10234
10235  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.2 — Sequência de Decisões do Fitting (1,15 segundos)</h4>
10236  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10237    <strong>Passo 1 — Redução de contexto:</strong>
10238  </p>
10239  <div class="cmd">Contexto original:  262.144 tokens ➔ Contexto reduzido automaticamente: 4.096 tokens (Economia de VRAM: 5.347 MiB)</div>
10240  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10241    <strong>Passo 2 — Mover todos os experts MoE para RAM:</strong>
10242  </p>
10243  <div class="cmd">Vulkan0 com as camadas densas residuais: 2.418 MiB (Sobra 3.924 MiB VRAM livre)
10244RAM host (experts MoE mapeados): 25.613 MiB</div>
10245  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10246    <strong>Passo 3 — Realocar camadas densas de volta para GPU (back-to-front):</strong>
10247  </p>
10248  <div class="cmd">41 camadas densas realocadas ➔ GPU. Uso resultante: 3.048 MiB | Livre: 4.318 MiB</div>
10249  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10250    <strong>Passo 4 — Filling front-to-back com overflow fracionado:</strong>
10251  </p>
10252  <div class="cmd">Resultado: 41 camadas (36 "overflowing") na GPU
10253Tipo de overflow: GATE (fracionado no gate layer)
10254Uso final GPU: 6.255 MiB | Livre: 1.111 MiB</div>
10255
10256  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.3 — Distribuição Final dos Pesos</h4>
10257  <div class="tbl">
10258    <table>
10259      <thead>
10260        <tr>
10261          <th>Localização do Buffer</th>
10262          <th>Conteúdo Armazenado</th>
10263          <th>Tamanho Mobilizado</th>
10264        </tr>
10265      </thead>
10266      <tbody>
10267        <tr><td><strong>Vulkan0 (RX 580 8GB)</strong></td><td>41 camadas densas + output layer</td><td><strong>5.154 MiB</strong></td></tr>
10268        <tr><td><strong>CPU_Mapped (RAM via mmap)</strong></td><td>256 experts MoE</td><td><strong>26.784 MiB</strong></td></tr>
10269      </tbody>
10270    </table>
10271  </div>
10272
10273  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.4 — Buffers Adicionais alocados na VRAM</h4>
10274  <div class="tbl">
10275    <table>
10276      <thead>
10277        <tr>
10278          <th>Buffer Tipo</th>
10279          <th>Tamanho Alocado</th>
10280          <th>Descrição Física</th>
10281        </tr>
10282      </thead>
10283      <tbody>
10284        <tr><td><strong>KV Cache (Vulkan0)</strong></td><td>80,00 MiB</td><td>4.096 cells, 10 layers</td></tr>
10285        <tr><td><strong>RS Buffer (Vulkan0)</strong></td><td>251,25 MiB</td><td>recorrente: 40 layers, 4 seqs</td></tr>
10286        <tr><td><strong>Compute Buffer (Vulkan0)</strong></td><td>770,02 MiB</td><td>Ativado durante grafos de computação</td></tr>
10287        <tr><td><strong>Host Compute Buffer</strong></td><td>16,02 MiB</td><td>RAM do sistema</td></tr>
10288        <tr><td><strong>Output Buffer (Vulkan_Host)</strong></td><td>3,79 MiB</td><td>Buffer de saída de tokens</td></tr>
10289      </tbody>
10290    </table>
10291  </div>
10292  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
10293    <strong>Total efetivo na VRAM durante inferência: ~6,2–7,2 GB</strong> (77–90% dos 8GB físicos livres).
10294  </p>
10295
10296  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.5 — Features habilitadas automaticamente</h4>
10297  <div class="cmd">
10298✅ Flash Attention (auto ➔ ENABLED)
10299✅ Fused Gated Delta Net — autoregressive
10300✅ Fused Gated Delta Net — chunked
10301✅ Prompt cache (limite: 8.192 MiB, ~89.715 MiB salvos em disco)
10302✅ Thinking mode (thinking = 1)
10303✅ 4 slots paralelos (n_seq_max = 4)
10304
10305Graph nodes: 3.729 | Graph splits: 106 (com bs=512), 74 (com bs=1)
10306Reserve: 137–183 ms</div>
10307
10308  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.6 — A Arquitetura de 4 Níveis de Memória</h3>
10309  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10310    Primeiro registro documentado de um modelo 35B usando <strong>4 camadas de memória simultaneamente</strong> para processamento numa RX 580 comum:
10311  </p>
10312  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.8rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
10313    <div>⚡ <strong style="color:#ff9e64">
10313NÍVEL 1 — VRAM RX 580 (8GB GDDR5):</strong> 5.154 MiB de camadas densas | Acesso: ~400 GB/s (GDDR5) | Latência: nanosegundos</div>
10314    <div style="margin-top:0.5rem">🧠 <strong style="color:#7aa2f7">NÍVEL 2 — RAM DDR4 ECC (32GB Sytem):</strong> 26.784 MiB de experts MoE via mmap | Acesso: ~51 GB/s (quad-channel) | Latência: dezenas de ns</div>
10315    <div style="margin-top:0.5rem">💾 <strong style="color:#22c55e">NÍVEL 3 — SSD NVMe (Disco E:):</strong> 26,55 GiB de arquivo .gguf fonte | Acesso: 1,7–3,5 GB/s | Usado durante carregamento inicial</div>
10316    <div style="margin-top:0.5rem">📁 <strong style="color:#e0af68">NÍVEL 4 — HDD (Disco C: Swap):</strong> Swap do Windows ativado quando a RAM esgota (>97% de uso) | Acesso: ~120–180 MB/s | Pico de 98–100% de uso na inferência</div>
10317  </div>
10318
10319  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.7 — Configuração do Contexto Carregado</h3>
10320  <div class="cmd">
10321n_ctx         = 4.096 tokens (reduzido de 262.144 pelo fitting)
10322n_batch       = 2.048
10323n_ubatch      = 512
10324n_seq_max     = 4 (slots paralelos)
10325flash_attn    = auto ➔ ENABLED
10326kv_unified    = true</div>
10327  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
10328    <strong>Limitação crítica documentada:</strong> O contexto de 4.096 tokens é o principal gargalo do setup. O thinking mode (modo raciocínio) do Qwen3.5 consome 3.000+ tokens sozinho antes de gerar qualquer resposta visível — deixando menos de 1.000 tokens livres para a resposta final ao cliente.
10329  </p>
10330
10331  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.8 — Benchmark Confirmado em Duas Sessões</h3>
10332  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Velocidade de geração</h4>
10333  <div class="tbl">
10334    <table>
10335      <thead>
10336        <tr>
10337          <th>Sessão</th>
10338          <th>Horário aproximado</th>
10339          <th>Prompt Eval Speed</th>
10340          <th>Geração Speed</th>
10341          <th>Total Tokens</th>
10342          <th>Tempo Total</th>
10343        </tr>
10344      </thead>
10345      <tbody>
10346        <tr><td><strong>Sessão 1</strong></td><td>~17h39</td><td><strong>34,13 tok/s</strong></td><td><strong>5,57 tok/s</strong></td><td>1.377 tok</td><td>~107 segundos</td></tr>
10347        <tr><td><strong>Sessão 2</strong></td><td>~21h34</td><td>~40.00 tok/s</td><td><strong>5,64 tok/s</strong></td><td>2.929 tok</td><td>~533 segundos</td></tr>
10348      </tbody>
10349    </table>
10350  </div>
10351  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
10352    <strong>Consistência notável:</strong> Manutenção na linha de ~5,6 tokens/segundo de geração independente da sessão estar sobrecarregada ou fria.
10353  </p>
10354<h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Registro de temperaturas registradas</h4>
10355  <div class="tbl">
10356    <table>
10357      <thead>
10358        <tr>
10359          <th>Momento do Teste</th>
10360          <th>GPU Temp (°C)</th>
10361        </tr>
10362      </thead>
10363      <tbody>
10364        <tr><td>Idle (modelo estacionado na VRAM)</td><td>33–41°C</td></tr>
10365        <tr><td>Inferência normal (sem Web Search ativo)</td><td>44–64°C</td></tr>
10366        <tr><td>Inferência carregada (com Web Search ativo)</td><td>70–75°C</td></tr>
10367        <tr><td><strong>Pico absoluto registrado</strong></td><td><strong>80°C</strong></td></tr>
10368        <tr><td>Após conclusão de resposta</td><td>71–73°C</td></tr>
10369      </tbody>
10370    </table>
10371  </div>
10372  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
10373    <strong>Temperatura de thermal throttling da RX 580:</strong> ~90°C. <strong>Margem de segurança operacional perfeitamente mantida!</strong>
10374  </p>
10375
10376  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Utilização de recursos na inferência física</h4>
10377  <div class="tbl">
10378    <table>
10379      <thead>
10380        <tr>
10381          <th>Recurso de Hardware</th>
10382          <th>Idle</th>
10383          <th>Durante Inferência</th>
10384          <th>Pico Registrado</th>
10385        </tr>
10386      </thead>
10387      <tbody>
10388        <tr><td>VRAM dedicada</td><td>6,7 / 8,0 GB</td><td>6,8 – 7,2 / 8,0 GB</td><td>7,4 GB / 8,0 GB</td></tr>
10389        <tr><td>RAM do Sistema</td><td>~29,0 GB</td><td>30,7 – 31,1 GB</td><td>31,2 / 31,8 GB (98% utiliz.)</td></tr>
10390        <tr><td>CPU Xeon v3</td><td>3%</td><td>62 – 70%</td><td>70%</td></tr>
10391        <tr><td>GPU utilização 3D</td><td>0%</td><td>1 – 3%</td><td>3% (Carga no barramento PCIe)</td></tr>
10392        <tr><td>
10392HDD C: (Atividade swap)</td><td>0%</td><td>13 – 42%</td><td>98 – 100% (Limiar swap)</td></tr>
10393      </tbody>
10394    </table>
10395  </div>
10396
10397  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.9 — Os 5 Testes: Histórico Completo de Engenharia</h3>
10398  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
10399    <strong>Pergunta de entrada enviada em todos os testes:</strong><br>
10400    "Explique detalhadamente como funciona o mecanismo de atenção em transformers e por que o MoE é mais eficiente que modelos densos. Responda em português."
10401  </blockquote>
10402
10403  <div style="display:flex;flex-direction:column;gap:1rem;margin-bottom:1.5rem">
10404    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
10405      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 1 — Sessão 1 · Raciocínio ON + Web Search ON + Geração Imagem ON</h5>
10406      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
10407        <strong>Resultado:</strong> ❌ Erro de protocolo (reposta não entregue) | <strong>Log do erro:</strong> <code>operator (): got exception: {"error":"code":400,"message":"Assistant response prefill is incompatible with enable_thinking."}</code>
10408      </p>
10409      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
10410        <strong>Análise:</strong> O modelo processou um pensamento por ~1 minuto recuperando 10 fontes do SearXNG, mas o OpenWebUI injetou um prefill incorreto incompatível com a flag de pensamento do Jinja2, forçando o cancelamento.
10411      </p>
10412    </div>
10413
10414    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
10415      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 2 — Sessão 2 · Raciocínio ON + Web Search ON (30 pesquisas consecutivas)</h5>
10416      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
10417        <strong>Resultado:</strong> ❌ Contexto esgotado | <strong>Log do erro:</strong> <code>stop processing: n_tokens = 3285, truncated = 1</code>
10418      </p>
10419      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
10420        <strong>Análise:</strong> As 30 pesquisas do SearXNG injetaram milhares de tokens de contexto na memória. O thinking mode tentou alocar seu próprio buffer e estourou os 4.096 limitantes do setup híbrido, forçando corte prematuro.
10421      </p>
10422    </div>
10423
10424    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
10425      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 3 — Sessão 2 · Raciocínio ON + Web Search ON (25 pesquisas, nova rodada acumulada)</h5>
10426      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
10427        <strong>Resultado:</strong> ❌ Contexto esgotado | <strong>Log do erro:</strong> <code>stop processing: n_tokens = 4095, truncated = 1</code>
10428      </p>
10429      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
10430        <strong>Análise:</strong> O OpenWebUI tentou reenviar acumulando o histórico de conversação anterior. O prompt cresceu tanto que atingiu o teto exato delimitado de hardware de 4.095 tokens no Fitting.
10431      </p>
10432    </div>
10433
10434    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
10435      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 4 — Sessão 2 · Raciocínio ON + Web Search OFF</h5>
10436      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
10437        <strong>Resultado:</strong> ❌ Timeout do Cliente | <strong>Log do erro:</strong> <code>stop: cancel task, id_task = 6887 (truncated = 0)</code>
10438      </p>
10439      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
10440        <strong>Análise:</strong> Sem web-search o consumo térmico despencou para estáveis 51°C e uso de swap caiu. Mas o processamento de raciocínio interno demorou tempo suficiente na CPU Xeon de 2014 para que a UI disparasse seu timeout de segurança de chamadas.
10441      </p>
10442    </div>
10443
10444    <div style="border:1px solid rgba(34, 197, 94, 0.2);background:rgba(0, 3, 1, 0.6);border-radius:6px;padding:1rem">
10445      <h5 style="color:#22c55e;font-weight:bold;font-size:0.85rem">✅ TESTE 5 — Sessão 2 · Raciocínio ON + Web Search OFF + Prompt Curto (45 tokens)</h5>
10446      <p style="font-size:0.8rem;color:#c2ffd2;line-height:1.6;margin-top:0.25rem">
10447        <strong>Resultado:</strong> SUCESSO ABSOLUTO ✅ | Resposta técnica profunda entregue integralmente em português brasileiro estruturado.
10448      </p>
10449      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
10450        <strong>Análise:</strong> Ao restringir o prompt inicial para 45 tokens e desativar barulhos complementares, o pensamento pôde rodar por 4 minutos completos sob o Xeon, realizando rascunho de equações e respondendo impecavelmente sobre Transformers (Softmax, Multiheads) e as eficiências do MoE.
10451      </p>
10452    </div>
10453  </div>
10454
10455  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.10 — Tabela Comparativa de Comportamento dos Testes</h3>
10456  <div class="tbl">
10457    <table>
10458      <thead>
10459        <tr>
10460          <th>ID</th>
10461          <th>Thinking</th>
10462          <th>Web Search</th>
10463          <th>Promo Token</th>
10464          <th>Status</th>
10465          <th>Causa Raiz Real da Falha</th>
10466        </tr>
10467      </thead>
10468      <tbody>
10469        <tr><td>1</td><td>ON</td><td>ON (10 fontes)</td><td>~936 tok</td><td>❌ Falha</td><td>Prefill de resposta incompatível with thinking=1</td></tr>
10470        <tr><td>2</td><td>ON</td><td>ON (30 pesq.)</td><td>~357 tok</td><td>❌ Falha</td><td>Esgotamento de contexto do Fitting (4.095 max)</td></tr>
10471        <tr><td>3</td><td>ON</td><td>ON (25 pesq.)</td><td>~3.385 tok</td><td>❌ Falha</td><td>Esgotamento de contexto imediato no reenvio</td></tr>
10472        <tr><td>4</td><td>ON</td><td>OFF</td><td>~350 tok</td><td>❌ Falha</td><td>Timeout nas requisições da OpenWebUI antes do output</td></tr>
10473        <tr style="background:rgba(34, 197, 94, 0.05)"><td><strong>5</strong></td><td><strong>ON</strong></td><td><strong>OFF</strong></td><td><strong>45 tok</strong></td><td><strong>✅ SUCESSO</strong></td><td><strong>Prompt enxuto coube integralmente na arquitetura de mmap</strong></td></tr>
10474      </tbody>
10475    </table>
10476  </div>
10477<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
10478    <strong>Conclusão Crítica:</strong> A RX 580 do laboratório de 2017 e o Xeon funcionaram estavelmente sem dar nenhum reset físico em todas as situações de stress. As falhas residiram estritamente na calibração lógica do software de front-end.
10479  </p>
10480
10481  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.11 — Coletas de Descobertas e Limitações Cruciais</h3>
10482  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
10483    <li><strong style="color:#fff">Incompatibilidade do Thinking com Contexto Curto:</strong> Por design de modelo, o pensamento consome cerca de 3.000 tokens e estoura rapidamente o KV Cache alocado de 4.096 se o prompt ou histórico for longo.</li>
10484    <li><strong style="color:#fff">O Fitting Automático do llama.cpp é Excepcional:</strong> Forçar o split por flags experimentais rígidas como <code>--override-tensor</code> prejudica as chamadas no Vulkan. O fitting por cálculo de grafos resolveu milimetricamente a distribuição de forma otimizada.</li>
10485    <li><strong style="color:#fff">Superaquecimento da GPU mitigado:</strong> Apenas a renderização profunda com dezenas de filtros simultâneos elevou a 80°C. Limitar a GPU para inferir frações densas mantém o chip a confortáveis 44-64°C.</li>
10486    <li><strong style="color:#fff font-weight:bold">O gargalo reside na taxa de I/O de Swap do HDD:</strong> Quando RAM estoura a 98%, a taxa cai para 5 tok/s devido ao HDD. Migrar o swap do host inteiro para unidades de estado sólido aumentará consideravelmente a velocidade de fluxo comb
10486inada.</li>
10487  </ul>
10488
10489  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.12 — Comparação Direta com Projetos de Comunidade</h3>
10490  <div class="tbl">
10491    <table>
10492      <thead>
10493        <tr>
10494          <th>Projeto / Autor</th>
10495          <th>Arquitetura Utilizada</th>
10496          <th>Modelo Testado</th>
10497          <th>Velocidade Geração</th>
10498          <th>Status de Autoria</th>
10499        </tr>
10500      </thead>
10501      <tbody>
10502        <tr><td><strong>Matheus Fertunani</strong></td><td>Linux Comercial / CPU Xeon pura (192GB RAM)</td><td>Qwen3.5 35B Q8</td><td>~7–8 tokens/s</td><td>Documentado no YouTube</td></tr>
10503        <tr><td><strong>AIVisionsLab (Nossos testes)</strong></td><td>Vulkan Híbrido (RX 580 8GB + 32GB RAM ECC)</td><td>Qwen3.5 35B Q6_K</td><td><strong>5,64 tokens/s</strong></td><td>✅ Validado e Registrado</td></tr>
10504      </tbody>
10505    </table>
10506  </div>
10507  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
10508    <strong>A grande vantagem arquitetural:</strong> O teste de CPU pura de Matheus exige hardwares profissionais de alto custo com mais de 100GB de RAM instalada. O ecossistema de Vulkan do AIVisionsLab provou-se operável em uma GPU de menos de R$ 400 em mercado secundário!
10509  </p>
10510
10511  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.13 — Configurações Recomendadas para Testes Futuros</h3>
10512  <div class="cmd">
10513# Teste 6 — Desativação explícita de thinking via servidor em versões de compilação recentes:
10514.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
10514ort 8081 --no-thinking
10515
10516# Teste 7 — Elevação estrita de buffers de contexto se a memória for redirecionada:
10517.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-...-Q6_K.gguf" --host 0.0.0.0 --port 8081 --ctx-size 8192
10518
10519# Teste 8 — Testar com quantizações menores como Q4_K_M (~21GB):
10520# Liberação de ~5GB adicionais na RAM host que reduz a dependência de swap no HDD e melhora consideravelmente a taxa de tok/s!</div>
10521
10522  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.14 — Lições Técnicas Consolidadas</h3>
10523  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
10524    <li><strong style="color:#fff">O silício de 2017 não é o limite:</strong> A placa de vídeo nunca crashou nos testes contínuos de estresse térmico, dezenas de vezes. O gargalo se provou uma mera calibração lógica de software.</li>
10525    <li><strong style="color:#fff">As esparsidades do MoE salvam a categoria:</strong> Sem MoE, seria impensável arrastar um modelo de 26GB de pesos ativos. O MoE faz com que apenas 3.1% dos neurônios fiquem de fato excitados por token.</li>
10526  </ul>
10527
10528  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.15 — Veredicto Geral do Laboratório</h3>
10529  <div class="tbl">
10530    <table>
10531      <thead>
10532        <tr>
10533          <th>Questão de Engenharia</th>
10534          <th>Veredicto Final</th>
10535        </tr>
10536      </thead>
10537      <tbody>
10538        <tr><td><strong>A RX 580 de 8GB suporta modelos de 35B parâmetros?</strong></td><td>✅ <strong>Sim</strong> (Em barramento híbrido mmap)</td></tr>
10539        <tr><td><strong>É prático para o dia a dia?</strong></td><td>⚠️ <strong>Não</strong> (5,6 tok/s e contexto de 4.096 tokens)</td></tr>
10540        <tr><td><strong>Vale como prova de conceito?</strong></td><td>✅ <strong>Absolutamente</strong></td></tr>
10541        <tr><td><strong>Houve throttling ou crash?</strong></td><td>✅ <strong>Zero ocorrências de instabilidade</strong></td></tr>
10542        <tr><td><strong>Temperatura máxima registrada</strong></td><td><strong>80°C</strong> (margem de segurança: ~90°C)</td></tr>
10543        <tr><td><strong>Velocidade de geração</strong></td><td><strong>~5,6 tokens/segundo</strong></td></tr>
10544        <tr><td><strong>Memória total mobilizada</strong></td><td><strong>~34 GB</strong> (VRAM + RAM + swap HDD)</td></tr>
10545      </tbody>
10546    </table>
10547  </div>
10548
10549  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.16 — Linha do Tempo do Experimento</h3>
10550  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
10551    <div>🕒 <strong>~17:39</strong> — Servidor sobe na porta 8080 (erro)</div>
10552    <div>🕒 <strong>~17:40</strong> — "Network Problem" no OpenWebUI (porta errada)</div>
10553    <div>🕒 <strong>~17:41</strong> — Servidor fechou ao trocar porta → reiniciado na 8081</div>
10554    <div>🕒 <strong>~17:42</strong> — Todas as ferramentas habilitadas no modelo (imagem, web, terminal)</div>
10555    <div>🕒 <strong>~17:43</strong> — <strong>TESTE 1</strong> inicia</div>
10556    <div>🕒 <strong>~17:44</strong> — Web search: 10 fontes recuperadas</div>
10557    <div>🕒 <strong>~17:44</strong> — Tentativa de gerar imagem → erro tratado → continua</div>
10558    <div>🕒 <strong>~17:45</strong> — "Pensado por um minuto" aparece no OpenWebUI</div>
10559    <div>🕒 <strong>~17:46</strong> — Resposta estruturada com título gerado internamente</div>
10560    <div>🕒 <strong>~17:50</strong> — Erro de protocolo (prefill + thinking) → sem entrega. Pico: 80°C</div>
10561    <div>🕒 <strong>~21:34</strong> — Sessão 2 inicia</div>
10562    <div>🕒 <strong>~21:34</strong> — <strong>TESTE 2</strong> inicia — web search ON (30 pesquisas). Contexto truncado.</div>
10563    <div>🕒 <strong>~21:48</strong>
10563 — <strong>TESTE 3</strong> automático — 25 pesquisas. Contexto truncado.</div>
10564    <div>🕒 <strong>~22:00</strong> — <strong>TESTE 4</strong> — web search OFF. Temperatura cai para 51°C. Timeout da UI.</div>
10565    <div>🕒 <strong>~23:06</strong> — <strong>TESTE 5</strong> — prompt de 45 tokens. Thinking decodificado com sucesso.</div>
10566    <div>🕒 <strong>~23:14</strong> — Resposta completa entregue em português ✅. GPU: 64°C | RAM: 96%</div>
10567  </div>
10568
10569  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.17 — Impacto para a Documentação do AIVisionsLab</h3>
10570<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10571    Este experimento adiciona ao projeto: um novo benchmark robusto de 5,6 tok/s para modelos 35B MoE híbridos, a confirmação de que o fitting automático do llama.cpp supera configurações manuais rígidas via Vulkan, a identificação clara de incompatibilidade do modo thinking com contextos inferiores a 8.192 e a descrição de uma arquitetura estendida a 4 níveis de memória.
10572  </p>
10573
10574  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.18 — Tags e Metadados</h3>
10575  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
10576    <div>🏷️ <strong>Tags:</strong> hybrid, moe, vulkan, rx580, large-model, thinking-mode, limits, qwen35b, benchmark, fitting-automático, 4-memory-levels, sem-throttling</div>
10577    <div style="margin-top:0.5rem">💻 <strong>Hardware:</strong> RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
10578    <div style="margin-top:0.25rem">💿 <strong>Software:</strong> llama.cpp b9049 + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
10579    <div style="margin-top:0.25rem">📅 <strong>Data:</strong> 15/06/2026</div>
10580    <div style="margin-top:0.25rem">⏱️ <strong>Sessões:</strong> 2 (17h39–18h24 e 21h34–23h14)</div>
10581    <div style="margin-top:0.25rem">📊 <strong>Testes:</strong> 5 (4 falhas de software, 1 sucesso de inferência completa)</div>
10582    <div style="margin-top:0.25rem">📈 <strong>Benchmark:</strong> 5,57–5,64 tok/s (geração) | 34,13 tok/s (prompt eval)</div>
10583    <div style="margin-top:0.25rem">🔥 <strong>Temperatura pico:</strong> 80°C</div>
10584    <div style="margin-top:0.25rem">🏆 <strong>Status final:</strong> ✅ HARDWARE APROVADO</div>
10585  </div>
10586
10587  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
10588    "O problema nunca foi o hardware.<br>
10589    Foi a combinação de thinking + web search esgotando os 4.096 tokens de contexto.<br>
10590    Com prompt curto e sem web search, o Qwen3.5-35B Q6_K responde normalmente numa RX 580 de 2017."<br>
10591    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 15/06/2026</span>
10592  </blockquote>
10593
10594  <div class="footer">
10595    Documentação gerada por Claude Sonnet 4.6 — 15/06/2026 · Baseada em logs reais, screenshots, benchmarks e observações em tempo real · Sessão 1: ~17h39–18h24 | Sessão 2: ~21h34–23h14 · 5 testes documentados · 1 bem-sucedido · Hardware de 2017 processando IA de 2025
10596  </div>
10597</div>`},linhatempo:{id:"linhatempo",title:"37. LINHA DO TEMPO COLETIVA — A EVOLUÇÃO DO RX 580 COMO PLATAFORMA DE IA",desc:"Análisis histórico y comparativo unificado documentando la ruptura de barreras y obsolescencia de la RX 580 en tres etapas revolucionarias (2025-2026).",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:25,tags:["evolucion-historica","rx580-timeline","comunidade-hacker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["meta"],previous:"meta",next:"audio_rvc",related:["jornada","comunidade"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">El rescate técnico y el ascenso de la AMD Radeon RX 580 como una plataforma de inteligencia artificial práctica no es fruto de una sola mente, sino de una <strong>evolución colectiva ascendente</strong>. Tres proyectos independientes, construidos sobre la base matemática común del ecosistema <code>ggml</code>, pavimentaron esta jornada:</p><div style="position:relative;margin:2rem 0;padding-left:1.5rem;border-left:2px solid var(--b)"><div style="margin-bottom:1.5rem;position:relative"><div style="position:absolute;
10597left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:var(--r);border:2px solid #07080a"></div><span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:var(--r);font-weight:bold">ENERO DE 2025</span><h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">Método Amihart (Debian Linux)</h5><p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Primer hito documentado. Validó LLMs acelerados por Vulkan en <code>llama.cpp</code> obteniendo 24.56 t/s. Sin embargo, declaró: <em>"Vulkan no funciona para Stable Diffusion"</em>, debido a las limitaciones del software en la época, recurriendo a ROCm vía Docker.</p></div><div style="margin-bottom:1.5rem;position:relative"><div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#eab308;border:2px solid #07080a"></div><span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#eab308;font-weight:bold">DICIEMBRE DE 2025</span><h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">Método DadHacks (Linux/Debian)</h5><p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Refutó empíricamente la imposibilidad de Stable Diffusion vía Vulkan. Utilizó el recién lanzado motor <code>stable-diffusion.cpp</code> con la flag compiladora <code>-DSD_VULKAN=ON</code> para correr generación GGUF de Flux Schnell con segmentación CPU/GPU.</p></div><div style="position:relative"><div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#22c55e;border:2px solid #07080a"></div><span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#22c55e;font-weight:bold">TEMPORADA 2026</span><h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">AIVisionsLab (Windows Nativo + WSL2)</h5><p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Unificación del ecosistema de producción. Desarrolló automatización nativa vía <code>.bat</code>, integró renderizado Vulkan local a paneles amigables (OpenWebUI vía Docker), documentó los fallbacks para CPU Xeon en modelos SOTA y mapeó de forma exhaustiva los motivos de fallos de DirectML/ROCm en Windows.</p></div></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:2rem 0 .75rem 0;text-transform:uppercase">A. La Pregunta que Cada Proyecto Respondió</h4><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">La evolución de la madurez técnica de la RX 580 puede traducirse por las premisas respondidas por los autores:</p><ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem"><li><strong style="color:#fff">Amihart (Ene 2025):</strong> <em>"¿Es posible correr LLMs rápido en la RX 580 sin ROCm oficial?"</em> <strong style="color:var(--r)">Sí</strong>, compilando llama.cpp con Vulkan API puro.</li><li><strong style="color:#fff">DadHacks (Dic 2025):</strong> <em>"¿Es posible generar imágenes vía IA aceleradas por Vulkan en la RX 580?"</em> <strong style="color:var(--r)">Sí</strong>, compilando stable-diffusion.cpp y utilizando el formato alternativo estable GGUF.</li><li><strong style="color:#fff">AIVisionsLab (2026):</strong> <em>"¿Es posible poner toda esta infraestructura en producción integrada y amigable en Windows?"</em> <strong style="color:var(--r)">Sí</strong>, construyendo puentes de red de contenedores Docker, automatizaciones unificadas y fallbacks inteligentes de CPU para excedentes de VRAM.</li></ul><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. Tabla Maestra Comparativa Unificada</h4><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">Mapeo estructural cruzado de las capacidades y logros acumulativos:</p><div class="tbl" style="margin-bottom:1.5rem"><table><thead><tr><th>Capacidad</th><th>Amihart (2025)</th><th>DadHacks (2025)</th><th>AIVisionsLab (2026)</th></tr></thead><tbody><tr><td><strong>Sistema Base</strong></td><td>Debian Linux</td><td>Linux Debian</td><td>Windows 10 Pro + WSL2 Linux</td></tr><tr><td><strong>Motor de LLM</strong></td><td>✅ Vulkan (24.56 t/s)</td><td>✅ Vulkan (llama.cpp)</td><td>✅ Vulkan (15-16 t/s)</td></tr><tr><td><strong>Motor SD</strong></td><td>❌ No viable en Vulkan</td><td>✅ Vulkan puro</td><td>✅ Vulkan puro (~72s SD1.5)</td></tr><tr><td><strong>Flux GGUF</strong></td><td>❌ Inexistente</td><td>✅ Línea de comandos</td><td>✅ Híbrido GPU/CPU Estable</td></tr><tr><td><strong>Interfaz Gráfica</strong></td><td>❌ Solo Consola / WebUI Docker</td><td>❌ Solo CLI</td><td>✅ OpenWebUI + API integrada</td></tr><tr><td><strong>Automatización</strong></td><td>❌ No desarrollado</td><td>❌ No desarrollado</td><td>✅ Scripts .bat doble clic</td></tr><tr><td><strong>Estabilidad VRAM</strong></td><td>❌ Limitación física ROCm</td><td>⚠️ CLI manual</td><td>✅ VAE Tiling integrado</td></tr><tr><td><strong>Modelos &gt; 8GB</strong></td><td>❌ OOM crónicos</td><td>⚠️ CPU offload básico</td><td>✅ Fallbacks Quad-Channel REG ECC</td></tr><tr><td><strong>Animación Vídeo</strong></td><td>❌ No abordado</td><td>❌ No abordado</td><td>✅ AnimateDiff WSL2 CPU Xeon</td></tr><tr><td><strong>Detección GGUF</strong></td><td>❌ No abordado</td><td>❌ No abordado</td><td>✅ Mapeo leejet vs city96</td></tr></tbody></table></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">C. El Denominador Técnico Común — Motor GGML</h4><p style="font-size:.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">La tecnología central de compresión y ejecución que viabilizó el aprovechamiento de GPUs legacy fue el ecosistema desarrollado por Georgi Gerganov (<strong>ggml / llama.cpp / stable-diffusion.cpp</strong>). Al portar las operaciones tensoriales directamente al lenguaje C/C++ y exp
10597oner ganchos nativos a la librería gráfica abierta de <strong>Vulkan API</strong>, esta implementación permite que tarjetas sin paquetes modernos de driver propietario realicen cálculos masivos nativos (eludiendo drivers de vendor restrictivos).</p><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">D. Filosofía Convergente</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Manifestaciones directas que eternizan el propósito libre de estos investigadores:</p><blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem"><strong>Amihart:</strong> "A pesar de lo antigua que es esta GPU, es técnicamente posible utilizarla para IA si adaptamos el flujo de ejecución... la optimización de bajo nivel es la clave para la reutilización de hardware heredado."</blockquote><blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem"><strong>DadHacks:</strong> "Este setup provee un puente viable de aprovechamiento técnico de las inversiones existentes en hardware sin requerir upgrades caros o dependencia de paquetes de software hinchados."</blockquote><blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem"><strong>AIVisionsLab:</strong> "La degradación por obsolescencia de drivers y ecosistemas cerrados es un factor comercial y no una limitación material de la tarjeta. El hardware heredado mantiene su utilidad operativa mediante soporte de software abierto."</blockquote><div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem"><strong style="color:var(--r)">Crédito de Co-autoría y Referencia:</strong> Línea de tiempo técnica dedicada al esfuerzo experimental acumulativo de <strong>艾米心 (Amihart)</strong>, <strong>DH (DadHacks)</strong>, <strong>leejet</strong>, <strong>ggerganov</strong>, <strong>woodrex</strong> y todos los desarrolladores independientes enfocados en la reutilización digital y preservación de hardware.</div>`},linux_nativo:{id:"linux_nativo",title:"43. LINUX NATIVO — Ubuntu 26.04 LTS + RX 580 + Vulkan",desc:"AIVisionsLab — Documentación del Stack Completo en Linux Real",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"sistema-operacional",difficulty:"advanced",estimated_time_min:40,tags:["ubuntu-native","linux-vulkan","low-level-compilation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_whisper"],previous:"audio_whisper",next:"audio_srt_ptbr",related:["comfyui-wsl","amihart"]},part:1},html:`<div class="card bg-red-950/20 border border-red-500/30 p-5 rounded-md my-6"><h4 style="color:#ef4444;font-weight:800;font-size:0.95rem;margin-bottom:0.6rem;display:flex;items-center;gap:0.4rem">🚨 INFORME DE INCIDENTE (16/06/2026): EL GRAN DESASTRE DE ESPACIO Y LA CAÍDA DE GNOME</h4><p style="font-size:0.82rem;color:#fca5a5;line-height:1.75;margin-bottom:0.75rem"><strong>Estado Crítico:</strong> Durante las pruebas de pipelines extremos y descarga masiva de modelos GGUF pesados en la partición dedicada de 97GB, el espacio físico se agotó por completo (0 bytes libres en swap/root). En un intento rápido de liberar caché y limpieza forzada vía terminal, se corrompieron dependencias críticas del entorno gráfico.</p><ul style="padding-left:1.2rem;font-size:.8rem;color:#fbcfe8;line-height:1.8;margin-bottom:1rem"><li><strong>Síntoma:</strong> El Gestor de Ventanas <strong>GNOME</strong> se rompió por completo, resultando en bucles de inicio de sesión y pantalla negra terminal sin cargar la interfaz de vídeo.</li><li><strong>Acción de Recuperación:</strong> Formateo físico y reinstalación inmediata del sistema Linux Bare-Metal desde cero para reconstrucción limpia y redimensionamiento adecuado de particiones.</li><li><strong>
10597El Veredicto Existencial:</strong> <em>"¡Definitivamente necesito aprender Linux!"</em> — El viaje de AIVisionsLab prueba que dominar la terminal y la asignación de espacio bajo LVM es tan crucial como conocer los shaders del backend de Vulkan.</li></ul></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Documentación detallada y homologada de ejecución directa en Linux nativo. Sin WSL2, sin emulación de contenedor o Docker Passthrough: acceso bare-metal real a través de drivers open-source <strong>Mesa RADV</strong> sobre el novísimo <strong>Ubuntu 26.04 LTS (Resolute Raccoon)</strong> corriendo el kernel Linux 7.0.</p><div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:.85rem;margin-bottom:1.25rem"><div class="stat"><div class="stat-icon">🐧</div><div><div class="stat-lbl">Plataforma Linux</div><div class="stat-val" style="font-size:.82rem">Ubuntu 26.04 LTS</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Kernel 7.0 (Resolute)</div></div></div><div class="stat"><div class="stat-icon">🎛️</div><div><div class="stat-lbl">Driver Vulkan</div><div class="stat-val" style="font-size:.82rem">Mesa RADV 26.0.3</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Vulkan Core version 1.4.341</div></div></div><div class="stat"><div class="stat-icon">💽</div><div><div class="stat-lbl">Particionado</div><div class="stat-val" style="font-size:.82rem">Ext4 dedicada 97GB</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">HDD sdb6 Dual Boot</div></div></div><div class="stat"><div class="stat-icon">📦</div><div><div class="stat-lbl">Docker Runtime</div><div class="stat-val" style="font-size:.82rem">Motor Linux Nativo</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Puentes OpenWebUI al 100%</div></div></div></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Tabla Comparativa Bruta: Windows 10 vs Linux Nativo</h3><div class="tbl"><table><thead><tr><th>Escenario / Carga de Trabajo</th><th>Windows 10 (AMD oficial)</th><th>Linux Ubuntu 26.04 (Mesa RADV)</th><th>Ganador Crucial</th></tr></thead><tbody><tr><td><strong>LLM (Qwen3 4B GGUF) @ 99 capas</strong></td><td>~15-17 tokens/s</td><td><strong>~35 tokens/s (motor RADV)</strong></td><td>🏆 <strong>Linux (2x más rápido)</strong></td></tr><tr><td><strong>LLM Grande (Qwen3.6 35B) @ Max capas</strong></td><td><strong>7.62 tokens/s (máx 10 capas)</strong></td><td>5.18 tokens/s (máx 20 capas)</td><td>⚖️ <strong>Empate Técnico</strong> (Linux permite 2x más capas, Windows es más rápido por capa)</td></tr><tr><td><strong>Stable Diffusion (Dreamshaper8 - 50st)</strong></td><td><strong>~72 segundos (1.44s/it)</strong></td><td>~85 segundos (1.65s/it)</td><td>🏆 <strong>Windows (estable por driver)</strong></td></tr><tr><td><strong>Flux Schnell (4 steps, 512x512)</strong></td><td>~84 segundos (OOM si 1024x1024)</td><td><strong>~52 segundos sampling (Total: 95s)</strong></td><td>🏆 <strong>Linux (mejor swap VRAM)</strong></td></tr><tr><td><strong>whisper.cpp (large-v3-turbo, audio 106s)</strong></td><td>307 s (Uso VRAM: 2.6 GB)</td><td><strong>23.58 s (Uso VRAM: 1.6 GB)</strong></td><td>🏆 <strong>Linux (Absurdamente superior)</strong></td></tr></tbody></table></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Instalación y Dual-Boot Sin Sobrescribir Registros</h3><p style="font-size:.82rem;color:#94a3b8;line-height:1.75">1. En Windows, libera espacio usando el Administrador de Discos (Reducir Volumen).<br>2. Prepara el pendrive con la ISO desktop de <strong>Ubuntu 26.04 amd64</strong>.<br>3. En el instalador de Ubuntu, selecciona la opción "Instalar junto al Windows Boot Manager". El instalador creará la partición y configurará el menú GRUB para permitir la selección de arranque en cada reinicio automáticamente.</p><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Post-Instalación: Validación Bare-Metal de la GPU Polaris</h3><div class="code"><span class="code-lang">bash</span>
10597<pre>lspci | grep -i vga
10598# ¡AMD Radeon RX 580 2048SP detectada!
10599
10600vulkaninfo --summary 2>/dev/null | grep -A5 "Devices"
10601# Debe mostrar: GPU0: DRIVER_ID_MESA_RADV | driverInfo = Mesa 26.0.3 ✅</pre></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Pila de Comandos de Ejecución Homologados en Ubuntu</h3><h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">1. Iniciando llama-server vía Vulkan</h4><div class="code"><span class="code-lang">bash</span><pre>~/llama.cpp/build/bin/llama-server \\
10602  -m "/run/media/aivisions-lab-studio/NVMe/models/qwen3/Qwen3-4B-Q4_K_M.gguf" \\
10603  --host 0.0.0.0 --port 8081 \\
10604  -ngl 99 -t 24</pre></div><h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">2. Generación de Imágenes (Flux Schnell) — Secretos Contra el Cuelgue de GNOME</h4><div class="code"><span class="code-lang">bash</span><pre>~/stable-diffusion.cpp/build/bin/sd-server \\
10605  --listen-ip 0.0.0.0 --listen-port 7860 \\
10606  --diffusion-model /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/flux1-schnell-q4_k.gguf \\
10607  --vae /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/ae.safetensors \\
10608  --clip_l /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/clip_l.safetensors \\
10609  --t5xxl /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/t5xxl_fp16.safetensors \\
10610  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre></div><p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-top:.35rem">💡 <strong>Flags Críticas:</strong> El parámetro <code>--vae-tiling</code> es estrictamente obligatorio. Sin él, la decodificación VAE supera el límite de memoria física y cuelga el entorno gráfico GNOME. Evita usar <code>--backend vulkan0</code> para este modelo pesado en Linux, ya que genera bugs de contexto perdido.</p><h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">3. Transcripción Rápida de Audio vía whisper.cpp</h4><div class="code"><span class="code-lang">bash</span><pre>~/whisper.cpp/build/bin/whisper-cli \\
10611  -m ~/whisper.cpp/models/ggml-large-v3-turbo.bin \\
10612  -f "/ruta/hacia/audio.wav" \\
10613  -l pt --output-txt</pre></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Servicios y Contenedores Docker Corriendo en Paralelo</h3><div class="tbl"><table><thead><tr><th>Contenedor activo</th><th>Imagen Base</th><th>Puerto Mapeado</th><th>Finalidad</th></tr></thead><tbody><tr><td><strong>open-webui</strong></td><td>ghcr.io/open-webui/open-webui:main</td><td>3000 -> 8080</td><td>Panel unificado de Chat con LLM y render SD</td></tr><tr><td><strong>portainer</strong></td><td>portainer/portainer-ce</td><td>9000</td><td>Gestión visual de procesos y pilas Docker</td></tr><tr><td><strong>searxng</strong></td><td>searxng/searxng:latest</td><td>8080</td><td>Motor de búsqueda privado para respuestas ancladas de IA</td></tr></tbody></table></div><div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4"><h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Lecciones Autónomas Aprendidas en Linux</h4><p style="font-size:0.8rem;color:#94a3b8;line-height:1.7"><strong>ROCm Abandonado:</strong> Tarjetas GCN4 / Polaris como la RX 580 ya no tienen soporte en el SDK ROCm oficial. Intentar correr Ollama oficial vía GPU Docker en ella fallará. ¡La ruta de oro es correr <strong>Ollama en la CPU Xeon</strong> o usar <strong>llama-server nativo compilado con Vulkan</strong>! Docker solo debe emplearse para frontends y servidores secundarios libres.</p></div>
10614</div>
10615
10616<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Serviços e Contêineres Docker Rodando Paralelos</h3>
10617<div class="tbl">
10618  <table>
10619    <thead>
10620      <tr>
10621        <th>Contêiner ativo</th>
10622        <th>Imagem Base</th>
10623        <th>Porta Mapeada</th>
10624        <th>Finalidade</th>
10625      </tr>
10626    </thead>
10627    <tbody>
10628      <tr>
10629        <td><strong>open-webui</strong></td>
10630        <td>ghcr.io/open-webui/open-webui:main</td>
10631        <td>3000 -> 8080</td>
10632        <td>Painel unificado de Chat com LLM e render SD</td>
10633      </tr>
10634      <tr>
10635        <td><strong>
10635portainer</strong></td>
10636        <td>portainer/portainer-ce</td>
10637        <td>9000</td>
10638        <td>Gerenciamento visual de processos e pilhas Docker</td>
10639      </tr>
10640      <tr>
10641        <td><strong>searxng</strong></td>
10642        <td>searxng/searxng:latest</td>
10643        <td>8080</td>
10644        <td>Mecanismo de busca privado para as respostas ancoradas de IA</td>
10645      </tr>
10646    </tbody>
10647  </table>
10648</div>
10649
10650<div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4">
10651  <h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Lições Autônomas Aprendidas em Linux</h4>
10652  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7">
10653    <strong>ROCm Abandonado:</strong> Placas GCN4 / Polaris como a RX 580 não têm mais suporte no SDK ROCm oficial. Tentar rodar Ollama oficial via GPU Docker nela falhará. A rota de ouro é rodar o <strong>Ollama na CPU Xeon</strong> ou usar o <strong>llama-server nativo compilado com Vulkan</strong>! Docker só deve ser empregado para frontends e servidores secundários livres.
10654  </p>
10655</div>`},llama:{id:"llama",title:"07. COMPILAÇÃO DO LLAMA.CPP (BACKEND VULKAN)",desc:"Paso a paso con los comandos maestro para generar los binarios optimizados de LLM para la RX 580.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["llamacpp","vulkan-acceleration","compilacao-cpp"],last_reviewed:"2026-07-01",relationships:{prerequisites:["jornada"],previous:"jornada",next:"sdcpp",related:["modelos","limit_qwen_35b"]}},html:`<div class="note">⚠ Asegúrate de ejecutar los comandos a continuación exclusivamente dentro del <strong>Developer PowerShell de Visual Studio</strong></div><div class="code"><pre># Navegar a la partición de alta velocidad y clonar el repositorio oficial
10656cd E:\\
10657git clone https://github.com/ggerganov/llama.cpp
10658cd llama.cpp
10659
10660# Instanciar el directorio de build inyectando la flag compiladora del backend Vulkan
10661cmake -B build -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
10662
10663# Disparar la compilación utilizando 20 hilos paralelos del procesador Xeon
10664cmake --build build --config Release -j20</pre></div><h4 class="s" style="margin-top:1rem;margin-bottom:.5rem;color:#fff">Comando de Validación del Dispositivo de Aceleración</h4><div class="code"><pre>cd build\\bin\\Release
10665.\\llama-cli.exe --list-devices
10666# Retorno esperado de consola: Vulkan0: AMD Radeon RX 580 2048SP ✅</pre></div>`},meta:{id:"meta",title:"36. REFERÊNCIAS E METADADOS DO DOCUMENTO",desc:"Análisis técnico del ciclo de vida físico del hardware heredado y filosofía de reaprovechamiento del laboratorio.",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"metadados",difficulty:"beginner",estimated_time_min:10,tags:["silicon-governance","metadata-specs","efficiency-telemetry"],last_reviewed:"2026-07-01",relationships:{prerequisites:["arquivos"],previous:"arquivos",next:"linhatempo",related:["arquivos","proximos"]}},html:'<blockquote style="font-size:.9rem;color:#94a3b8;font-style:italic;line-height:1.9;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">"La obsolescencia programada comercial es una elección de mercado, no una barrera de ingeniería. El hardware heredado no muere; es liberado por el software correcto."</blockquote><div class="tbl" style="margin-top:.9rem"><table><thead><tr><th>Metadato del Sistema</th><th>Registro de Auditoría</th></tr></thead><tbody><tr><td>Versión del Deploy</td><td>VULKAN_DEPLOY_V3.0_COMPLETO</td></tr><tr><td>Año del Registro</td><td>Histórico Consolidado // Temporada 2026</td></tr><tr><td>Alcance de Autoría</td><td>Arquitectura de Sistemas Black Tuxedo AI Solutions</td></tr></tbody></table></div>'},modelos:{id:"modelos",title:"09. CONVERSÃO DE MODELOS PARA FORMATO GGUF",desc:"Optimización y cuantización de archivos .safetensors estándar al formato aceptado por el motor ggml.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"quantizacao",difficulty:"intermediate",estimated_time_min:15,tags:["gguf","quantizacao-modelos","vram-8gb"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdcpp"],previous:"sdcpp",next:"sdserver",related:["llama","comfyui-modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.9rem">Los runtimes optimizados en C++ de <code>stable-diffusion.cpp</code> exigen el formato de archivo estructurado en <code style="color:var(--r)">.gguf</code>. Los modelos tradicionales descargados de Civitai (.safetensors) necesitan pasar por el conversor nativo:</p><div class="code"><pre># Comando para conversión directa y aplicación de cuantización estable en 8-bits (q8_0)
10667.\\sd-cli.exe -M convert -m "E:\\models\\DreamShaper_8.safetensors" -o "E:\\models\\dreamshaper8.gguf" --type q8_0</pre></div><div class="code ok" style="margin-top:.75rem"><pre># Log de finalización del proceso:
10668[INFO] convert 'DreamShaper_8.safetensors' to 'dreamshaper8.gguf' success ✅</pre></div>`},prereqs:{id:"prereqs",title:"05. PRÉ-REQUISITOS DO SISTEMA",desc:"Herramientas necesarias para compilar los binarios abiertos y levantar los servidores locales.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"dependencias",difficulty:"intermediate",estimated_time_min:20,tags:["cmake","git","msvc-compiler","gcc","vulkan-sdk"],last_reviewed:"2026-07-01",relationships:{prerequisites:["solucao"],previous:"solucao",next:"jornada",related:["llama","sdcpp"]}},html:`<div class="c2"><div class="card"><p style="font-size:.58rem;color:var(--r);text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">⚠ ENTORNO DE COMPILACIÓN (GPU)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">Developer PowerShell de VS</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">
10668Abre a través del Menú Inicio → "Developer PowerShell for VS 2022"</p></div><div class="card"><p style="font-size:.58rem;color:#22c55e;text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">✅ ENTORNO DE EJECUCIÓN (RUNTIME)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">PowerShell Estándar de Windows</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">Ejecuta los binarios finales compilados sin overhead del ecosistema dev</p></div></div><div class="tbl" style="margin-top:1rem"><table><thead><tr><th>Software / SDK</th><th>Versión Homologada</th><th>Notas de Configuración Esenciales</th></tr></thead><tbody><tr><td>Visual Studio Community</td><td>2022 o 2026</td><td>Obligatorio marcar la carga de trabajo: "Desarrollo para escritorio con C++"</td></tr><tr><td>CMake Compiler</td><td>v4.3.2+</td><td>Disponible en cmake.org. Recordar marcar: "Add CMake to system PATH"</td></tr><tr><td>Vulkan SDK</td><td>v1.4.341.1</td><td>Descargar vía LunarG. Instalación estándar obligatoriamente en <code>C:\\VulkanSDK\\</code></td></tr><tr><td>Git Windows</td><td>Última estable</td><td>Instalador oficial para clonación de repositorios open-source</td></tr><tr><td>Docker Desktop</td><td>v4.x+</td><td>Necesario para correr el ecosistema OpenWebUI y pipelines auxiliares como SearXNG</td></tr><tr><td>WSL2 Subsystem</td><td>Ubuntu 22.04.5 LTS</td><td>Base de ejecución estable para el entorno Python de ComfyUI y Ollama</td></tr><tr><td>Miniconda Linux</td><td>Rama Python 3.11</td><td>Gestor aislado de paquetes corriendo dentro del subsistema Linux WSL2</td></tr></tbody></table></div><div class="code"><pre># Comandos de validación del entorno de compilación
10669cmake --version
10670# Retorno esperado: cmake version 4.3.2 ✅
10671
10672dir C:\\VulkanSDK
10673# Retorno esperado: visualización del directorio de la versión 1.4.341.1 ✅</pre></div>`},proving_hypothesis_35b:{id:"proving_hypothesis_35b",title:"42. PROVANDO A HIPÓTESE: CURL, CTX-SIZE 8192 E A PRIMEIRA RESPOSTA COMPLETA",desc:"Continuação direta da Seção 33 · 3 testes · Hipótese confirmada · Hardware de 2017",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:35,tags:["context-length","offloading-layer","matematica-tensores"],last_reviewed:"2026-07-01",relationships:{prerequisites:["limit_qwen_35b"],previous:"limit_qwen_35b",next:"sdxl_vulkan",related:["limit_qwen_35b","cpu"]},part:1},html:`<div class="whisper-doc">
10674  <div class="hero">
10675    <div class="hero-title"><span>Provando a Hipótese</span> — Qwen3.5 35B</div>
10676    <div class="hero-sub">Experimentos conclusivos validando preenchimento de contexto, timeouts de cliente e comparação Q4_K_M vs Q6_K no silício de 2017.</div>
10677    <div class="hero-badges">
10678      <span class="badge badge-gpu">AMD RX 580 8GB</span>
10679      <span class="badge badge-win">Xeon E5-2690 v3</span>
10680      <span class="badge badge-ok">Hipótese Provada</span>
10681      <span class="badge badge-ok">--ctx-size 8192</span>
10682      <span class="badge badge-win">Q4_K_M vs Q6_K</span>
10683    </div>
10684  </div>
10685
10686  <div class="stat-grid">
10687    <div class="stat">
10688      <div class="stat-label">Velocidade (Q4_K_M)</div>
10689      <div class="stat-value">6.42 - 6.65 tok/s</div>
10690      <div class="stat-sub">Sem Swap Ativo</div>
10691    </div>
10692    <div class="stat">
10693      <div class="stat-label">Contexto Provado</div>
10694      <div class="stat-value">8.192 tokens</div>
10695      <div class="stat-sub">Acomoda modo de Raciocínio</div>
10696    </div>
10697    <div class="stat">
10698      <div class="stat-label">Temperatura Máxima</div>
10699      <div class="stat-value">74°C</div>
10700      <div class="stat-sub">10°C mais frio com Q4_K_M</div>
10701    </div>
10702    <div class="stat">
10703      <div class="stat-label">Status do Hardware</div>
10704      <div class="stat-value">100% Aprovado</div>
10705      <div class="stat-sub">Zero crashes / 4 slots paralelos</div>
10706    </div>
10707  </div>
10708
10709  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.0 — Contexto e Motivação</h3>
10710  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10711    A Seção 33 terminou com uma hipótese clara: <em>"O problema nunca foi o hardware. Foi a combinação de thinking 
10711+ web search esgotando os 4.096 tokens de contexto. Com prompt curto e sem web search, o Qwen3.5-35B Q6_K responde normalmente numa RX 580 de 2017."</em>
10712  </p>
10713  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
10714    Em 16 de junho de 2026, o AIVisionsLab executou os testes pendentes sugeridos para provar essa hipótese ao vivo, avaliando o comportamento com curl direto (sem timeout do cliente), habilitando a flag de tamanho de contexto ampliado e testando quantizações mais eficientes.
10715  </blockquote>
10716
10717  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.1 — Hardware do Laboratório</h3>
10718  <div class="tbl">
10719    <table>
10720      <thead>
10721        <tr>
10722          <th>Componente</th>
10723          <th>Especificação</th>
10724        </tr>
10725      </thead>
10726      <tbody>
10727        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 cores / 24 threads · 3,05 GHz turbo (Lançado em 2014)</td></tr>
10728        <tr><td><strong>RAM</strong></td><td>31,8 GB DDR4 REG ECC (quad-channel)</td></tr>
10729        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (Lançado em 2017)</td></tr>
10730        <tr><td><strong>Storage NVMe</strong></td><td>SSD NVMe (Disco E:) — modelos GGUF (Leitura de 1.7–3.5 GB/s)</td></tr>
10731        <tr><td><strong>Storage HDD</strong></td><td>HDD (Disco C: / F:) — sistema Windows + swap</td></tr>
10732        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — lançado em 20/05/2026</td></tr>
10733        <tr><td><strong>Sistema</strong></td><td>Windows 10 Pro com WSL2 activo</td></tr>
10734      </tbody>
10735    </table>
10736  </div>
10737
10738  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.2 — Modelos Testados</h3>
10739  <div class="tbl">
10740    <table>
10741      <thead>
10742        <tr>
10743          <th>Modelo</th>
10744          <th>Quantização</th>
10745          <th>Tamanho do Arquivo</th>
10746          <th>Parâmetros da Arquitetura</th>
10747        </tr>
10748      </thead>
10749      <tbody>
10750        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q6_K</strong></td><td>6 bits</td><td>28,51 GB</td><td>34,66B (MoE)</td></tr>
10751        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M</strong></td><td>4 bits (Medium)</td><td><strong>21,17 GB</strong></td><td>34,66B (MoE)</td></tr>
10752        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q5_K_M</strong></td><td>5 bits (Medium)</td><td>24,76 GB</td><td>34,66B (MoE)</td></tr>
10753      </tbody>
10754    </table>
10755  </div>
10756  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
10757    *Nota: Todos os modelos possuem arquitetura idêntica de Mixture of Experts (MoE), variando apenas a compressão matemática de seus pesos.
10758  </p>
10759
10760  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.3 — Localizando os Executáveis</h3>
10761  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10762    Antes de testar, foi necessário localizar as compilações otimizadas do <code>llama-server</code>. No PowerShell do laboratório:
10763  </p>
10764  <div class="cmd">Get-ChildItem -Path E:\\ -Recurse -Filter "llama-server.exe" -ErrorAction SilentlyContinue
10765 
10766# Resultado:
10767E:\\llama.cpp\\llama-server.exe (stub de 9KB)
10768E:\\llama.cpp\\build\\bin\\Release\\llama-server.exe (Executável real de 7.5MB) ◀</div>
10769
10770  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.4 — Teste 9: Curl Direto Sem Timeout</h3>
10771  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.1 — Motivação</h4>
10772  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10773    Identificar se o gargalo de timeout relatado no Teste 4 residia no servidor ou estritamente nas requisições AJAX do cliente OpenWebUI.
10774  </p>
10775
10776  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.2 — Inicialização do Servidor</h4>
10777  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
10778.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --p
10778ort 8081</div>
10779
10780  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.3 — Resolvendo Escaping de JSON no PowerShell</h4>
10781  <div class="cmd">'{"model":"any","messages":[{"role":"user","content":"Explique MoE em 3 paragrafos"}]}' | Out-File -Encoding utf8 -FilePath "E:\\teste.json"</div>
10782
10783  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.4 — Executando a Chamada de Longa Duração</h4>
10784  <div class="cmd">curl.exe -X POST http://localhost:8081/v1/chat/completions -H "Content-Type: application/json" --max-time 600 -d "@E:\\teste.json"</div>
10785
10786  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.5 — Resultado Analítico</h4>
10787  <div class="cmd">truncated = 0  ◀ RESPOSTA COMPLETA ENTREGUE COM SUCESSO
10788total time = 266.42 s / 1955 tokens
10789eval time  = 255.97 s / 1683 tokens @ 6.57 t/s</div>
10790  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
10791    <strong>Veredicto técnico:</strong> O hardware de 2017 processou e entregou a resposta perfeitamente! O problema anterior era o tempo limite do navegador desistindo da conexão TCP, enquanto o servidor continuava gerando em background.
10792  </p>
10793
10794  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.5 — Paralelismo Real: 4 Slots de Computação</h3>
10795  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10796    Durante o Teste 9, o OpenWebUI foi conectado paralelamente disparando a mesma pergunta. O motor de agendamento do llama.cpp processou de forma concorrente sem travamentos:
10797  </p>
10798  <div class="cmd">Task 0 (curl)      — n_decoded = 1125, tg = 5.96 t/s
10799Task 875 (OpenWebUI) — n_decoded = 243,  tg = 5.08 t/s</div>
10800<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10801    A arquitetura resistiu de forma estável (GPU: 63°C, VRAM: 7.1/8.0 GB, RAM: 91% de uso de sistema total seguro, sem travar o Windows).
10802  </p>
10803
10804  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.6 — Teste 7: Habilitando Contexto Extremo (--ctx-size 8192)</h3>
10805  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.1 — O Comando Otimizado</h4>
10806  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
10807.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --p
10807ort 8081 --ctx-size 8192</div>
10808
10809  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.2 — Prompt de Teste e Comportamento do Thinking</h4>
10810  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">
10811    "Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."
10812  </blockquote>
10813  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10814    Ao receber o prompt, o processador de pensamento rodou por longos 9 minutos em background na CPU trabalhando com o contexto de 8192 tokens. A análise interna destrinchou a matemática da VRAM (calculou que 35B em INT4 exige 17,5GB de peso puro) para desvendar as complexidades de esparsidade de ativação.
10815  </p>
10816
10817  <h4 style="color:rgba(225,29,72,0.9);font-weight:700;font-size:0.95rem;margin-top:2rem;margin-bottom:0.5rem">34.6.2-A — O Raciocínio Interno do Modelo: Análise Comparativa dos Três Thinking Blocks</h4>
10818  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
10819    Durante as exaustivas sessões de ensaio das Seções 33 e 34, o Qwen3.5-35B gerou três blocos independentes de raciocínio de bastidores (<code>&lt;think&gt;</code>) que foram capturados via interceptação direta de pacotes brutos. A tabulação e o mapeamento sistemático dessas sessões fornecem evidências fundamentais de análise cognitiva do modelo:
10820  </p>
10821
10822  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">1. Thinking Block 1 — Quantização Q6_K — Sessão 1 (23:06 de 15/06)</h5>
10823  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
10824    <strong>Prompt:</strong> <em>"Explique detalhadamente o mecanismo de atenção nos Transformers e por que MoE é mais eficiente que modelos densos."</em><br>
10825    <strong>Tempo de Raciocínio:</strong> ~4 minutos | <strong>Tokens do Bloco:</strong> ~2.000 | <strong>Status:</strong> ✅ Concluído com Sucesso.
10826  </p>
10827  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
10828    <span style="color:#e11d48">// Linha de Pensamento do Qwen3.5 (Q6_K):</span><br>
10829    - Deconstruct query into structured chunks: Attention math, Multi-head, MoE, benefits vs dense.<br>
10830    - Detail Attention: Focus on Scaled Dot-Product mathematical formulation (Q, K, V). Show why division by sqrt(d_k) is required to prevent vanishing gradients during Softmax.<br>
10831    - Explain Multi-Head as parallel subspace projections (capturing both strict syntactic dependencies and semantic references).<br>
10832    - Deconstruct MoE: Discuss role of Router/Gating network, Routing sparsity (top-k selection), and load balancing to prevent routing collapse (unused experts).<br>
10833    - <span style="color:#a3e635">[Autocorreção Interna]</span>: "Wait, I must check if MoE is always faster. I should explicitly note that MoE is memory-intensive for routing/loading but highly sparse computationally. If memory bandwidth is bottlenecked under dual-system offloading, token generation speed depends strongly on mmap performance."
10834  </div>
10835
10836  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">2. Thinking Block 2 — Quantização Q4_K_M — Sessão 2 (05:05 de 16/06)</h5>
10837  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
10838    <strong>Prompt:</strong> <em>"Qual a diferença entre MoE e modelo denso, e por que MoE permite rodar 35B numa GPU de 8GB?"</em><br>
10839    <strong>Tempo de Raciocínio:</strong> ~11 minutos | <strong>Tokens do Bloco:</strong> ~3.500 | <strong>Status:</strong> ❌ Interrompido por esgotamento de contexto (Límite 4096).
10840  </p>
10841  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
10842    <span style="color:#e11d48">// Linha de Pensamento do Qwen3.5 (Q4_K_M):</span><br>
10843    - Analysis of premise: Running 35 billion parameter model in 8GB VRAM.<br>
10844    - <span style="color:#f43f5e">
10844[Cálculo Físico Espontâneo]</span>:<br>
10845      * FP32 weights: 35B * 4 bytes = 140 GB. Impossible.<br>
10846      * FP16 weights: 35B * 2 bytes = 70 GB. Impossible.<br>
10847      * INT8 quant:  35B * 1 byte = 35 GB. Impossible.<br>
10848      * INT4 quant:  35B * 0.5 bytes = 17.5 GB. Still larger than 8GB. This doesn't fit natively.<br>
10849    - Challenge the premise: "Wait, if the model indeed runs on 8GB, there must be extreme offloading, sparse activation memory loading, or aggressive hybrid quantization."<br>
10850    - <span style="color:#a3e635">[Autocorreção Crítica]</span>: "Ah! The user says 'por que o MoE permite rodar'. But actually, MoE weights are typically larger than equivalent dense models. A 35B MoE has 35B total parameters but only roughly 6B-8B active parameters per token. If we offload the inactive experts to system memory (RAM/mmap swap) and only load the active experts or the shared dense blocks onto the GPU, then the GPU memory footprint during active tensor computation is massively reduced. Let me structure this hypothesis."<br>
10851    - <span style="color:#d946ef">[Análise Meta-Arquitetural]</span>: Elaborating on the split mechanism. Router stays in VRAM for instant routing, shared blocks in VRAM, active experts fetched from RAM dynamically during forward pass.
10852  </div>
10853  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
10854    <em>Nota Conclusiva de Engenharia:</em> Enquanto o modelo formulava esse raciocínio fascinante na CPU, ele estava descrevendo em profundidade matemática exatamente o sistema de mmap distribuído e a arquitetura Vulkan de 4 níveis de memória que o sustentava em tempo real — sem possuir acesso direto aos metadados do container ou ao sistema de arquivos do laboratório.
10855  </p>
10856
10857  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">3. Thinking Block 3 — Quantização Q4_K_M — Sessão 2 (05:24 de 16/06)</h5>
10858  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
10859    <strong>Prompt:</strong> <em>"Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."</em><br>
10860    <strong>Tempo de Raciocínio:</strong> ~9 minutos | <strong>Tokens do Bloco:</strong> ~3.000 | <strong>Status:</strong> ✅ Concluído com Sucesso (--ctx-size 8192).
10861  </p>
10862  <div style="background:#090a0f;border:1px solid rgba(34,197,94,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a3e635;margin-bottom:1rem">
10863    <span style="color:#a3e635">// Linha de Pensamento do Qwen3.5 (Q4_K_M com limite otimizado):</span><br>
10864    - Prompt requests: Portuguese, direct, concise.<br>
10865    - Challenge VRAM claim again internally: MoE total size is bigger than dense, but active size is smaller. VRAM savings must come from smaller activation graphs (fewer experts evaluated simultaneously) and CPU-offloaded weight mapping.<br>
10866    - Work step-by-step to compress explanation to fit "direto e conciso":<br>
10867      * <span style="color:#cbd5e1">Rascunho v1:</span> Long theoretical detail on Router and CPU/VRAM exchange metrics.<br>
10868      * <span style="color:#cbd5e1">Refinamento v2:</span> Cut down router math, focus on "Ativação Esparsa" (activation memory bounds).<br>
10869      * <span style="color:#cbd5e1">Compressão Final:</span> Produce 3 crisp, highly readable Portuguese bullet points summarizing Active Parameters, Activation Garty/Memory limit, and Compute Scalability.
10870  </div>
10871<h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">Tabela Comparativa de Comportamento Cognitivo</h5>
10872  <div class="tbl">
10873    <table>
10874      <thead>
10875        <tr>
10876          <th>Métrica de Profiling</th>
10877          <th>Sessão 1 (Q6_K)</th>
10878          <th>Sessão 2-A (Q4_K_M)</th>
10879          <th>Sessão 2-B (Q4_K_M / ctx 8192)</th>
10880        </tr>
10881      </thead>
10882      <tbody>
10883        <tr><td><strong>Duração do Raciocínio</strong></td><td>~4 minutos</td><td><strong>~11 minutos</strong></td><td>~9 minutos</td></tr>
10884        <tr><td><strong>Volume do Bloco &lt;think&gt;</strong></td><td>~2.000 tokens</td><td><strong>~3.500 tokens</strong></td><td>~3.000 tokens</td></tr>
10885        <tr><td><strong>Autocorreções Efetuadas</strong></td><td>2</td><td><strong>7 (Autocorreções profundas)</strong></td><td>4 (Foco em concisão)</td></tr>
10886        <tr><td><strong>Questionamento de Premissa?</strong></td><td>Não</td><td><strong>✅ Sim (Provou erro matemático do prompt)</strong></td><td>Sim (reajuste técnico)</td></tr>
10887        <tr><td><strong>Raciocínio Matemático</strong></td><td>Equação Transformers</td><td><strong>Cálculo do tamanho de pesos reais</strong></td><td>Cálculo de buffers de ativação</td></tr>
10888        <tr><td><strong>Entrega do Texto</strong></td><td>✅ Sucesso</td><td>❌ Estouro (4096 esgotados)</td><td><strong>✅ Sucesso Absoluto (Zero cortes)</strong></td></tr>
10889      </tbody>
10890    </table>
10891  </div>
10892
10893  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.8 — Cronograma Histórico do Laboratório</h3>
10894  <div class="tbl">
10895    <table>
10896      <thead>
10897        <tr>
10898          <th>Sessão do Experimento</th>
10899          <th>ID</th>
10900          <th>Parâmetros de Ctx</th>
10901          <th>Geração (tok/s)</th>
10902          <th>Corte de Fluxo (truncated)</th>
10903          <th>Resultado Efetivo</th>
10904        </tr>
10905      </thead>
10906      <tbody>
10907        <tr><td>Seção 34 — Teste 5</td><td>Q6_K</td><td>4096 tokens</td><td>5,57 t/s</td><td>0 (prompt enxuto)</td><td>✅ Resposta entregue (contexto enxuto)</td></tr>
10908        <tr><td>Seção 34 — Teste 9 (curl)</td><td>Q4_K_M</td><td>4096 tokens</td><td><strong>6,57 t/s</strong></td><td>0 (sem timeout)</td><td>
10908✅ Resposta integral por canal direto</td></tr>
10909        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Seção 34 — Teste 7 (WebUI)</strong></td><td>Q4_K_M</td><td>8192 tokens</td><td>6,42 t/s</td><td>0</td><td>✅ Resposta completa com raciocínio expandido</td></tr>
10910      </tbody>
10911    </table>
10912  </div>
10913
10914  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.9 — Nova Coleção de Lições Técnicas Consolidadas</h3>
10915  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
10916    <li><strong style="color:#fff">Lição 6 — O fator Timeout do Cliente:</strong> A maior parte dos erros apontados por testadores não decorre de incapacidade física da GPU, mas sim da persistência HTTP falha de interfaces que desistem antes da decodificação final.</li>
10917    <li><strong style="color:#fff">Lição 7 — Ajuste de Buffers de Contexto:</strong> Ativar a diretiva <code>--ctx-size 8192</code> remove o limite asfixiante do buffer de raciocínio, oferecendo fôlego de processamento para os mais de 3.500 tokens exigidos de raciocínio lógico interno.</li>
10918    <li><strong style="color:#fff">Lição 8 — Supremacia de Carregamento da Quantização Média:</strong> Rodar 35B com quantização de 4 bits economiza 7GB cruciais na carga física de RAM da CPU, reduzindo o I/O do Swap do disco e otimizando a temperatura.</li>
10919    <li><strong style="color:#fff">Lição 9 — Raciocínio de Modelo Crítico:</strong> O Qwen3.5 MoE questionou a premissa errônea presente no prompt, calculando pesos em tempo real e rebatendo sobre o offloading híbrido, o que prova comportamento de atenção e alinhamento impecáveis.</li>
10920    <li><strong style="color:#fff">Lição 10 — Paralelismo nativo estável:</strong> A coexistência de chamadas em canais concorrentes prova a maturidade das implementações de pipeline de shaders Vulkan no llama.cpp.</li>
10921  </ul>
10922
10923  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.10 — Setup Recomendado para Implementações Futuras</h3>
10924  <div class="cmd"># Script do Laboratório para inicialização de produção
10925cd E:\\llama.cpp\\build\\bin\\Release
10926 
10927.\\llama-server.exe \`
10928  -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" \`
10929  --host 0.0.0.0 \`
10930  --port 8081 \`
10931  --ctx-size 8192</div>
10932  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
10933    *Instruções de interface complementares: Desativação estrita de Web Search e geração e imagens durante o processamento híbrido extremo.
10934  </p>
10935
10936  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.11 — Veredicto Geral do Laboratório (Provando a Hipótese)</h3>
10937  <div class="tbl">
10938    <table>
10939      <thead>
10940        <tr>
10941          <th>Questão de Engenharia</th>
10942          <th>Veredicto Final</th>
10943        </tr>
10944      </thead>
10945      <tbody>
10946        <tr><td><strong>O curl resolve o timeout do OpenWebUI?</strong></td><td>✅ <strong>Sim</strong> (truncated = 0, resposta 100% íntegra)</td></tr>
10947        <tr><td><strong>CTX-SIZE de 8.192 resolve o thinking mode esmagado?</strong></td><td>✅ <strong>Sim</strong> (Acomoda com folga raciocínios longos)</td></tr>
10948        <tr><td><strong>Q4_K_M é superior para o cenário de 32GB de RAM?</strong></td><td>✅ <strong>Sim</strong> (Mais rápido, mais frio, menor swap)</td></tr>
10949        <tr><td><strong>A hipótese de esgotamento de contexto foi confirmada?</strong></td><td>✅ <strong>Absolutamente</strong></td></tr>
10950        <tr><td><strong>Sobrecusto financeiro para otimização em 2026?</strong></td><td>✅ <strong>R$ 0,00</strong> (Solução lógica via flags)</td></tr>
10951      </tbody>
10952    </table>
10953  </div>
10954
10955  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.12 — Tags e Metadados</h3>
10956  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
10957    <div>🏷️ <strong>Tags:</strong> curl, ctx-size, timeout, openwebui, q4km, q6k, paralelismo, thinking-mode, resposta-completa, hipotese-confirmada, rx580</div>
10958    <div style="margin-top:0.5rem">💻 <strong>Hardware:</strong>
10958 RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
10959    <div style="margin-top:0.25rem">💿 <strong>Software:</strong> llama.cpp (build\\bin\\Release) + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
10960    <div style="margin-top:0.25rem">📅 <strong>Data:</strong> 16/06/2026</div>
10961    <div style="margin-top:0.25rem">📊 <strong>Testes:</strong> 3 (Teste 9 curl, paralelismo real, Teste 7 ctx8192)</div>
10962    <div style="margin-top:0.25rem">📈 <strong>Benchmark:</strong> 6,42–6,65 tok/s (Q4_K_M) | truncated = 0</div>
10963    <div style="margin-top:0.25rem">🔥 <strong>Temperatura pico:</strong> 74°C</div>
10964    <div style="margin-top:0.25rem">🏆 <strong>Status final:</strong> ✅ HIPÓTESE CONFIRMADA</div>
10965  </div>
10966
10967  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
10968    "O problema nunca foi o hardware. Era uma flag e um timeout."<br>
10969    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 16/06/2026</span>
10970  </blockquote>
10971
10972  <div class="footer">
10973    Documentação gerada por Claude Sonnet 4.6 — 16/06/2026 · Baseada em logs reais, screenshots e benchmarks ao vivo · 3 testes documentados · Hipótese confirmada · Hardware de 2017 processando IA de 2025
10974  </div>
10975</div>`},proximos:{id:"proximos",title:"34. PRÓXIMOS PASSOS (ROADMAP 2027)",desc:"Próximas metas de desarrollo: Clusters Multi-GPU Vulkan y malla local de agentes autónomos.",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"planejamento",difficulty:"beginner",estimated_time_min:10,tags:["roadmap-2027","planejamento-tecnico","novas-verticais"],last_reviewed:"2026-07-01",relationships:{prerequisites:["codacus"],previous:"codacus",next:"arquivos",related:["jornada","meta"]}},html:'<div class="card" style="border-left:3px solid #22c55e"><p style="font-size:.88rem;color:#fff;font-weight:600">Planificación de Expansión del Infraestructura Computacional:</p><ul style="padding-left:1.2rem;margin-top:.45rem;font-size:.85rem;color:#94a3b8;line-height:2"><li><strong style="color:#fff">[ ] Homologación de Cluster Multi-GPU:</strong> Acoplamiento de una segunda tarjeta gráfica RX 580 en paralelo vía Vulkan para distribución de tensores de peso.</li><li><strong style="color:#fff">[ ] Mapeo de Agentes Locales Autónomos:</strong> Integración completa del framework CrewAI corriendo nativamente sobre la API de OpenWebUI para automatización empresarial.</li></ul></div>'},scripts:{id:"scripts",title:"21. SCRIPTS E AUTOMAÇÃO",desc:"Scripts por lotes para limpiar la memoria de vídeo e inicializar los servidores locales sin conflictos.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:15,tags:["reboot-stack","memory-flush","manutencao-servidor"],last_reviewed:"2026-07-01",relationships:{prerequisites:["stack"],previous:"stack",next:"guia",related:["reboot_stack","sd_bat_automation"]}},html:`<h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">19.A — Script Master (Todos los Servicios)</h4><div class="code"><span class="code-lang">batch</span><pre>@echo off
10976title INFRASTRUCTURE IA - REBOOT STACK
10977cls
10978echo Forzando el cierre de instancias activas en segundo plano...
10979taskkill /F /IM sd-server.exe 2>nul
10980taskkill /F /IM llama-server.exe 2>nul
10981timeout /t 2 /nobreak >nul
10982
10983echo Inicializando LLM vía Vulkan en RX 580 (puerto 8081)...
10984start "LLM Server - Vulkan RX580" C:\\llama.cpp\\build\\bin\\Release\\llama-server.exe ^
10985  -m "E:\\MODELO LLM PARA GPU\\Mistral-7B-Q4_K_M.gguf" ^
10986  --host 0.0.0.0 ^
10987  --port 8081 ^
10988  --device Vulkan0
10989
10990timeout /t 3 /nobreak >nul
10991
10992echo Inicializando SD Server vía Vulkan en RX 580 (puerto 7860)...
10993E:
10994cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
10995sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
10996  -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
10997
10998pause</pre></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.B — Conectar LLM a OpenWebUI</h4><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Tras iniciar llama-server, conéctalo a OpenWebUI:</p><ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:.75rem"><li>Accede a <code style="color:var(--r)">http://localhost:3000</code></li><li>Haz clic en el avatar → <strong style="color:#fff">Panel de Administración</strong></li><li>Ve a <strong style="color:#fff">Configuración → Conexiones</strong></li><li>En la sección <strong style="color:#fff">API OpenAI</strong> haz clic en <strong style="color:#fff">"+"</strong></li><li>Rellena los campos de abajo:</li></ol><div class="tbl"><table><thead><tr><th>
10998Campo</th><th>Valor</th></tr></thead><tbody><tr><td>URL</td><td><code>http://host.docker.internal:8081/v1</code></td></tr><tr><td>API Key</td><td><code>sk-local</code></td></tr></tbody></table></div><ol start="6" style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-top:.75rem"><li>Haz clic en el icono de <strong style="color:#fff">refresh</strong> — debe aparecer una franja verde ✅</li><li>Guarda</li></ol><div class="card" style="margin-top:.75rem;border-left:3px solid #eab308;padding-left:.9rem"><p style="font-size:.85rem;color:#94a3b8;line-height:1.8"><strong style="color:#eab308">⚠️ No uses <code>127.0.0.1</code></strong> — Docker corre en una red aislada WSL2 y no ve el localhost de Windows. Usa siempre <code style="color:var(--r)">host.docker.internal</code>.</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.C — Validación en el Chat</h4><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Tras guardar, abre un <strong style="color:#fff">Nuevo Chat</strong> en OpenWebUI:</p><ul style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem"><li>El modelo <code style="color:var(--r)">Mistral-7B-Q4_K_M.gguf</code> aparece en la lista en <strong style="color:#fff">Externo</strong></li><li>Selecciónalo y conversa normalmente</li><li>El modelo corre 100% en la <strong style="color:#fff">RX 580 vía Vulkan</strong> — no en Ollama</li></ul><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.D — Verificar si está en la GPU (no en CPU)</h4><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem">En la terminal de llama-server, confirma:</p><div class="code"><span class="code-lang">log</span><pre>ggml_vulkan: Found 1 Vulkan device(s)
10999ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
11000llama server listening at http://0.0.0.0:8081</pre></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:.75rem 0 .5rem 0">Y durante la inferencia aparece el benchmark:</p><div class="code"><span class="code-lang">log</span><pre>17.77 t/s  ← RX 580 Vulkan ✅</pre></div><div class="card" style="margin-top:.75rem"><p style="font-size:.85rem;color:#64748b;line-height:1.8">Si solo aparece <code>3-5 t/s</code> sin la línea <code>ggml_vulkan</code> — está corriendo en CPU. Verifica que <code style="color:var(--r)">--device Vulkan0</code> esté en el comando.</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.E — Tres Interfaces Disponibles</h4><div class="tbl"><table><thead><tr><th>Interfaz</th><th>URL</th><th>Cuando Usar</th></tr></thead><tbody><tr><td><strong style="color:#fff">UI nativa llama.cpp</strong></td><td><code>http://127.0.0.1:8081</code></td><td>Pruebas rápidas directas en el navegador</td></tr><tr class="hig"><td><strong style="color:#fff">OpenWebUI</strong></td><td><code>http://localhost:3000</code></td><td>Uso diario con historial y RAG</td></tr><tr><td><strong style="color:#fff">API directa</strong></td><td><code>http://192.168.15.68:8081/v1</code></td><td>Integración con otras apps</td></tr></tbody></table></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.F — Reglas Críticas del Script</h4><div class="tbl"><table><thead><tr><th>Regla</th><th>Motivo</th></tr></thead><tbody><tr class="hig"><td>Obligatorio <code>--host 0.0.0.0</code></td><td><code>127.0.0.1</code> bloquea Docker</td></tr><tr class="hig"><td>Obligatorio <code>--device Vulkan0</code></td><td>Sin esto cae a CPU (3-5 t/s)</td></tr><tr><td><code>taskkill</code> antes de iniciar</td><td>Libera VRAM de procesos atascados</td></tr><tr><td><code>host.docker.internal</code> en OpenWebUI</td><td>Única dirección que Docker ve en el host Windows</td></tr></tbody></table></div>`},sd_bat_automation:{id:"sd_bat_automation",title:"12. SD-SERVER LOCAL / BOOT SEQUENCE",de
11000sc:"Script por lotes dedicado a la inicialización segura y reproducible del servidor de IA.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:12,tags:["batch-automation","loop-monitoramento","gerenciamento-portas"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux_server"],previous:"flux_server",next:"sd_openwebui_integration",related:["scripts","reboot_stack"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Para evitar errores manuales, rutas incorrectas o puertos atascados en la VRAM al reiniciar Windows, el servidor debe iniciarse exclusivamente vía un archivo <code>.bat</code> en el Escritorio.</p><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Script de Producción (iniciar_ia_server.bat):</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px">@echo off
11001title Servidor Stable Diffusion Local - Produccion
11002cls
11003
11004:: 1. Limpieza de procesos fantasma en VRAM/RAM
11005taskkill /f /im sd-server.exe 2>nul
11006taskkill /f /im sd-cli.exe 2>nul
11007timeout /t 2 /nobreak >nul
11008
11009:: 2. Salto de unidad y ruta nativa (sintaxis CMD)
11010E:
11011cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
11012
11013:: 3. Ejecucion con escucha abierta para Docker
11014sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
11015
11016pause</pre><div class="tbl" style="margin:1.25rem 0"><table><thead><tr><th>Regla</th><th>Motivo</th></tr></thead><tbody><tr><td>Nunca usar <code>.\\</code> antes del ejecutable</td><td>CMD tradicional no lo reconoce — rompe el terminal</td></tr><tr><td>Bloque <code>taskkill</code> obligatorio</td><td>Libera el puerto 7860 atascado en procesos en segundo plano</td></tr><tr><td>Salto de unidad (<code>E:</code>) antes de <code>cd</code></td><td>CMD no cambia de unidad sin el salto explícito</td></tr></tbody></table></div><div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;"><span style="color:#22c55e; font-weight:bold">✅ ESTADO: AUTOMATIZACIÓN VALIDADA EN PRODUCCIÓN</span><br><span style="font-size:.8rem; color:#94a3b8">Doble clic en el .bat inicializa el ecosistema completo — limpieza, ruta y bind de puerto en secuencia</span></div>`},sd_openwebui_integration:{id:"sd_openwebui_integration",title:"13. INTEGRAÇÃO OPENWEBUI + DOCKER",desc:"Puente de red entre el contenedor Docker de OpenWebUI y el motor C++ nativo ejecutándose en la GPU del host.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"integracao",difficulty:"advanced",estimated_time_min:35,tags:["open-webui","docker-compose","networking-docker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_bat_automation"],previous:"sd_bat_automation",next:"comfyui-wsl",related:["sdserver","comfyui-wsl"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Cuando el motor de generación corre fuera del contenedor Docker, la comunicación local estándar (<code>127.0.0.1</code>) es bloqueada por el aislamiento de red y el Firewall de Windows. La inicialización y la ruta deben ser explícitas.</p><p style="font-size:.88rem;color:#fff;margin-bottom:.5rem">⚙️ <strong>Parámetros Críticos de Inicialización</strong></p><div class="tbl" style="margin-bottom:1.25rem"><table><thead><tr><th>Flag</th><th>Valor</th><th>Descripción</th></tr></thead><tbody><tr><td><code>--listen-ip</code></td><td><code>0.0.0.0</code></td><td>Abre escucha para peticiones externas al host (Docker)</td></tr><tr><td><code>--listen-port</code></td><td><code>7860</code></td><td>Puerto estándar de integración con OpenWebUI</td></tr><tr><td><code>-m</code></td><td>ruta absoluta</td><td>Modelo SD 1.5 / XL en <code>.safetensors</code> o <code>.gguf</code></td></tr></tbody></table></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Comando de Producción — SD 1.5 / DreamShaper:</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"</pre><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:1rem 0">⚠️ <strong style="color:#fff">Nota de Arquitectura:</strong> Los modelos Flux.1 no son compatibles con esta build vía flag <code>-m</code> simple — retornan <code>[ERROR] main.cpp:92 - new_sd_ctx_t failed</code>. Para Flux, usa el comando dedicado de la sección 10.A con flags <code>--diffusion-model</code>, <code>--vae</code>, <code>--clip_l</code> y <code>--t5xxl</code> por separado.</p><p style="font-size:.88rem;color:#fff;margin-bottom:.75rem">🔌 <strong>Configuración de Ruta en OpenWebUI</strong></p><ol style="font-size:.88rem;color:#94a3b8;line-height:2;margin-left:1.25rem"><li>Accede a <code>http://localhost:3000</code></li><li>Ve a <strong>Configuración &gt; Imágenes</strong> (Panel de Administración)</li><li>Selecciona el motor <strong>Automatic1111</strong></li><li>Ingresa la IP local de la máquina con <code>/</code> obligatorio al final:<br><code style="color:#22c55e">http://192.168.15.68:7860/</code></li><li>Haz clic en <strong>Guardar</strong> — una franja verde confirmará el puente de red</li></ol><div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin:1.25rem 0"><strong style="color:#ef4444;display:block;margin-bottom:.4rem">🔒 Liberación Obligatoria en Windows Defender Firewall</strong><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem">Windows Defender bloquea silenciosamente conexiones provenientes de la subred interna de Docker (<code>172.17.0.0/16</code>) y WSL2 (<code>172.x.x.x</code>) por defecto. Sin esta regla, OpenWebUI no puede alcanzar el sd-server incluso con <code>--listen-ip 0.0.0.0</code> activo.</p><p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>Método 2 — PowerShell (una línea, ejecución como Administrador):</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:10px;margin-bottom:.5rem">New-NetFirewallRule -DisplayName "sd-server AIVisionsLab" -Direction Inbound -Protocol TCP -LocalPort 7860 -Action Allow</pre><p style="font-size:.82rem;color:#94a3b8;margin:0"><strong>Validación:</strong> Tras crear la regla, reinicia sd-server e intenta generar una imagen vía OpenWebUI. La franja verde en la configuración de imágenes confirma el puente activo.</p></div>`},sdcpp:{id:"sdcpp",title:"08. COMPILAÇÃO DO STABLE-DIFFUSION.CPP",desc:"Generando el motor limpio en C++ para renderizado de imágenes acelerado por GPU sin dependencias CUDA.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["sdcpp","stable-diffusion-cpp","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["llama"],previous:"llama",next:"modelos",related:["sdserver","flux_server"]}},html:`<div class="note">⚠ Compilación vía <strong>Developer PowerShell</strong> · Ejecución posterior vía <strong>PowerShell Común</strong></div><div class="code"><pre># Clonación estructurada trayendo todos los submódulos de dependencia vinculados
11017git clone --recursive https://github.com/leejet/stable-diffusion.cpp
11018cd stable-diffusion.cpp
11019mkdir build
11020cd build
11021
11022# Mapear el compilador activando el engine Vulkan y compilar los binarios en modo performance
11023cmake .. -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
11024cmake --build . --config Release -j20</pre></div><div class="code ok" style="margin-top:.75rem"><pre>
11024# Logs finales de compilación exitosa:
11025-- Found Vulkan: C:/VulkanSDK/1.4.341.1/Lib/vulkan-1.lib
11026[100%] Built target sd-server ✅</pre></div>`},sdserver:{id:"sdserver",title:"10. INICIALIZAÇÃO DO SERVIDOR SD-SERVER (GPU)",desc:"Activación del servicio de imagen en el puerto local para escuchar las llamadas de API de la interfaz gráfica.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"intermediate",estimated_time_min:15,tags:["sd-server","api-rest","inferenca-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["modelos"],previous:"modelos",next:"flux_server",related:["sd_bat_automation","sd_openwebui_integration"]}},html:`<div class="note ok">✅ Inicialización homologada: Ejecuta este bloque de código dentro del <strong>PowerShell Común</strong></div><div class="code"><pre># Levantar el servidor apuntando al modelo cuantizado y definiendo el host de escucha
11027E:\\stable-diffusion.cpp\\build\\bin\\Release\\sd-server.exe \\
11028  -m "E:\\models\\dreamshaper8.gguf" \\
11029  --host 0.0.0.0 \\
11030  --port 7860</pre></div><div class="code ok" style="margin-top:.75rem"><pre># Monitoreo del terminal:
11031ggml_vulkan: Found 1 Vulkan device(s)
11032ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
11033Server listening on http://0.0.0.0:7860 ✅</pre></div>`},sdxl_vulkan:{id:"sdxl_vulkan",title:"26. SDXL & FLUX.1 VULKAN: ALTA RESOLUÇÃO NA POLARIS",desc:"Mapeo completo del desafío de difusión de alta resolución (1024x1024) mediante Vulkan y offloading estructurado de tensores en silicio de 8GB.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:40,tags:["sdxl","vulkan-diffusion","segmentacao-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proving_hypothesis_35b"],previous:"proving_hypothesis_35b",next:"",related:["animatediff-video","flux-vulkan"]}},html:`<div class="page">
11034
11035  <div class="hero">
11036    <div class="hero-eyebrow">AIVisionsLab — Sección 26</div>
11037    <div class="hero-title">SDXL 1024×1024 en RX 580 mediante Vulkan:<br>el desafío que vino de AMD y fue respondido en vivo</div>
11038    <div class="hero-sub">AMD RX 580 8GB (2017) · stable-diffusion.cpp (leejet) · Vulkan · sin CUDA · sin ROCm · split híbrido CPU/GPU · output fotorrealista confirmado</div>
11039  </div>
11040
11041  <div class="badges">
11042    <span class="badge badge-red">RX 580 · GCN 4th gen</span>
11043    <span class="badge badge-blue">Vulkan backend</span>
11044    <span class="badge badge-gray">stable-diffusion.cpp</span>
11045    <span class="badge badge-green">SDXL 1024×1024 ✓</span>
11046    <span class="badge badge-amber">split híbrido CPU/GPU</span>
11047  </div>
11048
11049  <h2>Contexto: el desafío vino del Discord de AMD</h2>
11050  <p>Mientras discutíamos ROCm vs Vulkan en el servidor oficial de la AMD Developer Community, un miembro cuestionó en vivo los límites del stack. La respuesta no fue especulación: fue ejecutar el benchmark en tiempo real y publicar el resultado con capturas de pantalla, logs y la imagen generada, dentro del propio servidor de AMD.</p>
11051
11052  <div class="discord-card">
11053    <div class="discord-header"><i class="ti ti-brand-discord" aria-hidden="true"></i> AMD Developer Community · #rocm-ai-assistant</div>
11054    <div class="discord-body">
11055      <div class="discord-quote">
11056        <div class="author">POIZONE 🔥</div>
11057        <p>"Love the RX 580 flex. Which SD backend are you using, stable-diffusion.cpp on Vulkan? And does it support SDXL or Flux, or only SD1.5?"</p>
11058      </div>
11059      <div class="discord-reply">Respuesta: ejecutamos la prueba en vivo durante la conversación. El resultado — SDXL 1.0 @ 1024×1024 confirmado, con logs, capturas del Task Manager e imagen generada — fue publicado de vuelta en el mismo canal. El ROCm AI Assistant (bot oficial de AMD) respondió reconociendo que Vulkan es la elección legítima para hardware fuera del soporte ROCm.</div>
11060    </div>
11061  </div>
11062
11063  <h2>El problema: 6.9 GB de modelo, 8 GB de VRAM</h2>
11064  <p>El SDXL base pesa ~6.9 GB en fp16. Con buffers de activación durante la inferencia, esto supera los 8 GB de la RX 580 si todo se carga en la GPU. La solución es offload selectivo por componente — el stable-diffusion.cpp (fork leejet) soporta esto nativamente, con la misma lógica que ya usamos para el FLUX.1-schnell con <code>--clip-on-cpu</code>.</p>
11065  <p>Un segundo problema silencioso: el VAE original del SDXL produce NaN en FP16, y el ggml_conv_2d del sd.cpp solo opera en FP16. Sin el fix correcto, la imagen sale negra — sin ningún error visible en el log.</p>
11066
11067  <div class="gotcha-box">
11068    <div class="gotcha-title">⚠ gotcha obligatoria — VAE FP16 fix</div>
11069    <p>Use siempre <strong>sdxl_vae-fp16-fix.safetensors</strong> (madebyollin) en lugar del VAE original. Sin él: imagen negra, silenciosamente, en todo y cualquier render. El flag <code>--vae</code> apunta a este archivo, no al VAE integrado en el checkpoint.</p>
11070  </div>
11071
11072  <h2>Solución: split híbrido CPU/GPU</h2>
11073  <p>UNet completo en la VRAM. Text encoders y VAE decode en la RAM. El <code>--vae-tiling</code> divide el decode en tiles 32×32 para eliminar el pico de memoria en la etapa final del pipeline.</p>
11074
11075  <div class="code-block">
11076    <div class="code-label">PowerShell — E:\\stable-diffusion.cpp\\build\\bin\\Release\\</div>
11077    <pre>.\\sd-server.exe \`
11078  --listen-ip 0.0.0.0 \`
11079  --listen-port 8081 \`
11080  -m E:\\models\\sd_xl_base_1.0.safetensors \`
11081  --vae E:\\models\\sdxl_vae-fp16-fix.safetensors \`
11082  --clip-on-cpu \`
11083  --vae-on-cpu \`
11084  --vae-tiling \`
11085  -H 1024 -W 1024 -v</pre>
11086  </div>
11087
11088  <table class="flag-table">
11089    <thead><tr><th>Flag</th><th>Efecto</th><th>Memoria liberada de la VRAM</th></tr></thead>
11090    <tbody>
11091      <tr><td>--clip-on-cpu</td><td>CLIP-L + OpenCLIP-bigG corren en la RAM durante el conditioner</td><td>~1.56 GB</td></tr>
11092      <tr><td>--vae-on-cpu</td><td>VAE decode corre en la CPU/RAM — elimina pico al final del pipeline</td><td>~416 MB</td></tr>
11093      <tr><td>--vae-tiling</td><td>Divide el decode en tiles 32×32 (49 tiles en 1024×1024)</td><td>— (reduce pico de RAM)</td></tr>
11094    </tbody>
11095  </table>
11096
11097  <h2>Split de memoria confirmado en los logs</h2>
11098
11099  <div class="log-block">
11100    <pre><span class="comment"># salida del sd-server tras carga completa del modelo:</span>
11101
11102total params memory size = 6624.11MB
11103<span class="highlight">  VRAM  4900.07MB  →  diffusion_model (UNet)</span>
11104<span class="highlight">  RAM   1564.36MB  →  text_encoders (CLIP-L + OpenCLIP-bigG)</span>
11105<span class="highlight">  RAM    159.68MB  →  vae</span>
11106
11107listening on: http://0.0.0.0:8081</pre>
11108  </div>
11109
11110  <div class="memory-split">
11111    <div class="mem-card gpu">
11112      <div class="mem-label">GPU · VRAM</div>
11113      <div class="mem-value">4.9 GB</div>
11114      <div class="mem-sub">UNet (diffusion_model)</div>
11115    </div>
11116    <div class="mem-card ram">
11117      <div class="mem-label">CPU · RAM</div>
11118      <div class="mem-value">1.56 GB</div>
11119      <div class="mem-sub">CLIP-L + OpenCLIP-bigG</div>
11120    </div>
11121    <div class="mem-card ram">
11122      <div class="mem-label">CPU · RAM</div>
11123      <div class="mem-value">160 MB</div>
11124      <div class="mem-sub">VAE decode (49 tiles)</div>
11125    </div>
11126  </div>
11127
11128  <h2>Prueba de generación mediante PowerShell</h2>
11129  <p>Por qué no usamos el Open WebUI: ya estaba configurado apuntando al FLUX.1-schnell en otro puerto. Reconfigurar arriesgaba romper un setup que ya funcionaba. El terminal resuelve más rápido, sin estado guardado que preservar y sin conflicto de puerto.</p>
11130
11131  <div class="code-block">
11132    <div class="code-label">PowerShell — envío del prompt mediante API A1111-compatible</div>
11133    <pre>$body = @{
11134    prompt         = "a lovely cat, detailed fur, studio lighting"
11135    negative_prompt = ""
11136    width          = 1024
11137    height         = 1024
11138    steps          = 20
11139    cfg_scale      = 7
11140    sampler_name   = "Euler a"
11141} | ConvertTo-Json
11142
11143$response = Invoke-RestMethod \`
11144    -Uri "http://localhost:8081/sdapi/v1/txt2img" \`
11145    -Method Post \`
11146    -ContentType "application/json" \`
11147    -Body $body
11148
11149$bytes = [Convert]::FromBase64String($response.images[0])
11150[IO.File]::WriteAllBytes("E:\\models\\teste_sdxl_1024.png", $bytes)</pre>
11151  </div>
11152
11153  <h2>Benchmark completo</h2>
11154
11155  <div class="bench-grid">
11156    <div class="bench-card">
11157      <div class="bench-phase">Conditioner (CLIP)</div>
11158      <div class="bench-time">~4s</div>
11159      <div class="bench-detail">CPU/RAM · CLIP-L + OpenCLIP-bigG</div>
11160    </div>
11161    <div class="bench-card">
11162      <div class="bench-phase">UNet sampling</div>
11163      <div class="bench-time">267s</div>
11164      <div class="bench-detail">20 steps · Euler A · 13.37s/it · RX 580 Vulkan</div>
11165    </div>
11166    <div class="bench-card">
11167      <div class="bench-phase">VAE decode</div>
11168      <div class="bench-time">~390s</div>
11169      <div class="bench-detail">49 tiles 32×32 · ~8s/tile · CPU/RAM</div>
11170    </div>
11171    <div class="bench-card">
11172      <div class="bench-phase">VRAM pico</div>
11173      <div class="bench-time">5.7 GB</div>
11174      <div class="bench-detail">de 8.0 GB disponibles · margen de 2.3 GB</div>
11175    </div>
11176    <div class="bench-card total">
11177      <div class="bench-phase">
11177Total end-to-end</div>
11178      <div class="bench-time">662s · ~11 minutos</div>
11179      <div class="bench-detail">Temperatura pico 67°C → 39°C idle · RAM usada 17.7/31.8 GB</div>
11180    </div>
11181  </div>
11182
11183  <h2>Contexto de velocidad</h2>
11184  <p>No es rápido. Ese no es el punto.</p>
11185
11186  <table class="comparison-table">
11187    <thead><tr><th>Hardware</th><th>Stack</th><th>Tiempo SDXL 1024×1024</th></tr></thead>
11188    <tbody>
11189      <tr><td>RTX 4090</td><td>CUDA</td><td>~8s</td></tr>
11190      <tr><td>RTX 3080</td><td>CUDA</td><td>~25s</td></tr>
11191      <tr class="highlight-row"><td>RX 580 8GB (2017)</td><td>Vulkan · sin CUDA · sin ROCm</td><td>662s <span class="tag">funciona</span></td></tr>
11192      <tr><td>CPU puro (Xeon E5-2690 v3)</td><td>AVX2</td><td>rango similar al setup anterior</td></tr>
11193    </tbody>
11194  </table>
11195
11196  <h2>Output generado</h2>
11197  <p>Prompt: <em>"a lovely cat, detailed fur, studio lighting"</em></p>
11198  <p>Resultado: Maine Coon fotorrealista, pelos individuales visibles, ojos nítidos, bokeh, studio lighting con contraste dramático. Sin artefactos, sin ruido, sin imagen negra. El VAE FP16 fix funcionó exactamente como se documentó.</p>
11199
11200  <div class="result-box">
11201    <p>✓ SDXL 1.0 @ 1024×1024 — confirmado en la RX 580 8GB mediante Vulkan puro. Hardware lanzado en 2017, fuera del soporte oficial ROCm, sin ninguna dependencia propietaria de vendor. El split híbrido CPU/GPU con --clip-on-cpu + --vae-on-cpu + --vae-tiling es la combinación que hace esto posible dentro de los 8 GB de VRAM.</p>
11202  </div>
11203
11204  <h2>La respuesta de la AMD Developer Community</h2>
11205  <p>El benchmark fue publicado en el servidor oficial de AMD con logs, capturas del Task Manager durante la inferencia y la imagen generada, en respuesta directa a la pregunta del miembro POIZONE en el canal #rocm-ai-assistant. La reacción fue inmediata: <em>"wow, that was fast thanks alot, and also pretty good results"</em>.</p>
11206  <p>A continuación, en respuesta a un mensaje más largo sobre la motivación del proyecto — acceso a hardware legado, el abandono de Polaris por parte de ROCm y DirectML, y la filosofía de "el hardware no muere, el soporte oficial es lo que desaparece" — POIZONE comentó: <em>"Today, someone who wanted to run local AI and couldn't — now can. That's what matters. — this is exactly why i like this idea"</em>.</p>
11207
11208  <h2>Descargas de modelo</h2>
11209  <div class="code-block">
11210    <div class="code-label">PowerShell — descargar en E:\\models\\</div>
11211    <pre>cd E:\\models\\
11212
11213# modelo base SDXL (~6.9 GB)
11214curl.exe -L -o sd_xl_base_1.0.safetensors \`
11215  https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
11216
11217# VAE FP16 fix — obligatorio (~319 MB)
11218curl.exe -L -o sdxl_vae-fp16-fix.safetensors \`
11219  https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors</pre>
11220  </div>
11221
11222  <div class="footer-note">
11223    AIVisionsLab · Sección 26 de 36 · Hardware: AMD RX 580 8GB (2017) + Xeon E5-2690 v3 + 32 GB DDR4 ECC · Windows 10 Pro + WSL2 · stable-diffusion.cpp fork leejet · Vulkan backend · Probado y documentado en vivo en respuesta a un desafío en el AMD Developer Community Discord.
11224  </div>
11225
11226</div>`},solucao:{id:"solucao",title:"04. A SOLUÇÃO — ARQUITETURA DUPLA",desc:"Cómo dividimos el procesamiento entre Vulkan en GPU y WSL2 en CPU para evitar Pantallas Azules.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"arquitetura",difficulty:"intermediate",estimated_time_min:15,tags:["vulkan-api","co-processamento","otimizacao-barramento"],last_reviewed:"2026-07-01",relationships:{prerequisites:["falhas"],previous:"falhas",next:"prereqs",related:["contexto","stack"]}},html:`<p>Ya que AMD no nos dio herramientas oficiales, creamos nuestra propia ingeniería:</p>
11227<ol style="color:#94a3b8; font-size:16px; line-height:1.8;">
11228  <li><strong>El Motor Vulkan (C++):</strong> Tomamos el código fuente de Llama.cpp y Stable-Diffusion.cpp y lo compilamos con el flag Vulkan. Esto hace que la IA se ejecute directamente en la tarjeta gráfica a máxima velocidad, ignorando los bloqueos de AMD.</li>
11229  <li><strong>El Refuerzo WSL2 (Linux en Windows):</strong> Para modelos de 16GB (como el FLUX.1) que darían 'Pantalla Azul' por falta de VRAM, usamos Linux dentro de Windows. Enviamos el procesamiento al Xeon y a la RAM de 32GB. Tarda, pero no se cuelga.</li>
11230</ol>
11231<p style="color:#22c55e; font-weight:bold;">¡Con esta combinación, convertimos una tarjeta 'obsoleta' en una máquina de IA de vanguardia!</p>`},stack:{id:"stack",title:"20. MAPA DE SERVIÇOS DO STACK INTEGRADO",desc:"Tabla de monitoreo de infraestructura, enrutamiento de tráfico local y backends activos.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"monitoramento",difficulty:"beginner",estimated_time_min:10,tags:["network-stack","ports-mapping","security-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["animatediff-video"],previous:"animatediff-video",next:"scripts",related:["sd_bat_automation","scripts"]}},html:'<div class="tbl"><table><thead><tr><th>
11231Servicio de IA</th><th>Puerto de Acceso</th><th>Protocolo / Engine</th><th>Backend de Hardware Activo</th></tr></thead><tbody><tr><td><strong>Open WebUI</strong></td><td><code>:3000</code></td><td>Docker Container</td><td>Entorno Virtualizado WSL2</td></tr><tr class="hig"><td><strong>llama-server</strong></td><td><code>:8081</code></td><td>Ejecutable Nativo ggml</td><td>GPU AMD Radeon RX 580 (Vulkan 1.x)</td></tr><tr class="hig"><td><strong>sd-server</strong></td><td><code>:7860</code></td><td>Ejecutable Nativo ggml</td><td>GPU AMD Radeon RX 580 (Vulkan 1.x)</td></tr><tr><td><strong>ComfyUI Server</strong></td><td><code>:8188</code></td><td>Runtime Python Aislado</td><td>CPU Xeon E5-2690 v3 (Modo Pure CPU)</td></tr><tr><td><strong>Ollama Engine</strong></td><td><code>:11434</code></td><td>Servicio de Contingencia</td><td>CPU Xeon E5-2690 v3 (Modo Pure CPU)</td></tr></tbody></table></div>'},"troubleshoot-comfyui":{id:"troubleshoot-comfyui",title:"28. CATASTROFE DE MEMÓRIA NO COMFYUI WINDOWS",desc:"Manejo de desbordamientos de asignación física de VRAM y uso emergencial de señalizadores de paginación.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["vram-spillfix","pagefile-allocation","comfyui-out-of-memory"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux-vulkan"],previous:"flux-vulkan",next:"comfyui-portable-amd",related:["comfyui-directml","comfyui-directml-func"]}},html:'<div class="err"><div class="err-t">Excepción de Runtime: RuntimeError: Could not allocate tensor with...</div><p style="margin-top:.35rem"><strong style="color:#e2e8f0">Mecanismo de Fallo:</strong> Ocurre al intentar correr flujos de imagen complejos en Windows utilizando backends de aceleración inestables que intentan reservar más bloques contiguos de memoria de los que la tarjeta dispone libremente en ese momento.</p><p style="margin-top:.35rem"><strong style="color:#fff">Flags de Supervivencia:</strong> Cambia la llamada del archivo de inicialización inyectando los comandos de fragmentación de carga: <code>--lowvram</code> o <code>--normalvram</code>. Esto fuerza al gestor de ComfyUI a descargar las capas del CLIP de la memoria de vídeo antes de inicializar el procesamiento del KSampler.</p></div>'},troubleshooting:{id:"troubleshooting",title:"27. GUIA DE RESOLUÇÃO DE PROBLEMAS (TROUBLESHOOTING)",desc:"Diagnósticos rápidos para sortear fallos de timeout de API y semillas nulas en el servidor.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"geral",difficulty:"beginner",estimated_time_min:10,tags:["port-fixing","network-troubleshoot","timeout-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["cpu"],previous:"cpu",next:"flux-vulkan",related:["falhas","troubleshoot-comfyui"]}},html:'<div class="err"><div class="err-t">Síntoma Crítico: generate_image returned no results / Terminal congelado</div><p style="margin-top:.35rem"><strong style="color:#e2e8f0">Causa Identificada:</strong> El servidor <code>sd-server.exe</code> presenta un bug de desbordamiento numérico intermitente al procesar generaciones enviadas con la semilla configurada en modo aleatorio (Seed: -1).</p><p style="margin-top:.35rem"><strong style="color:#22c55e">Acción Correctiva:</strong> Dentro de la interfaz de OpenWebUI, desactiva la clave de semilla dinámica en las opciones avanzadas del prompt y fuerza un valor entero fijo válido (Ejemplo: <code>42</code>, <code>1337</code>).</p></div>'}},fr:{amihart:{id:"amihart",title:"31. MÉTODO AMIHART — INFERÊNCIA RX580 EM POLARIS/DEBIAN",desc:"Note de Crédit : Section documentaire en hommage à la preuve de concept réalisée par 艾米心 (Amihart), pionnière dans la validation de Vulkan sous Debian GCN4/Polaris.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:30,tags:["metodo-amihart","debian-polaris","vulkan-diagnostics"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comunidade"],previous:"comunidade",next:"dadhacks",related:["comunidade","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">En janvier 2025, le développeur <strong style="color:#fff">艾米心 (Amihart)</strong> a publié une étude technique démontrant que, malgré les limitations officielles imposées par AMD (fin du support officiel de ROCm pour les architectures Polaris/GCN4), le matériel RX 580 possède toujours un plein potentiel d'accélération IA.</p><div style="display:grid;grid-template-columns:1fr 1fr;gap:.85rem;margin-bottom:1.25rem"><div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid var(--r)"><p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">Approche AIVisionsLab (Windows Natif)</p><ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8"><li>Exécution sur le système hôte (Windows).</li><li>Focus sur la production quotidienne à haute stabilité.</li><li>Réglage de l'orchestration Vulkan native.</li><li>Segmentation hybride VRAM/CPU dans WSL.</li></ul></div><div class="card" style="border-left:3px solid #22c55e;padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid #22c55e"><p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">La Méthode Amihart (Linux/Debian)</p><ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8"><li>Exécution dans l'écosystème Linux/Debian.</li><li>Isolation robuste via conteneurs Docker.</li><li>Compilation stricte avec les flags de l'API Vulkan.</li><li>Sandbox ROCm adapté virtualisé.</li></ul></div></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. Setup LLM — Vulkan sur Debian</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">llama.cpp est compilé avec l'API Vulkan pure pour contourner l'absence du pilote ROCm :</p><div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Étape 1 : Installer les pilotes Vulkan et les prérequis de compilation
11232sudo apt install vulkan-tools libtcmalloc-minimal4 libcurl4-openssl-dev glslc cmake make git pkg-config libvul
11232kan-dev
11233
11234# Étape 2 : Cloner et compiler llama.cpp avec Vulkan activé
11235cd ~
11236git clone https://github.com/ggerganov/llama.cpp
11237cd llama.cpp && mkdir build && cd build
11238cmake .. -DGGML_VULKAN=on -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=ON
11239
11240# Étape 3 : Ajouter les binaires au PATH d'exécution
11241echo 'export PATH=$PATH:'$(realpath bin) >> ~/.bashrc
11242source ~/.bashrc
11243
11244# Étape 4 : Exécuter DeepSeek R1 8B (Accélération Vulkan0)
11245llama-cli -m deepseek-r1:8B --device Vulkan0 -ngl 100</code></pre></div><p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Métrique de Performance (Amihart) :</strong> Sur un Celeron G6900 opérant sans GPU, la réponse est de 5,45 tokens/s. En utilisant l'accélération Vulkan pure sur RX 580 avec 100 couches offload, la performance monte à <strong style="color:var(--r)">24,56 tokens/s</strong>, rendant le modèle viable et agile.</p><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">B. Setup Stable Diffusion — Sandbox Docker</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Comme les générateurs d'images exigent des dépendances ROCm, Amihart utilise des conteneurs virtuels isolés pour faire tourner la WebUI proprement sur Debian :</p><div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Étape 1 : Installation du moteur Docker et des clés strictes
11246sudo apt update && sudo apt install -y ca-certificates curl
11247install -m 0755 -d /etc/apt/keyrings
11248curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
11249chmod a+r /etc/apt/keyrings/docker.asc
11250echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
11251sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io
11252
11253# Étape 2 : Clonage de la WebUI et exécution sous l'isolation ROCm gfx803
11254cd ~
11255git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
11256cd ~/stable-diffusion-webui
11257
11258sudo docker run -it \\
11259  --network=host --device=/dev/kfd --device=/dev/dri \\
11260  --ipc=host --shm-size 16G --group-add video \\
11261  --cap-add=SYS_PTRACE \\
11262  --rm -v $(pwd)/cache:/root/.cache \\
11263  -v $(pwd)/data:/stable-diffusion-webui/data \\
11264  woodrex/sd-webui-for-gfx803:latest</code></pre></div><p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Optimisation Critique du Cache Amihart :</strong> Pour éviter les rechargements de dépendances à chaque fois que le conteneur démarre :</p><div class="code" style="margin-bottom:1.5rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Obtenir le CONTAINER ID actif
11265sudo docker ps -l
11266# Commiter l'état dans une nouvelle image persistante
11267sudo docker commit [CONTAINER_ID]
11268# Voir l'ID de l'image persistée et remplacer l'appel docker run par celui-ci
11269sudo docker images</code></pre></div><div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem"><strong style="color:var(--r)">Métriques et Références Techniques :</strong> Routage basé sur la publication originale de <a href="https://amihart.medium.com/inference-with-an-rx580-13e9c1055472" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">艾米心 (Amihart)</a> (Medium, Janvier 2025). La connaissance est ouverte et utile à la communauté.</div>`},"animatediff-video":{id:"animatediff-video",title:"19. ANIMATEDIFF E INTERPOLAÇÃO DE QUADROS (VÍDEO)",desc:"Injection de cohérence temporelle dans ComfyUI sur matériel hérité pour structurer des loops fluides coprocessés sur Intel Xeon.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"advanced",estimated_time_min:30,tags:["animatediff","geracao-video","motion-modules"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-modelos"],previous:"comfyui-modelos",next:"stack",related:["comfyui-flux","sdxl_vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">L'<strong>AnimateDiff</strong> est un framework de modélisation temporel conçu spécifiquement pour convertir les modèles de diffusion statiques (comme Stable Diffusion 1.5) en générateurs vidéo cohérents. Il fonctionne en injectant des modules d'attention temporelle qui se chevauchent dans ComfyUI/WSL2. Cette technique permet de calculer les transitions d'images adjacentes de manière mathématiquement coordonnée, générant des loops fluides et éliminant les effets statiques chaotiques de bruit scintillant.</p><div style="display:grid;grid-template-columns:1fr 1fr;gap:1.25rem;margin-bottom:1.5rem"><div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px"><div style="font-size:1.8rem">🎬</div><div><div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">Pipeline Vidéo</div><div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#fff">AnimateDiff (WSL2 Pure CPU)</div><div style="font-size:.65rem;color:#64748b;margin-top:2px">24 Threads Intel Xeon E5</div></div></div><div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px"><div style="font-size:1.8rem">⏳</div><div><div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">Métrique de Traitement</div><div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#34d399">~141s par Seconde d'Image</div><div style="font-size:.65rem;color:#64748b;margin-top:2px">Rendu temporel interpolé</div></div></div></div><div style="background:#0F1115;border:1px solid rgba(255,255,255,0.04);border-radius:6px;padding:1.5rem;margin-bottom:1.5rem"><h4 style="font-size:.85rem;color:#fff;text-transform:uppercase;letter-spacing:1px;margin-bottom:1rem;display:flex;align-items:center;gap:.5rem;margin-top:0"><span>🎥</span> Vitrine Interactive de Génération (Breathe-Loop Vidéo par Cache Local)</h4><p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">Ci-dessous sont représentés les deux outputs rendus par votre stack d'IA locale. Survolez pour activer la sensation de vidéo interpolée, ou cliquez sur le bouton simulateur pour lancer le rendu synthétique du Xeon :</p><div style="display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-bottom:1.25rem"><div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1"><img src="/images/cyberpunk_alley_0_1779586391528.png" alt="Cyberpunk Neon Alley" referrerPolicy="no-referrer" class="animatediff-img-1" style="width:100%;height:100%;object-fit:cover;transition:transform 8s ease-in-out, filter 2s ease;filter:brightness(0.9)" /><div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem"><span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span><span>CYBER_STREET_00.GIF</span></div><div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.75rem .5rem .5rem .75rem;display:flex;justify-content:space-between;align-items:center"><span style="font-family:monospace;font-size:9px;color:#64748b">Stable Diffusion 1.5</span><span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">VULKAN_OK</span></div></div><div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1"><img src="/images/cosmic_glass_0_1779586410888.png" alt="Cosmic Glass Flask" referrerPolicy="no-referrer" class="animatediff-img-2" style="width:100%;height:100%;object-fit:cover;transition:transform 6s ease-in-out, filter 3s ease;filter:brightness(0.85)" /><div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem"><span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span><span>ALCHEM_COSMOS_01.GIF</span></div><div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.5rem .75rem;display:flex;justify-content:space-between;align-items:center"><span style="font-family:monospace;font-size:9px;color:#64748b">Pure Xeon Model</span><span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">THREADED_OK</span></div></div></div><div style="text-align:center;margin-top:.5rem"><button onclick="toggleAnimateDiffSim(this)" style="background:rgba(239, 68, 68, 0.1);border:1px solid rgba(239, 68, 68, 0.4);border-radius:3px;color:#fca5a5;font-family:monospace;padding:.5rem 1rem;font-size:.72rem;cursor:pointer;transition:all 0.2s;text-transform:uppercase">▶ Activer la Simulation de Mouvement</button></div><div id="sim-log-box" style="background:#07080a;border:1px solid rgba(255,255,255,0.01);border-radius:3px;padding:0.75rem;margin-top:1rem;font-family:monospace;font-size:10px;color:#475569;line-height:1.5;display:none;max-height:120px;overflow-y:auto;text-align:left"></div></div><style>
11269.video-preview-box:hover .animatediff-img-1{transform:scale(1.1) rotate(0.5deg);filter:brightness(1.1) saturate(1.15) !important}.video-preview-box:hover .animatediff-img-2{transform:scale(1.08) rotate(-0.5deg);filter:brightness(1.05) saturate(1.2) !important}.animate-active-1{animation:panCyberpunk 12s infinite alternate ease-in-out;filter:brightness(1.1) saturate(1.15) !important}.animate-active-2{animation:panGlass 10s infinite alternate ease-in-out;filter:brightness(1.05) saturate(1.2) !important}@keyframes panCyberpunk{0%{transform:scale(1);filter:hue-rotate(0deg)}50%{transform:scale(1.12) translate(5px, -3px);filter:hue-rotate(15deg)}100%{transform:scale(1.02) translate(-5px, 2px);filter:hue-rotate(-10deg)}}@keyframes panGlass{0%{transform:scale(1.02) rotate(0deg)}50%{transform:scale(1.15) translate(-2px, 4px) rotate(1deg);filter:hue-rotate(5deg)}100%{transform:scale(1.05) translate(4px, -2px) rotate(-0.5deg);filter:hue-rotate(-5deg)}}@keyframes heartbeat{0%,100%{opacity:0.4}50%{opacity:1}}.pulse-red{animation:heartbeat 1s infinite}</style>`},arquivos:{id:"arquivos",title:"35. TAXONOMIA E ESTRUTURA DE ARQUIVOS NVMe",desc:"Arborescence unifiée pour le suivi des binaires compilés et des modèles partagés.",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"armazenamento",difficulty:"beginner",estimated_time_min:10,tags:["nvme-struct","model-directories","storage-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proximos"],previous:"proximos",next:"meta",related:["comfyui-modelos","meta"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Organisation structurelle rigoureuse des chemins physiques maintenus dans la partition haute vitesse du SSD :</p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#e2e8f0;background:rgba(0,0,0,.3);padding:.9rem;border-radius:4px;border:1px solid var(--b)">E:\\
11270├── llama.cpp\\
11271│   └── build\\bin\\Release\\
11272│       ├── llama-server.exe     <span style="color:#64748b"># Serveur de Langage Local</span>
11273│       └── llama-cli.exe        <span style="color:#64748b"># Utilitaire de Diagnostic</span>
11274├── stable-diffusion.cpp\\
11275│   └── build\\bin\\Release\\
11276│       ├── sd-server.exe        <span style="color:#64748b"># Serveur d'Image Vulkan</span>
11277│       └── sd-cli.exe           <span style="color:#64748b"># Convertisseur de Modèles GGUF</span>
11278└── models\\
11279    ├── mistral-7b-instruct.Q4_K_M.gguf
11280    └── dreamshaper8.gguf        <span style="color:#64748b"># Checkpoint SD 1.5 Quantifié</span></pre>`},audio_rvc:{id:"audio_rvc",title:"38. VOICE CONVERSION LOCAL — APPLIO RVC EM AMD RX 580 (Fases Iniciais)",desc:"Pipeline de clonagem de voz no Windows sem CUDA NVIDIA - Configuração do ambiente e primeiras fases.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:35,tags:["applio","rvc-voice-clone","sintese-audio"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linhatempo"],previous:"linhatempo",next:"audio_whisper",related:["audio_whisper","audio_srt_ptbr"]},part:1},html:`<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
11281  Documentação honesta de uma instalação real, incluindo todas as tentativas, erros e soluções.<br />
11282  Conduzida em duas sessões: ChatGPT (fases iniciais) + Claude (fases finais).
11283</blockquote>
11284
11285<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">CONTEXTO DO PROJETO</h3>
11286<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O objetivo era montar um pipeline de produção audiovisual para canal do YouTube estilo dark/documentário:</p>
11287<div class="code" style="margin-bottom:1.25rem">
11288  <pre><code>Texto → Balabolka + Antônio Neural (TTS) → WAV → Applio/RVC → Yuri (voz clonada)</code></pre>
11289</div>
11290<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A ideia central: separar <strong>atuação</strong> de <strong>identidade vocal</strong>.</p>
11291<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
11292  <li><strong style="color:#fff">Antônio Neural</strong> faz a interpretação, prosódia e emoção (voz Microsoft Neural)</li>
11293  <li><strong style="color:#fff">Yuri</strong> (modelo RVC treinado) aplica a identidade vocal por cima</li>
11294</ul>
11295<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.5rem">Isso produz resultado muito mais natural que TTS generativo puro.</p>
11296
11297<div class="tbl" style="margin-bottom:1.5rem">
11298  <table>
11299    <thead>
11300      <tr>
11301        <th>Aspecto</th>
11302        <th>XTTS/TTS puro</th>
11303        <th>Antônio → Yuri (RVC)</th>
11304      </tr>
11305    </thead>
11306    <tbody>
11307      <tr>
11308        <td>Prosódia</td>
11309        <td>Artificial</td>
11310        <td>Humana (ator real)</td>
11311      </tr>
11312      <tr>
11313        <td>Termos técnicos</td>
11314        <td>Tropeça</td>
11315        <td>Lê corretamente</td>
11316      </tr>
11317      <tr>
11318        <td>Textos longos</td>
11319        <td>Degrada</td>
11320        <td>Estável</td>
11321      </tr>
11322      <tr>
11323        <td>Identidade vocal</td>
11324        <td>Genérica</td>
11325        <td>Clonada</td>
11326      </tr>
11327      <tr>
11328        <td>Naturalidade</td>
11329        <td>60-70%</td>
11330        <td>80-95%</td>
11331      </tr>
11332    </tbody>
11333  </table>
11334</div>
11335
11336<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">HARDWARE UTILIZADO</h3>
11337<div class="tbl" style="margin-bottom:1.5rem">
11338  <table>
11339    <thead>
11340      <tr>
11341        <th>Item</th>
11342        <th>Especificação</th>
11343      </tr>
11344    </thead>
11345    <tbody>
11346      <tr>
11347        <td>CPU</td>
11348        <td>Intel Xeon E5-2690 v3 (24 núcleos)</td>
11349      </tr>
11350      <tr>
11351        <td>GPU</td>
11352        <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
11353      </tr>
11354      <tr>
11355        <td>RAM</td>
11356        <td>31.8 GB DDR4 REG ECC</td>
11357      </tr>
11358      <tr>
11359        <td>OS</td>
11360        <td>Windows 11</td>
11361      </tr>
11362      <tr>
11363        <td>Storage</td>
11364        <td>SSD NVMe (E:)</td>
11365      </tr>
11366      <tr>
11367        <td>Python</td>
11368        <td>3.11.9</td>
11369      </tr>
11370    </tbody>
11371  </table>
11372</div>
11373
11374<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 0 — TENTATIVA COM DATASET DO ANTÔNIO (fracasso documentado)</h3>
11375<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A ideia original era treinar o modelo RVC com horas de áudio do Antônio Neural. Foi criado um script <code>split.py</code> com Whisper para segmentar automaticamente o áudio em clips de 6-12 segundos.</p>
11376<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-bottom:0.5rem"><strong>O problema: estouro de memória</strong></p>
11377<div class="code" style="margin-bottom:1.25rem">
11378  <pre><code>MemoryError
11379concurrent.futures.process.BrokenProcessPool</code></pre>
11380</div>
11381<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O pré-processamento de dataset grande (~2h34 de áudio) estourou RAM e VRAM simultaneamente. Mesmo quando terminava, o volume de 1000+ clips causava instabilidade no pipeline do Applio.</p>
11382<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem"><strong>Decisão:</strong> abandonar o dataset do Antônio e usar diretamente <strong>9 minutos de TTS do ElevenLabs</strong> com a voz do Yuri. Menor, mais limpo, mais controlado.</p>
11383
11384<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 1 — INSTALAÇÃO DO AMBIENTE BASE</h3>
11385<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Estrutura de pastas:</strong></p>
11386<div class="code" style="margin-bottom:1.25rem">
11387  <pre><code>E:\\tts-audio_pra_youtube\\
11388├── Applio\\
11389├── voices\\
11390│   └── YURI-TTS.wav  (9 minutos, ElevenLabs, voz Yuri)
11391├── output\\
11392└── scripts\\</code></pre>
11393</div>
11394
11395<div class="err" style="margin-bottom:1.25rem">
11396  <div class="err-t">⚠️ Problema: Python 3.10 incompatível</div>
11397  <p>O Applio moderno exige Python 3.11+. O numpy 2.4.4 requerido não existe para 3.10.</p>
11398</div>
11399
11400<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução:</strong> instalar Python 3.11 em paralelo sem remover o 3.10:</p>
11401<div class="code" style="margin-bottom:1.25rem">
11402  <span class="code-lang">powershell</span>
11403  <pre><code>py -0
11404# -V:3.11  Python 3.11 (64-bit)   ← usar esta
11405# -V:3.10  Python 3.10 (64-bit)   ← manter para outros projetos
11406
11407py -3.11 -m venv venv
11408venv\\Scripts\\activate
11409python --version
11410# Python 3.11.9  ✅</code></pre>
11411</div>
11412
11413<div class="err" style="margin-bottom:1.25rem">
11414  <div class="err-t">⚠️ Problema: requirements.txt com CUDA forçado</div>
11415  <div class="code" style="margin-top:0.5rem;margin-bottom:0.5rem">
11416    <pre><code># O Applio traz esta linha que quebra no AMD Windows:
11417torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'</code></pre>
11418  </div>
11419  <p>O sufixo <code>+cu128</code> é CUDA 12.8 exclusivo NVIDIA. No Windows (<code>win32</code>), essa condição sempre é verdadeira.</p>
11420</div>
11421
11422<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução:</strong> editar o <code>requirements.txt</code>:</p>
11423<div class="code" style="margin-bottom:1.25rem">
11424  <pre><code># REMOVER:
11425torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
11426torchaudio==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
11427torchvision==0.22.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
11428
11429# SUBSTITUIR POR:
11430torch==2.7.1; sys_platform == 'win32'
11431torchaudio==2.7.1; sys_platform == 'win32'
11432torchvision==0.22.1; sys_platform == 'win32'</code></pre>
11433</div>
11434
11435<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 2 — TENTATIVA DIRECTML (fracasso documentado)</h3>
11436<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Com o Applio rodando em CPU (~10 min por época), tentou-se acelerar com DirectML.</p>
11437<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Instalação e teste:</strong></p>
11438<div class="code" style="margin-bottom:1.25rem">
11439  <span class="code-lang">powershell</span>
11440  <pre><code>pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
11441pip install torch-directml
11442
11443python -c "import torch_directml; dml = torch_directml.device(); print(dml)"
11444# privateuseone:0  ✅  — RX 580 reconhecida</code></pre>
11445</div>
11446<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Resultado real:</strong></p>
11447<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
11448  <li>GPU uso: 7-10%</li>
11449  <li>VRAM: 1.2GB usada</li>
11450  <li>Velocidade com DirectML: <strong>4.27s/it</strong></li>
11451  <li>Velocidade sem DirectML (CPU): <strong>4.46s/it</strong></li>
11452  <li>Diferença real: <strong>~5%</strong> — irrelevante</li>
11453</ul>
11454<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Por que foi abandonado:</strong></p>
11455<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O <code>torch-directml</code> está preso na versão <code>0.2.5.dev240914</code> (setembro 2024) e exige <code>torch==2.4.1</code>. O Applio precisa de <code>torch==2.7.1</code>. Conflito irreconciliável:</p>
11456<div class="code" style="margin-bottom:1.25rem">
11457  <pre><code>torch-directml 0.2.5 requires torch==2.4.1
11458hyper-connections 0.4.11 requires torch>=2.5   ← conflito
11459torch-einops-utils 0.1.1 requires torch>=2.5   ← conflito</code></pre>
11460</div>
11461<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A Microsoft parou de investir no DirectML para IA. O projeto está essencialmente abandonado.</p>
11462<p style="font-size:.88rem;color:#10b981;line-height:1.9;margin-bottom:1.25rem">✅ <strong>Conclusão:</strong> DirectML para RVC em Windows AMD em 2026 = não vale a pena.</p>
11463
11464
11465</div>
11466<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 3 — ERRO CRÍTICO: VARIÁVEIS DE AMBIENTE</h3>
11467<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Durante tentativas de forçar CPU, foram usados comandos que <strong>silenciosamente quebravam a extração de características</strong>:</p>
11468<div class="code" style="margin-bottom:1.25rem">
11469  <span class="code-lang">powershell</span>
11470  <pre><code># ❌ NUNCA FAZER ISSO com Applio AMD:
11471set USE_DIRECTML=0
11472set CUDA_VISIBLE_DEVICES=-1
11473set ROCM_VISIBLE_DEVICES=-1
11474set HIP_VISIBLE_DEVICES=-1</code></pre>
11475</div>
11476<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Esses comandos deixavam a pasta <code>extracted</code> vazia após a extração. O treino terminava em <strong>segundos</strong> dizendo "Model trained successfully" sem gerar nenhum <code>.pth</code>.</p>
11477<div class="code" style="margin-bottom:1.25rem">
11478  <pre><code>Not enough data present in the training set.
11479Feature files in logs\\my-project\\extracted could not be loaded correctly.</code></pre>
11480</div>
11481<div class="err" style="margin-bottom:1.25rem">
11482  <div class="err-t">⚠️ Armadilha: "Model trained successfully" em segundos = treino fake.</div>
11483  <p>Sempre verificar se <code>logs/projeto/extracted/</code> tem arquivos <code>.npy</code> antes de treinar.</p>
11484</div>
11485
11486<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 4 — INSTALAÇÃO LIMPA (solução final)</h3>
11487<div class="code" style="margin-bottom:1.25rem">
11488  <span class="code-lang">powershell</span>
11489  <pre><code># 1. Destruir ambiente corrompido
11490deactivate
11491Remove-Item -Recurse -Force venv
11492Remove-Item -Recurse -Force logs
11493
11494# 2. Criar venv limpo
11495py -3.11 -m venv venv
11496venv\\Scripts\\activate
11497python -m pip install --upgrade pip
11498
11499# 3. Instalar torch base
11500pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
11501pip install torch-directml
11502
11503# 4. Instalar dependências sem sobrescrever torch
11504pip install -r requirements.txt --no-deps
11505
11506# 5. Corrigir dependências faltantes
11507pip install gradio-client==1.14.0
11508pip install cffi soupsieve local-attention
11509pip install "aiofiles&lt;25.0" "pandas&lt;3.0" "pydantic&lt;=2.12.3"
11510pip install "starlette&lt;1.0,&gt;=0.40.0" "tomlkit&lt;0.14.0"
11511pip install "tokenizers&gt;=0.22.0,&lt;=0.23.0"
11512pip install audioread decorator lazy-loader msgpack pooch scikit-learn resampy</code></pre>
11513</div>
11514<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>config.py — versão final (sem DirectML):</strong></p>
11515<div class="code" style="margin-bottom:1.25rem">
11516  <span class="code-lang">python</span>
11517  <pre><code>import torch
11518import json
11519import os
11520
11521@singleton
11522class Config:
11523    def __init__(self):
11524        self.device = "cuda:0" if torch.cuda.is_available() else "cpu"
11525        # No AMD Windows sem CUDA, usa "cpu" automaticamente</code></pre>
11526</div>
11527<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Iniciar:</strong></p>
11528<div class="code" style="margin-bottom:1.25rem">
11529  <span class="code-lang">powershell</span>
11530  <pre><code># PowerShell LIMPO, sem nenhum 'set' antes
11531python app.py
11532# * Running on local URL: http://127.0.0.1:6969  ✅</code></pre>
11533</div>
11534
11535<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 5 — ARQUIVOS MUTE FALTANDO</h3>
11536<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Na instalação via git, os arquivos de silêncio não são criados. Aparecem um por um durante o treino:</p>
11537<div class="code" style="margin-bottom:1.25rem">
11538  <pre><code>FileNotFoundError: logs\\mute\\sliced_audios\\mute40000.wav
11539FileNotFoundError: logs\\mute\\extracted\\mute.npy          ← shape errado causa crash
11540FileNotFoundError: logs\\mute\\f0\\mute.wav.npy
11541FileNotFoundError: logs\\mute\\f0_voiced\\mute.wav.npy
11542RuntimeError: tensor (100) must match size (768)</code></pre>
11543</div>
11544<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução — criar todos de uma vez:</strong></p>
11545<div class="code" style="margin-bottom:1.25rem">
11546  <span class="code-lang">powershell</span>
11547  <pre><code>python -c "
11548import numpy as np, soundfile as sf, os
11549[os.makedirs(d, exist_ok=True) for d in [
11550    'logs/mute/sliced_audios','logs/mute/extracted',
11551    'logs/mute/f0','logs/mute/f0_voiced'
11552]]
11553sf.write('logs/mute/sliced_audios/mute40000.wav', np.zeros(int(40000*3.7)), 40000)
11554sf.write('logs/mute/sliced_audios/mute48000.wav', np.zeros(int(48000*3.7)), 48000)
11555sf.write('logs/mute/sliced_audios/mute32000.wav', np.zeros(int(32000*3.7)), 32000)
11556np.save('logs/mute/extracted/mute.npy', np.zeros((196, 768)))
11557np.save('logs/mute/f0/mute.wav.npy', np.zeros(100))
11558np.save('logs/mute/f0_voiced/mute.wav.npy', np.zeros(100))
11559print('OK')
11560"</code></pre>
11561</div>
11562<div class="err" style="margin-bottom:1.25rem">
11563  <div class="err-t">⚠️ Crítico: mute.npy precisa ter shape (196, 768)</div>
11564  <p>dimensão 768 do embedder contentvec. Qualquer outro shape causa crash.</p>
11565</div>
11566
11567<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">
11567FASE 6 — DATASET E TREINO</h3>
11568<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Dataset usado:</strong></p>
11569<div class="tbl" style="margin-bottom:1.5rem">
11570  <table>
11571    <thead>
11572      <tr>
11573        <th>Parâmetro</th>
11574        <th>Valor</th>
11575      </tr>
11576    </thead>
11577    <tbody>
11578      <tr>
11579        <td>Arquivo</td>
11580        <td>YURI-TTS.wav</td>
11581      </tr>
11582      <tr>
11583        <td>Duração</td>
11584        <td>9 minutos</td>
11585      </tr>
11586      <tr>
11587        <td>Fonte</td>
11588        <td>ElevenLabs TTS</td>
11589      </tr>
11590      <tr>
11591        <td>Nota</td>
11592        <td>Mínimo aceitável. Ideal: 15-25 min</td>
11593      </tr>
11594    </tbody>
11595  </table>
11596</div>
11597
11598<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Configurações do Applio:</strong></p>
11599<div class="tbl" style="margin-bottom:1.5rem">
11600  <table>
11601    <thead>
11602      <tr>
11603        <th>Parâmetro</th>
11604        <th>Valor</th>
11605      </tr>
11606    </thead>
11607    <tbody>
11608      <tr>
11609        <td>Taxa de amostragem</td>
11610        <td>40000 Hz</td>
11611      </tr>
11612      <tr>
11613        <td>Vocoder</td>
11614        <td>HiFi-GAN</td>
11615      </tr>
11616      <tr>
11617        <td>Algoritmo de pitch</td>
11618        <td>RMVPE</td>
11619      </tr>
11620      <tr>
11621        <td>Embedder</td>
11622        <td>contentvec</td>
11623      </tr>
11624      <tr>
11625        <td>Tamanho do lote</td>
11626        <td>4</td>
11627      </tr>
11628      <tr>
11629        <td>Total de épocas</td>
11630        <td>200</td>
11631      </tr>
11632      <tr>
11633        <td>Número da GPU</td>
11634        <td><strong>vazio</strong> (não colocar 0, -1 ou cpu)</td>
11635      </tr>
11636    </tbody>
11637  </table>
11638</div>
11639
11640<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Métricas reais:</strong></p>
11641<div class="tbl" style="margin-bottom:1.5rem">
11642  <table>
11643    <thead>
11644      <tr>
11645        <th>Época</th>
11646        <th>Loss</th>
11647        <th>Tempo por época</th>
11648      </tr>
11649    </thead>
11650    <tbody>
11651      <tr>
11652        <td>1</td>
11653        <td>27.181</td>
11654        <td>7:21</td>
11655      </tr>
11656      <tr>
11657        <td>8</td>
11658        <td>17.93</td>
11659        <td>7:02</td>
11660      </tr>
11661      <tr>
11662        <td>20</td>
11663        <td>16.212</td>
11664        <td>7:43</td>
11665      </tr>
11666      <tr>
11667        <td>43</td>
11668        <td>15.785</td>
11669        <td>5:43</td>
11670      </tr>
11671    </tbody>
11672  </table>
11673</div>
11674<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
11675  <li>Velocidade: ~6 minutos por época</li>
11676  <li>Total: ~20 horas para 200 épocas</li>
11677  <li>Hardware efetivo: CPU Xeon 24 núcleos</li>
11678</ul>
11679<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
11680  <strong>ℹ️ Buffer do PowerShell:</strong> de treino overnight o terminal pode parecer travado. O treino continua normalmente — verificar o contador no Applio.
11681</blockquote>
11682
11683<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">LIÇÕES APRENDIDAS</h3>
11684<p style="font-size:.88rem;color:#10b981;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">✅ O que funciona:</p>
11685<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
11686  <li>Applio + CPU puro no AMD Windows — estável e funcional</li>
11687  <li>Python 3.11 obrigatório (não 3.10)</li>
11688  <li><code>requirements.txt</code> editado — remover <code>+cu128</code></li>
11689  <li>PowerShell limpo — sem variáveis <code>CUDA_VISIBLE_DEVICES</code></li>
11690  <li>Arquivos mute criados manualmente antes do treino</li>
11691  <li>Campo "Número da GPU" <strong>vazio</strong> no Applio</li>
11692</ol>
11693<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">❌ O que não funciona:</p>
11694<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
11695  <li>DirectML + torch 2.7.1 — incompatível em 2026</li>
11696  <li><code>set CUDA_VISIBLE_DEVICES=-1</code> — quebra a extração de features</li>
11697  <li><code>pip install -r requirements.txt</code> sem editar — instala CUDA e falha</li>
11698  <li>Dataset grande (horas de áudio) — estouro de RAM/VRAM</li>
11699</ol>
11700
11701<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">PIPELINE FINAL DE PRODUÇÃO</h3>
11702<div class="code" style="margin-bottom:1.25rem">
11703  <pre><code>1. Escrever roteiro
11704   ↓
117052. Balabolka + Antônio Neural → WAV com interpretação humana
11706   ↓
117073. Applio — Inferência
11708   Modelo: my-project_200e.pth
11709   Índice: my-project.index
11710   ↓
117114. Output: WAV com voz do Yuri
11712   ↓
117135. Edição e publicação no YouTube</code></pre>
11714</div>
11715<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Velocidade de inferência (pós-treino):</strong></p>
11716<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
11717  <li>~5-30 segundos por minuto de áudio</li>
11718  <li>2 horas de áudio → ~30 minutos de processamento</li>
11719  <li>Modo Lote disponível no Applio</li>
11720</ul>
11721
11722<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">CHECKLIST — REPRODUZINDO DO ZERO</h3>
11723<ul style="list-style-type:none;padding-left:0;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
11724  <li><span style="color:#475569">[ ]</span> Python 3.11 instalado</li>
11725  <li><span style="color:#475569">[ ]</span> Git instalado</li>
11726  <li><span style="color:#475569">[ ]</span> FFmpeg no PATH</li>
11727  <li><span style="color:#475569">[ ]</span> Dataset WAV limpo (mínimo 5 min, ideal 15-25 min)</li>
11728  <li><span style="color:#475569">[ ]</span> <code>requirements.txt</code> editado (remover <code>+cu128</code>)</li>
11729  <li><span style="color:#475569">[ ]</span> <code>config.py</code> sem referências ao <code>torch_directml</code></li>
11730  <li><span style="color:#475569">[ ]</span> Arquivos mute criados</li>
11731  <li><span style="color:#475569">[ ]</span> PowerShell limpo (sem <code>set CUDA_VISIBLE_DEVICES</code>)</li>
11732  <li><span style="color:#475569">[ ]</span> Campo "Número da GPU" <strong>vazio</strong> no Applio</li>
11733  <li><span style="color:#475569">[ ]</span> Após extração: verificar que <code>logs/projeto/extracted/</code> tem arquivos <code>.npy</code></li>
11734</ul>
11735
11736<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">AMD vs NVIDIA EM IA — POSIÇÃO DO APPLIO/RVC (2026)</h3>
11737<div class="tbl" style="margin-bottom:1.5rem">
11738  <table>
11739    <thead>
11740      <tr>
11741        <th>Plataforma</th>
11742        <th>Situação</th>
11743      </tr>
11744    </thead>
11745    <tbody>
11746      <tr>
11747        <td>NVIDIA CUDA</td>
11748        <td>✅ Excelente — suporte nativo</td>
11749      </tr>
11750      <tr>
11751        <td>AMD ROCm Linux</td>
11752        <td>⚠️ Razoável — funciona com esforço</td>
11753      </tr>
11754      <tr>
11755        <td>AMD Windows DirectML</td>
11756        <td>❌ Abandonado</td>
11757      </tr>
11758      <tr>
11759        <td>AMD Windows CPU</td>
11760        <td>✅ Funcional — lento mas estável</td>
11761      </tr>
11762    </tbody>
11763  </table>
11764</div>
11765<p style="font-size:.85rem;color:#94a3b8;font-style:italic;line-height:1.8"><em>*Hardware legado não morre — só precisa do backend certo.</em></p>`},audio_srt_ptbr:{id:"audio_srt_ptbr",title:"40. PIPELINE COMPLETO — TRANSCRIÇÃO + TRADUÇÃO PT-BR COM RX 580",desc:"Transcrição de vídeo em inglês com tradução automática para português brasileiro, do .mp4 ao .srt sem nenhum serviço pago.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:25,tags:["srt-generation","automacao-srt","ffmpeg-pipeline"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linux_nativo"],previous:"linux_nativo",next:"limit_qwen_35b",related:["audio_whisper","limit_qwen_35b"]},part:1}
11765,html:`<div class="whisper-doc">
11766  <div class="hero">
11767    <div class="hero-title"><span>Pipeline Completo</span> — Transcrição + Tradução EN➔PT-BR</div>
11768    <div class="hero-sub">Transcrição offline de vídeo em inglês com tradução automática para português brasileiro, do <code>.mp4</code> ao <code>.srt</code> de forma 100% gratuita usando a RX 580 via Vulkan.</div>
11769    <div class="hero-badges">
11770      <span class="badge badge-gpu">AMD RX 580 8GB</span>
11771      <span class="badge badge-win">Windows + PowerShell</span>
11772      <span class="badge badge-ok">Vulkan Backend</span>
11773      <span class="badge badge-ok">large-v3-turbo</span>
11774      <span class="badge badge-win">deep-translator (Gratuito)</span>
11775    </div>
11776  </div>
11777
11778  <div class="stat-grid">
11779    <div class="stat">
11780      <div class="stat-label">tempo total pipeline</div>
11781      <div class="stat-value">~8 min</div>
11782      <div class="stat-sub">Vídeo de 29m 51s</div>
11783    </div>
11784    <div class="stat">
11785      <div class="stat-label">VRAM Usada</div>
11786      <div class="stat-value">2.9 GB</div>
11787      <div class="stat-sub">de 8 GB Polaris</div>
11788    </div>
11789    <div class="stat">
11790      <div class="stat-label">Temp. Média GPU</div>
11791      <div class="stat-value">50°C</div>
11792      <div class="stat-sub">Fan Curve Otimizada</div>
11793    </div>
11794    <div class="stat">
11795      <div class="stat-label">Custo Cloud</div>
11796      <div class="stat-value">R$ 0,00</div>
11797      <div class="stat-sub">100% Local & Offline</div>
11798    </div>
11799  </div>
11800
11801  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Hardware Utilizado no Teste</h3>
11802  <div class="tbl">
11803    <table>
11804      <thead>
11805        <tr>
11806          <th>Componente</th>
11807          <th>Especificação</th>
11808        </tr>
11809      </thead>
11810      <tbody>
11811        <tr>
11812          <td><strong>GPU</strong></td>
11813          <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
11814        </tr>
11815        <tr>
11816          <td><strong>CPU</strong></td>
11817          <td>Intel Xeon E5-2690 v3 (24 threads / 12 Cores)</td>
11818        </tr>
11819        <tr>
11820          <td><strong>RAM</strong></td>
11821          <td>31.8 GB DDR4 REG ECC</td>
11822        </tr>
11823        <tr>
11824          <td><strong>OS</strong></td>
11825          <td>Windows 11 Professional</td>
11826        </tr>
11827        <tr>
11828          <td><strong>Driver</strong></td>
11829          <td>Adrenalin 31.0.21925.1001 (2026/05/20)</td>
11830        </tr>
11831      </tbody>
11832    </table>
11833  </div>
11834
11835  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Fluxo de Dados Unificado (Pipeline)</h3>
11836  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
11837    O objetivo é mapear um vídeo educacional em inglês para legenda em português compatível com software editor de vídeo (Filmora, Premiere, etc.), rodando a transcrição via GPU nativa e traduzindo cada timestamp sem limites de API de nuvem comercial:
11838  </p>
11839  <div class="cmd" style="white-space:normal; line-height:1.6; padding: 1rem;">
11840    <strong>video.mp4</strong> ➔ <code>FFmpeg (extração)</code> ➔ <strong>video_16k.wav</strong><br>
11841    ➔ <code>whisper-cli Vulkan (transcrição)</code> ➔ <strong>video.srt (English)</strong><br>
11842    ➔ <code>Python deep-translator (Google Translate)</code> ➔ <strong>video_ptbr.srt (Português)</strong><br>
11843    ➔ <code>Importar na Timeline do Filmora</code>
11844  </div>
11845
11846  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Performance e Timing Detalhado</h3>
11847  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
11848    Métricas reais obtidas transcrição de um vídeo educacional de <strong>29 minutos e 51 segundos</strong> (áudio em inglês, AAC, 480x360):
11849  </p>
11850  <div class="tbl" style="margin-bottom:1.5rem">
11851    <table>
11852      <thead>
11853        <tr>
11854          <th>Etapa do Pipeline</th>
11855          <th>Ferramenta</th>
11856          <th>Tempo Gasto</th>
11857        </tr>
11858      </thead>
11859      <tbody>
11860        <tr>
11861          <td><strong>1. Extração de Áudio WAV Sem Compressão</strong></td>
11862          <td>FFmpeg</td>
11863          <td><strong>1.7 segundos</strong></td>
11864        </tr>
11865        <tr>
11866          <td><strong>2. Transcrição de Áudio (EN)</strong></td>
11867          <td>Whisper.cpp + Vulkan</td>
11868          <td><strong>6 minutos e 07 segundos</strong></td>
11869        </tr>
11870        <tr>
11871          <td><strong>3. Tradução em Bloco do SRT (EN➔PT-BR)</strong></td>
11872          <td>Python + <code>deep-translator</code></td>
11873          <td><strong>~2 minutos</strong> (limitação de I/O de rede)</td>
11874        </tr>
11875        <tr style="border-top:1px solid rgba(255,255,255,0.15)">
11876          <td><strong>Métrica Total Consolidade</strong></td>
11877          <td><strong>Pipeline Completo</strong></td>
11878          <td><strong>~8 minutos</strong></td>
11879        </tr>
11880      </tbody>
11881    </table>
11882  </div>
11883
11884  <h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">Timings Internos do Core (whisper_print_timings)</h4>
11885  <div class="card bg-black/40 border border-white/5 p-4 rounded-md my-3 font-mono text-xs text-[#a7f3d0] leading-relaxed">
11886    load modelo : 3.687 ms<br>
11887    mel (áudio) : 2.305 ms<br>
11888    encode GPU  : 204.689 ms<br>
11889    decode      : 4.081 ms<br>
11890    batch total : 108.675 ms<br>
11891    total       : 367.432 ms (por batch de segmentação)
11892  </div>
11893
11894  <div class="section-title">Manual de Instruções Passo a Passo</div>
11895
11896  <div class="step">
11897    <div class="step-header">
11898      <div class="step-num">1</div>
11899      <div class="step-name">Extrair Áudio Compatível via FFmpeg</div>
11900      <div class="step-desc">WAV 16kHz Mono 16-bit</div>
11901    </div>
11902    <div class="step-body">
11903      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">O Whisper necessita estritamente de áudio WAV cru em 16.000 Hz, formato mono de 16 bits:</p>
11904      <div class="cmd">ffmpeg -i "E:\\MUSICAS SUNO AI\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\MUSICAS SUNO AI\\video_16k.wav"</div>
11905      <p class="note"><strong>Flags:</strong> <code>-ar 16000</code> força 16kHz · <code>-ac 1</code> converte para canal mono único · <code>-c:a pcm_s16le</code> define PCM de 16 bits sem perda.</p>
11906    </div>
11907  </div>
11908
11909  <div class="step">
11910    <div class="step-header">
11911      <div class="step-num">2</div>
11912      <div class="step-name">Transcrever via Vulkan</div>
11913      <div class="step-desc">
11913Carga pesada na GPU Polaris</div>
11914    </div>
11915    <div class="step-body">
11916      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">Chamar o executável compilado do Whisper para gerar o arquivo inicial de legendas SRT em inglês:</p>
11917      <div class="cmd">cd C:\\whisper.cpp</div>
11918      <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\MUSICAS SUNO AI\\video_16k.wav" -l en --output-srt</div>
11919      <p class="note"><strong>Verificação de atividade da GPU:</strong> Certifique-se de ver as linhas <code>ggml_vulkan: Found 1 Vulkan devices: AMD Radeon RX 580 2048SP</code> na inicialização para atestar que o encode pesado foi acoplado na GPU, reduzindo o uso de CPU para ~5%.</p>
11920    </div>
11921  </div>
11922
11923  <div class="step">
11924    <div class="step-header">
11925      <div class="step-num">3</div>
11926      <div class="step-name">Criar e Executar Script Python de Tradução</div>
11927      <div class="step-desc">Zero Keys, Zero Custos</div>
11928    </div>
11929    <div class="step-body">
11930      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">
11931        Instale a biblioteca de tradução sem chaves de API: <code>pip install deep-translator</code>. Crie e rode o arquivo <code>C:\\whisper.cpp\\traduzir.py</code> com este código:
11932      </p>
11933      <div class="cmd" style="white-space:pre-wrap; font-size:11px;">from deep_translator import GoogleTranslator
11934
11935def traduzir_srt(entrada, saida):
11936    with open(entrada, 'r', encoding='utf-8') as f:
11937        conteudo = f.read()
11938
11939    blocos = conteudo.strip().split('\\n\\n')
11940    resultado = []
11941
11942    for bloco in blocos:
11943        linhas = bloco.split('\\n')
11944        if len(linhas) >= 3:
11945            numero = linhas[0]
11946            timestamp = linhas[1]
11947            texto = ' '.join(linhas[2:])
11948            traduzido = GoogleTranslator(source='en', target='pt').translate(texto)
11949            resultado.append(f"{numero}\\n{timestamp}
11949\\n{traduzido}")
11950
11951    with open(saida, 'w', encoding='utf-8') as f:
11952        f.write('\\n\\n'.join(resultado))
11953    print("Pronto!")
11954
11955traduzir_srt(
11956    r'E:\\MUSICAS SUNO AI\\video_16k.wav.srt',
11957    r'E:\\MUSICAS SUNO AI\\video_16k_ptbr.srt'
11958)</div>
11959<p style="font-size:0.8rem;color:#94a3b8;margin-top:0.5rem">Pour exécuter :</p>
11960      <div class="cmd">python traduzir.py</div>
11961    </div>
11962  </div>
11963
11964  <div class="step">
11965    <div class="step-header">
11966      <div class="step-num">4</div>
11967      <div class="step-name">Importer les sous-titres dans Filmora</div>
11968      <div class="step-desc">Finaliser le montage vidéo</div>
11969    </div>
11970    <div class="step-body">
11971      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6">
11972        1. Dans Wondershare Filmora, accédez à <strong>Fichier ➔ Importer ➔ Importer des fichiers de sous-titres</strong>.<br>
11973        2. Sélectionnez le fichier généré <code>video_16k_ptbr.srt</code>.<br>
11974        3. Faites glisser et déposez la piste de sous-titres directement sur la timeline, superposée à la piste vidéo originale.
11975      </p>
11976    </div>
11977  </div>
11978
11979  <div class="section-title">Leçons autonomes apprises au fil des péripéties</div>
11980  <div class="card-inner">
11981    <div class="lesson">
11982      <div class="lesson-icon">⚠️</div>
11983      <div class="lesson-text"><strong>Évitez d'utiliser --translate pour le PT-BR directement dans les flags de Whisper :</strong> Le paramètre <code>--translate</code> traduit par conception l'audio vers l'anglais de manière native. Pour obtenir des sous-titres en portugais brésilien de qualité, l'approche correcte consiste à extraire l'anglais via <code>-l en</code> et à traduire avec l'algorithme <code>traduzir.py</code>.</div>
11984    </div>
11985    <div class="lesson">
11986      <div class="lesson-icon">⚠️</div>
11987      <div class="lesson-text"><strong>Problèmes de langue source incorrecte :</strong> Passer <code>-l pt</code> lorsque l'audio source est parlé en anglais force Whisper à appliquer des modèles phonétiques portugais sur l'audio anglais, générant des textes totalement incompréhensibles et dénués de sens. Définissez toujours la langue réelle de l'audio d'entrée comme paramètre initial.</div>
11988    </div>
11989    <div class="lesson">
11990      <div class="lesson-icon">ℹ️</div>
11991      <div class="lesson-text"><strong>Emplacement du fichier généré :</strong> Par défaut, dans les compilations natives, le fichier <code>.srt</code> est enregistré dans le même dossier physique que le fichier audio WAV traité, et non dans le répertoire du script ou de Whisper.</div>
11992    </div>
11993    <div class="lesson">
11994      <div class="lesson-icon">✅</div>
11995      <div class="lesson-text"><strong>8 Go de VRAM en 2026, toujours vaillante :</strong> Le modèle Whisper <code>large-v3-turbo</code> consomme seulement 2,9 Go de VRAM physique dans l'écosystème, laissant de la marge pour d'autres activités sur votre machine ou pour un rendu parallèle. Des milliers de dollars économisés en abonnements et APIs propriétaires.</div>
11996    </div>
11997  </div>
11998
11999  <div class="footer">
12000    RX 580 — vieille de 580 ans, mais toujours en service 🚀 · Péripéties documentées en juin 2026
12001  </div>
12002</div>`},audio_whisper:{id:"audio_whisper",title:"39. WHISPER.CPP LOCAL — TRANSCRIÇÃO DE ÁUDIO EM AMD RX 580",desc:"Transcription audio/vidéo accélérée par GPU AMD via Vulkan sur Windows (modèle large-v3-turbo).",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:30,tags:["whispercpp","transcricao-audio","vulkan-whisper"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_rvc"],previous:"audio_rvc",next:"linux_nativo",related:["audio_rvc","audio_srt_ptbr"]},part:1},html:`<div class="whisper-doc"><style>.whisper-doc{--color-border-secondary:rgba(255,255,255,0.05);--color-border-tertiary:rgba(255,255,255,0.08);--color-background-secondary:#0c0d10;--color-background-primary:#07080a;--color-text-primary:#ffffff;--color-text-secondary:#94a3b8;font-family:inherit}.whisper-doc *{box-sizing:border-box}
12002.whisper-doc .badge{display:inline-block;font-size:11px;font-weight:500;padding:2px 8px;border-radius:4px;letter-spacing:0.04em;text-transform:uppercase}.whisper-doc .badge-gpu{background:rgba(225,29,72,0.1);border:1px solid rgba(225,29,72,0.3);color:#fda4af}.whisper-doc .badge-win{background:rgba(34,197,94,0.1);border:1px solid rgba(34,197,94,0.2);color:#a7f3d0}.whisper-doc .badge-ok{background:rgba(14,165,233,0.1);border:1px solid rgba(14,165,233,0.3);color:#bae6fd}.whisper-doc .badge-warn{background:rgba(245,158,11,0.1);border:1px solid rgba(245,158,11,0.3);color:#fef08a}.whisper-doc .hero{border:1px solid rgba(255,255,255,0.05);border-radius:6px;padding:1.5rem;margin-bottom:2rem;background:#0c0d10}.whisper-doc .hero-title{font-size:26px;font-weight:700;color:var(--color-text-primary);line-height:1.2;margin-bottom:0.5rem;font-family:'Syne',var(--font-sans);text-transform:uppercase}.whisper-doc .hero-title span{color:#E11D48}.whisper-doc .hero-sub{font-size:13px;color:var(--color-text-secondary);margin-bottom:1.25rem;line-height:1.6;font-family:var(--font-sans)}.whisper-doc .hero-badges{display:flex;flex-wrap:wrap;gap:6px}.whisper-doc .stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin-bottom:2rem}.whisper-doc .stat{background:#0c0d10;border:1px solid rgba(255,255,255,0.05);border-radius:6px;padding:0.875rem 1rem}.whisper-doc .stat-label{font-size:11px;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:0.06em;margin-bottom:4px;font-family:var(--font-sans)}.whisper-doc .stat-value{font-size:20px;font-weight:700;color:var(--color-text-primary);font-family:var(--font-mono)}.whisper-doc .stat-sub{font-size:11px;color:var(--color-text-secondary);margin-top:2px;font-family:var(--font-sans)}.whisper-doc .section{margin-bottom:2.5rem}.whisper-doc .section-title{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:0.08em;color:#E11D48;margin-top:2rem;margin-bottom:1rem;font-family:var(--font-sans);padding-bottom:6px;border-bottom:1px solid rgba(255,255,255,0.08)}.whisper-doc .step{border:1px solid rgba(255,255,255,0.05);border-radius:6px;margin-bottom:10px;overflow:hidden;background:#050506}.whisper-doc .step-header{display:flex;align-items:center;gap:10px;padding:0.75rem 1rem;background:#0c0d10;border-bottom:1px solid rgba(255,255,255,0.03)}.whisper-doc .step-num{width:24px;height:24px;border-radius:50%;background:#E11D48;color:#fff;font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-family:var(--font-mono)}.whisper-doc .step-name{font-size:13px;font-weight:700;color:var(--color-text-primary);font-family:var(--font-sans)}.whisper-doc .step-desc{font-size:11px;color:var(--color-text-secondary);font-family:var(--font-sans);margin-left:auto}.whisper-doc .step-body{padding:0.875rem 1rem}.whisper-doc .cmd{background:#050506;border:1px solid rgba(255,255,255,0.03);border-radius:4px;padding:0.625rem 0.875rem;font-size:12px;color:#fff;font-family:var(--font-mono);margin-bottom:6px;overflow-x:auto;white-space:nowrap;border-left:3px solid #E11D48}.whisper-doc .note{font-size:12px;color:var(--color-text-secondary);font-family:var(--font-sans);line-height:1.6;margin-top:4px;padding-left:8px;border-left:2px solid #E11D48}.whisper-doc .flag-table{width:100%;border-collapse:collapse;font-size:12px}.whisper-doc .flag-table th{text-align:left;padding:8px 10px;font-weight:700;color:var(--color-text-primary);font-family:var(--font-sans);font-size:10px;text-transform:uppercase;letter-spacing:0.05em;border-bottom:1px solid rgba(255,255,255,0.08);background:#111215}.whisper-doc .flag-table td{padding:8px 10px;border-bottom:1px solid rgba(255,255,255,0.03);font-family:var(--font-mono)}.whisper-doc .flag-table td:first-child{color:#fda4af}.whisper-doc .flag-table td:last-child{font-family:var(--font-sans);color:var(--color-text-secondary)}.whisper-doc .flag-table tr:last-child td{border-bottom:none}.whisper-doc .perf-bar-wrap{margin:0.5rem 0 1rem;background:#0c0d10;border:1px solid rgba(255,255,255,0.05);padding:1rem;border-radius:6px}
12002.whisper-doc .perf-row{display:flex;align-items:center;gap:8px;margin-bottom:8px}.whisper-doc .perf-row:last-child{margin-bottom:0}.whisper-doc .perf-label{font-size:12px;color:var(--color-text-secondary);width:120px;flex-shrink:0;font-family:var(--font-sans);text-align:right}.whisper-doc .perf-bar-bg{flex:1;height:8px;background:rgba(255,255,255,0.03);border-radius:4px;overflow:hidden}.whisper-doc .perf-bar{height:100%;border-radius:4px}.whisper-doc .perf-time{font-size:12px;font-family:var(--font-mono);color:var(--color-text-primary);width:70px;flex-shrink:0;margin-left:8px}.whisper-doc .lesson{display:flex;gap:10px;padding:10px 0;border-bottom:1px solid rgba(255,255,255,0.03);align-items:flex-start}.whisper-doc .lesson:last-child{border-bottom:none}.whisper-doc .lesson-icon{font-size:16px;flex-shrink:0;margin-top:1px}.whisper-doc .lesson-text{font-size:12.5px;color:var(--color-text-secondary);font-family:var(--font-sans);line-height:1.6}.whisper-doc .lesson-text strong{font-weight:700;color:var(--color-text-primary)}.whisper-doc .footer{text-align:center;font-size:11px;color:#475569;font-family:var(--font-mono);padding-top:1.5rem;border-top:1px solid rgba(255,255,255,0.05);margin-top:2rem}.whisper-doc .two-col{display:grid;grid-template-columns:1fr 1fr;gap:10px}@media (max-width:600px){.whisper-doc .two-col{grid-template-columns:1fr}}.whisper-doc .env-row{display:flex;justify-content:space-between;padding:6px 0;border-bottom:1px solid rgba(255,255,255,0.03);font-size:12px}.whisper-doc .env-row:last-child{border-bottom:none}.whisper-doc .env-key{color:var(--color-text-secondary);font-family:var(--font-sans)}.whisper-doc .env-val{font-family:var(--font-mono);color:var(--color-text-primary);text-align:right}.whisper-doc .card-inner{background:#0c0d10;border:1px solid rgba(255,255,255,0.05);border-radius:6px;padding:1rem 1.25rem}</style><div class="hero"><div class="hero-title"><span>whisper.cpp</span> + RX 580 via Vulkan</div><div class="hero-sub">Transcription audio/vidéo avec accélération GPU AMD sur Windows — utilisant Vulkan pour faire tourner les modèles Whisper directement sur la VRAM de la RX 580. Un GPU de 2017 mis au travail en 2026.</div><div class="hero-badges"><span class="badge badge-gpu">AMD RX 580 8GB</span><span class="badge badge-win">Windows + PowerShell</span><span class="badge badge-ok">Vulkan Backend</span><span class="badge badge-ok">large-v3-turbo</span><span class="badge badge-warn">FFmpeg pré-req</span></div></div><div class="stat-grid"><div class="stat"><div class="stat-label">temps total</div><div class="stat-value">~5 min</div><div class="stat-sub">pour 15 min de vidéo</div></div><div class="stat"><div class="stat-label">VRAM utilisée</div><div class="stat-value">2.6 GB</div><div class="stat-sub">sur 8 GB disponibles</div></div><div class="stat"><div class="stat-label">speedup vs CPU</div><div class="stat-value">~150×</div><div class="stat-sub">avant : 12h pour 40min</div></div><div class="stat"><div class="stat-label">modèle</div><div class="stat-value">1.6 GB</div><div class="stat-sub">large-v3-turbo</div></div></div><div class="section"><div class="section-title">prérequis vérifiés</div><div class="card-inner"><div class="env-row"><span class="env-key">Vulkan SDK</span><span class="env-val">glslc v2026.1</span></div><div class="env-row"><span class="env-key">Git</span><span class="env-val">2.54.0.windows.1</span></div><div class="env-row"><span class="env-key">CMake</span><span class="env-val">4.3.2</span></div><div class="env-row"><span class="env-key">MSVC (Build Tools)</span><span class="env-val">14.52.36328 — VS 2026</span></div><div class="env-row"><span class="env-key">GPU détectée</span><span class="env-val">AMD Radeon RX 580 2048SP</span></div><div class="env-row"><span class="env-key">FFmpeg</span><span class="env-val">2026-04-19 (Gyan full build)</span></div></div><p class="note" style="margin-top:8px;">Vérifier RX 580 dans Vulkan : <span style="font-family:var(--font-mono);color:#fda4af;">vulkaninfo --summary</span> → doit afficher AMD Radeon RX 580 2048SP</p></div><div class="section"><div class="section-title">compilation — étape par étape</div><div class="step"><div class="step-header"><div class="step-num">1</div><div class="step-name">activer l'environnement MSVC x64</div><div class="step-desc">à chaque nouvelle session</div></div><div class="step-body"><div class="cmd">& "C:\\Program Files (x86)\\Microsoft Visual Studio\\18\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"</div><p class="note">À répéter à chaque fois que vous ouvrez un nouveau PowerShell avant de compiler. Sortie attendue : "Environment initialized for: 'x64'"</p></div></div><div class="step"><div class="step-header"><div class="step-num">2</div><div class="step-name">cloner le dépôt</div><div class="step-desc">~40 MB</div></div><div class="step-body"><div class="cmd">cd C:\\</div><div class="cmd">git clone https://github.com/ggml-org/whisper.cpp</div><div class="cmd">cd whisper.cpp</div></div></div><div class="step"><div class="step-header"><div class="step-num">3</div><div class="step-name">cmake avec Vulkan activé</div><div class="step-desc">flag critique : -DGGML_VULKAN=ON</div></div><div class="step-body"><div class="cmd">cmake -B build -DGGML_VULKAN=ON -DGGML_HIPBLAS=OFF -DGGML_HIP=OFF -DGGML_CUDA=OFF</div><div class="cmd">cmake --build build --config Release -j4</div><p class="note">Durée ~5-10 min. Les avertissements C4267/C4244 sont normaux — n'affectent pas le fonctionnement. Les binaires sont dans build\\bin\\Release\\</p></div></div><div class="step"><div class="step-header"><div class="step-num">4</div><div class="step-name">télécharger le modèle large-v3-turbo</div><div class="step-desc">~1.6 GB</div></div><div class="step-body"><div class="cmd">Invoke-WebRequest -Uri "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo.bin" -OutFile "models\\ggml-large-v3-turbo.bin"</div><p class="note">Autres modèles : large-v3 (~6GB VRAM, meilleure qualité), medium (~2.5GB), small (~1GB)</p></div></div></div><div class="section"><div class="section-title">utilisation — flux complet mp4 → txt</div><div class="step"><div class="step-header"><div class="step-num" style="background:#1D9E75;">1</div><div class="step-name">extraire l'audio avec FFmpeg</div><div class="step-desc">whisper ne lit pas mp4 directement sur Windows</div></div><div class="step-body"><div class="cmd">ffmpeg -i "E:\\videos\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\videos\\video.wav"</div><p class="note">-ar 16000 = 16kHz (obligatoire pour Whisper) · -ac 1 = mono · -c:a pcm_s16le = WAV sans compression</p></div></div><div class="step"><div class="step-header"><div class="step-num" style="background:#1D9E75;">2</div><div class="step-name">transcrire / traduire</div><div class="step-desc">le GPU fait le reste</div></div><div class="step-body"><div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --output-txt</
12002div><p style="font-size:12px;color:var(--color-text-secondary);margin:6px 0 4px;font-family:var(--font-sans);">avec traduction vers l'anglais :</p><div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --translate --output-txt</div><p class="note">--translate génère toujours de l'anglais (limitation de Whisper). Pour d'autres langues cibles, utiliser une étape de traduction supplémentaire.</p></div></div><div style="margin-top:1rem;"><div class="section-title" style="margin-bottom:0.75rem;">flags utiles</div><div class="card-inner"><table class="flag-table"><thead><tr><th>flag</th><th>description</th></tr></thead><tbody><tr><td>-l pt</td><td>langue source : portugais</td></tr><tr><td>-l en</td><td>langue source : anglais</td></tr><tr><td>--translate</td><td>traduit tout en anglais</td></tr><tr><td>--output-txt</td><td>sauvegarde .txt avec transcription</td></tr><tr><td>--output-srt</td><td>sauvegarde sous-titres .srt avec timestamps</td></tr><tr><td>--output-vtt</td><td>sauvegarde sous-titres .vtt</td></tr><tr><td>-t 8</td><td>utilise 8 threads CPU (défaut : 4)</td></tr><tr><td>--device 0</td><td>sélectionne le GPU 0 (défaut)</td></tr><tr><td>--no-gpu</td><td>force le CPU (mode lent)</td></tr></tbody></table></div></div></div><div class="section"><div class="section-title">performance — vidéo de 15 min</div><div class="perf-bar-wrap"><div class="perf-row"><div class="perf-label">chargement modèle</div><div class="perf-bar-bg"><div class="perf-bar" style="width:1.3%;background:#E11D48;"></div></div><div class="perf-time">4 s</div></div><div class="perf-row"><div class="perf-label">mel (audio)</div><div class="perf-bar-bg"><div class="perf-bar" style="width:0.4%;background:#E11D48;"></div></div><div class="perf-time">1.2 s</div></div><div class="perf-row"><div class="perf-label">encodage GPU</div><div class="perf-bar-bg"><div class="perf-bar" style="width:23.7%;background:#1D9E75;"></div></div><div class="perf-time">73 s</div></div><div class="perf-row"><div class="perf-label">décodage + batch</div><div class="perf-bar-bg"><div class="perf-bar" style="width:54.7%;background:#1D9E75;"></div></div><div class="perf-time">168 s</div></div><div class="perf-row"><div class="perf-label" style="font-weight:700;color:var(--color-text-primary);">total</div><div class="perf-bar-bg"><div class="perf-bar" style="width:100%;background:#E11D48;"></div></div><div class="perf-time" style="font-weight:700;">307 s</div></div></div><p class="note">CPU à ~5% pendant toute la transcription. VRAM : 2.6 GB sur 8 GB. Le GPU a fait le travail — le CPU s'est reposé.</p></div><div class="section"><div class="section-title">leçons tirées des péripéties</div><div class="card-inner"><div class="lesson"><div class="lesson-icon">⚠️</div><div class="lesson-text"><strong>WSL2 n'expose pas la RX 580 via Vulkan</strong> — utilisez toujours PowerShell/Windows natif pour tirer parti du GPU.</div></div><div class="lesson"><div class="lesson-icon">⚠️</div><div class="lesson-text"><strong>Whisper ne lit pas les MP4 sur Windows</strong> — extrayez toujours l'audio avec FFmpeg avant. Utilisez -ar 16000 -ac 1 -c:a pcm_s16le.</div></div><div class="lesson"><div class="lesson-icon">ℹ️</div><div class="lesson-text"><strong>--translate ne génère que de l'anglais</strong> — c'est une limitation de Whisper, pas de la configuration. Pour le FR comme cible, une étape supplémentaire est nécessaire.</div></div><div class="lesson"><div class="lesson-icon">ℹ️</div><div class="lesson-text"><strong>vcvars64.bat doit être réactivé</strong> à chaque nouvelle session PowerShell avant toute compilation.</div></div><div class="lesson"><div class="lesson-icon">✅</div><div class="lesson-text"><strong>8 GB de VRAM en 2026 c'est toujours solide</strong> — large-v3-turbo n'utilise que 2.6 GB. Un "vieux" GPU avec une VRAM correcte bat facilement un GPU neuf avec 4 GB.</div></div><div class="lesson"><div class="lesson-icon">✅</div><div class="lesson-text"><strong>Les avertissements C4267/C4244 pendant la compilation sont normaux</strong> — conversions de type attendues dans le code ggml, n'impactent pas le fonctionnement.</div></div></div></div><div class="footer">RX 580 — vieille de 580 ans, mais toujours active 🚀 · Péripéties documentées en juin/2026</div></div>
12003<div class="stat-sub">de 8 GB disponíveis</div>
12004    </div>
12005    <div class="stat">
12006      <div class="stat-label">speedup vs CPU</div>
12007      <div class="stat-value">~150×</div>
12008      <div class="stat-sub">antes: 12h para 40min</div>
12009    </div>
12010    <div class="stat">
12011      <div class="stat-label">modelo</div>
12012      <div class="stat-value">1.6 GB</div>
12013      <div class="stat-sub">large-v3-turbo</div>
12014    </div>
12015  </div>
12016
12017  <div class="section">
12018    <div class="section-title">pré-requisitos verificados</div>
12019    <div class="card-inner">
12020      <div class="env-row"><span class="env-key">Vulkan SDK</span><span class="env-val">glslc v2026.1</span></div>
12021      <div class="env-row"><span class="env-key">Git</span><span class="env-val">2.54.0.windows.1</span></div>
12022      <div class="env-row"><span class="env-key">CMake</span><span class="env-val">4.3.2</span></div>
12023      <div class="env-row"><span class="env-key">MSVC (Build Tools)</span><span class="env-val">14.52.36328 — VS 2026</span></div>
12024      <div class="env-row"><span class="env-key">GPU detectada</span><span class="env-val">AMD Radeon RX 580 2048SP</span></div>
12025      <div class="env-row"><span class="env-key">FFmpeg</span><span class="env-val">2026-04-19 (Gyan full build)</span></div>
12026    </div>
12027    <p class="note" style="margin-top: 8px;">Verificar RX 580 no Vulkan: <span style="font-family:var(--font-mono); color:#fda4af;">vulkaninfo --summary</span> → deve aparecer AMD Radeon RX 580 2048SP</p>
12028  </div>
12029
12030  <div class="section">
12031    <div class="section-title">compilação — passo a passo</div>
12032
12033    <div class="step">
12034      <div class="step-header">
12035        <div class="step-num">1</div>
12036        <div class="step-name">ativar ambiente MSVC x64</div>
12037        <div class="step-desc">a cada nova sessão</div>
12038      </div>
12039      <div class="step-body">
12040        <div class="cmd">& "C:\\Program Files (x86)\\Microsoft Visual Studio\\18\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"</div>
12041        <p class="note">Precisa repetir toda vez que abrir um novo PowerShell antes de compilar. Saída esperada: "Environment initialized for: 'x64'"</p>
12042      </div>
12043    </div>
12044
12045    <div class="step">
12046      <div class="step-header">
12047        <div class="step-num">2</div>
12048        <div class="step-name">clonar repositório</div>
12049        <div class="step-desc">~40 MB</div>
12050      </div>
12051      <div class="step-body">
12052        <div class="cmd">cd C:\\</div>
12053        <div class="cmd">git clone https://github.com/ggml-org/whisper.cpp</div>
12054        <div class="cmd">cd whisper.cpp</div>
12055      </div>
12056    </div>
12057
12058    <div class="step">
12059      <div class="step-header">
12060        <div class="step-num">3</div>
12061        <div class="step-name">cmake com Vulkan habilitado</div>
12062        <div class="step-desc">flag crítica: -DGGML_VULKAN=ON</div>
12063      </div>
12064      <div class="step-body">
12065        <div class="cmd">cmake -B build -DGGML_VULKAN=ON -DGGML_HIPBLAS=OFF -DGGML_HIP=OFF -DGGML_CUDA=OFF</div>
12066        <div class="cmd">cmake --build build --config Release -j4</div>
12067        <p class="note">Dura ~5-10 min. Warnings de C4267/C4244 são normais — não afetam o funcionamento. Binários ficam em build\\bin\\Release\\</p>
12068      </div>
12069    </div>
12070
12071    <div class="step">
12072      <div class="step-header">
12073        <div class="step-num">4</div>
12074        <div class="step-name">baixar modelo large-v3-turbo</div>
12075        <div class="step-desc">~1.6 GB</div>
12076      </div>
12077      <div class="step-body">
12078        <div class="cmd">Invoke-WebRequest -Uri "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo.bin" -OutFile "models\\ggml-large-v3-turbo.bin"</div>
12079        <p class="note">Outros modelos: large-v3 (~6GB VRAM, melhor qualidade), medium (~2.5GB), small (~1GB)</p>
12080      </div>
12081    </div>
12082  </div>
12083
12084  <div class="section">
12085    <div class="section-title">uso — fluxo completo mp4 → txt</div>
12086
12087    <div class="step">
12088      <div class="step-header">
12089        <div class="step-num" style="background:#1D9E75;">1</div>
12090        <div class="step-name">extrair áudio com FFmpeg</div>
12091        <div class="step-desc">whisper não lê mp4 direto no Windows</div>
12092      </div>
12093      <div class="step-body">
12094        <div class="cmd">ffmpeg -i "E:\\videos\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\videos\\video.wav"</div>
12095        <p class="note">-ar 16000 = 16kHz (obrigatório para o Whisper) · -ac 1 = mono · -c:a pcm_s16le = WAV sem compressão</p>
12096      </div>
12097    </div>
12098
12099    <div class="step">
12100      <div class="step-header">
12101        <div class="step-num" style="background:#1D9E75;">2</div>
12102        <div class="step-name">transcrever / traduzir</div>
12103        <div class="step-desc">GPU cuida do resto</div>
12104      </div>
12105      <div class="step-body">
12106        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --output-txt</
12106div>
12107        <p style="font-size:12px; color:var(--color-text-secondary); margin: 6px 0 4px; font-family:var(--font-sans);">com tradução para inglês:</p>
12108        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --translate --output-txt</div>
12109        <p class="note">--translate sempre gera inglês (limitação do Whisper). Para outros idiomas de destino, usar etapa adicional de tradução.</p>
12110      </div>
12111    </div>
12112
12113    <div style="margin-top: 1rem;">
12114      <div class="section-title" style="margin-bottom: 0.75rem;">flags úteis</div>
12115      <div class="card-inner">
12116        <table class="flag-table">
12117          <thead><tr><th>flag</th><th>descrição</th></tr></thead>
12118          <tbody>
12119            <tr><td>-l pt</td><td>idioma fonte: português</td></tr>
12120            <tr><td>-l en</td><td>idioma fonte: inglês</td></tr>
12121            <tr><td>--translate</td><td>traduz tudo para inglês</td></tr>
12122            <tr><td>--output-txt</td><td>salva .txt com transcrição</td></tr>
12123            <tr><td>--output-srt</td><td>salva legendas .srt com timestamps</td></tr>
12124            <tr><td>--output-vtt</td><td>salva legendas .vtt</td></tr>
12125            <tr><td>-t 8</td><td>usa 8 threads de CPU (padrão: 4)</td></tr>
12126            <tr><td>--device 0</td><td>seleciona GPU 0 (padrão)</td></tr>
12127            <tr><td>--no-gpu</td><td>força CPU (modo lento)</td></tr>
12128          </tbody>
12129        </table>
12130      </div>
12131    </div>
12132  </div>
12133
12134  <div class="section">
12135    <div class="section-title">performance — vídeo de 15 min</div>
12136    <div class="perf-bar-wrap">
12137      <div class="perf-row">
12138        <div class="perf-label">load modelo</div>
12139        <div class="perf-bar-bg"><div class="perf-bar" style="width:1.3%; background:#E11D48;"></div></div>
12140        <div class="perf-time">4 s</div>
12141      </div>
12142      <div class="perf-row">
12143        <div class="perf-label">mel (áudio)</div>
12144        <div class="perf-bar-bg"><div class="perf-bar" style="width:0.4%; background:#E11D48;"></div></div>
12145        <div class="perf-time">1.2 s</div>
12146      </div>
12147      <div class="perf-row">
12148        <div class="perf-label">encode GPU</div>
12149        <div class="perf-bar-bg"><div class="perf-bar" style="width:23.7%; background:#1D9E75;"></div></div>
12150        <div class="perf-time">73 s</div>
12151      </div>
12152      <div class="perf-row">
12153        <div class="perf-label">decode + batch</div>
12154        <div class="perf-bar-bg"><div class="perf-bar" style="width:54.7%; background:#1D9E75;"></div></div>
12155        <div class="perf-time">168 s</div>
12156      </div>
12157      <div class="perf-row">
12158        <div class="perf-label" style="font-weight:700; color:var(--color-text-primary);">total</div>
12159        <div class="perf-bar-bg"><div class="perf-bar" style="width:100%; background:#E11D48;"></div></div>
12160        <div class="perf-time" style="font-weight:700;">307 s</div>
12161      </div>
12162    </div>
12163    <p class="note">CPU em ~5% durante toda a transcrição. VRAM: 2.6 GB de 8 GB. A GPU fez o trabalho — CPU ficou de molho.</p>
12164  </div>
12165
12166  <div class="section">
12167    <div class="section-title">lições aprendidas nas peripécias</div>
12168    <div class="card-inner">
12169      <div class="lesson">
12170        <div class="lesson-icon">⚠️</div>
12171<div class="lesson-text"><strong>WSL2 não expõe a RX 580 via Vulkan</strong> — usar sempre PowerShell/Windows nativo para aproveitar a GPU.</div>
12172      </div>
12173      <div class="lesson">
12174        <div class="lesson-icon">⚠️</div>
12175        <div class="lesson-text"><strong>Whisper não lê MP4 no Windows</strong> — sempre extrair o áudio com FFmpeg antes. Usar -ar 16000 -ac 1 -c:a pcm_s16le.</div>
12176      </div>
12177      <div class="lesson">
12178        <div class="lesson-icon">ℹ️</div>
12179        <div class="lesson-text"><strong>--translate só gera inglês</strong> — é limitação do Whisper, não da configuração. Para PT como destino, precisa de etapa extra.</div>
12180      </div>
12181      <div class="lesson">
12182        <div class="lesson-icon">ℹ️</div>
12183        <div class="lesson-text"><strong>vcvars64.bat precisa ser reativado</strong> a cada nova sessão do PowerShell antes de qualquer compilação.</div>
12184      </div>
12185      <div class="lesson">
12186        <div class="lesson-icon">✅</div>
12187        <div class="lesson-text"><strong>8 GB de VRAM em 2026 ainda é sólido</strong> — large-v3-turbo usa apenas 2.6 GB. GPU "velha" com VRAM decente bate GPU nova com 4 GB fácil.</div>
12188      </div>
12189      <div class="lesson">
12190        <div class="lesson-icon">✅</div>
12191        <div class="lesson-text"><strong>Warnings C4267/C4244 durante compilação são normais</strong> — conversões de tipo esperadas no código do ggml, não impactam funcionamento.</div>
12192      </div>
12193    </div>
12194  </div>
12195
12196  <div class="footer">
12197    RX 580 — velha de 580 anos, mas ainda na ativa 🚀 · Peripécias documentadas em junho/2026
12198  </div>
12199
12200</div>`},benchmarks:{id:"benchmarks",title:"23. BENCHMARKS REAIS DO LABORATÓRIO",desc:"Données de télémétrie consolidées mesurées directement dans les logs d'inférence des deux architectures.",meta:{version:"1.0.0",type:"benchmark",category:"hardware",subcategory:"benchmarks",difficulty:"beginner",estimated_time_min:15,tags:["telemetria","gpu-benchmarks","performance-history"],last_reviewed:"2026-07-01",relationships:{prerequisites:["guia"],previous:"guia",next:"cpu",related:["hardware","cpu"]}},html:`<div class="tbl"><table><thead><tr><th>
12200Mode d'Exécution du Modèle</th><th>Architecture Allouée</th><th>Métrique Commerciale Obtenue</th><th>Statut de Viabilité</th></tr></thead><tbody><tr><td>Inférence Texte Courante</td><td>CPU Xeon Pur (Sans Accélération)</td><td>3 à 5 tokens par seconde</td><td>❌ Inefficace / Réponses Lentes</td></tr><tr class="hig"><td>Inférence Texte Compilée</td><td>RX 580 8GB via Vulkan Backend</td><td>15 à 16 tokens par seconde</td><td>✅ Hautement Productif / Instantané</td></tr><tr><td>Échantillonnage SD 1.5 (20 Steps)</td><td>ComfyUI Windows via DirectML</td><td>~450 secondes par image</td><td>❌ Instable / Écarté suite à Erreur Critique</td></tr><tr class="hig"><td>Échantillonnage SD 1.5 (20 Steps)</td><td>stable-diffusion.cpp via Vulkan</td><td>72 secondes par image</td><td>✅ Optimisé / Réponse Rapide</td></tr></tbody></table></div>`},codacus:{id:"codacus",title:"33. MÉTODO CODACUS vs AIVisionsLab",desc:"Expérience des 5 flags qui ont sauvé une GTX 1060 — fonctionnent-elles sur une RX 580 ?",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:25,tags:["gtx-1060","metodo-codacus","nvidia-pascal"],last_reviewed:"2026-07-01",relationships:{prerequisites:["dadhacks"],previous:"dadhacks",next:"proximos",related:["dadhacks","amihart"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">La chaîne Codacus a publié une vidéo à grand retentissement démontrant comment faire tourner un modèle de <strong>35B paramètres sur une GTX 1060 de 6GB</strong> en utilisant 5 flags spécifiques de <code>llama.cpp</code>, passant de 3.0 tokens/s en baseline à 17.0 tokens/s après optimisations. AIVisionsLab a testé cette hypothèse sur l'ancienne <strong>RX 580 2048SP 8GB avec Vulkan</strong> — comparant Windows et Linux natif.</p><div class="tbl"><table><thead><tr><th>Métrique / Configuration</th><th>Setup Codacus (Réf)</th><th>Setup AIVisionsLab</th></tr></thead><tbody><tr><td><strong>GPU</strong></td><td>Nvidia GTX 1060 6GB</td><td>AMD Radeon RX 580 2048SP 8GB</td></tr><tr><td><strong>Backend</strong></td><td>CUDA</td><td>Vulkan (Mesa RADV)</td></tr><tr><td><strong>OS</strong></td><td>Linux + Docker</td><td>Windows 10 / Ubuntu 26.04</td></tr><tr><td><strong>CPU</strong></td><td>Intel Core i3-8100</td><td>Intel Xeon E5-2690 v3 (12c/24t)</td></tr><tr><td><strong>Modèle de Test</strong></td><td>Qwen3.6 35B-A3B Q4_K_M</td><td>Qwen3.6 35B-A3B Q4_K_M (Même modèle)</td></tr></tbody></table></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Impact des 5 Flags sur Vulkan AMD</h3><div class="tbl"><table><thead><tr><th>Flag Appliquée</th><th>Impact sur GTX 1060 (CUDA)</th><th>Impact sur RX 580 (Vulkan Windows)</th><th>Impact sur RX 580 (Vulkan Linux Natif)</th></tr></thead><tbody><tr><td><strong>Baseline</strong></td><td>3.0 tokens/s (-ngl 20)</td><td><strong>7.62 tokens/s (-ngl 10)</strong></td><td><strong>5.18 tokens/s (-ngl 20)</strong></td></tr><tr><td><code>--override-tensor exps=CPU</code></td><td>10.0 tokens/s (+233%)</td><td>6.92 tokens/s (❌ -9%)</td><td>4.62 tokens/s (❌ -11%)</td></tr><tr><td><code>--no-mmap</code> (ou <code>-mmp 0</code>)</td><td>13.5 tokens/s (+35%)</td><td>7.44 tokens/s (❌ -2%)</td><td>4.86 tokens/s (❌ -6%)</td></tr><tr><td>Quantization KV cache (<code>-ctk/ctv</code>)</td><td>17.0 tokens/s (+26%)</td><td>7.58 tokens/s (❌ -1%)</td><td><strong>5.41 tokens/s (✅ +4%)</strong></td></tr><tr><td><code>--mlock</code> / ngl supplémentaire</td><td>Stabilité élargie</td><td>OOM au-dessus de ngl 10 (❌)</td><td>OOM au-dessus de ngl 20 (❌)</td></tr></tbody></table></div><div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4"><h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Analyse des Découvertes Techniques</h4><p style="font-size:0.8rem;color:#94a3b8;line-height:1.7"><strong>1. Modèle d'Allocation VRAM :</strong> Pourquoi ngl 20 donnait-il un OOM sur Windows mais passait sur Linux ? Le pilote propriétaire d'AMD sur Windows alloue la mémoire de manière plus conservatrice, tandis que le pilote open-source <strong>Mesa RADV sur Linux</strong> permet à plus de couches d'être déchargées dans le buffer (plafond maximum réel de 20 couches contre 10 couches sur Windows).</p><p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem"><strong>2. Incompatibilité de Backend :</strong> Le routage <code>override-tensor exps=CPU</code> pour isoler les experts Mixtral/MoE du GPU fonctionne de manière spectaculaire sur CUDA en raison de l'accès PCIe natif à haute vitesse de Nvidia. Sous le backend Vulkan, la surcharge de ce mouvement détruit les gains de traitement.</p><p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem"><strong>3. Le Xeon Supérieur a Compensé le Backend :</strong>
12200 Même avec une optimisation VRAM moindre, l'infrastructure CPU Xeon E5-2690 v3 (24 threads) d'AIVisionsLab a garanti une baseline originale supérieure de 7.62 tokens/s — battant la baseline de 3.0 tokens/s du i3-8100 de Codacus.</p></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Comparatif Mistral 7B — CPU Pur vs Vulkan</h3><p style="font-size:.88rem;color:#94a3b8;line-height:1.9">Pour démontrer la valeur brute et absolue du backend Vulkan sur le matériel Polaris hérité :</p><div class="code ok"><pre>💻 WSL2 Ubuntu (CPU Pur)  ·  24 threads  ·  1.79 tokens/s
12201🎮 Windows 10 (GPU Vulkan)  ·  12 threads  ·  18.54 tokens/s (⚡ 10x Plus Rapide !)</pre></div><blockquote style="font-size:.82rem;color:#64748b;font-style:italic;line-height:1.8;border-left:3px solid #E11D48;padding-left:.9rem;margin-top:1rem">"Les 5 flags de Codacus fonctionnent parfaitement pour les marques NVIDIA + CUDA + Linux Docker. Dans l'écosystème AMD + Vulkan, notre propre recette est différente mais incroyablement solide !"</blockquote>`},"comfyui-directml-func":{id:"comfyui-directml-func",title:"17. FIXES DIRECTML",desc:"Installation de la roue de développement spécifique pour forcer la stabilité opérationnelle.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-batch-fix","memoria-virtual","crash-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml"],previous:"comfyui-directml",next:"comfyui-flux",related:["comfyui-directml","scripts"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">S'il est nécessaire d'exécuter des tests comparatifs sur la couche DirectML sans crash d'initialisation, il faut procéder à un downgrade forcé des paquets en utilisant le build de développement de mai 2024 :</p><div class="code"><pre># Commande pour purger les dépendances conflictuelles et installer la dev wheel stable
12202pip uninstall torch torch-directml torchaudio
12203pip install torch==2.3.1+cpu --index-url https://download.pytorch.org/whl/cpu
12204pip install torch-directml==0.2.1.dev240521 --no-deps</pre></div>`},"comfyui-directml":{id:"comfyui-directml",title:"16. DIRECTML",desc:"Explication technique détaillée des échecs chroniques rencontrés lors des tests sur la branche Windows.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fix","windows-driver","comfyui-windows"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-wsl"],previous:"comfyui-wsl",next:"comfyui-directml-func",related:["troubleshoot-comfyui","comfyui-portable-amd"]}},html:`<div class="err"><div class="err-t">Défaillance Structurelle — Incompatibilité du Module CLIPTextEncode</div><p>Lors du chargement des flux de base de génération d'images en utilisant l'installeur natif DirectML pour les cartes AMD, la console abandonne l'exécution et renvoie l'exception bloquante suivante :</p><div class="code"><span class="code-lang">stderr</span><pre>File "comfy\\utils.py", line 245, in encode_token
12205NotImplementedError: Cannot access storage of OpaqueTensorImpl</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Analyse d'Ingénierie :</strong> Le pilote DirectML encapsule les données mémoire dans des objets connus sous le nom de <code>OpaqueTensorImpl</code>. Lorsque les fonctions internes d'optimisation d'attention mathématique de ComfyUI tentent de lire le contenu brut de ces tenseurs dans la mémoire physique, la couche de l'écosystème Microsoft bloque l'accès, interrompant le pipeline de rendu.</p></div>`},"comfyui-flux":{id:"comfyui-flux",title:"18. PARAMETRIZAÇÃO CRÍTICA DO FLUX.1 SCHNELL",desc:"Configuration mathématique obligatoire pour traiter le modèle SOTA sur CPU sans dépasser les limites de RAM.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:20,tags:["flux-fp8","comfyui-workflow","vram-allocation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml-func"],previous:"comfyui-directml-func",next:"comfyui-modelos",related:["flux_server","comfyui-modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Le traitement du FLUX.1 Schnell de 16GB en mode CPU exige des limites d'échantillonnage fixes. Les écarts par rapport à ces règles provoquent le gel de la machine par saturation extrême de mémoire :</p><div class="tbl"><table><thead><tr><th>
12205Paramètre d'Échantillonnage</th><th>Valeur d'Ajustement Obligatoire</th><th>Explication Technique sur Xeon</th></tr></thead><tbody><tr class="hig"><td>Sampling Steps</td><td>4 Steps</td><td>Le modèle Schnell a été conçu pour fermer la convergence du bruit en seulement 4 interactions.</td></tr><tr class="hig"><td>CFG Scale</td><td>1.0</td><td>Les valeurs supérieures à 1.0 détruisent la fidélité des textures et distordent la distribution des tenseurs.</td></tr><tr><td>Scheduler Type</td><td>sgm_uniform</td><td>Garantit l'interpolation linéaire des tenseurs de diffusion de manière optimisée pour les instructions AVX2.</td></tr></tbody></table></div>`},"comfyui-modelos":{id:"comfyui-modelos",title:"14. GESTÃO ZERO-COPY DE MODELOS NO NVMe",desc:"Technique de liens symboliques pour unifier le stockage des checkpoints lourds sans dupliquer les fichiers.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"armazenamento",difficulty:"intermediate",estimated_time_min:15,tags:["symlink","diretorios-compartilhados","espaco-disco"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-flux"],previous:"comfyui-flux",next:"animatediff-video",related:["arquivos","modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Pour éviter le gaspillage d'espace sur le lecteur SSD NVMe et éliminer le besoin de conserver des copies géantes identiques entre Windows et Linux (WSL2), un lien symbolique direct est créé pointant vers le système de fichiers croisé :</p><div class="code"><span class="code-lang">bash</span><pre># Exécuter ce bloc dans le terminal du sous-système Linux Ubuntu
12206cd ~/ComfyUI/models/checkpoints/
12207
12208# Créer le point d'ancrage virtuel reflétant le fichier physique situé sur la partition E: de Windows
12209ln -s "/mnt/e/ComfyUI_Models/checkpoints/flux1-schnell-fp8.safetensors" ./flux1-schnell-fp8.safetensors</pre></div>`},"comfyui-portable-amd":{id:"comfyui-portable-amd",title:"29. COMFYUI PORTÁTIL v0.3.48 — IMPLEMENTAÇÃO AMD",desc:"Paramètres spécifiques et injection de variables d'environnement pour l'architecture Polaris.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-portable","directml-setup","portable-workflow"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshoot-comfyui"],previous:"troubleshoot-comfyui",next:"comunidade",related:["comfyui-directml","comfyui-flux"]}},html:`<div class="card"><p style="font-size:.88rem;color:#94a3b8;line-height:1.9">Pour les implémentations utilisant des paquets portables précompilés de ComfyUI axés sur la compatibilité AMD DirectML sur Windows, l'interpréteur Python a besoin d'aide pour identifier correctement les capacités matérielles du vieux GPU :</p><div class="code"><span class="code-lang">batch</span><pre># Insérer en haut du fichier run_nvidia_gpu.bat ou script portable custom :
12210set HSA_OVERRIDE_GFX_VERSION=8.0.3
12211set DXVK_ASYNC=1
12212
12213.\\python_embeded\\python.exe main.py --directml</pre></div><p style="margin-top:.5rem;font-size:.82rem;color:#64748b;line-height:1.6">Le flag <code>8.0.3</code> émule l'ID d'architecture de build requis pour que les bibliothèques numériques traitent les tenseurs sans bloquer le bus PCIe de la série RX 500.</p></div>`},"comfyui-wsl":{id:"comfyui-wsl",title:"15. COMFYUI WSL2",desc:"Configuration de l'environnement Linux virtualisé pour hériter la puissance de calcul du Xeon et de la RAM ECC.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"virtualizacao",difficulty:"advanced",estimated_time_min:30,tags:["wsl2-linux","comfyui-wsl","direct-vulkan"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_openwebui_integration"],previous:"sd_openwebui_integration",next:"comfyui-directml",related:["comfyui-flux","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Pour contourner la limite physique de VRAM du GPU pour les modèles massifs, ComfyUI est instancié dans le sous-système Linux en pointant l'exécution strictement vers les cœurs du processeur :</p><div class="code"><span class="code-lang">bash</span>
12213<pre># Activer l'environnement virtuel isolé via Miniconda dans le terminal Ubuntu
12214conda activate comfy_env
12215
12216# Appeler le script principal en forçant l'utilisation du matériel de traitement central
12217python main.py --cpu --listen 0.0.0.0 --port 8188</pre></div><div class="note info" style="margin-top:.75rem">Le panneau de nœuds de ComfyUI sera entièrement disponible du côté Windows via la route mappée : <strong>http://localhost:8188</strong></div>`},comunidade:{id:"comunidade",title:"30. CONTEXTO E FONTES DA COMUNIDADE",desc:"Dépôts de connaissance hacker et forums dédiés à la préservation et l'optimisation du matériel hérité.",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"comunidade",difficulty:"beginner",estimated_time_min:10,tags:["comunidade-hacker","links-utiles","github-preservation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-portable-amd"],previous:"comfyui-portable-amd",next:"amihart",related:["amihart","dadhacks","codacus"]}},html:`<div class="card acc"><p style="font-size:.85rem;color:#94a3b8;line-height:1.9">L'ingénierie inverse et la viabilité technique de ce laboratoire sont basées sur des discussions d'optimisation documentées par des communautés concentrées sur l'extraction de la performance maximale de composants à bas coût :</p><ul style="padding-left:1.2rem;margin-top:.5rem;font-size:.85rem;color:#e2e8f0;line-height:2"><li>Communauté Mondiale d'Ingénierie de Serveurs Hérités : <strong style="color:var(--r)">r/X99_Lab</strong></li><li>Discussions d'Optimisation et Rimes de Compilation GGUF : <strong style="color:#fff">Github: ggerganov/llama.cpp/discussions</strong></li></ul></div>`},contexto:{id:"contexto",title:"01. CONTEXTO E PROBLEMA",desc:"Pourquoi l'une des cartes les plus vendues de l'histoire était laissée pour compte dans l'ère de l'IA.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:10,tags:["obsolescencia-programada","hardware-livre","preservacao-silicio"],last_reviewed:"2026-07-01",relationships:{prerequisites:[],previous:"",next:"hardware",related:["solucao","jornada"]}},html:"<p>La RX 580 (et sa sœur jumelle, la RX 580 2048SP) a été un succès commercial absolu. Des milliers de personnes l'ont à la maison. Mais quand la fièvre de l'IA a commencé, AMD s'est concentré uniquement sur les nouvelles cartes (RDNA3) et Linux. Sur Windows, la seule option était DirectML, qui est si lent qu'il rendait l'IA impraticable. La communauté s'est alors unie pour créer une solution à toute épreuve contre l'abandon.</p>"},cpu:{id:"cpu",title:"24. PARAMETRIZAÇÃO E AJUSTES DO XEON",desc:"Configurations BIOS et limites structurelles des instructions fp32 pour le processeur LGA 2011-3.",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"processadores",difficulty:"intermediate",estimated_time_min:18,tags:["bios-tuning","avx-optimization","intel-xeon-tuning"],last_reviewed:"2026-07-01",relationships:{prerequisites:["benchmarks"],previous:"benchmarks",next:"troubleshooting",related:["hardware","benchmarks"]}},html:`<div class="card acc"><p style="font-size:.88rem;color:#e2e8f0;font-weight:600;line-height:1.6">Directives Techniques pour les Processeurs Xeon de Microarchitecture Haswell (v3) :</p><p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">Le processeur Intel Xeon E5-2690 v3 sorti en 2014 possède le support natif du jeu d'instructions vectorielles <strong style="color:#fff">AVX2</strong>. Cependant, il manque de matériel dédié pour les calculs mathématiques de précision réduite en <strong style="color:var(--r)">FP16 (Demi-Précision)</strong>.</p><p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">Lors de l'instanciation des chargeurs de modèles dans ComfyUI sur Linux, assurez-vous de régler la précision de calcul sur <strong style="color:#22c55e">FP32 (Simple-Précision)</strong>. Si vous forcez l'exécution en FP16, le processeur devra émuler les instructions via logiciel, réduisant de moitié la vitesse de traitement.</p></div>`},dadhacks:{id:"dadhacks",title:"32. MÉTODO DADHACKS — AI IMAGE GENERATION ON RX 580 USING VULKAN: A COST-EFFECTIVE SOLUTION",desc:"Analyse de la consolidation expérimentale réalisée par DH (DadHacks) en décembre 2025, établissant des chemins de compatibilité pour la génération d'images sur GPU hérité.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"intermediate",estimated_time_min:20,tags:["dadhacks-method","estetica-baixo-custo","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["amihart"],previous:"amihart",next:"codacus",related:["amihart","codacus"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Le 05 décembre 2025, le développeur <strong style="color:#fff">DH (DadHacks)</strong> a publié un guide technique innovant sur le site <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline">dadhacks.org</a> démontrant que le GPU AMD RX 580 de 8GB est parfaitement viable pour la génération d'IA moderne sans dépendre de solutions logicielles propriétaires ou de ROCm.</p><div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);margin-bottom:1.25rem"><strong style="color:#fff;display:block;margin-bottom:.4rem">
12217📌 Résultats de la Validation Technique :</strong><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">L'étude de DadHacks a démontré de façon expérimentale qu'il est viable d'exécuter Stable Diffusion via Vulkan, affinant la conclusion préliminaire de janvier 2025. La maturité graduelle de l'écosystème <code>stable-diffusion.cpp</code> a amplifié les taux de transfert jusqu'à la fin de 2025.</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. Compilation du Moteur — stable-diffusion.cpp</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">DH a détaillé le flux de compilation sur Linux en utilisant le flag de compilation natif <code>-DSD_VULKAN=ON</code> :</p><div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># Cloner de manière récursive (obligatoire pour apporter les sous-modules de ggml)
12218git clone --recursive https://github.com/leejet/stable-diffusion.cpp
12219cd stable-diffusion.cpp && mkdir build && cd build
12220
12221# Configurer CMake en utilisant Vulkan activé
12222cmake .. -DSD_VULKAN=ON
12223
12224# Compiler les binaires
12225cmake --build . --config Release</pre></div><p style="font-size:.82rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">🧬 <strong>Divergence des Flags Documentée :</strong> DadHacks a utilisé <code>-DSD_VULKAN=ON</code> (couche d'application), tandis qu'AIVisionsLab a homologué <code>-DGGML_VULKAN=ON</code> (couche du moteur de tenseurs). Les deux génèrent le même binaire efficace en pratique, mais référencent des chemins différents de l'évolution du dépôt leejet.</p><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. Commandes de Génération Originales (DadHacks)</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Démonstration originale d'un appel hors ligne via terminal pour Flux Schnell (modèle quantifié en 4-bits) et Flux Dev, utilisant la segmentation de mémoire pour économiser la VRAM :</p><div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># Exécuter Flux Schnell (4 étapes d'échantillonnage)
12226sd --diffusion-model SD-Models/flux1-schnell-q4_0.gguf \\
12227   --vae SD-Models/ae.safetensors \\
12228   --clip_l SD-Models/clip_l.safetensors \\
12229   --t5xxl SD-Models/t5xxl_fp16.safetensors \\
12230   -p "a lovely beagle holding a sign says 'hello'" \\
12231   --cfg-scale 1.0 \\
12232   --sampling-method euler \\
12233   -v --steps 4 \\
12234   --clip-on-cpu</pre></div><div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin-bottom:1.25rem"><strong style="color:#ef4444;display:block;margin-bottom:.4rem">🚨 ALERTE CRITIQUE : Incompatibilité GGUF (Découverte AIVisionsLab)</strong><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">DadHacks n'a pas listé une incompatibilité de format très courante : les poids GGUF publiés par le mainteneur <strong>city96</strong> sont compatibles <em>uniquement</em> avec ComfyUI. Pour l'exécution dans stable-diffusion.cpp / sd-server, il est obligatoire d'utiliser les modèles publiés officiellement par le mainteneur <strong>leejet</strong> (ex: <code style="color:#fff">FLUX.1-schnell-gguf</code>).</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">C. Ce Que DadHacks N'a Pas Couvert (Qu'AIVisionsLab a Étendu)</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">Le guide original de DadHacks s'est concentré sur l'écosystème Linux/terminal avec des commandes manuelles. AIVisionsLab a étendu agressivement cette base technique :</p><table style="width:100%;border-collapse:collapse;font-size:.78rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem;border:1px solid var(--b)"><thead><tr style="background:rgba(255,255,255,0.02);color:#fff;border-bottom:1px solid var(--b)"><th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">Fonctionnalité</th><th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">DadHacks (Linux)</th><th style="padding:.5rem;text-align:left">AIVisionsLab (Windows Natif)</th></tr></thead><tbody><tr style="border-bottom:1px solid var(--b)"><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Hébergement Windows</td><td style="padding:.5rem;border-right:1px solid var(--b)">❌ Non abordé</td><td style="padding:.5rem;color:#22c55e">✅ Mapping via MSVC / exécutables Cmd</td></tr><tr style="border-bottom:1px solid var(--b)"><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Intégration Graphique</td><td style="padding:.5rem;border-right:1px solid var(--b)">❌ Terminal CLI uniquement</td><td style="padding:.5rem;color:#22c55e">✅ Serveur API + OpenWebUI / lien Docker</td></tr><tr style="border-bottom:1px solid var(--b)"><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Automatisation .bat</td><td style="padding:.5rem;border-right:1px solid var(--b)">❌ Scripts shell manuels</td><td style="padding:.5rem;color:#22c55e">✅ Scripts automatiques double-clic sur le Bureau</td></tr><tr><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Sécurité VRAM</td><td style="padding:.5rem;border-right:1px solid var(--b)">⚠️ Limité à la base CLI</td><td style="padding:.5rem;color:#22c55e">✅ Optimisations avec VAE Tiling contre les bugs OOM</td></tr></tbody></table><div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem"><strong style="color:var(--r)">Crédit Communautaire Extensif :</strong> Section documentaire basée sur la publication originale de <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">DH (DadHacks)</a>, intitulée <em>"AI Image Generation on RX 580 Using Vulkan"</em>. La connaissance est libre et évolutive.</div>`},falhas:{id:"falhas",title:"03. O QUE NÃO FUNCIONOU (O CEMITÉRIO TÉCNICO)",desc:"Analyse détaillée des erreurs : les raisons techniques du rejet de DirectML natif, OpenVINO et ROCm.",meta:{version:"1.0.0",type:"estudo_caso",category:"troubleshooting",subcategory:"historico",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fail","rocm-amd","openvino-intel"],last_reviewed:"2026-07-01",relationships:{prerequisites:["hardware"],previous:"hardware",next:"solucao",related:["troubleshooting","comfyui-directml"]}},html:`<div class="err">
12234<div class="err-t">3.1 DirectML + ComfyUI Windows Natif — ABANDONNÉ</div><p><strong style="color:#e2e8f0">Tentatives :</strong> Invocation via <code>torch-directml</code> et flag <code>--directml</code>. L'écosystème a été détecté comme <code>privateuseone0</code>, mais a révélé une instabilité chronique en raison du manque de mises à jour structurelles de Microsoft.</p><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Logs d'Erreur Critiques :</strong></p><div class="code"><span class="code-lang">stderr</span><pre>WARNING: torch-directml barely works, is very slow, has not been updated in over 1 year and might be removed soon, please don't use it.
12235
12236OSError: [WinError 127] La procédure spécifiée est introuvable
12237# Causé par un mismatch de DLL entre torchaudio et le build CPU de torch 2.4.1
12238
12239NotImplementedError: Cannot access storage of OpaqueTensorImpl
12240# CLIPTextEncode plante en essayant de manipuler des tenseurs opaques générés par DirectML</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Cause Racine :</strong> DirectML génère des tenseurs opaques incapables de communiquer avec les backends d'attention modernes de ComfyUI. De plus, l'installeur force l'importation de <code>torchaudio</code> dans le module <code>audio_vae.py</code>, cassant l'initialisation même si vous n'utilisez pas l'audio.</p></div><div class="err" style="margin-top:1rem"><div class="err-t">3.2 OpenVINO + Stable Diffusion Forge</div><p><strong style="color:#e2e8f0">Tentative :</strong> Couplage de l'extension <code>sd-webui-openvino</code> développée par Intel dans l'écosystème Forge.</p><div class="code"><span class="code-lang">stderr</span><pre>ModuleNotFoundError: No module named 'ldm'
12241ModuleNotFoundError: No module named 'sgm'
12242Error build_unet: Invalid backend: 'openvino'</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Cause Racine :</strong> L'extension a été conçue pour l'ancienne architecture d'Automatic1111. Comme Forge a complètement restructuré le code et remplacé les modules natifs <code>ldm</code> et <code>sgm</code>, l'injection du backend OpenVINO échoue complètement.</p></div><div class="err" style="margin-top:1rem"><div class="err-t">3.3 ROCm — Non Viable par Conception sur Polaris</div><ul><li>AMD a officiellement mis fin au support de l'architecture GCN4 (Polaris/RX 580) dans les branches modernes de ROCm (v5.x+).</li><li>Inexistence de support officiel pour ROCm natif sur Windows.</li><li>Les couches de compatibilité via WSL2 pour les anciennes cartes génèrent constamment des Kernel Panics lors des inférences à forte charge.</li></ul></div><div class="err" style="margin-top:1rem"><div class="err-t">3.4 WebUI Forge sur CPU Pur (HDD)</div><p><strong style="color:#e2e8f0">Métriques :</strong> Temps de démarrage de 85 secondes. Temps de rendu insoutenable de ~19 minutes par image simple (512x512, 20 steps). Le goulot d'étranglement du HDD en concurrence avec la gestion de pagination de <code>memory_management.py</code> a rendu le setup impraticable.</p></div>`},"flux-vulkan":{id:"flux-vulkan",title:"25. EXPLORAÇÃO COMPLEMENTAR: FLUX VIA VULKAN",desc:"Accélération alternative des modèles Flux utilisant des quantizations ultra-compactes en C++.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["flux-vulkan","cpp-native-inference","amd-acceleration"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshooting"],previous:"troubleshooting",next:"troubleshoot-comfyui",related:["flux_server","sdxl_vulkan"]}},html:`<div class="card"><p style="font-size:.88rem;color:#94a3b8;line-height:1.9">Bien que le checkpoint natif de FLUX.1 de 16GB exige le traitement robuste du CPU Xeon, il est tout à fait viable d'effectuer des inférences directement sur le GPU RX 580 en utilisant le binaire de <code>stable-diffusion.cpp</code> couplé avec des quantizations agressives de 3-bits :</p><div class="note info" style="margin-top:.5rem">Poids Recommandé pour Tests VRAM : <strong>flux1-schnell-Q3_K_S.gguf (~5.2GB)</strong>. Cette variation s'insère confortablement dans la limite physique de 8GB de la carte Polaris, livrant des générations SOTA accélérées par matériel.</div></div>`},flux_server:{id:"flux_server",title:"11. RODAR FLUX NO SD-SERVER (GPU + CPU HÍBRIDO)",desc:"Mapping et initialisation de l'écosystème Flux de 12B paramètres avec architecture mémoire segmentée.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"advanced",estimated_time_min:30,tags:["flux-schnell","servidor-imagem","gerenciamento-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdserver"],previous:"sdserver",next:"sd_bat_automation",related:["comfyui-flux","flux-vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Flux exige une segmentation précise entre VRAM et RAM hôte. En utilisant les flags <code>--vae-on-cpu</code> et <code>--vae-tiling</code>, nous évitons les erreurs de mémoire (OOM) sur la RX 580 2048SP. Le T5XXL (fp16) et le VAE résident en RAM ; le modèle de diffusion occupe la VRAM.</p><div class="tbl"><table><thead><tr><th>
12242Composant</th><th>Fichier Homologué</th><th>Allocation Finale</th><th>Taille</th></tr></thead><tbody><tr><td>Modèle de Diffusion</td><td><code>flux1-schnell-q4_k.gguf</code></td><td><strong>GPU (VRAM)</strong></td><td>~6.5 GB</td></tr><tr><td>VAE</td><td><code>ae.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~160 MB</td></tr><tr><td>CLIP L</td><td><code>clip_l.safetensors</code></td><td><strong>GPU (VRAM)</strong></td><td>~235 MB</td></tr><tr><td>T5XXL</td><td><code>t5xxl_fp16.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~9.3 GB</td></tr></tbody></table></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-top:1.25rem">⚠️ <strong style="color:#fff">Notes de Stabilité :</strong> Le retrait du flag <code>--timeout</code> (non supporté par la version actuelle) et l'ajout de <code>--vae-tiling</code> ont éliminé les erreurs <em>DeviceMemoryAllocation</em>. L'utilisation totale de la RAM atteint ~9.5 GB (T5XXL fp16). Pour économiser de la RAM, remplacer par <code>t5xxl_fp8</code> réduit à ~5 GB.</p><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Commande de Production (iniciar.bat) :</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
12243  --diffusion-model "E:\\ia_storage\\models\\Stable-diffusion\\flux1-schnell-q4_k.gguf" ^
12244  --vae "E:\\ia_storage\\models\\Stable-diffusion\\ae.safetensors" ^
12245  --clip_l "E:\\ia_storage\\models\\Stable-diffusion\\clip_l.safetensors" ^
12246  --t5xxl "E:\\ia_storage\\models\\Stable-diffusion\\t5xxl_fp16.safetensors" ^
12247  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre><div class="tbl" style="margin-top:1.25rem; margin-bottom:1.25rem"><table><thead><tr><th>Étape</th><th>Temps Réel</th></tr></thead><tbody><tr><td>Conditionnement (T5XXL)</td><td>11.49s</td></tr><tr><td>Sampling — 4 steps @ 1024x1024</td><td>~838s (~14 min)</td></tr><tr><td>VAE Decode — 9 tiles</td><td>40.45s</td></tr><tr><td><strong>Total par image</strong></td><td><strong>~838s (~14 min)</strong></td></tr></tbody></table></div><div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;"><span style="color:#22c55e; font-weight:bold">✅ STATUT : SERVEUR EN PRODUCTION — IMAGE GÉNÉRÉE AVEC SUCCÈS</span><br><span style="font-size:.8rem; color:#94a3b8">Listening on http://0.0.0.0:7860 | VRAM: 7.6/8.0 GB | RAM: ~9.5 GB | GPU: RX 580 2048SP | Temp: 66°C</span></div>`},guia:{id:"guia",title:"22. GUIA ESTRATÉGICO POR CASO DE USO",desc:"Matrice de décision : quand diriger le traitement vers le GPU ou vers le Xeon.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:12,tags:["decision-making","workflows","hardware-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["scripts"],previous:"scripts",next:"benchmarks",related:["contexto","benchmarks"]}},html:`<div class="tbl"><table><thead><tr><th>Objectif du Workflow</th><th>Modèle Recommandé</th><th>Backend Alloué</th><th>Métrique Réelle de Génération</th></tr></thead><tbody><tr class="hig"><td>Chat Texte et Assistance Locale</td><td>Mistral 7B / Llama 3 8B GGUF</td><td>GPU RX 580 (Vulkan)</td><td>Haute Performance (15-16 tokens/s) ⚡</td></tr><tr class="hig"><td>Génération Rapide d'Images (512x512)</td><td>DreamShaper 8 (SD 1.5 GGUF)</td><td>GPU RX 580 (Vulkan)</td><td>Rendu Fluide (~72 secondes)</td></tr><tr><td>Création Haute Résolution et Détail SOTA</td><td>FLUX.1 Schnell (16GB Weights)</td><td>CPU Xeon (WSL2)</td><td>Traitement Lourd (~24 minutes)</td></tr><tr><td>Interpolation d'Images et Animation Vidéo</td><td>AnimateDiff Pipeline Standard</td><td>CPU Xeon (WSL2)</td><td>Traitement Stable (~141 secondes)</td></tr></tbody></table></div>`},hardware:{id:"hardware",title:"02. HARDWARE DO LABORATÓRIO",desc:"Les spécifications de notre 'Frankenstein' à bas coût qui sert de base à ce tutoriel.",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"especificacoes",difficulty:"beginner",estimated_time_min:12,tags:["amd-polar","rx-580","intel-xeon","ram-ecc"],last_reviewed:"2026-07-01",relationships:{prerequisites:["contexto"],previous:"contexto",next:"falhas",related:["cpu","benchmarks"]}},html:`<div class="card acc">
12248  <div class="stat">
12249    <span class="stat-icon">🎮</span>
12250    <span class="stat-lbl">GPU</span>
12251    <span class="stat-val">RX 580 2048SP</span>
12252    <small>8GB VRAM (Vulkan)</small>
12253  </div>
12254  <div class="stat">
12255    <span class="stat-icon">🧠</span>
12256    <span class="stat-lbl">CPU</span>
12257    <span class="stat-val">Intel Xeon</span>
12258    <small>Rebut de serveur bon marché</small>
12259  </div>
12260  <div class="stat">
12261    <span class="stat-icon">💾</span>
12262    <span class="stat-lbl">RAM</span>
12263    <span class="stat-val">32GB DDR4</span>
12264    <small>Vital pour FLUX sur CPU</small>
12265  </div>
12266</div>
12267<p>8 Go de VRAM est le 'sweet spot'. C'est suffisant pour faire tourner des LLM 7B et des modèles d'images standards. Les 32 Go de RAM sont notre ceinture de sécurité pour les modèles géants.</p>`},jornada:{id:"jornada",title:"06. JORNADA COMPLETA — AS 5 FASES",desc:"La chronologie du laboratoire : de la lenteur initiale du CPU au contrôle total du matériel hérité.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:10,tags:["linha-tempo","conquistas","roadmap"],last_reviewed:"2026-07-01",relationships:{prerequisites:["prereqs"],previous:"prereqs",next:"llama",related:["linhatempo","proximos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.75rem">Le succès technique de l'écosystème local a été atteint à travers 5 jalons évolutifs et des décisions stratég
12267iques matérielles :</p><div class="phase"><div class="phase-num">01</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">WebUI Forge sur CPU Pur (HDD)</span><span class="lbl lbl-b">BASELINE INITIAL</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Première infrastructure fonctionnelle. Démarrage lent de 85 secondes et des marques de rendu atteignant ~19 minutes par image. Système complètement inviable pour un usage productif.</p></div></div><div class="phase"><div class="phase-num">02</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">Accélération LLM via Vulkan (RX 580)</span><span class="lbl lbl-r">BREAKTHROUGH TECHNIQUE</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Compilation réussie de llama.cpp activant le flag <code>-DGGML_VULKAN=ON</code>. Le moteur a commencé à identifier la carte graphique Polaris nativement, faisant passer le taux d'inférence de 3-5 t/s à 15-16 t/s.</p></div></div><div class="phase"><div class="phase-num">03</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">Migration du Stockage Centralisé vers NVMe</span><span class="lbl lbl-y">JALON DÉCISIF</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Remplacement du HDD mécanique par un lecteur NVMe haute vitesse (1.7–3.5 GB/s). Le temps de chargement en mémoire du modèle de langage est passé de 25 minutes à seulement 4 minutes, éliminant le principal goulot d'étranglement d'I/O du laboratoire.</p></div></div><div class="phase"><div class="phase-num">04</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">stable-diffusion.cpp natif via Vulkan</span><span class="lbl lbl-g">OBJECTIF GPU ATTEINT ✅</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Première image rendue localement en utilisant 100% du GPU RX 580 sur Windows. Le cycle de génération du modèle de poids quantifiés SD 1.5 GGUF s'est stabilisé à ~72 secondes.</p></div></div><div class="phase"><div class="phase-num">05</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">Mise à l'échelle du FLUX.1 Schnell via Xeon + RAM ECC</span><span class="lbl lbl-b">EXPANSION DE CAPACITÉ ✅</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">Implémentation stable du modèle SOTA de 16GB tournant sur le processeur serveur. Preuve empirique qu'une infrastructure d'entreprise de 2014 peut traiter de manière robuste des intelligences artificielles de pointe de 2026.</p></div></div>`},limit_qwen_35b:{id:"limit_qwen_35b",title:"41. LEVANDO AO LIMITE QWEN3.5 35B Q6_K NA RX 580 8GB VIA VULKAN",desc:"Expérience d'exécution hybride extrême d'un modèle de 34,66B paramètres sur un GPU Polaris et un Xeon de 2014.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:45,tags:["qwen-35b","offloading-extremo","vram-spillover"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_srt_ptbr"],previous:"audio_srt_ptbr",next:"proving_hypothesis_35b",related:["proving_hypothesis_35b","llama"]},part:1},html:`<div class="whisper-doc">
12268  <div class="hero">
12269    <div class="hero-title"><span>Poussez les limites</span> — Qwen3.5 35B sur RX 580</div>
12270    <div class="hero-sub">Expérience d'exécution hybride extrême d'un modèle de <strong>34,66B paramètres</strong> sur un GPU de 8GB de VRAM et un Xeon de 2014 via le moteur Vulkan.</div>
12271    <div class="hero-badges">
12272      <span class="badge badge-gpu">AMD RX 580 8GB</span>
12273      <span class="badge badge-win">Xeon E5-2690 v3</span>
12274      <span class="badge badge-ok">Vulkan Híbrido</span>
12275      <span class="badge badge-ok">34.66B parameters</span>
12276      <span class="badge badge-win">Q6_K Quantization</span>
12277    </div>
12278  </div>
12279
12280  <div class="stat-grid">
12281    <div class="stat">
12282      <div class="stat-label">Vitesse de génération</div>
12283      <div class="stat-value">5.64 tok/s</div>
12284      <div class="stat-sub">Session 2 (Stable)</div>
12285    </div>
12286    <div class="stat">
12287      <div class="stat-label">Prompt Eval</div>
12288      <div class="stat-value">34.13 tok/s</div>
12289      <div class="stat-sub">Temps de réponse ~107s</div>
12290    </div>
12291    <div class="stat">
12292      <div class="stat-label">Température maximale</div>
12293      <div class="stat-value">80°C</div>
12294      <div class="stat-sub">Sans Throttling (Cible : 90°C)</div>
12295    </div>
12296    <div class="stat">
12297      <div class="stat-label">Coût additionnel</div>
12298      <div class="stat-value">0,00 €</div>
12299      <div class="stat-sub">Exécution 100% locale</div>
12300    </div>
12301  </div>
12302
12303  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.0 — Contexte et motivation</h3>
12304  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
12305    Le 15 juin 2026, AIVisionsLab a mené l'expérience la plus extrême de son histoire : faire tourner un modèle de <strong>34,66 milliards de paramètres</strong> en mode hybride sur un GPU AMD Radeon RX 580 2048SP de 2017 avec seulement 8GB de VRAM.
12306  </p>
12307  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
12308    "Si la RX 580 fait déjà tourner Qwen3 4B à 35 tokens/s via Vulkan, jusqu'où peut-on aller ?"
12309  </blockquote>
12310  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
12311    La réponse documentée ci-dessous prouve que la limite n'est pas là où le marché du matériel prétend qu'elle est.
12312  </p>
12313
12314  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.1 — Matériel du laboratoire</h3>
12315  <div class="tbl">
12316    <table>
12317      <thead>
12318        <tr>
12319          <th>Composant</th>
12320          <th>Spécification</th>
12321        </tr>
12322      </thead>
12323      <tbody>
12324        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 cores / 24 threads · 3,05 GHz turbo (Sorti en 2014)</td></tr>
12325        <tr><td><strong>RAM</strong></td><td>
1232531,8 GB DDR4 REG ECC (quad-channel)</td></tr>
12326        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (Sorti en 2017)</td></tr>
12327        <tr><td><strong>Storage 1</strong></td><td>SSD NVMe (Disque E:) — modèles GGUF (Lecture de 1.7–3.5 GB/s)</td></tr>
12328        <tr><td><strong>Storage 2</strong></td><td>HDD (Disque C: / F:) — système Windows + swap</td></tr>
12329        <tr><td><strong>Storage 3</strong></td><td>HDD (Disque D:) — fichiers secondaires</td></tr>
12330        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — sorti le 20/05/2026</td></tr>
12331        <tr><td><strong>DirectX</strong></td><td>12 (Feature Level 12.0)</td></tr>
12332        <tr><td><strong>Bus</strong></td><td>PCI Express 3, périphérique 0, fonction 0</td></tr>
12333        <tr><td><strong>Système</strong></td><td>Windows 10/11 avec WSL2 actif</td></tr>
12334      </tbody>
12335    </table>
12336  </div>
12337  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
12338    *Note historique : Le Xeon E5-2690 v3 date de 2014. La RX 580 date de 2017. Qwen3.5 date de 2025. Du matériel de datacenter vieux de 10 ans traitant de l'IA de pointe.
12339  </p>
12340
12341  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.2 — Logiciels et versions</h3>
12342  <div class="tbl">
12343    <table>
12344      <thead>
12345        <tr>
12346          <th>Logiciel</th>
12347          <th>Version / Détail</th>
12348        </tr>
12349      </thead>
12350      <tbody>
12351        <tr><td><strong>llama.cpp</strong></td><td>build b9049-2496f9c14</td></tr>
12352        <tr><td><strong>Compilateur</strong></td><td>MSVC 14.51.36231 (Visual Studio)</td></tr>
12353        <tr><td><strong>Vulkan SDK</strong></td><td>1.4.350.0</td></tr>
12354        <tr><td><strong>OpenWebUI</strong></td><td>v0.9.6</td></tr>
12355        <tr><td><strong>SearXNG</strong></td><td>via Docker — intégré à OpenWebUI</td></tr>
12356        <tr><td><strong>Backend GPU</strong></td><td>Vulkan — <em>sans CUDA, sans ROCm, sans DirectML</em></td></tr>
12357        <tr><td><strong>Docker Desktop</strong></td><td>Actif — conteneurs open-webui + searxng</td></tr>
12358      </tbody>
12359    </table>
12360  </div>
12361
12362  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.3 — Le modèle : Qwen3.5-35B-A3B-Uncensored Q6_K</h3>
12363  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.1 — Spécifications techniques</h4>
12364  <div class="tbl">
12365    <table>
12366      <thead>
12367        <tr>
12368          <th>Paramètre</th>
12369          <th>Valeur</th>
12370        </tr>
12371      </thead>
12372      <tbody>
12373        <tr><td><strong>Nom complet</strong></td><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K</td></tr>
12374        <tr><td><strong>Architecture</strong></td><td>qwen35moe — Mixture of Experts (MoE)</td></tr>
12375        <tr><td><strong>Paramètres totaux</strong></td><td>34,66 milliards</td></tr>
12376        <tr><td><strong>Taille du fichier</strong></td><td>26,55 GiB (6,58 bits par poids)</td></tr>
12377        <tr><td><strong>Quantification</strong></td><td>Q6_K — 432 tenseurs q6_K + 301 tenseurs f32</td></tr>
12378        <tr><td><strong>Experts totaux</strong></td><td>256 experts</td></tr>
12379        <tr><td><strong>Experts actifs par token</strong></td><td>8 sur 256 (seulement 3,1% activés)</td></tr>
12380        <tr><td><strong>Contexte max d'entraînement</strong></td><td>262.144 tokens</td></tr>
12381        <tr><td><strong>Vocabulaire</strong></td><td>248.320 tokens (BPE, tokenizer qwen35)</td></tr>
12382        <tr><td><strong>Thinking mode par défaut</strong></td><td>ACTIVÉ (<code>thinking = 1</code> dans le template Jinja2)</td></tr>
12383        <tr><td><strong>Intervalle de full attention</strong></td><td>Tous les 4 layers</td></tr>
12384      </tbody>
12385    </table>
12386  </div>
12387
12388  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.2 — Pourquoi MoE change tout</h4>
12389  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
12390    Dans un modèle dense de 35B, <strong>tous</strong> les 35 milliards de paramètres sont activés pour chaque token généré. Dans Qwen3.5 MoE, seuls les <strong>8 experts les plus pertinents</strong> sur 256 sont activés — l'équivalent d'environ 3B paramètres actifs par token.
12391  </p>
12392  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
12393    Cela explique pourquoi un fichier de 26GB peut tourner sur une machine avec 32GB de RAM : la majeure partie des poids est en mémoire mais <strong>n'est pas calculée simultanément</strong>.
12394  </p>
12395
12396  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.4 — Commande d'initialisation</h3>
12397  <div class="cmd">
12398# Session 1 (port 8080 — erreur corrigée plus tard)
12399.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
12399ort 8080
12400
12401# Session 2 (port 8081 — correct)
12402.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --port 8081</div>
12403  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
12404    <strong>Aucun flag manuel de couches (<code>-ngl</code>).</strong> llama.cpp a effectué tout le fitting automatiquement.
12405  </p>
12406<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.5 — L'ajustement automatique : Comment llama.cpp a divisé 26GB en 1,15 secondes</h3>
12407  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
12408    C'est le cœur technique de l'expérience. Sans aucune intervention manuelle, llama.cpp a exécuté un algorithme d'optimisation qui a analysé la VRAM disponible et a distribué le modèle entre le GPU et la RAM de manière intelligente.
12409  </p>
12410
12411  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.1 — Situation initiale (Impossible de charger l'intégralité sur le GPU)</h4>
12412  <div class="cmd">
12413Mémoire requise sur le GPU (modèle complet) : 32.961 MiB
12414VRAM libre disponible :                        7.366 MiB
12415Déficit :                                     26.618 MiB — impossible pour le GPU de tout contenir</div>
12416
12417  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.2 — Séquence de décisions de l'ajustement (1,15 secondes)</h4>
12418  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
12419    <strong>Étape 1 — Réduction du contexte :</strong>
12420  </p>
12421  <div class="cmd">Contexte original :  262.144 tokens ➔ Contexte réduit automatiquement : 4.096 tokens (Économie de VRAM : 5.347 MiB)</div>
12422  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
12423    <strong>Étape 2 — Déplacer tous les experts MoE vers la RAM :</strong>
12424  </p>
12425  <div class="cmd">Vulkan0 avec les couches denses résiduelles : 2.418 MiB (Reste 3.924 MiB de VRAM libre)
12426RAM hôte (experts MoE mappés) : 25.613 MiB</div>
12427  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
12428    <strong>Étape 3 — Réallouer les couches denses vers le GPU (back-to-front) :</strong>
12429  </p>
12430  <div class="cmd">41 couches denses réallouées ➔ GPU. Utilisation résultante : 3.048 MiB | Libre : 4.318 MiB</div>
12431  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
12432    <strong>Étape 4 — Remplissage front-to-back avec débordement fractionné :</strong>
12433  </p>
12434  <div class="cmd">Résultat : 41 couches (36 "overflowing") sur le GPU
12435Type de débordement : GATE (fractionné au niveau de la gate layer)
12436Utilisation finale GPU : 6.255 MiB | Libre : 1.111 MiB</div>
12437
12438  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.3 — Distribution finale des poids</h4>
12439  <div class="tbl">
12440    <table>
12441      <thead>
12442        <tr>
12443          <th>Emplacement du tampon</th>
12444          <th>Contenu stocké</th>
12445          <th>Taille mobilisée</th>
12446        </tr>
12447      </thead>
12448      <tbody>
12449        <tr><td><strong>Vulkan0 (RX 580 8GB)</strong></td><td>41 couches denses + output layer</td><td><strong>5.154 MiB</strong></td></tr>
12450        <tr><td><strong>CPU_Mapped (RAM via mmap)</strong></td><td>256 experts MoE</td><td><strong>26.784 MiB</strong></td></tr>
12451      </tbody>
12452    </table>
12453  </div>
12454
12455  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.4 — Tampons supplémentaires alloués dans la VRAM</h4>
12456  <div class="tbl">
12457    <table>
12458      <thead>
12459        <tr>
12460          <th>Type de tampon</th>
12461          <th>Taille allouée</th>
12462          <th>Description physique</th>
12463        </tr>
12464      </thead>
12465      <tbody>
12466        <tr><td><strong>KV Cache (Vulkan0)</strong></td><td>80,00 MiB</td><td>4.096 cells, 10 layers</td></tr>
12467        <tr><td><strong>RS Buffer (Vulkan0)</strong></td><td>251,25 MiB</td><td>récurrent : 40 layers, 4 seqs</td></tr>
12468        <tr><td><strong>Compute Buffer (Vulkan0)</strong></td><td>770,02 MiB</td><td>Activé durant les graphes de calcul</td></tr>
12469        <tr><td><strong>Host Compute Buffer</strong></td><td>16,02 MiB</td><td>RAM système</td></tr>
12470        <tr><td><strong>Output Buffer (Vulkan_Host)</strong></td><td>3,79 MiB</td><td>Tampon de sortie des tokens</td></tr>
12471      </tbody>
12472    </table>
12473  </div>
12474  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
12475    <strong>Total effectif dans la VRAM durant l'inférence : ~6,2–7,2 GB</strong> (77–90% des 8GB physiques libres).
12476  </p>
12477
12478  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.5 — Fonctionnalités activées automatiquement</h4>
12479  <div class="cmd">
12480✅ Flash Attention (auto ➔ ENABLED)
12481✅ Fused Gated Delta Net — autoregressive
12482✅ Fused Gated Delta Net — chunked
12483✅ Prompt cache (limite : 8.192 MiB, ~89.715 MiB sauvegardés sur disque)
12484✅ Thinking mode (thinking = 1)
12485✅ 4 slots parallèles (n_seq_max = 4)
12486
12487Graph nodes : 3.729 | Graph splits : 106 (avec bs=512), 74 (avec bs=1)
12488Reserve : 137–183 ms</div>
12489
12490  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.6 — L'architecture à 4 niveaux de mémoire</h3>
12491  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
12492    Premier enregistrement documenté d'un modèle 35B utilisant <strong>4 couches de mémoire simultanément</strong> pour le traitement sur une RX 580 standard :
12493  </p>
12494  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.8rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
12495    <div>⚡ <strong style="color:#ff9e64">
12495NIVEAU 1 — VRAM RX 580 (8GB GDDR5) :</strong> 5.154 MiB de couches denses | Accès : ~400 GB/s (GDDR5) | Latence : nanosecondes</div>
12496    <div style="margin-top:0.5rem">🧠 <strong style="color:#7aa2f7">NIVEAU 2 — RAM DDR4 ECC (32GB System) :</strong> 26.784 MiB d'experts MoE via mmap | Accès : ~51 GB/s (quad-channel) | Latence : dizaines de ns</div>
12497    <div style="margin-top:0.5rem">💾 <strong style="color:#22c55e">NIVEAU 3 — SSD NVMe (Disque E:) :</strong> 26,55 GiB de fichier .gguf source | Accès : 1,7–3,5 GB/s | Utilisé durant le chargement initial</div>
12498    <div style="margin-top:0.5rem">📁 <strong style="color:#e0af68">NIVEAU 4 — HDD (Disque C: Swap) :</strong> Swap Windows activé quand la RAM est saturée (>97% d'utilisation) | Accès : ~120–180 MB/s | Pic de 98–100% d'utilisation durant l'inférence</div>
12499  </div>
12500
12501  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.7 — Configuration du contexte chargé</h3>
12502  <div class="cmd">
12503n_ctx         = 4.096 tokens (réduit de 262.144 par l'ajustement)
12504n_batch       = 2.048
12505n_ubatch      = 512
12506n_seq_max     = 4 (slots parallèles)
12507flash_attn    = auto ➔ ENABLED
12508kv_unified    = true</div>
12509  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
12510    <strong>Limitation critique documentée :</strong> Le contexte de 4.096 tokens est le goulot d'étranglement principal de la configuration. Le thinking mode (mode raisonnement) de Qwen3.5 consomme 3.000+ tokens à lui seul avant de générer une réponse visible — laissant moins de 1.000 tokens libres pour la réponse finale au client.
12511  </p>
12512
12513  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.8 — Benchmark confirmé en deux sessions</h3>
12514  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Vitesse de génération</h4>
12515  <div class="tbl">
12516    <table>
12517      <thead>
12518        <tr>
12519          <th>Session</th>
12520          <th>Heure approximative</th>
12521          <th>Prompt Eval Speed</th>
12522          <th>Génération Speed</th>
12523          <th>Total Tokens</th>
12524          <th>Temps total</th>
12525        </tr>
12526      </thead>
12527      <tbody>
12528        <tr><td><strong>Session 1</strong></td><td>~17h39</td><td><strong>34,13 tok/s</strong></td><td><strong>5,57 tok/s</strong></td><td>1.377 tok</td><td>~107 secondes</td></tr>
12529        <tr><td><strong>Session 2</strong></td><td>~21h34</td><td>~40.00 tok/s</td><td><strong>5,64 tok/s</strong></td><td>2.929 tok</td><td>~533 secondes</td></tr>
12530      </tbody>
12531    </table>
12532  </div>
12533  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
12534    <strong>Consistance remarquable :</strong> Maintien d'une cadence d'environ 5,6 tokens/seconde de génération, indépendamment du fait que la session soit surchargée ou froide.
12535  </p>
12536<h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Registro de temperaturas registradas</h4>
12537  <div class="tbl">
12538    <table>
12539      <thead>
12540        <tr>
12541          <th>Momento do Teste</th>
12542          <th>GPU Temp (°C)</th>
12543        </tr>
12544      </thead>
12545      <tbody>
12546        <tr><td>Idle (modelo estacionado na VRAM)</td><td>33–41°C</td></tr>
12547        <tr><td>Inferência normal (sem Web Search ativo)</td><td>44–64°C</td></tr>
12548        <tr><td>Inferência carregada (com Web Search ativo)</td><td>70–75°C</td></tr>
12549        <tr><td><strong>Pico absoluto registrado</strong></td><td><strong>80°C</strong></td></tr>
12550        <tr><td>Após conclusão de resposta</td><td>71–73°C</td></tr>
12551      </tbody>
12552    </table>
12553  </div>
12554  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
12555    <strong>Temperatura de thermal throttling da RX 580:</strong> ~90°C. <strong>Margem de segurança operacional perfeitamente mantida!</strong>
12556  </p>
12557
12558  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Utilização de recursos na inferência física</h4>
12559  <div class="tbl">
12560    <table>
12561      <thead>
12562        <tr>
12563          <th>Recurso de Hardware</th>
12564          <th>Idle</th>
12565          <th>Durante Inferência</th>
12566          <th>Pico Registrado</th>
12567        </tr>
12568      </thead>
12569      <tbody>
12570        <tr><td>VRAM dedicada</td><td>6,7 / 8,0 GB</td><td>6,8 – 7,2 / 8,0 GB</td><td>7,4 GB / 8,0 GB</td></tr>
12571        <tr><td>RAM do Sistema</td><td>~29,0 GB</td><td>30,7 – 31,1 GB</td><td>31,2 / 31,8 GB (98% utiliz.)</td></tr>
12572        <tr><td>CPU Xeon v3</td><td>3%</td><td>62 – 70%</td><td>70%</td></tr>
12573        <tr><td>GPU utilização 3D</td><td>0%</td><td>1 – 3%</td><td>3% (Carga no barramento PCIe)</td></tr>
12574        <tr><td>
12574HDD C: (Atividade swap)</td><td>0%</td><td>13 – 42%</td><td>98 – 100% (Limiar swap)</td></tr>
12575      </tbody>
12576    </table>
12577  </div>
12578
12579  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.9 — Os 5 Testes: Histórico Completo de Engenharia</h3>
12580  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
12581    <strong>Pergunta de entrada enviada em todos os testes:</strong><br>
12582    "Explique detalhadamente como funciona o mecanismo de atenção em transformers e por que o MoE é mais eficiente que modelos densos. Responda em português."
12583  </blockquote>
12584
12585  <div style="display:flex;flex-direction:column;gap:1rem;margin-bottom:1.5rem">
12586    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
12587      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 1 — Sessão 1 · Raciocínio ON + Web Search ON + Geração Imagem ON</h5>
12588      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
12589        <strong>Resultado:</strong> ❌ Erro de protocolo (reposta não entregue) | <strong>Log do erro:</strong> <code>operator (): got exception: {"error":"code":400,"message":"Assistant response prefill is incompatible with enable_thinking."}</code>
12590      </p>
12591      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
12592        <strong>Análise:</strong> O modelo processou um pensamento por ~1 minuto recuperando 10 fontes do SearXNG, mas o OpenWebUI injetou um prefill incorreto incompatível com a flag de pensamento do Jinja2, forçando o cancelamento.
12593      </p>
12594    </div>
12595
12596    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
12597      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 2 — Sessão 2 · Raciocínio ON + Web Search ON (30 pesquisas consecutivas)</h5>
12598      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
12599        <strong>Resultado:</strong> ❌ Contexto esgotado | <strong>Log do erro:</strong> <code>stop processing: n_tokens = 3285, truncated = 1</code>
12600      </p>
12601      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
12602        <strong>Análise:</strong> As 30 pesquisas do SearXNG injetaram milhares de tokens de contexto na memória. O thinking mode tentou alocar seu próprio buffer e estourou os 4.096 limitantes do setup híbrido, forçando corte prematuro.
12603      </p>
12604    </div>
12605
12606    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
12607      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 3 — Sessão 2 · Raciocínio ON + Web Search ON (25 pesquisas, nova rodada acumulada)</h5>
12608      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
12609        <strong>Resultado:</strong> ❌ Contexto esgotado | <strong>Log do erro:</strong> <code>stop processing: n_tokens = 4095, truncated = 1</code>
12610      </p>
12611      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
12612        <strong>Análise:</strong> O OpenWebUI tentou reenviar acumulando o histórico de conversação anterior. O prompt cresceu tanto que atingiu o teto exato delimitado de hardware de 4.095 tokens no Fitting.
12613      </p>
12614    </div>
12615
12616    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
12617      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 4 — Sessão 2 · Raciocínio ON + Web Search OFF</h5>
12618      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
12619        <strong>Resultado:</strong> ❌ Timeout do Cliente | <strong>Log do erro:</strong> <code>stop: cancel task, id_task = 6887 (truncated = 0)</code>
12620      </p>
12621      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
12622        <strong>Análise:</strong> Sem web-search o consumo térmico despencou para estáveis 51°C e uso de swap caiu. Mas o processamento de raciocínio interno demorou tempo suficiente na CPU Xeon de 2014 para que a UI disparasse seu timeout de segurança de chamadas.
12623      </p>
12624    </div>
12625
12626    <div style="border:1px solid rgba(34, 197, 94, 0.2);background:rgba(0, 3, 1, 0.6);border-radius:6px;padding:1rem">
12627      <h5 style="color:#22c55e;font-weight:bold;font-size:0.85rem">✅ TESTE 5 — Sessão 2 · Raciocínio ON + Web Search OFF + Prompt Curto (45 tokens)</h5>
12628      <p style="font-size:0.8rem;color:#c2ffd2;line-height:1.6;margin-top:0.25rem">
12629        <strong>Resultado:</strong> SUCESSO ABSOLUTO ✅ | Resposta técnica profunda entregue integralmente em português brasileiro estruturado.
12630      </p>
12631      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
12632        <strong>Análise:</strong> Ao restringir o prompt inicial para 45 tokens e desativar barulhos complementares, o pensamento pôde rodar por 4 minutos completos sob o Xeon, realizando rascunho de equações e respondendo impecavelmente sobre Transformers (Softmax, Multiheads) e as eficiências do MoE.
12633      </p>
12634    </div>
12635  </div>
12636
12637  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.10 — Tabela Comparativa de Comportamento dos Testes</h3>
12638  <div class="tbl">
12639    <table>
12640      <thead>
12641        <tr>
12642          <th>ID</th>
12643          <th>Thinking</th>
12644          <th>Web Search</th>
12645          <th>Promo Token</th>
12646          <th>Status</th>
12647          <th>Causa Raiz Real da Falha</th>
12648        </tr>
12649      </thead>
12650      <tbody>
12651        <tr><td>1</td><td>ON</td><td>ON (10 fontes)</td><td>~936 tok</td><td>❌ Falha</td><td>Prefill de resposta incompatível with thinking=1</td></tr>
12652        <tr><td>2</td><td>ON</td><td>ON (30 pesq.)</td><td>~357 tok</td><td>❌ Falha</td><td>Esgotamento de contexto do Fitting (4.095 max)</td></tr>
12653        <tr><td>3</td><td>ON</td><td>ON (25 pesq.)</td><td>~3.385 tok</td><td>❌ Falha</td><td>Esgotamento de contexto imediato no reenvio</td></tr>
12654        <tr><td>4</td><td>ON</td><td>OFF</td><td>~350 tok</td><td>❌ Falha</td><td>Timeout nas requisições da OpenWebUI antes do output</td></tr>
12655        <tr style="background:rgba(34, 197, 94, 0.05)"><td><strong>5</strong></td><td><strong>ON</strong></td><td><strong>OFF</strong></td><td><strong>45 tok</strong></td><td><strong>✅ SUCESSO</strong></td><td><strong>Prompt enxuto coube integralmente na arquitetura de mmap</strong></td></tr>
12656      </tbody>
12657    </table>
12658  </div>
12659<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
12660    <strong>Conclusão Crítica:</strong> A RX 580 do laboratório de 2017 e o Xeon funcionaram estavelmente sem dar nenhum reset físico em todas as situações de stress. As falhas residiram estritamente na calibração lógica do software de front-end.
12661  </p>
12662
12663  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.11 — Coletas de Descobertas e Limitações Cruciais</h3>
12664  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
12665    <li><strong style="color:#fff">Incompatibilidade do Thinking com Contexto Curto:</strong> Por design de modelo, o pensamento consome cerca de 3.000 tokens e estoura rapidamente o KV Cache alocado de 4.096 se o prompt ou histórico for longo.</li>
12666    <li><strong style="color:#fff">O Fitting Automático do llama.cpp é Excepcional:</strong> Forçar o split por flags experimentais rígidas como <code>--override-tensor</code> prejudica as chamadas no Vulkan. O fitting por cálculo de grafos resolveu milimetricamente a distribuição de forma otimizada.</li>
12667    <li><strong style="color:#fff">Superaquecimento da GPU mitigado:</strong> Apenas a renderização profunda com dezenas de filtros simultâneos elevou a 80°C. Limitar a GPU para inferir frações densas mantém o chip a confortáveis 44-64°C.</li>
12668    <li><strong style="color:#fff font-weight:bold">O gargalo reside na taxa de I/O de Swap do HDD:</strong> Quando RAM estoura a 98%, a taxa cai para 5 tok/s devido ao HDD. Migrar o swap do host inteiro para unidades de estado sólido aumentará consideravelmente a velocidade de fluxo comb
12668inada.</li>
12669  </ul>
12670
12671  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.12 — Comparação Direta com Projetos de Comunidade</h3>
12672  <div class="tbl">
12673    <table>
12674      <thead>
12675        <tr>
12676          <th>Projeto / Autor</th>
12677          <th>Arquitetura Utilizada</th>
12678          <th>Modelo Testado</th>
12679          <th>Velocidade Geração</th>
12680          <th>Status de Autoria</th>
12681        </tr>
12682      </thead>
12683      <tbody>
12684        <tr><td><strong>Matheus Fertunani</strong></td><td>Linux Comercial / CPU Xeon pura (192GB RAM)</td><td>Qwen3.5 35B Q8</td><td>~7–8 tokens/s</td><td>Documentado no YouTube</td></tr>
12685        <tr><td><strong>AIVisionsLab (Nossos testes)</strong></td><td>Vulkan Híbrido (RX 580 8GB + 32GB RAM ECC)</td><td>Qwen3.5 35B Q6_K</td><td><strong>5,64 tokens/s</strong></td><td>✅ Validado e Registrado</td></tr>
12686      </tbody>
12687    </table>
12688  </div>
12689  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
12690    <strong>A grande vantagem arquitetural:</strong> O teste de CPU pura de Matheus exige hardwares profissionais de alto custo com mais de 100GB de RAM instalada. O ecossistema de Vulkan do AIVisionsLab provou-se operável em uma GPU de menos de R$ 400 em mercado secundário!
12691  </p>
12692
12693  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.13 — Configurações Recomendadas para Testes Futuros</h3>
12694  <div class="cmd">
12695# Teste 6 — Desativação explícita de thinking via servidor em versões de compilação recentes:
12696.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
12696ort 8081 --no-thinking
12697
12698# Teste 7 — Elevação estrita de buffers de contexto se a memória for redirecionada:
12699.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-...-Q6_K.gguf" --host 0.0.0.0 --port 8081 --ctx-size 8192
12700
12701# Teste 8 — Testar com quantizações menores como Q4_K_M (~21GB):
12702# Liberação de ~5GB adicionais na RAM host que reduz a dependência de swap no HDD e melhora consideravelmente a taxa de tok/s!</div>
12703
12704  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.14 — Lições Técnicas Consolidadas</h3>
12705  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
12706    <li><strong style="color:#fff">O silício de 2017 não é o limite:</strong> A placa de vídeo nunca crashou nos testes contínuos de estresse térmico, dezenas de vezes. O gargalo se provou uma mera calibração lógica de software.</li>
12707    <li><strong style="color:#fff">As esparsidades do MoE salvam a categoria:</strong> Sem MoE, seria impensável arrastar um modelo de 26GB de pesos ativos. O MoE faz com que apenas 3.1% dos neurônios fiquem de fato excitados por token.</li>
12708  </ul>
12709
12710  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.15 — Veredicto Geral do Laboratório</h3>
12711  <div class="tbl">
12712    <table>
12713      <thead>
12714        <tr>
12715          <th>Questão de Engenharia</th>
12716          <th>Veredicto Final</th>
12717        </tr>
12718      </thead>
12719      <tbody>
12720        <tr><td><strong>A RX 580 de 8GB suporta modelos de 35B parâmetros?</strong></td><td>✅ <strong>Sim</strong> (Em barramento híbrido mmap)</td></tr>
12721        <tr><td><strong>É prático para o dia a dia?</strong></td><td>⚠️ <strong>Não</strong> (5,6 tok/s e contexto de 4.096 tokens)</td></tr>
12722        <tr><td><strong>Vale como prova de conceito?</strong></td><td>✅ <strong>Absolutamente</strong></td></tr>
12723        <tr><td><strong>Houve throttling ou crash?</strong></td><td>✅ <strong>Zero ocorrências de instabilidade</strong></td></tr>
12724        <tr><td><strong>Temperatura máxima registrada</strong></td><td><strong>80°C</strong> (margem de segurança: ~90°C)</td></tr>
12725        <tr><td><strong>Velocidade de geração</strong></td><td><strong>~5,6 tokens/segundo</strong></td></tr>
12726        <tr><td><strong>Memória total mobilizada</strong></td><td><strong>~34 GB</strong> (VRAM + RAM + swap HDD)</td></tr>
12727      </tbody>
12728    </table>
12729  </div>
12730
12731  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.16 — Linha do Tempo do Experimento</h3>
12732  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
12733    <div>🕒 <strong>~17:39</strong> — Servidor sobe na porta 8080 (erro)</div>
12734    <div>🕒 <strong>~17:40</strong> — "Network Problem" no OpenWebUI (porta errada)</div>
12735    <div>🕒 <strong>~17:41</strong> — Servidor fechou ao trocar porta → reiniciado na 8081</div>
12736    <div>🕒 <strong>~17:42</strong> — Todas as ferramentas habilitadas no modelo (imagem, web, terminal)</div>
12737    <div>🕒 <strong>~17:43</strong> — <strong>TESTE 1</strong> inicia</div>
12738    <div>🕒 <strong>~17:44</strong> — Web search: 10 fontes recuperadas</div>
12739    <div>🕒 <strong>~17:44</strong> — Tentativa de gerar imagem → erro tratado → continua</div>
12740    <div>🕒 <strong>~17:45</strong> — "Pensado por um minuto" aparece no OpenWebUI</div>
12741    <div>🕒 <strong>~17:46</strong> — Resposta estruturada com título gerado internamente</div>
12742    <div>🕒 <strong>~17:50</strong> — Erro de protocolo (prefill + thinking) → sem entrega. Pico: 80°C</div>
12743    <div>🕒 <strong>~21:34</strong> — Sessão 2 inicia</div>
12744    <div>🕒 <strong>~21:34</strong> — <strong>TESTE 2</strong> inicia — web search ON (30 pesquisas). Contexto truncado.</div>
12745    <div>🕒 <strong>~21:48</strong>
12745 — <strong>TESTE 3</strong> automático — 25 pesquisas. Contexto truncado.</div>
12746    <div>🕒 <strong>~22:00</strong> — <strong>TESTE 4</strong> — web search OFF. Temperatura cai para 51°C. Timeout da UI.</div>
12747    <div>🕒 <strong>~23:06</strong> — <strong>TESTE 5</strong> — prompt de 45 tokens. Thinking decodificado com sucesso.</div>
12748    <div>🕒 <strong>~23:14</strong> — Resposta completa entregue em português ✅. GPU: 64°C | RAM: 96%</div>
12749  </div>
12750
12751  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.17 — Impacto para a Documentação do AIVisionsLab</h3>
12752<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
12753    Este experimento adiciona ao projeto: um novo benchmark robusto de 5,6 tok/s para modelos 35B MoE híbridos, a confirmação de que o fitting automático do llama.cpp supera configurações manuais rígidas via Vulkan, a identificação clara de incompatibilidade do modo thinking com contextos inferiores a 8.192 e a descrição de uma arquitetura estendida a 4 níveis de memória.
12754  </p>
12755
12756  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.18 — Tags e Metadados</h3>
12757  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
12758    <div>🏷️ <strong>Tags:</strong> hybrid, moe, vulkan, rx580, large-model, thinking-mode, limits, qwen35b, benchmark, fitting-automático, 4-memory-levels, sem-throttling</div>
12759    <div style="margin-top:0.5rem">💻 <strong>Hardware:</strong> RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
12760    <div style="margin-top:0.25rem">💿 <strong>Software:</strong> llama.cpp b9049 + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
12761    <div style="margin-top:0.25rem">📅 <strong>Data:</strong> 15/06/2026</div>
12762    <div style="margin-top:0.25rem">⏱️ <strong>Sessões:</strong> 2 (17h39–18h24 e 21h34–23h14)</div>
12763    <div style="margin-top:0.25rem">📊 <strong>Testes:</strong> 5 (4 falhas de software, 1 sucesso de inferência completa)</div>
12764    <div style="margin-top:0.25rem">📈 <strong>Benchmark:</strong> 5,57–5,64 tok/s (geração) | 34,13 tok/s (prompt eval)</div>
12765    <div style="margin-top:0.25rem">🔥 <strong>Temperatura pico:</strong> 80°C</div>
12766    <div style="margin-top:0.25rem">🏆 <strong>Status final:</strong> ✅ HARDWARE APROVADO</div>
12767  </div>
12768
12769  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
12770    "O problema nunca foi o hardware.<br>
12771    Foi a combinação de thinking + web search esgotando os 4.096 tokens de contexto.<br>
12772    Com prompt curto e sem web search, o Qwen3.5-35B Q6_K responde normalmente numa RX 580 de 2017."<br>
12773    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 15/06/2026</span>
12774  </blockquote>
12775
12776  <div class="footer">
12777    Documentação gerada por Claude Sonnet 4.6 — 15/06/2026 · Baseada em logs reais, screenshots, benchmarks e observações em tempo real · Sessão 1: ~17h39–18h24 | Sessão 2: ~21h34–23h14 · 5 testes documentados · 1 bem-sucedido · Hardware de 2017 processando IA de 2025
12778  </div>
12779</div>`},linhatempo:{id:"linhatempo",title:"37. LINHA DO TEMPO COLETIVA — A EVOLUÇÃO DO RX 580 COMO PLATAFORMA DE IA",desc:"Analyse historique et comparative unifiée documentant la rupture des barrières et l'obsolescence de la RX 580 en trois étapes révolutionnaires (2025-2026).",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:25,tags:["evolucion-historica","rx580-timeline","comunidade-hacker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["meta"],previous:"meta",next:"audio_rvc",related:["jornada","comunidade"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Le sauvetage technique et l'ascension de l'AMD Radeon RX 580 en tant que plateforme d'intelligence artificielle pratique n'est pas le fruit d'un seul esprit, mais d'une <strong>évolution collective ascendante</strong>. Trois projets indépendants, construits sur la base mathématique commune de l'écosystème <code>ggml</code>, ont pavé ce voyage :</p><div style="position:relative;margin:2rem 0;padding-left:1.5rem;border-left:2px solid var(--b)"><div style="margin-bottom:1.5rem;position:relative"><div style="position:absolute;
12779left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:var(--r);border:2px solid #07080a"></div><span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:var(--r);font-weight:bold">JANVIER 2025</span><h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">Méthode Amihart (Debian Linux)</h5><p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Premier jalon documenté. Validé les LLM accélérés par Vulkan dans <code>llama.cpp</code> atteignant 24.56 t/s. Cependant, il a déclaré : <em>"Vulkan ne fonctionne pas pour Stable Diffusion"</em>, en raison des limitations du logiciel à l'époque, recourant à ROCm via Docker.</p></div><div style="margin-bottom:1.5rem;position:relative"><div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#eab308;border:2px solid #07080a"></div><span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#eab308;font-weight:bold">DÉCEMBRE 2025</span><h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">Méthode DadHacks (Linux/Debian)</h5><p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">A réfuté empiriquement l'impossibilité de Stable Diffusion via Vulkan. A utilisé le tout nouveau moteur <code>stable-diffusion.cpp</code> avec le flag de compilation <code>-DSD_VULKAN=ON</code> pour faire tourner la génération GGUF de Flux Schnell avec une segmentation CPU/GPU.</p></div><div style="position:relative"><div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#22c55e;border:2px solid #07080a"></div><span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#22c55e;font-weight:bold">SAISON 2026</span><h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">AIVisionsLab (Windows Natif + WSL2)</h5><p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Unification de l'écosystème de production. A développé l'automatisation native via <code>.bat</code>, intégré le rendu Vulkan local à des panneaux conviviaux (OpenWebUI via Docker), documenté les fallbacks pour le CPU Xeon sur les modèles SOTA et cartographié de manière exhaustive les raisons des échecs de DirectML/ROCm sur Windows.</p></div></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:2rem 0 .75rem 0;text-transform:uppercase">A. La Question à Laquelle Chaque Projet a Répondu</h4><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">L'évolution de la maturité technique de la RX 580 peut être traduite par les prémisses répondues par les auteurs :</p><ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem"><li><strong style="color:#fff">Amihart (Jan 2025) :</strong> <em>"Est-il possible de faire tourner des LLM rapidement sur la RX 580 sans ROCm officiel ?"</em> <strong style="color:var(--r)">Oui</strong>, en compilant llama.cpp avec l'API Vulkan pure.</li><li><strong style="color:#fff">DadHacks (Déc 2025) :</strong> <em>"Est-il possible de générer des images via IA accélérées par Vulkan sur la RX 580 ?"</em> <strong style="color:var(--r)">Oui</strong>, en compilant stable-diffusion.cpp et en utilisant le format alternatif stable GGUF.</li><li><strong style="color:#fff">AIVisionsLab (2026) :</strong> <em>
12779"Est-il possible de mettre toute cette infrastructure en production intégrée et conviviale sur Windows ?"</em> <strong style="color:var(--r)">Oui</strong>, en construisant des ponts réseau de conteneurs Docker, des automatisations unifiées et des fallbacks CPU intelligents pour les excédents de VRAM.</li></ul><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. Tableau Maître Comparatif Unifié</h4><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">Cartographie structurelle croisée des capacités et des réalisations cumulatives :</p><div class="tbl" style="margin-bottom:1.5rem"><table><thead><tr><th>Capacité</th><th>Amihart (2025)</th><th>DadHacks (2025)</th><th>AIVisionsLab (2026)</th></tr></thead><tbody><tr><td><strong>Système de Base</strong></td><td>Debian Linux</td><td>Linux Debian</td><td>Windows 10 Pro + WSL2 Linux</td></tr><tr><td><strong>Moteur LLM</strong></td><td>✅ Vulkan (24.56 t/s)</td><td>✅ Vulkan (llama.cpp)</td><td>✅ Vulkan (15-16 t/s)</td></tr><tr><td><strong>Moteur SD</strong></td><td>❌ Non viable en Vulkan</td><td>✅ Vulkan pur</td><td>✅ Vulkan pur (~72s SD1.5)</td></tr><tr><td><strong>Flux GGUF</strong></td><td>❌ Inexistant</td><td>✅ Ligne de commande</td><td>✅ Hybride GPU/CPU Stable</td></tr><tr><td><strong>Interface Graphique</strong></td><td>❌ Console uniquement / WebUI Docker</td><td>❌ CLI uniquement</td><td>✅ OpenWebUI + API intégrée</td></tr><tr><td><strong>Automatisation</strong></td><td>❌ Non développé</td><td>❌ Non développé</td><td>✅ Scripts .bat double-clic</td></tr><tr><td><strong>Stabilité VRAM</strong></td><td>❌ Limitation physique ROCm</td><td>⚠️ CLI manuel</td><td>✅ VAE Tiling intégré</td></tr><tr><td><strong>Modèles &gt; 8GB</strong></td><td>❌ OOM chroniques</td><td>⚠️ CPU offload basique</td><td>✅ Fallbacks Quad-Channel REG ECC</td></tr><tr><td><strong>Animation Vidéo</strong></td><td>❌ Non abordé</td><td>❌ Non abordé</td><td>✅ AnimateDiff WSL2 CPU Xeon</td></tr><tr><td><strong>Détection GGUF</strong></td><td>❌ Non abordé</td><td>❌ Non abordé</td><td>✅ Cartographie leejet vs city96</td></tr></tbody></table></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">C. Le Dénominateur Technique Commun — Moteur GGML</h4><p style="font-size:.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">La technologie centrale de compression et d'exécution qui a permis l'utilisation des GPU hérités a été l'écosystème développé par Georgi Gerganov (<strong>ggml / llama.cpp / stable-diffusion.cpp</strong>). En portant les opérations tensorielles directement vers le langage C/C++ et en exposant des crochets natifs à la bibliothèque graphique ouverte de <strong>Vulkan API</strong>, cette implémentation permet aux cartes sans paquets de pilotes propriétaires modernes d'effectuer des calculs massifs natifs (contournant les pilotes restrictifs des fournisseurs).</p><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">D. Philosophie Convergente</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Manifestations directes qui éternisent le purpose libre de ces chercheurs :</p><blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem"><strong>Amihart :</strong> "Malgré l'âge de ce GPU, il est techniquement possible de l'utiliser pour l'IA si nous adaptons le flux d'exécution... l'optimisation de bas niveau est la clé de la réutilisation du matériel hérité."</blockquote><blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem"><strong>DadHacks :</strong> "Cette configuration fournit un pont viable pour l'utilisation technique des investissements matériels existants sans nécessiter de mises à niveau coûteuses ou de dépendance à des progiciels gonflés."</blockquote><blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem"><strong>AIVisionsLab :</strong> "La dégradation par l'obsolescence des pilotes et des écosystèmes fermés est un facteur commercial et non une limitation matérielle de la carte. Le matériel hérité maintient son utilité opérationnelle grâce au support de logiciels ouverts."</blockquote><div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem"><strong style="color:var(--r)">Crédit de Co-autorialité et Référence :</strong> Chronologie technique dédiée à l'effort expérimental cumulatif d'<strong>艾米心 (Amihart)</strong>, <strong>DH (DadHacks)</strong>, <strong>leejet</strong>, <strong>ggerganov</strong>, <strong>woodrex</strong> et de tous les développeurs indépendants axés sur la réutilisation numérique et la préservation du matériel.</div>`},linux_nativo:{id:"linux_nativo",title:"43. LINUX NATIVO — Ubuntu 26.04 LTS + RX 580 + Vulkan",desc:"AIVisionsLab — Documentation de la pile complète sous Linux réel",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"sistema-operacional",difficulty:"advanced",estimated_time_min:40,tags:["ubuntu-native","linux-vulkan","low-level-compilation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_whisper"],previous:"audio_whisper",next:"audio_srt_ptbr",related:["comfyui-wsl","amihart"]},part:1},html:`<div class="card bg-red-950/20 border border-red-500/30 p-5 rounded-md my-6">
12780  <h4 style="color:#ef4444;font-weight:800;font-size:0.95rem;margin-bottom:0.6rem;display:flex;items-center;gap:0.4rem">
12781    🚨 RAPPORT D'INCIDENT (16/06/2026) : LE GRAND DÉSASTRE DE L'ESPACE ET LA CHUTE DE GNOME
12782  </h4>
12783  <p style="font-size:0.82rem;color:#fca5a5;line-height:1.75;margin-bottom:0.75rem">
12784    <strong>Statut critique :</strong> Lors des tests de pipelines extrêmes et du téléchargement massif de modèles GGUF lourds sur la partition dédiée de 97 Go, l'espace physique a été totalement épuisé (0 octet libre sur le swap/root). Lors d'une tentative rapide de libération de cache et de nettoyage forcé via le terminal, des dépendances critiques de l'environnement graphique ont été corrompues.
12785  </p>
12786  <ul style="padding-left:1.2rem;font-size:.8rem;color:#fbcfe8;line-height:1.8;margin-bottom:1rem">
12787    <li><strong>Symptôme :</strong> Le gestionnaire de fenêtres <strong>GNOME</strong> a complètement planté, entraînant des boucles de connexion et un écran noir terminal sans chargement de l'interface vidéo.</li>
12788    <li><strong>Action de récupération :</strong> Formatage physique et réinstallation immédiate du système Linux Bare-Metal à partir de zéro pour une reconstruction propre et un redimensionnement adéquat des partitions.</li>
12789    <li><strong>Le verdict existentiel :</strong> <em>"Je dois absolument apprendre Linux !"</em> — Le parcours de l'AIVisionsLab prouve que maîtriser le terminal et l'allocation d'espace sous LVM est tout aussi crucial que de connaître les shaders de backend de Vulkan.</li>
12790  </ul>
12791</div>
12792
12793<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
12794  Documentation détaillée et homologuée d'exécution directe sous Linux natif. Sans WSL2, sans émulation de conteneur ou Docker Passthrough : accès bare-metal réel via les pilotes open-source <strong>Mesa RADV</strong> sur le tout nouveau <strong>Ubuntu 26.04 LTS (Resolute Raccoon)</strong> exécutant le noyau Linux 7.0.
12795</p>
12796
12797<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:.85rem;margin-bottom:1.25rem">
12798  <div class="stat"><div class="stat-icon">🐧</div><div><div class="stat-lbl">Plateforme Linux</div><div class="stat-val" style="font-size:.82rem">Ubuntu 26.04 LTS</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Noyau 7.0 (Resolute)</div></div></div>
12799  <div class="stat"><div class="stat-icon">🎛️</div><div><div class="stat-lbl">Pilote Vulkan</div><div class="stat-val" style="font-size:.82rem">Mesa RADV 26.0.3</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Vulkan Core version 1.4.341</div></div></div>
12800  <div class="stat"><div class="stat-icon">💽</div><div><div class="stat-lbl">Partitionnement</div><div class="stat-val" style="font-size:.82rem">Ext4 dédiée 97 Go</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">HDD sdb6 Dual Boot</div></div></div>
12801  <div class="stat"><div class="stat-icon">📦</div><div><div class="stat-lbl">Runtime Docker</div><div class="stat-val" style="font-size:.82rem">Moteur Linux natif</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Ponts OpenWebUI à 100%</div></div></div>
12802</div>
12803
12804<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Tableau comparatif brut : Windows 10 vs Linux natif</h3>
12805<div class="tbl">
12806  <table>
12807    <thead>
12808      <tr>
12809        <th>Scénario / Charge de travail</th>
12810        <th>Windows 10 (AMD officiel)</th>
12811        <th>Linux Ubuntu 26.04 (Mesa RADV)</th>
12812        <th>Vainqueur crucial</th>
12813      </tr>
12814    </thead>
12815    <tbody>
12816      <tr>
12817        <td><strong>LLM (Qwen3 4B GGUF) @ 99 layers</strong></td>
12818        <td>~15-17 tokens/s</td>
12819        <td><strong>~35 tokens/s (RADV engine)</strong></td>
12820        <td>🏆 <strong>Linux (2x plus rapide)</strong></td>
12821      </tr>
12822      <tr>
12823        <td><strong>LLM Large (Qwen3.6 35B) @ Max layers</strong></td>
12824        <td><strong>7.62 tokens/s (max 10 layers)</strong></td>
12825        <td>5.18 tokens/s (max 20 layers)</td>
12826        <td>⚖️ <strong>Égalité technique</strong> (Linux permet 2x plus de layers, Windows est plus rapide par layer)</td>
12827      </tr>
12828      <tr>
12829        <td><strong>Stable Diffusion (Dreamshaper8 - 50st)</strong></td>
12830        <td><strong>~72 secondes (1.44s/it)</strong></td>
12831        <td>~85 secondes (1.65s/it)</td>
12832        <td>🏆 <strong>Windows (stable par pilote)</strong></td>
12833      </tr>
12834      <tr>
12835        <td><strong>Flux Schnell (4 steps, 512x512)</strong></td>
12836        <td>~84 secondes (OOM si 1024x1024)</td>
12837        <td><strong>~52 secondes sampling (Total: 95s)</strong></td>
12838        <td>🏆 <strong>Linux (meilleur swap VRAM)</strong></td>
12839      </tr>
12840      <tr>
12841        <td><strong>whisper.cpp (large-v3-turbo, audio 106s)</strong></td>
12842        <td>307 s (Utilisation VRAM: 2.6 GB)</td>
12843        <td><strong>23.58 s (Utilisation VRAM: 1.6 GB)</strong></td>
12844        <td>🏆 <strong>Linux (Absolument supérieur)</strong></td>
12845      </tr>
12846    </tbody>
12847  </table>
12848</div>
12849
12850<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Installation et Dual-Boot sans écraser les registres</h3>
12851<p style="font-size:.82rem;color:#94a3b8;line-height:1.75">
12852  1. Sous Windows, libérez de l'espace en utilisant le Gestionnaire de disques (Réduire le volume).<br>
12853  2. Préparez la clé USB avec l'ISO desktop d'<strong>Ubuntu 26.04 amd64</strong>.<br>
12854  3. Dans l'installateur Ubuntu, sélectionnez l'option "Installer à côté de Windows Boot Manager". L'installateur créera la partition et configurera le menu GRUB pour permettre la sélection de démarrage à chaque redémarrage automatiquement.
12855</p>
12856
12857<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Post-installation : Validation Bare-Metal de la GPU Polaris</h3>
12858<div class="code">
12859  <span class="code-lang">bash</span>
12860  <pre>lspci | grep -i vga
12861# AMD Radeon RX 580 2048SP détectée !
12862
12863vulkaninfo --summary 2>/dev/null | grep -A5 "Devices"
12864# Doit afficher : GPU0: DRIVER_ID_MESA_RADV | driverInfo = Mesa 26.0.3 ✅</pre>
12865</div>
12866
12867<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Pile de commandes d'exécution homologuées sous Ubuntu</h3>
12868
12869<h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">1. Initialisation de llama-server via Vulkan</h4>
12870<div class="code">
12871  <span class="code-lang">bash</span>
12872  <pre>~/llama.cpp/build/bin/llama-server \\
12873  -m "/run/media/aivisions-lab-studio/NVMe/models/qwen3/Qwen3-4B-Q4_K_M.gguf" \\
12874  --host 0.0.0.0 --port 8081 \\
12875  -ngl 99 -t 24</pre>
12876</div>
12877
12878<h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">2. Génération d'images (Flux Schnell) — Secrets contre le plantage de GNOME</h4>
12879<div class="code">
12880  <span class="code-lang">bash</span>
12881  <pre>~/stable-diffusion.cpp/build/bin/sd-server \\
12882  --listen-ip 0.0.0.0 --listen-port 7860 \\
12883  --diffusion-model /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/flux1-schnell-q4_k.gguf \\
12884  --vae /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/ae.safetensors \\
12885  --clip_l /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/clip_l.safetensors \\
12886  --t5xxl /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/t5xxl_fp16.safetensors \\
12887  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre>
12888</div>
12889<p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-top:.35rem">
12890  💡 <strong>Flags critiques :</strong> Le paramètre <code>--vae-tiling</code> est strictement obligatoire. Sans lui, le décodage du VAE dépasse la limite de mémoire physique et bloque l'environnement graphique GNOME. Évitez d'utiliser <code>--backend vulkan0</code> pour ce modèle lourd sous Linux, car cela génère des bugs de contexte perdus.
12891</p>
12892
12893<h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">3. Transcription rapide d'audio via whisper.cpp</h4>
12894<div class="code">
12895  <span class="code-lang">bash</span>
12896  <pre>~/whisper.cpp/build/bin/whisper-cli \\
12897  -m ~/whisper.cpp/models/ggml-large-v3-turbo.bin \\
12898  -f "/chemin/vers/audio.wav" \\
12899  -l pt --output-txt</pre>
12900</div>
12901
12902<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Services et conteneurs Docker tournant en parallèle</h3>
12903<div class="tbl">
12904  <table>
12905    <thead>
12906      <tr>
12907        <th>Conteneur actif</th>
12908        <th>Image de base</th>
12909        <th>Port mappé</th>
12910        <th>Finalité</th>
12911      </tr>
12912    </thead>
12913    <tbody>
12914      <tr>
12915        <td><strong>open-webui</strong></td>
12916        <td>ghcr.io/open-webui/open-webui:main</td>
12917        <td>3000 -> 8080</td>
12918        <td>Panneau unifié de Chat avec LLM et rendu SD</td>
12919      </tr>
12920      <tr>
12921        <td><strong>portainer</strong></td>
12922        <td>portainer/portainer-ce</td>
12923        <td>9000</td>
12924        <td>Gestion visuelle des processus et piles Docker</td>
12925      </tr>
12926      <tr>
12927        <td><strong>searxng</strong></td>
12928        <td>searxng/searxng:latest</td>
12929        <td>8080</td>
12930        <td>Moteur de recherche privé pour les réponses ancrées d'IA</td>
12931      </tr>
12932    </tbody>
12933  </table>
12934</div>
12935
12936<div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4">
12937  <h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Leçons autonomes apprises sous Linux</h4>
12938  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7">
12939    <strong>ROCm abandonné :</strong> Les cartes GCN4 / Polaris comme la RX 580 ne sont plus prises en charge par le SDK ROCm officiel. Tenter d'exécuter Ollama officiel via GPU Docker dessus échouera. La voie royale est d'exécuter <strong>Ollama sur le CPU Xeon</strong> ou d'utiliser le <strong>llama-server natif compilé avec Vulkan</strong> ! Docker ne doit être utilisé que pour les frontends et les serveurs secondaires légers.
12940  </p>
12941</div>`},llama:{id:"llama",title:"07. COMPILAÇÃO DO LLAMA.CPP (BACKEND VULKAN)",desc:"Guide étape par étape avec les commandes maîtres pour générer les binaires LLM optimisés pour la RX 580.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["llamacpp","vulkan-acceleration","compilacao-cpp"],last_reviewed:"2026-07-01",relationships:{prerequisites:["jornada"],previous:"jornada",next:"sdcpp",related:["modelos","limit_qwen_35b"]}},html:`<div class="note">⚠ Assurez-vous d'exécuter les commandes ci-dessous exclusivement dans le <strong>Developer PowerShell de Visual Studio</strong></div>
12942  <div class="code"><pre># Naviguer vers la partition haute vitesse et cloner le dépôt officiel
12943cd E:\\
12944git clone https://github.com/ggerganov/llama.cpp
12945cd llama.cpp
12946
12947# Instancier le répertoire de build en injectant le flag de compilation du backend Vulkan
12948cmake -B build -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
12949
12950# Lancer la compilation en utilisant 20 threads parallèles du processeur Xeon
12951cmake --build build --config Release -j20</pre></div>
12952  <h4 class="s" style="margin-top:1rem;margin-bottom:.5rem;color:#fff">Commande de validation du périphérique d'accélération</h4>
12953  <div class="code"><pre>cd build\\bin\\Release
12954.\\llama-cli.exe --list-devices
12955# Retour attendu de la console : Vulkan0: AMD Radeon RX 580 2048SP ✅</pre></div>`},meta:{id:"meta",title:"36. REFERÊNCIAS E METADADOS DO DOCUMENTO",desc:"Analyse technique du cycle de vie physique du matériel hérité et philosophie de réutilisation du laboratoire.",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"metadados",difficulty:"beginner",estimated_time_min:10,tags:["silicon-governance","metadata-specs","efficie
12955ncy-telemetry"],last_reviewed:"2026-07-01",relationships:{prerequisites:["arquivos"],previous:"arquivos",next:"linhatempo",related:["arquivos","proximos"]}},html:`<blockquote style="font-size:.9rem;color:#94a3b8;font-style:italic;line-height:1.9;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">
12956    "L'obsolescence programmée commerciale est un choix de marché, pas une barrière d'ingénierie. Le matériel hérité ne meurt pas ; il est libéré par le logiciel approprié."
12957  </blockquote>
12958  <div class="tbl" style="margin-top:.9rem"><table>
12959    <thead><tr><th>Métadonnée du système</th><th>Registre d'audit</th></tr></thead>
12960    <tbody>
12961      <tr><td>Version du déploiement</td><td>VULKAN_DEPLOY_V3.0_COMPLETO</td></tr>
12962      <tr><td>Année du registre</td><td>Historique consolidé // Saison 2026</td></tr>
12963      <tr><td>Portée de l'auteur</td><td>Architecture de systèmes Black Tuxedo AI Solutions</td></tr>
12964    </tbody>
12965  </table></div>`},modelos:{id:"modelos",title:"09. CONVERSÃO DE MODELOS PARA FORMATO GGUF",desc:"Optimisation et quantization des fichiers .safetensors standard au format accepté par le moteur ggml.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"quantizacao",difficulty:"intermediate",estimated_time_min:15,tags:["gguf","quantizacao-modelos","vram-8gb"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdcpp"],previous:"sdcpp",next:"sdserver",related:["llama","comfyui-modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.9rem">Les runtimes optimisés en C++ de <code>stable-diffusion.cpp</code> exigent le format de fichier structuré en <code style="color:var(--r)">.gguf</code>. Les modèles traditionnels téléchargés depuis Civitai (.safetensors) doivent passer par le convertisseur natif :</p><div class="code"><pre># Commande pour conversion directe et application de quantization stable en 8-bits (q8_0)
12966.\\sd-cli.exe -M convert -m "E:\\models\\DreamShaper_8.safetensors" -o "E:\\models\\dreamshaper8.gguf" --type q8_0</pre></div><div class="code ok" style="margin-top:.75rem"><pre># Log de fin de processus :
12967[INFO] convert 'DreamShaper_8.safetensors' to 'dreamshaper8.gguf' success ✅</pre></div>`},prereqs:{id:"prereqs",title:"05. PRÉ-REQUISITOS DO SISTEMA",desc:"Outils nécessaires pour compiler les binaires ouverts et démarrer les serveurs locaux.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"dependencias",difficulty:"intermediate",estimated_time_min:20,tags:["cmake","git","msvc-compiler","gcc","vulkan-sdk"],last_reviewed:"2026-07-01",relationships:{prerequisites:["solucao"],previous:"solucao",next:"jornada",related:["llama","sdcpp"]}},html:`<div class="c2"><div class="card"><p style="font-size:.58rem;color:var(--r);text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">⚠ ENVIRONNEMENT DE COMPILATION (GPU)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">Developer PowerShell de VS</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">S'ouvre via le Menu Démarrer → "Developer PowerShell for VS 2022"</p></div><div class="card"><p style="font-size:.58rem;color:#22c55e;text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">✅ ENVIRONNEMENT D'EXÉCUTION (RUNTIME)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">PowerShell Standard de Windows</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">Exécute les binaires finaux compilés sans overhead de l'écosystème dev</p></div></div><div class="tbl" style="margin-top:1rem"><table><thead><tr><th>Software / SDK</th><th>Version Homologuée</th><th>Notes de Configuration Essentielles</th></tr></thead><tbody><tr><td>Visual Studio Community</td><td>2022 ou 2026</td><td>Obligatoire de cocher la charge de travail : "Développement Desktop en C++"</td></tr><tr><td>CMake Compiler</td><td>v4.3.2+</td><td>Disponible sur cmake.org. Penser à cocher : "Add CMake to system PATH"</td></tr><tr><td>Vulkan SDK</td><td>v1.4.341.1</td><td>Télécharger via LunarG. Installation standard obligatoirement dans <code>C:\\VulkanSDK\\</code></td></tr><tr><td>Git Windows</td><td>Dernière stable</td><td>Installeur officiel pour le clonage des dépôts open-source</td></tr><tr><td>Docker Desktop</td><td>v4.x+</td><td>Nécessaire pour faire tourner l'écosystème OpenWebUI et pipelines auxiliaires comme SearXNG</td></tr><tr><td>WSL2 Subsystem</td><td>Ubuntu 22.04.5 LTS</td><td>Base d'exécution stable pour l'environnement Python de ComfyUI et Ollama</td></tr><tr><td>Miniconda Linux</td><td>Branche Python 3.11</td><td>Gestionnaire de paquets isolé tournant dans le sous-système Linux WSL2</td></tr></tbody></table></div><div class="code"><pre># Commandes de validation de l'environnement de compilation
12968cmake --version
12969# Retour attendu : cmake version 4.3.2 ✅
12970
12971dir C:\\VulkanSDK
12972# Retour attendu : affichage du répertoire de la version 1.4.341.1 ✅</pre></div>`},proving_hypothesis_35b:{id:"proving_hypothesis_35b",title:"42. PROVANDO A HIPÓTESE: CURL, CTX-SIZE 8192 E A PRIMEIRA RESPOSTA COMPLETA",desc:"Continuação direta da Seção 33 · 3 testes · Hipótese confirmada · Hardware de 2017",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:35,tags:["context-length","offloading-layer","matematica-tensores"],last_reviewed:"2026-07-01",relationships:{prerequisites:["limit_qwen_35b"],previous:"limit_qwen_35b",next:"sdxl_vulkan",related:["limit_qwen_35b","cpu"]},part:1},html:`<div class="whisper-doc">
12973  <div class="hero">
12974    <div class="hero-title"><span>Provando a Hipótese</span> — Qwen3.5 35B</div>
12975    <div class="hero-sub">Experimentos conclusivos validando preenchimento de contexto, timeouts de cliente e comparação Q4_K_M vs Q6_K no silício de 2017.</div>
12976    <div class="hero-badges">
12977      <span class="badge badge-gpu">AMD RX 580 8GB</span>
12978      <span class="badge badge-win">Xeon E5-2690 v3</span>
12979      <span class="badge badge-ok">Hipótese Provada</span>
12980      <span class="badge badge-ok">--ctx-size 8192</span>
12981      <span class="badge badge-win">Q4_K_M vs Q6_K</span>
12982    </div>
12983  </div>
12984
12985  <div class="stat-grid">
12986    <div class="stat">
12987      <div class="stat-label">Velocidade (Q4_K_M)</div>
12988      <div class="stat-value">6.42 - 6.65 tok/s</div>
12989      <div class="stat-sub">Sem Swap Ativo</div>
12990    </div>
12991    <div class="stat">
12992      <div class="stat-label">Contexto Provado</div>
12993      <div class="stat-value">8.192 tokens</div>
12994      <div class="stat-sub">Acomoda modo de Raciocínio</div>
12995    </div>
12996    <div class="stat">
12997      <div class="stat-label">Temperatura Máxima</div>
12998      <div class="stat-value">74°C</div>
12999      <div class="stat-sub">10°C mais frio com Q4_K_M</div>
13000    </div>
13001    <div class="stat">
13002      <div class="stat-label">Status do Hardware</div>
13003      <div class="stat-value">100% Aprovado</div>
13004      <div class="stat-sub">Zero crashes / 4 slots paralelos</div>
13005    </div>
13006  </div>
13007
13008  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.0 — Contexto e Motivação</h3>
13009  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
13010    A Seção 33 terminou com uma hipótese clara: <em>"O problema nunca foi o hardware. Foi a combinação de thinking + web search esgotando os 4.096 tokens de contexto. Com prompt curto e sem web search, o Qwen3.5-35B Q6_K responde normalmente numa RX 580 de 2017."</em>
13011  </p>
13012  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
13013    Em 16 de junho de 2026, o AIVisionsLab executou os testes pendentes sugeridos para provar essa hipótese ao vivo, avaliando o comportamento com curl direto (sem timeout do cliente), habilitando a flag de tamanho de contexto ampliado e testando quantizações mais eficientes.
13014  </blockquote>
13015
13016  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.1 — Hardware do Laboratório</h3>
13017  <div class="tbl">
13018    <table>
13019      <thead>
13020        <tr>
13021          <th>Componente</th>
13022          <th>Especificação</th>
13023        </tr>
13024      </thead>
13025      <tbody>
13026        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 cores / 24 threads · 3,05 GHz turbo (Lançado em 2014)</td></tr>
13027        <tr><td><strong>RAM</strong></td><td>31,8 GB DDR4 REG ECC (quad-channel)</td></tr>
13028        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (Lançado em 2017)</td></tr>
13029        <tr><td><strong>Storage NVMe</strong></td><td>SSD NVMe (Disco E:) — modelos GGUF (Leitura de 1.7–3.5 GB/s)</td></tr>
13030        <tr><td><strong>Storage HDD</strong></td><td>HDD (Disco C: / F:) — sistema Windows + swap</td></tr>
13031        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — lançado em 20/05/2026</td></tr>
13032        <tr><td><strong>Sistema</strong></td><td>Windows 10 Pro com WSL2 activo</td></tr>
13033      </tbody>
13034    </table>
13035  </div>
13036
13037  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.2 — Modelos Testados</h3>
13038  <div class="tbl">
13039    <table>
13040      <thead>
13041        <tr>
13042          <th>Modelo</th>
13043          <th>Quantização</th>
13044          <th>Tamanho do Arquivo</th>
13045          <th>Parâmetros da Arquitetura</th>
13046        </tr>
13047      </thead>
13048      <tbody>
13049        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q6_K</strong></td><td>6 bits</td><td>28,51 GB</td><td>34,66B (MoE)</td></tr>
13050        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M</strong></td><td>4 bits (Medium)</td><td><strong>21,17 GB</strong></td><td>34,66B (MoE)</td></tr>
13051        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q5_K_M</strong></td><td>5 bits (Medium)</td><td>24,76 GB</td><td>34,66B (MoE)</td></tr>
13052      </tbody>
13053    </table>
13054  </div>
13055  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
13056    *Nota: Todos os modelos possuem arquitetura idêntica de Mixture of Experts (MoE), variando apenas a compressão matemática de seus pesos.
13057  </p>
13058
13059  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.3 — Localizando os Executáveis</h3>
13060  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
13061    Antes de testar, foi necessário localizar as compilações otimizadas do <code>llama-server</code>. No PowerShell do laboratório:
13062  </p>
13063  <div class="cmd">Get-ChildItem -Path E:\\ -Recurse -Filter "llama-server.exe" -ErrorAction SilentlyContinue
13064 
13065# Resultado:
13066E:\\llama.cpp\\llama-server.exe (stub de 9KB)
13067E:\\llama.cpp\\build\\bin\\Release\\llama-server.exe (Executável real de 7.5MB) ◀</div>
13068
13069  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.4 — Teste 9: Curl Direto Sem Timeout</h3>
13070  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.1 — Motivação</h4>
13071  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
13072    Identificar se o gargalo de timeout relatado no Teste 4 residia no servidor ou estritamente nas requisições AJAX do cliente OpenWebUI.
13073  </p>
13074
13075  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.2 — Inicialização do Servidor</h4>
13076  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
13077.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --port 8081</div>
13078
13079  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.3 — Resolvendo Escaping de JSON no PowerShell</h4>
13080  <div class="cmd">'{"model":"any","messages":[{"role":"user","content":"Explique MoE em 3 paragrafos"}]}' | Out-File -Encoding utf8 -FilePath "E:\\teste.json"</div>
13081
13082  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.4 — Executando a Chamada de Longa Duração</h4>
13083  <div class="cmd">curl.exe -X POST http://localhost:8081/v1/chat/completions -H "Content-Type: application/json" --max-time 600 -d "@E:\\teste.json"</div>
13084
13085  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.5 — Resultado Analítico</h4>
13086  <div class="cmd">truncated = 0  ◀ RESPOSTA COMPLETA ENTREGUE COM SUCESSO
13087total time = 266.42 s / 1955 tokens
13088eval time  = 255.97 s / 1683 tokens @ 6.57 t/s</div>
13089  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
13090    <strong>Veredicto técnico:</strong> O hardware de 2017 processou e entregou a resposta perfeitamente! O problema anterior era o tempo limite do navegador desistindo da conexão TCP, enquanto o servidor continuava gerando em background.
13091  </p>
13092
13093  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.5 — Paralelismo Real: 4 Slots de Computação</h3>
13094  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
13095    Durante o Teste 9, o OpenWebUI foi conectado paralelamente disparando a mesma pergunta. O motor de agendamento do llama.cpp processou de forma concorrente sem travamentos:
13096  </p>
13097  <div class="cmd">Task 0 (curl)      — n_decoded = 1125, tg = 5.96 t/s
13098Task 875 (OpenWebUI) — n_decoded = 243,  tg = 5.08 t/s</div>
13099<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
13100    A arquitetura resistiu de forma estável (GPU: 63°C, VRAM: 7.1/8.0 GB, RAM: 91% de uso de sistema total seguro, sem travar o Windows).
13101  </p>
13102
13103  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.6 — Teste 7: Habilitando Contexto Extremo (--ctx-size 8192)</h3>
13104  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.1 — O Comando Otimizado</h4>
13105  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
13106.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --p
13106ort 8081 --ctx-size 8192</div>
13107
13108  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.2 — Prompt de Teste e Comportamento do Thinking</h4>
13109  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">
13110    "Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."
13111  </blockquote>
13112  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
13113    Ao receber o prompt, o processador de pensamento rodou por longos 9 minutos em background na CPU trabalhando com o contexto de 8192 tokens. A análise interna destrinchou a matemática da VRAM (calculou que 35B em INT4 exige 17,5GB de peso puro) para desvendar as complexidades de esparsidade de ativação.
13114  </p>
13115
13116  <h4 style="color:rgba(225,29,72,0.9);font-weight:700;font-size:0.95rem;margin-top:2rem;margin-bottom:0.5rem">34.6.2-A — O Raciocínio Interno do Modelo: Análise Comparativa dos Três Thinking Blocks</h4>
13117  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
13118    Durante as exaustivas sessões de ensaio das Seções 33 e 34, o Qwen3.5-35B gerou três blocos independentes de raciocínio de bastidores (<code>&lt;think&gt;</code>) que foram capturados via interceptação direta de pacotes brutos. A tabulação e o mapeamento sistemático dessas sessões fornecem evidências fundamentais de análise cognitiva do modelo:
13119  </p>
13120
13121  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">1. Thinking Block 1 — Quantização Q6_K — Sessão 1 (23:06 de 15/06)</h5>
13122  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
13123    <strong>Prompt:</strong> <em>"Explique detalhadamente o mecanismo de atenção nos Transformers e por que MoE é mais eficiente que modelos densos."</em><br>
13124    <strong>Tempo de Raciocínio:</strong> ~4 minutos | <strong>Tokens do Bloco:</strong> ~2.000 | <strong>Status:</strong> ✅ Concluído com Sucesso.
13125  </p>
13126  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
13127    <span style="color:#e11d48">// Linha de Pensamento do Qwen3.5 (Q6_K):</span><br>
13128    - Deconstruct query into structured chunks: Attention math, Multi-head, MoE, benefits vs dense.<br>
13129    - Detail Attention: Focus on Scaled Dot-Product mathematical formulation (Q, K, V). Show why division by sqrt(d_k) is required to prevent vanishing gradients during Softmax.<br>
13130    - Explain Multi-Head as parallel subspace projections (capturing both strict syntactic dependencies and semantic references).<br>
13131    - Deconstruct MoE: Discuss role of Router/Gating network, Routing sparsity (top-k selection), and load balancing to prevent routing collapse (unused experts).<br>
13132    - <span style="color:#a3e635">[Autocorreção Interna]</span>: "Wait, I must check if MoE is always faster. I should explicitly note that MoE is memory-intensive for routing/loading but highly sparse computationally. If memory bandwidth is bottlenecked under dual-system offloading, token generation speed depends strongly on mmap performance."
13133  </div>
13134
13135  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">2. Thinking Block 2 — Quantização Q4_K_M — Sessão 2 (05:05 de 16/06)</h5>
13136  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
13137    <strong>Prompt:</strong> <em>"Qual a diferença entre MoE e modelo denso, e por que MoE permite rodar 35B numa GPU de 8GB?"</em><br>
13138    <strong>Tempo de Raciocínio:</strong> ~11 minutos | <strong>Tokens do Bloco:</strong> ~3.500 | <strong>Status:</strong> ❌ Interrompido por esgotamento de contexto (Límite 4096).
13139  </p>
13140  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
13141    <span style="color:#e11d48">// Linha de Pensamento do Qwen3.5 (Q4_K_M):</span><br>
13142    - Analysis of premise: Running 35 billion parameter model in 8GB VRAM.<br>
13143    - <span style="color:#f43f5e">
13143[Cálculo Físico Espontâneo]</span>:<br>
13144      * FP32 weights: 35B * 4 bytes = 140 GB. Impossible.<br>
13145      * FP16 weights: 35B * 2 bytes = 70 GB. Impossible.<br>
13146      * INT8 quant:  35B * 1 byte = 35 GB. Impossible.<br>
13147      * INT4 quant:  35B * 0.5 bytes = 17.5 GB. Still larger than 8GB. This doesn't fit natively.<br>
13148    - Challenge the premise: "Wait, if the model indeed runs on 8GB, there must be extreme offloading, sparse activation memory loading, or aggressive hybrid quantization."<br>
13149    - <span style="color:#a3e635">[Autocorreção Crítica]</span>: "Ah! The user says 'por que o MoE permite rodar'. But actually, MoE weights are typically larger than equivalent dense models. A 35B MoE has 35B total parameters but only roughly 6B-8B active parameters per token. If we offload the inactive experts to system memory (RAM/mmap swap) and only load the active experts or the shared dense blocks onto the GPU, then the GPU memory footprint during active tensor computation is massively reduced. Let me structure this hypothesis."<br>
13150    - <span style="color:#d946ef">[Análise Meta-Arquitetural]</span>: Elaborating on the split mechanism. Router stays in VRAM for instant routing, shared blocks in VRAM, active experts fetched from RAM dynamically during forward pass.
13151  </div>
13152  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
13153    <em>Nota Conclusiva de Engenharia:</em> Enquanto o modelo formulava esse raciocínio fascinante na CPU, ele estava descrevendo em profundidade matemática exatamente o sistema de mmap distribuído e a arquitetura Vulkan de 4 níveis de memória que o sustentava em tempo real — sem possuir acesso direto aos metadados do container ou ao sistema de arquivos do laboratório.
13154  </p>
13155
13156  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">3. Thinking Block 3 — Quantização Q4_K_M — Sessão 2 (05:24 de 16/06)</h5>
13157  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
13158    <strong>Prompt:</strong> <em>"Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."</em><br>
13159    <strong>Tempo de Raciocínio:</strong> ~9 minutos | <strong>Tokens do Bloco:</strong> ~3.000 | <strong>Status:</strong> ✅ Concluído com Sucesso (--ctx-size 8192).
13160  </p>
13161  <div style="background:#090a0f;border:1px solid rgba(34,197,94,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a3e635;margin-bottom:1rem">
13162    <span style="color:#a3e635">// Linha de Pensamento do Qwen3.5 (Q4_K_M com limite otimizado):</span><br>
13163    - Prompt requests: Portuguese, direct, concise.<br>
13164    - Challenge VRAM claim again internally: MoE total size is bigger than dense, but active size is smaller. VRAM savings must come from smaller activation graphs (fewer experts evaluated simultaneously) and CPU-offloaded weight mapping.<br>
13165    - Work step-by-step to compress explanation to fit "direto e conciso":<br>
13166      * <span style="color:#cbd5e1">Rascunho v1:</span> Long theoretical detail on Router and CPU/VRAM exchange metrics.<br>
13167      * <span style="color:#cbd5e1">Refinamento v2:</span> Cut down router math, focus on "Ativação Esparsa" (activation memory bounds).<br>
13168      * <span style="color:#cbd5e1">Compressão Final:</span> Produce 3 crisp, highly readable Portuguese bullet points summarizing Active Parameters, Activation Garty/Memory limit, and Compute Scalability.
13169  </div>
13170<h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">Tabela Comparativa de Comportamento Cognitivo</h5>
13171  <div class="tbl">
13172    <table>
13173      <thead>
13174        <tr>
13175          <th>Métrica de Profiling</th>
13176          <th>Sessão 1 (Q6_K)</th>
13177          <th>Sessão 2-A (Q4_K_M)</th>
13178          <th>Sessão 2-B (Q4_K_M / ctx 8192)</th>
13179        </tr>
13180      </thead>
13181      <tbody>
13182        <tr><td><strong>Duração do Raciocínio</strong></td><td>~4 minutos</td><td><strong>~11 minutos</strong></td><td>~9 minutos</td></tr>
13183        <tr><td><strong>Volume do Bloco &lt;think&gt;</strong></td><td>~2.000 tokens</td><td><strong>~3.500 tokens</strong></td><td>~3.000 tokens</td></tr>
13184        <tr><td><strong>Autocorreções Efetuadas</strong></td><td>2</td><td><strong>7 (Autocorreções profundas)</strong></td><td>4 (Foco em concisão)</td></tr>
13185        <tr><td><strong>Questionamento de Premissa?</strong></td><td>Não</td><td><strong>✅ Sim (Provou erro matemático do prompt)</strong></td><td>Sim (reajuste técnico)</td></tr>
13186        <tr><td><strong>Raciocínio Matemático</strong></td><td>Equação Transformers</td><td><strong>Cálculo do tamanho de pesos reais</strong></td><td>Cálculo de buffers de ativação</td></tr>
13187        <tr><td><strong>Entrega do Texto</strong></td><td>✅ Sucesso</td><td>❌ Estouro (4096 esgotados)</td><td><strong>✅ Sucesso Absoluto (Zero cortes)</strong></td></tr>
13188      </tbody>
13189    </table>
13190  </div>
13191
13192  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.8 — Cronograma Histórico do Laboratório</h3>
13193  <div class="tbl">
13194    <table>
13195      <thead>
13196        <tr>
13197          <th>Sessão do Experimento</th>
13198          <th>ID</th>
13199          <th>Parâmetros de Ctx</th>
13200          <th>Geração (tok/s)</th>
13201          <th>Corte de Fluxo (truncated)</th>
13202          <th>Resultado Efetivo</th>
13203        </tr>
13204      </thead>
13205      <tbody>
13206        <tr><td>Seção 34 — Teste 5</td><td>Q6_K</td><td>4096 tokens</td><td>5,57 t/s</td><td>0 (prompt enxuto)</td><td>✅ Resposta entregue (contexto enxuto)</td></tr>
13207        <tr><td>Seção 34 — Teste 9 (curl)</td><td>Q4_K_M</td><td>4096 tokens</td><td><strong>6,57 t/s</strong></td><td>0 (sem timeout)</td><td>
13207✅ Resposta integral por canal direto</td></tr>
13208        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Seção 34 — Teste 7 (WebUI)</strong></td><td>Q4_K_M</td><td>8192 tokens</td><td>6,42 t/s</td><td>0</td><td>✅ Resposta completa com raciocínio expandido</td></tr>
13209      </tbody>
13210    </table>
13211  </div>
13212
13213  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.9 — Nova Coleção de Lições Técnicas Consolidadas</h3>
13214  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
13215    <li><strong style="color:#fff">Lição 6 — O fator Timeout do Cliente:</strong> A maior parte dos erros apontados por testadores não decorre de incapacidade física da GPU, mas sim da persistência HTTP falha de interfaces que desistem antes da decodificação final.</li>
13216    <li><strong style="color:#fff">Lição 7 — Ajuste de Buffers de Contexto:</strong> Ativar a diretiva <code>--ctx-size 8192</code> remove o limite asfixiante do buffer de raciocínio, oferecendo fôlego de processamento para os mais de 3.500 tokens exigidos de raciocínio lógico interno.</li>
13217    <li><strong style="color:#fff">Lição 8 — Supremacia de Carregamento da Quantização Média:</strong> Rodar 35B com quantização de 4 bits economiza 7GB cruciais na carga física de RAM da CPU, reduzindo o I/O do Swap do disco e otimizando a temperatura.</li>
13218    <li><strong style="color:#fff">Lição 9 — Raciocínio de Modelo Crítico:</strong> O Qwen3.5 MoE questionou a premissa errônea presente no prompt, calculando pesos em tempo real e rebatendo sobre o offloading híbrido, o que prova comportamento de atenção e alinhamento impecáveis.</li>
13219    <li><strong style="color:#fff">Lição 10 — Paralelismo nativo estável:</strong> A coexistência de chamadas em canais concorrentes prova a maturidade das implementações de pipeline de shaders Vulkan no llama.cpp.</li>
13220  </ul>
13221
13222  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.10 — Setup Recomendado para Implementações Futuras</h3>
13223  <div class="cmd"># Script do Laboratório para inicialização de produção
13224cd E:\\llama.cpp\\build\\bin\\Release
13225 
13226.\\llama-server.exe \`
13227  -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" \`
13228  --host 0.0.0.0 \`
13229  --port 8081 \`
13230  --ctx-size 8192</div>
13231  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
13232    *Instruções de interface complementares: Desativação estrita de Web Search e geração e imagens durante o processamento híbrido extremo.
13233  </p>
13234
13235  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.11 — Veredicto Geral do Laboratório (Provando a Hipótese)</h3>
13236  <div class="tbl">
13237    <table>
13238      <thead>
13239        <tr>
13240          <th>Questão de Engenharia</th>
13241          <th>Veredicto Final</th>
13242        </tr>
13243      </thead>
13244      <tbody>
13245        <tr><td><strong>O curl resolve o timeout do OpenWebUI?</strong></td><td>✅ <strong>Sim</strong> (truncated = 0, resposta 100% íntegra)</td></tr>
13246        <tr><td><strong>CTX-SIZE de 8.192 resolve o thinking mode esmagado?</strong></td><td>✅ <strong>Sim</strong> (Acomoda com folga raciocínios longos)</td></tr>
13247        <tr><td><strong>Q4_K_M é superior para o cenário de 32GB de RAM?</strong></td><td>✅ <strong>Sim</strong> (Mais rápido, mais frio, menor swap)</td></tr>
13248        <tr><td><strong>A hipótese de esgotamento de contexto foi confirmada?</strong></td><td>✅ <strong>Absolutamente</strong></td></tr>
13249        <tr><td><strong>Sobrecusto financeiro para otimização em 2026?</strong></td><td>✅ <strong>R$ 0,00</strong> (Solução lógica via flags)</td></tr>
13250      </tbody>
13251    </table>
13252  </div>
13253
13254  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.12 — Tags e Metadados</h3>
13255  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
13256    <div>🏷️ <strong>Tags:</strong> curl, ctx-size, timeout, openwebui, q4km, q6k, paralelismo, thinking-mode, resposta-completa, hipotese-confirmada, rx580</div>
13257    <div style="margin-top:0.5rem">💻 <strong>Hardware:</strong>
13257 RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
13258    <div style="margin-top:0.25rem">💿 <strong>Software:</strong> llama.cpp (build\\bin\\Release) + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
13259    <div style="margin-top:0.25rem">📅 <strong>Data:</strong> 16/06/2026</div>
13260    <div style="margin-top:0.25rem">📊 <strong>Testes:</strong> 3 (Teste 9 curl, paralelismo real, Teste 7 ctx8192)</div>
13261    <div style="margin-top:0.25rem">📈 <strong>Benchmark:</strong> 6,42–6,65 tok/s (Q4_K_M) | truncated = 0</div>
13262    <div style="margin-top:0.25rem">🔥 <strong>Temperatura pico:</strong> 74°C</div>
13263    <div style="margin-top:0.25rem">🏆 <strong>Status final:</strong> ✅ HIPÓTESE CONFIRMADA</div>
13264  </div>
13265
13266  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
13267    "O problema nunca foi o hardware. Era uma flag e um timeout."<br>
13268    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 16/06/2026</span>
13269  </blockquote>
13270
13271  <div class="footer">
13272    Documentação gerada por Claude Sonnet 4.6 — 16/06/2026 · Baseada em logs reais, screenshots e benchmarks ao vivo · 3 testes documentados · Hipótese confirmada · Hardware de 2017 processando IA de 2025
13273  </div>
13274</div>`},proximos:{id:"proximos",title:"34. PRÓXIMOS PASSOS (ROADMAP 2027)",desc:"Prochains objectifs de développement : Clusters Multi-GPU Vulkan et mesh local d'agents autonomes.",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"planejamento",difficulty:"beginner",estimated_time_min:10,tags:["roadmap-2027","planejamento-tecnico","novas-verticais"],last_reviewed:"2026-07-01",relationships:{prerequisites:["codacus"],previous:"codacus",next:"arquivos",related:["jornada","meta"]}},html:`<div class="card" style="border-left:3px solid #22c55e"><p style="font-size:.88rem;color:#fff;font-weight:600">Planification de l'Expansion de l'Infrastructure Informatique :</p><ul style="padding-left:1.2rem;margin-top:.45rem;font-size:.85rem;color:#94a3b8;line-height:2"><li><strong style="color:#fff">[ ] Homologation de Cluster Multi-GPU :</strong> Couplage d'une seconde carte graphique RX 580 en parallèle via Vulkan pour la distribution des tenseurs de poids.</li><li><strong style="color:#fff">[ ] Mapping d'Agents Locaux Autonomes :</strong> Intégration complète du framework CrewAI tournant nativement sur l'API d'OpenWebUI pour l'automatisation en entreprise.</li></ul></div>`},scripts:{id:"scripts",title:"21. SCRIPTS E AUTOMAÇÃO",desc:"Scripts batch pour nettoyer la mémoire vidéo et initialiser les serveurs locaux sans conflits.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:15,tags:["reboot-stack","memory-flush","manutencao-servidor"],last_reviewed:"2026-07-01",relationships:{prerequisites:["stack"],previous:"stack",next:"guia",related:["reboot_stack","sd_bat_automation"]}},html:`<h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">19.A — Script Master (Tous les Services)</h4><div class="code"><span class="code-lang">batch</span><pre>@echo off
13275title INFRASTRUCTURE IA - REBOOT STACK
13276cls
13277echo Fermeture forcée des instances actives en arrière-plan...
13278taskkill /F /IM sd-server.exe 2>nul
13279taskkill /F /IM llama-server.exe 2>nul
13280timeout /t 2 /nobreak >nul
13281
13282echo Initialisation du LLM via Vulkan sur RX 580 (port 8081)...
13283start "LLM Server - Vulkan RX580" C:\\llama.cpp\\build\\bin\\Release\\llama-server.exe ^
13284  -m "E:\\MODELO LLM PARA GPU\\Mistral-7B-Q4_K_M.gguf" ^
13285  --host 0.0.0.0 ^
13286  --port 8081 ^
13287  --device Vulkan0
13288
13289timeout /t 3 /nobreak >nul
13290
13291echo Initialisation du SD Server via Vulkan sur RX 580 (port 7860)...
13292E:
13293cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
13294sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
13295  -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
13296
13297pause</pre></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.B — Connecter le LLM à OpenWebUI</h4><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Après avoir démarré llama-server, connectez-le à OpenWebUI :</p><ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:.75rem"><li>Accédez à <code style="color:var(--r)">http://localhost:3000</code></li><li>Cliquez sur l'avatar → <strong style="color:#fff">Panneau d'Administration</strong></li><li>Allez dans <strong style="color:#fff">Paramètres → Connexions</strong></li><li>Dans la section <strong style="color:#fff">API OpenAI</strong> cliquez sur <strong style="color:#fff">"+"</strong></li><li>Remplissez les champs ci-dessous :</li></ol><div class="tbl"><table><thead><tr><th>
13297Champ</th><th>Valeur</th></tr></thead><tbody><tr><td>URL</td><td><code>http://host.docker.internal:8081/v1</code></td></tr><tr><td>API Key</td><td><code>sk-local</code></td></tr></tbody></table></div><ol start="6" style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-top:.75rem"><li>Cliquez sur l'icône <strong style="color:#fff">refresh</strong> — une bannière verte doit apparaître ✅</li><li>Sauvegarder</li></ol><div class="card" style="margin-top:.75rem;border-left:3px solid #eab308;padding-left:.9rem"><p style="font-size:.85rem;color:#94a3b8;line-height:1.8"><strong style="color:#eab308">⚠️ N'utilisez pas <code>127.0.0.1</code></strong> — Docker tourne sur un réseau WSL2 isolé et ne voit pas le localhost Windows. Utilisez toujours <code style="color:var(--r)">host.docker.internal</code>.</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.C — Validation dans le Chat</h4><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Après sauvegarde, ouvrez un <strong style="color:#fff">Nouveau Chat</strong> dans OpenWebUI :</p><ul style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem"><li>Le modèle <code style="color:var(--r)">Mistral-7B-Q4_K_M.gguf</code> apparaît dans la liste sous <strong style="color:#fff">Externe</strong></li><li>Sélectionnez-le et discutez normalement</li><li>Le modèle tourne à 100% sur la <strong style="color:#fff">RX 580 via Vulkan</strong> — pas sur Ollama</li></ul><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.D — Vérifier s'il est sur le GPU (pas CPU)</h4><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem">Dans le terminal llama-server, confirmez :</p><div class="code"><span class="code-lang">log</span><pre>ggml_vulkan: Found 1 Vulkan device(s)
13298ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
13299llama server listening at http://0.0.0.0:8081</pre></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:.75rem 0 .5rem 0">Et pendant l'inférence le benchmark apparaît :</p><div class="code"><span class="code-lang">log</span><pre>17.77 t/s  ← RX 580 Vulkan ✅</pre></div><div class="card" style="margin-top:.75rem"><p style="font-size:.85rem;color:#64748b;line-height:1.8">Si seul <code>3-5 t/s</code> apparaît sans la ligne <code>ggml_vulkan</code> — il tourne sur CPU. Vérifiez que <code style="color:var(--r)">--device Vulkan0</code> est dans la commande.</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.E — Trois Interfaces Disponibles</h4><div class="tbl"><table><thead><tr><th>Interface</th><th>URL</th><th>Quand l'utiliser</th></tr></thead><tbody><tr><td><strong style="color:#fff">UI native llama.cpp</strong></td><td><code>http://127.0.0.1:8081</code></td><td>Tests rapides directement dans le navigateur</td></tr><tr class="hig"><td><strong style="color:#fff">OpenWebUI</strong></td><td><code>http://localhost:3000</code></td><td>Usage quotidien avec historique et RAG</td></tr><tr><td><strong style="color:#fff">API directe</strong></td><td><code>http://192.168.15.68:8081/v1</code></td><td>Intégration avec d'autres apps</td></tr></tbody></table></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.F — Règles Critiques du Script</h4><div class="tbl"><table><thead><tr><th>Règle</th><th>Raison</th></tr></thead><tbody><tr class="hig"><td>Obligatoire <code>--host 0.0.0.0</code></td><td><code>127.0.0.1</code> bloque Docker</td></tr><tr class="hig"><td>Obligatoire <code>--device Vulkan0</code></td><td>Sans ça tombe sur CPU (3-5 t/s)</td></tr><tr><td><code>taskkill</code> avant de démarrer</td><td>Libère la VRAM des processus bloqués</td></tr><tr><td><code>host.docker.internal</code> dans OpenWebUI</td><td>Seule adresse que Docker voit sur l'hôte Windows</td></tr></tbody></table></div>`},sd_bat_automation:{id:"sd_bat_automation",title:"12. SD-SERVER LOCAL / BOOT SEQUENCE",de
13299sc:"Script batch dédié à l'initialisation sûre et reproductible du serveur IA.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:12,tags:["batch-automation","loop-monitoramento","gerenciamento-portas"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux_server"],previous:"flux_server",next:"sd_openwebui_integration",related:["scripts","reboot_stack"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Pour éviter les erreurs manuelles, les chemins incorrects ou les ports bloqués dans la VRAM lors du redémarrage de Windows, le serveur doit être démarré exclusivement via un fichier <code>.bat</code> sur le Bureau.</p><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Script de Production (iniciar_ia_server.bat) :</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px">@echo off
13300title Serveur Stable Diffusion Local - Production
13301cls
13302
13303:: 1. Nettoyage des processus fantômes dans VRAM/RAM
13304taskkill /f /im sd-server.exe 2>nul
13305taskkill /f /im sd-cli.exe 2>nul
13306timeout /t 2 /nobreak >nul
13307
13308:: 2. Saut de lecteur et route native (syntaxe CMD)
13309E:
13310cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
13311
13312:: 3. Exécution avec écoute ouverte pour Docker
13313sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
13314
13315pause</pre><div class="tbl" style="margin:1.25rem 0"><table><thead><tr><th>Règle</th><th>Raison</th></tr></thead><tbody><tr><td>Ne jamais utiliser <code>.\\</code> avant l'exécutable</td><td>Le CMD traditionnel ne le reconnaît pas — casse le terminal</td></tr><tr><td>Bloc <code>taskkill</code> obligatoire</td><td>Libère le port 7860 bloqué dans les processus d'arrière-plan</td></tr><tr><td>Saut de lecteur (<code>E:</code>) avant <code>cd</code></td><td>Le CMD ne change pas de lecteur sans le saut explicite</td></tr></tbody></table></div><div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;"><span style="color:#22c55e; font-weight:bold">✅ STATUT : AUTOMATISATION VALIDÉE EN PRODUCTION</span><br><span style="font-size:.8rem; color:#94a3b8">Double-clic sur le .bat initialise l'écosystème complet — nettoyage, route et bind de port en séquence</span></div>`},sd_openwebui_integration:{id:"sd_openwebui_integration",title:"13. INTEGRAÇÃO OPENWEBUI + DOCKER",desc:"Pont réseau entre le conteneur Docker OpenWebUI et le moteur C++ natif fonctionnant sur le GPU hôte.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"integracao",difficulty:"advanced",estimated_time_min:35,tags:["open-webui","docker-compose","networking-docker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_bat_automation"],previous:"sd_bat_automation",next:"comfyui-wsl",related:["sdserver","comfyui-wsl"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Lorsque le moteur de génération fonctionne en dehors du conteneur Docker, la communication locale standard (<code>127.0.0.1</code>) est bloquée par l'isolation réseau et le Pare-feu Windows. L'initialisation et la route doivent être explicites.</p><p style="font-size:.88rem;color:#fff;margin-bottom:.5rem">⚙️ <strong>Paramètres Critiques d'Initialisation</strong></p><div class="tbl" style="margin-bottom:1.25rem"><table><thead><tr><th>Flag</th><th>Valeur</th><th>Description</th></tr></thead><tbody><tr><td><code>--listen-ip</code></td><td><code>0.0.0.0</code></td><td>Ouvre l'écoute aux requêtes externes à l'hôte (Docker)</td></tr><tr><td><code>--listen-port</code></td><td><code>7860</code></td><td>Port d'intégration standard avec OpenWebUI</td></tr><tr><td><code>-m</code></td><td>chemin absolu</td><td>Modèle SD 1.5 / XL en <code>.safetensors</code> ou <code>.gguf</code></td></tr></tbody></table></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Commande de Production — SD 1.5 / DreamShaper :</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"</pre><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:1rem 0">⚠️ <strong style="color:#fff">Note d'Architecture :</strong> Les modèles Flux.1 ne sont pas compatibles avec ce build via le simple flag <code>-m</code> — ils retournent <code>[ERROR] main.cpp:92 - new_sd_ctx_t failed</code>. Pour Flux, utilisez la commande dédiée de la section 10.A avec les flags <code>--diffusion-model</code>, <code>--vae</code>, <code>--clip_l</code> et <code>--t5xxl</code> séparément.</p><p style="font-size:.88rem;color:#fff;margin-bottom:.75rem">🔌 <strong>Configuration de la Route dans OpenWebUI</strong></p><ol style="font-size:.88rem;color:#94a3b8;line-height:2;margin-left:1.25rem"><li>Accédez à <code>http://localhost:3000</code></li><li>Allez dans <strong>Paramètres &gt; Images</strong> (Panneau d'Administration)</li><li>Sélectionnez le moteur <strong>Automatic1111</strong></li><li>Entrez l'IP locale de la machine avec un <code>/</code> obligatoire à la fin :<br><code style="color:#22c55e">http://192.168.15.68:7860/</code></li><li>Cliquez sur <strong>Sauvegarder</strong>
13315 — une bannière verte confirmera le pont réseau</li></ol><div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin:1.25rem 0"><strong style="color:#ef4444;display:block;margin-bottom:.4rem">🔒 Libération Obligatoire dans le Pare-feu Windows Defender</strong><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem">Le Pare-feu Windows bloque silencieusement les connexions provenant du sous-réseau interne de Docker (<code>172.17.0.0/16</code>) et de WSL2 (<code>172.x.x.x</code>) par défaut. Sans cette règle, OpenWebUI ne peut pas atteindre sd-server même avec <code>--listen-ip 0.0.0.0</code> actif.</p><p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>Méthode 2 — PowerShell (une ligne, exécution en tant qu'Administrateur) :</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:10px;margin-bottom:.5rem">New-NetFirewallRule -DisplayName "sd-server AIVisionsLab" -Direction Inbound -Protocol TCP -LocalPort 7860 -Action Allow</pre><p style="font-size:.82rem;color:#94a3b8;margin:0"><strong>Validation :</strong> Après avoir créé la règle, redémarrez sd-server et essayez de générer une image via OpenWebUI. La bannière verte dans les paramètres d'images confirme le pont actif.</p></div>`},sdcpp:{id:"sdcpp",title:"08. COMPILAÇÃO DO STABLE-DIFFUSION.CPP",desc:"Génération du moteur propre en C++ pour le rendu d'images accéléré par GPU sans dépendances CUDA.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["sdcpp","stable-diffusion-cpp","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["llama"],previous:"llama",next:"modelos",related:["sdserver","flux_server"]}},html:`<div class="note">⚠ Compilation via <strong>Developer PowerShell</strong> · Exécution ultérieure via <strong>PowerShell Commun</strong></div><div class="code"><pre># Clonage structuré apportant tous les sous-modules de dépendance liés
13316git clone --recursive https://github.com/leejet/stable-diffusion.cpp
13317cd stable-diffusion.cpp
13318mkdir build
13319cd build
13320
13321# Mapper le compilateur en activant le moteur Vulkan et compiler les binaires en mode performance
13322cmake .. -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
13323cmake --build . --config Release -j20</pre></div><div class="code ok" style="margin-top:.75rem"><pre># Logs finaux de compilation réussie :
13324-- Found Vulkan: C:/VulkanSDK/1.4.341.1/Lib/vulkan-1.lib
13325[100%] Built target sd-server ✅</pre></div>`},sdserver:{id:"sdserver",title:"10. INICIALIZAÇÃO DO SERVIDOR SD-SERVER (GPU)",desc:"Activation du service d'image sur le port local pour écouter les appels API de l'interface graphique.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"intermediate",estimated_time_min:15,tags:["sd-server","api-rest","inferenca-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["modelos"],previous:"modelos",next:"flux_server",related:["sd_bat_automation","sd_openwebui_integration"]}},html:`<div class="note ok">✅ Initialisation homologuée : Exécutez ce bloc de code dans le <strong>PowerShell Commun</strong></div><div class="code"><pre># Démarrer le serveur en pointant vers le modèle quantifié et en définissant l'hôte d'écoute
13326E:\\stable-diffusion.cpp\\build\\bin\\Release\\sd-server.exe \\
13327  -m "E:\\models\\dreamshaper8.gguf" \\
13328  --host 0.0.0.0 \\
13329  --port 7860</pre></div><div class="code ok" style="margin-top:.75rem"><pre># Surveillance du terminal :
13330ggml_vulkan: Found 1 Vulkan device(s)
13331ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
13332Server listening on http://0.0.0.0:7860 ✅</pre></div>`},sdxl_vulkan:{id:"sdxl_vulkan",title:"26. SDXL & FLUX.1 VULKAN: ALTA RESOLUÇÃO NA POLARIS",desc:"Cartographie complète du défi de diffusion haute résolution (1024x1024) via Vulkan et déchargement structuré des tenseurs sur le silicium 8 Go.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:40,tags:["sdxl","vulkan-diffusion","segmentacao-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proving_hypothesis_35b"],previous:"proving_hypothesis_35b",next:"",related:["animatediff-video","flux-vulkan"]}},html:`<div class="page">
13333
13334  <div class="hero">
13335    <div class="hero-eyebrow">AIVisionsLab — Section 26</div>
13336    <div class="hero-title">SDXL 1024×1024 sur RX 580 via Vulkan :<br>le défi venu d'AMD et relevé en direct</div>
13337    <div class="hero-sub">AMD RX 580 8GB (2017) · stable-diffusion.cpp (leejet) · Vulkan · sans CUDA · sans ROCm · split hybride CPU/GPU · sortie photoréaliste confirmée</div>
13338  </div>
13339
13340  <div class="badges">
13341    <span class="badge badge-red">RX 580 · GCN 4th gen</span>
13342    <span class="badge badge-blue">Vulkan backend</span>
13343    <span class="badge badge-gray">stable-diffusion.cpp</span>
13344    <span class="badge badge-green">SDXL 1024×1024 ✓</span>
13345    <span class="badge badge-amber">split hybride CPU/GPU</span>
13346  </div>
13347
13348  <h2>Contexte : le défi est venu du Discord d'AMD</h2>
13349  <p>Alors que nous discutions de ROCm vs Vulkan sur le serveur officiel de l'AMD Developer Community, un membre a remis en question en direct les limites de la stack. La réponse n'était pas une spéculation — il s'agissait d'exécuter le benchmark en temps réel et de publier le résultat avec des captures d'écran, des logs et l'image générée, au sein même du serveur d'AMD.</p>
13350
13351  <div class="discord-card">
13352    <div class="discord-header"><i class="ti ti-brand-discord" aria-hidden="true"></i> AMD Developer Community · #rocm-ai-assistant</div>
13353    <div class="discord-body">
13354      <div class="discord-quote">
13355        <div class="author">POIZONE 🔥</div>
13356        <p>"Love the RX 580 flex. Which SD backend are you using, stable-diffusion.cpp on Vulkan? And does it support SDXL or Flux, or only SD1.5?"</p>
13357      </div>
13358      <div class="discord-reply">Réponse : nous avons effectué le test en direct pendant la conversation. Le résultat — SDXL 1.0 @ 1024×1024 confirmé, avec logs, captures du Task Manager et image générée — a été publié dans le même canal. Le ROCm AI Assistant (bot officiel d'AMD) a répondu en reconnaissant que Vulkan est le choix légitime pour le matériel hors support ROCm.</div>
13359    </div>
13360  </div>
13361
13362  <h2>Le problème : 6.9 Go de modèle, 8 Go de VRAM</h2>
13363  <p>Le SDXL base pèse ~6.9 Go en FP16. Avec les buffers d'activation durant l'inférence, cela dépasse les 8 Go de la RX 580 si tout est chargé sur le GPU. La solution est le déchargement (offloading) sélectif par composant — le stable-diffusion.cpp (fork leejet) le prend en charge nativement, avec la même logique que celle déjà utilisée pour le FLUX.1-schnell avec <code>--clip-on-cpu</code>.</p>
13364  <p>Un second problème silencieux : le VAE original du SDXL produit des NaN en FP16, et le ggml_conv_2d de sd.cpp ne fonctionne qu'en FP16. Sans le correctif approprié, l'image sort noire — sans aucune erreur visible dans le log.</p>
13365
13366  <div class="gotcha-box">
13367    <div class="gotcha-title">⚠ gotcha obligatoire — VAE FP16 fix</div>
13368    <p>Utilisez toujours <strong>sdxl_vae-fp16-fix.safetensors</strong> (madebyollin) à la place du VAE original. Sans lui : image noire, silencieusement, sur tout rendu. Le flag <code>--vae</code> pointe vers ce fichier, et non vers le VAE intégré au checkpoint.</p>
13369  </div>
13370
13371  <h2>Solution : split hybride CPU/GPU</h2>
13372  <p>UNet entier dans la VRAM. Text encoders et VAE decode dans la RAM. Le <code>--vae-tiling</code> divise le décodage en tiles 32×32 pour éliminer le pic de mémoire lors de l'étape finale du pipeline.</p>
13373
13374  <div class="code-block">
13375    <div class="code-label">PowerShell — E:\\stable-diffusion.cpp\\build\\bin\\Release\\</div>
13376    <pre>.\\sd-server.exe \`
13377  --listen-ip 0.0.0.0 \`
13378  --listen-port 8081 \`
13379  -m E:\\models\\sd_xl_base_1.0.safetensors \`
13380  --vae E:\\models\\sdxl_vae-fp16-fix.safetensors \`
13381  --clip-on-cpu \`
13382  --vae-on-cpu \`
13383  --vae-tiling \`
13384  -H 1024 -W 1024 -v</pre>
13385  </div>
13386
13387  <table class="flag-table">
13388    <thead><tr><th>Flag</th><th>Effet</th><th>Mémoire libérée de la VRAM</th></tr></thead>
13389    <tbody>
13390      <tr><td>--clip-on-cpu</td><td>CLIP-L + OpenCLIP-bigG tournent sur la RAM durant le conditioner</td><td>~1.56 Go</td></tr>
13391      <tr><td>--vae-on-cpu</td><td>VAE decode tourne sur le CPU/RAM — élimine le pic en fin de pipeline</td><td>~416 Mo</td></tr>
13392      <tr><td>--vae-tiling</td><td>Divise le décodage en tiles 32×32 (49 tiles en 1024×1024)</td><td>— (réduit le pic de RAM)</td></tr>
13393    </tbody>
13394  </table>
13395
13396  <h2>Split de mémoire confirmé dans les logs</h2>
13397
13398  <div class="log-block">
13399    <pre><span class="comment"># sortie du sd-server après chargement complet du modèle :</span>
13400
13401total params memory size = 6624.11MB
13402<span class="highlight">  VRAM  4900.07MB  →  diffusion_model (UNet)</span>
13403<span class="highlight">  RAM   1564.36MB  →  text_encoders (CLIP-L + OpenCLIP-bigG)</span>
13404<span class="highlight">  RAM    159.68MB  →  vae</span>
13405
13406listening on: http://0.0.0.0:8081</pre>
13407  </div>
13408
13409  <div class="memory-split">
13410    <div class="mem-card gpu">
13411      <div class="mem-label">GPU · VRAM</div>
13412      <div class="mem-value">4.9 Go</div>
13413      <div class="mem-sub">UNet (diffusion_model)</div>
13414    </div>
13415    <div class="mem-card ram">
13416      <div class="mem-label">CPU · RAM</div>
13417      <div class="mem-value">1.56 Go</div>
13418      <div class="mem-sub">CLIP-L + OpenCLIP-bigG</div>
13419    </div>
13420    <div class="mem-card ram">
13421      <div class="mem-label">CPU · RAM</div>
13422      <div class="mem-value">160 Mo</div>
13423      <div class="mem-sub">VAE decode (49 tiles)</div>
13424    </div>
13425  </div>
13426
13427  <h2>Test de génération via PowerShell</h2>
13428  <p>
13428Pourquoi ne pas utiliser l'Open WebUI : il était déjà configuré pour pointer vers le FLUX.1-schnell sur un autre port. Reconfigurer risquait de casser une configuration fonctionnelle. Le terminal est plus rapide, sans état sauvegardé à préserver et sans conflit de port.</p>
13429
13430  <div class="code-block">
13431    <div class="code-label">PowerShell — envoi du prompt via API A1111-compatible</div>
13432    <pre>$body = @{
13433    prompt         = "a lovely cat, detailed fur, studio lighting"
13434    negative_prompt = ""
13435    width          = 1024
13436    height         = 1024
13437    steps          = 20
13438    cfg_scale      = 7
13439    sampler_name   = "Euler a"
13440} | ConvertTo-Json
13441
13442$response = Invoke-RestMethod \`
13443    -Uri "http://localhost:8081/sdapi/v1/txt2img" \`
13444    -Method Post \`
13445    -ContentType "application/json" \`
13446    -Body $body
13447
13448$bytes = [Convert]::FromBase64String($response.images[0])
13449[IO.File]::WriteAllBytes("E:\\models\\teste_sdxl_1024.png", $bytes)</pre>
13450  </div>
13451
13452  <h2>Benchmark complet</h2>
13453
13454  <div class="bench-grid">
13455    <div class="bench-card">
13456      <div class="bench-phase">Conditioner (CLIP)</div>
13457      <div class="bench-time">~4s</div>
13458      <div class="bench-detail">CPU/RAM · CLIP-L + OpenCLIP-bigG</div>
13459    </div>
13460    <div class="bench-card">
13461      <div class="bench-phase">UNet sampling</div>
13462      <div class="bench-time">267s</div>
13463      <div class="bench-detail">20 steps · Euler A · 13.37s/it · RX 580 Vulkan</div>
13464    </div>
13465    <div class="bench-card">
13466      <div class="bench-phase">VAE decode</div>
13467      <div class="bench-time">~390s</div>
13468      <div class="bench-detail">49 tiles 32×32 · ~8s/tile · CPU/RAM</div>
13469    </div>
13470    <div class="bench-card">
13471      <div class="bench-phase">VRAM pic</div>
13472      <div class="bench-time">5.7 Go</div>
13473      <div class="bench-detail">sur 8.0 Go disponibles · marge de 2.3 Go</div>
13474    </div>
13475    <div class="bench-card total">
13476      <div class="bench-phase">Total end-to-end</div>
13477      <div class="bench-time">662s · ~11 minutes</div>
13478      <div class="bench-detail">Température pic 67°C → 39°C idle · RAM utilisée 17.7/31.8 Go</div>
13479    </div>
13480  </div>
13481
13482  <h2>Contexte de vitesse</h2>
13483  <p>Ce n'est pas rapide. Ce n'est pas le but.</p>
13484
13485  <table class="comparison-table">
13486    <thead><tr><th>Matériel</th><th>Stack</th><th>Temps SDXL 1024×1024</th></tr></thead>
13487    <tbody>
13488      <tr><td>RTX 4090</td><td>CUDA</td><td>~8s</td></tr>
13489      <tr><td>RTX 3080</td><td>CUDA</td><td>~25s</td></tr>
13490      <tr class="highlight-row"><td>RX 580 8GB (2017)</td><td>Vulkan · sans CUDA · sans ROCm</td><td>662s <span class="tag">fonctionne</span></td></tr>
13491      <tr><td>CPU pur (Xeon E5-2690 v3)</td><td>AVX2</td><td>plage similaire au setup ci-dessus</td></tr>
13492    </tbody>
13493  </table>
13494
13495  <h2>Sortie générée</h2>
13496  <p>Prompt : <em>"a lovely cat, detailed fur, studio lighting"</em></p>
13497  <p>Résultat : Maine Coon photoréaliste, poils individuels visibles, yeux nets, bokeh, studio lighting avec contraste dramatique. Sans artefacts, sans bruit, sans image noire. Le VAE FP16 fix a fonctionné exactement comme documenté.</p>
13498
13499  <div class="result-box">
13500    <p>✓ SDXL 1.0 @ 1024×1024 — confirmé sur RX 580 8GB via Vulkan pur. Matériel lancé en 2017, hors support officiel ROCm, sans aucune dépendance propriétaire de vendeur. Le split hybride CPU/GPU avec --clip-on-cpu + --vae-on-cpu + --vae-tiling est la combinaison qui rend cela possible dans les 8 Go de VRAM.</p>
13501  </div>
13502
13503  <h2>La réponse de l'AMD Developer Community</h2>
13504  <p>Le benchmark a été publié sur le serveur officiel d'AMD avec logs, captures du Task Manager durant l'inférence et l'image générée, en réponse directe à la question du membre POIZONE sur le canal #rocm-ai-assistant. La réaction a été immédiate : <em>"wow, that was fast thanks alot, and also pretty good results"</em>.</p>
13505  <p>Par la suite, en réponse à un message plus long sur la motivation du projet — accès au matériel hérité, l'abandon de Polaris par ROCm et DirectML, et la philosophie selon laquelle "le matériel ne meurt pas, c'est le support officiel qui disparaît" — POI
13505ZONE a commenté : <em>"Today, someone who wanted to run local AI and couldn't — now can. That's what matters. — this is exactly why i like this idea"</em>.</p>
13506
13507  <h2>Téléchargements de modèle</h2>
13508  <div class="code-block">
13509    <div class="code-label">PowerShell — télécharger dans E:\\models\\</div>
13510    <pre>cd E:\\models\\
13511
13512# modèle base SDXL (~6.9 Go)
13513curl.exe -L -o sd_xl_base_1.0.safetensors \`
13514  https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
13515
13516# VAE FP16 fix — obligatoire (~319 Mo)
13517curl.exe -L -o sdxl_vae-fp16-fix.safetensors \`
13518  https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors</pre>
13519  </div>
13520
13521  <div class="footer-note">
13522    AIVisionsLab · Section 26 sur 36 · Matériel : AMD RX 580 8GB (2017) + Xeon E5-2690 v3 + 32 Go DDR4 ECC · Windows 10 Pro + WSL2 · stable-diffusion.cpp fork leejet · Vulkan backend · Testé et documenté en direct en réponse à un défi sur le Discord AMD Developer Community.
13523  </div>
13524
13525</div>`},solucao:{id:"solucao",title:"04. A SOLUÇÃO — ARQUITETURA DUPLA",desc:"Comment nous avons divisé le traitement entre Vulkan sur GPU et WSL2 sur CPU pour éviter les Écrans Bleus.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"arquitetura",difficulty:"intermediate",estimated_time_min:15,tags:["vulkan-api","co-processamento","otimizacao-barramento"],last_reviewed:"2026-07-01",relationships:{prerequisites:["falhas"],previous:"falhas",next:"prereqs",related:["contexto","stack"]}},html:`<p>Puisqu'AMD ne nous a pas donné d'outils officiels, nous avons créé notre propre ingénierie :</p>
13526<ol style="color:#94a3b8; font-size:16px; line-height:1.8;">
13527  <li><strong>Le Moteur Vulkan (C++) :</strong> Nous prenons le code source de Llama.cpp et Stable-Diffusion.cpp et le compilons avec le flag Vulkan. Cela permet à l'IA de tourner directement sur la carte graphique à vitesse maximale, contournant les verrous d'AMD.</li>
13528  <li><strong>Le Renfort WSL2 (Linux sur Windows) :</strong> Pour les modèles de 16 Go (comme FLUX.1) qui provoqueraient un 'Écran Bleu' par manque de VRAM, nous utilisons Linux dans Windows. Nous déportons le traitement vers le Xeon et les 32 Go de RAM. C'est long, mais ça ne plante pas.</li>
13529</ol>
13530<p style="color:#22c55e; font-weight:bold;">Avec ce duo, nous avons transformé une carte 'obsolète' en une machine d'IA de pointe !</p>`},stack:{id:"stack",title:"20. MAPA DE SERVIÇOS DO STACK INTEGRADO",desc:"Tableau de surveillance d'infrastructure, routage du trafic local et backends actifs.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"monitoramento",difficulty:"beginner",estimated_time_min:10,tags:["network-stack","ports-mapping","security-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["animatediff-video"],previous:"animatediff-video",next:"scripts",related:["sd_bat_automation","scripts"]}},html:`<div class="tbl"><table><thead><tr><th>Service d'IA</th><th>Port d'Accès</th><th>Protocole / Engine</th><th>Backend Matériel Actif</th></tr></thead><tbody><tr><td><strong>Open WebUI</strong></td><td><code>:3000</code></td><td>Docker Container</td><td>Environnement Virtualisé WSL2</td></tr><tr class="hig"><td><strong>llama-server</strong></td><td><code>:8081</code></td><td>Exécutable Natif ggml</td><td>GPU AMD Radeon RX 580 (Vulkan 1.x)</td></tr><tr class="hig"><td><strong>sd-server</strong></td><td><code>:7860</code></td><td>Exécutable Natif ggml</td><td>GPU AMD Radeon RX 580 (Vulkan 1.x)</td></tr><tr><td><strong>ComfyUI Server</strong></td><td><code>:8188</code></td><td>Runtime Python Isolé</td><td>CPU Xeon E5-2690 v3 (Mode Pure CPU)</td></tr><tr><td><strong>Ollama Engine</strong></td><td><code>:11434</code></td><td>Service de Contingence</td><td>CPU Xeon E5-2690 v3 (Mode Pure CPU)</td></tr></tbody></table></div>`},"troubleshoot-comfyui":{id:"troubleshoot-comfyui",title:"28. CATASTROFE DE MEMÓRIA NO COMFYUI WINDOWS",desc:"Gestion des dépassements d'allocation physique de VRAM et usage de secours des flags de pagination.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["vram-spillfix","pagefile-allocation","comfyui-out-of-memory"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux-vulkan"],previous:"flux-vulkan",next:"comfyui-portable-amd",related:["comfyui-directml","comfyui-directml-func"]}},html:`<div class="err">
13530<div class="err-t">Exception de Runtime : RuntimeError: Could not allocate tensor with...</div><p style="margin-top:.35rem"><strong style="color:#e2e8f0">Mécanisme de la Panne :</strong> Se produit lors de la tentative d'exécuter des flux d'images complexes sur Windows en utilisant des backends d'accélération instables qui tentent de réserver plus de blocs de mémoire contigus que la carte n'en dispose librement à ce moment.</p><p style="margin-top:.35rem"><strong style="color:#fff">Flags de Survie :</strong> Modifiez l'appel du fichier d'initialisation en injectant les commandes de fragmentation de charge : <code>--lowvram</code> ou <code>--normalvram</code>. Cela force le gestionnaire de ComfyUI à décharger les couches CLIP de la mémoire vidéo avant d'initialiser le traitement du KSampler.</p></div>`},troubleshooting:{id:"troubleshooting",title:"27. GUIA DE RESOLUÇÃO DE PROBLEMAS (TROUBLESHOOTING)",desc:"Diagnostics rapides pour contourner les échecs de timeout d'API et seeds nuls sur le serveur.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"geral",difficulty:"beginner",estimated_time_min:10,tags:["port-fixing","network-troubleshoot","timeout-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["cpu"],previous:"cpu",next:"flux-vulkan",related:["falhas","troubleshoot-comfyui"]}},html:`<div class="err"><div class="err-t">Symptôme Critique : generate_image returned no results / Terminal gelé</div><p style="margin-top:.35rem"><strong style="color:#e2e8f0">Cause Identifiée :</strong> Le serveur <code>sd-server.exe</code> présente un bug de dépassement numérique intermittent lors du traitement des générations envoyées avec la seed configurée en mode aléatoire (Seed: -1).</p><p style="margin-top:.35rem"><strong style="color:#22c55e">Action Corrective :</strong> Dans l'interface OpenWebUI, désactivez la clé de seed dynamique dans les options avancées du prompt et forcez une valeur entière fixe valide (Exemple : <code>42</code>, <code>1337</code>).</p></div>`}},ru:{amihart:{id:"amihart",title:"31. МЕТОД AMIHART — ВЫВОД (INFERENCE) НА RX580 В POLARIS/DEBIAN",desc:"Примечание: Данный раздел документации посвящен доказательству концепции, реализованной Amihart, пионером в валидации Vulkan на Debian GCN4/Polaris.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:30,tags:["metodo-amihart","debian-polaris","vulkan-diagnostics"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comunidade"],previous:"comunidade",next:"dadhacks",related:["comunidade","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">В январе 2025 года разработчик <strong style="color:#fff">Amihart</strong> опубликовал техническое исследование, демонстрирующее, что, несмотря на официальные ограничения, наложенные AMD (прекращение официальной поддержки ROCm для архитектур Polaris/GCN4), оборудование RX 580 по-прежнему обладает полным потенциалом для ускорения ИИ.</p>
13531  
13532  <div style="display:grid;grid-template-columns:1fr 1fr;gap:.85rem;margin-bottom:1.25rem">
13533    <div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid var(--r)">
13534      <p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">Подход AIVisionsLab (Windows Native)</p>
13535      <ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8">
13536        <li>Выполнение на хост-системе (Windows).</li>
13537        <li>Фокус на высокостабильной ежедневной эксплуатации.</li>
13538        <li>Настройка нативной оркестрации Vulkan.</li>
13539        <li>Гибридная сегментация VRAM/CPU в WSL.</li>
13540      </ul>
13541    </div>
13542    <div class="card" style="border-left:3px solid #22c55e;padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid #22c55e">
13543      <p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">Метод Amihart (Linux/Debian)</p>
13544      <ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8">
13545        <li>Выполнение в экосистеме Linux/Debian.</li>
13546        <li>Надежная изоляция через Docker-контейнеры.</li>
13547        <li>Строгая компиляция с флагами Vulkan API.</li>
13548        <li>Виртуализированная адаптированная песочница ROCm.</li>
13549      </ul>
13550    </div>
13551  </div>
13552
13553  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. Настройка LLM — Vulkan в Debian</h4>
13554  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">llama.cpp компилируется с чистым Vulkan API для обхода отсутствия драйвера ROCm:</p>
13555  <div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Шаг 1: Установка драйверов Vulkan и необходимых для компиляции компонентов
13556sudo apt install vulkan-tools libtcmalloc-minimal4 libcurl4-openssl-dev glslc cmake make git pkg-config libvul
13556kan-dev
13557
13558# Шаг 2: Клонирование и компиляция llama.cpp с поддержкой Vulkan
13559cd ~
13560git clone https://github.com/ggerganov/llama.cpp
13561cd llama.cpp && mkdir build && cd build
13562cmake .. -DGGML_VULKAN=on -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=ON
13563
13564# Шаг 3: Добавление бинарных файлов в PATH
13565echo 'export PATH=$PATH:'$(realpath bin) >> ~/.bashrc
13566source ~/.bashrc
13567
13568# Шаг 4: Запуск DeepSeek R1 8B (ускорение Vulkan0)
13569llama-cli -m deepseek-r1:8B --device Vulkan0 -ngl 100</code></pre></div>
13570
13571  <p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Показатели производительности (Amihart):</strong> На процессоре Celeron G6900 без использования GPU скорость генерации составляет 5,45 токенов/с. При использовании чистого ускорения Vulkan на RX 580 с выгрузкой 100 слоев (offload), производительность возрастает до <strong style="color:var(--r)">24,56 токенов/с</strong>, что делает модель быстрой и пригодной для использования.</p>
13572
13573  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">B. Настройка Stable Diffusion — Песочница Docker</h4>
13574  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Поскольку генераторы изображений требуют зависимостей ROCm, Amihart использует изолированные виртуальные контейнеры для чистого запуска WebUI в Debian:</p>
13575  <div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Шаг 1: Установка движка Docker и ключей
13576sudo apt update && sudo apt install -y ca-certificates curl
13577install -m 0755 -d /etc/apt/keyrings
13578curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
13579chmod a+r /etc/apt/keyrings/docker.asc
13580echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
13581sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io
13582
13583# Шаг 2: Клонирование WebUI и запуск в изоляции ROCm gfx803
13584cd ~
13585git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
13586cd ~/stable-diffusion-webui
13587
13588sudo docker run -it \\
13589  --network=host --device=/dev/kfd --device=/dev/dri \\
13590  --ipc=host --shm-size 16G --group-add video \\
13591  --cap-add=SYS_PTRACE \\
13592  --rm -v $(pwd)/cache:/root/.cache \\
13593  -v $(pwd)/data:/stable-diffusion-webui/data \\
13594  woodrex/sd-webui-for-gfx803:latest</code></pre></div>
13595
13596  <p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Критическая оптимизация кэша Amihart:</strong> Чтобы избежать повторной загрузки зависимостей при каждом запуске контейнера:</p>
13597  <div class="code" style="margin-bottom:1.5rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># Получение активного CONTAINER ID
13598sudo docker ps -l
13599# Фиксация состояния в новый постоянный образ
13600sudo docker commit [CONTAINER_ID]
13601# Просмотр ID сохраненного образа и замена его в команде docker run
13602sudo docker images</code></pre></div>
13603
13604  <div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem">
13605    <strong style="color:var(--r)">Метрики и технические ссылки:</strong> Маршрутизация основана на оригинальной публикации <a href="https://amihart.medium.com/inference-with-an-rx580-13e9c1055472" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">Amihart</a> (Medium, январь 2025 г.). Знания открыты и полезны для сообщества.
13606  </div>`},"animatediff-video":{id:"animatediff-video",title:"19. ANIMATEDIFF И ИНТЕРПОЛЯЦИЯ КАДРОВ (ВИДЕО)",desc:"Внедрение временной согласованности в C
13606omfyUI на устаревшем оборудовании для создания плавных циклов, обрабатываемых на Intel Xeon.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"advanced",estimated_time_min:30,tags:["animatediff","geracao-video","motion-modules"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-modelos"],previous:"comfyui-modelos",next:"stack",related:["comfyui-flux","sdxl_vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
13607  <strong>AnimateDiff</strong> — это фреймворк временного моделирования, разработанный специально для преобразования моделей статической диффузии (таких как Stable Diffusion 1.5) в генераторы согласованного видео. Он работает путем внедрения модулей временного внимания в ComfyUI/WSL2. Эта техника позволяет вычислять переходы между соседними кадрами математически скоординированным образом, создавая плавные циклы и устраняя статические эффекты хаотичного мерцающего шума.
13608</p>
13609
13610<!-- Stat cards of render cost -->
13611<div style="display:grid;grid-template-columns:1fr 1fr;gap:1.25rem;margin-bottom:1.5rem">
13612  <div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px">
13613    <div style="font-size:1.8rem">🎬</div>
13614    <div>
13615      <div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">Видеоконвейер</div>
13616      <div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#fff">AnimateDiff (WSL2 Pure CPU)</div>
13617      <div style="font-size:.65rem;color:#64748b;margin-top:2px">24 потока Intel Xeon E5</div>
13618    </div>
13619  </div>
13620  <div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px">
13621    <div style="font-size:1.8rem">⏳</div>
13622    <div>
13623      <div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">Метрика обработки</div>
13624      <div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#34d399">~141с на секунду кадра</div>
13625      <div style="font-size:.65rem;color:#64748b;margin-top:2px">Интерполированный временной рендеринг</div>
13626    </div>
13627  </div>
13628</div>
13629
13630<!-- Visual Exhibition Player -->
13631<div style="background:#0F1115;border:1px solid rgba(255,255,255,0.04);border-radius:6px;padding:1.5rem;margin-bottom:1.5rem">
13632  <h4 style="font-size:.85rem;color:#fff;text-transform:uppercase;letter-spacing:1px;margin-bottom:1rem;display:flex;align-items:center;gap:.5rem;margin-top:0">
13633    <span>🎥</span> Интерактивная витрина генерации (Breathe-Loop видео из локального кэша)
13634  </h4>
13635  <p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">
13636    Ниже представлены два результата, отрендеренные вашим локальным стеком ИИ. Наведите курсор, чтобы активировать эффект интерполированного видео, или нажмите кнопку симулятора, чтобы запустить синтетический рендеринг на Xeon:
13637  </p>
13638  
13639  <div style="display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-bottom:1.25rem">
13640    <!-- Player 1: Cyberpunk -->
13641    <div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1">
13642      <img src="/images/cyberpunk_alley_0_1779586391528.png" alt="Cyberpunk Neon Alley" referrerPolicy="no-referrer" class="animatediff-img-1" style="width:100%;height:100%;object-fit:cover;transition:transform 8s ease-in-out, filter 2s ease;filter:brightness(0.9)" />
13643      <div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem">
13644        <span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span>
13645        <span>CYBER_STREET_00.GIF</span>
13646      </div>
13647      <div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.75rem .5rem .5rem .75rem;display:flex;justify-content:space-between;align-items:center">
13648        <span style="font-family:monospace;font-size:9px;color:#64748b">Stable Diffusion 1.5</span>
13649        <span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">VULKAN_OK</span>
13650      </div>
13651    </div>
13652
13653    <!-- Player 2: Cosmic Glass -->
13654    <div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1">
13655      <img src="/images/cosmic_glass_0_1779586410888.png" alt="Cosmic Glass Flask" referrerPolicy="no-referrer" class="animatediff-img-2" style="width:100%;height:100%;object-fit:cover;transition:transform 6s ease-in-out, filter 3s ease;filter:brightness(0.85)" />
13656      <div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem">
13657        <span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span>
13658        <span>ALCHEM_COSMOS_01.GIF</span>
13659      </div>
13660      <div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.5rem .75rem;display:flex;justify-content:space-between;align-items:center">
13661        <span style="font-family:monospace;font-size:9px;color:#64748b">Pure Xeon Model</span>
13662        <span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">THREADED_OK</span>
13663      </div>
13664    </div>
13665  </div>
13666
13667  <div style="text-align:center;margin-top:.5rem">
13668    <button onclick="toggleAnimateDiffSim(this)" style="background:rgba(239, 68, 68, 0.1);border:1px solid rgba(239, 68, 68, 0.4);border-radius:3px;color:#fca5a5;font-family:monospace;padding:.5rem 1rem;font-size:.72rem;cursor:pointer;transition:all 0.2s;text-transform:uppercase">
13669      ▶ Активировать симуляцию движения
13670    </button>
13671  </div>
13672  
13673  <div id="sim-log-box" style="background:#07080a;border:1px solid rgba(255,255,255,0.01);border-radius:3px;padding:0.75rem;margin-top:1rem;font-family:monospace;font-size:10px;color:#475569;line-height:1.5;display:none;max-height:120px;overflow-y:auto;text-align:left">
13674  </div>
13675</div>
13676
13677<style>
13678  .video-preview-box:hover .animatediff-img-1 {
13679    transform: scale(1.1) rotate(0.5deg);
13680    filter: brightness(1.1) saturate(1.15) !important;
13681  }
13682  .video-preview-box:hover .animatediff-img-2 {
13683    transform: scale(1.08) rotate(-0.5deg);
13684    filter: brightness(1.05) saturate(1.2) !important;
13685  }
13686  .animate-active-1 {
13687    animation: panCyberpunk 12s infinite alternate ease-in-out;
13688    filter: brightness(1.1) saturate(1.15) !important;
13689  }
13690  .animate-active-2 {
13691    animation: panGlass 10s infinite alternate ease-in-out;
13692    filter: brightness(1.05) saturate(1.2) !important;
13693  }
13694  @keyframes panCyberpunk {
13695    0% { transform: scale(1); filter: hue-rotate(0deg); }
13696    50% { transform: scale(1.12) translate(5px, -3px); filter: hue-rotate(15deg); }
13697    100% { transform: scale(1.02) translate(-5px, 2px); filter: hue-rotate(-10deg); }
13698  }
13699  @keyframes panGlass {
13700    0% { transform: scale(1.02) rotate(0deg); }
13701    50% { transform: scale(1.15) translate(-2px, 4px) rotate(1deg); filter: hue-rotate(5deg); }
13702    100% { transform: scale(1.05) translate(4px, -2px) rotate(-0.5deg); filter: hue-rotate(-5deg); }
13703  }
13704  @keyframes heartbeat {
13705    0%, 100% { opacity: 0.4; }
13706    50% { opacity: 1; }
13707  }
13708  .pulse-red {
13709    animation: heartbeat 1s infinite;
13710  }
13711</style>`},arquivos:{id:"arquivos",title:"35. ТАКСОНОМИЯ И СТРУКТУРА ФАЙЛОВ NVMe",desc:"Единое дерево каталогов для отслеживания скомпилированных бинарных файлов и общих моделей.",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"armazenamento",difficulty:"beginner",estimated_time_min:10,tags:["nvme-struct","model-directories","storage-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proximos"],previous:"proximos",next:"meta",related:["comfyui-modelos","meta"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">Строгая структурная организация физических путей, поддерживаемая в высокоскоростном разделе SSD:</p>
13712  <pre style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#e2e8f0;background:rgba(0,0,0,.3);padding:.9rem;border-radius:4px;border:1px solid var(--b)">
13713E:\\
13714├── llama.cpp\\
13715│   └── build\\bin\\Release\\
13716│       ├── llama-server.exe     <span style="color:#64748b"># Локальный языковой сервер</span>
13717│       └── llama-cli.exe        <span style="color:#64748b"># Диагностическая утилита</span>
13718├── stable-diffusion.cpp\\
13719│   └── build\\bin\\Release\\
13720│       ├── sd-server.exe        <span style="color:#64748b"># Vulkan сервер изображений</span>
13721│       └── sd-cli.exe           <span style="color:#64748b"># Конвертер моделей GGUF</span>
13722└── models\\
13723    ├── mistral-7b-instruct.Q4_K_M.gguf
13724    └── dreamshaper8.gguf        <span style="color:#64748b"># Квантованный чекпоинт SD 1.5</span></pre>`},audio_rvc:{id:"audio_rvc",title:"38. ЛОКАЛЬНОЕ ПРЕОБРАЗОВАНИЕ ГОЛОСА — APPLIO RVC НА AMD RX 580 (Начальные этапы)",desc:"Конвейер клонирования голоса в Windows без CUDA NVIDIA — настройка окружения и первые этапы.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:35,tags:["applio","rvc-voice-clone","sintese-audio"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linhatempo"],previous:"linhatempo",next:"audio_whisper",related:["audio_whisper","audio_srt_ptbr"]},part:1},html:`<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
13725  Честная документация реальной установки, включая все попытки, ошибки и решения.<br />
13726  Проведено в две сессии: ChatGPT (начальные этапы) + Claude (заключительные этапы).
13727</blockquote>
13728
13729<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">КОНТЕКСТ ПРОЕКТА</h3>
13730<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Целью было создание аудиовизуального производственного конвейера для YouTube-канала в стиле dark/документалистика:</p>
13731<div class="code" style="margin-bottom:1.25rem">
13732  <pre><code>Текст → Balabolka + Antônio Neural (TTS) → WAV → Applio/RVC → Yuri (клонированный голос)</code></pre>
13733</div>
13734<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Основная идея: отделить <strong>актерскую игру</strong> от <strong>голосовой идентичности</strong>.</p>
13735<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
13736  <li><strong style="color:#fff">Antônio Neural</strong> обеспечивает интерпретацию, просодию и эмоции (голос Microsoft Neural)</li>
13737  <li><strong style="color:#fff">Yuri</strong> (обученная модель RVC) накладывает голосовую идентичность поверх</li>
13738</ul>
13739<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.5rem">Это дает гораздо более естественный результат, чем чистый генеративный TTS.</p>
13740
13741<div class="tbl" style="margin-bottom:1.5rem">
13742  <table>
13743    <thead>
13744      <tr>
13745        <th>Аспект</th>
13746        <th>XTTS/Чистый TTS</th>
13747        <th>Antônio → Yuri (RVC)</th>
13748      </tr>
13749    </thead>
13750    <tbody>
13751      <tr>
13752        <td>Просодия</td>
13753        <td>Искусственная</td>
13754        <td>Человеческая (реальный актер)</td>
13755      </tr>
13756      <tr>
13757        <td>Технические термины</td>
13758        <td>Спотыкается</td>
13759        <td>Читает правильно</td>
13760      </tr>
13761      <tr>
13762        <td>Длинные тексты</td>
13763        <td>Деградирует</td>
13764        <td>Стабильно</td>
13765      </tr>
13766      <tr>
13767        <td>Голосовая идентичность</td>
13768        <td>Общая</td>
13769        <td>Клонированная</td>
13770      </tr>
13771      <tr>
13772        <td>Естественность</td>
13773        <td>60-70%</td>
13774        <td>80-95%</td>
13775      </tr>
13776    </tbody>
13777  </table>
13778</div>
13779
13780<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">ИСПОЛЬЗУЕМОЕ ОБОРУДОВАНИЕ</h3>
13781<div class="tbl" style="margin-bottom:1.5rem">
13782  <table>
13783    <thead>
13784      <tr>
13785        <th>Компонент</th>
13786        <th>Спецификация</th>
13787      </tr>
13788    </thead>
13789    <tbody>
13790      <tr>
13791        <td>CPU</td>
13792        <td>Intel Xeon E5-2690 v3 (24 ядра)</td>
13793      </tr>
13794      <tr>
13795        <td>GPU</td>
13796        <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
13797      </tr>
13798      <tr>
13799        <td>RAM</td>
13800        <td>31.8 GB DDR4 REG ECC</td>
13801      </tr>
13802      <tr>
13803        <td>OS</td>
13804        <td>Windows 11</td>
13805      </tr>
13806      <tr>
13807        <td>Storage</td>
13808        <td>SSD NVMe (E:)</td>
13809      </tr>
13810      <tr>
13811        <td>Python</td>
13812        <td>3.11.9</td>
13813      </tr>
13814    </tbody>
13815  </table>
13816</div>
13817
13818<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">ЭТАП 0 — ПОПЫТКА С ДАТАСЕТОМ ANTÔNIO (задокументированный провал)</h3>
13819<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
13819Первоначальная идея заключалась в обучении модели RVC на часах аудио от Antônio Neural. Был создан скрипт <code>split.py</code> с использованием Whisper для автоматической сегментации аудио на клипы по 6-12 секунд.</p>
13820<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-bottom:0.5rem"><strong>Проблема: переполнение памяти</strong></p>
13821<div class="code" style="margin-bottom:1.25rem">
13822  <pre><code>MemoryError
13823concurrent.futures.process.BrokenProcessPool</code></pre>
13824</div>
13825<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Предварительная обработка большого датасета (~2ч 34мин аудио) привела к одновременному переполнению RAM и VRAM. Даже после завершения, объем из 1000+ клипов вызывал нестабильность в конвейере Applio.</p>
13826<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem"><strong>Решение:</strong> отказаться от датасета Antônio и использовать напрямую <strong>9 минут TTS от ElevenLabs</strong> с голосом Yuri. Меньше, чище, лучше контролируется.</p>
13827
13828<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">ЭТАП 1 — УСТАНОВКА БАЗОВОГО ОКРУЖЕНИЯ</h3>
13829<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Структура папок:</strong></p>
13830<div class="code" style="margin-bottom:1.25rem">
13831  <pre><code>E:\\tts-audio_pra_youtube\\
13832├── Applio\\
13833├── voices\\
13834│   └── YURI-TTS.wav  (9 минут, ElevenLabs, голос Yuri)
13835├── output\\
13836└── scripts\\</code></pre>
13837</div>
13838
13839<div class="err" style="margin-bottom:1.25rem">
13840  <div class="err-t">⚠️ Проблема: несовместимость с Python 3.10</div>
13841  <p>Современный Applio требует Python 3.11+. Необходимый numpy 2.4.4 отсутствует для 3.10.</p>
13842</div>
13843
13844<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Решение:</strong> установить Python 3.11 параллельно, не удаляя 3.10:</p>
13845<div class="code" style="margin-bottom:1.25rem">
13846  <span class="code-lang">powershell</span>
13847  <pre><code>py -0
13848# -V:3.11  Python 3.11 (64-bit)   ← использовать этот
13849# -V:3.10  Python 3.10 (64-bit)   ← оставить для других проектов
13850
13851py -3.11 -m venv venv
13852venv\\Scripts\\activate
13853python --version
13854# Python 3.11.9  ✅</code></pre>
13855</div>
13856
13857<div class="err" style="margin-bottom:1.25rem">
13858  <div class="err-t">⚠️ Проблема: requirements.txt с принудительным CUDA</div>
13859  <div class="code" style="margin-top:0.5rem;margin-bottom:0.5rem">
13860    <pre><code># Applio содержит эту строку, которая вызывает сбой на AMD Windows:
13861torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'</code></pre>
13862  </div>
13863  <p>Суффикс <code>+cu128</code> — это CUDA 12.8, эксклюзив для NVIDIA. В Windows (<code>win32</code>) это условие всегда истинно.</p>
13864</div>
13865
13866<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Решение:</strong> отредактировать <code>requirements.txt</code>:</p>
13867<div class="code" style="margin-bottom:1.25rem">
13868  <pre><code># УДАЛИТЬ:
13869torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
13870torchaudio==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
13871torchvision==0.22.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
13872
13873# ЗАМЕНИТЬ НА:
13874torch==2.7.1; sys_platform == 'win32'
13875torchaudio==2.7.1; sys_platform == 'win32'
13876torchvision==0.22.1; sys_platform == 'win32'</code></pre>
13877</div>
13878
13879<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">ЭТАП 2 — ПОПЫТКА DIRECTML (задокументированный провал)</h3>
13880<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Поскольку Applio работал на CPU (~10 мин на эпоху), была предпринята попытка ускорения через DirectML.</p>
13881<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Установка и тест:</strong></p>
13882<div class="code" style="margin-bottom:1.25rem">
13883  <span class="code-lang">powershell</span>
13884  <pre><code>pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
13885pip install torch-directml
13886
13887python -c "import torch_directml; dml = torch_directml.device(); print(dml)"
13888# privateuseone:0  ✅  — RX 580 распознана</code></pre>
13889</div>
13890<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Реальный результат:</strong></p>
13891<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
13892  <li>Загрузка GPU: 7-10%</li>
13893  <li>VRAM: 1.2GB используется</li>
13894  <li>Скорость с DirectML: <strong>4.27с/ит</strong></li>
13895  <li>Скорость без DirectML (CPU): <strong>4.46с/ит</strong></li>
13896  <li>Реальная разница: <strong>~5%</strong> — несущественно</li>
13897</ul>
13898<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Почему от этого отказались:</strong></p>
13899<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem"><code>torch-directml</code> застрял на версии <code>0.2.5.dev240914</code> (сентябрь 2024) и требует <code>torch==2.4.1</code>. Applio требует <code>torch==2.7.1</code>. Неразрешимый конфликт:</p>
13900<div class="code" style="margin-bottom:1.25rem">
13901  <pre><code>torch-directml 0.2.5 requires torch==2.4.1
13902hyper-connections 0.4.11 requires torch>=2.5   ← конфликт
13903torch-einops-utils 0.1.1 requires torch>=2.5   ← конфликт</code></pre>
13904</div>
13905<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Microsoft прекратила инвестиции в DirectML для ИИ. Проект по сути заброшен.</p>
13906<p style="font-size:.88rem;color:#10b981;line-height:1.9;margin-bottom:1.25rem">✅ <strong>Вывод:</strong> DirectML для RVC на Windows AMD в 2026 году = не стоит усилий.</p>
13907<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">ЭТАП 3 — КРИТИЧЕСКАЯ ОШИБКА: ПЕРЕМЕННЫЕ ОКРУЖЕНИЯ</h3>
13908<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">При попытках принудительного использования CPU применялись команды, которые <strong>незаметно нарушали извлечение характеристик</strong>:</p>
13909<div class="code" style="margin-bottom:1.25rem">
13910  <span class="code-lang">powershell</span>
13911  <pre><code># ❌ НИКОГДА НЕ ДЕЛАЙТЕ ЭТОГО с Applio AMD:
13912set USE_DIRECTML=0
13913set CUDA_VISIBLE_DEVICES=-1
13914set ROCM_VISIBLE_DEVICES=-1
13915set HIP_VISIBLE_DEVICES=-1</code></pre>
13916</div>
13917<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Эти команды оставляли папку <code>extracted</code> пустой после извлечения. Обучение завершалось за <strong>секунды</strong> с сообщением "Model trained successfully", не создавая ни одного файла <code>.pth</code>.</p>
13918<div class="code" style="margin-bottom:1.25rem">
13919  <pre><code>Not enough data present in the training set.
13920Feature files in logs\\my-project\\extracted could not be loaded correctly.</code></pre>
13921</div>
13922<div class="err" style="margin-bottom:1.25rem">
13923  <div class="err-t">⚠️ Ловушка: "Model trained successfully" за секунды = фейковое обучение.</div>
13924  <p>Всегда проверяйте наличие файлов <code>.npy</code> в <code>logs/projeto/extracted/</code> перед началом обучения.</p>
13925</div>
13926
13927<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">ЭТАП 4 — ЧИСТАЯ УСТАНОВКА (финальное решение)</h3>
13928<div class="code" style="margin-bottom:1.25rem">
13929  <span class="code-lang">powershell</span>
13930  <pre><code># 1. Удаление поврежденного окружения
13931deactivate
13932Remove-Item -Recurse -Force venv
13933Remove-Item -Recurse -Force logs
13934
13935# 2. Создание чистого venv
13936py -3.11 -m venv venv
13937venv\\Scripts\\activate
13938python -m pip install --upgrade pip
13939
13940# 3. Установка базового torch
13941pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
13942pip install torch-directml
13943
13944# 4. Установка зависимостей без перезаписи torch
13945pip install -r requirements.txt --no-deps
13946
13947# 5. Исправление отсутствующих зависимостей
13948pip install gradio-client==1.14.0
13949pip install cffi soupsieve local-attention
13950pip install "aiofiles&lt;25.0" "pandas&lt;3.0" "pydantic&lt;=2.12.3"
13951pip install "starlette&lt;1.0,&gt;=0.40.0" "tomlkit&lt;0.14.0"
13952pip install "tokenizers&gt;=0.22.0,&lt;=0.23.0"
13953pip install audioread decorator lazy-loader msgpack pooch scikit-learn resampy</code></pre>
13954</div>
13955<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>config.py — финальная версия (без DirectML):</strong></p>
13956<div class="code" style="margin-bottom:1.25rem">
13957  <span class="code-lang">python</span>
13958  <pre><code>import torch
13959import json
13960import os
13961
13962@singleton
13963class Config:
13964    def __init__(self):
13965        self.device = "cuda:0" if torch.cuda.is_available() else "cpu"
13966        # На AMD Windows без CUDA автоматически используется "cpu"</code></pre>
13967</div>
13968<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Запуск:</strong></p>
13969<div class="code" style="margin-bottom:1.25rem">
13970  <span class="code-lang">powershell</span>
13971  <pre><code># ЧИСТЫЙ PowerShell, без каких-либо 'set' перед запуском
13972python app.py
13973# * Running on local URL: http://127.0.0.1:6969  ✅</code></pre>
13974</div>
13975
13976<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">ЭТАП 5 — ОТСУТСТВУЮЩИЕ ФАЙЛЫ MUTE</h3>
13977<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">При установке через git файлы тишины не создаются. Они появляются по одному во время обучения:</p>
13978<div class="code" style="margin-bottom:1.25rem">
13979  <pre><code>FileNotFoundError: logs\\mute\\sliced_audios\\mute40000.wav
13980FileNotFoundError: logs\\mute\\extracted\\mute.npy          ← неверная форма вызывает сбой
13981FileNotFoundError: logs\\mute\\f0\\mute.wav.npy
13982FileNotFoundError: logs\\mute\\f0_voiced\\mute.wav.npy
13983RuntimeError: tensor (100) must match size (768)</code></pre>
13984</div>
13985<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Решение — создать все сразу:</strong></p>
13986<div class="code" style="margin-bottom:1.25rem">
13987  <span class="code-lang">powershell</span>
13988  <pre><code>python -c "
13989import numpy as np, soundfile as sf, os
13990[os.makedirs(d, exist_ok=True) for d in [
13991    'logs/mute/sliced_audios','logs/mute/extracted',
13992    'logs/mute/f0','logs/mute/f0_voiced'
13993]]
13994sf.write('logs/mute/sliced_audios/mute40000.wav', np.zeros(int(40000*3.7)), 40000)
13995sf.write('logs/mute/sliced_audios/mute48000.wav', np.zeros(int(48000*3.7)), 48000)
13996sf.write('logs/mute/sliced_audios/mute32000.wav', np.zeros(int(32000*3.7)), 32000)
13997np.save('logs/mute/extracted/mute.npy', np.zeros((196, 768)))
13998np.save('logs/mute/f0/mute.wav.npy', np.zeros(100))
13999np.save('logs/mute/f0_voiced/mute.wav.npy', np.zeros(100))
14000print('OK')
14001"</code></pre>
14002</div>
14003<div class="err" style="margin-bottom:1.25rem">
14004  <div class="err-t">⚠️ Критично: mute.npy должен иметь форму (196, 768)</div>
14005  <p>размерность 768 от эмбеддера contentvec. Любая другая форма вызывает сбой.</p>
14006</div>
14007
14008<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">ЭТАП 6 — ДАТАСЕТ И ОБУЧЕНИЕ</h3>
14009<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Использованный датасет:</strong></p>
14010<div class="tbl" style="margin-bottom:1.5rem">
14011  <table>
14012    <thead>
14013      <tr>
14014        <th>Параметр</th>
14015        <th>Значение</th>
14016      </tr>
14017    </thead>
14018    <tbody>
14019      <tr>
14020        <td>Файл</td>
14021        <td>YURI-TTS.wav</td>
14022      </tr>
14023      <tr>
14024        <td>Длительность</td>
14025        <td>9 минут</td>
14026      </tr>
14027      <tr>
14028        <td>Источник</td>
14029        <td>ElevenLabs TTS</td>
14030      </tr>
14031      <tr>
14032        <td>Примечание</td>
14033        <td>Минимум допустимого. Идеал: 15-25 мин</td>
14034      </tr>
14035    </tbody>
14036  </table>
14037</div>
14038
14039<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Настройки Applio:</strong></p>
14040<div class="tbl" style="margin-bottom:1.5rem">
14041  <table>
14042    <thead>
14043      <tr>
14044        <th>Параметр</th>
14045        <th>Значение</th>
14046      </tr>
14047    </thead>
14048    <tbody>
14049      <tr>
14050        <td>Частота дискретизации</td>
14051        <td>40000 Hz</td>
14052      </tr>
14053      <tr>
14054        <td>Вокодер</td>
14055        <td>HiFi-GAN</td>
14056      </tr>
14057      <tr>
14058        <td>Алгоритм высоты тона</td>
14059        <td>RMVPE</td>
14060      </tr>
14061      <tr>
14062        <td>Эмбеддер</td>
14063        <td>contentvec</td>
14064      </tr>
14065      <tr>
14066        <td>Размер батча</td>
14067        <td>4</td>
14068      </tr>
14069      <tr>
14070        <td>Всего эпох</td>
14071        <td>200</td>
14072      </tr>
14073      <tr>
14074        <td>Номер GPU</td>
14075        <td><strong>пусто</strong> (не ставьте 0, -1 или cpu)</td>
14076      </tr>
14077    </tbody>
14078  </table>
14079</div>
14080
14081<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Реальные метрики:</strong></p>
14082<div class="tbl" style="margin-bottom:1.5rem">
14083  <table>
14084    <thead>
14085      <tr>
14086        <th>Эпоха</th>
14087        <th>Loss</th>
14088        <th>Время на эпоху</th>
14089      </tr>
14090    </thead>
14091    <tbody>
14092      <tr>
14093        <td>1</td>
14094        <td>27.181</td>
14095        <td>7:21</td>
14096      </tr>
14097      <tr>
14098        <td>8</td>
14099        <td>17.93</td>
14100        <td>7:02</td>
14101      </tr>
14102      <tr>
14103        <td>20</td>
14104        <td>16.212</td>
14105        <td>7:43</td>
14106      </tr>
14107      <tr>
14108        <td>43</td>
14109        <td>15.785</td>
14110        <td>5:43</td>
14111      </tr>
14112    </tbody>
14113  </table>
14114</div>
14115<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
14116  <li>Скорость: ~6 минут на эпоху</li>
14117  <li>Итого: ~20 часов на 200 эпох</li>
14118  <li>Эффективное оборудование: CPU Xeon 24 ядра</li>
14119</ul>
14120<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
14121  <strong>ℹ️ Буфер PowerShell:</strong> при ночном обучении терминал может выглядеть зависшим. Обучение продолжается в обычном режиме — проверяйте счетчик в Applio.
14122</blockquote>
14123
14124<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">ИЗВЛЕЧЕННЫЕ УРОКИ</h3>
14125<p style="font-size:.88rem;color:#10b981;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">✅ Что работает:</p>
14126<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
14127  <li>Applio + чистый CPU на AMD Windows — стабильно и функционально</li>
14128  <li>Python 3.11 обязателен (не 3.10)</li>
14129  <li>Отредактированный <code>requirements.txt</code> — удален <code>+cu128</code></li>
14130  <li>Чистый PowerShell — без переменных <code>CUDA_VISIBLE_DEVICES</code></li>
14131  <li>Файлы mute созданы вручную перед обучением</li>
14132  <li>Поле "Номер GPU" <strong>пустое</strong> в Applio</li>
14133</ol>
14134<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">❌ Что не работает:</p>
14135<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
14136  <li>DirectML + torch 2.7.1 — несовместимо в 2026</li>
14137  <li><code>set CUDA_VISIBLE_DEVICES=-1</code> — нарушает извлечение признаков</li>
14138  <li><code>pip install -r requirements.txt</code> без редактирования — устанавливает CUDA и вызывает сбой</li>
14139  <li>Большой датасет (часы аудио) — переполнение RAM/VRAM</li>
14140</ol>
14141
14142<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">
14142ФИНАЛЬНЫЙ ПРОИЗВОДСТВЕННЫЙ КОНВЕЙЕР</h3>
14143<div class="code" style="margin-bottom:1.25rem">
14144  <pre><code>1. Написание сценария
14145   ↓
141462. Balabolka + Antônio Neural → WAV с человеческой интонацией
14147   ↓
141483. Applio — Инференс
14149   Модель: my-project_200e.pth
14150   Индекс: my-project.index
14151   ↓
141524. Вывод: WAV с голосом Yuri
14153   ↓
141545. Монтаж и публикация на YouTube</code></pre>
14155</div>
14156<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Скорость инференса (после обучения):</strong></p>
14157<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
14158  <li>~5-30 секунд на минуту аудио</li>
14159  <li>2 часа аудио → ~30 минут обработки</li>
14160  <li>Пакетный режим доступен в Applio</li>
14161</ul>
14162
14163<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">ЧЕК-ЛИСТ — ВОСПРОИЗВЕДЕНИЕ С НУЛЯ</h3>
14164<ul style="list-style-type:none;padding-left:0;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
14165  <li><span style="color:#475569">[ ]</span> Установлен Python 3.11</li>
14166  <li><span style="color:#475569">[ ]</span> Установлен Git</li>
14167  <li><span style="color:#475569">[ ]</span> FFmpeg в PATH</li>
14168  <li><span style="color:#475569">[ ]</span> Чистый датасет WAV (минимум 5 мин, идеал 15-25 мин)</li>
14169  <li><span style="color:#475569">[ ]</span> Отредактирован <code>requirements.txt</code> (удален <code>+cu128</code>)</li>
14170  <li><span style="color:#475569">[ ]</span> <code>config.py</code> без ссылок на <code>torch_directml</code></li>
14171  <li><span style="color:#475569">[ ]</span> Созданы файлы mute</li>
14172  <li><span style="color:#475569">[ ]</span> Чистый PowerShell (без <code>set CUDA_VISIBLE_DEVICES</code>)</li>
14173  <li><span style="color:#475569">[ ]</span> Поле "Номер GPU" <strong>пустое</strong> в Applio</li>
14174  <li><span style="color:#475569">[ ]</span> После извлечения: проверить наличие файлов <code>.npy</code> в <code>logs/projeto/extracted/</code></li>
14175</ul>
14176
14177<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">AMD vs NVIDIA В ИИ — ПОЗИЦИЯ APPLIO/RVC (2026)</h3>
14178<div class="tbl" style="margin-bottom:1.5rem">
14179  <table>
14180    <thead>
14181      <tr>
14182        <th>Платформа</th>
14183        <th>Статус</th>
14184      </tr>
14185    </thead>
14186    <tbody>
14187      <tr>
14188        <td>NVIDIA CUDA</td>
14189        <td>✅ Отлично — нативная поддержка</td>
14190      </tr>
14191      <tr>
14192        <td>AMD ROCm Linux</td>
14193        <td>⚠️ Приемлемо — работает с усилиями</td>
14194      </tr>
14195      <tr>
14196        <td>AMD Windows DirectML</td>
14197        <td>❌ Заброшено</td>
14198      </tr>
14199      <tr>
14200        <td>AMD Windows CPU</td>
14201        <td>✅ Функционально — медленно, но стабильно</td>
14202      </tr>
14203    </tbody>
14204  </table>
14205</div>
14206<p style="font-size:.85rem;color:#94a3b8;font-style:italic;line-height:1.8"><em>*Устаревшее оборудование не умирает — ему просто нужен правильный бэкенд.</em></p>`},audio_srt_ptbr:{id:"audio_srt_ptbr",title:"40. ПОЛНЫЙ КОНВЕЙЕР — ТРАНСКРИПЦИЯ + ПЕРЕВОД НА РУССКИЙ С RX 580 (Часть 1)",desc:"Транскрипция видео на английском языке с автоматическим переводом на русский, от .mp4 до .srt без использования платных сервисов.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:25,tags:["srt-generation","automacao-srt","ffmpeg-pipeline"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linux_nativo"],previous:"linux_nativo",next:"limit_qwen_35b",related:["audio_whisper","limit_qwen_35b"]},part:1}
14206,html:`<div class="whisper-doc">
14207  <div class="hero">
14208    <div class="hero-title"><span>Полный конвейер</span> — Транскрипция + Перевод EN➔RU</div>
14209    <div class="hero-sub">Офлайн-транскрипция видео на английском языке с автоматическим переводом на русский, от <code>.mp4</code> до <code>.srt</code>, 100% бесплатно с использованием RX 580 через Vulkan.</div>
14210    <div class="hero-badges">
14211      <span class="badge badge-gpu">AMD RX 580 8GB</span>
14212      <span class="badge badge-win">Windows + PowerShell</span>
14213      <span class="badge badge-ok">Vulkan Backend</span>
14214      <span class="badge badge-ok">large-v3-turbo</span>
14215      <span class="badge badge-win">deep-translator (Бесплатно)</span>
14216    </div>
14217  </div>
14218
14219  <div class="stat-grid">
14220    <div class="stat">
14221      <div class="stat-label">общее время конвейера</div>
14222      <div class="stat-value">~8 мин</div>
14223      <div class="stat-sub">Видео 29м 51с</div>
14224    </div>
14225    <div class="stat">
14226      <div class="stat-label">Использовано VRAM</div>
14227      <div class="stat-value">2.9 GB</div>
14228      <div class="stat-sub">из 8 GB Polaris</div>
14229    </div>
14230    <div class="stat">
14231      <div class="stat-label">Ср. темп. GPU</div>
14232      <div class="stat-value">50°C</div>
14233      <div class="stat-sub">Оптимизированная кривая вентиляторов</div>
14234    </div>
14235    <div class="stat">
14236      <div class="stat-label">Стоимость Cloud</div>
14237      <div class="stat-value">0,00 руб.</div>
14238      <div class="stat-sub">100% локально и офлайн</div>
14239    </div>
14240  </div>
14241
14242  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Оборудование, использованное в тесте</h3>
14243  <div class="tbl">
14244    <table>
14245      <thead>
14246        <tr>
14247          <th>Компонент</th>
14248          <th>Спецификация</th>
14249        </tr>
14250      </thead>
14251      <tbody>
14252        <tr>
14253          <td><strong>GPU</strong></td>
14254          <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
14255        </tr>
14256        <tr>
14257          <td><strong>CPU</strong></td>
14258          <td>Intel Xeon E5-2690 v3 (24 потока / 12 ядер)</td>
14259        </tr>
14260        <tr>
14261          <td><strong>RAM</strong></td>
14262          <td>31.8 GB DDR4 REG ECC</td>
14263        </tr>
14264        <tr>
14265          <td><strong>OS</strong></td>
14266          <td>Windows 11 Professional</td>
14267        </tr>
14268        <tr>
14269          <td><strong>Драйвер</strong></td>
14270          <td>Adrenalin 31.0.21925.1001 (2026/05/20)</td>
14271        </tr>
14272      </tbody>
14273    </table>
14274  </div>
14275
14276  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Единый поток данных (Pipeline)</h3>
14277  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
14278    Цель состоит в том, чтобы преобразовать образовательное видео на английском языке в субтитры на русском, совместимые с видеоредакторами (Filmora, Premiere и др.), выполняя транскрипцию через нативный GPU и переводя каждый временной штамп без ограничений коммерческих облачных API:
14279  </p>
14280  <div class="cmd" style="white-space:normal; line-height:1.6; padding: 1rem;">
14281    <strong>video.mp4</strong> ➔ <code>FFmpeg (извлечение)</code> ➔ <strong>video_16k.wav</strong><br>
14282    ➔ <code>whisper-cli Vulkan (транскрипция)</code> ➔ <strong>video.srt (English)</strong><br>
14283    ➔ <code>Python deep-translator (Google Translate)</code> ➔ <strong>video_ru.srt (Русский)</strong><br>
14284    ➔ <code>Импорт на таймлайн Filmora</code>
14285  </div>
14286
14287  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Производительность и детальный тайминг</h3>
14288  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
14289    Реальные метрики, полученные при транскрипции образовательного видео длительностью <strong>29 минут 51 секунда</strong> (аудио на английском, AAC, 480x360):
14290  </p>
14291  <div class="tbl" style="margin-bottom:1.5rem">
14292    <table>
14293      <thead>
14294        <tr>
14295          <th>Этап конвейера</th>
14296          <th>Инструмент</th>
14297          <th>Затраченное время</th>
14298        </tr>
14299      </thead>
14300      <tbody>
14301        <tr>
14302          <td><strong>1. Извлечение аудио WAV без сжатия</strong></td>
14303          <td>FFmpeg</td>
14304          <td><strong>1.7 секунды</strong></td>
14305        </tr>
14306        <tr>
14307          <td><strong>2. Транскрипция аудио (EN)</strong></td>
14308          <td>Whisper.cpp + Vulkan</td>
14309          <td><strong>6 минут 07 секунд</strong></td>
14310        </tr>
14311        <tr>
14312          <td><strong>3. Блочный перевод SRT (EN➔RU)</strong></td>
14313          <td>Python + <code>deep-translator</code></td>
14314          <td><strong>~2 минуты</strong> (ограничение сетевого I/O)</td>
14315        </tr>
14316        <tr style="border-top:1px solid rgba(255,255,255,0.15)">
14317          <td><strong>Итоговая метрика</strong></td>
14318          <td><strong>Полный конвейер</strong></td>
14319          <td><strong>~8 минут</strong></td>
14320        </tr>
14321      </tbody>
14322    </table>
14323  </div>
14324
14325  <h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">Внутренние тайминги ядра (whisper_print_timings)</h4>
14326  <div class="card bg-black/40 border border-white/5 p-4 rounded-md my-3 font-mono text-xs text-[#a7f3d0] leading-relaxed">
14327    load modelo : 3.687 ms<br>
14328    mel (аудио) : 2.305 ms<br>
14329    encode GPU  : 204.689 ms<br>
14330    decode      : 4.081 ms<br>
14331    batch total : 108.675 ms<br>
14332    total       : 367.432 ms (на пакет сегментации)
14333  </div>
14334
14335  <div class="section-title">Пошаговое руководство</div>
14336
14337  <div class="step">
14338    <div class="step-header">
14339      <div class="step-num">1</div>
14340      <div class="step-name">Извлечение совместимого аудио через FFmpeg</div>
14341      <div class="step-desc">WAV 16kHz Mono 16-bit</div>
14342    </div>
14343    <div class="step-body">
14344      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">Whisper строго требует необработанный аудиофайл WAV с частотой 16 000 Гц, моно, 16 бит:</p>
14345      <div class="cmd">ffmpeg -i "E:\\MUSICAS SUNO AI\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\MUSICAS SUNO AI\\video_16k.wav"</div>
14346      <p class="note"><strong>Флаги:</strong> <code>-ar 16000</code> принудительно 16kHz · <code>-ac 1</code> конвертация в моно · <code>-c:a pcm_s16le</code>
14346 установка 16-битного PCM без потерь.</p>
14347    </div>
14348  </div>
14349
14350  <div class="step">
14351    <div class="step-header">
14352      <div class="step-num">2</div>
14353      <div class="step-name">Транскрипция через Vulkan</div>
14354      <div class="step-desc">Высокая нагрузка на GPU Polaris</div>
14355    </div>
14356    <div class="step-body">
14357      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">Запуск скомпилированного исполняемого файла Whisper для генерации начального файла субтитров SRT на английском:</p>
14358      <div class="cmd">cd C:\\whisper.cpp</div>
14359      <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\MUSICAS SUNO AI\\video_16k.wav" -l en --output-srt</div>
14360      <p class="note"><strong>Проверка активности GPU:</strong> Убедитесь, что при запуске отображаются строки <code>ggml_vulkan: Found 1 Vulkan devices: AMD Radeon RX 580 2048SP</code>, подтверждающие, что тяжелое кодирование перенесено на GPU, снижая нагрузку на CPU до ~5%.</p>
14361    </div>
14362  </div>
14363
14364  <div class="step">
14365    <div class="step-header">
14366      <div class="step-num">3</div>
14367      <div class="step-name">Создание и запуск Python-скрипта для перевода</div>
14368      <div class="step-desc">Без ключей, без затрат</div>
14369    </div>
14370    <div class="step-body">
14371      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">
14372        Установите библиотеку для перевода без API-ключей: <code>pip install deep-translator</code>. Создайте и запустите файл <code>C:\\whisper.cpp\\traduzir.py</code> с этим кодом:
14373      </p>
14374      <div class="cmd" style="white-space:pre-wrap; font-size:11px;">from deep_translator import GoogleTranslator
14375
14376def traduzir_srt(entrada, saida):
14377    with open(entrada, 'r', encoding='utf-8') as f:
14378        conteudo = f.read()
14379
14380    blocos = conteudo.strip().split('\\n\\n')
14381    resultado = []
14382
14383    for bloco in blocos:
14384        linhas = bloco.split('\\n')
14385        if len(linhas) >= 3:
14386            numero = linhas[0]
14387            timestamp = linhas[1]
14388            texto = ' '.join(linhas[2:])
14389            traduzido = GoogleTranslator(source='en', target='ru').translate(texto)
14390            resultado.append(f"{numero}\\n{timestamp}
14390\\n{traduzido}")
14391
14392    with open(saida, 'w', encoding='utf-8') as f:
14393        f.write('\\n\\n'.join(resultado))
14394    print("Готово!")
14395
14396traduzir_srt(
14397    r'E:\\MUSICAS SUNO AI\\video_16k.wav.srt',
14398    r'E:\\MUSICAS SUNO AI\\video_16k_ru.srt'
14399)</div>
14400<p style="font-size:0.8rem;color:#94a3b8;margin-top:0.5rem">Для запуска:</p>
14401      <div class="cmd">python traduzir.py</div>
14402    </div>
14403  </div>
14404
14405  <div class="step">
14406    <div class="step-header">
14407      <div class="step-num">4</div>
14408      <div class="step-name">Импорт субтитров в Filmora</div>
14409      <div class="step-desc">Завершение редактирования видео</div>
14410    </div>
14411    <div class="step-body">
14412      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6">
14413        1. В Wondershare Filmora перейдите в <strong>Файл ➔ Импорт ➔ Импорт файлов субтитров</strong>.<br>
14414        2. Выберите созданный файл <code>video_16k_ptbr.srt</code>.<br>
14415        3. Перетащите дорожку субтитров прямо на таймлайн, наложив её поверх исходной видеодорожки.
14416      </p>
14417    </div>
14418  </div>
14419
14420  <div class="section-title">Самостоятельные уроки, извлеченные из приключений</div>
14421  <div class="card-inner">
14422    <div class="lesson">
14423      <div class="lesson-icon">⚠️</div>
14424      <div class="lesson-text"><strong>Избегайте использования --translate для PT-BR напрямую в флагах Whisper:</strong> Параметр <code>--translate</code> по своей архитектуре переводит аудио на английский язык. Чтобы получить качественные субтитры на бразильском португальском, правильный подход — извлечь английский текст с помощью <code>-l en</code> и перевести его алгоритмом <code>traduzir.py</code>.</div>
14425    </div>
14426    <div class="lesson">
14427      <div class="lesson-icon">⚠️</div>
14428      <div class="lesson-text"><strong>Проблемы с неверным исходным языком:</strong> Указание <code>-l pt</code>, когда исходное аудио на английском, заставляет Whisper навязывать португальские фонетические паттерны английскому звуку, что приводит к созданию совершенно неразборчивого и бессмысленного текста. Всегда указывайте реальный язык входного аудио в качестве начального параметра.</div>
14429    </div>
14430    <div class="lesson">
14431      <div class="lesson-icon">ℹ️</div>
14432      <div class="lesson-text"><strong>Расположение созданного файла:</strong> По умолчанию в нативных сборках файл <code>.srt</code> сохраняется в той же физической папке, где находится обработанный аудиофайл WAV, а не в директории скрипта или Whisper.</div>
14433    </div>
14434    <div class="lesson">
14435      <div class="lesson-icon">✅</div>
14436      <div class="lesson-text"><strong>8 ГБ VRAM в 2026 году всё ещё актуальны:</strong> Модель Whisper <code>large-v3-turbo</code> потребляет всего 2.9 ГБ физической VRAM в экосистеме, оставляя запас для других задач на вашей машине или параллельного рендеринга. Тысячи долларов сэкономлены на подписках и проприетарных API.</div>
14437    </div>
14438  </div>
14439
14440  <div class="footer">
14441    RX 580 — старая, но всё ещё в строю 🚀 · Приключения задокументированы в июне 2026 года
14442  </div>
14443</div>`},audio_whisper:{id:"audio_whisper",title:"39. WHISPER.CPP LOCAL — ТРАНСКРИПЦИЯ АУДИО НА AMD RX 580 (Часть 1)",desc:"Транскрипция аудио/видео с ускорением на GPU AMD через Vulkan в Windows (модель large-v3-turbo).",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:30,tags:["whispercpp","transcricao-audio","vulkan-whisper"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_rvc"],previous:"audio_rvc",next:"linux_nativo",related:["audio_rvc","audio_srt_ptbr"]},part:1}
14443,html:`<div class="whisper-doc">
14444<style>
14445.whisper-doc {
14446  --color-border-secondary: rgba(255, 255, 255, 0.05);
14447  --color-border-tertiary: rgba(255, 255, 255, 0.08);
14448  --color-background-secondary: #0c0d10;
14449  --color-background-primary: #07080a;
14450  --color-text-primary: #ffffff;
14451  --color-text-secondary: #94a3b8;
14452  font-family: inherit;
14453}
14454.whisper-doc * { box-sizing: border-box; }
14455.whisper-doc .badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 4px; letter-spacing: 0.04em; text-transform: uppercase; }
14456.whisper-doc .badge-gpu { background: rgba(225, 29, 72, 0.1); border: 1px solid rgba(225, 29, 72, 0.3); color: #fda4af; }
14457.whisper-doc .badge-win { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.2); color: #a7f3d0; }
14458.whisper-doc .badge-ok { background: rgba(14, 165, 233, 0.1); border: 1px solid rgba(14, 165, 233, 0.3); color: #bae6fd; }
14459.whisper-doc .badge-warn { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #fef08a; }
14460.whisper-doc .hero { border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 1.5rem; margin-bottom: 2rem; background: #0c0d10; }
14461.whisper-doc .hero-title { font-size: 26px; font-weight: 700; color: var(--color-text-primary); line-height: 1.2; margin-bottom: 0.5rem; font-family: 'Syne', var(--font-sans); text-transform: uppercase; }
14462.whisper-doc .hero-title span { color: #E11D48; }
14463.whisper-doc .hero-sub { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 1.25rem; line-height: 1.6; font-family: var(--font-sans); }
14464.whisper-doc .hero-badges { display: flex; flex-wrap: wrap; gap: 6px; }
14465.whisper-doc .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 2rem; }
14466.whisper-doc .stat { background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 0.875rem 1rem; }
14467.whisper-doc .stat-label { font-size: 11px; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; font-family: var(--font-sans); }
14468.whisper-doc .stat-value { font-size: 20px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-mono); }
14469.whisper-doc .stat-sub { font-size: 11px; color: var(--color-text-secondary); margin-top: 2px; font-family: var(--font-sans); }
14470.whisper-doc .section { margin-bottom: 2.5rem; }
14471.whisper-doc .section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #E11D48; margin-top: 2rem; margin-bottom: 1rem; font-family: var(--font-sans); padding-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
14472.whisper-doc .step { border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; margin-bottom: 10px; overflow: hidden; background: #050506; }
14473.whisper-doc .step-header { display: flex; align-items: center; gap: 10px; padding: 0.75rem 1rem; background: #0c0d10; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
14474.whisper-doc .step-num { width: 24px; height: 24px; border-radius: 50%; background: #E11D48; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-mono); }
14475.whisper-doc .step-name { font-size: 13px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-sans); }
14476.whisper-doc .step-desc { font-size: 11px; color: var(--color-text-secondary); font-family: var(--font-sans); margin-left: auto; }
14477.whisper-doc .step-body { padding: 0.875rem 1rem; }
14478.whisper-doc .cmd { background: #050506; border: 1px solid rgba(255, 255, 255, 0.03); border-radius: 4px; padding: 0.625rem 0.875rem; font-size: 12px; color: #fff; font-family: var(--font-mono); margin-bottom: 6px; overflow-x: auto; white-space: nowrap; border-left: 3px solid #E11D48; }
14479.whisper-doc .note { font-size: 12px; color: var(--color-text-secondary); font-family: var(--font-sans); line-height: 1.6; margin-top: 4px; padding-left: 8px; border-left: 2px solid #E11D48; }
14480.whisper-doc .flag-table { width: 100%; border-collapse: collapse; font-size: 12px; }
14481.whisper-doc .flag-table th { text-align: left; padding: 8px 10px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-sans); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: #111215; }
14482.whisper-doc .flag-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-family: var(--font-mono); }
14483.whisper-doc .flag-table td:first-child { color: #fda4af; }
14484.whisper-doc .flag-table td:last-child { font-family: var(--font-sans); color: var(--color-text-secondary); }
14485.whisper-doc .flag-table tr:last-child td { border-bottom: none; }
14486.whisper-doc .perf-bar-wrap { margin: 0.5rem 0 1rem; background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); padding: 1rem; border-radius: 6px; }
14487.whisper-doc .perf-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
14488.whisper-doc .perf-row:last-child { margin-bottom: 0; }
14489.whisper-doc .perf-label { font-size: 12px; color: var(--color-text-secondary); width: 120px; flex-shrink: 0; font-family: var(--font-sans); text-align: right; }
14490.whisper-doc .perf-bar-bg { flex: 1; height: 8px; background: rgba(255, 255, 255, 0.03); border-radius: 4px; overflow: hidden; }
14491.whisper-doc .perf-bar { height: 100%; border-radius: 4px; }
14492.whisper-doc .perf-time { font-size: 12px; font-family: var(--font-mono); color: var(--color-text-primary); width: 70px; flex-shrink: 0; margin-left: 8px; }
14493.whisper-doc .lesson { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); align-items: flex-start; }
14494.whisper-doc .lesson:last-child { border-bottom: none; }
14495.whisper-doc .lesson-icon { font-size: 16px; flex-shrink: 0;
14495 margin-top: 1px; }
14496.whisper-doc .lesson-text { font-size: 12.5px; color: var(--color-text-secondary); font-family: var(--font-sans); line-height: 1.6; }
14497.whisper-doc .lesson-text strong { font-weight: 700; color: var(--color-text-primary); }
14498.whisper-doc .footer { text-align: center; font-size: 11px; color: #475569; font-family: var(--font-mono); padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, 0.05); margin-top: 2rem; }
14499.whisper-doc .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
14500@media (max-width: 600px) { .whisper-doc .two-col { grid-template-columns: 1fr; } }
14501.whisper-doc .env-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-size: 12px; }
14502.whisper-doc .env-row:last-child { border-bottom: none; }
14503.whisper-doc .env-key { color: var(--color-text-secondary); font-family: var(--font-sans); }
14504.whisper-doc .env-val { font-family: var(--font-mono); color: var(--color-text-primary); text-align: right; }
14505.whisper-doc .card-inner { background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 1rem 1.25rem; }
14506</style>
14507
14508  <div class="hero">
14509    <div class="hero-title"><span>whisper.cpp</span> + RX 580 через Vulkan</div>
14510    <div class="hero-sub">Транскрипция аудио/видео с GPU-ускорением AMD в Windows — используем Vulkan для запуска моделей Whisper напрямую в VRAM видеокарты RX 580. GPU 2017 года снова в деле в 2026-м.</div>
14511    <div class="hero-badges">
14512      <span class="badge badge-gpu">AMD RX 580 8GB</span>
14513      <span class="badge badge-win">Windows + PowerShell</span>
14514      <span class="badge badge-ok">Vulkan Backend</span>
14515      <span class="badge badge-ok">large-v3-turbo</span>
14516      <span class="badge badge-warn">Требуется FFmpeg</span>
14517    </div>
14518  </div>
14519
14520  <div class="stat-grid">
14521    <div class="stat">
14522      <div class="stat-label">общее время</div>
14523      <div class="stat-value">~5 мин</div>
14524      <div class="stat-sub">для 15 мин видео</div>
14525    </div>
14526    <div class="stat">
14527      <div class="stat-label">используемая VRAM</div>
14528      <div class="stat-value">2.6 GB</div>
14529<div class="stat-sub">из 8 ГБ доступно</div>
14530    </div>
14531    <div class="stat">
14532      <div class="stat-label">ускорение vs CPU</div>
14533      <div class="stat-value">~150×</div>
14534      <div class="stat-sub">было: 12ч до 40мин</div>
14535    </div>
14536    <div class="stat">
14537      <div class="stat-label">модель</div>
14538      <div class="stat-value">1.6 ГБ</div>
14539      <div class="stat-sub">large-v3-turbo</div>
14540    </div>
14541  </div>
14542
14543  <div class="section">
14544    <div class="section-title">проверенные предварительные требования</div>
14545    <div class="card-inner">
14546      <div class="env-row"><span class="env-key">Vulkan SDK</span><span class="env-val">glslc v2026.1</span></div>
14547      <div class="env-row"><span class="env-key">Git</span><span class="env-val">2.54.0.windows.1</span></div>
14548      <div class="env-row"><span class="env-key">CMake</span><span class="env-val">4.3.2</span></div>
14549      <div class="env-row"><span class="env-key">MSVC (Build Tools)</span><span class="env-val">14.52.36328 — VS 2026</span></div>
14550      <div class="env-row"><span class="env-key">Обнаружен GPU</span><span class="env-val">AMD Radeon RX 580 2048SP</span></div>
14551      <div class="env-row"><span class="env-key">FFmpeg</span><span class="env-val">2026-04-19 (Gyan full build)</span></div>
14552    </div>
14553    <p class="note" style="margin-top: 8px;">Проверка RX 580 в Vulkan: <span style="font-family:var(--font-mono); color:#fda4af;">vulkaninfo --summary</span> → должно отобразиться AMD Radeon RX 580 2048SP</p>
14554  </div>
14555
14556  <div class="section">
14557    <div class="section-title">компиляция — пошаговое руководство</div>
14558
14559    <div class="step">
14560      <div class="step-header">
14561        <div class="step-num">1</div>
14562        <div class="step-name">активация среды MSVC x64</div>
14563        <div class="step-desc">для каждой новой сессии</div>
14564      </div>
14565      <div class="step-body">
14566        <div class="cmd">& "C:\\Program Files (x86)\\Microsoft Visual Studio\\18\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"</div>
14567        <p class="note">Необходимо повторять при каждом открытии нового PowerShell перед компиляцией. Ожидаемый вывод: "Environment initialized for: 'x64'"</p>
14568      </div>
14569    </div>
14570
14571    <div class="step">
14572      <div class="step-header">
14573        <div class="step-num">2</div>
14574        <div class="step-name">клонирование репозитория</div>
14575        <div class="step-desc">~40 МБ</div>
14576      </div>
14577      <div class="step-body">
14578        <div class="cmd">cd C:\\</div>
14579        <div class="cmd">git clone https://github.com/ggml-org/whisper.cpp</div>
14580        <div class="cmd">cd whisper.cpp</div>
14581      </div>
14582    </div>
14583
14584    <div class="step">
14585      <div class="step-header">
14586        <div class="step-num">3</div>
14587        <div class="step-name">cmake с включенным Vulkan</div>
14588        <div class="step-desc">критически важный флаг: -DGGML_VULKAN=ON</div>
14589      </div>
14590      <div class="step-body">
14591        <div class="cmd">cmake -B build -DGGML_VULKAN=ON -DGGML_HIPBLAS=OFF -DGGML_HIP=OFF -DGGML_CUDA=OFF</div>
14592        <div class="cmd">cmake --build build --config Release -j4</div>
14593        <p class="note">Занимает ~5-10 мин. Предупреждения C4267/C4244 нормальны — на работу не влияют. Бинарные файлы находятся в build\\bin\\Release\\</p>
14594      </div>
14595    </div>
14596
14597    <div class="step">
14598      <div class="step-header">
14599        <div class="step-num">4</div>
14600        <div class="step-name">загрузка модели large-v3-turbo</div>
14601        <div class="step-desc">~1.6 ГБ</div>
14602      </div>
14603      <div class="step-body">
14604        <div class="cmd">Invoke-WebRequest -Uri "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo.bin" -OutFile "models\\ggml-large-v3-turbo.bin"</div>
14605        <p class="note">Другие модели: large-v3 (~6GB VRAM, лучшее качество), medium (~2.5GB), small (~1GB)</p>
14606      </div>
14607    </div>
14608  </div>
14609
14610  <div class="section">
14611    <div class="section-title">использование — полный цикл mp4 → txt</div>
14612
14613    <div class="step">
14614      <div class="step-header">
14615        <div class="step-num" style="background:#1D9E75;">1</div>
14616        <div class="step-name">извлечение аудио через FFmpeg</div>
14617        <div class="step-desc">whisper не читает mp4 напрямую в Windows</div>
14618      </div>
14619      <div class="step-body">
14620        <div class="cmd">ffmpeg -i "E:\\videos\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\videos\\video.wav"</div>
14621        <p class="note">-ar 16000 = 16кГц (обязательно для Whisper) · -ac 1 = моно · -c:a pcm_s16le = WAV без сжатия</p>
14622      </div>
14623    </div>
14624
14625    <div class="step">
14626      <div class="step-header">
14627        <div class="step-num" style="background:#1D9E75;">2</div>
14628        <div class="step-name">транскрипция / перевод</div>
14629        <div class="step-desc">GPU берет на себя остальное</div>
14630      </div>
14631      <div class="step-body">
14632        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --output-txt</
14632div>
14633        <p style="font-size:12px; color:var(--color-text-secondary); margin: 6px 0 4px; font-family:var(--font-sans);">с переводом на английский:</p>
14634        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --translate --output-txt</div>
14635        <p class="note">--translate всегда генерирует английский (ограничение Whisper). Для других целевых языков используйте дополнительный этап перевода.</p>
14636      </div>
14637    </div>
14638
14639    <div style="margin-top: 1rem;">
14640      <div class="section-title" style="margin-bottom: 0.75rem;">полезные флаги</div>
14641      <div class="card-inner">
14642        <table class="flag-table">
14643          <thead><tr><th>флаг</th><th>описание</th></tr></thead>
14644          <tbody>
14645            <tr><td>-l pt</td><td>исходный язык: португальский</td></tr>
14646            <tr><td>-l en</td><td>исходный язык: английский</td></tr>
14647            <tr><td>--translate</td><td>переводит всё на английский</td></tr>
14648            <tr><td>--output-txt</td><td>сохраняет .txt с транскрипцией</td></tr>
14649            <tr><td>--output-srt</td><td>сохраняет субтитры .srt с временными метками</td></tr>
14650            <tr><td>--output-vtt</td><td>сохраняет субтитры .vtt</td></tr>
14651            <tr><td>-t 8</td><td>использует 8 потоков CPU (по умолчанию: 4)</td></tr>
14652            <tr><td>--device 0</td><td>выбирает GPU 0 (по умолчанию)</td></tr>
14653            <tr><td>--no-gpu</td><td>принудительно использует CPU (медленный режим)</td></tr>
14654          </tbody>
14655        </table>
14656      </div>
14657    </div>
14658  </div>
14659
14660  <div class="section">
14661    <div class="section-title">производительность — видео 15 мин</div>
14662    <div class="perf-bar-wrap">
14663      <div class="perf-row">
14664        <div class="perf-label">загрузка модели</div>
14665        <div class="perf-bar-bg"><div class="perf-bar" style="width:1.3%; background:#E11D48;"></div></div>
14666        <div class="perf-time">4 с</div>
14667      </div>
14668      <div class="perf-row">
14669        <div class="perf-label">mel (аудио)</div>
14670        <div class="perf-bar-bg"><div class="perf-bar" style="width:0.4%; background:#E11D48;"></div></div>
14671        <div class="perf-time">1.2 с</div>
14672      </div>
14673      <div class="perf-row">
14674        <div class="perf-label">кодирование GPU</div>
14675        <div class="perf-bar-bg"><div class="perf-bar" style="width:23.7%; background:#1D9E75;"></div></div>
14676        <div class="perf-time">73 с</div>
14677      </div>
14678      <div class="perf-row">
14679        <div class="perf-label">декодирование + пакет</div>
14680        <div class="perf-bar-bg"><div class="perf-bar" style="width:54.7%; background:#1D9E75;"></div></div>
14681        <div class="perf-time">168 с</div>
14682      </div>
14683      <div class="perf-row">
14684        <div class="perf-label" style="font-weight:700; color:var(--color-text-primary);">итого</div>
14685        <div class="perf-bar-bg"><div class="perf-bar" style="width:100%; background:#E11D48;"></div></div>
14686        <div class="perf-time" style="font-weight:700;">307 с</div>
14687      </div>
14688    </div>
14689    <p class="note">CPU нагружен на ~5% во время транскрипции. VRAM: 2.6 ГБ из 8 ГБ. GPU выполнил всю работу — CPU отдыхал.</p>
14690  </div>
14691
14692  <div class="section">
14693    <div class="section-title">уроки, извлеченные из приключений</div>
14694    <div class="card-inner">
14695      <div class="lesson">
14696        <div class="lesson-icon">⚠️</div>
14697<div class="lesson-text"><strong>WSL2 не предоставляет доступ к RX 580 через Vulkan</strong> — всегда используйте PowerShell/Windows напрямую, чтобы задействовать GPU.</div>
14698      </div>
14699      <div class="lesson">
14700        <div class="lesson-icon">⚠️</div>
14701        <div class="lesson-text"><strong>Whisper не читает MP4 в Windows</strong> — всегда предварительно извлекайте аудио с помощью FFmpeg. Используйте -ar 16000 -ac 1 -c:a pcm_s16le.</div>
14702      </div>
14703      <div class="lesson">
14704        <div class="lesson-icon">ℹ️</div>
14705        <div class="lesson-text"><strong>--translate генерирует только английский</strong> — это ограничение Whisper, а не конфигурации. Для получения PT в качестве целевого языка требуется дополнительный этап.</div>
14706      </div>
14707      <div class="lesson">
14708        <div class="lesson-icon">ℹ️</div>
14709        <div class="lesson-text"><strong>vcvars64.bat необходимо повторно активировать</strong> в каждой новой сессии PowerShell перед любой компиляцией.</div>
14710      </div>
14711      <div class="lesson">
14712        <div class="lesson-icon">✅</div>
14713        <div class="lesson-text"><strong>8 GB VRAM в 2026 году — это все еще солидно</strong> — large-v3-turbo использует всего 2.6 GB. «Старый» GPU с приличным объемом VRAM легко обходит новые GPU с 4 GB.</div>
14714      </div>
14715      <div class="lesson">
14716        <div class="lesson-icon">✅</div>
14717        <div class="lesson-text"><strong>Предупреждения C4267/C4244 во время компиляции — это нормально</strong> — ожидаемые преобразования типов в коде ggml, они не влияют на работу.</div>
14718      </div>
14719    </div>
14720  </div>
14721
14722  <div class="footer">
14723    RX 580 — старая, но все еще в строю 🚀 · Приключения задокументированы в июне 2026 года
14724  </div>
14725
14726</div>`},benchmarks:{id:"benchmarks",title:"23. РЕАЛЬНЫЕ ТЕСТЫ ЛАБОРАТОРИИ",desc:"Консолидированные данные телеметрии, полученные непосредственно из логов вывода для обеих архитектур.",meta:{version:"1.0.0",type:"benchmark",category:"hardware",subcategory:"benchmarks",difficulty:"beginner",estimated_time_min:15,tags:["telemetria","gpu-benchmarks","performance-history"],last_reviewed:"2026-07-01",relationships:{prerequisites:["guia"],previous:"guia",next:"cpu",related:["hardware","cpu"]}},html:`<div class="tbl"><table>
14727    <thead><tr><th>
14727Режим выполнения модели</th><th>Выделенная архитектура</th><th>Полученная коммерческая метрика</th><th>Статус жизнеспособности</th></tr></thead>
14728    <tbody>
14729      <tr><td>Обычный текстовый вывод</td><td>Чистый CPU Xeon (без ускорения)</td><td>3–5 токенов в секунду</td><td>❌ Неэффективно / Медленные ответы</td></tr>
14730      <tr class="hig"><td>Компилированный текстовый вывод</td><td>RX 580 8GB через Vulkan Backend</td><td>15–16 токенов в секунду</td><td>✅ Высокая производительность / Мгновенно</td></tr>
14731      <tr><td>Сэмплирование SD 1.5 (20 Steps)</td><td>ComfyUI Windows через DirectML</td><td>~450 секунд на изображение</td><td>❌ Нестабильно / Отказ из-за критической ошибки</td></tr>
14732      <tr class="hig"><td>Сэмплирование SD 1.5 (20 Steps)</td><td>stable-diffusion.cpp через Vulkan</td><td>72 секунды на изображение</td><td>✅ Оптимизировано / Быстрый отклик</td></tr>
14733    </tbody>
14734  </table></div>`},codacus:{id:"codacus",title:"33. МЕТОД CODACUS против AIVisionsLab",desc:"Эксперимент с 5 флагами, которые спасли GTX 1060 — работают ли они на RX 580?",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:25,tags:["gtx-1060","metodo-codacus","nvidia-pascal"],last_reviewed:"2026-07-01",relationships:{prerequisites:["dadhacks"],previous:"dadhacks",next:"proximos",related:["dadhacks","amihart"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
14735  Канал Codacus опубликовал видео, получившее широкий резонанс, в котором продемонстрировал, как запустить модель с <strong>35B параметрами на GTX 1060 6GB</strong>, используя 5 специфических флагов <code>llama.cpp</code>, что позволило увеличить скорость с 3.0 tokens/s в базовой конфигурации до 17.0 tokens/s после оптимизаций. AIVisionsLab протестировал эту гипотезу на старой <strong>RX 580 2048SP 8GB с Vulkan</strong> — сравнив Windows и нативный Linux.
14736</p>
14737
14738<div class="tbl">
14739  <table>
14740    <thead>
14741      <tr>
14742        <th>Метрика / Конфигурация</th>
14743        <th>Setup Codacus (Ref)</th>
14744        <th>Setup AIVisionsLab</th>
14745      </tr>
14746    </thead>
14747    <tbody>
14748      <tr>
14749        <td><strong>GPU</strong></td>
14750        <td>Nvidia GTX 1060 6GB</td>
14751        <td>AMD Radeon RX 580 2048SP 8GB</td>
14752      </tr>
14753      <tr>
14754        <td><strong>Backend</strong></td>
14755        <td>CUDA</td>
14756        <td>Vulkan (Mesa RADV)</td>
14757      </tr>
14758      <tr>
14759        <td><strong>OS</strong></td>
14760        <td>Linux + Docker</td>
14761        <td>Windows 10 / Ubuntu 26.04</td>
14762      </tr>
14763      <tr>
14764        <td><strong>CPU</strong></td>
14765        <td>Intel Core i3-8100</td>
14766        <td>Intel Xeon E5-2690 v3 (12c/24t)</td>
14767      </tr>
14768      <tr>
14769        <td><strong>Тестовая модель</strong></td>
14770        <td>Qwen3.6 35B-A3B Q4_K_M</td>
14771        <td>Qwen3.6 35B-A3B Q4_K_M (Та же модель)</td>
14772      </tr>
14773    </tbody>
14774  </table>
14775</div>
14776
14777<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Влияние 5 флагов на Vulkan AMD</h3>
14778
14779<div class="tbl">
14780  <table>
14781    <thead>
14782      <tr>
14783        <th>Примененный флаг</th>
14784        <th>Влияние на GTX 1060 (CUDA)</th>
14785        <th>Влияние на RX 580 (Vulkan Windows)</th>
14786        <th>Влияние на RX 580 (Vulkan Linux Native)</th>
14787      </tr>
14788    </thead>
14789    <tbody>
14790      <tr>
14791        <td><strong>Baseline</strong></td>
14792        <td>3.0 tokens/s (-ngl 20)</td>
14793        <td><strong>7.62 tokens/s (-ngl 10)</strong></td>
14794        <td><strong>5.18 tokens/s (-ngl 20)</strong></td>
14795      </tr>
14796      <tr>
14797        <td><code>--override-tensor exps=CPU</code></td>
14798        <td>10.0 tokens/s (+233%)</td>
14799        <td>6.92 tokens/s (❌ -9%)</td>
14800        <td>4.62 tokens/s (❌ -11%)</td>
14801      </tr>
14802      <tr>
14803        <td><code>--no-mmap</code> (или <code>-mmp 0</code>)</td>
14804        <td>13.5 tokens/s (+35%)</td>
14805        <td>7.44 tokens/s (❌ -2%)</td>
14806        <td>4.86 tokens/s (❌ -6%)</td>
14807      </tr>
14808      <tr>
14809        <td>Квантование KV cache (<code>-ctk/ctv</code>)</td>
14810        <td>17.0 tokens/s (+26%)</td>
14811        <td>7.58 tokens/s (❌ -1%)</td>
14812        <td><strong>5.41 tokens/s (✅ +4%)</strong></td>
14813      </tr>
14814      <tr>
14815        <td><code>--mlock</code> / доп. ngl</td>
14816        <td>Повышенная стабильность</td>
14817        <td>OOM выше ngl 10 (❌)</td>
14818        <td>OOM выше ngl 20 (❌)</td>
14819      </tr>
14820    </tbody>
14821  </table>
14822</div>
14823
14824<div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4">
14825  <h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Анализ технических результатов</h4>
14826  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7">
14827    <strong>1. Модель выделения VRAM:</strong> Почему ngl 20 вызывал OOM в Windows, но работал в Linux? Проприетарный драйвер AMD в Windows выделяет память более консервативно, тогда как open-source драйвер <strong>Mesa RADV в Linux</strong> позволяет выгружать больше слоев в буфер (реальный предел в 20 слоев против 10 слоев в Windows).
14828  </p>
14829  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem">
14830    <strong>2. Несовместимость Backend:</strong> Маршрутизация <code>override-tensor exps=CPU</code> для изоляции экспертов Mixtral/MoE от GPU работает великолепно в CUDA благодаря нативному высокоскоростному доступу PCIe у Nvidia. В среде Vulkan накладные расходы на это перемещение данных нивелируют прирост производительности.
14831  </p>
14832  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem">
14833    <strong>3. Мощный Xeon компенсировал Backend:</strong> Несмотря на меньшую оптимизацию VRAM, инфраструктура CPU Xeon E5-2690 v3 (24 потока) в AIVisionsLab обеспечила более высокий базовый показатель в 7.62 tokens/s — превзойдя 3.0 tokens/s у i3-8100 в тесте Codacus.
14834  </p>
14835</div>
14836
14837<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Сравнение Mistral 7B — Чистый CPU против Vulkan</h3>
14838<p style="font-size:.88rem;color:#94a3b8;line-height:1.9">
14839  Чтобы продемонстрировать абсолютную ценность backend Vulkan на устаревшем оборудовании Polaris:
14840</p>
14841<div class="code ok">
14842  <pre>💻 WSL2 Ubuntu (Чистый CPU)  ·  24 потока  ·  1.79 tokens/s
14843🎮 Windows 10 (Vulkan GPU)  ·  12 потоков  ·  18.54 tokens/s (⚡ в 10 раз быстрее!)</pre>
14844</div>
14845<blockquote style="font-size:.82rem;color:#64748b;font-style:italic;line-height:1.8;border-left:3px solid #E11D48;padding-left:.9rem;margin-top:1rem">
14846  "5 флагов Codacus отлично работают для связки NVIDIA + CUDA + Linux Docker. В экосистеме AMD + Vulkan наш собственный рецепт отличается, но он невероятно надежен!"
14847</blockquote>`},"comfyui-directml-func":{id:"comfyui-directml-func",title:"17. ИСПРАВЛЕНИЯ DIRECTML",desc:"Установка специфического dev wheel для обеспечения операционной стабильности.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-batch-fix","memoria-virtual","crash-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml"],previous:"comfyui-directml",next:"comfyui-flux",related:["comfyui-directml","scripts"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Если необходимо выполнить сравнительное тестирование на уровне DirectML без сбоев при инициализации, необходимо принудительно понизить версию пакетов, используя сборку для разработчиков от мая 2024 года:</p>
14848  <div class="code"><pre># Comando para expurgar dependências conflitantes e instalar o dev wheel estável
14849pip uninstall torch torch-directml torchaudio
14850pip install torch==2.3.1+cpu --index-url https://download.pytorch.org/whl/cpu
14851pip install torch-directml==0.2.1.dev240521 --no-deps</pre></div>`},"comfyui-directml":{id:"comfyui-directml",title:"16. DIRECTML",desc:"Подробное техническое объяснение хронических сбоев, обнаруженных во время тестирования в ветке Windows.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fix","windows-driver","comfyui-windows"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-wsl"],previous:"comfyui-wsl",next:"comfyui-directml-func",related:["troubleshoot-comfyui","comfyui-portable-amd"]}},html:`<div class="err">
14851<div class="err-t">Структурный сбой — несовместимость модуля CLIPTextEncode</div><p>При загрузке базовых потоков генерации изображений с использованием нативного установщика DirectML для видеокарт AMD консоль прерывает выполнение, возвращая следующее критическое исключение:</p><div class="code"><span class="code-lang">stderr</span><pre>File "comfy\\utils.py", line 245, in encode_token
14852NotImplementedError: Cannot access storage of OpaqueTensorImpl</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">Инженерный анализ:</strong> Драйвер DirectML инкапсулирует данные памяти в объекты, известные как <code>OpaqueTensorImpl</code>. Когда внутренние функции математической оптимизации внимания ComfyUI пытаются считать необработанное содержимое этих тензоров из физической памяти, уровень экосистемы Microsoft блокирует доступ, прерывая конвейер рендеринга.</p></div>`},"comfyui-flux":{id:"comfyui-flux",title:"18. КРИТИЧЕСКАЯ ПАРАМЕТРИЗАЦИЯ FLUX.1 SCHNELL",desc:"Обязательная математическая конфигурация для обработки модели SOTA на CPU без превышения лимитов RAM.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:20,tags:["flux-fp8","comfyui-workflow","vram-allocation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml-func"],previous:"comfyui-directml-func",next:"comfyui-modelos",related:["flux_server","comfyui-modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Обработка 16GB модели FLUX.1 Schnell в режиме CPU требует фиксированных лимитов сэмплирования. Отклонения от этих правил приводят к зависанию системы из-за экстремального переполнения памяти:</p>
14853  <div class="tbl"><table>
14854    <thead><tr><th>Параметр сэмплирования</th><th>Обязательное значение настройки</th><th>Техническое пояснение для Xeon</th></tr></thead>
14855    <tbody>
14856      <tr class="hig"><td>Sampling Steps</td><td>4 Steps</td><td>Модель Schnell разработана для завершения сходимости шума всего за 4 итерации.</td></tr>
14857      <tr class="hig"><td>CFG Scale</td><td>1.0</td><td>Значения выше 1.0 разрушают точность текстур и искажают распределение тензоров.</td></tr>
14858      <tr><td>Scheduler Type</td><td>sgm_uniform</td><td>Обеспечивает линейную интерполяцию диффузионных тензоров, оптимизированную для инструкций AVX2.</td></tr>
14859    </tbody>
14860  </table></div>`},"comfyui-modelos":{id:"comfyui-modelos",title:"14. ZERO-COPY УПРАВЛЕНИЕ МОДЕЛЯМИ НА NVMe",desc:"Метод символических ссылок для унификации хранения тяжелых чекпоинтов без дублирования файлов.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"armazenamento",difficulty:"intermediate",estimated_time_min:15,tags:["symlink","diretorios-compartilhados","espaco-disco"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-flux"],previous:"comfyui-flux",next:"animatediff-video",related:["arquivos","modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Чтобы избежать нерационального использования пространства на SSD NVMe и исключить необходимость хранения идентичных огромных копий между Windows и Linux (WSL2), создается прямая символическая ссылка, указ
14860ывающая на кросс-файловую систему:</p>
14861  <div class="code"><span class="code-lang">bash</span><pre># Executar este bloco dentro do terminal do subsistema Linux Ubuntu
14862cd ~/ComfyUI/models/checkpoints/
14863
14864# Criar o ponto de ancoragem virtual espelhando o arquivo físico localizado na partição E: do Windows
14865ln -s "/mnt/e/ComfyUI_Models/checkpoints/flux1-schnell-fp8.safetensors" ./flux1-schnell-fp8.safetensors</pre></div>`},"comfyui-portable-amd":{id:"comfyui-portable-amd",title:"29. PORTABLE COMFYUI v0.3.48 — РЕАЛИЗАЦИЯ AMD",desc:"Специфические настройки и внедрение переменных среды для архитектуры Polaris.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-portable","directml-setup","portable-workflow"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshoot-comfyui"],previous:"troubleshoot-comfyui",next:"comunidade",related:["comfyui-directml","comfyui-flux"]}},html:`<div class="card">
14866    <p style="font-size:.88rem;color:#94a3b8;line-height:1.9">Для реализаций, использующих предварительно скомпилированные портативные пакеты ComfyUI, ориентированные на совместимость с AMD DirectML в Windows, интерпретатору Python требуется помощь для корректной идентификации аппаратных возможностей устаревшего GPU:</p>
14867    <div class="code"><span class="code-lang">batch</span><pre># Вставьте в начало файла run_nvidia_gpu.bat или пользовательского портативного скрипта:
14868set HSA_OVERRIDE_GFX_VERSION=8.0.3
14869set DXVK_ASYNC=1
14870
14871.\\python_embeded\\python.exe main.py --directml</pre></div>
14872    <p style="margin-top:.5rem;font-size:.82rem;color:#64748b;line-height:1.6">Флаг <code>8.0.3</code> эмулирует ID архитектуры сборки, необходимый для того, чтобы численные библиотеки могли обрабатывать тензоры без зависания шины PCIe серии RX 500.</p>
14873  </div>`},"comfyui-wsl":{id:"comfyui-wsl",title:"15. COMFYUI WSL2",desc:"Настройка виртуализированной среды Linux для использования вычислительной мощности Xeon и RAM ECC.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"virtualizacao",difficulty:"advanced",estimated_time_min:30,tags:["wsl2-linux","comfyui-wsl","direct-vulkan"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_openwebui_integration"],previous:"sd_openwebui_integration",next:"comfyui-directml",related:["comfyui-flux","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">Чтобы обойти ограничение физической VRAM GPU при работе с массивными моделями, ComfyUI запускается внутри подсистемы Linux с принудительным выполнением вычислений на ядрах процессора:</p>
14874  <div class="code"><span class="code-lang">bash</span><pre># Активация изолированной виртуальной среды через Miniconda в терминале Ubuntu
14875conda activate comfy_env
14876
14877# Запуск основного скрипта с принудительным использованием центрального процессора
14878python main.py --cpu --listen 0.0.0.0 --port 8188</pre></div>
14879  <div class="note info" style="margin-top:.75rem">Панель узлов ComfyUI будет полностью доступна в Windows через сопоставленный адрес: <strong>http://localhost:8188</strong></div>`},comunidade:{id:"comunidade",title:"30. КОНТЕКСТ И ИСТОЧНИКИ СООБЩЕСТВА",desc:"Репозитории хакерских знаний и форумы, посвященные сохранению и оптимизации устаревшего оборудования.",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"comunidade",difficulty:"beginner",estimated_time_min:10,tags:["comunidade-hacker","links-utiles","github-preservation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-portable-amd"],previous:"comfyui-portable-amd",next:"amihart",related:["amihart","dadhacks","codacus"]}},html:`<div class="card acc">
14880    <p style="font-size:.85rem;color:#94a3b8;line-height:1.9">Обратная разработка и техническая жизнеспособность этой лаборатории основаны на дискуссиях по оптимизации, задокументированных сообществами, сфокусированными на извлечении максимальной производительности из недорогих компонентов:</p>
14881    <ul style="padding-left:1.2rem;margin-top:.5rem;font-size:.85rem;color:#e2e8f0;line-height:2">
14882      <li>Официальный Discord-сервер AIVisionsLab: <strong style="color:#5865F2"><a href="https://discord.gg/FmkxZjN8f" target="_blank" rel="noopener noreferrer" style="color:#5865F2;text-decoration:underline">discord.gg/FmkxZjN8f</a></strong></li>
14883      <li>
14883Глобальное сообщество инженеров по серверному оборудованию прошлых поколений: <strong style="color:var(--r)">r/X99_Lab</strong></li>
14884      <li>Дискуссии по оптимизации и параметры компиляции GGUF: <strong style="color:#fff">Github: ggerganov/llama.cpp/discussions</strong></li>
14885    </ul>
14886  </div>`},contexto:{id:"contexto",title:"01. КОНТЕКСТ И ПРОБЛЕМА",desc:"В 2026 году стандартный нарратив был ясен: RX 580 не тянет ИИ. Анализ закрытых экосистем и жизнеспособности ускорения через Vulkan.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:10,tags:["obsolescencia-programada","hardware-livre","preservacao-silicio"],last_reviewed:"2026-07-01",relationships:{prerequisites:[],previous:"",next:"hardware",related:["solucao","jornada"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">В 2026 году стандартный нарратив был ясен: <strong style="color:#fff">RX 580 не тянет ИИ</strong>. Доступные экосистемы были следующими:</p>
14887  <div class="tbl"><table>
14888    <thead><tr><th>Решение</th><th>Статус для RX 580</th></tr></thead>
14889    <tbody>
14890      <tr><td>CUDA (Nvidia)</td><td>❌ Эксклюзивно для Nvidia</td></tr>
14891      <tr><td>ROCm (официальный AMD)</td><td>❌ Поддержка Polaris/GCN4 удалена в версии 5.x</td></tr>
14892      <tr><td>DirectML (Microsoft)</td><td>❌ Заброшено до созревания — нестабильно, медленно</td></tr>
14893      <tr><td>OpenVINO (Intel)</td><td>❌ Несовместимо с Forge на Windows</td></tr>
14894    </tbody>
14895  </table></div>
14896  <div class="tbl" style="margin-top:.9rem"><table>
14897    <thead><tr><th>Элемент</th><th>Статус (до решения)</th></tr></thead>
14898    <tbody>
14899      <tr><td>LLM</td><td>Чистый CPU — от 25 до 40 минут на ответ</td></tr>
14900      <tr><td>Генерация изображений</td><td>ComfyUI через CPU — 50+ минут на изображение на HDD</td></tr>
14901      <tr><td>RX 580</td><td>Простаивает, 0% нагрузки для ИИ</td></tr>
14902      <tr><td>Storage</td><td>Медленный HDD (критическое узкое место I/O)</td></tr>
14903    </tbody>
14904  </table></div>
14905  <div class="card acc" style="margin-top:1.25rem">
14906    <blockquote style="font-size:.88rem;color:#94a3b8;font-style:italic;line-height:1.9;border-left:3px solid var(--r);padding-left:.9rem">"Polaris устарела. Годится только для майнинга. Старая AMD не тянет ИИ. Меняй видеокарту."</blockquote>
14907    <p style="margin-top:.9rem;font-size:.88rem;color:#e2e8f0;font-weight:600">Это убеждение было ложным. Вычислительная мощность была там всегда. Проблема была в программном обеспечении, а не в аппаратном.</p>
14908  </div>
14909  <p style="margin-top:1.25rem;font-size:.88rem;color:#94a3b8;line-height:1.9">Проект <code style="color:var(--r)">ggml</code> (основа <code style="color:var(--r)">llama.cpp</code> и <code style="color:var(--r)">stable-diffusion.cpp</code>) использует Vulkan в качестве GPU-бэкенда — открытый стандарт, который работает на любом современном GPU. RX 580 поддерживает Vulkan 1.x с момента выхода оригинальных драйверов в 2017 году. ROCm и CUDA не требуются.</p>
14910  <p style="margin-top:.9rem;font-size:.88rem;color:#94a3b8;line-height:1.9">Для более крупных моделей (например, FLUX.1 Schnell 16GB) решением является запуск через <strong style="color:#fff">CPU Xeon + большой объем RAM ECC</strong> посредством ComfyUI в WSL2, с использованием символических ссылок на модели в Windows — без дублирования файлов и потери места.</p>`},cpu:{id:"cpu",title:"24. ПАРАМЕТРИЗАЦИЯ И НАСТРОЙКИ XEON",desc:"Настройки BIOS и структурные ограничения инструкций fp32 для процессора LGA 2011-3.",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"processadores",difficulty:"intermediate",estimated_time_min:18,tags:["bios-tuning","avx-optimization","intel-xeon-tuning"],last_reviewed:"2026-07-01",relationships:{prerequisites:["benchmarks"],previous:"benchmarks",next:"troubleshooting",related:["hardware","benchmarks"]}},html:`<div class="card acc">
14911    <p style="font-size:.88rem;color:#e2e8f0;font-weight:600;line-height:1.6">Технические рекомендации для процессоров Xeon с микроархитектурой Haswell (v3):</p>
14912    <p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">Процессор Intel Xeon E5-2690 v3, выпущенный в 2014 году, имеет нативную поддержку набора векторных инструкций <strong style="color:#fff">AVX2</strong>. Однако он не обладает аппаратным обеспечением для математических вычислений с пониженной точностью в <strong style="color:var(--r)">FP16 (Half-Precision)</strong>.</p>
14913    <p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">При инициализации загрузчиков моделей в ComfyUI на Linux убедитесь, что точность вычислений установлена на <strong style="color:#22c55e">FP32 (Single-Precision)</strong>. Если принудительно использовать FP16, процессору придется эмулировать инструкции программно, что снизит скорость обработки вдвое.</p>
14914  </div>`},dadhacks:{id:"dadhacks",title:"32. МЕТОД DADHACKS — AI IMAGE GENERATION ON RX 580 USING VULKAN: A COST-EFFECTIVE SOLUTION",desc:"Анализ экспериментальной консолидации, проведенной DH (DadHacks) в декабре 2025 года, устанавливающий пути совместимости для генерации изображений на устаревшем GPU.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"intermediate",estimated_time_min:20,tags:["dadhacks-method","estetica-baixo-custo","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["amihart"],previous:"amihart",next:"codacus",related:["amihart","codacus"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">5 декабря 2025 года разработчик <strong style="color:#fff">DH (DadHacks)</strong> опубликовал инновационное техническое руководство на сайте <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline">dadhacks.org</a>, продемонстрировав, что GPU AMD RX 580 с 8GB VRAM вполне пригоден для современной генерации ИИ без использования проприетарного ПО или ROCm.</p>
14915
14916  <div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);margin-bottom:1.25rem">
14917    <strong style="color:#fff;display:block;margin-bottom:.4rem">📌 Результаты технической проверки:</strong>
14918    <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">Исследование DadHacks экспериментально доказало возможность запуска Stable Diffusion через Vulkan, уточнив предварительные выводы от января 2025 года. Постепенное развитие экосистемы <code>stable-diffusion.cpp</code> увеличило скорость передачи данных к концу 2025 года.</p>
14919  </div>
14920
14921  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. Компиляция движка — stable-diffusion.cpp</h4>
14922  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">DH подробно описал процесс компиляции в Linux с использованием нативного флага компилятора <code>-DSD_VULKAN=ON</code>:</p>
14923  <div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># Рекурсивное клонирование (обязательно для загрузки подмодулей ggml)
14924git clone --recursive https://github.com/leejet/stable-diffusion.cpp
14925cd stable-diffusion.cpp && mkdir build && cd build
14926
14927# Настройка CMake с включенным Vulkan
14928cmake .. -DSD_VULKAN=ON
14929
14930# Компиляция бинарных файлов
14931cmake --build . --config Release</pre></div>
14932
14933  <p style="font-size:.82rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">🧬 <strong>Документированное различие флагов:</strong> DadHacks использовал <code>-DSD_VULKAN=ON</code> (уровень приложения), в то время как AIVisionsLab подтвердил работу с <code>-DGGML_VULKAN=ON</code> (уровень тензорного движка). На практике оба варианта создают одинаково эффективный бинарный файл, но ссылаются на разные пути развития репозитория leejet.</p>
14934
14935  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. Оригинальные команды генерации (DadHacks)</h4>
14936  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Оригинальная демонстрация вызова через терминал для Flux Schnell (4-битная квантованная модель) и Flux Dev с использованием сегментации памяти для экономии VRAM:</p>
14937  <div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># Запуск Flux Schnell (4 шага сэмплирования)
14938sd --diffusion-model SD-Models/flux1-schnell-q4_0.gguf \\
14939   --vae SD-Models/ae.safetensors \\
14940   --clip_l SD-Models/clip_l.safetensors \\
14941   --t5xxl SD-Models/t5xxl_fp16.safetensors \\
14942   -p "a lovely beagle holding a sign says 'hello'" \\
14943   --cfg-scale 1.0 \\
14944   --sampling-method euler \\
14945   -v --steps 4 \\
14946   --clip-on-cpu</pre></div>
14947
14948  <div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin-bottom:1.25rem">
14949    <strong style="color:#ef4444;display:block;margin-bottom:.4rem">🚨 КРИТИЧЕСКОЕ ПРЕДУПРЕЖДЕНИЕ: Несовместимость GGUF (открытие AIVisionsLab)</strong>
14950    <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">DadHacks не упомянул об очень распространенной несовместимости форматов: веса GGUF, опубликованные мейнтейнером <strong>city96</strong>, совместимы <em>
14950только</em> с ComfyUI. Для запуска в stable-diffusion.cpp / sd-server обязательно использование моделей, официально опубликованных мейнтейнером <strong>leejet</strong> (например: <code style="color:#fff">FLUX.1-schnell-gguf</code>).</p>
14951  </div>
14952
14953  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">C. Что не охватил DadHacks (и что расширил AIVisionsLab)</h4>
14954  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">Оригинальное руководство DadHacks было сосредоточено на экосистеме Linux/терминале с ручными командами. AIVisionsLab значительно расширил эту техническую базу:</p>
14955  <table style="width:100%;border-collapse:collapse;font-size:.78rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem;border:1px solid var(--b)">
14956    <thead>
14957      <tr style="background:rgba(255,255,255,0.02);color:#fff;border-bottom:1px solid var(--b)">
14958        <th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">Функционал</th>
14959        <th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">DadHacks (Linux)</th>
14960        <th style="padding:.5rem;text-align:left">AIVisionsLab (Windows Native)</th>
14961      </tr>
14962    </thead>
14963    <tbody>
14964      <tr style="border-bottom:1px solid var(--b)">
14965        <td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Хостинг на Windows</td>
14966        <td style="padding:.5rem;border-right:1px solid var(--b)">❌ Не рассматривался</td>
14967        <td style="padding:.5rem;color:#22c55e">✅ Маппинг через MSVC / исполняемые файлы Cmd</td>
14968      </tr>
14969      <tr style="border-bottom:1px solid var(--b)">
14970        <td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Графическая интеграция</td>
14971        <td style="padding:.5rem;border-right:1px solid var(--b)">❌ Только CLI терминал</td>
14972        <td style="padding:.5rem;color:#22c55e">✅ API сервер + OpenWebUI / Docker link</td>
14973      </tr>
14974      <tr style="border-bottom:1px solid var(--b)">
14975        <td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Автоматизация .bat</td>
14976        <td style="padding:.5rem;border-right:1px solid var(--b)">❌ Ручные shell скрипты</td>
14977        <td style="padding:.5rem;color:#22c55e">✅ Автоматические скрипты для запуска с рабочего стола</td>
14978      </tr>
14979      <tr>
14980        <td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Безопасность VRAM</td>
14981        <td style="padding:.5rem;border-right:1px solid var(--b)">⚠️ Ограничение базовым CLI</td>
14982        <td style="padding:.5rem;color:#22c55e">✅ Оптимизации с VAE Tiling против ошибок OOM</td>
14983      </tr>
14984    </tbody>
14985  </table>
14986
14987  <div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem">
14988    <strong style="color:var(--r)">Благодарность сообществу:</strong> Документальный раздел основан на оригинальной публикации <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">DH (DadHacks)</a> под названием <em>"AI Image Generation on RX 580 Using Vulkan"</em>. Знания свободны и развиваются.
14989  </div>`},falhas:{id:"falhas",title:"03. ЧТО НЕ СРАБОТАЛО (ТЕХНИЧЕСКОЕ КЛАДБИЩЕ)",desc:"Детальный анализ ошибок: технические причины отказа от нативного DirectML, OpenVINO и ROCm.",meta:{version:"1.0.0",type:"estudo_caso",category:"troubleshooting",subcategory:"historico",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fail","rocm-amd","openvino-intel"],last_reviewed:"2026-07-01",relationships:{prerequisites:["hardware"],previous:"hardware",next:"solucao",related:["troubleshooting","comfyui-directml"]}},html:`<div class="err">
14990    <div class="err-t">3.1 DirectML + ComfyUI Windows Native — ЗАБРОШЕНО</div>
14991    <p><strong style="color:#e2e8f0">Попытки:</strong> Вызов через <code>torch-directml</code> и флаг <code>--directml</code>. Экосистема была определена как <code>privateuseone0</code>, но выявила хроническую нестабильность из-за отсутствия структурных обновлений со стороны Microsoft.</p>
14992    <p style="margin-top:.45rem"><strong style="color:#e2e8f0">Критические логи ошибок:</strong></p>
14993    <div class="code"><span class="code-lang">stderr</span><pre>WARNING: torch-directml barely works, is very slow, has not been updated in over 1 year and might be removed soon, please don't use it.
14994
14995OSError: [WinError 127] Не найдена указанная процедура
14996# Вызвано несоответствием DLL между torchaudio и CPU-сборкой torch 2.4.1
14997
14998NotImplementedError: Cannot access storage of OpaqueTensorImpl
14999# CLIPTextEncode выдает ошибку при попытке обработки непрозрачных тензоров, созданных DirectML</pre></div>
15000    <p style="margin-top:.45rem"><strong style="color:#e2e8f0">Первопричина:</strong> DirectML генерирует непрозрачные тензоры, неспособные взаимодействовать с современными бэкендами внимания ComfyUI. Кроме того, установщик принудительно импортирует <code>torchaudio</code> внутри модуля <code>audio_vae.py</code>, что нарушает инициализацию, даже если вы не используете аудио.</p>
15001  </div>
15002  <div class="err" style="margin-top:1rem">
15003    <div class="err-t">3.2 OpenVINO + Stable Diffusion Forge</div>
15004    <p><strong style="color:#e2e8f0">Попытка:</strong> Подключение расширения <code>sd-webui-openvino</code>, разработанного Intel, внутри экосистемы Forge.</p>
15005    <div class="code"><span class="code-lang">stderr</span><pre>ModuleNotFoundError: No module named 'ldm'
15006ModuleNotFoundError: No module named 'sgm'
15007Error build_unet: Invalid backend: 'openvino'</pre></div>
15008    <p style="margin-top:.45rem"><strong style="color:#e2e8f0">Первопричина:</strong> Расширение было разработано для старой архитектуры Automatic1111. Поскольку Forge полностью перестроил код и заменил нативные модули <code>ldm</code> и <code>sgm</code>, внедрение бэкенда OpenVINO завершается полным провалом.</p>
15009  </div>
15010  <div class="err" style="margin-top:1rem">
15011    <div class="err-t">3.3 ROCm — Непригодно по дизайну для Polaris</div>
15012    <ul>
15013      <li>AMD официально прекратила поддержку архитектуры GCN4 (Polaris/RX 580) в современных ветках ROCm (v5.x+).</li>
15014      <li>Отсутствие официальной поддержки нативного ROCm в среде Windows.</li>
15015      <li>Слои совместимости через WSL2 для старых видеокарт вызывают постоянные Kernel Panics при высоконагруженном инференсе.</li>
15016    </ul>
15017  </div>
15018  <div class="err" style="margin-top:1rem">
15019    <div class="err-t">3.4 WebUI Forge на чистом CPU (HDD)</div>
15020    <p><strong style="color:#e2e8f0">Метрики:</strong> Время запуска 85 секунд. Неприемлемое время рендеринга ~19 минут на одно изображение (512x512, 20 steps). Узкое место HDD в сочетании с управлением подкачкой в <code>memory_management.py</code> сделало такой сетап непрактичным.</p>
15021  </div>`},"flux-vulkan":{id:"flux-vulkan",title:"25. ДОПОЛНИТЕЛЬНОЕ ИССЛЕДОВАНИЕ: FLUX ЧЕРЕЗ VULKAN",desc:"Альтернативное ускорение моделей Flux с использованием ультракомпактных квантований на C++.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["flux-vulkan","cpp-native-inference","amd-acceleration"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshooting"],previous:"troubleshooting",next:"troubleshoot-comfyui",related:["flux_server","sdxl_vulkan"]}},html:`<div class="card">
15022    <p style="font-size:.88rem;color:#94a3b8;line-height:1.9">Хотя нативный чекпоинт FLUX.1 объемом 16GB требует мощной обработки CPU Xeon, вполне возможно выполнять инференс непосредственно на GPU RX 580, используя бинарный файл <code>stable-diffusion.cpp</code> в сочетании с агрессивным 3-битным квантованием:</p>
15023    <div class="note info" style="margin-top:.5rem">Рекомендуемый вес для тестирования VRAM: <strong>flux1-schnell-Q3_K_S.gguf (~5.2GB)</strong>. Этот вариант легко помещается в физический лимит 8GB карты Polaris, обеспечивая генерацию уровня SOTA с аппаратным ускорением.</div>
15024  </div>`},flux_server:{id:"flux_server",title:"11. ЗАПУСК FLUX В SD-SERVER (ГИБРИДНЫЙ GPU + CPU)",desc:"Маппинг и инициализация экосистемы Flux с 12B параметрами и архитектурой сегментированной памяти.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"advanced",estimated_time_min:30,tags:["flux-schnell","servidor-imagem","gerenciamento-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdserver"],previous:"sdserver",next:"sd_bat_automation",related:["comfyui-flux","flux-vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Flux требует точной сегментации между VRAM и системной RAM. Используя флаги <code>--vae-on-cpu</code> и <code>--vae-tiling</code>, мы предотвращаем переполнение памяти (OOM) на RX 580 2048SP. T5XXL (fp16) и VAE размещаются в RAM;
15024 модель диффузии занимает VRAM.</p>
15025  <div class="tbl">
15026    <table>
15027      <thead>
15028        <tr><th>Компонент</th><th>Утвержденный файл</th><th>Финальное размещение</th><th>Размер</th></tr>
15029      </thead>
15030      <tbody>
15031        <tr><td>Diffusion Model</td><td><code>flux1-schnell-q4_k.gguf</code></td><td><strong>GPU (VRAM)</strong></td><td>~6.5 GB</td></tr>
15032        <tr><td>VAE</td><td><code>ae.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~160 MB</td></tr>
15033        <tr><td>CLIP L</td><td><code>clip_l.safetensors</code></td><td><strong>GPU (VRAM)</strong></td><td>~235 MB</td></tr>
15034        <tr><td>T5XXL</td><td><code>t5xxl_fp16.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~9.3 GB</td></tr>
15035      </tbody>
15036    </table>
15037  </div>
15038  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-top:1.25rem">⚠️ <strong style="color:#fff">Заметки о стабильности:</strong> Удаление флага <code>--timeout</code> (не поддерживается текущей версией) и включение <code>--vae-tiling</code> устранили ошибки <em>DeviceMemoryAllocation</em>. Общее использование RAM достигает ~9.5 GB (T5XXL fp16). Для экономии RAM замена на <code>t5xxl_fp8</code> снижает потребление до ~5 GB.</p>
15039  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Команда запуска (iniciar.bat):</strong></p>
15040  <pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
15041  --diffusion-model "E:\\ia_storage\\models\\Stable-diffusion\\flux1-schnell-q4_k.gguf" ^
15042  --vae "E:\\ia_storage\\models\\Stable-diffusion\\ae.safetensors" ^
15043  --clip_l "E:\\ia_storage\\models\\Stable-diffusion\\clip_l.safetensors" ^
15044  --t5xxl "E:\\ia_storage\\models\\Stable-diffusion\\t5xxl_fp16.safetensors" ^
15045  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre>
15046  <div class="tbl" style="margin-top:1.25rem; margin-bottom:1.25rem">
15047    <table>
15048      <thead>
15049        <tr><th>Этап</th><th>Реальное время</th></tr>
15050      </thead>
15051      <tbody>
15052        <tr><td>Кондиционирование (T5XXL)</td><td>11.49s</td></tr>
15053        <tr><td>Sampling — 4 steps @ 1024x1024</td><td>~838s (~14 min)</td></tr>
15054        <tr><td>VAE Decode — 9 tiles</td><td>40.45s</td></tr>
15055        <tr><td><strong>Всего на изображение</strong></td><td><strong>~838s (~14 min)</strong></td></tr>
15056      </tbody>
15057    </table>
15058  </div>
15059  <div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;">
15060    <span style="color:#22c55e; font-weight:bold">✅ СТАТУС: СЕРВЕР В ПРОДАКШЕНЕ — ИЗОБРАЖЕНИЕ УСПЕШНО СГЕНЕРИРОВАНО</span><br>
15061    <span style="font-size:.8rem; color:#94a3b8">Listening on http://0.0.0.0:7860 | VRAM: 7.6/8.0 GB | RAM: ~9.5 GB | GPU: RX 580 2048SP | Temp: 66°C</span>
15062  </div>`},guia:{id:"guia",title:"22. СТРАТЕГИЧЕСКОЕ РУКОВОДСТВО ПО ВАРИАНТАМ ИСПОЛЬЗОВАНИЯ",desc:"Матрица принятия решений: когда перенаправлять обработку на GPU, а когда на Xeon.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:12,tags:["decision-making","workflows","hardware-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["scripts"],previous:"scripts",next:"benchmarks",related:["contexto","benchmarks"]}},html:`<div class="tbl"><table>
15063    <thead><tr><th>Цель рабочего процесса</th><th>Рекомендуемая модель</th><th>Выделенный бэкенд</th><th>
15063Реальные показатели генерации</th></tr></thead>
15064    <tbody>
15065      <tr class="hig"><td>Локальный текстовый чат и помощь</td><td>Mistral 7B / Llama 3 8B GGUF</td><td>GPU RX 580 (Vulkan)</td><td>Высокая производительность (15-16 токенов/с) ⚡</td></tr>
15066      <tr class="hig"><td>Быстрая генерация изображений (512x512)</td><td>DreamShaper 8 (SD 1.5 GGUF)</td><td>GPU RX 580 (Vulkan)</td><td>Плавный рендеринг (~72 секунды)</td></tr>
15067      <tr><td>Создание высокого разрешения и детализации SOTA</td><td>FLUX.1 Schnell (16GB Weights)</td><td>CPU Xeon (WSL2)</td><td>Тяжелая обработка (~24 минуты)</td></tr>
15068      <tr><td>Интерполяция кадров и видеоанимация</td><td>AnimateDiff Pipeline Standard</td><td>CPU Xeon (WSL2)</td><td>Стабильная обработка (~141 секунда)</td></tr>
15069    </tbody>
15070  </table></div>`},hardware:{id:"hardware",title:"02. АППАРАТНОЕ ОБЕСПЕЧЕНИЕ ЛАБОРАТОРИИ",desc:"Подробная конфигурация Master: Xeon E5-2690 v3, RX 580 8GB, 32GB RAM ECC и критическое влияние NVMe.",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"especificacoes",difficulty:"beginner",estimated_time_min:12,tags:["amd-polar","rx-580","intel-xeon","ram-ecc"],last_reviewed:"2026-07-01",relationships:{prerequisites:["contexto"],previous:"contexto",next:"falhas",related:["cpu","benchmarks"]}},html:`<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:.85rem;margin-bottom:1.25rem">
15071    <div class="stat"><div class="stat-icon">🖥️</div><div><div class="stat-lbl">GPU</div><div class="stat-val" style="font-size:.82rem">RX 580 2048SP</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">8GB GDDR5 VRAM</div></div></div>
15072    <div class="stat"><div class="stat-icon">⚙️</div><div><div class="stat-lbl">CPU</div><div class="stat-val" style="font-size:.82rem">Xeon E5-2690 v3</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">12c/24t · 3.5GHz boost</div></div></div>
15073    <div class="stat"><div class="stat-icon">💾</div><div><div class="stat-lbl">RAM</div><div class="stat-val" style="font-size:.82rem">32GB DDR4 REG ECC</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Quad Channel RDIMM</div></div></div>
15074    <div class="stat"><div class="stat-icon">📀</div><div><div class="stat-lbl">Storage</div><div class="stat-val" style="font-size:.82rem">NVMe E: 1TB</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">1.7–3.5 GB/s чтение</div></div></div>
15075    <div class="stat"><div class="stat-icon">🖥️</div><div><div class="stat-lbl">OS</div><div class="stat-val" style="font-size:.82rem">Windows 10 Pro</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">WSL2 Ubuntu 22.04.5</div></div></div>
15076    <div class="stat"><div class="stat-icon">🔧</div><div><div class="stat-lbl">Driver AMD</div><div class="stat-val" style="font-size:.82rem">31.0.21924.61</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Amdnolk (11/12/2025)</div></div></div>
15077  </div>
15078  <div class="tbl"><table>
15079    <thead><tr><th>Компонент</th><th>Спецификация среды</th></tr></thead>
15080    <tbody>
15081      <tr><td>Материнская плата</td><td>Machinist MR9A Pro (Chipset X99, LGA 2011-3)</td></tr>
15082      <tr><td>Вторичный накопитель</td><td>HDD C: (узкое место I/O — модели хранятся на NVMe E:)</td></tr>
15083      <tr><td>Kernel WSL2</td><td>6.6.87.2-microsoft-standard-WSL2</td></tr>
15084      <tr><td>Vulkan SDK</td><td>1.4.341.1</td></tr>
15085      <tr><td>CMake</td><td>4.3.2</td></tr>
15086      <tr><td>Visual Studio</td><td>2022/2026 Community (MSVC 19.50)</td></tr>
15087      <tr><td>Python (WSL2)</td><td>3.11.15</td></tr>
15088      <tr><td>PyTorch (WSL2)</td><td>2.4.1+cu121</td></tr>
15089      <tr><td>ComfyUI Версии</td><td>0.19.3 (WSL2 CPU) | 0.21.0 (Windows DirectML)</td></tr>
15090    </tbody>
15091  </table></div>
15092  <div class="card" style="margin-top:.9rem">
15093    <p style="font-size:.85rem;color:#64748b;line-height:1.9"><strong style="color:#fff">RX 580 2048SP:</strong> Вариант с 2048 Shader Processors (против 2304SP в оригинале). Чрезвычайно распространенная карта после майнинга, которая безупречно работает через Vulkan.</p>
15094    <p style="font-size:.85rem;color:#64748b;line-height:1.9;margin-top:.65rem"><strong style="color:#fff">NVMe vs HDD:</strong> Переход на NVMe сократил время загрузки LLM с 25 минут до 4 минут. В случае с FLUX (16GB) время загрузки сократилось с 25 минут на HDD до всего ~30 секунд на NVMe. <strong style="color:var(--r)">Накопитель так же критичен, как и вычислительная мощность.</strong></p>
15095    <p style="font-size:.85rem;color:#64748b;line-height:1.9;margin-top:.65rem"><strong style="color:#fff">32GB REG ECC:</strong> При работе с FLUX.1 Schnell FP8 система постоянно использует 94% доступной памяти. Серверная RAM ECC обеспечивает абсолютную стабильность и предотвращает повреждение тензоров при экстремальных нагрузках.</p>
15096  </div>`},jornada:{id:"jornada",title:"06. ПОЛНЫЙ ПУТЬ — 5 ЭТАПОВ",desc:"Хронология лаборатории: от начальной медленной работы на CPU до полного контроля над унаследованным оборудованием.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:10,tags:["linha-tempo","conquistas","roadmap"],last_reviewed:"2026-07-01",relationships:{prerequisites:["prereqs"],previous:"prereqs",next:"llama",related:["linhatempo","proximos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.75rem">Технический успех локальной экосистемы был достигнут благодаря 5 эволюционным этапам и стратегическим решениям по аппаратному обеспечению:</p>
15097  <div class="phase">
15098    <div class="phase-num">01</div>
15099    <div class="phase-body">
15100      <div class="phase-hdr"><span class="phase-title">WebUI Forge на чистом CPU (HDD)</span><span class="lbl lbl-b">ИСХОДНАЯ БАЗА</span></div>
15101      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Первая функциональная инфраструктура. Загрузка занимала 85 секунд, а время рендеринга достигало ~19 минут на изображение. Система абсолютно непригодна для продуктивного использования.</p>
15102    </div>
15103  </div>
15104  <div class="phase">
15105    <div class="phase-num">02</div>
15106    <div class="phase-body">
15107      <div class="phase-hdr"><span class="phase-title">Ускорение LLM через Vulkan (RX 580)</span><span class="lbl lbl-r">ТЕХНИЧЕСКИЙ ПРОРЫВ</span></div>
15108      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Успешная компиляция llama.cpp с активацией флага <code>-DGGML_VULKAN=ON</code>. Движок начал распознавать видеокарту Polaris нативно, увеличив скорость вывода с 3-5 t/s до внушительных 15-16 t/s.</p>
15109    </div>
15110  </div>
15111  <div class="phase">
15112    <div class="phase-num">03</div>
15113    <div class="phase-body">
15114      <div class="phase-hdr"><span class="phase-title">Миграция централизованного хранилища на NVMe</span><span class="lbl lbl-y">РЕШАЮЩИЙ ЭТАП</span></div>
15115      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Замена механического HDD на высокоскоростной накопитель NVMe (1.7–3.5 GB/s). Время загрузки языковой модели в память сократилось с 25 минут до всего 4 минут, устранив основное узкое место I/O в лаборатории.</p>
15116    </div>
15117  </div>
15118  <div class="phase">
15119    <div class="phase-num">04</div>
15120    <div class="phase-body">
15121      <div class="phase-hdr"><span class="phase-title">stable-diffusion.cpp нативно через Vulkan</span><span class="lbl lbl-g">ЦЕЛЬ GPU ДОСТИГНУТА ✅</span></div>
15122      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Первое изображение, отрендеренное локально с использованием 100% ресурсов GPU RX 580 в среде Windows. Цикл генерации квантованной модели SD 1.5 GGUF стабилизировался на отметке ~72 секунды.</p>
15123    </div>
15124  </div>
15125  <div class="phase">
15126    <div class="phase-num">05</div>
15127    <div class="phase-body">
15128      <div class="phase-hdr"><span class="phase-title">Масштабирование FLUX.1 Schnell через Xeon + RAM ECC</span><span class="lbl lbl-b">РАСШИРЕНИЕ ВОЗМОЖНОСТЕЙ ✅</span></div>
15129      <p style="font-size:.85rem;color:#64748b;line-height:1.9">Стабильное развертывание модели SOTA объемом 16GB на серверном процессоре. Эмпирическое докаÐ
15129·Ð°Ñ‚ельство того, что корпоративная инфраструктура 2014 года способна надежно обрабатывать современные нейросети 2026 года.</p>
15130    </div>
15131  </div>`},limit_qwen_35b:{id:"limit_qwen_35b",title:"41. ВЫЖИМАЕМ МАКСИМУМ ИЗ QWEN3.5 35B Q6_K НА RX 580 8GB ЧЕРЕЗ VULKAN (Часть 1)",desc:"Эксперимент по экстремальному гибридному запуску модели с 34.66B параметров на GPU Polaris и процессоре Xeon 2014 года.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:45,tags:["qwen-35b","offloading-extremo","vram-spillover"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_srt_ptbr"],previous:"audio_srt_ptbr",next:"proving_hypothesis_35b",related:["proving_hypothesis_35b","llama"]},part:1},html:`<div class="whisper-doc">
15132  <div class="hero">
15133    <div class="hero-title"><span>Выжимаем максимум</span> — Qwen3.5 35B на RX 580</div>
15134    <div class="hero-sub">Эксперимент по экстремальному гибридному запуску модели с <strong>34,66B параметров</strong> на GPU с 8GB VRAM и Xeon 2014 года через движок Vulkan.</div>
15135    <div class="hero-badges">
15136      <span class="badge badge-gpu">AMD RX 580 8GB</span>
15137      <span class="badge badge-win">Xeon E5-2690 v3</span>
15138      <span class="badge badge-ok">Vulkan Híbrido</span>
15139      <span class="badge badge-ok">34.66B parameters</span>
15140      <span class="badge badge-win">Q6_K Quantization</span>
15141    </div>
15142  </div>
15143
15144  <div class="stat-grid">
15145    <div class="stat">
15146      <div class="stat-label">
15146Скорость генерации</div>
15147      <div class="stat-value">5.64 tok/s</div>
15148      <div class="stat-sub">Сессия 2 (Стабильно)</div>
15149    </div>
15150    <div class="stat">
15151      <div class="stat-label">Prompt Eval</div>
15152      <div class="stat-value">34.13 tok/s</div>
15153      <div class="stat-sub">Время отклика ~107с</div>
15154    </div>
15155    <div class="stat">
15156      <div class="stat-label">Максимальная температура</div>
15157      <div class="stat-value">80°C</div>
15158      <div class="stat-sub">Без троттлинга (Цель: 90°C)</div>
15159    </div>
15160    <div class="stat">
15161      <div class="stat-label">Дополнительные затраты</div>
15162      <div class="stat-value">0,00 руб.</div>
15163      <div class="stat-sub">Запуск 100% локально</div>
15164    </div>
15165  </div>
15166
15167  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.0 — Контекст и мотивация</h3>
15168  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
15169    15 июня 2026 года AIVisionsLab провела самый экстремальный эксперимент в своей истории: запуск модели с <strong>34,66 миллиардами параметров</strong> в гибридном режиме на GPU AMD Radeon RX 580 2048SP 2017 года выпуска с объемом VRAM всего 8GB.
15170  </p>
15171  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
15172    "Если RX 580 уже запускает Qwen3 4B со скоростью 35 токенов/с через Vulkan, где находится предел?"
15173  </blockquote>
15174  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
15175    Документация ниже доказывает, что предел находится не там, где его устанавливает рынок оборудования.
15176  </p>
15177
15178  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.1 — Оборудование лаборатории</h3>
15179  <div class="tbl">
15180    <table>
15181      <thead>
15182        <tr>
15183          <th>Компонент</th>
15184          <th>Спецификация</th>
15185        </tr>
15186      </thead>
15187      <tbody>
15188        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 ядер / 24 потока · 3,05 ГГц турбо (выпущен в 2014)</td></tr>
15189        <tr><td><strong>RAM</strong></td><td>31,8 GB DDR4 REG ECC (четырехканальный режим)</td></tr>
15190        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (выпущен в 2017)</td></tr>
15191        <tr><td><strong>Storage 1</strong></td><td>SSD NVMe (Диск E:) — модели GGUF (чтение 1.7–3.5 ГБ/с)</td></tr>
15192        <tr><td><strong>Storage 2</strong></td><td>HDD (Диск C: / F:) — система Windows + файл подкачки</td></tr>
15193        <tr><td><strong>Storage 3</strong></td><td>HDD (Диск D:) — второстепенные файлы</td></tr>
15194        <tr><td><strong>Драйвер AMD</strong></td><td>31.0.21925.1001 — выпущен 20.05.2026</td></tr>
15195        <tr><td><strong>DirectX</strong></td><td>12 (Feature Level 12.0)</td></tr>
15196        <tr><td><strong>Шина</strong></td><td>PCI Express 3, устройство 0, функция 0</td></tr>
15197        <tr><td><strong>Система</strong></td><td>Windows 10/11 с активным WSL2</td></tr>
15198      </tbody>
15199    </table>
15200  </div>
15201  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
15202    *Историческая справка: Xeon E5-2690 v3 выпущен в 2014 году. RX 580 — в 2017. Qwen3.5 — в 2025. Серверное оборудование 10-летней давности обрабатывает ИИ последнего поколения.
15203  </p>
15204
15205  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.2 — Программное обеспечение и версии</h3>
15206  <div class="tbl">
15207    <table>
15208      <thead>
15209        <tr>
15210          <th>ПО</th>
15211          <th>Версия / Детали</th>
15212        </tr>
15213      </thead>
15214      <tbody>
15215        <tr><td><strong>llama.cpp</strong></td><td>build b9049-2496f9c14</td></tr>
15216        <tr><td><strong>Компилятор</strong></td><td>MSVC 14.51.36231 (Visual Studio)</td></tr>
15217        <tr><td><strong>Vulkan SDK</strong></td><td>1.4.350.0</td></tr>
15218        <tr><td><strong>OpenWebUI</strong></td><td>v0.9.6</td></tr>
15219        <tr><td><strong>SearXNG</strong></td><td>через Docker — интегрирован в OpenWebUI</td></tr>
15220        <tr><td><strong>
15220Backend GPU</strong></td><td>Vulkan — <em>без CUDA, без ROCm, без DirectML</em></td></tr>
15221        <tr><td><strong>Docker Desktop</strong></td><td>Активен — контейнеры open-webui + searxng</td></tr>
15222      </tbody>
15223    </table>
15224  </div>
15225
15226  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.3 — Модель: Qwen3.5-35B-A3B-Uncensored Q6_K</h3>
15227  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.1 — Технические характеристики</h4>
15228  <div class="tbl">
15229    <table>
15230      <thead>
15231        <tr>
15232          <th>Параметр</th>
15233          <th>Значение</th>
15234        </tr>
15235      </thead>
15236      <tbody>
15237        <tr><td><strong>Полное имя</strong></td><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K</td></tr>
15238        <tr><td><strong>Архитектура</strong></td><td>qwen35moe — Mixture of Experts (MoE)</td></tr>
15239        <tr><td><strong>Всего параметров</strong></td><td>34,66 миллиарда</td></tr>
15240        <tr><td><strong>Размер файла</strong></td><td>26,55 GiB (6,58 бит на вес)</td></tr>
15241        <tr><td><strong>Квантование</strong></td><td>Q6_K — 432 тензора q6_K + 301 тензор f32</td></tr>
15242        <tr><td><strong>Всего экспертов</strong></td><td>256 экспертов</td></tr>
15243        <tr><td><strong>Активных экспертов на токен</strong></td><td>8 из 256 (активировано только 3,1%)</td></tr>
15244        <tr><td><strong>Макс. контекст обучения</strong></td><td>262.144 токена</td></tr>
15245        <tr><td><strong>Словарь</strong></td><td>248.320 токенов (BPE, токенизатор qwen35)</td></tr>
15246        <tr><td><strong>Стандартный режим Thinking</strong></td><td>АКТИВИРОВАН (<code>thinking = 1</code> в шаблоне Jinja2)</td></tr>
15247        <tr><td><strong>Интервал full attention</strong></td><td>Каждые 4 слоя</td></tr>
15248      </tbody>
15249    </table>
15250  </div>
15251
15252  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.2 — Почему MoE меняет всё</h4>
15253  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
15254    В плотной модели 35B <strong>все</strong> 35 миллиардов параметров активируются для каждого сгенерированного токена. В Qwen3.5 MoE активируются только <strong>8 наиболее релевантных экспертов</strong> из 256 — что эквивалентно ~3B активных параметров на токен.
15255  </p>
15256  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
15257    Это объясняет, почему файл размером 26GB может работать на машине с 32GB RAM: большая часть весов находится в памяти, но <strong>не вычисляется одновременно</strong>.
15258  </p>
15259
15260  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.4 — Команда запуска</h3>
15261  <div class="cmd">
15262# Сессия 1 (порт 8080 — ошибка исправлена позже)
15263.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
15263ort 8080
15264
15265# Сессия 2 (порт 8081 — корректная)
15266.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --port 8081</div>
15267  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
15268    <strong>Никаких ручных флагов слоев (<code>-ngl</code>).</strong> llama.cpp выполнил всю подгонку автоматически.
15269  </p>
15270<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.5 — Автоматическая подгонка: как llama.cpp распределил 26GB за 1,15 секунды</h3>
15271  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
15272    Это техническое ядро эксперимента. Без какого-либо ручного вмешательства llama.cpp выполнил алгоритм оптимизации, который проанализировал доступную VRAM и интеллектуально распределил модель между GPU и RAM.
15273  </p>
15274
15275  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.1 — Исходная ситуация (невозможно загрузить целиком в GPU)</h4>
15276  <div class="cmd">
15277Требуемая память на GPU (полная модель): 32.961 MiB
15278Свободная доступная VRAM:                7.366 MiB
15279Дефицит:                                 26.618 MiB — GPU не может вместить всё</div>
15280
15281  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.2 — Последовательность решений при подгонке (1,15 секунды)</h4>
15282  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
15283    <strong>Шаг 1 — Уменьшение контекста:</strong>
15284  </p>
15285  <div class="cmd">Исходный контекст: 262.144 токенов ➔ Автоматически уменьшенный контекст: 4.096 токенов (Экономия VRAM: 5.347 MiB)</div>
15286  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
15287    <strong>Шаг 2 — Перенос всех экспертов MoE в RAM:</strong>
15288  </p>
15289  <div class="cmd">Vulkan0 с плотными остаточными слоями: 2.418 MiB (Осталось 3.924 MiB свободной VRAM)
15290Хост-RAM (отображенные эксперты MoE): 25.613 MiB</div>
15291  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
15292    <strong>Шаг 3 — Перераспределение плотных слоев обратно в GPU (back-to-front):</strong>
15293  </p>
15294  <div class="cmd">41 плотный слой перераспределен ➔ GPU. Итоговое использование: 3.048 MiB | Свободно: 4.318 MiB</div>
15295  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
15296    <strong>Шаг 4 — Заполнение front-to-back с дробным переполнением (overflow):</strong>
15297  </p>
15298  <div class="cmd">Результат: 41 слой (36 "overflowing") на GPU
15299Тип переполнения: GATE (дробное на gate layer)
15300Итоговое использование GPU: 6.255 MiB | Свободно: 1.111 MiB</div>
15301
15302  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.3 — Итоговое распределение весов</h4>
15303  <div class="tbl">
15304    <table>
15305      <thead>
15306        <tr>
15307          <th>Расположение буфера</th>
15308          <th>Хранимое содержимое</th>
15309          <th>Задействованный объем</th>
15310        </tr>
15311      </thead>
15312      <tbody>
15313        <tr><td><strong>Vulkan0 (RX 580 8GB)</strong></td><td>41 плотный слой + output layer</td><td><strong>5.154 MiB</strong></td></tr>
15314        <tr><td><strong>CPU_Mapped (RAM через mmap)</strong></td><td>256 экспертов MoE</td><td><strong>26.784 MiB</strong></td></tr>
15315      </tbody>
15316    </table>
15317  </div>
15318
15319  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.4 — Дополнительные буферы, выделенные в VRAM</h4>
15320  <div class="tbl">
15321    <table>
15322      <thead>
15323        <tr>
15324          <th>Тип буфера</th>
15325          <th>Выделенный объем</th>
15326          <th>Физическое описание</th>
15327        </tr>
15328      </thead>
15329      <tbody>
15330        <tr><td><strong>KV Cache (Vulkan0)</strong></td><td>80,00 MiB</td><td>4.096 ячеек, 10 слоев</td></tr>
15331        <tr><td><strong>RS Buffer (Vulkan0)</strong></td><td>251,25 MiB</td><td>рекуррентный: 40 слоев, 4 seqs</td></tr>
15332        <tr><td><strong>Compute Buffer (Vulkan0)</strong></td><td>770,02 MiB</td><td>Активируется во время вычислительных графов</td></tr>
15333        <tr><td><strong>Host Compute Buffer</strong></td><td>16,02 MiB</td><td>Системная RAM</td></tr>
15334        <tr><td><strong>Output Buffer (Vulkan_Host)</strong></td><td>3,79 MiB</td><td>Буфер вывода токенов</td></tr>
15335      </tbody>
15336    </table>
15337  </div>
15338  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
15339    <strong>Эффективный итог в VRAM во время инференса: ~6,2–7,2 GB</strong> (77–90% от 8GB физически свободной памяти).
15340  </p>
15341
15342  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.5 — Автоматически включенные функции</h4>
15343  <div class="cmd">
15344✅ Flash Attention (auto ➔ ENABLED)
15345✅ Fused Gated Delta Net — autoregressive
15346✅ Fused Gated Delta Net — chunked
15347✅ Prompt cache (лимит: 8.192 MiB, ~89.715 MiB сохранено на диске)
15348✅ Thinking mode (thinking = 1)
15349✅ 4 параллельных слота (n_seq_max = 4)
15350
15351Graph nodes: 3.729 | Graph splits: 106 (с bs=512), 74 (с bs=1)
15352Reserve: 137–183 мс</div>
15353
15354  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.6 — 4-уровневая архитектура памяти</h3>
15355  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
15356    Первый задокументированный случай использования модели 35B с <strong>одновременным задействованием 4 уровней памяти</strong> для обработки на обычной RX 580:
15357  </p>
15358  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.8rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
15359    <div>⚡ <strong style="color:#ff9e64">УРОВЕНЬ 1 — VRAM RX 580 (8GB GDDR5):</strong> 5.154 MiB плотных слоев | Доступ: ~400 GB/s (GDDR5) | Задержка: наносекунды</div>
15360    <div style="margin-top:0.5rem">🧠 <strong style="color:#7aa2f7">УРОВЕНЬ 2 — RAM DDR4 ECC (32GB System):</strong> 26.784 MiB экспертов MoE через mmap | Доступ: ~51 GB/s (quad-ch
15360annel) | Задержка: десятки нс</div>
15361    <div style="margin-top:0.5rem">💾 <strong style="color:#22c55e">УРОВЕНЬ 3 — SSD NVMe (Диск E:):</strong> 26,55 GiB исходного файла .gguf | Доступ: 1,7–3,5 GB/s | Используется при начальной загрузке</div>
15362    <div style="margin-top:0.5rem">📁 <strong style="color:#e0af68">УРОВЕНЬ 4 — HDD (Диск C: Swap):</strong> Файл подкачки Windows, активируется при исчерпании RAM (>97% использования) | Доступ: ~120–180 MB/s | Пик 98–100% использования при инференсе</div>
15363  </div>
15364
15365  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.7 — Конфигурация загруженного контекста</h3>
15366  <div class="cmd">
15367n_ctx         = 4.096 токенов (уменьшено с 262.144 при подгонке)
15368n_batch       = 2.048
15369n_ubatch      = 512
15370n_seq_max     = 4 (параллельные слоты)
15371flash_attn    = auto ➔ ENABLED
15372kv_unified    = true</div>
15373  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
15374    <strong>Критическое ограничение:</strong> Контекст в 4.096 токенов является главным узким местом системы. Thinking mode (режим рассуждения) модели Qwen3.5 потребляет 3.000+ токенов только на процесс мышления перед генерацией видимого ответа — оставляя менее 1.000 токенов для финального ответа пользователю.
15375  </p>
15376
15377  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.8 — Бенчмарк, подтвержденный в двух сессиях</h3>
15378  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">
15378Скорость генерации</h4>
15379  <div class="tbl">
15380    <table>
15381      <thead>
15382        <tr>
15383          <th>Сессия</th>
15384          <th>Примерное время</th>
15385          <th>Скорость Prompt Eval</th>
15386          <th>Скорость генерации</th>
15387          <th>Всего токенов</th>
15388          <th>Общее время</th>
15389        </tr>
15390      </thead>
15391      <tbody>
15392        <tr><td><strong>Сессия 1</strong></td><td>~17:39</td><td><strong>34,13 tok/s</strong></td><td><strong>5,57 tok/s</strong></td><td>1.377 tok</td><td>~107 секунд</td></tr>
15393        <tr><td><strong>Сессия 2</strong></td><td>~21:34</td><td>~40.00 tok/s</td><td><strong>5,64 tok/s</strong></td><td>2.929 tok</td><td>~533 секунды</td></tr>
15394      </tbody>
15395    </table>
15396  </div>
15397  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
15398    <strong>Примечательная стабильность:</strong> Поддержание скорости генерации на уровне ~5,6 токенов/сек независимо от того, была ли сессия перегружена или «холодной».
15399  </p>
15400<h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Журнал зарегистрированных температур</h4>
15401  <div class="tbl">
15402    <table>
15403      <thead>
15404        <tr>
15405          <th>Этап теста</th>
15406          <th>Темп. GPU (°C)</th>
15407        </tr>
15408      </thead>
15409      <tbody>
15410        <tr><td>Idle (модель загружена в VRAM)</td><td>33–41°C</td></tr>
15411        <tr><td>Обычная инференция (без активного Web Search)</td><td>44–64°C</td></tr>
15412        <tr><td>Нагруженная инференция (с активным Web Search)</td><td>70–75°C</td></tr>
15413        <tr><td><strong>Абсолютный пик</strong></td><td><strong>80°C</strong></td></tr>
15414        <tr><td>После завершения ответа</td><td>71–73°C</td></tr>
15415      </tbody>
15416    </table>
15417  </div>
15418  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
15419    <strong>Температура троттлинга RX 580:</strong> ~90°C. <strong>Операционный запас безопасности полностью соблюден!</strong>
15420  </p>
15421
15422  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Использование ресурсов при физической инференции</h4>
15423  <div class="tbl">
15424    <table>
15425      <thead>
15426        <tr>
15427          <th>Аппаратный ресурс</th>
15428          <th>Idle</th>
15429          <th>Во время инференции</th>
15430          <th>Пик</th>
15431        </tr>
15432      </thead>
15433      <tbody>
15434        <tr><td>Выделенная VRAM</td><td>6,7 / 8,0 GB</td><td>6,8 – 7,2 / 8,0 GB</td><td>7,4 GB / 8,0 GB</td></tr>
15435        <tr><td>Системная RAM</td><td>~29,0 GB</td><td>30,7 – 31,1 GB</td><td>31,2 / 31,8 GB (98% исп.)</td></tr>
15436        <tr><td>CPU Xeon v3</td><td>3%</td><td>62 – 70%</td><td>70%</td></tr>
15437        <tr><td>GPU 3D-нагрузка</td><td>0%</td><td>1 – 3%</td><td>3% (Нагрузка на шину PCIe)</td></tr>
15438        <tr><td>HDD C: (Активность swap)</td><td>0%</td><td>13 – 42%</td><td>98 – 100% (Предел swap)</td></tr>
15439      </tbody>
15440    </table>
15441  </div>
15442
15443  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.9 — 5 тестов: Полная история инженерных испытаний</h3>
15444  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
15445    <strong>Входной запрос, отправленный во всех тестах:</strong><br>
15446    "Подробно объясни, как работает механизм внимания в трансформерах и почему MoE эффективнее плотных моделей. Ответь на португальском."
15447  </blockquote>
15448
15449  <div style="display:flex;flex-direction:column;gap:1rem;margin-bottom:1.5rem">
15450    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
15451      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">
15451ТЕСТ 1 — Сессия 1 · Raciocínio ON + Web Search ON + Генерация изображений ON</h5>
15452      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
15453        <strong>Результат:</strong> ❌ Ошибка протокола (ответ не получен) | <strong>Лог ошибки:</strong> <code>operator (): got exception: {"error":"code":400,"message":"Assistant response prefill is incompatible with enable_thinking."}</code>
15454      </p>
15455      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
15456        <strong>Анализ:</strong> Модель обрабатывала мыслительный процесс около 1 минуты, извлекая 10 источников из SearXNG, но OpenWebUI вставил некорректный prefill, несовместимый с флагом мышления Jinja2, что привело к отмене.
15457      </p>
15458    </div>
15459
15460    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
15461      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">ТЕСТ 2 — Сессия 2 · Raciocínio ON + Web Search ON (30 последовательных поисков)</h5>
15462      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
15463        <strong>Результат:</strong> ❌ Контекст исчерпан | <strong>Лог ошибки:</strong> <code>stop processing: n_tokens = 3285, truncated = 1</code>
15464      </p>
15465      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
15466        <strong>Анализ:</strong> 30 поисковых запросов SearXNG добавили тысячи токенов контекста в память. Режим thinking попытался выделить собственный буфер и превысил лимит в 4096 токенов гибридной настройки, вызвав преждевременную остановку.
15467      </p>
15468    </div>
15469
15470    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
15471      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">ТЕСТ 3 — Сессия 2 · Raciocínio ON + Web Search ON (25 поисков, новый накопленный раунд)</h5>
15472      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
15473        <strong>Результат:</strong> ❌ Контекст исчерпан | <strong>Лог ошибки:</strong> <code>stop processing: n_tokens = 4095, truncated = 1</code>
15474      </p>
15475      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
15476        <strong>Анализ:</strong> OpenWebUI попытался повторно отправить запрос, накопив историю предыдущего диалога. Промпт увеличился настолько, что достиг жесткого аппаратного лимита в 4095 токенов при Fitting.
15477      </p>
15478    </div>
15479
15480    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
15481      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">ТЕСТ 4 — Сессия 2 · Raciocínio ON + Web Search OFF</h5>
15482      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
15483        <strong>Результат:</strong> ❌ Тайм-аут клиента | <strong>Лог ошибки:</strong> <code>stop: cancel task, id_task = 6887 (truncated = 0)</code>
15484      </p>
15485      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
15486        <strong>Анализ:</strong> Без web-search тепловыделение упало до стабильных 51°C, использование swap снизилось. Однако обработка внутреннего мышления на CPU Xeon 2014 года заняла достаточно времени, чтобы UI сработал по тайм-ауту безопасности вызовов.
15487      </p>
15488    </div>
15489
15490    <div style="border:1px solid rgba(34, 197, 94, 0.2);background:rgba(0, 3, 1, 0.6);border-radius:6px;padding:1rem">
15491      <h5 style="color:#22c55e;font-weight:bold;font-size:0.85rem">
15491✅ ТЕСТ 5 — Сессия 2 · Raciocínio ON + Web Search OFF + Короткий промпт (45 токенов)</h5>
15492      <p style="font-size:0.8rem;color:#c2ffd2;line-height:1.6;margin-top:0.25rem">
15493        <strong>Результат:</strong> АБСОЛЮТНЫЙ УСПЕХ ✅ | Глубокий технический ответ предоставлен полностью на структурированном португальском языке.
15494      </p>
15495      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
15496        <strong>Анализ:</strong> Ограничив начальный промпт 45 токенами и отключив дополнительные шумы, процесс мышления смог выполняться в течение полных 4 минут на Xeon, выполняя черновик уравнений и безупречно отвечая о трансформерах (Softmax, Multiheads) и эффективности MoE.
15497      </p>
15498    </div>
15499  </div>
15500
15501  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.10 — Сводная таблица поведения тестов</h3>
15502  <div class="tbl">
15503    <table>
15504      <thead>
15505        <tr>
15506          <th>ID</th>
15507          <th>Thinking</th>
15508          <th>Web Search</th>
15509          <th>Prompt Token</th>
15510          <th>Статус</th>
15511          <th>Реальная причина сбоя</th>
15512        </tr>
15513      </thead>
15514      <tbody>
15515        <tr><td>1</td><td>ON</td><td>ON (10 ист.)</td><td>~936 tok</td><td>❌ Сбой</td><td>Prefill ответа несовместим с thinking=1</td></tr>
15516        <tr><td>2</td><td>ON</td><td>ON (30 поис.)</td><td>~357 tok</td><td>❌ Сбой</td><td>Исчерпание контекста Fitting (макс. 4095)</td></tr>
15517        <tr><td>3</td><td>ON</td><td>ON (25 поис.)</td><td>~3.385 tok</td><td>❌ Сбой</td><td>Мгновенное исчерпание контекста при повторе</td></tr>
15518        <tr><td>4</td><td>ON</td><td>OFF</td><td>~350 tok</td><td>❌ Сбой</td><td>Тайм-аут запросов OpenWebUI до вывода</td></tr>
15519        <tr style="background:rgba(34, 197, 94, 0.05)"><td><strong>5</strong></td><td><strong>ON</strong></td><td><strong>OFF</strong></td><td><strong>45 tok</strong></td><td><strong>✅ УСПЕХ</strong></td><td><strong>Компактный промпт полностью поместился в архитектуру mmap</strong></td></tr>
15520      </tbody>
15521    </table>
15522  </div>
15523<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
15524    <strong>Критический вывод:</strong> RX 580 из лаборатории 2017 года и Xeon работали стабильно, не вызывая физических сбросов ни в одной из стрессовых ситуаций. Сбои были связаны исключительно с логической калибровкой фронтенд-программного обеспечения.
15525  </p>
15526
15527  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.11 — Сбор результатов и критические ограничения</h3>
15528  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
15529    <li><strong style="color:#fff">Несовместимость Thinking с коротким контекстом:</strong> Согласно архитектуре модели, процесс «мышления» потребляет около 3000 токенов, что быстро переполняет выделенный KV Cache объемом 4096, если промпт или история диалога слишком длинные.</li>
15530    <li><strong style="color:#fff">Автоматическое распределение llama.cpp исключительно эффективно:</strong> Принудительное разделение через жесткие экспериментальные флаги, такие как <code>--override-tensor</code>, нарушает вызовы в Vulkan. Распределение на основе вычисления графов позволило идеально оптимизировать нагрузку.</li>
15531    <li><strong style="color:#fff">Перегрев GPU устранен:</strong> Только глубокий рендеринг с десятками одновременных фильтров приводил к нагреву до 80°C. Ограничение GPU для вывода плотных фракций поддерживает температуру чипа в комфортных пределах 44-64°C.</li>
15532    <li><strong style="color:#fff font-weight:bold">
15532Узкое место — скорость I/O Swap на HDD:</strong> Когда использование RAM достигает 98%, скорость падает до 5 ток/с из-за HDD. Перенос всего swap хоста на твердотельные накопители значительно увеличит общую скорость потока.</li>
15533  </ul>
15534
15535  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.12 — Прямое сравнение с проектами сообщества</h3>
15536  <div class="tbl">
15537    <table>
15538      <thead>
15539        <tr>
15540          <th>Проект / Автор</th>
15541          <th>Используемая архитектура</th>
15542          <th>Тестируемая модель</th>
15543          <th>Скорость генерации</th>
15544          <th>Статус авторства</th>
15545        </tr>
15546      </thead>
15547      <tbody>
15548        <tr><td><strong>Matheus Fertunani</strong></td><td>Коммерческий Linux / Чистый CPU Xeon (192GB RAM)</td><td>Qwen3.5 35B Q8</td><td>~7–8 токенов/с</td><td>Задокументировано на YouTube</td></tr>
15549        <tr><td><strong>AIVisionsLab (Наши тесты)</strong></td><td>Гибридный Vulkan (RX 580 8GB + 32GB RAM ECC)</td><td>Qwen3.5 35B Q6_K</td><td><strong>5,64 токенов/с</strong></td><td>✅ Проверено и зарегистрировано</td></tr>
15550      </tbody>
15551    </table>
15552  </div>
15553  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
15554    <strong>Главное архитектурное преимущество:</strong> Тест на чистом CPU от Matheus требует дорогостоящего профессионального оборудования с более чем 100GB установленной RAM. Экосистема Vulkan от AIVisionsLab доказала свою работоспособность на GPU стоимостью менее 400 реалов на вторичном рынке!
15555  </p>
15556
15557  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.13 — Рекомендуемые конфигурации для будущих тестов</h3>
15558  <div class="cmd">
15559# Тест 6 — Явное отключение thinking через сервер в последних версиях сборки:
15560.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
15560ort 8081 --no-thinking
15561
15562# Тест 7 — Строгое увеличение контекстных буферов при перенаправлении памяти:
15563.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-...-Q6_K.gguf" --host 0.0.0.0 --port 8081 --ctx-size 8192
15564
15565# Тест 8 — Тестирование с меньшими квантованиями, такими как Q4_K_M (~21GB):
15566# Освобождение дополнительных ~5GB в хост-RAM, что снижает зависимость от swap на HDD и значительно улучшает показатель ток/с!</div>
15567
15568  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.14 — Консолидированные технические уроки</h3>
15569  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
15570    <li><strong style="color:#fff">Кремний 2017 года — не предел:</strong> Видеокарта ни разу не зависла во время непрерывных стресс-тестов на нагрев, проводившихся десятки раз. Узким местом оказалась лишь логическая калибровка ПО.</li>
15571    <li><strong style="color:#fff">Разреженность MoE спасает категорию:</strong> Без MoE было бы немыслимо запустить модель с 26GB активных весов. MoE позволяет активировать лишь 3.1% нейронов на каждый токен.</li>
15572  </ul>
15573
15574  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.15 — Общий вердикт лаборатории</h3>
15575  <div class="tbl">
15576    <table>
15577      <thead>
15578        <tr>
15579          <th>Инженерный вопрос</th>
15580          <th>Итоговый вердикт</th>
15581        </tr>
15582      </thead>
15583      <tbody>
15584        <tr><td><strong>Поддерживает ли RX 580 8GB модели 35B параметров?</strong></td><td>✅ <strong>Да</strong> (в гибридном режиме mmap)</td></tr>
15585        <tr><td><strong>Практично ли это для повседневного использования?</strong></td><td>⚠️ <strong>Нет</strong> (5,6 ток/с и контекст 4096 токенов)</td></tr>
15586        <tr><td><strong>Подходит ли как доказательство концепции?</strong></td><td>✅ <strong>Абсолютно</strong></td></tr>
15587        <tr><td><strong>Был ли троттлинг или сбои?</strong></td><td>✅ <strong>Нулевая нестабильность</strong></td></tr>
15588        <tr><td><strong>Максимальная зарегистрированная температура</strong></td><td><strong>80°C</strong> (запас прочности: ~90°C)</td></tr>
15589        <tr><td><strong>
15589Скорость генерации</strong></td><td><strong>~5,6 токенов/секунду</strong></td></tr>
15590        <tr><td><strong>Общий объем задействованной памяти</strong></td><td><strong>~34 GB</strong> (VRAM + RAM + swap HDD)</td></tr>
15591      </tbody>
15592    </table>
15593  </div>
15594
15595  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.16 — Хронология эксперимента</h3>
15596  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
15597    <div>🕒 <strong>~17:39</strong> — Сервер запущен на порту 8080 (ошибка)</div>
15598    <div>🕒 <strong>~17:40</strong> — "Network Problem" в OpenWebUI (неверный порт)</div>
15599    <div>🕒 <strong>~17:41</strong> — Сервер закрыт при смене порта → перезапущен на 8081</div>
15600    <div>🕒 <strong>~17:42</strong> — Все инструменты включены в модели (изображение, веб, терминал)</div>
15601    <div>🕒 <strong>~17:43</strong> — <strong>ТЕСТ 1</strong> запущен</div>
15602    <div>🕒 <strong>~17:44</strong> — Веб-поиск: получено 10 источников</div>
15603    <div>🕒 <strong>~17:44</strong> — Попытка генерации изображения → ошибка обработана → продолжение</div>
15604    <div>🕒 <strong>~17:45</strong> — В OpenWebUI появилось "Thinking for a minute"</div>
15605    <div>🕒 <strong>~17:46</strong> — Структурированный ответ с внутренне сгенерированным заголовком</div>
15606    <div>🕒 <strong>~17:50</strong> — Ошибка протокола (prefill + thinking) → нет вывода. Пик: 80°C</div>
15607    <div>🕒 <strong>~21:34</strong> — Сессия 2 запущена</div>
15608    <div>🕒 <strong>~21:34</strong> — <strong>ТЕСТ 2</strong> запущен — веб-поиск ВКЛ (30 запросов). Контекст усечен.</div>
15609    <div>🕒 <strong>~21:48</strong> — <strong>ТЕСТ 3</strong> автоматический — 25 запросов. Контекст усечен.</div>
15610    <div>🕒 <strong>~22:00</strong> — <strong>ТЕСТ 4</strong> — веб-поиск ВЫКЛ. Температура упала до 51°C. Тайм-аут UI.</div>
15611    <div>🕒 <strong>~23:06</strong> — <strong>ТЕСТ 5</strong> — промпт из 45 токенов. Thinking успешно декодировано.</div>
15612    <div>🕒 <strong>~23:14</strong> — Полный ответ доставлен на португальском ✅. GPU: 64°C | RAM: 96%</div>
15613  </div>
15614
15615  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.17 — Значение для документации AIVisionsLab</h3>
15616<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
15617    Этот эксперимент дополняет проект: новый надежный бенчмарк 5,6 tok/s для гибридных моделей 35B MoE, подтверждение того, что автоматический fitting в llama.cpp превосходит жесткие ручные настройки через Vulkan, четкое выявление несовместимости режима thinking с контекстами менее 8.192 и описание архитектуры, расширенной до 4 уровней памяти.
15618  </p>
15619
15620  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.18 — Теги и метаданные</h3>
15621  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
15622    <div>🏷️ <strong>Теги:</strong> hybrid, moe, vulkan, rx580, large-model, thinking-mode, limits, qwen35b, benchmark, fitting-automático, 4-memory-levels, sem-throttling</div>
15623    <div style="margin-top:0.5rem">💻 <strong>Оборудование:</strong>
15623 RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
15624    <div style="margin-top:0.25rem">💿 <strong>ПО:</strong> llama.cpp b9049 + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
15625    <div style="margin-top:0.25rem">📅 <strong>Дата:</strong> 15/06/2026</div>
15626    <div style="margin-top:0.25rem">⏱️ <strong>Сессии:</strong> 2 (17:39–18:24 и 21:34–23:14)</div>
15627    <div style="margin-top:0.25rem">📊 <strong>Тесты:</strong> 5 (4 программных сбоя, 1 успешный полный вывод)</div>
15628    <div style="margin-top:0.25rem">📈 <strong>Бенчмарк:</strong> 5,57–5,64 tok/s (генерация) | 34,13 tok/s (prompt eval)</div>
15629    <div style="margin-top:0.25rem">🔥 <strong>Пиковая температура:</strong> 80°C</div>
15630    <div style="margin-top:0.25rem">🏆 <strong>Итоговый статус:</strong> ✅ ОБОРУДОВАНИЕ ОДОБРЕНО</div>
15631  </div>
15632
15633  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
15634    "Проблема никогда не была в оборудовании.<br>
15635    Дело было в сочетании thinking + web search, исчерпывающем 4.096 токенов контекста.<br>
15636    С коротким промптом и без web search, Qwen3.5-35B Q6_K работает в штатном режиме на RX 580 2017 года."<br>
15637    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 15/06/2026</span>
15638  </blockquote>
15639
15640  <div class="footer">
15641    Документация создана Claude Sonnet 4.6 — 15/06/2026 · Основано на реальных логах, скриншотах, бенчмарках и наблюдениях в реальном времени · Сессия 1: ~17:39–18:24 | Сессия 2: ~21:34–23:14 · 5 задокументированных тестов · 1 успешный · Оборудование 2017 года обрабатывает ИИ 2025 года
15642  </div>
15643</div>`},linhatempo:{id:"linhatempo",title:"37. КОЛЛЕКТИВНАЯ ХРОНОЛОГИЯ — ЭВОЛЮЦИЯ RX 580 КАК ПЛАТФОРМЫ ДЛЯ ИИ",desc:"Унифицированный исторический и сравнительный анализ, документирующий преодоление барьеров и устаревания RX 580 в три революционных этапа (2025-2026).",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:25,tags:["evolucion-historica","rx580-timeline","comunidade-hacker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["meta"],previous:"meta",next:"audio_rvc",related:["jornada","comunidade"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Техническое спасение и восхождение AMD Radeon RX 580 в качестве практической платформы для искусственного интеллекта — это не плод работы одного человека, а результат <strong>коллективной эволюции</strong>. Три независимых проекта, построенных на общей математической базе экосистемы <code>ggml</code>, проложили этот путь:</p>
15644
15645  <!-- Linha do Tempo Visual -->
15646  <div style="position:relative;margin:2rem 0;padding-left:1.5rem;border-left:2px solid var(--b)">
15647    <div style="margin-bottom:1.5rem;position:relative">
15648      <div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:var(--r);border:2px solid #07080a"></div>
15649      <span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:var(--r);font-weight:bold">ЯНВАРЬ 2025</span>
15650      <h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">Метод Amihart (Debian Linux)</h5>
15651      <p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Первая задокументированная веха. Валидация LLM с ускорением Vulkan в <code>llama.cpp</code> с достижением 24.56 t/s. Тем не менее, было заявлено: <em>"Vulkan не работает для Stable Diffusion"</em> из-за ограничений программного обеспечения того времени, что привело к использованию ROCm через Docker.</p>
15652    </div>
15653    <div style="margin-bottom:1.5rem;position:relative">
15654      <div style="position:absolute;
15654left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#eab308;border:2px solid #07080a"></div>
15655      <span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#eab308;font-weight:bold">ДЕКАБРЬ 2025</span>
15656      <h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">Метод DadHacks (Linux/Debian)</h5>
15657      <p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Эмпирическое опровержение невозможности использования Stable Diffusion через Vulkan. Использован недавно выпущенный движок <code>stable-diffusion.cpp</code> с флагом компиляции <code>-DSD_VULKAN=ON</code> для запуска генерации GGUF модели Flux Schnell с сегментацией CPU/GPU.</p>
15658    </div>
15659    <div style="position:relative">
15660      <div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#22c55e;border:2px solid #07080a"></div>
15661      <span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#22c55e;font-weight:bold">СЕЗОН 2026</span>
15662      <h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">AIVisionsLab (Windows Native + WSL2)</h5>
15663      <p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">Унификация производственной экосистемы. Разработана нативная автоматизация через <code>.bat</code>, интеграция локального рендеринга Vulkan в удобные панели (OpenWebUI через Docker), задокументированы фоллбэки на CPU Xeon для моделей SOTA и проведен исчерпывающий анализ причин сбоев DirectML/ROCm в Windows.</p>
15664    </div>
15665  </div>
15666
15667  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:2rem 0 .75rem 0;text-transform:uppercase">A. Вопрос, на который ответил каждый проект</h4>
15668  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">Эволюцию технической зрелости RX 580 можно описать через предпосылки, на которые ответили авторы:</p>
15669  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
15670    <li><strong style="color:#fff">Amihart (Янв 2025):</strong> <em>"Возможно ли быстро запускать LLM на RX 580 без официального ROCm?"</em> <strong style="color:var(--r)">Да</strong>, путем компиляции llama.cpp с чистым Vulkan API.</li>
15671    <li><strong style="color:#fff">DadHacks (Дек 2025):</strong> <em>"Возможно ли генерировать изображения с помощью ИИ с ускорением Vulkan на RX 580?"</em> <strong style="color:var(--r)">Да</strong>, путем компиляции stable-diffusion.cpp и использования альтернативного стабильного формата GGUF.</li>
15672    <li><strong style="color:#fff">AIVisionsLab (2026):</strong> <em>"Возможно ли развернуть всю эту инфраструктуру в интегрированном и удобном для пользователя виде на Windows?"</em> <strong style="color:var(--r)">Да</strong>, создав сетевые мосты для контейнеров Docker, унифицированную автоматизацию и интеллектуальные фоллбэки с GPU на CPU при нехватке VRAM.</li>
15673  </ul>
15674
15675  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. Унифицированная сводная таблица</h4>
15676  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">Структурированное сопоставление возможностей и накопленных достижений:</p>
15677  <div class="tbl" style="margin-bottom:1.5rem">
15678    <table>
15679      <thead>
15680        <tr>
15681          <th>Возможность</th>
15682          <th>Amihart (2025)</th>
15683          <th>DadHacks (2025)</th>
15684          <th>AIVisionsLab (2026)</th>
15685        </tr>
15686      </thead>
15687      <tbody>
15688        <tr><td><strong>Базовая система</strong></td><td>Debian Linux</td><td>Linux Debian</td><td>Windows 10 Pro + WSL2 Linux</td></tr>
15689        <tr><td><strong>Движок LLM</strong></td><td>✅ Vulkan (24.56 t/s)</td><td>✅ Vulkan (llama.cpp)</td><td>✅ Vulkan (15-16 t/s)</td></tr>
15690        <tr><td><strong>Движок SD</strong></td><td>❌ Невозможно на Vulkan</td><td>✅ Чистый Vulkan</td><td>✅ Чистый Vulkan (~72s SD1.5)</td></tr>
15691        <tr><td><strong>Flux GGUF</strong></td><td>❌ Отсутствует</td><td>✅ Командная строка</td><td>✅ Гибрид GPU/CPU Стабильно</td></tr>
15692        <tr><td><strong>Графический интерфейс</strong></td><td>❌ Только консоль / WebUI Docker</td><td>❌ Только CLI</td><td>✅ OpenWebUI + API интеграция</td></tr>
15693        <tr><td><strong>Автоматизация</strong></td><td>❌ Не разработана</td><td>❌ Не разработана</td><td>✅ Скрипты .bat (double-click)</td></tr>
15694        <tr><td><strong>Стабильность VRAM</strong></td><td>❌ Физическое ограничение ROCm</td><td>⚠️ Ручной CLI</td><td>✅ Интегрированный VAE Tiling</td></tr>
15695        <tr><td><strong>Модели &gt; 8GB</strong></td><td>
15695❌ Хронические OOM</td><td>⚠️ Базовый CPU offload</td><td>✅ Фоллбэки Quad-Channel REG ECC</td></tr>
15696        <tr><td><strong>Видеоанимация</strong></td><td>❌ Не рассматривалось</td><td>❌ Не рассматривалось</td><td>✅ AnimateDiff WSL2 CPU Xeon</td></tr>
15697        <tr><td><strong>Детекция GGUF</strong></td><td>❌ Не рассматривалось</td><td>❌ Не рассматривалось</td><td>✅ Маппинг leejet vs city96</td></tr>
15698      </tbody>
15699    </table>
15700  </div>
15701
15702  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">C. Общий технический знаменатель — движок GGML</h4>
15703  <p style="font-size:.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">Ключевой технологией сжатия и выполнения, которая позволила использовать устаревшие GPU, стала экосистема, разработанная Георги Гергановым (<strong>ggml / llama.cpp / stable-diffusion.cpp</strong>). Перенося тензорные операции непосредственно на язык C/C++ и предоставляя нативные хуки к открытой графической библиотеке <strong>Vulkan API</strong>, эта реализация позволяет картам без современных проприетарных драйверов выполнять массивные нативные вычисления (обходя ограничительные драйверы вендоров).</p>
15704 
15705   <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">D. Конвергентная философия</h4>
15706   <p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">Прямые высказывания, увековечивающие свободные цели этих исследователей:</p>
15707   <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem">
15708     <strong>Amihart:</strong> "Несмотря на возраст этой GPU, технически возможно использовать её для ИИ, если адаптировать поток выполнения... низкоуровневая оптимизация — ключ к повторному использованию устаревшего оборудования."
15709   </blockquote>
15710   <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem">
15711     <strong>DadHacks:</strong> "Этот сетап предоставляет жизнеспособный мост для технического использования существующих инвестиций в оборудование без необходимости дорогостоящих обновлений или зависимости от раздутых пакетов ПО."
15712   </blockquote>
15713   <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
15714     <strong>AIVisionsLab:</strong> "Деградация из-за устаревания драйверов и закрытых экосистем — это коммерческий фактор, а не материальное ограничение карты. Устаревшее оборудование сохраняет свою эксплуатационную полезность при поддержке открытого ПО."
15715   </blockquote>
15716 
15717   <div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem">
15718     <strong style="color:var(--r)">Кредиты соавторства и ссылки:</strong> Техническая хронология посвящена совокупным экспериментальным усилиям <strong>Amihart</strong>, <strong>DH (DadHacks)</strong>, <strong>leejet</strong>, <strong>ggerganov</strong>, <strong>woodrex</strong> и всех независимых разработчиков, сосредоточенных на цифровом перепрофилировании и сохранении оборудования.
15719       </div>`},linux_nativo:{id:"linux_nativo",title:"43. LINUX NATIVO — Ubuntu 26.04 LTS + RX 580 + Vulkan (Часть 1)",desc:"AIVisionsLab — Документация полного стека на реальном Linux",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"sistema-operacional",difficulty:"advanced",estimated_time_min:40,tags:["ubuntu-native","linux-vulkan","low-level-compilation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_whisper"],previous:"audio_whisper",next:"audio_srt_ptbr",related:["comfyui-wsl","amihart"]},part:1},html:`<div class="card bg-red-950/20 border border-red-500/30 p-5 rounded-md my-6">
15720  <h4 style="color:#ef4444;font-weight:800;font-size:0.95rem;margin-bottom:0.6rem;display:flex;items-center;gap:0.4rem">
15721    🚨 ОТЧЕТ ОБ ИНЦИДЕНТЕ (16/06/2026): КАТАСТРОФА С ДИСКОВЫМ ПРОСТРАНСТВОМ И КРАХ GNOME
15722  </h4>
15723  <p style="font-size:0.82rem;color:#fca5a5;line-height:1.75;margin-bottom:0.75rem">
15724    <strong>Критический статус:</strong> Во время тестирования экстремальных конвейеров и массовой загрузки тяжелых моделей GGUF на выделенный раздел объемом 97 ГБ физическое пространство было полностью исчерпано (0 байт свободно в swap/root). При попытке быстрой очистки кэша и принудительной очистки через терминал были повреждены критические зависимости графической среды.
15725  </p>
15726  <ul style="padding-left:1.2rem;font-size:.8rem;color:#fbcfe8;line-height:1.8;margin-bottom:1rem">
15727    <li><strong>Симптом:</strong> Оконный менеджер <strong>GNOME</strong> полностью вышел из строя, что привело к циклам входа в систему и черному экрану терминала без загрузки графического интерфейса.</li>
15728    <li><strong>Действие по восстановлению:</strong> Физическое форматирование и немедленная переустановка системы Linux Bare-Metal с нуля для чистой сборки и правильного изменения размера разделов.</li>
15729    <li><strong>Экзистенциальный вердикт:</strong> <em>"Мне определенно нужно учить Linux!"</em>
15729 — Путь AIVisionsLab доказывает, что освоение терминала и распределения пространства в LVM так же важно, как и знание бэкенд-шейдеров Vulkan.</li>
15730  </ul>
15731</div>
15732
15733<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
15734  Детальная и проверенная документация по прямому выполнению на нативном Linux. Без WSL2, без эмуляции контейнеров или Docker Passthrough: реальный доступ bare-metal через open-source драйверы <strong>Mesa RADV</strong> на новейшем <strong>Ubuntu 26.04 LTS (Resolute Raccoon)</strong> с ядром Linux 7.0.
15735</p>
15736
15737<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:.85rem;margin-bottom:1.25rem">
15738  <div class="stat"><div class="stat-icon">🐧</div><div><div class="stat-lbl">Платформа Linux</div><div class="stat-val" style="font-size:.82rem">Ubuntu 26.04 LTS</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Ядро 7.0 (Resolute)</div></div></div>
15739  <div class="stat"><div class="stat-icon">🎛️</div><div><div class="stat-lbl">Vulkan Driver</div><div class="stat-val" style="font-size:.82rem">Mesa RADV 26.0.3</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Vulkan Core version 1.4.341</div></div></div>
15740  <div class="stat"><div class="stat-icon">💽</div><div><div class="stat-lbl">Разметка диска</div><div class="stat-val" style="font-size:.82rem">Ext4 выделенный 97 ГБ</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">HDD sdb6 Dual Boot</div></div></div>
15741  <div class="stat"><div class="stat-icon">📦</div><div><div class="stat-lbl">Docker Runtime</div><div class="stat-val" style="font-size:.82rem">Nativo Linux Engine</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Мосты OpenWebUI на 100%</div></div></div>
15742</div>
15743
15744<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Сравнительная таблица: Windows 10 vs Нативный Linux</h3>
15745<div class="tbl">
15746  <table>
15747    <thead>
15748      <tr>
15749        <th>Сценарий / Рабочая нагрузка</th>
15750        <th>Windows 10 (AMD официальный)</th>
15751        <th>Linux Ubuntu 26.04 (Mesa RADV)</th>
15752        <th>Критический победитель</th>
15753      </tr>
15754    </thead>
15755    <tbody>
15756      <tr>
15757        <td><strong>LLM (Qwen3 4B GGUF) @ 99 layers</strong></td>
15758        <td>~15-17 токенов/с</td>
15759        <td><strong>~35 токенов/с (RADV engine)</strong></td>
15760        <td>🏆 <strong>Linux (в 2 раза быстрее)</strong></td>
15761      </tr>
15762      <tr>
15763        <td><strong>Большая LLM (Qwen3.6 35B) @ Max layers</strong></td>
15764        <td><strong>7.62 токенов/с (макс 10 слоев)</strong></td>
15765        <td>5.18 токенов/с (макс 20 слоев)</td>
15766        <td>⚖️ <strong>Техническая ничья</strong> (Linux позволяет в 2 раза больше слоев, Windows быстрее на слой)</td>
15767      </tr>
15768      <tr>
15769        <td><strong>Stable Diffusion (Dreamshaper8 - 50st)</strong></td>
15770        <td><strong>~72 секунды (1.44с/it)</strong></td>
15771        <td>~85 секунд (1.65с/it)</td>
15772        <td>🏆 <strong>Windows (стабильнее драйвер)</strong></td>
15773      </tr>
15774      <tr>
15775        <td><strong>Flux Schnell (4 шага, 512x512)</strong></td>
15776        <td>~84 секунды (OOM при 1024x1024)</td>
15777        <td><strong>~52 секунды сэмплинг (Всего: 95с)</strong></td>
15778        <td>🏆 <strong>Linux (лучший swap VRAM)</strong></td>
15779      </tr>
15780      <tr>
15781        <td><strong>whisper.cpp (large-v3-turbo, аудио 106с)</strong></td>
15782        <td>307 с (Использование VRAM: 2.6 ГБ)</td>
15783        <td><strong>23.58 с (Использование VRAM: 1.6 ГБ)</strong></td>
15784        <td>🏆 <strong>Linux (Абсолютно превосходит)</strong></td>
15785      </tr>
15786    </tbody>
15787  </table>
15788</div>
15789
15790<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Установка и Dual-Boot без перезаписи реестров</h3>
15791<p style="font-size:.82rem;color:#94a3b8;line-height:1.75">
15792  1. В Windows освободите место с помощью Управления дисками (Сжать том).<br>
15793  2. Подготовьте флешку с ISO-образом desktop <strong>Ubuntu 26.04 amd64</strong>.<br>
15794  3. В установщике Ubuntu выберите опцию "Установить рядом с Windows Boot Manager". Установщик создаст раздел и настроит меню GRUB для автоматического выбора загрузки при каждой перезагрузке.
15795</p>
15796
15797<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Пост-установка: Bare-Metal валидация GPU Polaris</h3>
15798<div class="code">
15799  <span class="code-lang">bash</span>
15800  <pre>lspci | grep -i vga
15801# AMD Radeon RX 580 2048SP обнаружена!
15802
15803vulkaninfo --summary 2>/dev/null | grep -A5 "Devices"
15804# Должно отображать: GPU0: DRIVER_ID_MESA_RADV | driverInfo = Mesa 26.0.3 ✅</pre>
15805</div>
15806
15807<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Стек проверенных команд выполнения в Ubuntu</h3>
15808
15809<h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">1. Инициализация llama-server через Vulkan</h4>
15810<div class="code">
15811  <span class="code-lang">bash</span>
15812  <pre>~/llama.cpp/build/bin/llama-server \\
15813  -m "/run/media/aivisions-lab-studio/NVMe/models/qwen3/Qwen3-4B-Q4_K_M.gguf" \\
15814  --host 0.0.0.0 --port 8081 \\
15815  -ngl 99 -t 24</pre>
15816</div>
15817
15818<h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">2. Генерация изображений (Flux Schnell) — Секреты против зависания GNOME</h4>
15819<div class="code">
15820  <span class="code-lang">bash</span>
15821  <pre>~/stable-diffusion.cpp/build/bin/sd-server \\
15822  --listen-ip 0.0.0.0 --listen-port 7860 \\
15823  --diffusion-model /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/flux1-schnell-q4_k.gguf \\
15824  --vae /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/ae.safetensors \\
15825  --clip_l /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/clip_l.safetensors \\
15826  --t5xxl /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/t5xxl_fp16.safetensors \\
15827  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre>
15828</div>
15829<p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-top:.35rem">
15830  💡 <strong>Критические флаги:</strong> Параметр <code>--vae-tiling</code> строго обязателен. Без него декодирование VAE превышает лимит физической памяти и вызывает зависание графической среды GNOME. Избегайте использования <code>--backend vulkan0</code> для этой тяжелой модели в Linux, так как это вызывает ошибки потери контекста.
15831</p>
15832
15833<h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">3. Быстрая транскрипция аудио через whisper.cpp</h4>
15834<div class="code">
15835  <span class="code-lang">bash</span>
15836  <pre>~/whisper.cpp/build/bin/whisper-cli \\
15837  -m ~/whisper.cpp/models/ggml-large-v3-turbo.bin \\
15838  -f "/caminho/para/audio.wav" \\
15839  -l pt --output-txt</pre>
15840</div>
15841
15842<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Параллельно запущенные службы и Docker-контейнеры</h3>
15843<div class="tbl">
15844  <table>
15845    <thead>
15846      <tr>
15847        <th>Активный контейнер</th>
15848        <th>Базовый образ</th>
15849        <th>Проброс портов</th>
15850        <th>Назначение</th>
15851      </tr>
15852    </thead>
15853    <tbody>
15854      <tr>
15855        <td><strong>open-webui</strong></td>
15856        <td>ghcr.io/open-webui/open-webui:main</td>
15857        <td>3000 -> 8080</td>
15858        <td>Единая панель чата с LLM и рендерингом SD</td>
15859      </tr>
15860      <tr>
15861        <td><strong>portainer</strong></td>
15862        <td>portainer/portainer-ce</td>
15863        <td>9000</td>
15864        <td>Визуальное управление процессами и стеками Docker</td>
15865      </tr>
15866      <tr>
15867        <td><strong>searxng</strong></td>
15868        <td>searxng/searxng:latest</td>
15869        <td>8080</td>
15870        <td>Приватная поисковая система для ответов ИИ с привязкой к источникам</td>
15871      </tr>
15872    </tbody>
15873  </table>
15874</div>
15875
15876<div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4">
15877  <h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Автономные уроки, извлеченные в Linux</h4>
15878  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7">
15879    <strong>ROCm больше не поддерживается:</strong> Карты GCN4 / Polaris, такие как RX 580, больше не поддерживаются в официальном SDK ROCm. Попытка запустить официальный Ollama через GPU Docker на них приведет к ошибке. Золотой путь — это запуск <strong>Ollama на CPU Xeon</strong> или использование <strong>нативного llama-server, скомпилированного с Vulkan</strong>! Docker следует использовать только для фронтендов и вспомогательных серверов.
15880  </p>
15881</div>`},llama:{id:"llama",title:"07. КОМПИЛЯЦИЯ LLAMA.CPP (BACKEND VULKAN)",desc:"Пошаговое руководство с основными командами для создания оптимизированных бинарных файлов LLM для RX 580.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["llamacpp","vulkan-acceleration","compilacao-cpp"],last_reviewed:"2026-07-01",relationships:{prerequisites:["jornada"],previous:"jornada",next:"sdcpp",related:["modelos","limit_qwen_35b"]}},html:`<div class="note">⚠ Убедитесь, что выполняете приведенные ниже команды исключительно в <strong>Developer PowerShell для Visual Studio</strong></div>
15882  <div class="code"><pre># Перейти в высокоскоростной раздел и клонировать официальный репозиторий
15883cd E:\\
15884git clone https://github.com/ggerganov/llama.cpp
15885cd llama.cpp
15886
15887# Создать директорию сборки с внедрением флага компилятора для backend Vulkan
15888cmake -B build -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
15889
15890# Запустить компиляцию, используя 20 параллельных потоков процессора Xeon
15891cmake --build build --config Release -j20</pre></div>
15892  <h4 class="s" style="margin-top:1rem;margin-bottom:.5rem;color:#fff">Команда проверки устройства ускорения</h4>
15893  <div class="code"><pre>cd build\\bin\\Release
15894.\\llama-cli.exe --list-devices
15895# Ожидаемый вывод консоли: Vulkan0: AMD Radeon RX 580 2048SP ✅</pre></div>`},meta:{id:"meta",title:"36. ССЫЛКИ И МЕТАДАННЫЕ ДОКУМЕНТА",desc:"Технический анализ жизненного циÐ
15895ºÐ»Ð° устаревшего оборудования и философия повторного использования в лаборатории.",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"metadados",difficulty:"beginner",estimated_time_min:10,tags:["silicon-governance","metadata-specs","efficiency-telemetry"],last_reviewed:"2026-07-01",relationships:{prerequisites:["arquivos"],previous:"arquivos",next:"linhatempo",related:["arquivos","proximos"]}},html:`<blockquote style="font-size:.9rem;color:#94a3b8;font-style:italic;line-height:1.9;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">
15896    "Коммерческое запланированное устаревание — это рыночный выбор, а не инженерный барьер. Устаревшее оборудование не умирает; оно обретает вторую жизнь благодаря правильному программному обеспечению."
15897  </blockquote>
15898  <div class="tbl" style="margin-top:.9rem"><table>
15899    <thead><tr><th>Метаданные системы</th><th>Журнал аудита</th></tr></thead>
15900    <tbody>
15901      <tr><td>Версия развертывания</td><td>VULKAN_DEPLOY_V3.0_COMPLETO</td></tr>
15902      <tr><td>
15902Год регистрации</td><td>Консолидированная история // Сезон 2026</td></tr>
15903      <tr><td>Авторство</td><td>Архитектура систем Black Tuxedo AI Solutions</td></tr>
15904    </tbody>
15905  </table></div>`},modelos:{id:"modelos",title:"09. КОНВЕРТАЦИЯ МОДЕЛЕЙ В ФОРМАТ GGUF",desc:"Оптимизация и квантование стандартных файлов .safetensors в формат, поддерживаемый движком ggml.",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"quantizacao",difficulty:"intermediate",estimated_time_min:15,tags:["gguf","quantizacao-modelos","vram-8gb"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdcpp"],previous:"sdcpp",next:"sdserver",related:["llama","comfyui-modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.9rem">Оптимизированные среды выполнения на C++ в <code>stable-diffusion.cpp</code> требуют использования файлового формата <code style="color:var(--r)">.gguf</code>. Традиционные модели, загруженные с Civitai (.safetensors), должны пройти через нативный конвертер:</p>
15906  <div class="code"><pre># Comando para conversão direta e aplicação de quantização estável em 8-bits (q8_0)
15907.\\sd-cli.exe -M convert -m "E:\\models\\DreamShaper_8.safetensors" -o "E:\\models\\dreamshaper8.gguf" --type q8_0</pre></div>
15908  <div class="code ok" style="margin-top:.75rem"><pre># Log de encerramento do processo:
15909[INFO] convert 'DreamShaper_8.safetensors' to 'dreamshaper8.gguf' success ✅</pre></div>`},prereqs:{id:"prereqs",title:"05. СИСТЕМНЫЕ ТРЕБОВАНИЯ",desc:"Инструментарий, необходимый для компиляции открытых бинарных файлов и запуска локальных серверов.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"dependencias",difficulty:"intermediate",estimated_time_min:20,tags:["cmake","git","msvc-compiler","gcc","vulkan-sdk"],last_reviewed:"2026-07-01",relationships:{prerequisites:["solucao"],previous:"solucao",next:"jornada",related:["llama","sdcpp"]}},html:`<div class="c2">
15910    <div class="card"><p style="font-size:.58rem;color:var(--r);text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">⚠ СРЕДА КОМПИЛЯЦИИ (GPU)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">Developer PowerShell do VS</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">Открывается через меню «Пуск» → "Developer PowerShell for VS 2022"</p></div>
15911    <div class="card"><p style="font-size:.58rem;color:#22c55e;text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">✅ СРЕДА ВЫПОЛНЕНИЯ (RUNTIME)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">Стандартный PowerShell Windows</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">Запускает финальные скомпилированные бинарные файлы без накладных расходов среды разработки</p></div>
15912  </div>
15913  <div class="tbl" style="margin-top:1rem"><table>
15914    <thead><tr><th>Software / SDK</th><th>Подтвержденная версия</th><th>Важные примечания по настройке</th></tr></thead>
15915    <tbody>
15916      <tr><td>Visual Studio Community</td><td>2022 или 2026</td><td>Обязательно выбрать рабочую нагрузку: "Разработка классических приложений на C++"</td></tr>
15917      <tr><td>CMake Compiler</td><td>v4.3.2+</td><td>Доступен на cmake.org. Не забудьте отметить: "Add CMake to system PATH"</td></tr>
15918      <tr><td>Vulkan SDK</td><td>v1.4.341.1</td><td>Загрузить через LunarG. Стандартная установка обязательна в <code>C:\\VulkanSDK\\</code></td></tr>
15919      <tr><td>Git Windows</td><td>Последняя стабильная</td><td>Официальный установщик для клонирования open-source репозиториев</td></tr>
15920      <tr><td>Docker Desktop</td><td>v4.x+</td><td>Необходим для запуска экосистемы OpenWebUI и вспомогательных конвейеров, таких как SearXNG</td></tr>
15921      <tr><td>WSL2 Subsystem</td><td>Ubuntu 22.04.5 LTS</td><td>Стабильная база выполнения для Python-среды ComfyUI и Ollama</td></tr>
15922      <tr><td>Miniconda Linux</td><td>Ветка Python 3.11</td><td>Изолированный менеджер пакетов, работающий внутри подсистемы Linux WSL2</td></tr>
15923    </tbody>
15924  </table></div>
15925  <div class="code"><pre># Команды проверки среды компиляции
15926cmake --version
15927# Ожидаемый результат: cmake version 4.3.2 ✅
15928
15929dir C:\\VulkanSDK
15930# Ожидаемый результат: отображение директории версии 1.4.341.1 ✅</pre></div>`},proving_hypothesis_35b:{id:"proving_hypothesis_35b",title:"42. ПОДТВЕРЖДЕНИЕ ГИПОТЕЗЫ: CURL, CTX-SIZE 8192 И ПЕРВЫЙ ПОЛНЫЙ ОТВЕТ (Часть 1)",desc:"Прямое продолжение Раздела 33 · 3 теста · Гипотеза подтверждена · Оборудование 2017 года",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:35,tags:["context-length","offloading-layer","matematica-tensores"],last_reviewed:"2026-07-01",relationships:{prerequisites:["limit_qwen_35b"],previous:"limit_qwen_35b",next:"sdxl_vulkan",related:["limit_qwen_35b","cpu"]},part:1}
15930,html:`<div class="whisper-doc">
15931  <div class="hero">
15932    <div class="hero-title"><span>Подтверждение гипотезы</span> — Qwen3.5 35B</div>
15933    <div class="hero-sub">Заключительные эксперименты, подтверждающие заполнение контекста, тайм-ауты клиента и сравнение Q4_K_M против Q6_K на кремнии 2017 года.</div>
15934    <div class="hero-badges">
15935      <span class="badge badge-gpu">AMD RX 580 8GB</span>
15936      <span class="badge badge-win">Xeon E5-2690 v3</span>
15937      <span class="badge badge-ok">Гипотеза подтверждена</span>
15938      <span class="badge badge-ok">--ctx-size 8192</span>
15939      <span class="badge badge-win">Q4_K_M vs Q6_K</span>
15940    </div>
15941  </div>
15942
15943  <div class="stat-grid">
15944    <div class="stat">
15945      <div class="stat-label">Скорость (Q4_K_M)</div>
15946      <div class="stat-value">6.42 - 6.65 tok/s</div>
15947      <div class="stat-sub">Без активного Swap</div>
15948    </div>
15949    <div class="stat">
15950      <div class="stat-label">Подтвержденный контекст</div>
15951      <div class="stat-value">8.192 токенов</div>
15952      <div class="stat-sub">Поддерживает режим рассуждения</div>
15953    </div>
15954    <div class="stat">
15955      <div class="stat-label">Максимальная температура</div>
15956      <div class="stat-value">74°C</div>
15957      <div class="stat-sub">На 10°C холоднее с Q4_K_M</div>
15958    </div>
15959    <div class="stat">
15960      <div class="stat-label">Статус оборудования</div>
15961      <div class="stat-value">100% Пройдено</div>
15962      <div class="stat-sub">Без сбоев / 4 параллельных слота</div>
15963    </div>
15964  </div>
15965
15966  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.0 — Контекст и мотивация</h3>
15967  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
15968    Раздел 33 завершился четкой гипотезой: <em>"Проблема никогда не была в оборудовании. Это было сочетание thinking + web search, исчерпывающее 4.096 токенов контекста. С коротким промптом и без web search, Qwen3.5-35B Q6_K отвечает нормально на RX 580 2017 года."</em>
15969  </p>
15970  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
15971    16 июня 2026 года AIVisionsLab провела отложенные тесты, предложенные для подтверждения этой гипотезы в реальном времени, оценив поведение с прямым curl (без тайм-аута клиента), включив флаг расширенного размера контекста и протестировав более эффективные квантования.
15972  </blockquote>
15973
15974  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.1 — Оборудование лаборатории</h3>
15975  <div class="tbl">
15976    <table>
15977      <thead>
15978        <tr>
15979          <th>Компонент</th>
15980          <th>Спецификация</th>
15981        </tr>
15982      </thead>
15983      <tbody>
15984        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 ядер / 24 потока · 3,05 ГГц турбо (Выпущен в 2014)</td></tr>
15985        <tr><td><strong>RAM</strong></td><td>31,8 ГБ DDR4 REG ECC (четырехканальный режим)</td></tr>
15986        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 ГБ GDDR5 (Выпущен в 2017)</td></tr>
15987        <tr><td><strong>Storage NVMe</strong></td><td>SSD NVMe (Диск E:) — модели GGUF (Чтение 1.7–3.5 ГБ/с)</td></tr>
15988        <tr><td><strong>Storage HDD</strong></td><td>HDD (Диск C: / F:) — система Windows + swap</td></tr>
15989        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — выпущен 20.05.2026</td></tr>
15990        <tr><td><strong>Система</strong></td><td>Windows 10 Pro с активным WSL2</td></tr>
15991      </tbody>
15992    </table>
15993  </div>
15994
15995  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.2 — Протестированные модели</h3>
15996  <div class="tbl">
15997    <table>
15998      <thead>
15999        <tr>
16000          <th>Модель</th>
16001          <th>Квантование</th>
16002          <th>Размер файла</th>
16003          <th>Параметры архитектуры</th>
16004        </tr>
16005      </thead>
16006      <tbody>
16007        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q6_K</strong></td><td>6 бит</td><td>28,51 ГБ</td><td>34,66B (MoE)</td></tr>
16008        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M</strong></td><td>4 бита (Medium)</td><td><strong>21,17 ГБ</strong></td><td>34,66B (MoE)</td></tr>
16009        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q5_K_M</strong></td><td>
160095 бит (Medium)</td><td>24,76 ГБ</td><td>34,66B (MoE)</td></tr>
16010      </tbody>
16011    </table>
16012  </div>
16013  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
16014    *Примечание: Все модели имеют идентичную архитектуру Mixture of Experts (MoE), различаясь только математическим сжатием весов.
16015  </p>
16016
16017  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.3 — Поиск исполняемых файлов</h3>
16018  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
16019    Перед тестированием необходимо было найти оптимизированные сборки <code>llama-server</code>. В PowerShell лаборатории:
16020  </p>
16021  <div class="cmd">Get-ChildItem -Path E:\\ -Recurse -Filter "llama-server.exe" -ErrorAction SilentlyContinue
16022 
16023# Результат:
16024E:\\llama.cpp\\llama-server.exe (заглушка 9КБ)
16025E:\\llama.cpp\\build\\bin\\Release\\llama-server.exe (реальный исполняемый файл 7.5МБ) ◀</div>
16026
16027  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.4 — Тест 9: Прямой Curl без тайм-аута</h3>
16028  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.1 — Мотивация</h4>
16029  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
16030    Определить, кроется ли узкое место тайм-аута, описанное в Тесте 4, в сервере или исключительно в AJAX-запросах клиента OpenWebUI.
16031  </p>
16032
16033  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.2 — Запуск сервера</h4>
16034  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
16035.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --p
16035ort 8081</div>
16036
16037  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.3 — Решение проблемы экранирования JSON в PowerShell</h4>
16038  <div class="cmd">'{"model":"any","messages":[{"role":"user","content":"Explique MoE em 3 paragrafos"}]}' | Out-File -Encoding utf8 -FilePath "E:\\teste.json"</div>
16039
16040  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.4 — Выполнение длительного вызова</h4>
16041  <div class="cmd">curl.exe -X POST http://localhost:8081/v1/chat/completions -H "Content-Type: application/json" --max-time 600 -d "@E:\\teste.json"</div>
16042
16043  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.5 — Аналитический результат</h4>
16044  <div class="cmd">truncated = 0  ◀ ПОЛНЫЙ ОТВЕТ УСПЕШНО ПОЛУЧЕН
16045total time = 266.42 s / 1955 tokens
16046eval time  = 255.97 s / 1683 tokens @ 6.57 t/s</div>
16047  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
16048    <strong>Технический вердикт:</strong> Оборудование 2017 года обработало и выдало ответ идеально! Предыдущая проблема заключалась в тайм-ауте браузера, который разрывал TCP-соединение, в то время как сервер продолжал генерацию в фоновом режиме.
16049  </p>
16050
16051  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.5 — Реальный параллелизм: 4 вычислительных слота</h3>
16052  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
16053    Во время Теста 9 OpenWebUI был подключен параллельно, отправляя тот же вопрос. Планировщик llama.cpp обработал запросы конкурентно без сбоев:
16054  </p>
16055  <div class="cmd">Task 0 (curl)      — n_decoded = 1125, tg = 5.96 t/s
16056Task 875 (OpenWebUI) — n_decoded = 243,  tg = 5.08 t/s</div>
16057<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
16058    Архитектура работала стабильно (GPU: 63°C, VRAM: 7.1/8.0 GB, RAM: 91% от общего использования системы, без зависаний Windows).
16059  </p>
16060
16061  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.6 — Тест 7: Включение экстремального контекста (--ctx-size 8192)</h3>
16062  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.1 — Оптимизированная команда</h4>
16063  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
16064.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --p
16064ort 8081 --ctx-size 8192</div>
16065
16066  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.2 — Тестовый промпт и поведение Thinking</h4>
16067  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">
16068    "Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."
16069  </blockquote>
16070  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
16071    После получения промпта процессор мышления работал в фоновом режиме на CPU в течение долгих 9 минут, обрабатывая контекст в 8192 токена. Внутренний анализ разобрал математику VRAM (вычислив, что 35B в INT4 требует 17,5 ГБ чистого веса), чтобы раскрыть сложности разреженности активации.
16072  </p>
16073
16074  <h4 style="color:rgba(225,29,72,0.9);font-weight:700;font-size:0.95rem;margin-top:2rem;margin-bottom:0.5rem">34.6.2-A — Внутренние рассуждения модели: Сравнительный анализ трех блоков Thinking</h4>
16075  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
16076    В ходе исчерпывающих сессий тестирования в разделах 33 и 34, Qwen3.5-35B сгенерировал три независимых блока фоновых рассуждений (<code>&lt;think&gt;</code>), которые были перехвачены путем прямого захвата необработанных пакетов. Табуляция и систематическое картирование этих сессий предоставляют фундаментальные доказательства когнитивного анализа модели:
16077  </p>
16078
16079  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">1. Блок Thinking 1 — Квантование Q6_K — Сессия 1 (23:06, 15/06)</h5>
16080  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
16081    <strong>Промпт:</strong> <em>"Explique detalhadamente o mecanismo de atenção nos Transformers e por que MoE é mais eficiente que modelos densos."</em><br>
16082    <strong>Время рассуждения:</strong> ~4 минуты | <strong>Токенов в блоке:</strong> ~2.000 | <strong>Статус:</strong> ✅ Успешно завершено.
16083  </p>
16084  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
16085    <span style="color:#e11d48">// Линия мышления Qwen3.5 (Q6_K):</span><br>
16086    - Deconstruct query into structured chunks: Attention math, Multi-head, MoE, benefits vs dense.<br>
16087    - Detail Attention: Focus on Scaled Dot-Product mathematical formulation (Q, K, V). Show why division by sqrt(d_k) is required to prevent vanishing gradients during Softmax.<br>
16088    - Explain Multi-Head as parallel subspace projections (capturing both strict syntactic dependencies and semantic references).<br>
16089    - Deconstruct MoE: Discuss role of Router/Gating network, Routing sparsity (top-k selection), and load balancing to prevent routing collapse (unused experts).<br>
16090    - <span style="color:#a3e635">[Внутренняя самокоррекция]</span>: "Wait, I must check if MoE is always faster. I should explicitly note that MoE is memory-intensive for routing/loading but highly sparse computationally. If memory bandwidth is bottlenecked under dual-system offloading, token generation speed depends strongly on mmap performance."
16091  </div>
16092
16093  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">2. Блок Thinking 2 — Квантование Q4_K_M — СессиÑ
16093 2 (05:05, 16/06)</h5>
16094  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
16095    <strong>Промпт:</strong> <em>"Qual a diferença entre MoE e modelo denso, e por que MoE permite rodar 35B numa GPU de 8GB?"</em><br>
16096    <strong>Время рассуждения:</strong> ~11 минут | <strong>Токенов в блоке:</strong> ~3.500 | <strong>Статус:</strong> ❌ Прервано из-за исчерпания контекста (Лимит 4096).
16097  </p>
16098  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
16099    <span style="color:#e11d48">// Линия мышления Qwen3.5 (Q4_K_M):</span><br>
16100    - Analysis of premise: Running 35 billion parameter model in 8GB VRAM.<br>
16101    - <span style="color:#f43f5e">[Спонтанный физический расчет]</span>:<br>
16102      * FP32 weights: 35B * 4 bytes = 140 GB. Impossible.<br>
16103      * FP16 weights: 35B * 2 bytes = 70 GB. Impossible.<br>
16104      * INT8 quant:  35B * 1 byte = 35 GB. Impossible.<br>
16105      * INT4 quant:  35B * 0.5 bytes = 17.5 GB. Still larger than 8GB. This doesn't fit natively.<br>
16106    - Challenge the premise: "Wait, if the model indeed runs on 8GB, there must be extreme offloading, sparse activation memory loading, or aggressive hybrid quantization."<br>
16107    - <span style="color:#a3e635">[Критическая самокоррекция]</span>: "Ah! The user says 'por que o MoE permite rodar'. But actually, MoE weights are typically larger than equivalent dense models. A 35B MoE has 35B total parameters but only roughly 6B-8B active parameters per token. If we offload the inactive experts to system memory (RAM/mmap swap) and only load the active experts or the shared dense blocks onto the GPU, then the GPU memory footprint during active tensor computation is massively reduced. Let me structure this hypothesis."<br>
16108    - <span style="color:#d946ef">[Мета-архитектурный анализ]</span>: Elaborating on the split mechanism. Router stays in VRAM for instant routing, shared blocks in VRAM, active experts fetched from RAM dynamically during forward pass.
16109  </div>
16110  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
16111    <em>Заключительное инженерное примечание:</em> Пока модель формулировала это захватывающее рассуждение на CPU, она в математических подробностях описывала именно ту систему распределенного mmap и 4-уровневую архитектуру памяти Vulkan, которая поддерживала её работу в реальном времени — не имея прямого доступа к метаданным контейнера или файловой системе лаборатории.
16112  </p>
16113
16114  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">3. Блок Thinking 3 — Квантование Q4_K_M — Сессия 2 (05:24, 16/06)</h5>
16115  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
16116    <strong>Промпт:</strong> <em>"Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."</em><br>
16117    <strong>Время рассуждения:</strong> ~9 минут | <strong>Токенов в блоке:</strong> ~3.000 | <strong>Статус:</strong> ✅ Успешно завершено (--ctx-size 8192).
16118  </p>
16119  <div style="background:#090a0f;border:1px solid rgba(34,197,94,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a3e635;margin-bottom:1rem">
16120    <span style="color:#a3e635">// Линия мышления Qwen3.5 (Q4_K_M с оптимизированным лимитом):</span><br>
16121    - Prompt requests: Portuguese, direct, concise.<br>
16122    - Challenge VRAM claim again internally: MoE total size is bigger than dense, but active size is smaller. VRAM savings must come from smaller activation graphs (fewer experts evaluated simultaneously) and CPU-offloaded weight mapping.<br>
16123    - Work step-by-step to compress explanation to fit "direto e conciso":<br>
16124      * <span style="color:#cbd5e1">Rascunho v1:</span> Long theoretical detail on Router and CPU/VRAM exchange metrics.<br>
16125      * <span style="color:#cbd5e1">Refinamento v2:</span> Cut down router math, focus on "Ativação Esparsa" (activation memory bounds).<br>
16126      * <span style="color:#cbd5e1">Compressão Final:</span> Produce 3 crisp, highly readable Portuguese bullet points summarizing Active Parameters, Activation Garty/Memory limit, and Compute Scalability.
16127  </div>
16128<h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">Сравнительная таблица когнитивного поведения</h5>
16129  <div class="tbl">
16130    <table>
16131      <thead>
16132        <tr>
16133          <th>Метрика профилирования</th>
16134          <th>
16134Сессия 1 (Q6_K)</th>
16135          <th>Сессия 2-A (Q4_K_M)</th>
16136          <th>Сессия 2-B (Q4_K_M / ctx 8192)</th>
16137        </tr>
16138      </thead>
16139      <tbody>
16140        <tr><td><strong>Длительность рассуждения</strong></td><td>~4 минуты</td><td><strong>~11 минут</strong></td><td>~9 минут</td></tr>
16141        <tr><td><strong>Объем блока &lt;think&gt;</strong></td><td>~2.000 токенов</td><td><strong>~3.500 токенов</strong></td><td>~3.000 токенов</td></tr>
16142        <tr><td><strong>Выполненные самокоррекции</strong></td><td>2</td><td><strong>7 (Глубокие самокоррекции)</strong></td><td>4 (Акцент на лаконичность)</td></tr>
16143        <tr><td><strong>Постановка под сомнение предпосылки?</strong></td><td>Нет</td><td><strong>✅ Да (Доказана математическая ошибка в промпте)</strong></td><td>Да (техническая корректировка)</td></tr>
16144        <tr><td><strong>Математическое рассуждение</strong></td><td>Уравнение Transformers</td><td><strong>Расчет размера реальных весов</strong></td><td>Расчет буферов активации</td></tr>
16145        <tr><td><strong>Вывод текста</strong></td><td>✅ Успех</td><td>❌ Переполнение (4096 исчерпаны)</td><td><strong>✅ Абсолютный успех (Без обрывов)</strong></td></tr>
16146      </tbody>
16147    </table>
16148  </div>
16149
16150  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.8 — Исторический график лаборатории</h3>
16151  <div class="tbl">
16152    <table>
16153      <thead>
16154        <tr>
16155          <th>Сессия эксперимента</th>
16156          <th>ID</th>
16157          <th>Параметры Ctx</th>
16158          <th>Генерация (ток/с)</th>
16159          <th>Обрыв потока (truncated)</th>
16160          <th>Эффективный результат</th>
16161        </tr>
16162      </thead>
16163      <tbody>
16164        <tr><td>Раздел 34 — Тест 5</td><td>Q6_K</td><td>4096 токенов</td><td>5,57 т/с</td><td>0 (компактный промпт)</td><td>✅ Ответ получен (компактный контекст)</td></tr>
16165        <tr><td>Раздел 34 — Тест 9 (curl)</td><td>Q4_K_M</td><td>4096 токенов</td><td><strong>6,57 т/с</strong></td><td>0 (без timeout)</td><td>✅ Полный ответ через прямой канал</td></tr>
16166        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Раздел 34 — Тест 7 (WebUI)</strong></td><td>Q4_K_M</td><td>8192 токенов</td><td>6,42 т/с</td><td>0</td><td>✅ Полный ответ с расширенным рассуждением</td></tr>
16167      </tbody>
16168    </table>
16169  </div>
16170
16171  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.9 — Новая коллекция консолидированных технических уроков</h3>
16172  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
16173    <li><strong style="color:#fff">Урок 6 — Фактор Timeout клиента:</strong> Большая часть ошибок, на которые указывают тестировщики, вызвана не физической неспособностью GPU, а сбоями HTTP-соединения в интерфейсах, которые прерывают работу до завершения декодирования.</li>
16174    <li><strong style="color:#fff">Урок 7 — Настройка буферов контекста:</strong> Активация директивы <code>--ctx-size 8192</code> снимает ограничивающий лимит буфера рассуждений, предоставляя вычислительный запас для более чем 3.500 токенов, требуемых для внутреннего логического вывода.</li>
16175    <li><strong style="color:#fff">Урок 8 — Превосходство загрузки средней квантования:</strong> Запуск 35B с 4-битным квантованием экономит 7GB, критически важных для физической нагрузки на RAM CPU, снижая I/O Swap диска и оптимизируя температуру.</li>
16176    <li><strong style="color:#fff">Урок 9 — Критическое рассуждение модели:</strong> Qwen3.5 MoE поставила под сомнение ошибочную предпосылку в промпте, вычисляя веса в реальном времени и парируя аргументы о гибридном offloading, что доÐ
16176ºÐ°Ð·Ñ‹Ð²Ð°ÐµÑ‚ безупречное внимание и согласованность.</li>
16177    <li><strong style="color:#fff">Урок 10 — Стабильный нативный параллелизм:</strong> Сосуществование вызовов в параллельных каналах доказывает зрелость реализаций конвейера шейдеров Vulkan в llama.cpp.</li>
16178  </ul>
16179
16180  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.10 — Рекомендуемая настройка для будущих реализаций</h3>
16181  <div class="cmd"># Лабораторный скрипт для запуска в продакшн
16182cd E:\\llama.cpp\\build\\bin\\Release
16183 
16184.\\llama-server.exe \`
16185  -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" \`
16186  --host 0.0.0.0 \`
16187  --port 8081 \`
16188  --ctx-size 8192</div>
16189  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
16190    *Дополнительные инструкции по интерфейсу: Строгое отключение Web Search и генерации изображений во время экстремальной гибридной обработки.
16191  </p>
16192
16193  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.11 — Общий вердикт лаборатории (Подтверждение гипотезы)</h3>
16194  <div class="tbl">
16195    <table>
16196      <thead>
16197        <tr>
16198          <th>Инженерный вопрос</th>
16199          <th>Итоговый вердикт</th>
16200        </tr>
16201      </thead>
16202      <tbody>
16203        <tr><td><strong>Решает ли curl проблему timeout в OpenWebUI?</strong></td><td>✅ <strong>Да</strong> (truncated = 0, ответ 100% целостный)</td></tr>
16204        <tr><td><strong>Решает ли CTX-SIZE 8192 проблему сжатого thinking mode?</strong></td><td>✅ <strong>Да</strong> (С запасом вмещает длинные рассуждения)</td></tr>
16205        <tr><td><strong>Q4_K_M лучше для сценария с 32GB RAM?</strong></td><td>✅ <strong>Да</strong> (Быстрее, холоднее, меньше swap)</td></tr>
16206        <tr><td><strong>Подтвердилась ли гипотеза об исчерпании контекста?</strong></td><td>✅ <strong>Абсолютно</strong></td></tr>
16207        <tr><td><strong>Финансовые затраты на оптимизацию в 2026 году?</strong></td><td>✅ <strong>R$ 0,00</strong> (Логическое решение через flags)</td></tr>
16208      </tbody>
16209    </table>
16210  </div>
16211
16212  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.12 — Теги и метаданные</h3>
16213  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
16214    <div>🏷️ <strong>Теги:</strong> curl, ctx-size, timeout, openwebui, q4km, q6k, параллелизм, thinking-mode, полный-ответ, гипотеза-подтверждена, rx580</div>
16215    <div style="margin-top:0.5rem">💻 <strong>Оборудование:</strong> RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
16216    <div style="margin-top:0.25rem">💿 <strong>ПО:</strong> llama.cpp (build\\bin\\Release) + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
16217    <div style="margin-top:0.25rem">📅 <strong>Дата:</strong> 16/06/2026</div>
16218    <div style="margin-top:0.25rem">📊 <strong>Тесты:</strong> 3 (Тест 9 curl, реальный параллелизм, Тест 7 ctx8192)</div>
16219    <div style="margin-top:0.25rem">📈 <strong>Бенчмарк:</strong> 6,42–6,65 tok/s (Q4_K_M) | truncated = 0</div>
16220    <div style="margin-top:0.25rem">🔥 <strong>Пиковая температура:</strong> 74°C</div>
16221    <div style="margin-top:0.25rem">🏆 <strong>Итоговый статус:</strong> ✅ ГИПОТЕЗА ПОДТВЕРЖДЕНА</div>
16222  </div>
16223
16224  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
16225    "Проблема никогда не была в оборудовании. Все дело в flag и timeout."<br>
16226    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 16/06/2026</span>
16227  </blockquote>
16228
16229  <div class="footer">
16230    Документация создана Claude Sonnet 4.6 — 16/06/2026 · Основано на реальных логах, скриншотах и бенчмарках в реальном времени · 3 задокументированных теста · Гипотеза подтверждена · Оборудование 2017 года обрабатывает ИИ 2025 года
16231  </div>
16232</div>`},proximos:{id:"proximos",title:"34. ДАЛЬНЕЙШИЕ ШАГИ (ROADMAP 2027)",desc:"Ближайшие цели разработки: Multi-GPU Vulkan кластеры и локальная сеть автономных агентов.",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"planejamento",difficulty:"beginner",estimated_time_min:10,tags:["roadmap-2027","planejamento-tecnico","novas-verticais"],last_reviewed:"2026-07-01",relationships:{prerequisites:["codacus"],previous:"codacus",next:"arquivos",related:["jornada","meta"]}},html:`<div class="card" style="border-left:3px solid #22c55e">
16233    <p style="font-size:.88rem;color:#fff;font-weight:600">Планирование расширения вычислительной инфраструктуры:</p>
16234    <ul style="padding-left:1.2rem;margin-top:.45rem;font-size:.85rem;color:#94a3b8;line-height:2">
16235      <li><strong style="color:#fff">[ ] Гомологация Multi-GPU кластера:</strong> Подключение второй видеокарты RX 580 параллельно через Vulkan для распределения тензоров весов.</li>
16236      <li><strong style="color:#fff">[ ] Картографирование локальных автономных агентов:</strong> Полная интеграция фреймворка CrewAI, работающего Ð
16236½Ð°Ñ‚ивно поверх API OpenWebUI для корпоративной автоматизации.</li>
16237    </ul>
16238  </div>`},scripts:{id:"scripts",title:"21. СКРИПТЫ И АВТОМАТИЗАЦИЯ",desc:"Пакетные скрипты для очистки видеопамяти и запуска локальных серверов без конфликтов.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:15,tags:["reboot-stack","memory-flush","manutencao-servidor"],last_reviewed:"2026-07-01",relationships:{prerequisites:["stack"],previous:"stack",next:"guia",related:["reboot_stack","sd_bat_automation"]}},html:`<h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">19.A — Главный скрипт (Все службы)</h4>
16239  <div class="code"><span class="code-lang">batch</span><pre>@echo off
16240title INFRASTRUCTURE IA - REBOOT STACK
16241cls
16242echo Принудительное завершение активных фоновых процессов...
16243taskkill /F /IM sd-server.exe 2>nul
16244taskkill /F /IM llama-server.exe 2>nul
16245timeout /t 2 /nobreak >nul
16246
16247echo Запуск LLM через Vulkan на RX 580 (порт 8081)...
16248start "LLM Server - Vulkan RX580" C:\\llama.cpp\\build\\bin\\Release\\llama-server.exe ^
16249  -m "E:\\MODELO LLM PARA GPU\\Mistral-7B-Q4_K_M.gguf" ^
16250  --host 0.0.0.0 ^
16251  --port 8081 ^
16252  --device Vulkan0
16253
16254timeout /t 3 /nobreak >nul
16255
16256echo Запуск SD Server через Vulkan на RX 580 (порт 7860)...
16257E:
16258cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
16259sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
16260  -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
16261
16262pause</pre></div>
16263
16264  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.B — Подключение LLM к OpenWebUI</h4>
16265  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">После запуска llama-server, подключитесь к OpenWebUI:</p>
16266  <ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:.75rem">
16267    <li>Перейдите по адресу <code style="color:var(--r)">http://localhost:3000</code></li>
16268    <li>Нажмите на аватар → <strong style="color:#fff">Панель администратора</strong></li>
16269    <li>Перейдите в <strong style="color:#fff">Настройки → Подключения</strong></li>
16270    <li>В разделе <strong style="color:#fff">API OpenAI</strong> нажмите <strong style="color:#fff">"+"</strong></li>
16271    <li>Заполните поля ниже:</li>
16272  </ol>
16273  <div class="tbl"><table>
16274    <thead><tr><th>Поле</th><th>Значение</th></tr></thead>
16275    <tbody>
16276      <tr><td>URL</td><td><code>http://host.docker.internal:8081/v1</code></td></tr>
16277      <tr><td>API Key</td><td><code>sk-local</code></td></tr>
16278    </tbody>
16279  </table></div>
16280  <ol start="6" style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-top:.75rem">
16281    <li>Нажмите на иконку <strong style="color:#fff">обновления</strong> — должна появиться зеленая полоса ✅</li>
16282    <li>Сохраните</li>
16283  </ol>
16284  <div class="card" style="margin-top:.75rem;border-left:3px solid #eab308;padding-left:.9rem">
16285    <p style="font-size:.85rem;color:#94a3b8;line-height:1.8"><strong style="color:#eab308">⚠️ Не используйте <code>127.0.0.1</code></strong> — Docker работает в изолированной сети WSL2 и не видит localhost Windows. Всегда используйте <code style="color:var(--r)">host.docker.internal</code>.</p>
16286  </div>
16287
16288  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.C — Проверка в чате</h4>
16289  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">После сохранения откройте <strong style="color:#fff">Новый чат</strong> в OpenWebUI:</p>
16290  <ul style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem">
16291    <li>Модель <code style="color:var(--r)">Mistral-7B-Q4_K_M.gguf</code> появится в списке в разделе <strong style="color:#fff">Внешние</strong></li>
16292    <li>Выберите её и общайтесь в обычном режиме</li>
16293    <li>Модель работает на 100% на <strong style="color:#fff">RX 580 через Vulkan</strong> — а не через Ollama</li>
16294  </ul>
16295
16296  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.D — Проверка работы на GPU (а не на CPU)</h4>
16297  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem">В терминале llama-server подтвердите следующее:</p>
16298  <div class="code"><span class="code-lang">log</span><pre>ggml_vulkan: Found 1 Vulkan device(s)
16299ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
16300llama server listening at http://0.0.0.0:8081</pre></div>
16301  <p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:.75rem 0 .5rem 0">Во время вывода (инференса) отображается бенчмарк:</p>
16302  <div class="code"><span class="code-lang">log</span><pre>17.77 t/s  ← RX 580 Vulkan ✅</pre></div>
16303  <div class="card" style="margin-top:.75rem">
16304    <p style="font-size:.85rem;color:#64748b;line-height:1.8">Если отображается только <code>3-5 t/s</code> без строки <code>ggml_vulkan</code> — значит, используется CPU. Проверьте, указан ли параметр <code style="color:var(--r)">--device Vulkan0</code> в команде запуска.</p>
16305  </div>
16306
16307  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.E — Три доступных интерфейса</h4>
16308  <div class="tbl"><table>
16309    <thead><tr><th>Интерфейс</th><th>URL</th><th>Когда использовать</th></tr></thead>
16310    <tbody>
16311      <tr><td><strong style="color:#fff">llama.cpp UI (родной)</strong></td><td><code>http://127.0.0.1:8081</code></td><td>Быстрые тесты прямо в браузере</td></tr>
16312      <tr class="hig"><td><strong style="color:#fff">OpenWebUI</strong></td><td><code>http://localhost:3000</code></td><td>Повседневное использование с историей и RAG</td></tr>
16313      <tr><td><strong style="color:#fff">Прямой API</strong></td><td><code>http://192.168.15.68:8081/v1</code></td><td>Интеграция с другими приложениями</td></tr>
16314    </tbody>
16315  </table></div>
16316
16317  <h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.F — Критические правила скрипта</h4>
16318  <div class="tbl"><table>
16319    <thead><tr><th>Правило</th><th>Причина</th></tr></thead>
16320    <tbody>
16321      <tr class="hig"><td><code>--host 0.0.0.0</code> обязательно</td><td><code>127.0.0.1</code> блокирует Docker</td></tr>
16322      <tr class="hig"><td><code>--device Vulkan0</code> обязательно</td><td>Без этого переключается на CPU (3-5 t/s)</td></tr>
16323      <tr><td><code>taskkill</code> перед запуском</td><td>Освобождает VRAM от зависших процессов</td></tr>
16324      <tr><td><code>host.docker.internal</code> в OpenWebUI</td><td>Единственный адрес, который Docker видит на хосте Windows</td></tr>
16325    </tbody>
16326  </table></div>`},sd_bat_automation:{id:"sd_bat_automation",title:"12. SD-SERVER LOCAL / ПОСЛЕДОВАТЕЛЬНОСТЬ ЗАГРУЗКИ",desc:"Специализированный пакетный скрипт для безопасного и воспроизводимого запуска сервера ИИ.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:12,tags:["batch-automation","loop-monitoramento","gerenciamento-portas"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux_server"],previous:"flux_server",next:"sd_openwebui_integration",related:["scripts","reboot_stack"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Чтобы избежать ошибок ручного ввода, неверных путей или зависания портов в VRAM при перезагрузке Windows, сервер должен запускаться исключительно через файл <code>.bat</code> на рабочем столе.</p>
16327
16328<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Производственный скрипт (iniciar_ia_server.bat):</strong></p>
16329<pre style="font-family:'JetBrains Mono',monospace;font-size:11px">@echo off
16330title Servidor Stable Diffusion Local - Producao
16331cls
16332
16333:: 1. Limpeza de processos fantasmas na VRAM/RAM
16334taskkill /f /im sd-server.exe 2>nul
16335taskkill /f /im sd-cli.exe 2>nul
16336timeout /t 2 /nobreak >nul
16337
16338:: 2. Salto de unidade e rota nativa (CMD syntax)
16339E:
16340cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
16341
16342:: 3. Execucao com escuta aberta para Docker
16343sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
16344
16345pause</pre>
16346
16347<div class="tbl" style="margin:1.25rem 0">
16348  <table>
16349    <thead>
16350      <tr><th>Правило</th><th>Причина</th></tr>
16351    </thead>
16352    <tbody>
16353      <tr><td>Никогда не использовать <code>.\\</code> перед исполняемым файлом</td><td>Традиционный CMD не распознает его — это вызывает сбой терминала</td></tr>
16354      <tr><td>Блок <code>taskkill</code> обязателен</td><td>Освобождает порт 7860, зависший в фоновых процессах</td></tr>
16355      <tr><td>Переход на диск (<code>E:</code>) перед <code>cd</code></td><td>CMD не меняет диск без явного перехода</td></tr>
16356    </tbody>
16357  </table>
16358</div>
16359
16360<div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;">
16361  <span style="color:#22c55e; font-weight:bold">✅ СТАТУС: АВТОМАТИЗАЦИЯ ПРОВЕРЕНА В ПРОДАКШЕНЕ</span><br>
16362  <span style="font-size:.8rem; color:#94a3b8">Двойной клик по .bat запускает всю экосистему — очистку, переход по пути и привязку порта в нужной последовательности</span>
16363</div>`},sd_openwebui_integration:{id:"sd_openwebui_integration",title:"13. ИНТЕГРАЦИЯ OPENWEBUI + DOCKER",desc:"Сетевой мост между Docker-контейнером OpenWebUI и нативным C++ движком, работающим на GPU хоста.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"integracao",difficulty:"advanced",estimated_time_min:35,tags:["open-webui","docker-compose","networking-docker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_bat_automation"],previous:"sd_bat_automation",next:"comfyui-wsl",related:["sdserver","comfyui-wsl"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Когда движок генерации работает вне Docker-контейнера, стандартная локальная связь (<code>127.0.0.1</code>) блокируется сетевой изоляцией и брандмауэром Windows. Инициализация и маршрутизация должны быть заданы явно.</p>
16364
16365<p style="font-size:.88rem;color:#fff;margin-bottom:.5rem">⚙️ <strong>Критические параметры инициализации<
16365/strong></p>
16366<div class="tbl" style="margin-bottom:1.25rem">
16367  <table>
16368    <thead>
16369      <tr><th>Флаг</th><th>Значение</th><th>Описание</th></tr>
16370    </thead>
16371    <tbody>
16372      <tr><td><code>--listen-ip</code></td><td><code>0.0.0.0</code></td><td>Открывает прослушивание для внешних запросов к хосту (Docker)</td></tr>
16373      <tr><td><code>--listen-port</code></td><td><code>7860</code></td><td>Стандартный порт для интеграции с OpenWebUI</td></tr>
16374      <tr><td><code>-m</code></td><td>абсолютный путь</td><td>Модель SD 1.5 / XL в формате <code>.safetensors</code> или <code>.gguf</code></td></tr>
16375    </tbody>
16376  </table>
16377</div>
16378
16379<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">Команда для продакшена — SD 1.5 / DreamShaper:</strong></p>
16380<pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"</pre>
16381
16382<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:1rem 0">⚠️ <strong style="color:#fff">Архитектурное примечание:</strong> Модели Flux.1 несовместимы с данной сборкой через простой флаг <code>-m</code> — они возвращают <code>[ERROR] main.cpp:92 - new_sd_ctx_t failed</code>. Для Flux используйте специальную команду из раздела 10.A с флагами <code>--diffusion-model</code>, <code>--vae</code>, <code>--clip_l</code> и <code>--t5xxl</code> по отдельности.</p>
16383
16384<p style="font-size:.88rem;color:#fff;margin-bottom:.75rem">🔌 <strong>Настройка маршрута в OpenWebUI</strong></p>
16385<ol style="font-size:.88rem;color:#94a3b8;line-height:2;margin-left:1.25rem">
16386  <li>Перейдите по адресу <code>http://localhost:3000</code></li>
16387  <li>Перейдите в <strong>Настройки &gt; Изображения</strong> (Панель администратора)</li>
16388  <li>Выберите движок <strong>Automatic1111</strong></li>
16389  <li>Введите локальный IP машины с обязательным символом <code>/</code> в конце:<br>
16390    <code style="color:#22c55e">http://192.168.15.68:7860/</code>
16391  </li>
16392  <li>Нажмите <strong>Сохранить</strong> — зеленая полоса подтвердит установку сетевого моста</li>
16393</ol>
16394
16395<div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin:1.25rem 0">
16396  <strong style="color:#ef4444;display:block;margin-bottom:.4rem">🔒 Обязательное разрешение в брандмауэре Windows Defender</strong>
16397  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem">Windows Defender по умолчанию молча блокирует соединения, исходящие из внутренней подсети Docker (<code>172.17.0.0/16</code>) и WSL2 (<code>172.x.x.x</code>). Без этого правила OpenWebUI не сможет связаться с sd-server даже при активном <code>--listen-ip 0.0.0.0</code>.</p>
16398  <p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>Метод 1 — Графический интерфейс (рекомендуется для первой установки):</strong></p>
16399  <ol style="font-size:.82rem;color:#94a3b8;line-height:1.6;margin-left:1.25rem;margin-bottom:.5rem">
16400    <li>Откройте: <code>Панель управления → Брандмауэр Защитника Windows → Дополнительные параметры</code></li>
16401    <li>Нажмите: <code>Правила для входящих подключений → Создать правило</code></li>
16402    <li>Тип: <code>Для порта</code></li>
16403    <li>Протокол: <code>TCP</code> | Порт: <code>7860</code></li>
16404    <li>Действие: <code>Разрешить подключение</code></li>
16405    <li>Профили: отметьте <code>Доменный</code>, <code>Частный</code> и <code>Публичный</code></li>
16406    <li>Имя: <code>sd-server AIVisionsLab</code></li>
16407  </ol>
16408  <p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>Метод 2 — PowerShell (одной строкой, запуск от имени администратора):</strong></p>
16409  <pre style="font-family:'JetBrains Mono',monospace;font-size:10px;margin-bottom:.5rem">New-NetFirewallRule -DisplayName "sd-server AIVisionsLab" -Direction Inbound -Protocol TCP -LocalPort 7860 -Action Allow</pre>
16410  <p style="font-size:.82rem;color:#94a3b8;margin:0"><strong>Проверка:</strong> После создания правила перезапустите sd-server и попробуйте сгенерировать изображение через OpenWebUI. Зеленая полоса в настройках изображений подтвердит, что мост активен.</p>
16411</div>
16412
16413<p style="font-size:.88rem;color:#fff;margin:1rem 0 .5rem">📊 <strong>
16413Ожидаемые логи успешного запуска</strong></p>
16414<pre style="font-family:'JetBrains Mono',monospace;font-size:11px">[INFO] main.cpp:148 - listening on: http://0.0.0.0:7860
16415[INFO] stable-diffusion.cpp:3987 - generate_image 512x512
16416[INFO] stable-diffusion.cpp:4218 - generate_image completed in X.XXs</pre>
16417
16418<div class="card" style="border-left:3px dashed var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);margin-top:1.25rem">
16419  <strong style="color:#fff;display:block;margin-bottom:.4rem">⚠️ Примечание о совместимости флагов — sd-server</strong>
16420  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem">Репозиторий <code>leejet/stable-diffusion.cpp</code> претерпел переименование аргументов CLI в ходе версий. В зависимости от скомпилированного коммита:</p>
16421  <div class="tbl" style="margin-bottom:.75rem">
16422    <table>
16423      <thead>
16424        <tr><th>Версия / Сборка</th><th>Правильные флаги</th></tr>
16425      </thead>
16426      <tbody>
16427        <tr><td>Старые сборки (до master-600)</td><td><code>
16427--host 0.0.0.0 --port 7860</code></td></tr>
16428        <tr><td>Новые сборки (master-600+)</td><td><code>--listen-ip 0.0.0.0 --listen-port 7860</code></td></tr>
16429      </tbody>
16430    </table>
16431  </div>
16432  <p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem"><strong>Быстрая диагностика:</strong> Если терминал возвращает <code>error: unknown argument '--listen-ip'</code>, немедленно замените его на <code>--host</code> и <code>--port</code>. Сетевое поведение идентично — обновилась только номенклатура аргументов.</p>
16433  <p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>Проверка вашей версии:</strong></p>
16434  <pre style="font-family:'JetBrains Mono',monospace;font-size:10px;margin:0">E:\\stable-diffusion.cpp\\build\\bin\\Release\\sd-server.exe --help
16435# Ищите в списке: если отображается "--listen-ip", используйте новый синтаксис.
16436# Если отображается "--host", используйте старый синтаксис.</pre>
16437</div>`},sdcpp:{id:"sdcpp",title:"08. КОМПИЛЯЦИЯ STABLE-DIFFUSION.CPP",desc:"Создание чистого движка на C++ для ускоренного GPU рендеринга изображений без зависимостей CUDA.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["sdcpp","stable-diffusion-cpp","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["llama"],previous:"llama",next:"modelos",related:["sdserver","flux_server"]}},html:`<div class="note">⚠ Компиляция через <strong>Developer PowerShell</strong> · Последующий запуск через <strong>обычный PowerShell</strong></div>
16438  <div class="code"><pre># Структурированное клонирование с загрузкой всех связанных подмодулей зависимостей
16439git clone --recursive https://github.com/leejet/stable-diffusion.cpp
16440cd stable-diffusion.cpp
16441mkdir build
16442cd build
16443
16444# Настройка компилятора с активацией движка Vulkan и компиляция бинарных файлов в режиме производительности
16445cmake .. -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
16446cmake --build . --config Release -j20</pre></div>
16447  <div class="code ok" style="margin-top:.75rem"><pre># Финальные логи успешной компиляции:
16448-- Found Vulkan: C:/VulkanSDK/1.4.341.1/Lib/vulkan-1.lib
16449[100%] Built target sd-server ✅</pre></div>`},sdserver:{id:"sdserver",title:"10. ИНИЦИАЛИЗАЦИЯ СЕРВЕРА SD-SERVER (GPU)",desc:"Активация сервиса генерации изображений на локальном порту для прослушивания вызовов API графического интерфейса.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"intermediate",estimated_time_min:15,tags:["sd-server","api-rest","inferenca-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["modelos"],previous:"modelos",next:"flux_server",related:["sd_bat_automation","sd_openwebui_integration"]}},html:`<div class="note ok">✅ Инициализация подтверждена: выполните этот блок кода в <strong>обычном PowerShell</strong></div>
16450  <div class="code"><pre># Запуск сервера с указанием квантованной модели и настройкой хоста прослушивания
16451E:\\stable-diffusion.cpp\\build\\bin\\Release\\sd-server.exe \\
16452  -m "E:\\models\\dreamshaper8.gguf" \\
16453  --host 0.0.0.0 \\
16454  --port 7860</pre></div>
16455  <div class="code ok" style="margin-top:.75rem"><pre># Мониторинг терминала:
16456ggml_vulkan: Found 1 Vulkan device(s)
16457ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
16458Server listening on http://0.0.0.0:7860 ✅</pre></div>`},sdxl_vulkan:{id:"sdxl_vulkan",title:"26. SDXL & FLUX.1 VULKAN: ВЫСОКОЕ РАЗРЕШЕНИЕ НА POLARIS",desc:"Полный разбор задачи диффузии высокого разрешения (1024x1024) через Vulkan и структурированный offloading тензоров на 8 ГБ кремния.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:40,tags:["sdxl","vulkan-diffusion","segmentacao-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proving_hypothesis_35b"],previous:"proving_hypothesis_35b",next:"",related:["animatediff-video","flux-vulkan"]}},html:`<div class="page">
16459
16460  <div class="hero">
16461    <div class="hero-eyebrow">AIVisionsLab — Раздел 26</div>
16462    <div class="hero-title">SDXL 1024×1024 на RX 580 через Vulkan:<br>вызов от AMD, принятый в прямом эфире</div>
16463    <div class="hero-sub">AMD RX 580 8GB (2017) · stable-diffusion.cpp (leejet) · Vulkan · без CUDA · без ROCm · гибридное разделение CPU/GPU · фотореалистичный результат подтвержден</div>
16464  </div>
16465
16466  <div class="badges">
16467    <span class="badge badge-red">RX 580 · GCN 4th gen</span>
16468    <span class="badge badge-blue">Vulkan backend</span>
16469    <span class="badge badge-gray">stable-diffusion.cpp</span>
16470    <span class="badge badge-green">SDXL 1024×1024 ✓</span>
16471    <span class="badge badge-amber">гибридное разделение CPU/GPU</span>
16472  </div>
16473
16474  <h2>Контекст: вызов пришел из Discord AMD</h2>
16475  <p>Пока мы обсуждали ROCm против Vulkan на официальном сервере AMD Developer Community, один из участников в прямом эфире поставил под сомнение пределы стека. Ответ не был догадкой — мы запустили бенчмарк в реальном времени и опубликовали результат со скриншотами, логами и сгенерированным изображением прямо на сервере AMD.</p>
16476
16477  <div class="discord-card">
16478    <div class="discord-header"><i class="ti ti-brand-discord" aria-hidden="true"></i> AMD Developer Community · #rocm-ai-assistant</div>
16479    <div class="discord-body">
16480      <div class="discord-quote">
16481        <div class="author">POIZONE 🔥</div>
16482        <p>"Love the RX 580 flex. Which SD backend are you using, stable-diffusion.cpp on Vulkan? And does it support SDXL or Flux, or only SD1.5?"</p>
16483      </div>
16484      <div class="discord-reply">Ответ: мы провели тест в прямом эфире во время беседы. Результат — SDXL 1.0 @ 1024×1024 подтвержден, с логами, скриншотами Task Manager и сгенерированным изображением — был опубликован в том же канале. ROCm AI Assistant (официальный бот AMD) ответил, признав, что Vulkan является легитимным выбором для оборудования вне поддержки ROCm.</div>
16485    </div>
16486  </div>
16487
16488  <h2>Проблема: 6.9 ГБ модель, 8 ГБ VRAM</h2>
16489  <p>Базовая модель SDXL весит ~6.9 ГБ в fp16. С учетом буферов активации во время инференса, это превышает 8 ГБ VRAM RX 580, если загружать всё в GPU. Решение заключается в выборочном offloading по компонентам — stable-diffusion.cpp (форк leejet) поддерживает это нативно, используя ту же логику, что мы уже применяли для FLUX.1-schnell с <code>--clip-on-cpu</code>.</p>
16490  <p>Вторая скрытая проблема: оригинальный VAE от SDXL выдает NaN в FP16, а ggml_conv_2d в sd.cpp работает только в FP16. Без правильного исправления изображение получается черным — без каких-либо видимых ошибок в логе.</p>
16491
16492  <div class="gotcha-box">
16493    <div class="gotcha-title">⚠ обязательный нюанс — VAE FP16 fix</div>
16494    <p>Всегда используйте <strong>sdxl_vae-fp16-fix.safetensors</strong> (madebyollin) вместо оригинального VAE. Без него: черное изображение, без ошибок, при любом рендере. Флаг <code>--vae</code> указывает на этот файл, а не на VAE, встроенный в чекпоинт.</p>
16495  </div>
16496
16497  <h2>Решение: гибридное разделение CPU/GPU</h2>
16498  <p>UNet целиком в VRAM. Text encoders и VAE decode в RAM. Флаг <code>--vae-tiling</code> разбивает декодирование на тайлы 32×32, чтобы устранить пик потребления памяти на финальном этапе конвейера.</p>
16499
16500  <div class="code-block">
16501    <div class="code-label">PowerShell — E:\\stable-diffusion.cpp\\build\\bin\\Release\\</div>
16502    <pre>.\\sd-server.exe \`
16503  --listen-ip 0.0.0.0 \`
16504  --listen-port 8081 \`
16505  -m E:\\models\\sd_xl_base_1.0.safetensors \`
16506  --vae E:\\models\\sdxl_vae-fp16-fix.safetensors \`
16507  --clip-on-cpu \`
16508  --vae-on-cpu \`
16509  --vae-tiling \`
16510  -H 1024 -W 1024 -v</pre>
16511  </div>
16512
16513  <table class="flag-table">
16514    <thead><tr><th>Флаг</th><th>Эффект</th><th>Освобожденная VRAM</th></tr></thead>
16515    <tbody>
16516      <tr><td>--clip-on-cpu</td><td>CLIP-L + OpenCLIP-bigG работают в RAM во время conditioner</td><td>~1.56 ГБ</td></tr>
16517      <tr><td>--vae-on-cpu</td><td>VAE decode работает на CPU/RAM — устраняет пик в конце конвейера</td><td>~416 МБ</td></tr>
16518      <tr><td>--vae-tiling</td><td>Разбивает декодирование на тайлы 32×32 (49 тайлов при 1024×1024)</td><td>— (снижает пик RAM)</td></tr>
16519    </tbody>
16520  </table>
16521
16522  <h2>Разделение памяти подтверждено в логах</h2>
16523
16524  <div class="log-block">
16525    <pre><span class="comment"># вывод sd-server после полной загрузки модели:</span>
16526
16527total params memory size = 6624.11MB
16528<span class="highlight">  VRAM  4900.07MB  →  diffusion_model (UNet)</span>
16529<span class="highlight">  RAM   1564.36MB  →  text_encoders (CLIP-L + OpenCLIP-bigG)</span>
16530<span class="highlight">  RAM    159.68MB  →  vae</span>
16531
16532listening on: http://0.0.0.0:8081</pre>
16533  </div>
16534
16535  <div class="memory-split">
16536    <div class="mem-card gpu">
16537      <div class="mem-label">GPU · VRAM</div>
16538      <div class="mem-value">4.9 ГБ</div>
16539      <div class="mem-sub">UNet (diffusion_model)</div>
16540    </div>
16541    <div class="mem-card ram">
16542      <div class="mem-label">CPU · RAM</div>
16543      <div class="mem-value">1.56 ГБ</div>
16544      <div class="mem-sub">CLIP-L + OpenCLIP-bigG</div>
16545    </div>
16546    <div class="mem-card ram">
16547      <div class="mem-label">CPU · RAM</div>
16548      <div class="mem-value">160 МБ</div>
16549      <div class="mem-sub">VAE decode (49 тайлов)</div>
16550    </div>
16551  </div>
16552
16553  <h2>Тест генерации через PowerShell</h2>
16554  <p>Почему мы не используем Open WebUI: он уже был настроен на FLUX.1-schnell на другом порту. Перенастройка могла нарушить уже работающий сетап. Терминал решает задачу быстрее, без необходимости сохранять состояние и без конфликтов портов.</p>
16555
16556  <div class="code-block">
16557    <div class="code-label">PowerShell — отправка промпта через API A1111-compatible</div>
16558    <pre>$body = @{
16559    prompt         = "a lovely cat, detailed fur, studio lighting"
16560    negative_prompt = ""
16561    width          = 1024
16562    height         = 1024
16563    steps          = 20
16564    cfg_scale      = 7
16565    sampler_name   = "Euler a"
16566} | ConvertTo-Json
16567
16568$response = Invoke-RestMethod \`
16569    -Uri "http://localhost:8081/sdapi/v1/txt2img" \`
16570    -Method Post \`
16571    -ContentType "application/json" \`
16572    -Body $body
16573
16574$bytes = [Convert]::FromBase64String($response.images[0])
16575[IO.File]::WriteAllBytes("E:\\models\\teste_sdxl_1024.png", $bytes)</pre>
16576  </div>
16577
16578  <h2>Полный бенчмарк</h2>
16579
16580  <div class="bench-grid">
16581    <div class="bench-card">
16582      <div class="bench-phase">Conditioner (CLIP)</div>
16583      <div class="bench-time">~4с</div>
16584      <div class="bench-detail">CPU/RAM · CLIP-L + OpenCLIP-bigG</div>
16585    </div>
16586    <div class="bench-card">
16587      <div class="bench-phase">UNet sampling</div>
16588      <div class="bench-time">267с</div>
16589      <div class="bench-detail">20 шагов · Euler A · 13.37с/ит · RX 580 Vulkan</div>
16590    </div>
16591    <div class="bench-card">
16592      <div class="bench-phase">VAE decode</div>
16593      <div class="bench-time">~390с</div>
16594      <div class="bench-detail">49 тайлов 32×32 · ~8с/тайл · CPU/RAM</div>
16595    </div>
16596    <div class="bench-card">
16597      <div class="bench-phase">Пик VRAM</div>
16598      <div class="bench-time">5.7 ГБ</div>
16599      <div class="bench-detail">из 8.0 ГБ доступных · запас 2.3 ГБ</div>
16600    </div>
16601    <div class="bench-card total">
16602      <div class="bench-phase">Итого end-to-end</div>
16603      <div class="bench-time">662с · ~11 минут</div>
16604      <div class="bench-detail">Пиковая температура 67°C → 39°C в простое · RAM использовано 17.7/31.8 ГБ</div>
16605    </div>
16606  </div>
16607
16608  <h2>Контекст скорости</h2>
16609  <p>Это не быстро. Но это не главное.</p>
16610
16611  <table class="comparison-table">
16612    <thead><tr><th>Оборудование</th><th>Стек</th><th>Время SDXL 1024×1024</th></tr></thead>
16613    <tbody>
16614      <tr><td>RTX 4090</td><td>CUDA</td><td>~8с</td></tr>
16615      <tr><td>RTX 3080</td><td>CUDA</td><td>~25с</td></tr>
16616      <tr class="highlight-row"><td>RX 580 8GB (2017)</td><td>Vulkan · без CUDA · без ROCm</td><td>662с <span class="tag">работает</span></td></tr>
16617      <tr><td>Чистый CPU (Xeon E5-2690 v3)</td><td>AVX2</td><td>диапазон аналогичен сетапу выше</td></tr>
16618    </tbody>
16619  </table>
16620
16621  <h2>Полученный результат</h2>
16622  <p>Промпт: <em>"a lovely cat, detailed fur, studio lighting"</em></p>
16623  <p>Результат: фотореалистичный Maine Coon, видны отдельные волоски, четкие глаза, боке, студийное освещение с драматичным контрастом. Без артефактов, без шума, без черных изображений. VAE FP16 fix сработал точно так, как описано в документации.</p>
16624
16625  <div class="result-box">
16626    <p>✓ SDXL 1.0 @ 1024×1024 — подтверждено на RX 580 8GB через чистый Vulkan. Оборудование выпущено в 2017 году, вне официальной поддержки ROCm, без каких-либо проприетарных зависимостей от вендора. Гибридное разделение CPU/GPU с --clip-on-cpu + --vae-on-cpu + --vae-tiling — это комбинация, которая делает это возможным в пределах 8 ГБ VRAM.</p>
16627  </div>
16628
16629  <h2>Ответ AMD Developer Community</h2>
16630  <p>Бенчмарк был опубликован на официальном сервере AMD с логами, скриншотами Task Manager во время инференса и сгенерированным изображением в ответ на прямой вопрос участника POIZONE в канале #rocm-ai-assistant. Реакция была мгновенной: <em>"wow, that was fast thanks alot, and also pretty good results"</em>.</p>
16631  <p>В продолжение, отвечая на более развернутое сообщение о мотивации проекта — доступ к устаревшему оборудованию, отказ от поддержки Polaris в ROCm и DirectML, а также философия "железо не умирает, исчезает лишь официальная поддержка" — POIZONE прокомментировал: <em>"Today, someone who wanted to run local AI and couldn't — now can. That's what matters. — this is exactly why i like this idea"</em>.</p>
16632
16633  <h2>Загрузка моделей</h2>
16634  <div class="code-block">
16635    <div class="code-label">PowerShell — загрузка в E:\\models\\</div>
16636    <pre>cd E:\\models\\
16637
16638# базовая модель SDXL (~6.9 ГБ)
16639curl.exe -L -o sd_xl_base_1.0.safetensors \`
16640  https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
16641
16642# VAE FP16 fix — обязательно (~319 МБ)
16643curl.exe -L -o sdxl_vae-fp16-fix.safetensors \`
16644  https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors</pre>
16645  </div>
16646
16647  <div class="footer-note">
16648    AIVisionsLab · Раздел 26 из 36 · Оборудование: AMD RX 580 8GB (2017) + Xeon E5-2690 v3 + 32 ГБ DDR4 ECC · Windows 10 Pro + WSL2 · stable-diffusion.cpp форк leejet · Vulkan backend · Протестировано и задокументировано в прямом эфире в ответ на вызов в Discord AMD Developer Community.
16649  </div>
16650
16651</div>`},solucao:{id:"solucao",title:"04. РЕШЕНИЕ — ДВОЙНАЯ АРХИТЕКТУРА",desc:"Окончательная инженерная стратегия: интеллектуальное разделение рабочих нагрузок между GPU Vulkan и CPU Xeon.",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"arquitetura",difficulty:"intermediate",estimated_time_min:15,tags:["vulkan-api","co-processamento","otimizacao-barramento"],last_reviewed:"2026-07-01",relationships:{prerequisites:["falhas"],previous:"falhas",next:"prereqs",related:["contexto","stack"]}},html:`<div class="card acc">
16652    <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-bottom:.9rem">Логика системного потока</h3>
16653    <div class="code"><pre>ПУТЬ 1 — GPU VULKAN (Локальное ускорение RX 580):
16654Экосистема llama.cpp отображает GPU через нативные вызовы Vulkan
16655        ↓
16656stable-diffusion.cpp наследует и использует ту же чистую базу движка ggml
16657        ↓
16658Модели SD 1.5, конвертированные в GGUF, генерируют стабильные изображения за ~72 секунды ✅
16659
16660ПУТЬ 2 — CPU XEON (Масштабирование для тяжелых моделей SOTA):
16661Модель FLUX.1 Schnell FP8 требует 16GB и превышает 8GB физической VRAM видеокарты
16662        ↓
16663Перенос рабочего процесса на ComfyUI, работающий через CPU внутри WSL2 Linux
16664        ↓
16665Оперативная память DDR4 REG ECC выступает в роли "виртуальной VRAM высокой стабильности"
16666        ↓
16667Полная генерация FLUX.1 в разрешении 768x768 завершена за ~24 минуты ✅</pre></div>
16668  </div>
16669  <h4 class="s" style="margin-top:1.25rem;margin-bottom:.6rem;color:#fff;font-family:'Syne',sans-serif">Отображение портов и скоординированных служб</h4>
16670  <div class="code"><pre>Пользовательский интерфейс (OpenWebUI через Docker — Порт :3000)
16671        │
16672        ├──► Оркестрация текста: llama-server.exe (Порт :8081 — Backend Vulkan на RX 580)
16673        │     └── Резервный вариант: Ollama Engine (Порт :11434 — Режим чистого CPU)
16674        │
16675        └──► Оркестрация изображений (Динамические маршруты промптов):
16676              ├──► Сверхбыстрый запрос (SD 1.5 GGUF): sd-server.exe (Порт :7860 — Backend Vulkan)
16677              └──► Запрос SOTA/Сложный (FLUX.1): ComfyUI Server (Порт :8188 — WSL2 CPU Xeon)</pre></div>`},stack:{id:"stack",title:"20. КАРТА СЕРВИСОВ ИНТЕГРИРОВАННОГО СТЕКА",desc:"Таблица мониторинга инфраструктуры, локальной маршрутизации трафика и активных бэкендов.",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"monitoramento",difficulty:"beginner",estimated_time_min:10,tags:["network-stack","ports-mapping","security-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["animatediff-video"],previous:"animatediff-video",next:"scripts",related:["sd_bat_automation","scripts"]}},html:`<div class="tbl"><table>
16678    <thead><tr><th>
16678Сервис ИИ</th><th>Порт доступа</th><th>Протокол / Engine</th><th>Активный аппаратный бэкенд</th></tr></thead>
16679    <tbody>
16680      <tr><td><strong>Open WebUI</strong></td><td><code>:3000</code></td><td>Docker Container</td><td>Виртуализированная среда WSL2</td></tr>
16681      <tr class="hig"><td><strong>llama-server</strong></td><td><code>:8081</code></td><td>Nativo ggml Executável</td><td>GPU AMD Radeon RX 580 (Vulkan 1.x)</td></tr>
16682      <tr class="hig"><td><strong>sd-server</strong></td><td><code>:7860</code></td><td>Nativo ggml Executável</td><td>GPU AMD Radeon RX 580 (Vulkan 1.x)</td></tr>
16683      <tr><td><strong>ComfyUI Server</strong></td><td><code>:8188</code></td><td>Python Runtime Isolado</td><td>CPU Xeon E5-2690 v3 (Modo Pure CPU)</td></tr>
16684      <tr><td><strong>Ollama Engine</strong></td><td><code>:11434</code></td><td>Служба резервирования</td><td>CPU Xeon E5-2690 v3 (Modo Pure CPU)</td></tr>
16685    </tbody>
16686  </table></div>`},"troubleshoot-comfyui":{id:"troubleshoot-comfyui",title:"28. КАТАСТРОФА ПАМЯТИ В COMFYUI WINDOWS",desc:"Обработка переполнения физической VRAM и экстренное использование флагов подкачки.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["vram-spillfix","pagefile-allocation","comfyui-out-of-memory"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux-vulkan"],previous:"flux-vulkan",next:"comfyui-portable-amd",related:["comfyui-directml","comfyui-directml-func"]}},html:`<div class="err">
16687    <div class="err-t">Exceção de Runtime: RuntimeError: Could not allocate tensor with...</div>
16688    <p style="margin-top:.35rem"><strong style="color:#e2e8f0">Механизм сбоя:</strong> Возникает при попытке запуска сложных потоков генерации изображений в Windows с использованием нестабильных бэкендов ускорения, которые пытаются зарезервировать больше непрерывных блоков памяти, чем доступно на видеокарте в данный момент.</p>
16689    <p style="margin-top:.35rem"><strong style="color:#fff">Флаги выживания:</strong> Измените вызов файла запуска, добавив команды фрагментации нагрузки: <code>--lowvram</code> или <code>--normalvram</code>. Это заставляет менеджер ComfyUI выгружать слои CLIP из видеопамяти перед инициализацией обработки KSampler.</p>
16690  </div>`},troubleshooting:{id:"troubleshooting",title:"27. РУКОВОДСТВО ПО УСТРАНЕНИЮ НЕПОЛАДОК (TROUBLESHOOTING)",desc:"Быстрая диагностика для обхода ошибок тайм-аута API и нулевых значений seed на сервере.",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"geral",difficulty:"beginner",estimated_time_min:10,tags:["port-fixing","network-troubleshoot","timeout-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["cpu"],previous:"cpu",next:"flux-vulkan",related:["falhas","troubleshoot-comfyui"]}},html:`<div class="err">
16691    <div class="err-t">Критический симптом: generate_image returned no results / Терминал завис</div>
16692    <p style="margin-top:.35rem"><strong style="color:#e2e8f0">Выявленная причина:</strong> Сервер <code>sd-server.exe</code> демонстрирует периодическую ошибку численного переполнения при обработке генераций, отправленных с seed, установленным в случайном режиме (Seed: -1).</p>
16693    <p style="margin-top:.35rem"><strong style="color:#22c55e">Корректирующее действие:</strong> В интерфейсе OpenWebUI отключите переключатель динамического seed в расширенных настройках промпта и принудительно установите фиксированное и допустимое целое число (например: <code>42</code>, <code>1337</code>).</p>
16694  </div>`}},"zh-CN":{amihart:{id:"amihart",title:"31. MÉTODO AMIHART — INFERÊNCIA RX580 EM POLARIS/DEBIAN",desc:"致谢说明:纪念 艾米心 (Amihart) 概念验证的文献章节,她是 Debian GCN4/Polaris 下 Vulkan 验证的先驱。",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:30,tags:["metodo-amihart","debian-polaris","vulkan-diagnostics"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comunidade"],previous:"comunidade",next:"dadhacks",related:["comunidade","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">2025å¹´1月,开发者 <strong style="color:#fff">艾米心 (Amihart)</strong> 发表了一项技术研究,证明尽管 AMD 施加了官方限制(结束了对 Polaris/GCN4 架构的官方 ROCm 支持),RX 580 硬件仍具有充分的 AI 加速æ
16694½œåŠ›ã€‚</p><div style="display:grid;grid-template-columns:1fr 1fr;gap:.85rem;margin-bottom:1.25rem"><div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid var(--r)"><p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">AIVisionsLab 方法 (原生 Windows)</p><ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8"><li>在主机系统 (Windows) 上执行。</li><li>专注于高稳定性的日常生产。</li><li>原生 Vulkan 编排调优。</li><li>WSL 中的混合 VRAM/CPU 分段。</li></ul></div><div class="card" style="border-left:3px solid #22c55e;padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);border-left:3px solid #22c55e"><p style="font-size:.88rem;font-weight:600;color:#fff;margin-bottom:.5rem">Amihart 方法 (Linux/Debian)</p><ul style="padding-left:1.2rem;font-size:0.8rem;color:#94a3b8;line-height:1.8"><li>在 Linux/Debian 生态系统中执行。</li><li>通过 Docker 容器实现稳健隔离。</li><li>使用 Vulkan API 标志进行严格编译。</li><li>适配虚拟化的 ROCm 沙盒。</li></ul></div></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. LLM 设置 — Debian 上的 Vulkan</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">llama.cpp 使用纯 Vulkan API 编译,以绕过 ROCm 驱动程序的缺失:</p><div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># 步骤 1:安装 Vulkan 驱动程序和编译先决条件
16695sudo apt install vulkan-tools libtcmalloc-minimal4 libcurl4-openssl-dev glslc cmake make git pkg-config libvulkan-dev
16696
16697# 步骤 2:克隆并编译启用了 Vulkan 的 llama.cpp
16698cd ~
16699git clone https://github.com/ggerganov/llama.cpp
16700cd llama.cpp && mkdir build && cd build
16701cmake .. -DGGML_VULKAN=on -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=ON
16702
16703# 步骤 3:将二进制文件添加到执行 PATH
16704echo 'export PATH=$PATH:'$(realpath bin) >> ~/.bashrc
16705source ~/.bashrc
16706
16707# 步骤 4:运行 DeepSeek R1 8B (Vulkan0 加速)
16708llama-cli -m deepseek-r1:8B --device Vulkan0 -ngl 100</code></pre></div><p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>性能指标 (Amihart):</strong>在没有 GPU 的 Celeron G6900 上运行时,响应为 5.45 tokens/s。在 RX 580 上使用 100 层卸载的纯 Vulkan 加速,性能跃升至 <strong style="color:var(--r)">24.56 tokens/s</strong>,使模型可行且敏捷。</p><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">B. Stable Diffusion 设置 — Docker 沙盒</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">由于图像生成器需要 ROCm 依赖项,Amihart 使用隔离的虚拟容器在 Debian 上干净地运行 WebUI:</p><div class="code" style="margin-bottom:1.25rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># 步骤 1:安装 Docker 引擎和严格密钥
16709sudo apt update && sudo apt install -y ca-certificates curl
16710install -m 0755 -d /etc/apt/keyrings
16711curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
16712chmod a+r /etc/apt/keyrings/docker.asc
16713echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
16714sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io
16715
16716# 步骤 2:克隆 WebUI 并在 ROCm gfx803 隔离下运行
16717cd ~
16718git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
16719cd ~/stable-diffusion-webui
16720
16721sudo docker run -it \\
16722  --network=host --device=/dev/kfd --device=/dev/dri \\
16723  --ipc=host --shm-size 16G --group-add video \\
16724  --cap-add=SYS_PTRACE \\
16725  --rm -v $(pwd)/cache:/root/.cache \\
16726  -v $(pwd)/data:/stable-diffusion-webui/data \\
16727  woodrex/sd-webui-for-gfx803:latest</code></pre></div><p style="font-size:.85rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem"><strong>Amihart 的关键缓存优化:</strong>为避免每次容器启动时重新加载依赖项:</p><div class="code" style="margin-bottom:1.5rem"><pre style="background:#07080a;border:1px solid var(--b);padding:1rem;border-radius:4px;margin:0"><code style="color:#e2e8f0;font-size:11px"># 获取活动的 CONTAINER ID
16728sudo docker ps -l
16729# 将状态提交到新的持久镜像
16730sudo docker commit [CONTAINER_ID]
16731# 查看持久化的镜像 ID 并用它替换 docker run 调用
16732sudo docker images</code></pre></div><div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem"><strong style="color:var(--r)">指标和技术参考:</strong>路由基于 <a href="https://amihart.medium.com/inference-with-an-rx580-13e9c1055472" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">艾米心 (Amihart)</a> 的原始出版物(Medium,2025 年 1 月)。知识是开放的,对社区有用。</div>`},"animatediff-video":{id:"animatediff-video",title:"19. ANIMATEDIFF E INTERPOLAÇÃO DE QUADROS (VÍDEO)",desc:"在旧版硬件上的 ComfyUI 中注入时间一致性,以构建在 Intel Xeon 上协同处理的流畅循环。",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"advanced",estimated_time_min:30,tags:["animatediff","geracao-video","motion-modules"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-modelos"],previous:"comfyui-modelos",next:"stack",related:["comfyui-flux","sdxl_vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
16733  <strong>AnimateDiff</strong> 是一个专为将静态扩散模型(如 Stable Diffusion 1.5)转换为一致性视频生成器而设计的时间建模框架。它通过在 ComfyUI/WSL2 中注入重叠的时间注意力模块来工作。该技术允许以数学协调的方式计算相邻帧的过渡,从而生成流畅的循环,并消除闪烁噪声带来的混乱静态效果。
16734</p>
16735
16736<!-- Stat cards of render cost -->
16737<div style="display:grid;grid-template-columns:1fr 1fr;gap:1.25rem;margin-bottom:1.5rem">
16738  <div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px">
16739    <div style="font-size:1.8rem">🎬</div>
16740    <div>
16741      <div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">视频流水线</div>
16742      <div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#fff">AnimateDiff (WSL2 Pure CPU)</div>
16743      <div style="font-size:.65rem;color:#64748b;margin-top:2px">24 线程 Intel Xeon E5</div>
16744    </div>
16745  </div>
16746  <div class="stat-card" style="display:flex;align-items:center;gap:1rem;background:#14171a;border:1px solid var(--b);padding:18px;border-radius:4px">
16747    <div style="font-size:1.8rem">⏳</div>
16748    <div>
16749      <div class="stat-lbl" style="font-size:9px;color:#475569;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:2px">处理指标</div>
16750      <div class="stat-val" style="font-family:'Syne',sans-serif;font-weight:800;font-size:14px;color:#34d399">每秒视频帧耗时约 141 秒</div>
16751      <div style="font-size:.65rem;color:#64748b;margin-top:2px">插值时间渲染</div>
16752    </div>
16753  </div>
16754</div>
16755
16756<!-- Visual Exhibition Player -->
16757<div style="background:#0F1115;border:1px solid rgba(255,255,255,0.04);border-radius:6px;padding:1.5rem;margin-bottom:1.5rem">
16758  <h4 style="font-size:.85rem;color:#fff;text-transform:uppercase;letter-spacing:1px;margin-bottom:1rem;display:flex;align-items:center;gap:.5rem;margin-top:0">
16759    <span>🎥</span> 交互式生成展示(本地缓存视频呼吸循环)
16760  </h4>
16761  <p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">
16762    下方展示了由您的本地 AI 技术栈渲染的两个输出。将鼠标悬停以激活插值视频效果,或点击模拟器按钮以启动 Xeon 的合成渲染:
16763  </p>
16764  
16765  <div style="display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-bottom:1.25rem">
16766    <!-- Player 1: Cyberpunk -->
16767    <div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1">
16768      <img src="/images/cyberpunk_alley_0_1779586391528.png" alt="Cyberpunk Neon Alley" referrerPolicy="no-referrer" class="animatediff-img-1" style="width:100%;height:100%;object-fit:cover;transition:transform 8s ease-in-out, filter 2s ease;filter:brightness(0.9)" />
16769      <div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem">
16770        <span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span>
16771        <span>CYBER_STREET_00.GIF</span>
16772      </div>
16773      <div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.75rem .5rem .5rem .75rem;display:flex;justify-content:space-between;align-items:center">
16774        <span style="font-family:monospace;font-size:9px;color:#64748b">Stable Diffusion 1.5</span>
16775        <span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">VULKAN_OK</span>
16776      </div>
16777    </div>
16778
16779    <!-- Player 2: Cosmic Glass -->
16780    <div class="video-preview-box" style="position:relative;background:#050608;border:1px solid rgba(255,255,255,0.04);border-radius:4px;overflow:hidden;aspect-ratio:1">
16781      <img src="/images/cosmic_glass_0_1779586410888.png" alt="Cosmic Glass Flask" referrerPolicy="no-referrer" class="animatediff-img-2" style="width:100%;height:100%;object-fit:cover;transition:transform 6s ease-in-out, filter 3s ease;filter:brightness(0.85)" />
16782      <div style="position:absolute;top:.5rem;left:.5rem;background:rgba(0,0,0,0.85);font-family:monospace;font-size:9px;color:#fff;padding:.2rem .4rem;border-radius:2px;display:flex;align-items:center;gap:.3rem">
16783        <span class="pulse-red" style="width:5px;height:5px;border-radius:50%;background:#ef4444;display:inline-block"></span>
16784        <span>ALCHEM_COSMOS_01.GIF</span>
16785      </div>
16786      <div style="position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent, rgba(0,0,0,0.95));padding:.5rem .75rem;display:flex;justify-content:space-between;align-items:center">
16787        <span style="font-family:monospace;font-size:9px;color:#64748b">Pure Xeon Model</span>
16788        <span style="font-family:monospace;font-size:9px;color:#ef4444;font-weight:bold">THREADED_OK</span>
16789      </div>
16790    </div>
16791  </div>
16792
16793  <div style="text-align:center;margin-top:.5rem">
16794    <button onclick="toggleAnimateDiffSim(this)" style="background:rgba(239, 68, 68, 0.1);border:1px solid rgba(239, 68, 68, 0.4);border-radius:3px;color:#fca5a5;font-family:monospace;padding:.5rem 1rem;font-size:.72rem;cursor:pointer;transition:all 0.2s;text-transform:uppercase">
16795      ▶ 启用运动模拟
16796    </button>
16797  </div>
16798  
16799  <div id="sim-log-box" style="background:#07080a;border:1px solid rgba(255,255,255,0.01);border-radius:3px;padding:0.75rem;margin-top:1rem;font-family:monospace;font-size:10px;color:#475569;line-height:1.5;display:none;max-height:120px;overflow-y:auto;text-align:left">
16800  </div>
16801</div>
16802
16803<style>
16804  .video-preview-box:hover .animatediff-img-1 {
16805    transform: scale(1.1) rotate(0.5deg);
16806    filter: brightness(1.1) saturate(1.15) !important;
16807  }
16808  .video-preview-box:hover .animatediff-img-2 {
16809    transform: scale(1.08) rotate(-0.5deg);
16810    filter: brightness(1.05) saturate(1.2) !important;
16811  }
16812  .animate-active-1 {
16813    animation: panCyberpunk 12s infinite alternate ease-in-out;
16814    filter: brightness(1.1) saturate(1.15) !important;
16815  }
16816  .animate-active-2 {
16817    animation: panGlass 10s infinite alternate ease-in-out;
16818    filter: brightness(1.05) saturate(1.2) !important;
16819  }
16820  @keyframes panCyberpunk {
16821    0% { transform: scale(1); filter: hue-rotate(0deg); }
16822    50% { transform: scale(1.12) translate(5px, -3px); filter: hue-rotate(15deg); }
16823    100% { transform: scale(1.02) translate(-5px, 2px); filter: hue-rotate(-10deg); }
16824  }
16825  @keyframes panGlass {
16826    0% { transform: scale(1.02) rotate(0deg); }
16827    50% { transform: scale(1.15) translate(-2px, 4px) rotate(1deg); filter: hue-rotate(5deg); }
16828    100% { transform: scale(1.05) translate(4px, -2px) rotate(-0.5deg); filter: hue-rotate(-5deg); }
16829  }
16830  @keyframes heartbeat {
16831    0%, 100% { opacity: 0.4; }
16832    50% { opacity: 1; }
16833  }
16834  .pulse-red {
16835    animation: heartbeat 1s infinite;
16836  }
16837</style>`},arquivos:{id:"arquivos",title:"35. TAXONOMIA E ESTRUTURA DE ARQUIVOS NVMe",desc:"用于跟踪已编译二进制文件和共享模型的统一目录树。",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"armazenamento",difficulty:"beginner",estimated_time_min:10,tags:["nvme-struct","model-directories","storage-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proximos"],previous:"proximos",next:"meta",related:["comfyui-modelos","meta"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">在 SSD 高速分区内维护的物理路径的严格结构化组织:</p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#e2e8f0;background:rgba(0,0,0,.3);padding:.9rem;border-radius:4px;border:1px solid var(--b)">E:\\
16838├── llama.cpp\\
16839│   └── build\\bin\\Release\\
16840│       ├── llama-server.exe     <span style="color:#64748b"># 本地语言服务器</span>
16841│       └── llama-cli.exe        <span style="color:#64748b"># 诊断实用程序</span>
16842├── stable-diffusion.cpp\\
16843│   └── build\\bin\\Release\\
16844│       ├── sd-server.exe        <span style="color:#64748b"># Vulkan 图像服务器</span>
16845│       └── sd-cli.exe           <span style="color:#64748b"># GGUF 模型转换器</span>
16846└── models\\
16847    ├── mistral-7b-instruct.Q4_K_M.gguf
16848    └── dreamshaper8.gguf        <span style="color:#64748b"># 量化 SD 1.5 检查点</span></pre>`},audio_rvc:{id:"audio_rvc",title:"38. VOICE CONVERSION LOCAL — APPLIO RVC EM AMD RX 580 (Fases Iniciais)",desc:"Pipeline de clonagem de voz no Windows sem CUDA NVIDIA - Configuração do ambiente e primeiras fases.",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:35,tags:["applio","rvc-voice-clone","sintese-audio"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linhatempo"],previous:"linhatempo",next:"audio_whisper",related:["audio_whisper","audio_srt_ptbr"]},part:1},html:`<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
16849  Documentação honesta de uma instalação real, incluindo todas as tentativas, erros e soluções.<br />
16850  Conduzida em duas sessões: ChatGPT (fases iniciais) + Claude (fases finais).
16851</blockquote>
16852
16853<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">CONTEXTO DO PROJETO</h3>
16854<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O objetivo era montar um pipeline de produção audiovisual para canal do YouTube estilo dark/documentário:</p>
16855<div class="code" style="margin-bottom:1.25rem">
16856  <pre><code>Texto → Balabolka + Antônio Neural (TTS) → WAV → Applio/RVC → Yuri (voz clonada)</code></pre>
16857</div>
16858<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A ideia central: separar <strong>atuação</strong> de <strong>identidade vocal</strong>.</p>
16859<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
16860  <li><strong style="color:#fff">Antônio Neural</strong> faz a interpretação, prosódia e emoção (voz Microsoft Neural)</li>
16861  <li><strong style="color:#fff">Yuri</strong> (modelo RVC treinado) aplica a identidade vocal por cima</li>
16862</ul>
16863<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.5rem">Isso produz resultado muito mais natural que TTS generativo puro.</p>
16864
16865<div class="tbl" style="margin-bottom:1.5rem">
16866  <table>
16867    <thead>
16868      <tr>
16869        <th>Aspecto</th>
16870        <th>XTTS/TTS puro</th>
16871        <th>Antônio → Yuri (RVC)</th>
16872      </tr>
16873    </thead>
16874    <tbody>
16875      <tr>
16876        <td>Prosódia</td>
16877        <td>Artificial</td>
16878        <td>Humana (ator real)</td>
16879      </tr>
16880      <tr>
16881        <td>Termos técnicos</td>
16882        <td>Tropeça</td>
16883        <td>Lê corretamente</td>
16884      </tr>
16885      <tr>
16886        <td>Textos longos</td>
16887        <td>Degrada</td>
16888        <td>Estável</td>
16889      </tr>
16890      <tr>
16891        <td>Identidade vocal</td>
16892        <td>Genérica</td>
16893        <td>Clonada</td>
16894      </tr>
16895      <tr>
16896        <td>Naturalidade</td>
16897        <td>60-70%</td>
16898        <td>80-95%</td>
16899      </tr>
16900    </tbody>
16901  </table>
16902</div>
16903
16904<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">HARDWARE UTILIZADO</h3>
16905<div class="tbl" style="margin-bottom:1.5rem">
16906  <table>
16907    <thead>
16908      <tr>
16909        <th>Item</th>
16910        <th>Especificação</th>
16911      </tr>
16912    </thead>
16913    <tbody>
16914      <tr>
16915        <td>CPU</td>
16916        <td>Intel Xeon E5-2690 v3 (24 núcleos)</td>
16917      </tr>
16918      <tr>
16919        <td>GPU</td>
16920        <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
16921      </tr>
16922      <tr>
16923        <td>RAM</td>
16924        <td>31.8 GB DDR4 REG ECC</td>
16925      </tr>
16926      <tr>
16927        <td>OS</td>
16928        <td>Windows 11</td>
16929      </tr>
16930      <tr>
16931        <td>Storage</td>
16932        <td>SSD NVMe (E:)</td>
16933      </tr>
16934      <tr>
16935        <td>Python</td>
16936        <td>3.11.9</td>
16937      </tr>
16938    </tbody>
16939  </table>
16940</div>
16941
16942<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 0 — TENTATIVA COM DATASET DO ANTÔNIO (fracasso documentado)</h3>
16943<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A ideia original era treinar o modelo RVC com horas de áudio do Antônio Neural. Foi criado um script <code>split.py</code> com Whisper para segmentar automaticamente o áudio em clips de 6-12 segundos.</p>
16944<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-bottom:0.5rem"><strong>O problema: estouro de memória</strong></p>
16945<div class="code" style="margin-bottom:1.25rem">
16946  <pre><code>MemoryError
16947concurrent.futures.process.BrokenProcessPool</code></pre>
16948</div>
16949<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O pré-processamento de dataset grande (~2h34 de áudio) estourou RAM e VRAM simultaneamente. Mesmo quando terminava, o volume de 1000+ clips causava instabilidade no pipeline do Applio.</p>
16950<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem"><strong>Decisão:</strong> abandonar o dataset do Antônio e usar diretamente <strong>9 minutos de TTS do ElevenLabs</strong> com a voz do Yuri. Menor, mais limpo, mais controlado.</p>
16951
16952<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 1 — INSTALAÇÃO DO AMBIENTE BASE</h3>
16953<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Estrutura de pastas:</strong></p>
16954<div class="code" style="margin-bottom:1.25rem">
16955  <pre><code>E:\\tts-audio_pra_youtube\\
16956├── Applio\\
16957├── voices\\
16958│   └── YURI-TTS.wav  (9 minutos, ElevenLabs, voz Yuri)
16959├── output\\
16960└── scripts\\</code></pre>
16961</div>
16962
16963<div class="err" style="margin-bottom:1.25rem">
16964  <div class="err-t">⚠️ Problema: Python 3.10 incompatível</div>
16965  <p>O Applio moderno exige Python 3.11+. O numpy 2.4.4 requerido não existe para 3.10.</p>
16966</div>
16967
16968<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução:</strong> instalar Python 3.11 em paralelo sem remover o 3.10:</p>
16969<div class="code" style="margin-bottom:1.25rem">
16970  <span class="code-lang">powershell</span>
16971  <pre><code>py -0
16972# -V:3.11  Python 3.11 (64-bit)   ← usar esta
16973# -V:3.10  Python 3.10 (64-bit)   ← manter para outros projetos
16974
16975py -3.11 -m venv venv
16976venv\\Scripts\\activate
16977python --version
16978# Python 3.11.9  ✅</code></pre>
16979</div>
16980
16981<div class="err" style="margin-bottom:1.25rem">
16982  <div class="err-t">⚠️ Problema: requirements.txt com CUDA forçado</div>
16983  <div class="code" style="margin-top:0.5rem;margin-bottom:0.5rem">
16984    <pre><code># O Applio traz esta linha que quebra no AMD Windows:
16985torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'</code></pre>
16986  </div>
16987  <p>O sufixo <code>+cu128</code> é CUDA 12.8 exclusivo NVIDIA. No Windows (<code>win32</code>), essa condição sempre é verdadeira.</p>
16988</div>
16989
16990<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Solução:</strong> editar o <code>requirements.txt</code>:</p>
16991<div class="code" style="margin-bottom:1.25rem">
16992  <pre><code># REMOVER:
16993torch==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
16994torchaudio==2.7.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
16995torchvision==0.22.1+cu128; sys_platform == 'linux' or sys_platform == 'win32'
16996
16997# SUBSTITUIR POR:
16998torch==2.7.1; sys_platform == 'win32'
16999torchaudio==2.7.1; sys_platform == 'win32'
17000torchvision==0.22.1; sys_platform == 'win32'</code></pre>
17001</div>
17002
17003<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">FASE 2 — TENTATIVA DIRECTML (fracasso documentado)</h3>
17004<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Com o Applio rodando em CPU (~10 min por época), tentou-se acelerar com DirectML.</p>
17005<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Instalação e teste:</strong></p>
17006<div class="code" style="margin-bottom:1.25rem">
17007  <span class="code-lang">powershell</span>
17008  <pre><code>pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
17009pip install torch-directml
17010
17011python -c "import torch_directml; dml = torch_directml.device(); print(dml)"
17012# privateuseone:0  ✅  — RX 580 reconhecida</code></pre>
17013</div>
17014<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Resultado real:</strong></p>
17015<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
17016  <li>GPU uso: 7-10%</li>
17017  <li>VRAM: 1.2GB usada</li>
17018  <li>Velocidade com DirectML: <strong>4.27s/it</strong></li>
17019  <li>Velocidade sem DirectML (CPU): <strong>4.46s/it</strong></li>
17020  <li>Diferença real: <strong>~5%</strong> — irrelevante</li>
17021</ul>
17022<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Por que foi abandonado:</strong></p>
17023<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">O <code>torch-directml</code> está preso na versão <code>0.2.5.dev240914</code> (setembro 2024) e exige <code>torch==2.4.1</code>. O Applio precisa de <code>torch==2.7.1</code>. Conflito irreconciliável:</p>
17024<div class="code" style="margin-bottom:1.25rem">
17025  <pre><code>torch-directml 0.2.5 requires torch==2.4.1
17026hyper-connections 0.4.11 requires torch>=2.5   ← conflito
17027torch-einops-utils 0.1.1 requires torch>=2.5   ← conflito</code></pre>
17028</div>
17029<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">A Microsoft parou de investir no DirectML para IA. O projeto está essencialmente abandonado.</p>
17030<p style="font-size:.88rem;color:#10b981;line-height:1.9;margin-bottom:1.25rem">✅ <strong>Conclusão:</strong> DirectML para RVC em Windows AMD em 2026 = não vale a pena.</p>
17031
17032
17033</div>
17034<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">阶段 3 — 关键错误:环境变量</h3>
17035<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">在尝试强制使用 CPU 时,使用了会导致<strong>特征提取静默失败</strong>的命令:</p>
17036<div class="code" style="margin-bottom:1.25rem">
17037  <span class="code-lang">powershell</span>
17038  <pre><code># ❌ 在 Applio AMD 上绝对不要这样做:
17039set USE_DIRECTML=0
17040set CUDA_VISIBLE_DEVICES=-1
17041set ROCM_VISIBLE_DEVICES=-1
17042set HIP_VISIBLE_DEVICES=-1</code></pre>
17043</div>
17044<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">这些命令会导致提取后 <code>extracted</code> 文件夹为空。训练会在<strong>几秒钟</strong>内结束并显示 "Model trained successfully",但不会生成任何 <code>.pth</code> 文件。</p>
17045<div class="code" style="margin-bottom:1.25rem">
17046  <pre><code>Not enough data present in the training set.
17047Feature files in logs\\my-project\\extracted could not be loaded correctly.</code></pre>
17048</div>
17049<div class="err" style="margin-bottom:1.25rem">
17050  <div class="err-t">⚠️ 陷阱:几秒钟内显示 "Model trained successfully" = 虚假训练。</div>
17051  <p>训练前请务必检查 <code>logs/projeto/extracted/</code> 中是否有 <code>.npy</code> 文件。</p>
17052</div>
17053
17054<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">阶段 4 — 干净安装(最终解决方案)</h3>
17055<div class="code" style="margin-bottom:1.25rem">
17056  <span class="code-lang">powershell</span>
17057  <pre><code># 1. 销毁损坏的环境
17058deactivate
17059Remove-Item -Recurse -Force venv
17060Remove-Item -Recurse -Force logs
17061
17062# 2. 创建干净的 venv
17063py -3.11 -m venv venv
17064venv\\Scripts\\activate
17065python -m pip install --upgrade pip
17066
17067# 3. 安装基础 torch
17068pip install torch==2.4.1 torchaudio==2.4.1 torchvision==0.19.1
17069pip install torch-directml
17070
17071# 4. 安装依赖项(不覆盖 torch)
17072pip install -r requirements.txt --no-deps
17073
17074# 5. 修复缺失的依赖项
17075pip install gradio-client==1.14.0
17076pip install cffi soupsieve local-attention
17077pip install "aiofiles&lt;25.0" "pandas&lt;3.0" "pydantic&lt;=2.12.3"
17078pip install "starlette&lt;1.0,&gt;=0.40.0" "tomlkit&lt;0.14.0"
17079pip install "tokenizers&gt;=0.22.0,&lt;=0.23.0"
17080pip install audioread decorator lazy-loader msgpack pooch scikit-learn resampy</code></pre>
17081</div>
17082<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>config.py — 最终版本(无 DirectML):</strong></p>
17083<div class="code" style="margin-bottom:1.25rem">
17084  <span class="code-lang">python</span>
17085  <pre><code>import torch
17086import json
17087import os
17088
17089@singleton
17090class Config:
17091    def __init__(self):
17092        self.device = "cuda:0" if torch.cuda.is_available() else "cpu"
17093        # 在没有 CUDA 的 AMD Windows 上,自动使用 "cpu"</code></pre>
17094</div>
17095<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>启动:</strong></p>
17096<div class="code" style="margin-bottom:1.25rem">
17097  <span class="code-lang">powershell</span>
17098  <pre><code># 干净的 PowerShell,之前没有任何 'set' 命令
17099python app.py
17100# * Running on local URL: http://127.0.0.1:6969  ✅</code></pre>
17101</div>
17102
17103<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">阶段 5 — 缺失静音文件</h3>
17104<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">通过 git 安装时,不会自动创建静音文件。它们会在训练期间逐个报错:</p>
17105<div class="code" style="margin-bottom:1.25rem">
17106  <pre><code>FileNotFoundError: logs\\mute\\sliced_audios\\mute40000.wav
17107FileNotFoundError: logs\\mute\\extracted\\mute.npy          ← 形状错误导致崩溃
17108FileNotFoundError: logs\\mute\\f0\\mute.wav.npy
17109FileNotFoundError: logs\\mute\\f0_voiced\\mute.wav.npy
17110RuntimeError: tensor (100) must match size (768)</code></pre>
17111</div>
17112<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>解决方案 — 一次性创建所有文件:</strong></p>
17113<div class="code" style="margin-bottom:1.25rem">
17114  <span class="code-lang">powershell</span>
17115  <pre><code>python -c "
17116import numpy as np, soundfile as sf, os
17117[os.makedirs(d, exist_ok=True) for d in [
17118    'logs/mute/sliced_audios','logs/mute/extracted',
17119    'logs/mute/f0','logs/mute/f0_voiced'
17120]]
17121sf.write('logs/mute/sliced_audios/mute40000.wav', np.zeros(int(40000*3.7)), 40000)
17122sf.write('logs/mute/sliced_audios/mute48000.wav', np.zeros(int(48000*3.7)), 48000)
17123sf.write('logs/mute/sliced_audios/mute32000.wav', np.zeros(int(32000*3.7)), 32000)
17124np.save('logs/mute/extracted/mute.npy', np.zeros((196, 768)))
17125np.save('logs/mute/f0/mute.wav.npy', np.zeros(100))
17126np.save('logs/mute/f0_voiced/mute.wav.npy', np.zeros(100))
17127print('OK')
17128"</code></pre>
17129</div>
17130<div class="err" style="margin-bottom:1.25rem">
17131  <div class="err-t">⚠️ 关键:mute.npy 的形状必须为 (196, 768)</div>
17132  <p>768 是 contentvec 嵌入器的维度。任何其他形状都会导致崩溃。</p>
17133</div>
17134
17135<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">阶段 6 — 数据集与训练</h3>
17136<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>使用的数据集:</strong></p>
17137<div class="tbl" style="margin-bottom:1.5rem">
17138  <table>
17139    <thead>
17140      <tr>
17141        <th>参数</th>
17142        <th>值</th>
17143      </tr>
17144    </thead>
17145    <tbody>
17146      <tr>
17147        <td>文件</td>
17148        <td>YURI-TTS.wav</td>
17149      </tr>
17150      <tr>
17151        <td>时长</td>
17152        <td>9 分钟</td>
17153      </tr>
17154      <tr>
17155        <td>来源</td>
17156        <td>ElevenLabs TTS</td>
17157      </tr>
17158      <tr>
17159        <td>备注</td>
17160        <td>最低可接受。理想:15-25 分钟</td>
17161      </tr>
17162    </tbody>
17163  </table>
17164</div>
17165
17166<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>Applio 配置:</strong></p>
17167<div class="tbl" style="margin-bottom:1.5rem">
17168  <table>
17169    <thead>
17170      <tr>
17171        <th>参数</th>
17172        <th>值</th>
17173      </tr>
17174    </thead>
17175    <tbody>
17176      <tr>
17177        <td>采样率</td>
17178        <td>40000 Hz</td>
17179      </tr>
17180      <tr>
17181        <td>声码器</td>
17182        <td>HiFi-GAN</td>
17183      </tr>
17184      <tr>
17185        <td>音高算法</td>
17186        <td>RMVPE</td>
17187      </tr>
17188      <tr>
17189        <td>嵌入器</td>
17190        <td>contentvec</td>
17191      </tr>
17192      <tr>
17193        <td>批次大小</td>
17194        <td>4</td>
17195      </tr>
17196      <tr>
17197        <td>总轮数</td>
17198        <td>200</td>
17199      </tr>
17200      <tr>
17201        <td>GPU 编号</td>
17202        <td><strong>留空</strong>(不要填 0、-1 或 cpu)</td>
17203      </tr>
17204    </tbody>
17205  </table>
17206</div>
17207
17208<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>实际指标:</strong></p>
17209<div class="tbl" style="margin-bottom:1.5rem">
17210  <table>
17211    <thead>
17212      <tr>
17213        <th>轮次</th>
17214        <th>Loss</th>
17215        <th>每轮耗时</th>
17216      </tr>
17217    </thead>
17218    <tbody>
17219      <tr>
17220        <td>1</td>
17221        <td>27.181</td>
17222        <td>7:21</td>
17223      </tr>
17224      <tr>
17225        <td>8</td>
17226        <td>17.93</td>
17227        <td>7:02</td>
17228      </tr>
17229      <tr>
17230        <td>20</td>
17231        <td>16.212</td>
17232        <td>7:43</td>
17233      </tr>
17234      <tr>
17235        <td>43</td>
17236        <td>15.785</td>
17237        <td>5:43</td>
17238      </tr>
17239    </tbody>
17240  </table>
17241</div>
17242<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
17243  <li>速度:约 6 分钟/轮</li>
17244  <li>总计:200 轮约需 20 小时</li>
17245  <li>实际硬件:24 核 Xeon CPU</li>
17246</ul>
17247<blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
17248  <strong>ℹ️ PowerShell 缓冲区:</strong>在通宵训练时,终端看起来可能卡住了。训练仍在正常进行 — 请查看 Applio 中的计数器。
17249</blockquote>
17250
17251<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">经验教训</h3>
17252<p style="font-size:.88rem;color:#10b981;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">✅ 有效方案:</p>
17253<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
17254  <li>Applio + 纯 CPU 在 AMD Windows 上 — 稳定且可用</li>
17255  <li>必须使用 Python 3.11(不要用 3.10)</li>
17256  <li>编辑 <code>requirements.txt</code> — 移除 <code>+cu128</code></li>
17257  <li>干净的 PowerShell — 不设置 <code>CUDA_VISIBLE_DEVICES</code> 变量</li>
17258  <li>训练前手动创建静音文件</li>
17259  <li>Applio 中的 "GPU 编号" 字段<strong>留空</strong></li>
17260</ol>
17261<p style="font-size:.88rem;color:#ef4444;font-weight:700;margin-top:1rem;margin-bottom:0.5rem">❌ 无效方案:</p>
17262<ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:1.25rem">
17263  <li>DirectML + torch 2.7.1 — 2026 年不兼容</li>
17264  <li><code>set CUDA_VISIBLE_DEVICES=-1</code> — 会破坏特征提取</li>
17265  <li>直接安装 <code>pip install -r requirements.txt</code> — 会安装 CUDA 并导致失败</li>
17266  <li>大数据集(数小时音频) — RAM/VRAM 溢出</li>
17267</ol>
17268
17269<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">最终生产流水线</h3>
17270<div class="code" style="margin-bottom:1.25rem">
17271  <pre><code>1. 编写脚本
17272   ↓
172732. Balabolka + Antônio Neural → 带有真人语气的 WAV
17274   ↓
172753. Applio — 推理
17276   模型: my-project_200e.pth
17277   索引: my-project.index
17278   ↓
172794. 输出: Yuri 声音的 WAV
17280   ↓
172815. 编辑并发布到 YouTube</code></pre>
17282</div>
17283<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:0.75rem"><strong>推理速度(训练后):</strong></p>
17284<ul style="list-style-type:disc;padding-left:1.5rem;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
17285  <li>每分钟音频约需 5-30 秒</li>
17286  <li>
172862 小时音频 → 约 30 分钟处理时间</li>
17287  <li>Applio 支持批处理模式</li>
17288</ul>
17289
17290<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">检查清单 — 从零开始复现</h3>
17291<ul style="list-style-type:none;padding-left:0;margin-bottom:1.25rem;color:#94a3b8;line-height:1.8">
17292  <li><span style="color:#475569">[ ]</span> 已安装 Python 3.11</li>
17293  <li><span style="color:#475569">[ ]</span> 已安装 Git</li>
17294  <li><span style="color:#475569">[ ]</span> PATH 中已包含 FFmpeg</li>
17295  <li><span style="color:#475569">[ ]</span> 干净的 WAV 数据集(最少 5 分钟,理想 15-25 分钟)</li>
17296  <li><span style="color:#475569">[ ]</span> 已编辑 <code>requirements.txt</code>(移除 <code>+cu128</code>)</li>
17297  <li><span style="color:#475569">[ ]</span> <code>config.py</code> 中无 <code>torch_directml</code> 引用</li>
17298  <li><span style="color:#475569">[ ]</span> 已创建静音文件</li>
17299  <li><span style="color:#475569">[ ]</span> 干净的 PowerShell(无 <code>set CUDA_VISIBLE_DEVICES</code>)</li>
17300  <li><span style="color:#475569">[ ]</span> Applio 中的 "GPU 编号" 字段<strong>留空</strong></li>
17301  <li><span style="color:#475569">[ ]</span> 提取后:确认 <code>logs/projeto/extracted/</code> 中有 <code>.npy</code> 文件</li>
17302</ul>
17303
17304<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-top:1.5rem;margin-bottom:.9rem">AI 中的 AMD vs NVIDIA — APPLIO/RVC 现状 (2026)</h3>
17305<div class="tbl" style="margin-bottom:1.5rem">
17306  <table>
17307    <thead>
17308      <tr>
17309        <th>平台</th>
17310        <th>状态</th>
17311      </tr>
17312    </thead>
17313    <tbody>
17314      <tr>
17315        <td>NVIDIA CUDA</td>
17316        <td>✅ 优秀 — 原生支持</td>
17317      </tr>
17318      <tr>
17319        <td>AMD ROCm Linux</td>
17320        <td>⚠️ 一般 — 需要折腾</td>
17321      </tr>
17322      <tr>
17323        <td>AMD Windows DirectML</td>
17324        <td>❌ 已废弃</td>
17325      </tr>
17326      <tr>
17327        <td>AMD Windows CPU</td>
17328        <td>✅ 可用 — 慢但稳定</td>
17329      </tr>
17330    </tbody>
17331  </table>
17332</div>
17333<p style="font-size:.85rem;color:#94a3b8;font-style:italic;line-height:1.8"><em>*旧硬件不会消亡 — 只是需要正确的后端。</em></p>`},audio_srt_ptbr:{id:"audio_srt_ptbr",title:"40. PIPELINE COMPLETO — TRANSCRIÇÃO + TRADUÇÃO PT-BR COM RX 580",desc:"将英语视频转录并自动翻译为巴西葡萄牙语,从 .mp4 到 .srt,无需任何付费服务。",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:25,tags:["srt-generation","automacao-srt","ffmpeg-pipeline"],last_reviewed:"2026-07-01",relationships:{prerequisites:["linux_nativo"],previous:"linux_nativo",next:"limit_qwen_35b",related:["audio_whisper","limit_qwen_35b"]},part:1},html:`<div class="whisper-doc">
17334  <div class="hero">
17335    <div class="hero-title"><span>完整流水线</span> — 转录 + 英语➔葡萄牙语 (PT-BR) 翻译</div>
17336    <div class="hero-sub">使用 RX 580 通过 Vulkan 进行离线英语视频转录,并自动翻译为巴西葡萄牙语,从 <code>.mp4</code> 到 <code>.srt</code> 100% 免费。</div>
17337    <div class="hero-badges">
17338      <span class="badge badge-gpu">AMD RX 580 8GB</span>
17339      <span class="badge badge-win">Windows + PowerShell</span>
17340      <span class="badge badge-ok">Vulkan Backend</span>
17341      <span class="badge badge-ok">large-v3-turbo</span>
17342      <span class="badge badge-win">deep-translator (免费)</span>
17343    </div>
17344  </div>
17345
17346  <div class="stat-grid">
17347    <div class="stat">
17348      <div class="stat-label">流水线总耗时</div>
17349      <div class="stat-value">~8 分钟</div>
17350      <div class="stat-sub">视频时长 29分 51秒</div>
17351    </div>
17352    <div class="stat">
17353      <div class="stat-label">VRAM 占用</div>
17354      <div class="stat-value">2.9 GB</div>
17355      <div class="stat-sub">来自 8 GB Polaris</div>
17356    </div>
17357    <div class="stat">
17358      <div class="stat-label">GPU 平均温度</div>
17359      <div class="stat-value">50°C</div>
17360      <div class="stat-sub">已优化风扇曲线</div>
17361    </div>
17362    <div class="stat">
17363      <div class="stat-label">云服务成本</div>
17364      <div class="stat-value">R$ 0,00</div>
17365      <div class="stat-sub">100% 本地离线</div>
17366    </div>
17367  </div>
17368
17369  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">测试所用硬件</h3>
17370  <div class="tbl">
17371    <table>
17372      <thead>
17373        <tr>
17374          <th>组件</th>
17375          <th>规格</th>
17376        </tr>
17377      </thead>
17378      <tbody>
17379        <tr>
17380          <td><strong>GPU</strong></td>
17381          <td>AMD Radeon RX 580 2048SP (8GB VRAM)</td>
17382        </tr>
17383        <tr>
17384          <td><strong>CPU</strong></td>
17385          <td>Intel Xeon E5-2690 v3 (24 线程 / 12 核心)</td>
17386        </tr>
17387        <tr>
17388          <td><strong>RAM</strong></td>
17389          <td>31.8 GB DDR4 REG ECC</td>
17390        </tr>
17391        <tr>
17392          <td><strong>OS</strong></td>
17393          <td>Windows 11 Professional</td>
17394        </tr>
17395        <tr>
17396          <td><strong>驱动程序</strong></td>
17397          <td>Adrenalin 31.0.21925.1001 (2026/05/20)</td>
17398        </tr>
17399      </tbody>
17400    </table>
17401  </div>
17402
17403  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">统一数据流 (Pipeline)</h3>
17404  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
17405    目标是将英语教学视频映射为兼容视频编辑软件(Filmora, Premiere 等)的葡萄牙语字幕,通过原生 GPU 运行转录,并对每个时间戳进行翻译,无需商业云 API 限制:
17406  </p>
17407  <div class="cmd" style="white-space:normal; line-height:1.6; padding: 1rem;">
17408    <strong>video.mp4</strong> ➔ <code>FFmpeg (提取)</code> ➔ <strong>video_16k.wav</strong><br>
17409    ➔ <code>whisper-cli Vulkan (转录)</code> ➔ <strong>video.srt (英语)</strong><br>
17410    ➔ <code>Python deep-translator (Google Translate)</code> ➔ <strong>video_ptbr.srt (葡萄牙语)</strong><br>
17411    ➔ <code>导入 Filmora 时间轴</code>
17412  </div>
17413
17414  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">性能与详细计时</h3>
17415  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
17416    转录 <strong>29 分 51 秒</strong>教学视频(英语音频,AAC,480x360)获得的实际指标:
17417  </p>
17418  <div class="tbl" style="margin-bottom:1.5rem">
17419    <table>
17420      <thead>
17421        <tr>
17422          <th>流水线阶段</th>
17423          <th>工具</th>
17424          <th>耗时</th>
17425        </tr>
17426      </thead>
17427      <tbody>
17428        <tr>
17429          <td><strong>1. 无损 WAV 音频提取</strong></td>
17430          <td>FFmpeg</td>
17431          <td><strong>1.7 秒</strong></td>
17432        </tr>
17433        <tr>
17434          <td><strong>2. 音频转录 (EN)</strong></td>
17435          <td>Whisper.cpp + Vulkan</td>
17436          <td><strong>6 分 07 秒</strong></td>
17437        </tr>
17438        <tr>
17439          <td><strong>3. SRT 批量翻译 (EN➔PT-BR)</strong></td>
17440          <td>Python + <code>deep-translator</code></td>
17441          <td><strong>~2 分钟</strong> (受网络 I/O 限制)</td>
17442        </tr>
17443        <tr style="border-top:1px solid rgba(255,255,255,0.15)">
17444          <td><strong>综合总指标</strong></td>
17445          <td><strong>完整流水线</strong></td>
17446          <td><strong>~8 分钟</strong></td>
17447        </tr>
17448      </tbody>
17449    </table>
17450  </div>
17451
17452  <h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">核心内部计时 (whisper_print_timings)</h4>
17453  <div class="card bg-black/40 border border-white/5 p-4 rounded-md my-3 font-mono text-xs text-[#a7f3d0] leading-relaxed">
17454    load modelo : 3.687 ms<br>
17455    mel (音频) : 2.305 ms<br>
17456    encode GPU  : 204.689 ms<br>
17457    decode      : 4.081 ms<br>
17458    batch total : 108.675 ms<br>
17459    total       : 367.432 ms (每分段批次)
17460  </div>
17461
17462  <div class="section-title">分步操作指南</div>
17463
17464  <div class="step">
17465    <div class="step-header">
17466      <div class="step-num">1</div>
17467      <div class="step-name">通过 FFmpeg 提取兼容音频</div>
17468      <div class="step-desc">WAV 16kHz 单声道 16-bit</div>
17469    </div>
17470    <div class="step-body">
17471      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">Whisper 严格要求 16,000 Hz、16 位单声道格式的原始 WAV 音频:</p>
17472      <div class="cmd">ffmpeg -i "E:\\MUSICAS SUNO AI\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\MUSICAS SUNO AI\\video_16k.wav"</div>
17473      <p class="note"><strong>参数:</strong> <code>-ar 16000</code> 强制 16kHz · <code>-ac 1</code> 转换为单声道 · <code>-c:a pcm_s16le</code> 定义无损 16 位 PCM。</p>
17474    </div>
17475  </div>
17476
17477  <div class="step">
17478    <div class="step-header">
17479      <div class="step-num">2</div>
17480      <div class="step-name">通过 Vulkan 转录</div>
17481      <div class="step-desc">Polaris GPU 高负载</div>
17482    </div>
17483    <div class="step-body">
17484      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">调用编译好的 Whisper 可执行文件,生成初始英语 SRT 字幕文件:</p>
17485      <div class="cmd">cd C:\\whisper.cpp</div>
17486      <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\MUSICAS SUNO AI\\video_16k.wav" -l en --output-srt</div>
17487      <p class="note"><strong>GPU 活动验证:</strong> 确保在初始化时看到 <code>ggml_vulkan: Found 1 Vulkan devices: AMD Radeon RX 580 2048SP</code>,这证明繁重的编码任务已卸载至 GPU,将 CPU 使用率降低至 ~5%。</p>
17488    </div>
17489  </div>
17490
17491  <div class="step">
17492    <div class="step-header">
17493      <div class="step-num">3</div>
17494      <div class="step-name">创建并运行 Python 翻译脚本</div>
17495      <div class="step-desc">零密钥,零成本</div>
17496    </div>
17497    <div class="step-body">
17498      <p style="font-size:0.8rem;color:#94a3b8;margin-bottom:0.5rem">
17499        安装无需 API 密钥的翻译库:<code>pip install deep-translator</code>。创建并运行 <code>C:\\whisper.cpp\\traduzir.py</code>,代码如下:
17500      </p>
17501      <div class="cmd" style="white-space:pre-wrap; font-size:11px;">from deep_translator import GoogleTranslator
17502
17503def traduzir_srt(entrada, saida):
17504    with open(entrada, 'r', encoding='utf-8') as f:
17505        conteudo = f.read()
17506
17507    blocos = conteudo.strip().split('\\n\\n')
17508    resultado = []
17509
17510    for bloco in blocos:
17511        linhas = bloco.split('\\n')
17512        if len(linhas) >= 3:
17513            numero = linhas[0]
17514            timestamp = linhas[1]
17515            texto = ' '.join(linhas[2:])
17516            traduzido = GoogleTranslator(source='en', target='pt').translate(texto)
17517            resultado.append(f"{numero}\\n{timestamp}
17517\\n{traduzido}")
17518
17519    with open(saida, 'w', encoding='utf-8') as f:
17520        f.write('\\n\\n'.join(resultado))
17521    print("完成!")
17522
17523traduzir_srt(
17524    r'E:\\MUSICAS SUNO AI\\video_16k.wav.srt',
17525    r'E:\\MUSICAS SUNO AI\\video_16k_ptbr.srt'
17526)</div>
17527<p style="font-size:0.8rem;color:#94a3b8;margin-top:0.5rem">运行命令:</p>
17528      <div class="cmd">python traduzir.py</div>
17529    </div>
17530  </div>
17531
17532  <div class="step">
17533    <div class="step-header">
17534      <div class="step-num">4</div>
17535      <div class="step-name">在 Filmora 中导入字幕</div>
17536      <div class="step-desc">完成视频剪辑</div>
17537    </div>
17538    <div class="step-body">
17539      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6">
17540        1. 在 Wondershare Filmora 中,前往 <strong>文件 ➔ 导入 ➔ 导入字幕文件</strong>。<br>
17541        2. 选择生成的 <code>video_16k_ptbr.srt</code> 文件。<br>
17542        3. 将字幕轨道直接拖放到时间线上,叠加在原始视频轨道上方。
17543      </p>
17544    </div>
17545  </div>
17546
17547  <div class="section-title">折腾过程中学到的自主经验</div>
17548  <div class="card-inner">
17549    <div class="lesson">
17550      <div class="lesson-icon">⚠️</div>
17551      <div class="lesson-text"><strong>避免在 Whisper 的参数中直接使用 --translate 翻译为 PT-BR:</strong> <code>--translate</code> 参数在设计上原生将音频翻译为英文。为了获得高质量的巴西葡萄牙语字幕,正确的方法是通过 <code>-l en</code> 提取英文,然后使用 <code>traduzir.py</code> 算法进行翻译。</div>
17552    </div>
17553    <div class="lesson">
17554      <div class="lesson-icon">⚠️</div>
17555      <div class="lesson-text"><strong>源语言设置错误的后果:</strong> 当源音频为英语时,如果传入 <code>-l pt</code>,会导致 Whisper 在英语音频上强行套用葡萄牙语语音模式,从而生成完全无法理解且毫无意义的文本。请务必将输入音频的实际语言设置为初始参数。</div>
17556    </div>
17557    <div class="lesson">
17558      <div class="lesson-icon">ℹ️</div>
17559      <div class="lesson-text"><strong>生成文件的位置:</strong> 默认情况下,在原生编译版本中,<code>.srt</code> 文件会保存在与被处理的 WAV 音频文件相同的物理文件夹中,而不是在脚本或 Whisper 的目录内。</div>
17560    </div>
17561    <div class="lesson">
17562      <div class="lesson-icon">✅</div>
17563      <div class="lesson-text"><strong>8 GB VRAM 在 2026 年依然坚挺:</strong> Whisper 的 <code>large-v3-turbo</code> 模型在该生态中仅消耗 2.9 GB 的物理 VRAM,为您的电脑运行其他任务或进行并行渲染留出了充足的空间。这为您省去了数千美元的订阅费和商业 APIs 费用。</div>
17564    </div>
17565  </div>
17566
17567  <div class="footer">
17568    RX 580 — 虽有 580 年高龄,但依然活跃在第一线 🚀 · 折腾记录于 2026 年 6 月
17569  </div>
17570</div>`},audio_whisper:{id:"audio_whisper",title:"39. WHISPER.CPP LOCAL — TRANSCRIÇÃO DE ÁUDIO EM AMD RX 580",desc:"在 Windows 上通过 Vulkan 实现 AMD GPU 加速的音频/视频转录 (large-v3-turbo 模型)。",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"audio",difficulty:"advanced",estimated_time_min:30,tags:["whispercpp","transcricao-audio","vulkan-whisper"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_rvc"],previous:"audio_rvc",next:"linux_nativo",related:["audio_rvc","audio_srt_ptbr"]},part:1},html:`<div class="whisper-doc">
17571<style>
17572.whisper-doc {
17573  --color-border-secondary: rgba(255, 255, 255, 0.05);
17574  --color-border-tertiary: rgba(255, 255, 255, 0.08);
17575  --color-background-secondary: #0c0d10;
17576  --color-background-primary: #07080a;
17577  --color-text-primary: #ffffff;
17578  --color-text-secondary: #94a3b8;
17579  font-family: inherit;
17580}
17581.whisper-doc * { box-sizing: border-box; }
17582.whisper-doc .badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 4px; letter-spacing: 0.04em; text-transform: uppercase; }
17583.whisper-doc .badge-gpu { background: rgba(225, 29, 72, 0.1); border: 1px solid rgba(225, 29, 72, 0.3); color: #fda4af; }
17584.whisper-doc .badge-win { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.2); color: #a7f3d0; }
17585.whisper-doc .badge-ok { background: rgba(14, 165, 233, 0.1); border: 1px solid rgba(14, 165, 233, 0.3); color: #bae6fd; }
17586.whisper-doc .badge-warn { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #fef08a; }
17587.whisper-doc .hero { border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 1.5rem; margin-bottom: 2rem; background: #0c0d10; }
17588.whisper-doc .hero-title { font-size: 26px; font-weight: 700; color: var(--color-text-primary); line-height: 1.2; margin-bottom: 0.5rem; font-family: 'Syne', var(--font-sans); text-transform: uppercase; }
17589.whisper-doc .hero-title span { color: #E11D48; }
17590.whisper-doc .hero-sub { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 1.25rem; line-height: 1.6; font-family: var(--font-sans); }
17591.whisper-doc .hero-badges { display: flex; flex-wrap: wrap; gap: 6px; }
17592.whisper-doc .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 2rem; }
17593.whisper-doc .stat { background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 0.875rem 1rem; }
17594.whisper-doc .stat-label { font-size: 11px; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; font-family: var(--font-sans); }
17595.whisper-doc .stat-value { font-size: 20px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-mono); }
17596.whisper-doc .stat-sub { font-size: 11px; color: var(--color-text-secondary); margin-top: 2px; font-family: var(--font-sans); }
17597.whisper-doc .section { margin-bottom: 2.5rem; }
17598.whisper-doc .section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #E11D48; margin-top: 2rem; margin-bottom: 1rem; font-family: var(--font-sans); padding-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
17599.whisper-doc .step { border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; margin-bottom: 10px; overflow: hidden; background: #050506; }
17600.whisper-doc .step-header { display: flex; align-items: center; gap: 10px; padding: 0.75rem 1rem; background: #0c0d10; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
17601.whisper-doc .step-num { width: 24px; height: 24px; border-radius: 50%; background: #E11D48; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-mono); }
17602.whisper-doc .step-name { font-size: 13px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-sans); }
17603.whisper-doc .step-desc { font-size: 11px; color: var(--color-text-secondary); font-family: var(--font-sans); margin-left: auto; }
17604.whisper-doc .step-body { padding: 0.875rem 1rem; }
17605.whisper-doc .cmd { background: #050506; border: 1px solid rgba(255, 255, 255, 0.03); border-radius: 4px; padding: 0.625rem 0.875rem; font-size: 12px; color: #fff; font-family: var(--font-mono); margin-bottom: 6px; overflow-x: auto; white-space: nowrap; border-left: 3px solid #E11D48; }
17606.whisper-doc .note { font-size: 12px; color: var(--color-text-secondary); font-family: var(--font-sans); line-height: 1.6; margin-top: 4px; padding-left: 8px; border-left: 2px solid #E11D48; }
17607.whisper-doc .flag-table { width: 100%; border-collapse: collapse; font-size: 12px; }
17608.whisper-doc .flag-table th { text-align: left; padding: 8px 10px; font-weight: 700; color: var(--color-text-primary); font-family: var(--font-sans); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: #111215; }
17609.whisper-doc .flag-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-family: var(--font-mono); }
17610.whisper-doc .flag-table td:first-child { color: #fda4af; }
17611.whisper-doc .flag-table td:last-child { font-family: var(--font-sans); color: var(--color-text-secondary); }
17612.whisper-doc .flag-table tr:last-child td { border-bottom: none; }
17613.whisper-doc .perf-bar-wrap { margin: 0.5rem 0 1rem; background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); padding: 1rem; border-radius: 6px; }
17614.whisper-doc .perf-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
17615.whisper-doc .perf-row:last-child { margin-bottom: 0; }
17616.whisper-doc .perf-label { font-size: 12px; color: var(--color-text-secondary); width: 120px; flex-shrink: 0; font-family: var(--font-sans); text-align: right; }
17617.whisper-doc .perf-bar-bg { flex: 1; height: 8px; background: rgba(255, 255, 255, 0.03); border-radius: 4px; overflow: hidden; }
17618.whisper-doc .perf-bar { height: 100%; border-radius: 4px; }
17619.whisper-doc .perf-time { font-size: 12px; font-family: var(--font-mono); color: var(--color-text-primary); width: 70px; flex-shrink: 0; margin-left: 8px; }
17620.whisper-doc .lesson { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); align-items: flex-start; }
17621.whisper-doc .lesson:last-child { border-bottom: none; }
17622.whisper-doc .lesson-icon { font-size: 16px; flex-shrink: 0;
17622 margin-top: 1px; }
17623.whisper-doc .lesson-text { font-size: 12.5px; color: var(--color-text-secondary); font-family: var(--font-sans); line-height: 1.6; }
17624.whisper-doc .lesson-text strong { font-weight: 700; color: var(--color-text-primary); }
17625.whisper-doc .footer { text-align: center; font-size: 11px; color: #475569; font-family: var(--font-mono); padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, 0.05); margin-top: 2rem; }
17626.whisper-doc .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
17627@media (max-width: 600px) { .whisper-doc .two-col { grid-template-columns: 1fr; } }
17628.whisper-doc .env-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-size: 12px; }
17629.whisper-doc .env-row:last-child { border-bottom: none; }
17630.whisper-doc .env-key { color: var(--color-text-secondary); font-family: var(--font-sans); }
17631.whisper-doc .env-val { font-family: var(--font-mono); color: var(--color-text-primary); text-align: right; }
17632.whisper-doc .card-inner { background: #0c0d10; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 1rem 1.25rem; }
17633</style>
17634
17635  <div class="hero">
17636    <div class="hero-title"><span>whisper.cpp</span> + RX 580 via Vulkan</div>
17637    <div class="hero-sub">在 Windows 上通过 AMD GPU 加速进行音频/视频转录 — 使用 Vulkan 将 Whisper 模型直接运行在 RX 580 的 VRAM 中。让 2017 年的 GPU 在 2026 年继续发光发热。</div>
17638    <div class="hero-badges">
17639      <span class="badge badge-gpu">AMD RX 580 8GB</span>
17640      <span class="badge badge-win">Windows + PowerShell</span>
17641      <span class="badge badge-ok">Vulkan Backend</span>
17642      <span class="badge badge-ok">large-v3-turbo</span>
17643      <span class="badge badge-warn">FFmpeg 前置需求</span>
17644    </div>
17645  </div>
17646
17647  <div class="stat-grid">
17648    <div class="stat">
17649      <div class="stat-label">总耗时</div>
17650      <div class="stat-value">~5 分钟</div>
17651      <div class="stat-sub">针对 15 分钟视频</div>
17652    </div>
17653    <div class="stat">
17654      <div class="stat-label">VRAM 占用</div>
17655      <div class="stat-value">2.6 GB</div>
17656<div class="stat-sub">可用 8 GB 中</div>
17657    </div>
17658    <div class="stat">
17659      <div class="stat-label">对比 CPU 加速比</div>
17660      <div class="stat-value">~150×</div>
17661      <div class="stat-sub">之前: 40分钟需12小时</div>
17662    </div>
17663    <div class="stat">
17664      <div class="stat-label">模型</div>
17665      <div class="stat-value">1.6 GB</div>
17666      <div class="stat-sub">large-v3-turbo</div>
17667    </div>
17668  </div>
17669
17670  <div class="section">
17671    <div class="section-title">已验证的前置需求</div>
17672    <div class="card-inner">
17673      <div class="env-row"><span class="env-key">Vulkan SDK</span><span class="env-val">glslc v2026.1</span></div>
17674      <div class="env-row"><span class="env-key">Git</span><span class="env-val">2.54.0.windows.1</span></div>
17675      <div class="env-row"><span class="env-key">CMake</span><span class="env-val">4.3.2</span></div>
17676      <div class="env-row"><span class="env-key">MSVC (Build Tools)</span><span class="env-val">14.52.36328 — VS 2026</span></div>
17677      <div class="env-row"><span class="env-key">检测到的 GPU</span><span class="env-val">AMD Radeon RX 580 2048SP</span></div>
17678      <div class="env-row"><span class="env-key">FFmpeg</span><span class="env-val">2026-04-19 (Gyan full build)</span></div>
17679    </div>
17680    <p class="note" style="margin-top: 8px;">在 Vulkan 中验证 RX 580: <span style="font-family:var(--font-mono); color:#fda4af;">vulkaninfo --summary</span> → 应显示 AMD Radeon RX 580 2048SP</p>
17681  </div>
17682
17683  <div class="section">
17684    <div class="section-title">编译 — 分步指南</div>
17685
17686    <div class="step">
17687      <div class="step-header">
17688        <div class="step-num">1</div>
17689        <div class="step-name">激活 MSVC x64 环境</div>
17690        <div class="step-desc">每次新会话</div>
17691      </div>
17692      <div class="step-body">
17693        <div class="cmd">& "C:\\Program Files (x86)\\Microsoft Visual Studio\\18\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"</div>
17694        <p class="note">每次打开新的 PowerShell 进行编译前都需要重复此步骤。预期输出: "Environment initialized for: 'x64'"</p>
17695      </div>
17696    </div>
17697
17698    <div class="step">
17699      <div class="step-header">
17700        <div class="step-num">2</div>
17701        <div class="step-name">克隆仓库</div>
17702        <div class="step-desc">~40 MB</div>
17703      </div>
17704      <div class="step-body">
17705        <div class="cmd">cd C:\\</div>
17706        <div class="cmd">git clone https://github.com/ggml-org/whisper.cpp</div>
17707        <div class="cmd">cd whisper.cpp</div>
17708      </div>
17709    </div>
17710
17711    <div class="step">
17712      <div class="step-header">
17713        <div class="step-num">3</div>
17714        <div class="step-name">启用 Vulkan 的 CMake</div>
17715        <div class="step-desc">关键参数: -DGGML_VULKAN=ON</div>
17716      </div>
17717      <div class="step-body">
17718        <div class="cmd">cmake -B build -DGGML_VULKAN=ON -DGGML_HIPBLAS=OFF -DGGML_HIP=OFF -DGGML_CUDA=OFF</div>
17719        <div class="cmd">cmake --build build --config Release -j4</div>
17720        <p class="note">耗时 ~5-10 分钟。C4267/C4244 警告是正常的 — 不影响功能。二进制文件位于 build\\bin\\Release\\</p>
17721      </div>
17722    </div>
17723
17724    <div class="step">
17725      <div class="step-header">
17726        <div class="step-num">4</div>
17727        <div class="step-name">下载 large-v3-turbo 模型</div>
17728        <div class="step-desc">~1.6 GB</div>
17729      </div>
17730      <div class="step-body">
17731        <div class="cmd">Invoke-WebRequest -Uri "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo.bin" -OutFile "models\\ggml-large-v3-turbo.bin"</div>
17732        <p class="note">其他模型: large-v3 (~6GB VRAM, 质量更好), medium (~2.5GB), small (~1GB)</p>
17733      </div>
17734    </div>
17735  </div>
17736
17737  <div class="section">
17738    <div class="section-title">
17738使用 — mp4 → txt 完整流程</div>
17739
17740    <div class="step">
17741      <div class="step-header">
17742        <div class="step-num" style="background:#1D9E75;">1</div>
17743        <div class="step-name">使用 FFmpeg 提取音频</div>
17744        <div class="step-desc">Whisper 在 Windows 上无法直接读取 mp4</div>
17745      </div>
17746      <div class="step-body">
17747        <div class="cmd">ffmpeg -i "E:\\videos\\video.mp4" -ar 16000 -ac 1 -c:a pcm_s16le "E:\\videos\\video.wav"</div>
17748        <p class="note">-ar 16000 = 16kHz (Whisper 强制要求) · -ac 1 = 单声道 · -c:a pcm_s16le = 无损 WAV</p>
17749      </div>
17750    </div>
17751
17752    <div class="step">
17753      <div class="step-header">
17754        <div class="step-num" style="background:#1D9E75;">2</div>
17755        <div class="step-name">转录 / 翻译</div>
17756        <div class="step-desc">GPU 处理其余工作</div>
17757      </div>
17758      <div class="step-body">
17759        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --output-txt</div>
17760        <p style="font-size:12px; color:var(--color-text-secondary); margin: 6px 0 4px; font-family:var(--font-sans);">翻译为英语:</p>
17761        <div class="cmd">.\\build\\bin\\Release\\whisper-cli.exe -m models\\ggml-large-v3-turbo.bin -f "E:\\videos\\video.wav" -l pt --translate --output-txt</div>
17762        <p class="note">--translate 总是生成英语 (Whisper 的限制)。对于其他目标语言,需要额外的翻译步骤。</p>
17763      </div>
17764    </div>
17765
17766    <div style="margin-top: 1rem;">
17767      <div class="section-title" style="margin-bottom: 0.75rem;">常用参数</div>
17768      <div class="card-inner">
17769        <table class="flag-table">
17770          <thead><tr><th>参数</th><th>描述</th></tr></thead>
17771          <tbody>
17772            <tr><td>-l pt</td><td>源语言: 葡萄牙语</td></tr>
17773            <tr><td>-l en</td><td>源语言: 英语</td></tr>
17774            <tr><td>--translate</td><td>全部翻译为英语</td></tr>
17775            <tr><td>--output-txt</td><td>保存 .txt 转录文件</td></tr>
17776            <tr><td>--output-srt</td><td>保存带时间戳的 .srt 字幕</td></tr>
17777            <tr><td>--output-vtt</td><td>保存 .vtt 字幕</td></tr>
17778            <tr><td>-t 8</td><td>使用 8 个 CPU 线程 (默认: 4)</td></tr>
17779            <tr><td>--device 0</td><td>选择 GPU 0 (默认)</td></tr>
17780            <tr><td>--no-gpu</td><td>强制使用 CPU (慢速模式)</td></tr>
17781          </tbody>
17782        </table>
17783      </div>
17784    </div>
17785  </div>
17786
17787  <div class="section">
17788    <div class="section-title">性能 — 15 分钟视频</div>
17789    <div class="perf-bar-wrap">
17790      <div class="perf-row">
17791        <div class="perf-label">加载模型</div>
17792        <div class="perf-bar-bg"><div class="perf-bar" style="width:1.3%; background:#E11D48;"></div></div>
17793        <div class="perf-time">4 s</div>
17794      </div>
17795      <div class="perf-row">
17796        <div class="perf-label">mel (音频)</div>
17797        <div class="perf-bar-bg"><div class="perf-bar" style="width:0.4%; background:#E11D48;"></div></div>
17798        <div class="perf-time">1.2 s</div>
17799      </div>
17800      <div class="perf-row">
17801        <div class="perf-label">GPU 编码</div>
17802        <div class="perf-bar-bg"><div class="perf-bar" style="width:23.7%; background:#1D9E75;"></div></div>
17803        <div class="perf-time">73 s</div>
17804      </div>
17805      <div class="perf-row">
17806        <div class="perf-label">解码 + 批处理</div>
17807        <div class="perf-bar-bg"><div class="perf-bar" style="width:54.7%; background:#1D9E75;"></div></div>
17808        <div class="perf-time">168 s</div>
17809      </div>
17810      <div class="perf-row">
17811        <div class="perf-label" style="font-weight:700; color:var(--color-text-primary);">总计</div>
17812        <div class="perf-bar-bg"><div class="perf-bar" style="width:100%; background:#E11D48;"></div></div>
17813        <div class="perf-time" style="font-weight:700;">307 s</div>
17814      </div>
17815    </div>
17816    <p class="note">转录期间 CPU 占用率约为 5%。VRAM: 8 GB 中占用 2.6 GB。GPU 完成了所有工作 — CPU 处于闲置状态。</p>
17817  </div>
17818
17819  <div class="section">
17820    <div class="section-title">探索过程中的经验教训</div>
17821    <div class="card-inner">
17822      <div class="lesson">
17823        <div class="lesson-icon">⚠️</div>
17824<div class="lesson-text"><strong>WSL2 无法通过 Vulkan 暴露 RX 580</strong> — 请始终使用原生 PowerShell/Windows 以利用 GPU。</div>
17825      </div>
17826      <div class="lesson">
17827        <div class="lesson-icon">⚠️</div>
17828        <div class="lesson-text"><strong>Whisper 在 Windows 上无法读取 MP4</strong> — 务必先使用 FFmpeg 提取音频。使用 -ar 16000 -ac 1 -c:a pcm_s16le。</div>
17829      </div>
17830      <div class="lesson">
17831        <div class="lesson-icon">ℹ️</div>
17832        <div class="lesson-text"><strong>--translate 仅生成英语</strong> — 这是 Whisper 的限制,而非配置问题。若需以葡萄牙语为目标,需要额外的翻译步骤。</div>
17833      </div>
17834      <div class="lesson">
17835        <div class="lesson-icon">ℹ️</div>
17836        <div class="lesson-text"><strong>vcvars64.bat 需要重新激活</strong> — 在每次新的 PowerShell 会话中,编译前必须重新运行。</div>
17837      </div>
17838      <div class="lesson">
17839        <div class="lesson-icon">✅</div>
17840        <div class="lesson-text"><strong>2026 年 8 GB VRAM 依然强劲</strong> — large-v3-turbo 仅占用 2.6 GB。拥有充足 VRAM 的“老”GPU 轻松击败仅有 4 GB 的新 GPU。</div>
17841      </div>
17842      <div class="lesson">
17843        <div class="lesson-icon">✅</div>
17844        <div class="lesson-text"><strong>编译期间的 C4267/C4244 警告是正常的</strong> — 这是 ggml 代码中预期的类型转换,不影响功能。</div>
17845      </div>
17846    </div>
17847  </div>
17848
17849  <div class="footer">
17850    RX 580 — 虽然“年事已高”,但依然活跃 🚀 · 2026 年 6 月记录的探索历程
17851  </div>
17852
17853</div>`},benchmarks:{id:"benchmarks",title:"23. BENCHMARKS REAIS DO LABORATÓRIO",desc:"直接从两种架构的推理日志中测得的汇总遥测数据。",meta:{version:"1.0.0",type:"benchmark",category:"hardware",subcategory:"benchmarks",difficulty:"beginner",estimated_time_min:15,tags:["telemetria","gpu-benchmarks","performance-history"],last_reviewed:"2026-07-01",relationships:{prerequisites:["guia"],previous:"guia",next:"cpu",related:["hardware","cpu"]}},html:`<div class="tbl"><table>
17854    <thead><tr><th>
17854模型执行模式</th><th>分配架构</th><th>获得的商业指标</th><th>可行性状态</th></tr></thead>
17855    <tbody>
17856      <tr><td>通用文本推理</td><td>纯 Xeon CPU(无加速)</td><td>每秒 3 到 5 个 token</td><td>❌ 低效 / 响应缓慢</td></tr>
17857      <tr class="hig"><td>编译文本推理</td><td>RX 580 8GB via Vulkan Backend</td><td>每秒 15 到 16 个 token</td><td>✅ 高效生产力 / 即时响应</td></tr>
17858      <tr><td>SD 1.5 采样 (20 Steps)</td><td>ComfyUI Windows via DirectML</td><td>每张图片约 450 秒</td><td>❌ 不稳定 / 因严重错误丢弃</td></tr>
17859      <tr class="hig"><td>SD 1.5 采样 (20 Steps)</td><td>stable-diffusion.cpp via Vulkan</td><td>每张图片 72 秒</td><td>✅ 已优化 / 快速响应</td></tr>
17860    </tbody>
17861  </table></div>`},codacus:{id:"codacus",title:"33. MÉTODO CODACUS vs AIVisionsLab",desc:"拯救 GTX 1060 的 5 个标志位实验——它们在 RX 580 上有效吗?",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"advanced",estimated_time_min:25,tags:["gtx-1060","metodo-codacus","nvidia-pascal"],last_reviewed:"2026-07-01",relationships:{prerequisites:["dadhacks"],previous:"dadhacks",next:"proximos",related:["dadhacks","amihart"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">
17862  Codacus 频道发布了一段极具影响力的视频,演示了如何使用 5 个特定的 <code>llama.cpp</code> 标志位在 <strong>6GB 显存的 GTX 1060 上运行 35B 参数模型</strong>,使推理速度从基准的 3.0 tokens/s 提升至优化后的 17.0 tokens/s。AIVisionsLab 在老款 <strong>RX 580 2048SP 8GB (Vulkan)</strong> 上测试了这一假设,并对比了 Windows 和原生 Linux 环境。
17863</p>
17864
17865<div class="tbl">
17866  <table>
17867    <thead>
17868      <tr>
17869        <th>指标 / 配置</th>
17870        <th>Codacus 设置 (参考)</th>
17871        <th>AIVisionsLab 设置</th>
17872      </tr>
17873    </thead>
17874    <tbody>
17875      <tr>
17876        <td><strong>GPU</strong></td>
17877        <td>Nvidia GTX 1060 6GB</td>
17878        <td>AMD Radeon RX 580 2048SP 8GB</td>
17879      </tr>
17880      <tr>
17881        <td><strong>Backend</strong></td>
17882        <td>CUDA</td>
17883        <td>Vulkan (Mesa RADV)</td>
17884      </tr>
17885      <tr>
17886        <td><strong>OS</strong></td>
17887        <td>Linux + Docker</td>
17888        <td>Windows 10 / Ubuntu 26.04</td>
17889      </tr>
17890      <tr>
17891        <td><strong>CPU</strong></td>
17892        <td>Intel Core i3-8100</td>
17893        <td>Intel Xeon E5-2690 v3 (12c/24t)</td>
17894      </tr>
17895      <tr>
17896        <td><strong>测试模型</strong></td>
17897        <td>Qwen3.6 35B-A3B Q4_K_M</td>
17898        <td>Qwen3.6 35B-A3B Q4_K_M (相同模型)</td>
17899      </tr>
17900    </tbody>
17901  </table>
17902</div>
17903
17904<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">5 个标志位对 AMD Vulkan 的影响</h3>
17905
17906<div class="tbl">
17907  <table>
17908    <thead>
17909      <tr>
17910        <th>应用标志位</th>
17911        <th>对 GTX 1060 (CUDA) 的影响</th>
17912        <th>对 RX 580 (Vulkan Windows) 的影响</th>
17913        <th>对 RX 580 (Vulkan Linux Native) 的影响</th>
17914      </tr>
17915    </thead>
17916    <tbody>
17917      <tr>
17918        <td><strong>Baseline</strong></td>
17919        <td>3.0 tokens/s (-ngl 20)</td>
17920        <td><strong>7.62 tokens/s (-ngl 10)</strong></td>
17921        <td><strong>5.18 tokens/s (-ngl 20)</strong></td>
17922      </tr>
17923      <tr>
17924        <td><code>--override-tensor exps=CPU</code></td>
17925        <td>10.0 tokens/s (+233%)</td>
17926        <td>6.92 tokens/s (❌ -9%)</td>
17927        <td>4.62 tokens/s (❌ -11%)</td>
17928      </tr>
17929      <tr>
17930        <td><code>--no-mmap</code> (或 <code>-mmp 0</code>)</td>
17931        <td>13.5 tokens/s (+35%)</td>
17932        <td>7.44 tokens/s (❌ -2%)</td>
17933        <td>4.86 tokens/s (❌ -6%)</td>
17934      </tr>
17935      <tr>
17936        <td>KV cache 量化 (<code>-ctk/ctv</code>)</td>
17937        <td>17.0 tokens/s (+26%)</td>
17938        <td>7.58 tokens/s (❌ -1%)</td>
17939        <td><strong>5.41 tokens/s (✅ +4%)</strong></td>
17940      </tr>
17941      <tr>
17942        <td><code>--mlock</code> / 额外 ngl</td>
17943        <td>稳定性增强</td>
17944        <td>超过 ngl 10 即 OOM (❌)</td>
17945        <td>超过 ngl 20 即 OOM (❌)</td>
17946      </tr>
17947    </tbody>
17948  </table>
17949</div>
17950
17951<div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4">
17952  <h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ 技术发现分析</h4>
17953  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7">
17954    <strong>1. VRAM 分配模型:</strong> 为什么 ngl 20 在 Windows 上会 OOM 而在 Linux 上却能通过?AMD 在 Windows 上的专有驱动程序分配内存的方式更为保守,而 <strong>Linux 上的开源 Mesa RADV 驱动</strong> 允许将更多的层卸载到缓冲区中(实际层数上限为 20 层,而 Windows 上仅为 10 层)。
17955  </p>
17956  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem">
17957    <strong>2. 后端不兼容性:</strong> 使用 <code>override-tensor exps=CPU</code> 将 Mixtral/MoE 专家模型从 GPU 中隔离出来的路由方式,在 CUDA 上表现出色,这得益于 Nvidia 原生的高速 PCIe 访问。在 Vulkan 后端下,这种数据移动带来的开销会抵消处理性能的提升。
17958  </p>
17959  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7;margin-top:0.5rem">
17960    <strong>3. Xeon 处理器弥补了后端差距:</strong> 即使 VRAM 优化程度较低,AIVisionsLab 的 Xeon E5-2690 v3 (24 线程) CPU 基础è
17960®¾æ–½ä»ç¡®ä¿äº† 7.62 tokens/s 的更高原始基准——超过了 Codacus 使用 i3-8100 的 3.0 tokens/s 基准。
17961  </p>
17962</div>
17963
17964<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Mistral 7B 对比 — 纯 CPU vs Vulkan</h3>
17965<p style="font-size:.88rem;color:#94a3b8;line-height:1.9">
17966  为了展示 Vulkan 后端在 Polaris 传统硬件上的绝对原始价值:
17967</p>
17968<div class="code ok">
17969  <pre>💻 WSL2 Ubuntu (纯 CPU)  ·  24 线程  ·  1.79 tokens/s
17970🎮 Windows 10 (Vulkan GPU)  ·  12 线程  ·  18.54 tokens/s (⚡ 快 10 倍!)</pre>
17971</div>
17972<blockquote style="font-size:.82rem;color:#64748b;font-style:italic;line-height:1.8;border-left:3px solid #E11D48;padding-left:.9rem;margin-top:1rem">
17973  “Codacus 的 5 个标志位非常适合 NVIDIA + CUDA + Linux Docker 组合。在 AMD + Vulkan 生态系统中,我们自己的配方虽然不同,但极其稳健!”
17974</blockquote>`},"comfyui-directml-func":{id:"comfyui-directml-func",title:"17. FIXES DIRECTML",desc:"安装特定的开发版 wheel 以强制实现运行稳定性ã€
17974‚",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-batch-fix","memoria-virtual","crash-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml"],previous:"comfyui-directml",next:"comfyui-flux",related:["comfyui-directml","scripts"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">如果需要在 DirectML 层上进行对比测试且不希望出现启动崩溃,则需要使用 2024 å¹´ 5 月的开发版本对软件包进行强制降级:</p>
17975  <div class="code"><pre># 用于清除冲突依赖并安装稳定开发版 wheel 的命令
17976pip uninstall torch torch-directml torchaudio
17977pip install torch==2.3.1+cpu --index-url https://download.pytorch.org/whl/cpu
17978pip install torch-directml==0.2.1.dev240521 --no-deps</pre></div>`},"comfyui-directml":{id:"comfyui-directml",title:"16. DIRECTML",desc:"针对 Windows 分支测试期间发现的长期故障的详细技术说明。",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fix","windows-driver","comfyui-windows"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-wsl"],previous:"comfyui-wsl",next:"comfyui-directml-func",related:["troubleshoot-comfyui","comfyui-portable-amd"]}},html:`<div class="err"><div class="err-t">结构性故障 — CLIPTextEncode 模块不兼容</div><p>在使用 AMD 显卡的原生 DirectML 安装程序加载基础图像生成流时,控制台会中止执行并返回以下阻断性异常:</p><div class="code"><span class="code-lang">stderr</span><pre>File "comfy\\utils.py", line 245, in encode_token
17979NotImplementedError: Cannot access storage of OpaqueTensorImpl</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">工程分析:</strong> DirectML 驱动程序将内存数据封装在称为 <code>OpaqueTensorImpl</code> 的对象中。当 ComfyUI 的内部数学注意力优化函数尝试读取物理内存中这些张量的原始内容时,Microsoft 生态系统层会阻止访问,从而中断渲染流水线。</p></div>`},"comfyui-flux":{id:"comfyui-flux",title:"18. PARAMETRIZAÇÃO CRÍTICA DO FLUX.1 SCHNELL",desc:"在 CPU 上处理 SOTA 模型且不超出 RAM 限制的强制性数学配置。",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:20,tags:["flux-fp8","comfyui-workflow","vram-allocation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-directml-func"],previous:"comfyui-directml-func",next:"comfyui-modelos",related:["flux_server","comfyui-modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">在 CPU 模式下处理 16GB 的 FLUX.1 Schnell 需要固定的采样限制。偏离这些规则会导致机器因内存极度饱和而死机:</p>
17980  <div class="tbl"><table>
17981    <thead><tr><th>采样参数</th><th>强制调整值</th><th>Xeon 技术说明</th></tr></thead>
17982    <tbody>
17983      <tr class="hig"><td>Sampling Steps</td><td>4 Steps</td><td>Schnell 模型旨在仅通过 4 次迭代完成噪声收敛。</td></tr>
17984      <tr class="hig"><td>CFG Scale</td><td>1.0</td><td>高于 1.0 的值会破坏纹理保真度并扭曲张量分布。</td></tr>
17985      <tr><td>Scheduler Type</td><td>sgm_uniform</td><td>确保扩散张量的线性插值针对 AVX2 指令集进行了优化。</td></tr>
17986    </tbody>
17987  </table></div>`},"comfyui-modelos":{id:"comfyui-modelos",title:"14. GESTÃO ZERO-COPY DE MODELOS NO NVMe",desc:"通过符号链接技术统一管理大型检查点 (checkpoints) 存储,避免文件重复。",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"armazenamento",difficulty:"intermediate",estimated_time_min:15,tags:["symlink","diretorios-compartilhados","espaco-disco"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-flux"],previous:"comfyui-flux",next:"animatediff-video",related:["arquivos","modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">为了避免浪费 NVMe SSD 驱动器空间,并消除在 Windows 和 Linux (WSL2) 之间维护相同巨型副本的需要,可以创建一个直接指向跨文件系统的符号链接:</p>
17988  <div class="code"><span class="code-lang">bash</span>
17988<pre># 在 Ubuntu Linux 子系统终端内执行此代码块
17989cd ~/ComfyUI/models/checkpoints/
17990
17991# 创建虚拟锚点,映射位于 Windows E: 分区上的物理文件
17992ln -s "/mnt/e/ComfyUI_Models/checkpoints/flux1-schnell-fp8.safetensors" ./flux1-schnell-fp8.safetensors</pre></div>`},"comfyui-portable-amd":{id:"comfyui-portable-amd",title:"29. COMFYUI PORTÁTIL v0.3.48 — IMPLEMENTAÇÃO AMD",desc:"针对 Polaris 架构的特定配置及环境变量注入。",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["comfyui-portable","directml-setup","portable-workflow"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshoot-comfyui"],previous:"troubleshoot-comfyui",next:"comunidade",related:["comfyui-directml","comfyui-flux"]}},html:`<div class="card">
17993    <p style="font-size:.88rem;color:#94a3b8;line-height:1.9">对于使用专注于 Windows 上 AMD DirectML 兼容性的 ComfyUI 预编译便携包的实现,Python 解释器需要辅助才能正确识别旧版 GPU 的硬件能力:</p>
17994    <div class="code"><span class="code-lang">batch</span><pre># 插入到 run_nvidia_gpu.bat 或自定义便携脚本的顶部:
17995set HSA_OVERRIDE_GFX_VERSION=8.0.3
17996set DXVK_ASYNC=1
17997
17998.\\python_embeded\\python.exe main.py --directml</pre></div>
17999    <p style="margin-top:.5rem;font-size:.82rem;color:#64748b;line-height:1.6"><code>8.0.3</code> 标志模拟了数值库处理张量所需的编译架构 ID,以防止 RX 500 系列的 PCIe 总线挂起。</p>
18000  </div>`},"comfyui-wsl":{id:"comfyui-wsl",title:"15. COMFYUI WSL2",desc:"配置虚拟化 Linux 环境以继承 Xeon 和 ECC RAM 的计算能力。",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"virtualizacao",difficulty:"advanced",estimated_time_min:30,tags:["wsl2-linux","comfyui-wsl","direct-vulkan"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_openwebui_integration"],previous:"sd_openwebui_integration",next:"comfyui-directml",related:["comfyui-flux","linux_nativo"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1rem">为了绕过大型模型中 GPU 物理 VRAM 的限制,ComfyUI 在 Linux 子系统中实例化,并将执行严格指向处理器核心:</p>
18001  <div class="code"><span class="code-lang">bash</span><pre># 通过 Ubuntu 终端中的 Miniconda 激活隔离的虚拟环境
18002conda activate comfy_env
18003
18004# 调用主脚本并强制使用中央处理硬件
18005python main.py --cpu --listen 0.0.0.0 --port 8188</pre></div>
18006  <div class="note info" style="margin-top:.75rem">ComfyUI 节点面板将通过映射路由在 Windows 端完全可用:<strong>http://localhost:8188</strong></div>`},comunidade:{id:"comunidade",title:"30. CONTEXTO E FONTES DA COMUNIDADE",desc:"致力于保存和优化旧硬件的黑客知识库和论坛。",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"comunidade",difficulty:"beginner",estimated_time_min:10,tags:["comunidade-hacker","links-utiles","github-preservation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["comfyui-portable-amd"],previous:"comfyui-portable-amd",next:"amihart",related:["amihart","dadhacks","codacus"]}},html:'<div class="card acc"><p style="font-size:.85rem;color:#94a3b8;line-height:1.9">本实验室的逆向工程和技术可行性基于专注于从低成本组件中提取最大性能的社区记录的优化讨论:</p><ul style="padding-left:1.2rem;margin-top:.5rem;font-size:.85rem;color:#e2e8f0;line-height:2"><li>全球旧服务器工程社区:<strong style="color:var(--r)">r/X99_Lab</strong></li><li>GGUF 编译优化与押韵讨论:<strong style="color:#fff">Github: ggerganov/llama.cpp/discussions</strong></li></ul></div>'},contexto:{id:"contexto",title:"01. CONTEXTO E PROBLEMA",desc:"在 2026 年,标准的说法是明确的:RX 580 无法运行 AI。分析锁定的生态系统和通过 Vulkan 进行加速的可行性。",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:10,tags:["obsolescencia-programada","hardware-livre","preservacao-silicio"],last_reviewed:"2026-07-01",relationships:{prerequisites:[],previous:"",next:"hardware",related:["solucao","jornada"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">在 2026 年,标准的说法是明确的:<strong style="color:#fff">RX 580 无法运行 AI</strong>。可用的生态系统为:</p>
18007  <div class="tbl"><table>
18008    <thead><tr><th>
18008解决方案</th><th>RX 580 的状态</th></tr></thead>
18009    <tbody>
18010      <tr><td>CUDA (Nvidia)</td><td>❌ Nvidia 独占</td></tr>
18011      <tr><td>ROCm (AMD 官方)</td><td>❌ 在 5.x 版本中移除了对 Polaris/GCN4 的支持</td></tr>
18012      <tr><td>DirectML (Microsoft)</td><td>❌ 在成熟前被放弃 — 不稳定、缓慢</td></tr>
18013      <tr><td>OpenVINO (Intel)</td><td>❌ 与 Windows 上的 Forge 不兼容</td></tr>
18014    </tbody>
18015  </table></div>
18016  <div class="tbl" style="margin-top:.9rem"><table>
18017    <thead><tr><th>项目</th><th>状态(方案前)</th></tr></thead>
18018    <tbody>
18019      <tr><td>LLM</td><td>纯 CPU — 每次回答 25 到 40 分钟</td></tr>
18020      <tr><td>图像生成</td><td>ComfyUI 运行在 CPU 上 — 在 HDD 上每张图像 50+ 分钟</td></tr>
18021      <tr><td>RX 580</td><td>闲置,AI使用率为0%</td></tr>
18022      <tr><td>存储</td><td>缓慢的HDD(严重的I/O瓶颈)</td></tr>
18023    </tbody>
18024  </table></div>
18025  <div class="card acc" style="margin-top:1.25rem">
18026    <blockquote style="font-size:.88rem;color:#94a3b8;font-style:italic;line-height:1.9;border-left:3px solid var(--r);padding-left:.9rem">"Polaris已过时。只适合挖矿。旧版AMD无法运行AI。换卡吧。"</blockquote>
18027    <p style="margin-top:.9rem;font-size:.88rem;color:#e2e8f0;font-weight:600">这种信念是错误的。计算能力一直都在。问题在于软件,而不是硬件。</p>
18028  </div>
18029  <p style="margin-top:1.25rem;font-size:.88rem;color:#94a3b8;line-height:1.9"><code style="color:var(--r)">ggml</code>项目(<code style="color:var(--r)">llama.cpp</code>和<code style="color:var(--r)">stable-diffusion.cpp</code>的基础)使用Vulkan作为GPU后端 — 这是一种开放标准,可在任何现代GPU上运行。RX 580自2017年的原始驱动程序以来就支持Vulkan 1.x。ROCm和CUDA是不必要的。</p>
18030  <p style="margin-top:.9rem;font-size:.88rem;color:#94a3b8;line-height:1.9">对于更大的模型(例如FLUX.1 Schnell 16GB),解决方案是通过WSL2上的ComfyUI在<strong style="color:#fff">Xeon CPU + 充足的ECC RAM</strong>上运行,并在Windows中建立指向模型的符号链接 — 无需复制文件,不浪费空间。</p>`},cpu:{id:"cpu",title:"24. PARAMETRIZAÇÃO E AJUSTES DO XEON",desc:"LGA 2011-3 处理器的 BIOS 配置和 fp32 指令的结构性限制。",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"processadores",difficulty:"intermediate",estimated_time_min:18,tags:["bios-tuning","avx-optimization","intel-xeon-tuning"],last_reviewed:"2026-07-01",relationships:{prerequisites:["benchmarks"],previous:"benchmarks",next:"troubleshooting",related:["hardware","benchmarks"]}},html:'<div class="card acc"><p style="font-size:.88rem;color:#e2e8f0;font-weight:600;line-height:1.6">Haswell 微架构 Xeon 处理器 (v3) 的技术指南:</p><p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">2014 年发布的 Intel Xeon E5-2690 v3 处理器原生支持 <strong style="color:#fff">AVX2</strong> 向量指令集。但是,它缺少用于 <strong style="color:var(--r)">FP16 (半精度)</strong> 降低精度数学计算的专用硬件。</p><p style="margin-top:.5rem;font-size:.85rem;color:#94a3b8;line-height:1.9">在 Linux 上的 ComfyUI 中实例化模型加载器时,请确保将计算精度设置为 <strong style="color:#22c55e">FP32 (单精度)</strong>。如果强制在 FP16 下执行,处理器将需要通过软件模拟指令,从而使处理速度减半。</p></div>'},dadhacks:{id:"dadhacks",title:"32. MÉTODO DADHACKS — AI IMAGE GENERATION ON RX 580 USING VULKAN: A COST-EFFECTIVE SOLUTION",desc:"分析 DH (DadHacks) 在 2025 å¹´ 12 月进行的实验性整合,为旧 GPU 上的图像生成建立兼容路径。",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"metodo-historico",difficulty:"intermediate",estimated_time_min:20,tags:["dadhacks-method","estetica-baixo-custo","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["amihart"],previous:"amihart",next:"codacus",related:["amihart","codacus"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">2025å¹´12月5日,开发者 <strong style="color:#fff">DH (DadHacks)</strong> 在 <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline">dadhacks.org</a> 上发布了一份创新技术指南,证明 8GB 的 AMD RX 580 GPU 完全适用于现代 AI 生成,而无需依赖专有软件解决方案或 ROCm。</p><div class="card" style="border-left:3px solid var(--r);padding:1rem;border-radius:4px;background:rgba(255,255,255,0.01);border:1px solid var(--b);margin-bottom:1.25rem"><strong style="color:#fff;display:block;margin-bottom:.4rem">📌 技术验证结果:</strong><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">DadHacks 的研究实验性证明,通过 Vulkan 运行 Stable Diffusion 是可行的,完善了 2025 å¹´ 1 月的初步结è
18030®ºã€‚<code>stable-diffusion.cpp</code> 生态系统的逐渐成熟在 2025 年底放大了吞吐量。</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">A. 引擎编译 — stable-diffusion.cpp</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">DH 详细介绍了在 Linux 上使用原生编译器标志 <code>-DSD_VULKAN=ON</code> 的编译流程:</p><div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># 递归克隆(必须引入 ggml 子模块)
18031git clone --recursive https://github.com/leejet/stable-diffusion.cpp
18032cd stable-diffusion.cpp && mkdir build && cd build
18033
18034# 使用启用的 Vulkan 配置 CMake
18035cmake .. -DSD_VULKAN=ON
18036
18037# 构建二进制文件
18038cmake --build . --config Release</pre></div><p style="font-size:.82rem;color:#64748b;line-height:1.6;margin-bottom:1.25rem">🧬 <strong>记录的标志分歧:</strong>DadHacks 使用了 <code>-DSD_VULKAN=ON</code>(应用层),而 AIVisionsLab 认证了 <code>-DGGML_VULKAN=ON</code>(张量引擎层)。两者在实践中生成相同的高效二进制文件,但引用了 leejet 存储库演进的不同路径。</p><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. 原始生成命令 (DadHacks)</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">通过终端离线调用 Flux Schnell(4-bit 量化模型)和 Flux Dev 的原始演示,使用内存分段以节省 VRAM:</p><div class="code" style="margin-bottom:1.25rem"><span class="code-lang">bash</span><pre># 运行 Flux Schnell(4 个采样步骤)
18039sd --diffusion-model SD-Models/flux1-schnell-q4_0.gguf \\
18040   --vae SD-Models/ae.safetensors \\
18041   --clip_l SD-Models/clip_l.safetensors \\
18042   --t5xxl SD-Models/t5xxl_fp16.safetensors \\
18043   -p "a lovely beagle holding a sign says 'hello'" \\
18044   --cfg-scale 1.0 \\
18045   --sampling-method euler \\
18046   -v --steps 4 \\
18047   --clip-on-cpu</pre></div><div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin-bottom:1.25rem"><strong style="color:#ef4444;display:block;margin-bottom:.4rem">🚨 严重警告:GGUF 不兼容(AIVisionsLab 发现)</strong><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin:0">DadHacks 没有列出一种非常常见的格式不兼容:维护者 <strong>city96</strong> 发布的 GGUF 权重<em>仅</em>与 ComfyUI 兼容。要在 stable-diffusion.cpp / sd-server 中执行,必须使用维护者 <strong>leejet</strong> 官方发布的模型(例如:<code style="color:#fff">FLUX.1-schnell-gguf</code>)。</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">C. DadHacks 未涵盖的内容(AIVisionsLab 扩展了)</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">DadHacks 的原始指南专注于带有手动命令的 Linux/终端生态系统。AIVisionsLab 积极扩展了这一技术基础:</p><table style="width:100%;border-collapse:collapse;font-size:.78rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem;border:1px solid var(--b)"><thead><tr style="background:rgba(255,255,255,0.02);color:#fff;border-bottom:1px solid var(--b)"><th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">功能</th><th style="padding:.5rem;text-align:left;border-right:1px solid var(--b)">DadHacks (Linux)</th><th style="padding:.5rem;text-align:left">AIVisionsLab (原生 Windows)</th></tr></thead><tbody><tr style="border-bottom:1px solid var(--b)"><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">Windows 托管</td><td style="padding:.5rem;border-right:1px solid var(--b)">❌ 未涉及</td><td style="padding:.5rem;color:#22c55e">✅ 通过 MSVC / Cmd 可执行文件映射</td></tr><tr style="border-bottom:1px solid var(--b)"><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">图形集成</td><td style="padding:.5rem;border-right:1px solid var(--b)">❌ 仅限 CLI 终端</td><td style="padding:.5rem;color:#22c55e">✅ API 服务器 + OpenWebUI / Docker 链接</td></tr><tr style="border-bottom:1px solid var(--b)"><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">.bat 自动化</td><td style="padding:.5rem;border-right:1px solid var(--b)">❌ 手动 shell 脚本</td><td style="padding:.5rem;color:#22c55e">✅ 桌面上的自动双击脚本</td></tr><tr><td style="padding:.5rem;border-right:1px solid var(--b);font-weight:bold;color:#fff">VRAM 安全</td><td style="padding:.5rem;border-right:1px solid var(--b)">⚠️ 限于 CLI 基础</td><td style="padding:.5rem;color:#22c55e">✅ 使用 VAE Tiling 优化防止 OOM 错误</td></tr></tbody></table><div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem"><strong style="color:var(--r)">广泛的社区致谢:</strong>基于 <a href="https://dadhacks.org/2025/12/05/ai-image-generation-on-rx-580-using-vulkan-a-cost-effective-solution/" target="_blank" rel="noopener noreferrer" style="color:var(--r);text-decoration:underline;font-weight:bold">DH (DadHacks)</a> 原始出版物的文献章节,题为 <em>"AI Image Generation on RX 580 Using Vulkan"</em>。知识是自由且不断进化的。</div>`},falhas:{id:"falhas",title:"03. O QUE NÃO FUNCIONOU (O CEMITÉRIO TÉCNICO)",desc:"详细错误分析:拒绝原生 DirectML、OpenVINO 和 ROCm 的技术原因。",meta:{version:"1.0.0",type:"estudo_caso",category:"troubleshooting",subcategory:"historico",difficulty:"intermediate",estimated_time_min:15,tags:["directml-fail","rocm-amd","openvino-intel"],last_reviewed:"2026-07-01",relationships:{prerequisites:["hardware"],previous:"hardware",next:"solucao",related:["troubleshooting","comfyui-directml"]}},html:`<div class="err">
18047<div class="err-t">3.1 DirectML + 原生 Windows ComfyUI — 已放弃</div><p><strong style="color:#e2e8f0">尝试:</strong>通过 <code>torch-directml</code> 和 <code>--directml</code> 标志调用。生态系统被检测为 <code>privateuseone0</code>,但由于微软缺乏结构性更新而暴露出长期不稳定性。</p><p style="margin-top:.45rem"><strong style="color:#e2e8f0">严重错误日志:</strong></p><div class="code"><span class="code-lang">stderr</span><pre>WARNING: torch-directml barely works, is very slow, has not been updated in over 1 year and might be removed soon, please don't use it.
18048
18049OSError: [WinError 127] 找不到指定的程序
18050# 由 torchaudio 和 torch 2.4.1 CPU 构建之间的 DLL 不匹配引起
18051
18052NotImplementedError: Cannot access storage of OpaqueTensorImpl
18053# CLIPTextEncode 在尝试操作 DirectML 生成的不透明张量时崩溃</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">根本原因:</strong>DirectML 生成的不透明张量无法与 ComfyUI 现代的注意力后端通信。此外,安装程序强制在 <code>audio_vae.py</code> 模块内导入 <code>torchaudio</code>,即使不使用音频也会破坏初始化。</p></div><div class="err" style="margin-top:1rem"><div class="err-t">3.2 OpenVINO + Stable Diffusion Forge</div><p><strong style="color:#e2e8f0">尝试:</strong>将 Intel 开发的 <code>sd-webui-openvino</code> 扩展耦合到 Forge 生态系统中。</p><div class="code"><span class="code-lang">stderr</span><pre>ModuleNotFoundError: No module named 'ldm'
18054ModuleNotFoundError: No module named 'sgm'
18055Error build_unet: Invalid backend: 'openvino'</pre></div><p style="margin-top:.45rem"><strong style="color:#e2e8f0">根本原因:</strong>该扩展是为旧的 Automatic1111 架构设计的。由于 Forge 完全重构了代码并替换了原生的 <code>ldm</code> 和 <code>sgm</code> 模块,OpenVINO 后端注入完全失败。</p></div><div class="err" style="margin-top:1rem"><div class="err-t">3.3 ROCm — 在 Polaris 上设计不可行</div><ul><li>AMD 在现代 ROCm 分支 (v5.x+) 中正式结束了对 GCN4 架构 (Polaris/RX 580) 的支持。</li><li>Windows 环境下不存在对原生 ROCm 的官方支持。</li><li>通过 WSL2 为旧卡提供兼容层会在高负载推理期间不断引发内核恐慌。</li></ul></div><div class="err" style="margin-top:1rem"><div class="err-t">3.4 WebUI Forge 纯 CPU 运行 (HDD)</div><p><strong style="color:#e2e8f0">指标:</strong>启动时间 85 秒。每张简单图像 (512x512, 20 步) 的渲染时间难以忍受,约 19 分钟。HDD 瓶颈与 <code>memory_management.py</code> 的分页管理竞争,使设置无法使用。</p></div>`},"flux-vulkan":{id:"flux-vulkan",title:"25. EXPLORAÇÃO COMPLEMENTAR: FLUX VIA VULKAN",desc:"使用 C++ 中的超紧凑量化对 Flux 模型进行替代加速。",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["flux-vulkan","cpp-native-inference","amd-acceleration"],last_reviewed:"2026-07-01",relationships:{prerequisites:["troubleshooting"],previous:"troubleshooting",next:"troubleshoot-comfyui",related:["flux_server","sdxl_vulkan"]}},html:'<div class="card"><p style="font-size:.88rem;color:#94a3b8;line-height:1.9">虽然 16GB 的原生 FLUX.1 检查点需要 Xeon CPU 的强大处理能力,但通过使用与 3-bit 激进量化耦合的 <code>stable-diffusion.cpp</code> 二进制文件,直接在 RX 580 GPU 上运行推理是完全可行的:</p><div class="note info" style="margin-top:.5rem">VRAM 测试推荐权重:<strong>flux1-schnell-Q3_K_S.gguf (~5.2GB)</strong>。此变体轻松适应 Polaris 显卡 8GB 的物理限制,提供硬件加速的 SOTA 生成。</div></div>'},flux_server:{id:"flux_server",title:"11. RODAR FLUX NO SD-SERVER (GPU + CPU HÍBRIDO)",desc:"具有分段内存架构的 12B 参数 Flux 生态系统的映射与初始化。",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"advanced",estimated_time_min:30,tags:["flux-schnell","servidor-imagem","gerenciamento-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdserver"],previous:"sdserver",next:"sd_bat_automation",related:["comfyui-flux","flux-vulkan"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">Flux 需要在 VRAM 和主机 RAM 之间进行精确分段。使用 <code>--vae-on-cpu</code> 和 <code>--vae-tiling</code> 标志,我们避免了 RX 580 2048SP 上的内存溢出 (OOM) 错误。T5XXL (fp16) 和 VAE 驻留在 RAM 中;扩散模型占据 VRAM。</p><div class="tbl"><table><thead><tr><th>
18055组件</th><th>认证文件</th><th>最终分配</th><th>大小</th></tr></thead><tbody><tr><td>扩散模型</td><td><code>flux1-schnell-q4_k.gguf</code></td><td><strong>GPU (VRAM)</strong></td><td>~6.5 GB</td></tr><tr><td>VAE</td><td><code>ae.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~160 MB</td></tr><tr><td>CLIP L</td><td><code>clip_l.safetensors</code></td><td><strong>GPU (VRAM)</strong></td><td>~235 MB</td></tr><tr><td>T5XXL</td><td><code>t5xxl_fp16.safetensors</code></td><td><strong>CPU (RAM)</strong></td><td>~9.3 GB</td></tr></tbody></table></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-top:1.25rem">⚠️ <strong style="color:#fff">稳定性说明:</strong>移除 <code>--timeout</code> 标志(当前版本不支持)并添加 <code>--vae-tiling</code> 消除了 <em>DeviceMemoryAllocation</em> 错误。RAM 总使用量达到 ~9.5 GB (T5XXL fp16)。要节省 RAM,替换为 <code>t5xxl_fp8</code> 可减少至 ~5 GB。</p><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">生产命令 (iniciar.bat):</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
18056  --diffusion-model "E:\\ia_storage\\models\\Stable-diffusion\\flux1-schnell-q4_k.gguf" ^
18057  --vae "E:\\ia_storage\\models\\Stable-diffusion\\ae.safetensors" ^
18058  --clip_l "E:\\ia_storage\\models\\Stable-diffusion\\clip_l.safetensors" ^
18059  --t5xxl "E:\\ia_storage\\models\\Stable-diffusion\\t5xxl_fp16.safetensors" ^
18060  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre><div class="tbl" style="margin-top:1.25rem; margin-bottom:1.25rem"><table><thead><tr><th>步骤</th><th>实际时间</th></tr></thead><tbody><tr><td>条件化 (T5XXL)</td><td>11.49s</td></tr><tr><td>采样 — 4 步 @ 1024x1024</td><td>~838s (~14 分钟)</td></tr><tr><td>VAE 解码 — 9 块</td><td>40.45s</td></tr><tr><td><strong>每张图像总计</strong></td><td><strong>~838s (~14 分钟)</strong></td></tr></tbody></table></div><div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;"><span style="color:#22c55e; font-weight:bold">✅ 状态:服务器生产中 — 图像生成成功</span><br><span style="font-size:.8rem; color:#94a3b8">Listening on http://0.0.0.0:7860 | VRAM: 7.6/8.0 GB | RAM: ~9.5 GB | GPU: RX 580 2048SP | Temp: 66°C</span></div>`},guia:{id:"guia",title:"22. GUIA ESTRATÉGICO POR CASO DE USO",desc:"决策矩阵:何时将处理指向 GPU 或 Xeon。",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"visao-geral",difficulty:"beginner",estimated_time_min:12,tags:["decision-making","workflows","hardware-mapping"],last_reviewed:"2026-07-01",relationships:{prerequisites:["scripts"],previous:"scripts",next:"benchmarks",related:["contexto","benchmarks"]}},html:'<div class="tbl"><table><thead><tr><th>工作流目标</th><th>推荐模型</th><th>分配后端</th><th>实际生成指标</th></tr></thead><tbody><tr class="hig"><td>本地文本聊天与助手</td><td>Mistral 7B / Llama 3 8B GGUF</td><td>RX 580 GPU (Vulkan)</td><td>高性能 (15-16 tokens/s) ⚡</td></tr><tr class="hig"><td>快速图像生成 (512x512)</td><td>DreamShaper 8 (SD 1.5 GGUF)</td><td>RX 580 GPU (Vulkan)</td><td>流畅渲染 (~72 秒)</td></tr><tr><td>高分辨率和 SOTA 细节创建</td><td>FLUX.1 Schnell (16GB 权重)</td><td>Xeon CPU (WSL2)</td><td>繁重处理 (~24 分钟)</td></tr><tr><td>帧插值与视频动画</td><td>AnimateDiff Pipeline Standard</td><td>Xeon CPU (WSL2)</td><td>稳定处理 (~141 秒)</td></tr></tbody></table></div>'},hardware:{id:"hardware",title:"02. HARDWARE DO LABORATÓRIO",desc:"详细的主配置:Xeon E5-2690 v3、RX 580 8GB、32GB ECC内存以及NVMe的关键影响。",meta:{version:"1.0.0",type:"documento",category:"hardware",subcategory:"especificacoes",difficulty:"beginner",estimated_time_min:12,tags:["amd-polar","rx-580","intel-xeon","ram-ecc"],last_reviewed:"2026-07-01",relationships:{prerequisites:["contexto"],previous:"contexto",next:"falhas",related:["cpu","benchmarks"]}},html:`<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:.85rem;margin-bottom:1.25rem">
18061    <div class="stat"><div class="stat-icon">🖥️</div><div><div class="stat-lbl">GPU</div><div class="stat-val" style="font-size:.82rem">RX 580 2048SP</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">8GB GDDR5 VRAM</div></div></div>
18062    <div class="stat"><div class="stat-icon">⚙️</div><div><div class="stat-lbl">CPU</div><div class="stat-val" style="font-size:.82rem">Xeon E5-2690 v3</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">
1806212c/24t · 3.5GHz boost</div></div></div>
18063    <div class="stat"><div class="stat-icon">💾</div><div><div class="stat-lbl">RAM</div><div class="stat-val" style="font-size:.82rem">32GB DDR4 REG ECC</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Quad Channel RDIMM</div></div></div>
18064    <div class="stat"><div class="stat-icon">📀</div><div><div class="stat-lbl">存储</div><div class="stat-val" style="font-size:.82rem">NVMe E: 1TB</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">1.7–3.5 GB/s 读取</div></div></div>
18065    <div class="stat"><div class="stat-icon">🖥️</div><div><div class="stat-lbl">OS</div><div class="stat-val" style="font-size:.82rem">Windows 10 Pro</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">WSL2 Ubuntu 22.04.5</div></div></div>
18066    <div class="stat"><div class="stat-icon">🔧</div><div><div class="stat-lbl">AMD驱动</div><div class="stat-val" style="font-size:.82rem">31.0.21924.61</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Amdnolk (11/12/2025)</div></div></div>
18067  </div>
18068  <div class="tbl"><table>
18069    <thead><tr><th>组件</th><th>环境规格</th></tr></thead>
18070    <tbody>
18071      <tr><td>主板</td><td>Machinist MR9A Pro (X99芯片组, LGA 2011-3)</td></tr>
18072      <tr><td>次要存储</td><td>HDD C: (I/O瓶颈 — 模型保存在NVMe E:上)</td></tr>
18073      <tr><td>WSL2内核</td><td>6.6.87.2-microsoft-standard-WSL2</td></tr>
18074      <tr><td>Vulkan SDK</td><td>1.4.341.1</td></tr>
18075      <tr><td>CMake</td><td>4.3.2</td></tr>
18076      <tr><td>Visual Studio</td><td>2022/2026 Community (MSVC 19.50)</td></tr>
18077      <tr><td>Python (WSL2)</td><td>3.11.15</td></tr>
18078      <tr><td>PyTorch (WSL2)</td><td>2.4.1+cu121</td></tr>
18079      <tr><td>ComfyUI版本</td><td>0.19.3 (WSL2 CPU) | 0.21.0 (Windows DirectML)</td></tr>
18080    </tbody>
18081  </table></div>
18082  <div class="card" style="margin-top:.9rem">
18083    <p style="font-size:.85rem;color:#64748b;line-height:1.9"><strong style="color:#fff">RX 580 2048SP:</strong> 具有2048个着色处理器(相对于原始的2304SP)的变体。非常常见的挖矿显卡,通过Vulkan表现出色。</p>
18084    <p style="font-size:.85rem;color:#64748b;line-height:1.9;margin-top:.65rem"><strong style="color:#fff">NVMe vs HDD:</strong> 改用NVMe将LLM的加载时间从25分钟减少到4分钟。对于FLUX(16GB),加载时间从HD
18084D上的25分钟骤降至NVMe上的仅~30秒。<strong style="color:var(--r)">存储与处理能力同样关键。</strong></p>
18085    <p style="font-size:.85rem;color:#64748b;line-height:1.9;margin-top:.65rem"><strong style="color:#fff">32GB REG ECC:</strong> 在运行FLUX.1 Schnell FP8时,系统连续消耗94%的可用内存。服务器ECC内存保持绝对的稳定性,并防止在极端负载下损坏张量。</p>
18086  </div>`},jornada:{id:"jornada",title:"06. JORNADA COMPLETA — AS 5 FASES",desc:"实验室时间线:从 CPU 初始缓慢到完全掌控旧硬件。",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:10,tags:["linha-tempo","conquistas","roadmap"],last_reviewed:"2026-07-01",relationships:{prerequisites:["prereqs"],previous:"prereqs",next:"llama",related:["linhatempo","proximos"]}},html:'<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.75rem">本地生态系统的技术成功是通过 5 个进化里程碑和战略性硬件决策实现的:</p><div class="phase"><div class="phase-num">01</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">纯 CPU 运行 WebUI Forge (HDD)</span><span class="lbl lbl-b">初始基线</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">第一个功能性基础设施。启动缓慢 85 秒,渲染标记达到每张图像约 19 分钟。系统完全无法用于生产。</p></div></div><div class="phase"><div class="phase-num">02</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">通过 Vulkan 加速 LLM (RX 580)</span><span class="lbl lbl-r">技术突破</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">成功编译 llama.cpp 并启用 <code>-DGGML_VULKAN=ON</code> 标志。引擎开始原生识别 Polaris 显卡,推理速度从 3-5 t/s 跃升至 15-16 t/s。</p></div></div><div class="phase"><div class="phase-num">03</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">集中式存储迁移至 NVMe</span><span class="lbl lbl-y">决定性里程碑</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">用高速 NVMe 驱动器 (1.7–3.5 GB/s) 替换机械 HDD。语言模型加载到内存的时间从 25 分钟下降到仅 4 分钟,消除了实验室主要的 I/O 瓶颈。</p></div></div><div class="phase"><div class="phase-num">04</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">通过 Vulkan 原生运行 stable-diffusion.cpp</span><span class="lbl lbl-g">GPU 目标完成 ✅</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">在 Windows 环境下使用 100% RX 580 GPU 本地渲染的第一张图像。SD 1.5 GGUF 量化权重模型的生成周期稳定在约 72 秒。</p></div></div><div class="phase"><div class="phase-num">05</div><div class="phase-body"><div class="phase-hdr"><span class="phase-title">通过 Xeon + ECC RAM 扩展 FLUX.1 Schnell</span><span class="lbl lbl-b">容量扩展 ✅</span></div><p style="font-size:.85rem;color:#64748b;line-height:1.9">在服务器处理器上稳定运行 16GB SOTA 模型。实证表明 2014 年的企业基础设施能够稳健地处理 2026 年最先进的人工智能。</p></div></div>'},limit_qwen_35b:{id:"limit_qwen_35b",title:"41. LEVANDO AO LIMITE QWEN3.5 35B Q6_K NA RX 580 8GB VIA VULKAN",desc:"Experimento de execução híbrida extrema de um modelo de 34.66B de parâmetros na GPU Polaris e Xeon de 2014.",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:45,tags:["qwen-35b","offloading-extremo","vram-spillover"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_srt_ptbr"],previous:"audio_srt_ptbr",next:"proving_hypothesis_35b",related:["proving_hypothesis_35b","llama"]},part:1},html:`<div class="whisper-doc">
18087  <div class="hero">
18088    <div class="hero-title"><span>Leve ao Limite</span> — Qwen3.5 35B na RX 580</div>
18089    <div class="hero-sub">Experimento de execução híbrida extrema de um modelo de <strong>34,66B parâmetros</strong> na GPU de 8GB de VRAM e Xeon de 2014 via motor Vulkan.</div>
18090    <div class="hero-badges">
18091      <span class="badge badge-gpu">AMD RX 580 8GB</span>
18092      <span class="badge badge-win">Xeon E5-2690 v3</span>
18093      <span class="badge badge-ok">Vulkan Híbrido</span>
18094      <span class="badge badge-ok">34.66B parameters</span>
18095      <span class="badge badge-win">Q6_K Quantization</span>
18096    </div>
18097  </div>
18098
18099  <div class="stat-grid">
18100    <div class="stat">
18101      <div class="stat-label">Velocidade Geração</div>
18102      <div class="stat-value">5.64 tok/s</div>
18103      <div class="stat-sub">Sessão 2 (Estável)</div>
18104    </div>
18105    <div class="stat">
18106      <div class="stat-label">Prompt Eval</div>
18107      <div class="stat-value">34.13 tok/s</div>
18108      <div class="stat-sub">Tempo resposta ~107s</div>
18109    </div>
18110    <div class="stat">
18111      <div class="stat-label">Temperatura Máxima</div>
18112      <div class="stat-value">80°C</div>
18113      <div class="stat-sub">Sem Throttling (Alvo: 90°C)</div>
18114    </div>
18115    <div class="stat">
18116      <div class="stat-label">Custo Adicional</div>
18117      <div class="stat-value">R$ 0,00</div>
18118      <div class="stat-sub">Execução 100% local</div>
18119    </div>
18120  </div>
18121
18122  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.0 — Contexto e Motivação</h3>
18123  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18124    Em 15 de junho de 2026, o AIVisionsLab conduziou o experimento mais extremo da sua história: rodar um modelo de <strong>34,66 bilhões de parâmetros</strong> em modo híbrido numa GPU AMD Radeon RX 580 2048SP de 2017 com apenas 8GB de VRAM.
18125  </p>
18126  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
18127    "Se a RX 580 já roda Qwen3 4B a 35 tokens/s via Vulkan, até onde vai o limite?"
18128  </blockquote>
18129  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18130    A resposta documentada abaixo prova que o limite não é onde o mercado de hardware diz que é.
18131  </p>
18132
18133  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.1 — Hardware do Laboratório</h3>
18134  <div class="tbl">
18135    <table>
18136      <thead>
18137        <tr>
18138          <th>Componente</th>
18139          <th>Especificação</th>
18140        </tr>
18141      </thead>
18142      <tbody>
18143        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 cores / 24 threads · 3,05 GHz turbo (Lançado em 2014)</td></tr>
18144        <tr><td><strong>RAM</strong></td><td>31,8 GB DDR4 REG ECC (quad-channel)</td></tr>
18145        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (Lançado em 2017)</td></tr>
18146        <tr><td><strong>Storage 1</strong></td><td>SSD NVMe (Disco E:) — modelos GGUF (Leitura de 1.7–3.5 GB/s)</td></tr>
18147        <tr><td><strong>Storage 2</strong></td><td>HDD (Disco C: / F:) — sistema Windows + swap</td></tr>
18148        <tr><td><strong>Storage 3</strong></td><td>HDD (Disco D:) — arquivos secundários</td></tr>
18149        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — lançado em 20/05/2026</td></tr>
18150        <tr><td><strong>DirectX</strong></td><td>12 (Feature Level 12.0)</td></tr>
18151        <tr><td><strong>Barramento</strong></td><td>PCI Express 3, dispositivo 0, função 0</td></tr>
18152        <tr><td><strong>Sistema</strong></td><td>Windows 10/11 com WSL2 ativo</td></tr>
18153      </tbody>
18154    </table>
18155  </div>
18156  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
18157    *Nota histórica: O Xeon E5-2690 v3 é de 2014. A RX 580 é de 2017. O Qwen3.5 é de 2025. Hardware de datacenter de 10 anos atrás processando IA de última geração.
18158  </p>
18159
18160  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.2 — Software e Versões</h3>
18161  <div class="tbl">
18162    <table>
18163      <thead>
18164        <tr>
18165          <th>Software</th>
18166          <th>Versão / Detalhe</th>
18167        </tr>
18168      </thead>
18169      <tbody>
18170        <tr><td><strong>llama.cpp</strong></td><td>build b9049-2496f9c14</td></tr>
18171        <tr><td><strong>Compilador</strong></td><td>MSVC 14.51.36231 (Visual Studio)</td></tr>
18172        <tr><td><strong>Vulkan SDK</strong></td><td>1.4.350.0</td></tr>
18173        <tr><td><strong>OpenWebUI</strong></td><td>v0.9.6</td></tr>
18174        <tr><td><strong>SearXNG</strong></td><td>via Docker — integrado ao OpenWebUI</td></tr>
18175        <tr><td><strong>
18175Backend GPU</strong></td><td>Vulkan — <em>sem CUDA, sem ROCm, sem DirectML</em></td></tr>
18176        <tr><td><strong>Docker Desktop</strong></td><td>Ativo — containers open-webui + searxng</td></tr>
18177      </tbody>
18178    </table>
18179  </div>
18180
18181  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.3 — O Modelo: Qwen3.5-35B-A3B-Uncensored Q6_K</h3>
18182  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.1 — Especificações Técnicas</h4>
18183  <div class="tbl">
18184    <table>
18185      <thead>
18186        <tr>
18187          <th>Parâmetro</th>
18188          <th>Valor</th>
18189        </tr>
18190      </thead>
18191      <tbody>
18192        <tr><td><strong>Nome completo</strong></td><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K</td></tr>
18193        <tr><td><strong>Arquitetura</strong></td><td>qwen35moe — Mixture of Experts (MoE)</td></tr>
18194        <tr><td><strong>Parâmetros totais</strong></td><td>34,66 bilhões</td></tr>
18195        <tr><td><strong>Tamanho do arquivo</strong></td><td>26,55 GiB (6,58 bits por peso)</td></tr>
18196        <tr><td><strong>Quantização</strong></td><td>Q6_K — 432 tensores q6_K + 301 tensores f32</td></tr>
18197        <tr><td><strong>Experts totais</strong></td><td>256 experts</td></tr>
18198        <tr><td><strong>Experts ativos por token</strong></td><td>8 de 256 (apenas 3,1% ativados)</td></tr>
18199        <tr><td><strong>Contexto máximo de treino</strong></td><td>262.144 tokens</td></tr>
18200        <tr><td><strong>Vocabulário</strong></td><td>248.320 tokens (BPE, tokenizer qwen35)</td></tr>
18201        <tr><td><strong>Thinking mode padrão</strong></td><td>ATIVADO (<code>thinking = 1</code> no template Jinja2)</td></tr>
18202        <tr><td><strong>Intervalo de full attention</strong></td><td>A cada 4 layers</td></tr>
18203      </tbody>
18204    </table>
18205  </div>
18206
18207  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.3.2 — Por que MoE muda tudo</h4>
18208  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18209    Em um modelo denso de 35B, <strong>todos</strong> os 35 bilhões de parâmetros são ativados para cada token gerado. No Qwen3.5 MoE, apenas os <strong>8 experts mais relevantes</strong> de 256 são ativados — o equivalente a ~3B parâmetros ativos por token.
18210  </p>
18211  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18212    Isso explica por que um arquivo de 26GB consegue rodar numa máquina com 32GB de RAM: a maior parte dos pesos está na memória mas <strong>não é calculada simultaneamente</strong>.
18213  </p>
18214
18215  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.4 — Comando de Inicialização</h3>
18216  <div class="cmd">
18217# Sessão 1 (porta 8080 — erro corrigido depois)
18218.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
18218ort 8080
18219
18220# Sessão 2 (porta 8081 — correta)
18221.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --port 8081</div>
18222  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
18223    <strong>Nenhuma flag manual de camadas (<code>-ngl</code>).</strong> O llama.cpp fez todo o fitting automático.
18224  </p>
18225<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.5 — 自动适配:llama.cpp 如何在 1.15 秒内拆分 26GB 模型</h3>
18226  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18227    这是实验的技术核心。无需任何手动干预,llama.cpp 执行了一项优化算法,分析了可用 VRAM 并智能地在 GPU 和 RAM 之间分配了模型。
18228  </p>
18229
18230  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.1 — 初始状态(无法将完整模型加载到 GPU)</h4>
18231  <div class="cmd">
18232GPU 所需内存(完整模型): 32.961 MiB
18233可用空闲 VRAM:              7.366 MiB
18234缺口:                       26.618 MiB — GPU 无法完全容纳</div>
18235
18236  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.2 — 适配决策序列(1.15 秒)</h4>
18237  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18238    <strong>步骤 1 — 上下文缩减:</strong>
18239  </p>
18240  <div class="cmd">原始上下文: 262.144 tokens ➔ 自动缩减上下文: 4.096 tokens(节省 VRAM: 5.347 MiB)</div>
18241  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18242    <strong>步骤 2 — 将所有 MoE 专家层移至 RAM:</strong>
18243  </p>
18244  <div class="cmd">Vulkan0 包含密集残差层: 2.418 MiB(剩余 3.924 MiB 空闲 VRAM)
18245主机 RAM(映射的 MoE 专家): 25.613 MiB</div>
18246  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18247    <strong>步骤 3 — 将密集层重新分配回 GPU(从后向前):</strong>
18248  </p>
18249  <div class="cmd">41 层密集层重新分配 ➔ GPU。最终使用量: 3.048 MiB | 空闲: 4.318 MiB</div>
18250  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18251    <strong>步骤 4 — 从前向后填充并进行分段溢出:</strong>
18252  </p>
18253  <div class="cmd">结果: 41 层(36 层“溢出”)在 GPU 上
18254溢出类型: GATE(在门控层进行分段)
18255最终 GPU 使用量: 6.255 MiB | 空闲: 1.111 MiB</div>
18256
18257  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.3 — 权重的最终分布</h4>
18258  <div class="tbl">
18259    <table>
18260      <thead>
18261        <tr>
18262          <th>缓冲区位置</th>
18263          <th>存储内容</th>
18264          <th>占用大小</th>
18265        </tr>
18266      </thead>
18267      <tbody>
18268        <tr><td><strong>Vulkan0 (RX 580 8GB)</strong></td><td>41 层密集层 + 输出层</td><td><strong>5.154 MiB</strong></td></tr>
18269        <tr><td><strong>CPU_Mapped (RAM via mmap)</strong></td><td>256 个 MoE 专家</td><td><strong>26.784 MiB</strong></td></tr>
18270      </tbody>
18271    </table>
18272  </div>
18273
18274  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.4 — 在 VRAM 中分配的额外缓冲区</h4>
18275  <div class="tbl">
18276    <table>
18277      <thead>
18278        <tr>
18279          <th>缓冲区类型</th>
18280          <th>分配大小</th>
18281          <th>物理描述</th>
18282        </tr>
18283      </thead>
18284      <tbody>
18285        <tr><td><strong>KV Cache (Vulkan0)</strong></td><td>80,00 MiB</td><td>4.096 cells, 10 layers</td></tr>
18286        <tr><td><strong>RS Buffer (Vulkan0)</strong></td><td>251,25 MiB</td><td>循环: 40 layers, 4 seqs</td></tr>
18287        <tr><td><strong>Compute Buffer (Vulkan0)</strong></td><td>770,02 MiB</td><td>计算图激活期间使用</td></tr>
18288        <tr><td><strong>Host Compute Buffer</strong></td><td>16,02 MiB</td><td>系统 RAM</td></tr>
18289        <tr><td><strong>Output Buffer (Vulkan_Host)</strong></td><td>3,79 MiB</td><td>Token 输出缓冲区</td></tr>
18290      </tbody>
18291    </table>
18292  </div>
18293  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
18294    <strong>推理期间 VRAM 的有效总占用: ~6,2–7,2 GB</strong>(占 8GB 物理内存的 77–90%)。
18295  </p>
18296
18297  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">33.5.5 — 自动启用的功能</h4>
18298  <div class="cmd">
18299✅ Flash Attention (auto ➔ ENABLED)
18300✅ Fused Gated Delta Net — autoregressive
18301✅ Fused Gated Delta Net — chunked
18302✅ Prompt cache (限制: 8.192 MiB, ~89.715 MiB 已保存至磁盘)
18303✅ Thinking mode (thinking = 1)
18304✅ 4 个并行槽 (n_seq_max = 4)
18305
18306Graph nodes: 3.729 | Graph splits: 106 (bs=512 时), 74 (bs=1 时)
18307Reserve: 137–183 ms</div>
18308
18309  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.6 — 4 层内存架构</h3>
18310  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18311    这是在普通 RX 580 上使用 <strong>4 层内存同时处理</strong> 35B 模型的首个记录案例:
18312  </p>
18313  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.8rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
18314    <div>⚡ <strong style="color:#ff9e64">第 1 层 — VRAM RX 580 (8GB GDDR5):</strong> 5.154 MiB 密集层 | 访问速度: ~400 GB/s (GDDR5) | 延迟: 纳秒级</div>
18315    <div style="margin-top:0.5rem">🧠 <strong style="color:#7aa2f7">第 2 层 — RAM DDR4 ECC (32GB 系统):</strong> 26.784 MiB MoE 专家 (通过 mmap) | 访问速度: ~51 GB/s (四通道) | 延迟: 数十 ns</div>
18316    <div style="margin-top:0.5rem">💾 <strong style="color:#22c55e">第 3 层 — SSD NVMe (E: 盘):</strong> 26,55 GiB 源 .gguf 文件 | 访问速度: 1,7–3,5 GB/s | 初始加载时使用</div>
18317    <div style="margin-top:0.5rem">📁 <strong style="color:#e0af68">第 4 层 — HDD (C: 盘交换文件):</strong> 当 RAM 耗尽时启用 Windows 交换文件 (>97% 使用率) | 访问速度: ~120–180 MB/s | 推理时峰值使用率 98–100%</div>
18318  </div>
18319
18320  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.7 — 加载的上下文配置</h3>
18321  <div class="cmd">
18322n_ctx         = 4.096 tokens (由适配算法从 262.144 缩减)
18323n_batch       = 2.048
18324n_ubatch      = 512
18325n_seq_max     = 4 (并行槽)
18326flash_attn    = auto ➔ ENABLED
18327kv_unified    = true</div>
18328  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
18329    <strong>
18329关键限制记录:</strong> 4.096 tokens 的上下文是该设置的主要瓶颈。Qwen3.5 的 thinking mode(思考模式)在生成任何可见回复之前,仅自身就会消耗 3.000+ tokens,留给最终用户回复的空间不足 1.000 tokens。
18330  </p>
18331
18332  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.8 — 两次会话的基准测试确认</h3>
18333  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">生成速度</h4>
18334  <div class="tbl">
18335    <table>
18336      <thead>
18337        <tr>
18338          <th>会话</th>
18339          <th>大约时间</th>
18340          <th>提示词评估速度</th>
18341          <th>生成速度</th>
18342          <th>总 Tokens</th>
18343          <th>总耗时</th>
18344        </tr>
18345      </thead>
18346      <tbody>
18347        <tr><td><strong>会话 1</strong></td><td>~17:39</td><td><strong>34,13 tok/s</strong></td><td><strong>5,57 tok/s</strong></td><td>1.377 tok</td><td>~107 秒</td></tr>
18348        <tr><td><strong>会话 2</strong></td><td>~21:34</td><td>~40.00 tok/s</td><td><strong>5,64 tok/s</strong></td><td>2.929 tok</td><td>~533 秒</td></tr>
18349      </tbody>
18350    </table>
18351  </div>
18352  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
18353    <strong>显著的一致性:</strong> 无论会话是处于过载状态还是冷启动状态,生成速度均维持在 ~5,6 tokens/秒左右。
18354  </p>
18355<h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Registro de temperaturas registradas</h4>
18356  <div class="tbl">
18357    <table>
18358      <thead>
18359        <tr>
18360          <th>Momento do Teste</th>
18361          <th>GPU Temp (°C)</th>
18362        </tr>
18363      </thead>
18364      <tbody>
18365        <tr><td>Idle (modelo estacionado na VRAM)</td><td>33–41°C</td></tr>
18366        <tr><td>Inferência normal (sem Web Search ativo)</td><td>44–64°C</td></tr>
18367        <tr><td>Inferência carregada (com Web Search ativo)</td><td>70–75°C</td></tr>
18368        <tr><td><strong>Pico absoluto registrado</strong></td><td><strong>80°C</strong></td></tr>
18369        <tr><td>Após conclusão de resposta</td><td>71–73°C</td></tr>
18370      </tbody>
18371    </table>
18372  </div>
18373  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
18374    <strong>Temperatura de thermal throttling da RX 580:</strong> ~90°C. <strong>Margem de segurança operacional perfeitamente mantida!</strong>
18375  </p>
18376
18377  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">Utilização de recursos na inferência física</h4>
18378  <div class="tbl">
18379    <table>
18380      <thead>
18381        <tr>
18382          <th>Recurso de Hardware</th>
18383          <th>Idle</th>
18384          <th>Durante Inferência</th>
18385          <th>Pico Registrado</th>
18386        </tr>
18387      </thead>
18388      <tbody>
18389        <tr><td>VRAM dedicada</td><td>6,7 / 8,0 GB</td><td>6,8 – 7,2 / 8,0 GB</td><td>7,4 GB / 8,0 GB</td></tr>
18390        <tr><td>RAM do Sistema</td><td>~29,0 GB</td><td>30,7 – 31,1 GB</td><td>31,2 / 31,8 GB (98% utiliz.)</td></tr>
18391        <tr><td>CPU Xeon v3</td><td>3%</td><td>62 – 70%</td><td>70%</td></tr>
18392        <tr><td>GPU utilização 3D</td><td>0%</td><td>1 – 3%</td><td>3% (Carga no barramento PCIe)</td></tr>
18393        <tr><td>HDD C: (Atividade swap)</td><td>0%</td><td>13 – 42%</td><td>98 – 100% (Limiar swap)</td></tr>
18394      </tbody>
18395    </table>
18396  </div>
18397
18398  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.9 — Os 5 Testes: Histórico Completo de Engenharia</h3>
18399  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
18400    <strong>Pergunta de entrada enviada em todos os testes:</strong><br>
18401    "Explique detalhadamente como funciona o mecanismo de atenção em transformers e por que o MoE é mais eficiente que modelos densos. Responda em português."
18402  </blockquote>
18403
18404  <div style="display:flex;flex-direction:column;gap:1rem;margin-bottom:1.5rem">
18405    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
18406      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 1 — Sessão 1 · Raciocínio ON + Web Search ON + Geração Imagem ON</h5>
18407      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
18408        <strong>Resultado:</strong> ❌ Erro de protocolo (reposta não entregue) | <strong>Log do erro:</strong> <code>operator (): got exception: {"error":"code":400,"message":"Assistant response prefill is incompatible with enable_thinking."}</code>
18409      </p>
18410      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
18411        <strong>Análise:</strong> O modelo processou um pensamento por ~1 minuto recuperando 10 fontes do SearXNG, mas o OpenWebUI injetou um prefill incorreto incompatível com a flag de pensamento do Jinja2, forçando o cancelamento.
18412      </p>
18413    </div>
18414
18415    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
18416      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 2 — Sessão 2 · Raciocínio ON + Web Search ON (30 pesquisas consecutivas)</h5>
18417      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
18418        <strong>Resultado:</strong> ❌ Contexto esgotado | <strong>Log do erro:</strong> <code>stop processing: n_tokens = 3285, truncated = 1</code>
18419      </p>
18420      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
18421        <strong>Análise:</strong> As 30 pesquisas do SearXNG injetaram milhares de tokens de contexto na memória. O thinking mode tentou alocar seu próprio buffer e estourou os 4.096 limitantes do setup híbrido, forçando corte prematuro.
18422      </p>
18423    </div>
18424
18425    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
18426      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 3 — Sessão 2 · Raciocínio ON + Web Search ON (25 pesquisas, nova rodada acumulada)</h5>
18427      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
18428        <strong>Resultado:</strong> ❌ Contexto esgotado | <strong>Log do erro:</strong> <code>stop processing: n_tokens = 4095, truncated = 1</code>
18429      </p>
18430      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
18431        <strong>Análise:</strong> O OpenWebUI tentou reenviar acumulando o histórico de conversação anterior. O prompt cresceu tanto que atingiu o teto exato delimitado de hardware de 4.095 tokens no Fitting.
18432      </p>
18433    </div>
18434
18435    <div style="border:1px solid rgba(255, 69, 0, 0.1);background:rgba(3, 0, 1, 0.6);border-radius:6px;padding:1rem">
18436      <h5 style="color:#fff;font-weight:bold;font-size:0.85rem">TESTE 4 — Sessão 2 · Raciocínio ON + Web Search OFF</h5>
18437      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
18438        <strong>Resultado:</strong> ❌ Timeout do Cliente | <strong>Log do erro:</strong> <code>stop: cancel task, id_task = 6887 (truncated = 0)</code>
18439      </p>
18440      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
18441        <strong>Análise:</strong> Sem web-search o consumo térmico despencou para estáveis 51°C e uso de swap caiu. Mas o processamento de raciocínio interno demorou tempo suficiente na CPU Xeon de 2014 para que a UI disparasse seu timeout de segurança de chamadas.
18442      </p>
18443    </div>
18444
18445    <div style="border:1px solid rgba(34, 197, 94, 0.2);background:rgba(0, 3, 1, 0.6);border-radius:6px;padding:1rem">
18446      <h5 style="color:#22c55e;font-weight:bold;font-size:0.85rem">✅ TESTE 5 — Sessão 2 · Raciocínio ON + Web Search OFF + Prompt Curto (45 tokens)</h5>
18447      <p style="font-size:0.8rem;color:#c2ffd2;line-height:1.6;margin-top:0.25rem">
18448        <strong>Resultado:</strong> SUCESSO ABSOLUTO ✅ | Resposta técnica profunda entregue integralmente em português brasileiro estruturado.
18449      </p>
18450      <p style="font-size:0.8rem;color:#94a3b8;line-height:1.6;margin-top:0.25rem">
18451        <strong>Análise:</strong> Ao restringir o prompt inicial para 45 tokens e desativar barulhos complementares, o pensamento pôde rodar por 4 minutos completos sob o Xeon, realizando rascunho de equações e respondendo impecavelmente sobre Transformers (Softmax, Multiheads) e as eficiências do MoE.
18452      </p>
18453    </div>
18454  </div>
18455
18456  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.10 — Tabela Comparativa de Comportamento dos Testes</h3>
18457  <div class="tbl">
18458    <table>
18459      <thead>
18460        <tr>
18461          <th>ID</th>
18462          <th>Thinking</th>
18463          <th>Web Search</th>
18464          <th>Promo Token</th>
18465          <th>Status</th>
18466          <th>Causa Raiz Real da Falha</th>
18467        </tr>
18468      </thead>
18469      <tbody>
18470        <tr><td>1</td><td>ON</td><td>ON (10 fontes)</td><td>~936 tok</td><td>❌ Falha</td><td>Prefill de resposta incompatível with thinking=1</td></tr>
18471        <tr><td>2</td><td>ON</td><td>ON (30 pesq.)</td><td>~357 tok</td><td>❌ Falha</td><td>Esgotamento de contexto do Fitting (4.095 max)</td></tr>
18472        <tr><td>3</td><td>ON</td><td>ON (25 pesq.)</td><td>~3.385 tok</td><td>❌ Falha</td><td>Esgotamento de contexto imediato no reenvio</td></tr>
18473        <tr><td>4</td><td>ON</td><td>OFF</td><td>~350 tok</td><td>❌ Falha</td><td>Timeout nas requisições da OpenWebUI antes do output</td></tr>
18474        <tr style="background:rgba(34, 197, 94, 0.05)"><td><strong>5</strong></td><td><strong>ON</strong></td><td><strong>OFF</strong></td><td><strong>45 tok</strong></td><td><strong>✅ SUCESSO</strong></td><td><strong>Prompt enxuto coube integralmente na arquitetura de mmap</strong></td></tr>
18475      </tbody>
18476    </table>
18477  </div>
18478<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
18479    <strong>Conclusão Crítica:</strong> A RX 580 do laboratório de 2017 e o Xeon funcionaram estavelmente sem dar nenhum reset físico em todas as situações de stress. As falhas residiram estritamente na calibração lógica do software de front-end.
18480  </p>
18481
18482  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.11 — Coletas de Descobertas e Limitações Cruciais</h3>
18483  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
18484    <li><strong style="color:#fff">Incompatibilidade do Thinking com Contexto Curto:</strong> Por design de modelo, o pensamento consome cerca de 3.000 tokens e estoura rapidamente o KV Cache alocado de 4.096 se o prompt ou histórico for longo.</li>
18485    <li><strong style="color:#fff">O Fitting Automático do llama.cpp é Excepcional:</strong> Forçar o split por flags experimentais rígidas como <code>--override-tensor</code> prejudica as chamadas no Vulkan. O fitting por cálculo de grafos resolveu milimetricamente a distribuição de forma otimizada.</li>
18486    <li><strong style="color:#fff">Superaquecimento da GPU mitigado:</strong> Apenas a renderização profunda com dezenas de filtros simultâneos elevou a 80°C. Limitar a GPU para inferir frações densas mantém o chip a confortáveis 44-64°C.</li>
18487    <li><strong style="color:#fff font-weight:bold">O gargalo reside na taxa de I/O de Swap do HDD:</strong> Quando RAM estoura a 98%, a taxa cai para 5 tok/s devido ao HDD. Migrar o swap do host inteiro para unidades de estado sólido aumentará consideravelmente a velocidade de fluxo comb
18487inada.</li>
18488  </ul>
18489
18490  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.12 — Comparação Direta com Projetos de Comunidade</h3>
18491  <div class="tbl">
18492    <table>
18493      <thead>
18494        <tr>
18495          <th>Projeto / Autor</th>
18496          <th>Arquitetura Utilizada</th>
18497          <th>Modelo Testado</th>
18498          <th>Velocidade Geração</th>
18499          <th>Status de Autoria</th>
18500        </tr>
18501      </thead>
18502      <tbody>
18503        <tr><td><strong>Matheus Fertunani</strong></td><td>Linux Comercial / CPU Xeon pura (192GB RAM)</td><td>Qwen3.5 35B Q8</td><td>~7–8 tokens/s</td><td>Documentado no YouTube</td></tr>
18504        <tr><td><strong>AIVisionsLab (Nossos testes)</strong></td><td>Vulkan Híbrido (RX 580 8GB + 32GB RAM ECC)</td><td>Qwen3.5 35B Q6_K</td><td><strong>5,64 tokens/s</strong></td><td>✅ Validado e Registrado</td></tr>
18505      </tbody>
18506    </table>
18507  </div>
18508  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
18509    <strong>A grande vantagem arquitetural:</strong> O teste de CPU pura de Matheus exige hardwares profissionais de alto custo com mais de 100GB de RAM instalada. O ecossistema de Vulkan do AIVisionsLab provou-se operável em uma GPU de menos de R$ 400 em mercado secundário!
18510  </p>
18511
18512  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.13 — Configurações Recomendadas para Testes Futuros</h3>
18513  <div class="cmd">
18514# Teste 6 — Desativação explícita de thinking via servidor em versões de compilação recentes:
18515.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q6_K.gguf" --host 0.0.0.0 --p
18515ort 8081 --no-thinking
18516
18517# Teste 7 — Elevação estrita de buffers de contexto se a memória for redirecionada:
18518.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-...-Q6_K.gguf" --host 0.0.0.0 --port 8081 --ctx-size 8192
18519
18520# Teste 8 — Testar com quantizações menores como Q4_K_M (~21GB):
18521# Liberação de ~5GB adicionais na RAM host que reduz a dependência de swap no HDD e melhora consideravelmente a taxa de tok/s!</div>
18522
18523  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.14 — Lições Técnicas Consolidadas</h3>
18524  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
18525    <li><strong style="color:#fff">O silício de 2017 não é o limite:</strong> A placa de vídeo nunca crashou nos testes contínuos de estresse térmico, dezenas de vezes. O gargalo se provou uma mera calibração lógica de software.</li>
18526    <li><strong style="color:#fff">As esparsidades do MoE salvam a categoria:</strong> Sem MoE, seria impensável arrastar um modelo de 26GB de pesos ativos. O MoE faz com que apenas 3.1% dos neurônios fiquem de fato excitados por token.</li>
18527  </ul>
18528
18529  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.15 — Veredicto Geral do Laboratório</h3>
18530  <div class="tbl">
18531    <table>
18532      <thead>
18533        <tr>
18534          <th>Questão de Engenharia</th>
18535          <th>Veredicto Final</th>
18536        </tr>
18537      </thead>
18538      <tbody>
18539        <tr><td><strong>A RX 580 de 8GB suporta modelos de 35B parâmetros?</strong></td><td>✅ <strong>Sim</strong> (Em barramento híbrido mmap)</td></tr>
18540        <tr><td><strong>É prático para o dia a dia?</strong></td><td>⚠️ <strong>Não</strong> (5,6 tok/s e contexto de 4.096 tokens)</td></tr>
18541        <tr><td><strong>Vale como prova de conceito?</strong></td><td>✅ <strong>Absolutamente</strong></td></tr>
18542        <tr><td><strong>Houve throttling ou crash?</strong></td><td>✅ <strong>Zero ocorrências de instabilidade</strong></td></tr>
18543        <tr><td><strong>Temperatura máxima registrada</strong></td><td><strong>80°C</strong> (margem de segurança: ~90°C)</td></tr>
18544        <tr><td><strong>Velocidade de geração</strong></td><td><strong>~5,6 tokens/segundo</strong></td></tr>
18545        <tr><td><strong>Memória total mobilizada</strong></td><td><strong>~34 GB</strong> (VRAM + RAM + swap HDD)</td></tr>
18546      </tbody>
18547    </table>
18548  </div>
18549
18550  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.16 — Linha do Tempo do Experimento</h3>
18551  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#c0caf5;margin-bottom:1.5rem">
18552    <div>🕒 <strong>~17:39</strong> — Servidor sobe na porta 8080 (erro)</div>
18553    <div>🕒 <strong>~17:40</strong> — "Network Problem" no OpenWebUI (porta errada)</div>
18554    <div>🕒 <strong>~17:41</strong> — Servidor fechou ao trocar porta → reiniciado na 8081</div>
18555    <div>🕒 <strong>~17:42</strong> — Todas as ferramentas habilitadas no modelo (imagem, web, terminal)</div>
18556    <div>🕒 <strong>~17:43</strong> — <strong>TESTE 1</strong> inicia</div>
18557    <div>🕒 <strong>~17:44</strong> — Web search: 10 fontes recuperadas</div>
18558    <div>🕒 <strong>~17:44</strong> — Tentativa de gerar imagem → erro tratado → continua</div>
18559    <div>🕒 <strong>~17:45</strong> — "Pensado por um minuto" aparece no OpenWebUI</div>
18560    <div>🕒 <strong>~17:46</strong> — Resposta estruturada com título gerado internamente</div>
18561    <div>🕒 <strong>~17:50</strong> — Erro de protocolo (prefill + thinking) → sem entrega. Pico: 80°C</div>
18562    <div>🕒 <strong>~21:34</strong> — Sessão 2 inicia</div>
18563    <div>🕒 <strong>~21:34</strong> — <strong>TESTE 2</strong> inicia — web search ON (30 pesquisas). Contexto truncado.</div>
18564    <div>🕒 <strong>~21:48</strong>
18564 — <strong>TESTE 3</strong> automático — 25 pesquisas. Contexto truncado.</div>
18565    <div>🕒 <strong>~22:00</strong> — <strong>TESTE 4</strong> — web search OFF. Temperatura cai para 51°C. Timeout da UI.</div>
18566    <div>🕒 <strong>~23:06</strong> — <strong>TESTE 5</strong> — prompt de 45 tokens. Thinking decodificado com sucesso.</div>
18567    <div>🕒 <strong>~23:14</strong> — Resposta completa entregue em português ✅. GPU: 64°C | RAM: 96%</div>
18568  </div>
18569
18570  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.17 — Impacto para a Documentação do AIVisionsLab</h3>
18571<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18572    Este experimento adiciona ao projeto: um novo benchmark robusto de 5,6 tok/s para modelos 35B MoE híbridos, a confirmação de que o fitting automático do llama.cpp supera configurações manuais rígidas via Vulkan, a identificação clara de incompatibilidade do modo thinking com contextos inferiores a 8.192 e a descrição de uma arquitetura estendida a 4 níveis de memória.
18573  </p>
18574
18575  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">33.18 — Tags e Metadados</h3>
18576  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
18577    <div>🏷️ <strong>Tags:</strong> hybrid, moe, vulkan, rx580, large-model, thinking-mode, limits, qwen35b, benchmark, fitting-automático, 4-memory-levels, sem-throttling</div>
18578    <div style="margin-top:0.5rem">💻 <strong>Hardware:</strong> RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
18579    <div style="margin-top:0.25rem">💿 <strong>Software:</strong> llama.cpp b9049 + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
18580    <div style="margin-top:0.25rem">📅 <strong>Data:</strong> 15/06/2026</div>
18581    <div style="margin-top:0.25rem">⏱️ <strong>Sessões:</strong> 2 (17h39–18h24 e 21h34–23h14)</div>
18582    <div style="margin-top:0.25rem">📊 <strong>Testes:</strong> 5 (4 falhas de software, 1 sucesso de inferência completa)</div>
18583    <div style="margin-top:0.25rem">📈 <strong>Benchmark:</strong> 5,57–5,64 tok/s (geração) | 34,13 tok/s (prompt eval)</div>
18584    <div style="margin-top:0.25rem">🔥 <strong>Temperatura pico:</strong> 80°C</div>
18585    <div style="margin-top:0.25rem">🏆 <strong>Status final:</strong> ✅ HARDWARE APROVADO</div>
18586  </div>
18587
18588  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
18589    "O problema nunca foi o hardware.<br>
18590    Foi a combinação de thinking + web search esgotando os 4.096 tokens de contexto.<br>
18591    Com prompt curto e sem web search, o Qwen3.5-35B Q6_K responde normalmente numa RX 580 de 2017."<br>
18592    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 15/06/2026</span>
18593  </blockquote>
18594
18595  <div class="footer">
18596    Documentação gerada por Claude Sonnet 4.6 — 15/06/2026 · Baseada em logs reais, screenshots, benchmarks e observações em tempo real · Sessão 1: ~17h39–18h24 | Sessão 2: ~21h34–23h14 · 5 testes documentados · 1 bem-sucedido · Hardware de 2017 processando IA de 2025
18597  </div>
18598</div>`},linhatempo:{id:"linhatempo",title:"37. LINHA DO TEMPO COLETIVA — A EVOLUÇÃO DO RX 580 COMO PLATAFORMA DE IA",desc:"统一的历史和比较分析,记录了在三个革命性阶段(2025-2026)中突破 RX 580 障碍和过时化的过程。",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"linha-tempo",difficulty:"beginner",estimated_time_min:25,tags:["evolucion-historica","rx580-timeline","comunidade-hacker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["meta"],previous:"meta",next:"audio_rvc",related:["jornada","comunidade"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">AMD Radeon RX 580 作为实用人工智能平台的技术救援和崛起不是单一思想的产物,而是<strong>向上集体进化</strong>的结果。建立在 <code>ggml</code>
18598 生态系统共同数学基础上的三个独立项目铺平了这条道路:</p><div style="position:relative;margin:2rem 0;padding-left:1.5rem;border-left:2px solid var(--b)"><div style="margin-bottom:1.5rem;position:relative"><div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:var(--r);border:2px solid #07080a"></div><span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:var(--r);font-weight:bold">2025 年 1 月</span><h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">Amihart 方法 (Debian Linux)</h5><p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">第一个记录在案的里程碑。在 <code>llama.cpp</code> 中验证了 Vulkan 加速的 LLM,达到 24.56 t/s。然而,他宣称:<em>“Vulkan 不适用于 Stable Diffusion”</em>,由于当时软件的限制,求助于通过 Docker 使用 ROCm。</p></div><div style="margin-bottom:1.5rem;position:relative"><div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#eab308;border:2px solid #07080a"></div><span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#eab308;font-weight:bold">2025 年 12 月</span><h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">DadHacks 方法 (Linux/Debian)</h5><p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">凭经验反驳了通过 Vulkan 运行 Stable Diffusion 的不可能性。使用新发布的 <code>stable-diffusion.cpp</code> 引擎和编译器标志 <code>-DSD_VULKAN=ON</code>,通过 CPU/GPU 分段运行 Flux Schnell GGUF 生成。</p></div><div style="position:relative"><div style="position:absolute;left:-29px;top:2px;width:12px;height:12px;border-radius:50%;background:#22c55e;border:2px solid #07080a"></div><span style="font-family:'JetBrains Mono',monospace;font-size:11px;color:#22c55e;font-weight:bold">2026 季</span><h5 style="color:#fff;margin:.25rem 0;font-size:.88rem">AIVisionsLab (原生 Windows + WSL2)</h5><p style="font-size:.8rem;color:#94a3b8;line-height:1.6;margin:0">
18598生产生态系统统一。开发了通过 <code>.bat</code> 的原生自动化,将本地 Vulkan 渲染集成到用户友好的面板(通过 Docker 的 OpenWebUI),记录了 SOTA 模型的 CPU Xeon 回退,并详尽映射了 Windows 上 DirectML/ROCm 失败的原因。</p></div></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:2rem 0 .75rem 0;text-transform:uppercase">A. 每个项目回答的问题</h4><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">RX 580 技术成熟度的演变可以转化为作者回答的前提:</p><ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem"><li><strong style="color:#fff">Amihart (2025 年 1 月):</strong> <em>“在没有官方 ROCm 的情况下,是否可以在 RX 580 上快速运行 LLM?”</em> <strong style="color:var(--r)">是的</strong>,使用纯 Vulkan API 编译 llama.cpp。</li><li><strong style="color:#fff">DadHacks (2025 年 12 月):</strong> <em>“是否可以通过 Vulkan 加速在 RX 580 上生成 AI 图像?”</em> <strong style="color:var(--r)">是的</strong>,编译 stable-diffusion.cpp 并使用稳定的替代 GGUF 格式。</li><li><strong style="color:#fff">AIVisionsLab (2026):</strong> <em>“是否可以在 Windows 上将所有这些基础设施投入集成且友好的生产中?”</em> <strong style="color:var(--r)">是的</strong>,通过构建 Docker 容器网络桥接、统一自动化和智能 CPU 回退来处理 VRAM 盈余。</li></ul><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">B. 统一的主对比表</h4><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:1rem">累积能力和成就的交叉结构映射:</p><div class="tbl" style="margin-bottom:1.5rem"><table><thead><tr><th>能力</th><th>Amihart (2025)</th><th>DadHacks (2025)</th><th>AIVisionsLab (2026)</th></tr></thead><tbody><tr><td><strong>基础系统</strong></td><td>Debian Linux</td><td>Linux Debian</td><td>Windows 10 Pro + WSL2 Linux</td></tr><tr><td><strong>LLM 引擎</strong></td><td>✅ Vulkan (24.56 t/s)</td><td>✅ Vulkan (llama.cpp)</td><td>✅ Vulkan (15-16 t/s)</td></tr><tr><td><strong>SD 引擎</strong></td><td>❌ 在 Vulkan 中不可行</td><td>✅ 纯 Vulkan</td><td>✅ 纯 Vulkan (~72s SD1.5)</td></tr><tr><td><strong>Flux GGUF</strong></td><td>❌ 不存在</td><td>✅ 命令行</td><td>✅ 稳定的 GPU/CPU 混合</td></tr><tr><td><strong>图形界面</strong></td><td>❌ 仅控制台 / Docker WebUI</td><td>❌ 仅 CLI</td><td>✅ OpenWebUI + 集成 API</td></tr><tr><td><strong>自动化</strong></td><td>❌ 未开发</td><td>❌ 未开发</td><td>✅ 双击 .bat 脚本</td></tr><tr><td><strong>VRAM 稳定性</strong></td><td>❌ 物理 ROCm 限制</td><td>⚠️ 手动 CLI</td><td>✅ 集成 VAE Tiling</td></tr><tr><td><strong>大于 8GB 的模型</strong></td><td>❌ 慢性 OOM</td><td>⚠️ 基础 CPU 卸载</td><td>✅ 四通道 REG ECC 回退</td></tr><tr><td><strong>视频动画</strong></td><td>❌ 未涉及</td><td>❌ 未涉及</td><td>✅ AnimateDiff WSL2 CPU Xeon</td></tr><tr><td><strong>GGUF 检测</strong></td><td>❌ 未涉及</td><td>❌ 未涉及</td><td>✅ leejet vs city96 映射</td></tr></tbody></table></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">C. 共同技术 denominator — GGML 引擎</h4><p style="font-size:.85rem;color:#94a3b8;line-height:1.8;margin-bottom:1rem">实现旧 GPU 利用的核心压缩和执行技术是 Georgi Gerganov(<strong>ggml / llama.cpp / stable-diffusion.cpp</strong>)开发的生态系统。通过将张量操作直接移植到 C/C++ 语言并暴露原生钩子到开放的 <strong>Vulkan API</strong> 图形库,此实现允许没有现代专有驱动程序包的显卡执行原生大规模计算(绕过限制性的供应商驱动程序)。</p><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">D. 趋同哲学</h4><p style="font-size:0.85rem;color:#94a3b8;line-height:1.8">使这些研究人员自由目的永恒化的直接表现:</p><blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem"><strong>Amihart:</strong> “尽管这款 GPU 很旧,但如果我们调整执行流程,在技术上是可以将其用于 AI 的……低级优化是重用旧硬件的关键。”</blockquote><blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:.85rem"><strong>DadHacks:</strong> “此设置为现有硬件投资的技术利用提供了可行的桥梁,无需昂贵的升级或依赖臃肿的软件包。”</blockquote><blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem"><strong>AIVisionsLab:</strong> “由于驱动程序和封闭生态系统的过时而导致的退化是一个商业因素,而不是显卡的物质限制。旧硬件通过开源软件支持保持其操作效用。”</blockquote><div class="card" style="border:1px dashed rgba(255,255,255,0.08);background:rgba(255,255,255,0.01);padding:1rem;border-radius:4px;margin-top:1.25rem"><strong style="color:var(--r)">合著者署名和参考:</strong>技术时间线致力于 <strong>艾米心 (Amihart)</strong>、<strong>DH (DadHacks)</strong>、<strong>leejet</strong>、<strong>ggerganov</strong>、<strong>woodrex</strong> 以及所有专注于数字重用和硬件保护的独立开发者的累积实验努力。</div>`},linux_nativo:{id:"linux_nativo",title:"43. LINUX NATIVO — Ubuntu 26.04 LTS + RX 580 + Vulkan",desc:"AIVisionsLab — 真实 Linux 上完整 Stack 的文档",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"sistema-operacional",difficulty:"advanced",estimated_time_min:40,tags:["ubuntu-native","linux-vulkan","low-level-compilation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["audio_whisper"],previous:"audio_whisper",next:"audio_srt_ptbr",related:["comfyui-wsl","amihart"]},part:1},html:`<div class="card bg-red-950/20 border border-red-500/30 p-5 rounded-md my-6"><h4 style="color:#ef4444;font-weight:800;font-size:0.95rem;margin-bottom:0.6rem;display:flex;items-center;gap:0.4rem">🚨 事故报告 (16/06/2026):大空间灾难与 GNOME 的崩溃</h4><p style="font-size:0.82rem;color:#fca5a5;line-height:1.75;margin-bottom:0.75rem"><strong>严重状态:</strong>在专用 97GB 分区上进行极端流水线测试和大量下载重型 GGUF 模型期间,物理空间完全耗尽(swap/root 中 0 字节可用)。在尝试通过终端快速释放缓存和强制清理时,图形环境的关键依赖项被损坏。</p><ul style="padding-left:1.2rem;font-size:.8rem;color:#fbcfe8;line-height:1.8;margin-bottom:1rem"><li><strong>症状:</strong><strong>GNOME</strong> 窗口管理器完全崩溃,导致登录循环和黑屏终端,无法加载视频界面。</li><li><strong>恢复行动:</strong>物理格式化并立即从零开始重新安装裸机 Linux 系统,以进行干净重建和适当的分区调整。</li><li><strong>存在主义裁决:</strong><em>“我绝对需要学习 Linux!”</em> — AIVisionsLab 的旅程证明,掌握终端和 LVM 下的空间分配与了解 Vulkan 后端着色器同样至关重要。</li></ul></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">在原生 Linux 上直接执行的详细且经过认证的文档。没有 WSL2,没有容器仿真或 Docker Passthrough:通过开源 <strong>Mesa RADV</strong> 驱动程序在全新的 <strong>Ubuntu 26.04 LTS (Resolute Raccoon)</strong>
18598 上运行 Linux 内核 7.0 实现真实的裸机访问。</p><div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:.85rem;margin-bottom:1.25rem"><div class="stat"><div class="stat-icon">🐧</div><div><div class="stat-lbl">Linux 平台</div><div class="stat-val" style="font-size:.82rem">Ubuntu 26.04 LTS</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">内核 7.0 (Resolute)</div></div></div><div class="stat"><div class="stat-icon">🎛️</div><div><div class="stat-lbl">Vulkan 驱动程序</div><div class="stat-val" style="font-size:.82rem">Mesa RADV 26.0.3</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">Vulkan 核心版本 1.4.341</div></div></div><div class="stat"><div class="stat-icon">💽</div><div><div class="stat-lbl">分区</div><div class="stat-val" style="font-size:.82rem">Ext4 专用 97GB</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">HDD sdb6 双启动</div></div></div><div class="stat"><div class="stat-icon">📦</div><div><div class="stat-lbl">Docker 运行时</div><div class="stat-val" style="font-size:.82rem">原生 Linux 引擎</div><div style="font-size:.65rem;color:#475569;margin-top:.15rem">OpenWebUI 桥接 100%</div></div></div></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">原始对比表:Windows 10 vs 原生 Linux</h3><div class="tbl"><table><thead><tr><th>场景 / 工作负载</th><th>Windows 10 (AMD 官方)</th><th>Linux Ubuntu 26.04 (Mesa RADV)</th><th>关键赢家</th></tr></thead><tbody><tr><td><strong>LLM (Qwen3 4B GGUF) @ 99 层</strong></td><td>~15-17 tokens/s</td><td><strong>~35 tokens/s (RADV 引擎)</strong></td><td>🏆 <strong>Linux (快 2 倍)</strong></td></tr><tr><td><strong>大型 LLM (Qwen3.6 35B) @ 最大层数</strong></td><td><strong>7.62 tokens/s (最大 10 层)</strong></td><td>5.18 tokens/s (最大 20 层)</td><td>⚖️ <strong>技术平局</strong> (Linux 允许 2 倍以上层数,Windows 每层更快)</td></tr><tr><td><strong>Stable Diffusion (Dreamshaper8 - 50st)</strong></td><td><strong>~72 秒 (1.44s/it)</strong></td><td>~85 秒 (1.65s/it)</td><td>🏆 <strong>Windows (驱动稳定)</strong></td></tr><tr><td><strong>Flux Schnell (4 步, 512x512)</strong></td><td>~84 秒 (如果 1024x1024 则 OOM)</td><td><strong>~52 秒采样 (总计:95秒)</strong></td><td>🏆 <strong>Linux (更好的 VRAM 交换)</strong></td></tr><tr><td><strong>whisper.cpp (large-v3-turbo, 106秒 音频)</strong></td><td>307 秒 (VRAM 使用:2.6 GB)</td><td><strong>23.58 秒 (VRAM 使用:1.6 GB)</strong></td><td>🏆 <strong>Linux (绝对优越)</strong></td></tr></tbody></table></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">安装与双启动而不覆盖记录</h3><p style="font-size:.82rem;color:#94a3b8;line-height:1.75">1. 在 Windows 中,使用磁盘管理(压缩卷)释放空间。<br>2. 使用 <strong>Ubuntu 26.04 amd64</strong> 桌面版 ISO 准备 U 盘。<br>3. 在 Ubuntu 安装程序中,选择“与 Windows Boot Manager 共存安装”选项。安装程序将创建分区并配置 GRUB 菜单,以允许在每次重启时自动选择启动。</p><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">安装后:Polaris GPU 的裸机验证</h3><div class="code"><span class="code-lang">bash</span><pre>lspci | grep -i vga
18599# 检测到 AMD Radeon RX 580 2048SP!
18600
18601vulkaninfo --summary 2>/dev/null | grep -A5 "Devices"
18602# 应显示:GPU0: DRIVER_ID_MESA_RADV | driverInfo = Mesa 26.0.3 ✅</pre></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Ubuntu 上认证的执行命令堆栈</h3><h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">1. 通过 Vulkan 初始化 llama-server</h4><div class="code"><span class="code-lang">bash</span><pre>~/llama.cpp/build/bin/llama-server \\
18603  -m "/run/media/aivisions-lab-studio/NVMe/models/qwen3/Qwen3-4B-Q4_K_M.gguf" \\
18604  --host 0.0.0.0 --port 8081 \\
18605  -ngl 99 -t 24</pre></div><h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">2. 图像生成 (Flux Schnell) — 防止 GNOME 崩溃的秘密</h4><div class="code"><span class="code-lang">bash</span><pre>~/stable-diffusion.cpp/build/bin/sd-server \\
18606  --listen-ip 0.0.0.0 --listen-port 7860 \\
18607  --diffusion-model /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/flux1-schnell-q4_k.gguf \\
18608  --vae /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/ae.safetensors \\
18609  --clip_l /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/clip_l.safetensors \\
18610  --t5xxl /run/media/aivisions-lab-studio/NVMe/ia_storage/models/Stable-diffusion/t5xxl_fp16.safetensors \\
18611  --cfg-scale 1.0 --steps 4 --clip-on-cpu --vae-on-cpu --vae-tiling</pre></div><p style="font-size:.8rem;color:#64748b;line-height:1.6;margin-top:.35rem">💡 <strong>关键标志:</strong><code>--vae-tiling</code> 参数是严格强制的。没有它,VAE 解码会超出物理内存限制并导致 GNOME 图形环境崩溃。在 Linux 上避免对此重型模型使用 <code>--backend vulkan0</code>,因为它会产生上下文丢失的错误。</p><h4 style="color:#fff;font-size:.85rem;font-weight:600;margin-top:.85rem">3. 通过 whisper.cpp 快速转录音频</h4><div class="code"><span class="code-lang">bash</span><pre>~/whisper.cpp/build/bin/whisper-cli \\
18612  -m ~/whisper.cpp/models/ggml-large-v3-turbo.bin \\
18613  -f "/path/to/audio.wav" \\
18614  -l pt --output-txt</pre></div><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">并行运行的 Docker 服务和容器</h3><div class="tbl"><table><thead><tr><th>活动容器</th><th>基础镜像</th><th>映射端口</th><th>目的</th></tr></thead><tbody><tr><td><strong>open-webui</strong></td><td>ghcr.io/open-webui/open-webui:main</td><td>3000 -> 8080</td><td>统一的 LLM 聊天和 SD 渲染面板</td></tr><tr><td><strong>portainer</strong></td><td>portainer/portainer-ce</td><td>9000</td><td>Docker 进程和堆栈的可视化管理</td></tr><tr><td><strong>searxng</strong></td><td>searxng/searxng:latest</td><td>8080</td><td>用于锚定 AI 响应的私有搜索引擎</td></tr></tbody></table></div><div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4"><h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ 在 Linux 上学到的自主经验</h4><p style="font-size:0.8rem;color:#94a3b8;line-height:1.7"><strong>放弃 ROCm:</strong>像 RX 580 这样的 GCN4 / Polaris 显卡在官方 ROCm SDK 中不再受支持。尝试通过 GPU Docker 运行官方 Ollama 会失败。黄金路线是在 <strong>Xeon CPU 上运行 Ollama</strong> 或使用<strong>使用 Vulkan 编译的原生 llama-server</strong>!Docker 只能用于前端和空闲的辅助服务器。</p></div>
18615</div>
18616
18617<h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:1.5rem;margin-bottom:.5rem">Serviços e Contêineres Docker Rodando Paralelos</h3>
18618<div class="tbl">
18619  <table>
18620    <thead>
18621      <tr>
18622        <th>Contêiner ativo</th>
18623        <th>Imagem Base</th>
18624        <th>Porta Mapeada</th>
18625        <th>Finalidade</th>
18626      </tr>
18627    </thead>
18628    <tbody>
18629      <tr>
18630        <td><strong>open-webui</strong></td>
18631        <td>ghcr.io/open-webui/open-webui:main</td>
18632        <td>3000 -> 8080</td>
18633        <td>Painel unificado de Chat com LLM e render SD</td>
18634      </tr>
18635      <tr>
18636        <td><strong>portainer</strong></td>
18637        <td>portainer/portainer-ce</td>
18638        <td>9000</td>
18639        <td>Gerenciamento visual de processos e pilhas Docker</td>
18640      </tr>
18641      <tr>
18642        <td><strong>searxng</strong></td>
18643        <td>searxng/searxng:latest</td>
18644        <td>8080</td>
18645        <td>Mecanismo de busca privado para as respostas ancoradas de IA</td>
18646      </tr>
18647    </tbody>
18648  </table>
18649</div>
18650
18651<div class="card bg-black/40 border border-white/5 p-4 rounded-md my-4">
18652  <h4 style="color:#fff;font-weight:700;font-size:0.9rem;margin-bottom:0.5rem">⚠️ Lições Autônomas Aprendidas em Linux</h4>
18653  <p style="font-size:0.8rem;color:#94a3b8;line-height:1.7">
18654    <strong>ROCm Abandonado:</strong> Placas GCN4 / Polaris como a RX 580 não têm mais suporte no SDK ROCm oficial. Tentar rodar Ollama oficial via GPU Docker nela falhará. A rota de ouro é rodar o <strong>Ollama na CPU Xeon</strong> ou usar o <strong>llama-server nativo compilado com Vulkan</strong>! Docker só deve ser empregado para frontends e servidores secundários livres.
18655  </p>
18656</div>`},llama:{id:"llama",title:"07. COMPILAÇÃO DO LLAMA.CPP (BACKEND VULKAN)",desc:"为 RX 580 生成优化 LLM 二进制文件的主控命令分步指南。",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["llamacpp","vulkan-acceleration","compilacao-cpp"],last_reviewed:"2026-07-01",relationships:{prerequisites:["jornada"],previous:"jornada",next:"sdcpp",related:["modelos","limit_qwen_35b"]}},html:`<div class="note">⚠ 确保仅在 <strong>Visual Studio 的 Developer PowerShell</strong> 中执行以下命令</div><div class="code"><pre># 导航到高速分区并克隆官方仓库
18657cd E:\\
18658git clone https://github.com/ggerganov/llama.cpp
18659cd llama.cpp
18660
18661# 实例化构建目录,注入 Vulkan 后端编译标志
18662cmake -B build -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
18663
18664# 使用 Xeon 处理器的 20 个并行线程触发编译
18665cmake --build build --config Release -j20</pre></div><h4 class="s" style="margin-top:1rem;margin-bottom:.5rem;color:#fff">加速设备验证命令</h4><div class="code"><pre>cd build\\bin\\Release
18666.\\llama-cli.exe --list-devices
18667# 预期控制台返回:Vulkan0: AMD Radeon RX 580 2048SP ✅</pre></div>`},meta:{id:"meta",title:"36. REFERÊNCIAS E METADADOS DO DOCUMENTO",desc:"旧硬件物理生命周期的技术分析以及实验室的再利用哲学。",meta:{version:"1.0.0",type:"documento",category:"comunidade",subcategory:"metadados",difficulty:"beginner",estimated_time_min:10,tags:["silicon-governance","metadata-specs","efficiency-telemetry"],last_reviewed:"2026-07-01",relationships:{prerequisites:["arquivos"],previous:"arquivos",next:"linhatempo",related:["arquivos","proximos"]}},html:'<blockquote style="font-size:.9rem;color:#94a3b8;font-style:italic;line-height:1.9;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">"商业计划性淘汰是市场的选择,而不是工程的障碍。旧硬件不会消亡;它被正确的软件所解放。"</blockquote><div class="tbl" style="margin-top:.9rem"><table><thead><tr><th>系统元数据</th><th>审计记录</th></tr></thead><tbody><tr><td>部署版本</td><td>VULKAN_DEPLOY_V3.0_COMPLETO</td></tr><tr><td>记录年份</td><td>合并历史 // 2026 季</td></tr><tr><td>创作范围</td><td>Black Tuxedo AI Solutions 系统架构</td></tr></tbody></table></div>'},modelos:{id:"modelos",title:"09. CONVERSÃO DE MODELOS PARA FORMATO GGUF",desc:"将标准 .safetensors 文件优化并量化为 ggml 引擎接受的格式。",meta:{version:"1.0.0",type:"documento",category:"modelagem",subcategory:"quantizacao",difficulty:"intermediate",estimated_time_min:15,tags:["gguf","quantizacao-modelos","vram-8gb"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sdcpp"],previous:"sdcpp",next:"sdserver",related:["llama","comfyui-modelos"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.9rem"><code>stable-diffusion.cpp</code> 的优化 C++ 运行时要求使用 <code style="color:var(--r)">.gguf</code> 结构化文件格式。从 Civitai 下载的传统模型 (.safetensors) 需要通过原生转换器:</p><div class="code"><pre># 直接转换并应用稳定 8-bit 量化 (q8_0) 的命令
18668.\\sd-cli.exe -M convert -m "E:\\models\\DreamShaper_8.safetensors" -o "E:\\models\\dreamshaper8.gguf" --type q8_0</pre></div><div class="code ok" style="margin-top:.75rem"><pre># 进程结束日志:
18669[INFO] convert 'DreamShaper_8.safetensors' to 'dreamshaper8.gguf' success ✅</pre></div>`},prereqs:{id:"prereqs",title:"05. PRÉ-REQUISITOS DO SISTEMA",desc:"编译开放二进制文件并启动本地服务器所需的工具链。",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"dependencias",difficulty:"intermediate",estimated_time_min:20,tags:["cmake","git","msvc-compiler","gcc","vulkan-sdk"],last_reviewed:"2026-07-01",relationships:{prerequisites:["solucao"],previous:"solucao",next:"jornada",related:["llama","sdcpp"]}},html:`<div class="c2"><div class="card"><p style="font-size:.58rem;color:var(--r);text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">⚠ 编译环境 (GPU)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">VS Developer PowerShell</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">通过开始菜单打开 → "Developer PowerShell for VS 2022"</p></div><div class="card"><p style="font-size:.58rem;color:#22c55e;text-transform:uppercase;letter-spacing:.15em;margin-bottom:.45rem;font-weight:700">✅ 执行环境 (运行时)</p><p style="font-size:.85rem;color:#e2e8f0;font-weight:600">Windows 标准 PowerShell</p><p style="font-size:.72rem;color:#475569;margin-top:.2rem">运行最终编译的二进制文件,无需开发生态系统的开销</p></div></div><div class="tbl" style="margin-top:1rem"><table><thead><tr><th>
18669软件 / SDK</th><th>认证版本</th><th>基本配置说明</th></tr></thead><tbody><tr><td>Visual Studio Community</td><td>2022 或 2026</td><td>必须勾选工作负载:“使用 C++ 的桌面开发”</td></tr><tr><td>CMake Compiler</td><td>v4.3.2+</td><td>可在 cmake.org 获取。记得勾选:“Add CMake to system PATH”</td></tr><tr><td>Vulkan SDK</td><td>v1.4.341.1</td><td>通过 LunarG 下载。必须标准安装到 <code>C:\\VulkanSDK\\</code></td></tr><tr><td>Git Windows</td><td>最新稳定版</td><td>用于克隆开源仓库的官方安装程序</td></tr><tr><td>Docker Desktop</td><td>v4.x+</td><td>运行 OpenWebUI 生态系统和辅助流水线(如 SearXNG)所需</td></tr><tr><td>WSL2 Subsystem</td><td>Ubuntu 22.04.5 LTS</td><td>ComfyUI 和 Ollama Python 环境的稳定执行基础</td></tr><tr><td>Miniconda Linux</td><td>Python 3.11 分支</td><td>在 WSL2 Linux 子系统中运行的隔离包管理器</td></tr></tbody></table></div><div class="code"><pre># 编译环境验证命令
18670cmake --version
18671# 预期返回:cmake version 4.3.2 ✅
18672
18673dir C:\\VulkanSDK
18674# 预期返回:显示 1.4.341.1 版本的目录 ✅</pre></div>`},proving_hypothesis_35b:{id:"proving_hypothesis_35b",title:"42. PROVANDO A HIPÓTESE: CURL, CTX-SIZE 8192 E A PRIMEIRA RESPOSTA COMPLETA",desc:"Continuação direta da Seção 33 · 3 testes · Hipótese confirmada · Hardware de 2017",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:35,tags:["context-length","offloading-layer","matematica-tensores"],last_reviewed:"2026-07-01",relationships:{prerequisites:["limit_qwen_35b"],previous:"limit_qwen_35b",next:"sdxl_vulkan",related:["limit_qwen_35b","cpu"]},part:1},html:`<div class="whisper-doc">
18675  <div class="hero">
18676    <div class="hero-title"><span>Provando a Hipótese</span> — Qwen3.5 35B</div>
18677    <div class="hero-sub">Experimentos conclusivos validando preenchimento de contexto, timeouts de cliente e comparação Q4_K_M vs Q6_K no silício de 2017.</div>
18678    <div class="hero-badges">
18679      <span class="badge badge-gpu">AMD RX 580 8GB</span>
18680      <span class="badge badge-win">Xeon E5-2690 v3</span>
18681      <span class="badge badge-ok">Hipótese Provada</span>
18682      <span class="badge badge-ok">--ctx-size 8192</span>
18683      <span class="badge badge-win">Q4_K_M vs Q6_K</span>
18684    </div>
18685  </div>
18686
18687  <div class="stat-grid">
18688    <div class="stat">
18689      <div class="stat-label">Velocidade (Q4_K_M)</div>
18690      <div class="stat-value">6.42 - 6.65 tok/s</div>
18691      <div class="stat-sub">Sem Swap Ativo</div>
18692    </div>
18693    <div class="stat">
18694      <div class="stat-label">Contexto Provado</div>
18695      <div class="stat-value">8.192 tokens</div>
18696      <div class="stat-sub">Acomoda modo de Raciocínio</div>
18697    </div>
18698    <div class="stat">
18699      <div class="stat-label">Temperatura Máxima</div>
18700      <div class="stat-value">74°C</div>
18701      <div class="stat-sub">10°C mais frio com Q4_K_M</div>
18702    </div>
18703    <div class="stat">
18704      <div class="stat-label">Status do Hardware</div>
18705      <div class="stat-value">100% Aprovado</div>
18706      <div class="stat-sub">Zero crashes / 4 slots paralelos</div>
18707    </div>
18708  </div>
18709
18710  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.0 — Contexto e Motivação</h3>
18711  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18712    A Seção 33 terminou com uma hipótese clara: <em>"O problema nunca foi o hardware. Foi a combinação de thinking + web search esgotando os 4.096 tokens de contexto. Com prompt curto e sem web search, o Qwen3.5-35B Q6_K responde normalmente numa RX 580 de 2017."</em>
18713  </p>
18714  <blockquote style="font-size:.82rem;color:#94a3b8;font-style:italic;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1.25rem">
18715    Em 16 de junho de 2026, o AIVisionsLab executou os testes pendentes sugeridos para provar essa hipótese ao vivo, avaliando o comportamento com curl direto (sem timeout do cliente), habilitando a flag de tamanho de contexto ampliado e testando quantizações mais eficientes.
18716  </blockquote>
18717
18718  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.1 — Hardware do Laboratório</h3>
18719  <div class="tbl">
18720    <table>
18721      <thead>
18722        <tr>
18723          <th>Componente</th>
18724          <th>Especificação</th>
18725        </tr>
18726      </thead>
18727      <tbody>
18728        <tr><td><strong>CPU</strong></td><td>Intel Xeon E5-2690 v3 — 12 cores / 24 threads · 3,05 GHz turbo (Lançado em 2014)</td></tr>
18729        <tr><td><strong>RAM</strong></td><td>
1872931,8 GB DDR4 REG ECC (quad-channel)</td></tr>
18730        <tr><td><strong>GPU</strong></td><td>AMD Radeon RX 580 2048SP — 8 GB GDDR5 (Lançado em 2017)</td></tr>
18731        <tr><td><strong>Storage NVMe</strong></td><td>SSD NVMe (Disco E:) — modelos GGUF (Leitura de 1.7–3.5 GB/s)</td></tr>
18732        <tr><td><strong>Storage HDD</strong></td><td>HDD (Disco C: / F:) — sistema Windows + swap</td></tr>
18733        <tr><td><strong>Driver AMD</strong></td><td>31.0.21925.1001 — lançado em 20/05/2026</td></tr>
18734        <tr><td><strong>Sistema</strong></td><td>Windows 10 Pro com WSL2 activo</td></tr>
18735      </tbody>
18736    </table>
18737  </div>
18738
18739  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.2 — Modelos Testados</h3>
18740  <div class="tbl">
18741    <table>
18742      <thead>
18743        <tr>
18744          <th>Modelo</th>
18745          <th>Quantização</th>
18746          <th>Tamanho do Arquivo</th>
18747          <th>Parâmetros da Arquitetura</th>
18748        </tr>
18749      </thead>
18750      <tbody>
18751        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q6_K</strong></td><td>6 bits</td><td>28,51 GB</td><td>34,66B (MoE)</td></tr>
18752        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M</strong></td><td>4 bits (Medium)</td><td><strong>21,17 GB</strong></td><td>34,66B (MoE)</td></tr>
18753        <tr><td>Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-<strong>Q5_K_M</strong></td><td>5 bits (Medium)</td><td>24,76 GB</td><td>34,66B (MoE)</td></tr>
18754      </tbody>
18755    </table>
18756  </div>
18757  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
18758    *Nota: Todos os modelos possuem arquitetura idêntica de Mixture of Experts (MoE), variando apenas a compressão matemática de seus pesos.
18759  </p>
18760
18761  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.3 — Localizando os Executáveis</h3>
18762  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18763    Antes de testar, foi necessário localizar as compilações otimizadas do <code>llama-server</code>. No PowerShell do laboratório:
18764  </p>
18765  <div class="cmd">Get-ChildItem -Path E:\\ -Recurse -Filter "llama-server.exe" -ErrorAction SilentlyContinue
18766 
18767# Resultado:
18768E:\\llama.cpp\\llama-server.exe (stub de 9KB)
18769E:\\llama.cpp\\build\\bin\\Release\\llama-server.exe (Executável real de 7.5MB) ◀</div>
18770
18771  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.4 — Teste 9: Curl Direto Sem Timeout</h3>
18772  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.1 — Motivação</h4>
18773  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18774    Identificar se o gargalo de timeout relatado no Teste 4 residia no servidor ou estritamente nas requisições AJAX do cliente OpenWebUI.
18775  </p>
18776
18777  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.2 — Inicialização do Servidor</h4>
18778  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
18779.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --p
18779ort 8081</div>
18780
18781  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.3 — Resolvendo Escaping de JSON no PowerShell</h4>
18782  <div class="cmd">'{"model":"any","messages":[{"role":"user","content":"Explique MoE em 3 paragrafos"}]}' | Out-File -Encoding utf8 -FilePath "E:\\teste.json"</div>
18783
18784  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.4 — Executando a Chamada de Longa Duração</h4>
18785  <div class="cmd">curl.exe -X POST http://localhost:8081/v1/chat/completions -H "Content-Type: application/json" --max-time 600 -d "@E:\\teste.json"</div>
18786
18787  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.4.5 — Resultado Analítico</h4>
18788  <div class="cmd">truncated = 0  ◀ RESPOSTA COMPLETA ENTREGUE COM SUCESSO
18789total time = 266.42 s / 1955 tokens
18790eval time  = 255.97 s / 1683 tokens @ 6.57 t/s</div>
18791  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-top:0.5rem">
18792    <strong>Veredicto técnico:</strong> O hardware de 2017 processou e entregou a resposta perfeitamente! O problema anterior era o tempo limite do navegador desistindo da conexão TCP, enquanto o servidor continuava gerando em background.
18793  </p>
18794
18795  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.5 — Paralelismo Real: 4 Slots de Computação</h3>
18796  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18797    Durante o Teste 9, o OpenWebUI foi conectado paralelamente disparando a mesma pergunta. O motor de agendamento do llama.cpp processou de forma concorrente sem travamentos:
18798  </p>
18799  <div class="cmd">Task 0 (curl)      — n_decoded = 1125, tg = 5.96 t/s
18800Task 875 (OpenWebUI) — n_decoded = 243,  tg = 5.08 t/s</div>
18801<p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18802    A arquitetura resistiu de forma estável (GPU: 63°C, VRAM: 7.1/8.0 GB, RAM: 91% de uso de sistema total seguro, sem travar o Windows).
18803  </p>
18804
18805  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.6 — Teste 7: Habilitando Contexto Extremo (--ctx-size 8192)</h3>
18806  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.1 — O Comando Otimizado</h4>
18807  <div class="cmd">cd E:\\llama.cpp\\build\\bin\\Release
18808.\\llama-server.exe -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" --host 0.0.0.0 --p
18808ort 8081 --ctx-size 8192</div>
18809
18810  <h4 style="color:#fff;font-weight:600;font-size:0.9rem;margin-top:1rem;margin-bottom:0.5rem">34.6.2 — Prompt de Teste e Comportamento do Thinking</h4>
18811  <blockquote style="font-size:.82rem;color:#94a3b8;line-height:1.7;border-left:3px solid var(--r);padding-left:.9rem;margin-bottom:1rem">
18812    "Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."
18813  </blockquote>
18814  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18815    Ao receber o prompt, o processador de pensamento rodou por longos 9 minutos em background na CPU trabalhando com o contexto de 8192 tokens. A análise interna destrinchou a matemática da VRAM (calculou que 35B em INT4 exige 17,5GB de peso puro) para desvendar as complexidades de esparsidade de ativação.
18816  </p>
18817
18818  <h4 style="color:rgba(225,29,72,0.9);font-weight:700;font-size:0.95rem;margin-top:2rem;margin-bottom:0.5rem">34.6.2-A — O Raciocínio Interno do Modelo: Análise Comparativa dos Três Thinking Blocks</h4>
18819  <p style="font-size:0.85rem;color:#94a3b8;line-height:1.75;margin-bottom:1rem">
18820    Durante as exaustivas sessões de ensaio das Seções 33 e 34, o Qwen3.5-35B gerou três blocos independentes de raciocínio de bastidores (<code>&lt;think&gt;</code>) que foram capturados via interceptação direta de pacotes brutos. A tabulação e o mapeamento sistemático dessas sessões fornecem evidências fundamentais de análise cognitiva do modelo:
18821  </p>
18822
18823  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">1. Thinking Block 1 — Quantização Q6_K — Sessão 1 (23:06 de 15/06)</h5>
18824  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
18825    <strong>Prompt:</strong> <em>"Explique detalhadamente o mecanismo de atenção nos Transformers e por que MoE é mais eficiente que modelos densos."</em><br>
18826    <strong>Tempo de Raciocínio:</strong> ~4 minutos | <strong>Tokens do Bloco:</strong> ~2.000 | <strong>Status:</strong> ✅ Concluído com Sucesso.
18827  </p>
18828  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
18829    <span style="color:#e11d48">// Linha de Pensamento do Qwen3.5 (Q6_K):</span><br>
18830    - Deconstruct query into structured chunks: Attention math, Multi-head, MoE, benefits vs dense.<br>
18831    - Detail Attention: Focus on Scaled Dot-Product mathematical formulation (Q, K, V). Show why division by sqrt(d_k) is required to prevent vanishing gradients during Softmax.<br>
18832    - Explain Multi-Head as parallel subspace projections (capturing both strict syntactic dependencies and semantic references).<br>
18833    - Deconstruct MoE: Discuss role of Router/Gating network, Routing sparsity (top-k selection), and load balancing to prevent routing collapse (unused experts).<br>
18834    - <span style="color:#a3e635">[Autocorreção Interna]</span>: "Wait, I must check if MoE is always faster. I should explicitly note that MoE is memory-intensive for routing/loading but highly sparse computationally. If memory bandwidth is bottlenecked under dual-system offloading, token generation speed depends strongly on mmap performance."
18835  </div>
18836
18837  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">2. Thinking Block 2 — Quantização Q4_K_M — Sessão 2 (05:05 de 16/06)</h5>
18838  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
18839    <strong>Prompt:</strong> <em>"Qual a diferença entre MoE e modelo denso, e por que MoE permite rodar 35B numa GPU de 8GB?"</em><br>
18840    <strong>Tempo de Raciocínio:</strong> ~11 minutos | <strong>Tokens do Bloco:</strong> ~3.500 | <strong>Status:</strong> ❌ Interrompido por esgotamento de contexto (Límite 4096).
18841  </p>
18842  <div style="background:#090a0f;border:1px solid rgba(225,29,72,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a9b1d6;margin-bottom:1rem">
18843    <span style="color:#e11d48">// Linha de Pensamento do Qwen3.5 (Q4_K_M):</span><br>
18844    - Analysis of premise: Running 35 billion parameter model in 8GB VRAM.<br>
18845    - <span style="color:#f43f5e">
18845[Cálculo Físico Espontâneo]</span>:<br>
18846      * FP32 weights: 35B * 4 bytes = 140 GB. Impossible.<br>
18847      * FP16 weights: 35B * 2 bytes = 70 GB. Impossible.<br>
18848      * INT8 quant:  35B * 1 byte = 35 GB. Impossible.<br>
18849      * INT4 quant:  35B * 0.5 bytes = 17.5 GB. Still larger than 8GB. This doesn't fit natively.<br>
18850    - Challenge the premise: "Wait, if the model indeed runs on 8GB, there must be extreme offloading, sparse activation memory loading, or aggressive hybrid quantization."<br>
18851    - <span style="color:#a3e635">[Autocorreção Crítica]</span>: "Ah! The user says 'por que o MoE permite rodar'. But actually, MoE weights are typically larger than equivalent dense models. A 35B MoE has 35B total parameters but only roughly 6B-8B active parameters per token. If we offload the inactive experts to system memory (RAM/mmap swap) and only load the active experts or the shared dense blocks onto the GPU, then the GPU memory footprint during active tensor computation is massively reduced. Let me structure this hypothesis."<br>
18852    - <span style="color:#d946ef">[Análise Meta-Arquitetural]</span>: Elaborating on the split mechanism. Router stays in VRAM for instant routing, shared blocks in VRAM, active experts fetched from RAM dynamically during forward pass.
18853  </div>
18854  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
18855    <em>Nota Conclusiva de Engenharia:</em> Enquanto o modelo formulava esse raciocínio fascinante na CPU, ele estava descrevendo em profundidade matemática exatamente o sistema de mmap distribuído e a arquitetura Vulkan de 4 níveis de memória que o sustentava em tempo real — sem possuir acesso direto aos metadados do container ou ao sistema de arquivos do laboratório.
18856  </p>
18857
18858  <h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">3. Thinking Block 3 — Quantização Q4_K_M — Sessão 2 (05:24 de 16/06)</h5>
18859  <p style="font-size:0.82rem;color:#94a3b8;line-height:1.75;margin-bottom:0.75rem">
18860    <strong>Prompt:</strong> <em>"Explique em português por que MoE permite rodar modelos grandes em hardware com pouca VRAM. Seja direto e conciso."</em><br>
18861    <strong>Tempo de Raciocínio:</strong> ~9 minutos | <strong>Tokens do Bloco:</strong> ~3.000 | <strong>Status:</strong> ✅ Concluído com Sucesso (--ctx-size 8192).
18862  </p>
18863  <div style="background:#090a0f;border:1px solid rgba(34,197,94,0.05);border-radius:6px;padding:0.9rem;font-family:'JetBrains Mono',monospace;font-size:0.72rem;line-height:1.6;color:#a3e635;margin-bottom:1rem">
18864    <span style="color:#a3e635">// Linha de Pensamento do Qwen3.5 (Q4_K_M com limite otimizado):</span><br>
18865    - Prompt requests: Portuguese, direct, concise.<br>
18866    - Challenge VRAM claim again internally: MoE total size is bigger than dense, but active size is smaller. VRAM savings must come from smaller activation graphs (fewer experts evaluated simultaneously) and CPU-offloaded weight mapping.<br>
18867    - Work step-by-step to compress explanation to fit "direto e conciso":<br>
18868      * <span style="color:#cbd5e1">Rascunho v1:</span> Long theoretical detail on Router and CPU/VRAM exchange metrics.<br>
18869      * <span style="color:#cbd5e1">Refinamento v2:</span> Cut down router math, focus on "Ativação Esparsa" (activation memory bounds).<br>
18870      * <span style="color:#cbd5e1">Compressão Final:</span> Produce 3 crisp, highly readable Portuguese bullet points summarizing Active Parameters, Activation Garty/Memory limit, and Compute Scalability.
18871  </div>
18872<h5 style="color:#fff;font-weight:600;font-size:0.85rem;margin-top:1.25rem;margin-bottom:0.5rem">Tabela Comparativa de Comportamento Cognitivo</h5>
18873  <div class="tbl">
18874    <table>
18875      <thead>
18876        <tr>
18877          <th>Métrica de Profiling</th>
18878          <th>Sessão 1 (Q6_K)</th>
18879          <th>Sessão 2-A (Q4_K_M)</th>
18880          <th>Sessão 2-B (Q4_K_M / ctx 8192)</th>
18881        </tr>
18882      </thead>
18883      <tbody>
18884        <tr><td><strong>Duração do Raciocínio</strong></td><td>~4 minutos</td><td><strong>~11 minutos</strong></td><td>~9 minutos</td></tr>
18885        <tr><td><strong>Volume do Bloco &lt;think&gt;</strong></td><td>~2.000 tokens</td><td><strong>~3.500 tokens</strong></td><td>~3.000 tokens</td></tr>
18886        <tr><td><strong>Autocorreções Efetuadas</strong></td><td>2</td><td><strong>7 (Autocorreções profundas)</strong></td><td>4 (Foco em concisão)</td></tr>
18887        <tr><td><strong>Questionamento de Premissa?</strong></td><td>Não</td><td><strong>✅ Sim (Provou erro matemático do prompt)</strong></td><td>Sim (reajuste técnico)</td></tr>
18888        <tr><td><strong>Raciocínio Matemático</strong></td><td>Equação Transformers</td><td><strong>Cálculo do tamanho de pesos reais</strong></td><td>Cálculo de buffers de ativação</td></tr>
18889        <tr><td><strong>Entrega do Texto</strong></td><td>✅ Sucesso</td><td>❌ Estouro (4096 esgotados)</td><td><strong>✅ Sucesso Absoluto (Zero cortes)</strong></td></tr>
18890      </tbody>
18891    </table>
18892  </div>
18893
18894  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.8 — Cronograma Histórico do Laboratório</h3>
18895  <div class="tbl">
18896    <table>
18897      <thead>
18898        <tr>
18899          <th>Sessão do Experimento</th>
18900          <th>ID</th>
18901          <th>Parâmetros de Ctx</th>
18902          <th>Geração (tok/s)</th>
18903          <th>Corte de Fluxo (truncated)</th>
18904          <th>Resultado Efetivo</th>
18905        </tr>
18906      </thead>
18907      <tbody>
18908        <tr><td>Seção 34 — Teste 5</td><td>Q6_K</td><td>4096 tokens</td><td>5,57 t/s</td><td>0 (prompt enxuto)</td><td>✅ Resposta entregue (contexto enxuto)</td></tr>
18909        <tr><td>Seção 34 — Teste 9 (curl)</td><td>Q4_K_M</td><td>4096 tokens</td><td><strong>6,57 t/s</strong></td><td>0 (sem timeout)</td><td>
18909✅ Resposta integral por canal direto</td></tr>
18910        <tr style="background:rgba(34,197,94,0.05)"><td><strong>Seção 34 — Teste 7 (WebUI)</strong></td><td>Q4_K_M</td><td>8192 tokens</td><td>6,42 t/s</td><td>0</td><td>✅ Resposta completa com raciocínio expandido</td></tr>
18911      </tbody>
18912    </table>
18913  </div>
18914
18915  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.9 — Nova Coleção de Lições Técnicas Consolidadas</h3>
18916  <ul style="padding-left:1.2rem;font-size:.82rem;color:#94a3b8;line-height:1.8;margin-bottom:1.25rem">
18917    <li><strong style="color:#fff">Lição 6 — O fator Timeout do Cliente:</strong> A maior parte dos erros apontados por testadores não decorre de incapacidade física da GPU, mas sim da persistência HTTP falha de interfaces que desistem antes da decodificação final.</li>
18918    <li><strong style="color:#fff">Lição 7 — Ajuste de Buffers de Contexto:</strong> Ativar a diretiva <code>--ctx-size 8192</code> remove o limite asfixiante do buffer de raciocínio, oferecendo fôlego de processamento para os mais de 3.500 tokens exigidos de raciocínio lógico interno.</li>
18919    <li><strong style="color:#fff">Lição 8 — Supremacia de Carregamento da Quantização Média:</strong> Rodar 35B com quantização de 4 bits economiza 7GB cruciais na carga física de RAM da CPU, reduzindo o I/O do Swap do disco e otimizando a temperatura.</li>
18920    <li><strong style="color:#fff">Lição 9 — Raciocínio de Modelo Crítico:</strong> O Qwen3.5 MoE questionou a premissa errônea presente no prompt, calculando pesos em tempo real e rebatendo sobre o offloading híbrido, o que prova comportamento de atenção e alinhamento impecáveis.</li>
18921    <li><strong style="color:#fff">Lição 10 — Paralelismo nativo estável:</strong> A coexistência de chamadas em canais concorrentes prova a maturidade das implementações de pipeline de shaders Vulkan no llama.cpp.</li>
18922  </ul>
18923
18924  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.10 — Setup Recomendado para Implementações Futuras</h3>
18925  <div class="cmd"># Script do Laboratório para inicialização de produção
18926cd E:\\llama.cpp\\build\\bin\\Release
18927 
18928.\\llama-server.exe \`
18929  -m "E:\\models\\Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" \`
18930  --host 0.0.0.0 \`
18931  --port 8081 \`
18932  --ctx-size 8192</div>
18933  <p style="font-size:0.8rem;color:#94a3b8;font-style:italic;line-height:1.8;margin-top:0.5rem">
18934    *Instruções de interface complementares: Desativação estrita de Web Search e geração e imagens durante o processamento híbrido extremo.
18935  </p>
18936
18937  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.11 — Veredicto Geral do Laboratório (Provando a Hipótese)</h3>
18938  <div class="tbl">
18939    <table>
18940      <thead>
18941        <tr>
18942          <th>Questão de Engenharia</th>
18943          <th>Veredicto Final</th>
18944        </tr>
18945      </thead>
18946      <tbody>
18947        <tr><td><strong>O curl resolve o timeout do OpenWebUI?</strong></td><td>✅ <strong>Sim</strong> (truncated = 0, resposta 100% íntegra)</td></tr>
18948        <tr><td><strong>CTX-SIZE de 8.192 resolve o thinking mode esmagado?</strong></td><td>✅ <strong>Sim</strong> (Acomoda com folga raciocínios longos)</td></tr>
18949        <tr><td><strong>Q4_K_M é superior para o cenário de 32GB de RAM?</strong></td><td>✅ <strong>Sim</strong> (Mais rápido, mais frio, menor swap)</td></tr>
18950        <tr><td><strong>A hipótese de esgotamento de contexto foi confirmada?</strong></td><td>✅ <strong>Absolutamente</strong></td></tr>
18951        <tr><td><strong>Sobrecusto financeiro para otimização em 2026?</strong></td><td>✅ <strong>R$ 0,00</strong> (Solução lógica via flags)</td></tr>
18952      </tbody>
18953    </table>
18954  </div>
18955
18956  <h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:700;margin-top:2rem;margin-bottom:.5rem">34.12 — Tags e Metadados</h3>
18957  <div style="background:#141519;border:1px border-white/5;border-radius:6px;padding:1rem;font-family:'JetBrains Mono',monospace;font-size:0.75rem;line-height:1.7;color:#a9b1d6;margin-bottom:1.5rem">
18958    <div>🏷️ <strong>Tags:</strong> curl, ctx-size, timeout, openwebui, q4km, q6k, paralelismo, thinking-mode, resposta-completa, hipotese-confirmada, rx580</div>
18959    <div style="margin-top:0.5rem">💻 <strong>Hardware:</strong>
18959 RX 580 2048SP + Xeon E5-2690 v3 + 32GB ECC DDR4</div>
18960    <div style="margin-top:0.25rem">💿 <strong>Software:</strong> llama.cpp (build\\bin\\Release) + Vulkan SDK 1.4.350.0 + OpenWebUI v0.9.6</div>
18961    <div style="margin-top:0.25rem">📅 <strong>Data:</strong> 16/06/2026</div>
18962    <div style="margin-top:0.25rem">📊 <strong>Testes:</strong> 3 (Teste 9 curl, paralelismo real, Teste 7 ctx8192)</div>
18963    <div style="margin-top:0.25rem">📈 <strong>Benchmark:</strong> 6,42–6,65 tok/s (Q4_K_M) | truncated = 0</div>
18964    <div style="margin-top:0.25rem">🔥 <strong>Temperatura pico:</strong> 74°C</div>
18965    <div style="margin-top:0.25rem">🏆 <strong>Status final:</strong> ✅ HIPÓTESE CONFIRMADA</div>
18966  </div>
18967
18968  <blockquote style="font-size:.85rem;color:#e11d48;font-style:italic;line-height:1.75;border-left:3px solid #e11d48;padding-left:.9rem;margin:2rem 0;background:rgba(225,29,72,0.02);padding-top:0.5rem;padding-bottom:0.5rem">
18969    "O problema nunca foi o hardware. Era uma flag e um timeout."<br>
18970    <span style="font-style:normal;font-weight:bold;display:block;margin-top:0.5rem;font-size:0.75rem">— AIVisionsLab, 16/06/2026</span>
18971  </blockquote>
18972
18973  <div class="footer">
18974    Documentação gerada por Claude Sonnet 4.6 — 16/06/2026 · Baseada em logs reais, screenshots e benchmarks ao vivo · 3 testes documentados · Hipótese confirmada · Hardware de 2017 processando IA de 2025
18975  </div>
18976</div>
18977</div>`},proximos:{id:"proximos",title:"34. PRÓXIMOS PASSOS (ROADMAP 2027)",desc:"下一个开发目标:Vulkan 多 GPU 集群和本地自主代理网格。",meta:{version:"1.0.0",type:"artigo",category:"comunidade",subcategory:"planejamento",difficulty:"beginner",estimated_time_min:10,tags:["roadmap-2027","planejamento-tecnico","novas-verticais"],last_reviewed:"2026-07-01",relationships:{prerequisites:["codacus"],previous:"codacus",next:"arquivos",related:["jornada","meta"]}},html:'<div class="card" style="border-left:3px solid #22c55e"><p style="font-size:.88rem;color:#fff;font-weight:600">计算基础设施扩展规划:</p><ul style="padding-left:1.2rem;margin-top:.45rem;font-size:.85rem;color:#94a3b8;line-height:2"><li><strong style="color:#fff">[ ] 多 GPU 集群认证:</strong>通过 Vulkan 并行耦合第二块 RX 580 显卡,用于权重张量分布。</li><li><strong style="color:#fff">[ ] 自主本地代理映射:</strong>将 CrewAI 框架完全集成,在 OpenWebUI API 上原生运行以实现企业自动化。</li></ul></div>'},scripts:{id:"scripts",title:"21. SCRIPTS E AUTOMAÇÃO",desc:"用于清理显存并无冲突地启动本地服务器的批处理脚本。",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:15,tags:["reboot-stack","memory-flush","manutencao-servidor"],last_reviewed:"2026-07-01",relationships:{prerequisites:["stack"],previous:"stack",next:"guia",related:["reboot_stack","sd_bat_automation"]}},html:`<h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin-bottom:.75rem;text-transform:uppercase">19.A — 主脚本(所有服务)</h4><div class="code"><span class="code-lang">batch</span><pre>@echo off
18978title INFRASTRUCTURE IA - REBOOT STACK
18979cls
18980echo 强制终止后台活动实例...
18981taskkill /F /IM sd-server.exe 2>nul
18982taskkill /F /IM llama-server.exe 2>nul
18983timeout /t 2 /nobreak >nul
18984
18985echo 通过 Vulkan 在 RX 580 上初始化 LLM (端口 8081)...
18986start "LLM Server - Vulkan RX580" C:\\llama.cpp\\build\\bin\\Release\\llama-server.exe ^
18987  -m "E:\\MODELO LLM PARA GPU\\Mistral-7B-Q4_K_M.gguf" ^
18988  --host 0.0.0.0 ^
18989  --port 8081 ^
18990  --device Vulkan0
18991
18992timeout /t 3 /nobreak >nul
18993
18994echo 通过 Vulkan 在 RX 580 上初始化 SD Server (端口 7860)...
18995E:
18996cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
18997sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 ^
18998  -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
18999
19000pause</pre></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.B — 将 LLM 连接到 OpenWebUI</h4><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">启动 llama-server 后,将其连接到 OpenWebUI:</p><ol style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-bottom:.75rem"><li>访问 <code style="color:var(--r)">http://localhost:3000</code></li><li>点击头像 → <strong style="color:#fff">管理面板</strong></li><li>转到 <strong style="color:#fff">设置 → 连接</strong></li><li>在 <strong style="color:#fff">OpenAI API</strong> 部分点击 <strong style="color:#fff">"+"</strong></li><li>填写以下字段:</li></ol><div class="tbl"><table><thead><tr><th>
19000字段</th><th>值</th></tr></thead><tbody><tr><td>URL</td><td><code>http://host.docker.internal:8081/v1</code></td></tr><tr><td>API Key</td><td><code>sk-local</code></td></tr></tbody></table></div><ol start="6" style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem;margin-top:.75rem"><li>点击 <strong style="color:#fff">刷新</strong> 图标 — 应出现绿色横幅 ✅</li><li>保存</li></ol><div class="card" style="margin-top:.75rem;border-left:3px solid #eab308;padding-left:.9rem"><p style="font-size:.85rem;color:#94a3b8;line-height:1.8"><strong style="color:#eab308">⚠️ 不要使用 <code>127.0.0.1</code></strong> — Docker 在隔离的 WSL2 网络上运行,看不到 Windows localhost。请始终使用 <code style="color:var(--r)">host.docker.internal</code>。</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.C — 聊天验证</h4><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.75rem">保存后,在 OpenWebUI 中打开一个 <strong style="color:#fff">新聊天</strong>:</p><ul style="font-size:.88rem;color:#94a3b8;line-height:2;padding-left:1.2rem"><li><code style="color:var(--r)">Mistral-7B-Q4_K_M.gguf</code> 模型出现在 <strong style="color:#fff">外部</strong> 列表中</li><li>选择它并正常聊天</li><li>模型 100% 在 <strong style="color:#fff">RX 580 通过 Vulkan</strong> 运行 — 而不是在 Ollama 上</li></ul><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.D — 验证是否在 GPU 上(不是 CPU)</h4><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem">在 llama-server 终端中,确认:</p><div class="code"><span class="code-lang">log</span><pre>ggml_vulkan: Found 1 Vulkan device(s)
19001ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
19002llama server listening at http://0.0.0.0:8081</pre></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:.75rem 0 .5rem 0">并且在推理期间出现基准测试:</p><div class="code"><span class="code-lang">log</span><pre>17.77 t/s  ← RX 580 Vulkan ✅</pre></div><div class="card" style="margin-top:.75rem"><p style="font-size:.85rem;color:#64748b;line-height:1.8">如果只出现 <code>3-5 t/s</code> 而没有 <code>ggml_vulkan</code> 行 — 它在 CPU 上运行。检查命令中是否有 <code style="color:var(--r)">--device Vulkan0</code>。</p></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.E — 三个可用接口</h4><div class="tbl"><table><thead><tr><th>接口</th><th>URL</th><th>何时使用</th></tr></thead><tbody><tr><td><strong style="color:#fff">原生 llama.cpp UI</strong></td><td><code>http://127.0.0.1:8081</code></td><td>直接在浏览器中进行快速测试</td></tr><tr class="hig"><td><strong style="color:#fff">OpenWebUI</strong></td><td><code>http://localhost:3000</code></td><td>带历史记录和 RAG 的日常使用</td></tr><tr><td><strong style="color:#fff">直接 API</strong></td><td><code>http://192.168.15.68:8081/v1</code></td><td>与其他应用集成</td></tr></tbody></table></div><h4 style="color:#fff;font-family:'Syne',sans-serif;font-size:11px;letter-spacing:1px;margin:1.5rem 0 .75rem 0;text-transform:uppercase">19.F — 脚本关键规则</h4><div class="tbl"><table><thead><tr><th>规则</th><th>原因</th></tr></thead><tbody><tr class="hig"><td>必须 <code>--host 0.0.0.0</code></td><td><code>127.0.0.1</code> 阻止 Docker</td></tr><tr class="hig"><td>必须 <code>--device Vulkan0</code></td><td>没有它会降到 CPU (3-5 t/s)</td></tr><tr><td>启动前 <code>taskkill</code></td><td>释放卡住进程的 VRAM</td></tr><tr><td>在 OpenWebUI 中使用 <code>host.docker.internal</code></td><td>Docker 在 Windows 主机上看到的唯一地址</td></tr></tbody></table></div>`},sd_bat_automation:{id:"sd_bat_automation",title:"12. SD-SERVER LOCAL / BOOT SEQUENCE",de
19002sc:"用于安全且可重现的 AI 服务器初始化的专用批处理脚本。",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"scripts",difficulty:"intermediate",estimated_time_min:12,tags:["batch-automation","loop-monitoramento","gerenciamento-portas"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux_server"],previous:"flux_server",next:"sd_openwebui_integration",related:["scripts","reboot_stack"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">为避免手动错误、路径不正确或重启 Windows 时端口卡在 VRAM 中,服务器必须仅通过桌面上的 <code>.bat</code> 文件启动。</p><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">生产脚本 (iniciar_ia_server.bat):</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px">@echo off
19003title Local Stable Diffusion Server - Production
19004cls
19005
19006:: 1. 清理 VRAM/RAM 中的幽灵进程
19007taskkill /f /im sd-server.exe 2>nul
19008taskkill /f /im sd-cli.exe 2>nul
19009timeout /t 2 /nobreak >nul
19010
19011:: 2. 驱动器跳转和原生命令行路由 (CMD 语法)
19012E:
19013cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
19014
19015:: 3. 为 Docker 开放监听执行
19016sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"
19017
19018pause</pre><div class="tbl" style="margin:1.25rem 0"><table><thead><tr><th>规则</th><th>原因</th></tr></thead><tbody><tr><td>切勿在可执行文件前使用 <code>.\\</code></td><td>传统 CMD 无法识别 — 会破坏终端</td></tr><tr><td>强制 <code>taskkill</code> 块</td><td>释放卡在后台进程中的 7860 端口</td></tr><tr><td><code>cd</code> 前的驱动器跳转 (<code>E:</code>)</td><td>没有显式跳转 CMD 不会更改驱动器</td></tr></tbody></table></div><div class="card" style="margin-bottom:1.25rem; background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e;"><span style="color:#22c55e; font-weight:bold">✅ 状态:自动化在生产中验证</span><br><span style="font-size:.8rem; color:#94a3b8">双击 .bat 初始化完整生态系统 — 按顺序清理、路由和绑定端口</span></div>`},sd_openwebui_integration:{id:"sd_openwebui_integration",title:"13. INTEGRAÇÃO OPENWEBUI + DOCKER",desc:"OpenWebUI Docker 容器与运行在主机 GPU 上的原生 C++ 引擎之间的网络桥接。",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"integracao",difficulty:"advanced",estimated_time_min:35,tags:["open-webui","docker-compose","networking-docker"],last_reviewed:"2026-07-01",relationships:{prerequisites:["sd_bat_automation"],previous:"sd_bat_automation",next:"comfyui-wsl",related:["sdserver","comfyui-wsl"]}},html:`<p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:1.25rem">当生成引擎在 Docker 容器外运行时,标准本地通信 (<code>127.0.0.1</code>) 会被网络隔离和 Windows 防火墙阻止。初始化和路由需要显式设置。</p><p style="font-size:.88rem;color:#fff;margin-bottom:.5rem">⚙️ <strong>关键初始化参数</strong></p><div class="tbl" style="margin-bottom:1.25rem"><table><thead><tr><th>标志</th><th>值</th><th>描述</th></tr></thead><tbody><tr><td><code>--listen-ip</code></td><td><code>0.0.0.0</code></td><td>开放对主机外部请求的监听 (Docker)</td></tr><tr><td><code>--listen-port</code></td><td><code>7860</code></td><td>与 OpenWebUI 集成的标准端口</td></tr><tr><td><code>-m</code></td><td>绝对路径</td><td><code>.safetensors</code> 或 <code>.gguf</code> 格式的 SD 1.5 / XL 模型</td></tr></tbody></table></div><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin-bottom:.5rem"><strong style="color:#fff">生产命令 — SD 1.5 / DreamShaper:</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:11px">sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\ia_storage\\models\\Stable-diffusion\\checkpoints\\dreamshaper_8.safetensors"</pre><p style="font-size:.88rem;color:#94a3b8;line-height:1.9;margin:1rem 0">⚠️ <strong style="color:#fff">架构说明:</strong>Flux.1 模型不兼容通过简单 <code>-m</code> 标志的此构建 — 它们返回 <code>[ERROR] main.cpp:92 - new_sd_ctx_t failed</code>。对于 Flux,请使用 10.A 节中的专用命令,分别使用 <code>--diffusion-model</code>、<code>--vae</code>、<code>--clip_l</code> 和 <code>--t5xxl</code> 标志。</p><p style="font-size:.88rem;color:#fff;margin-bottom:.75rem">🔌 <strong>在 OpenWebUI 中配置路由</strong></p><ol style="font-size:.88rem;color:#94a3b8;line-height:2;margin-left:1.25rem"><li>访问 <code>http://localhost:3000</code></li><li>转到 <strong>设置 &gt; 图像</strong> (管理面板)</li><li>选择 <strong>Automatic1111</strong> 引擎</li><li>输入机器的本地 IP,末尾必须带 <code>/</code>:<br><code style="color:#22c55e">http://192.168.15.68:7860/</code></li><li>点击 <strong>保存</strong>
19018 — 绿色横幅将确认网络桥接</li></ol><div class="card" style="border:1px solid rgba(239,68,68,0.2);background:rgba(239,68,68,0.02);padding:1rem;border-radius:4px;margin:1.25rem 0"><strong style="color:#ef4444;display:block;margin-bottom:.4rem">🔒 必须在 Windows Defender 防火墙中放行</strong><p style="font-size:.82rem;color:#94a3b8;line-height:1.7;margin-bottom:.5rem">默认情况下,Windows Defender 会静默阻止来自 Docker 内部子网 (<code>172.17.0.0/16</code>) 和 WSL2 (<code>172.x.x.x</code>) 的连接。如果没有此规则,即使激活了 <code>--listen-ip 0.0.0.0</code>,OpenWebUI 也无法连接到 sd-server。</p><p style="font-size:.82rem;color:#fff;margin-bottom:.25rem"><strong>方法 2 — PowerShell (一行命令,以管理员身份运行):</strong></p><pre style="font-family:'JetBrains Mono',monospace;font-size:10px;margin-bottom:.5rem">New-NetFirewallRule -DisplayName "sd-server AIVisionsLab" -Direction Inbound -Protocol TCP -LocalPort 7860 -Action Allow</pre><p style="font-size:.82rem;color:#94a3b8;margin:0"><strong>验证:</strong> 创建规则后,重启 sd-server 并尝试通过 OpenWebUI 生成图像。图像设置中的绿色横幅确认桥接已激活。</p></div>`},sdcpp:{id:"sdcpp",title:"08. COMPILAÇÃO DO STABLE-DIFFUSION.CPP",desc:"构建纯净的 C++ 引擎,实现无 CUDA 依赖的 GPU 加速图像渲染。",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"compilacao",difficulty:"advanced",estimated_time_min:25,tags:["sdcpp","stable-diffusion-cpp","vulkan-image"],last_reviewed:"2026-07-01",relationships:{prerequisites:["llama"],previous:"llama",next:"modelos",related:["sdserver","flux_server"]}},html:`<div class="note">⚠ 通过 <strong>Developer PowerShell</strong> 编译 · 之后通过 <strong>普通 PowerShell</strong> 执行</div><div class="code"><pre># 结构化克隆,引入所有链接的依赖子模块
19019git clone --recursive https://github.com/leejet/stable-diffusion.cpp
19020cd stable-diffusion.cpp
19021mkdir build
19022cd build
19023
19024# 映射编译器,启用 Vulkan 引擎并以性能模式编译二进制文件
19025cmake .. -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
19026cmake --build . --config Release -j20</pre></div><div class="code ok" style="margin-top:.75rem"><pre># 最终成功编译日志:
19027-- Found Vulkan: C:/VulkanSDK/1.4.341.1/Lib/vulkan-1.lib
19028[100%] Built target sd-server ✅</pre></div>`},sdserver:{id:"sdserver",title:"10. INICIALIZAÇÃO DO SERVIDOR SD-SERVER (GPU)",desc:"在本地端口激活图像服务,以监听图形界面的 API 调用。",meta:{version:"1.0.0",type:"documento",category:"software",subcategory:"servidor",difficulty:"intermediate",estimated_time_min:15,tags:["sd-server","api-rest","inferenca-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["modelos"],previous:"modelos",next:"flux_server",related:["sd_bat_automation","sd_openwebui_integration"]}},html:`<div class="note ok">✅ 认证初始化:在 <strong>普通 PowerShell</strong> 中运行此代码块</div><div class="code"><pre># 启动服务器,指向量化模型并定义监听主机
19029E:\\stable-diffusion.cpp\\build\\bin\\Release\\sd-server.exe \\
19030  -m "E:\\models\\dreamshaper8.gguf" \\
19031  --host 0.0.0.0 \\
19032  --port 7860</pre></div><div class="code ok" style="margin-top:.75rem"><pre># 终端监控:
19033ggml_vulkan: Found 1 Vulkan device(s)
19034ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB
19035Server listening on http://0.0.0.0:7860 ✅</pre></div>`},sdxl_vulkan:{id:"sdxl_vulkan",title:"26. SDXL & FLUX.1 VULKAN: ALTA RESOLUÇÃO NA POLARIS",desc:"通过 Vulkan 和 8GB 显存上的结构化张量卸载(offloading),实现高分辨率(1024x1024)扩散模型的完整挑战映射。",meta:{version:"1.0.0",type:"estudo_caso",category:"estudo-caso",subcategory:"pesquisa-extrema",difficulty:"advanced",estimated_time_min:40,tags:["sdxl","vulkan-diffusion","segmentacao-memoria"],last_reviewed:"2026-07-01",relationships:{prerequisites:["proving_hypothesis_35b"],previous:"proving_hypothesis_35b",next:"",related:["animatediff-video","flux-vulkan"]}},html:`<div class="page">
19036
19037  <div class="hero">
19038    <div class="hero-eyebrow">AIVisionsLab — 第 26 节</div>
19039    <div class="hero-title">在 RX 580 上通过 Vulkan 实现 SDXL 1024×1024:<br>来自 AMD 的挑战及现场实测回应</div>
19040    <div class="hero-sub">AMD RX 580 8GB (2017) · stable-diffusion.cpp (leejet) · Vulkan · 无 CUDA · 无 ROCm · CPU/GPU 混合拆分 · 已确认照片级真实输出</div>
19041  </div>
19042
19043  <div class="badges">
19044    <span class="badge badge-red">RX 580 · GCN 4th gen</span>
19045    <span class="badge badge-blue">Vulkan backend</span>
19046    <span class="badge badge-gray">stable-diffusion.cpp</span>
19047    <span class="badge badge-green">SDXL 1024×1024 ✓</span>
19048    <span class="badge badge-amber">CPU/GPU 混合拆分</span>
19049  </div>
19050
19051  <h2>背景:挑战源自 AMD Discord 社区</h2>
19052  <p>当我们在 AMD Developer Community 官方服务器讨论 ROCm 与 Vulkan 时,一位成员现场质疑了该技术栈的极限。我们的回应并非空谈,而是实时运行基准测试,并在 AMD 服务器内发布了包含截图、日志和生成图像的结果。</p>
19053
19054  <div class="discord-card">
19055    <div class="discord-header"><i class="ti ti-brand-discord" aria-hidden="true"></i> AMD Developer Community · #rocm-ai-assistant</div>
19056    <div class="discord-body">
19057      <div class="discord-quote">
19058        <div class="author">POIZONE 🔥</div>
19059        <p>"Love the RX 580 flex. Which SD backend are you using, stable-diffusion.cpp on Vulkan? And does it support SDXL or Flux, or only SD1.5?"</p>
19060      </div>
19061      <div class="discord-reply">回复:我们在对话期间进行了现场测试。结果——SDXL 1.0 @ 1024×1024 已确认,并附带了日志、任务管理器截图和生成的图像——已发布回同一频道。ROCm AI Assistant(AMD 官方机器人)回应并承认,对于超出 ROCm 支持范围的硬件,Vulkan 是合理的选择。</div>
19062    </div>
19063  </div>
19064
19065  <h2>问题:6.9 GB 模型,8 GB VRAM</h2>
19066  <p>SDXL base 模型在 fp16 下约为 6.9 GB。由于推理过程中的激活缓冲区占用,如果全部加载到 GPU,会超出 RX 580 的 8 GB 显存。解决方案是按组件进行选择性卸载(offload)——stable-diffusion.cpp (leejet 分支) 原生支持此功能,逻辑与我们之前在 FLUX.1-schnell 中使用 <code>--clip-on-cpu</code> 的方式相同。</p>
19067  <p>第二个隐蔽问题:SDXL 的原始 VAE 在 FP16 下会产生 NaN,而 sd.cpp 的 ggml_conv_2d 仅在 FP16 下运行。如果没有正确的修复,图像会变成黑色——且日志中没有任何可见错误。</p>
19068
19069  <div class="gotcha-box">
19070    <div class="gotcha-title">⚠ 必读注意事项 — VAE FP16 修复</div>
19071    <p>请务必使用 <strong>sdxl_vae-fp16-fix.safetensors</strong> (madebyollin) 替代原始 VAE。否则:所有渲染结果都会静默输出为黑色图像。<code>--vae</code> 标志应指向此文件,而非 checkpoint 中内置的 VAE。</p>
19072  </div>
19073
19074  <h2>解决方案:CPU/GPU 混合拆分</h2>
19075  <p>将 UNet 全部放入 VRAM。Text encoders 和 VAE decode 放入 RAM。<code>--vae-tiling</code> 将解码过程拆分为 32×32 的 tiles,以消除流水线最后阶段的内存峰值。</p>
19076
19077  <div class="code-block">
19078    <div class="code-label">PowerShell — E:\\stable-diffusion.cpp\\build\\bin\\Release\\</div>
19079    <pre>.\\sd-server.exe \`
19080  --listen-ip 0.0.0.0 \`
19081  --listen-port 8081 \`
19082  -m E:\\models\\sd_xl_base_1.0.safetensors \`
19083  --vae E:\\models\\sdxl_vae-fp16-fix.safetensors \`
19084  --clip-on-cpu \`
19085  --vae-on-cpu \`
19086  --vae-tiling \`
19087  -H 1024 -W 1024 -v</pre>
19088  </div>
19089
19090  <table class="flag-table">
19091    <thead><tr><th>标志</th><th>效果</th><th>释放的 VRAM 内存</th></tr></thead>
19092    <tbody>
19093      <tr><td>--clip-on-cpu</td><td>CLIP-L + OpenCLIP-bigG 在 conditioner 期间运行于 RAM</td><td>~1.56 GB</td></tr>
19094      <tr><td>--vae-on-cpu</td><td>VAE decode 在 CPU/RAM 上运行 — 消除流水线末端峰值</td><td>~416 MB</td></tr>
19095      <tr><td>--vae-tiling</td><td>将解码拆分为 32×32 tiles (1024×1024 下为 49 个 tiles)</td><td>— (降低 RAM 峰值)</td></tr>
19096    </tbody>
19097  </table>
19098
19099  <h2>日志中确认的内存拆分</h2>
19100
19101  <div class="log-block">
19102    <pre><span class="comment"># 模型完全加载后的 sd-server 输出:</span>
19103
19104total params memory size = 6624.11MB
19105<span class="highlight">  VRAM  4900.07MB  →  diffusion_model (UNet)</span>
19106<span class="highlight">  RAM   1564.36MB  →  text_encoders (CLIP-L + OpenCLIP-bigG)</span>
19107<span class="highlight">  RAM    159.68MB  →  vae</span>
19108
19109listening on: http://0.0.0.0:8081</pre>
19110  </div>
19111
19112  <div class="memory-split">
19113    <div class="mem-card gpu">
19114      <div class="mem-label">GPU · VRAM</div>
19115      <div class="mem-value">4.9 GB</div>
19116      <div class="mem-sub">UNet (diffusion_model)</div>
19117    </div>
19118    <div class="mem-card ram">
19119      <div class="mem-label">CPU · RAM</div>
19120      <div class="mem-value">1.56 GB</div>
19121      <div class="mem-sub">CLIP-L + OpenCLIP-bigG</div>
19122    </div>
19123    <div class="mem-card ram">
19124      <div class="mem-label">CPU · RAM</div>
19125      <div class="mem-value">160 MB</div>
19126      <div class="mem-sub">VAE decode (49 tiles)</div>
19127    </div>
19128  </div>
19129
19130  <h2>通过 PowerShell 进行生成测试</h2>
19131  <p>为什么不使用 Open WebUI:因为它已经配置为指向另一端口上的 FLUX.1-schnell。重新配置可能会破坏现有的工作环境。使用终端可以更快解决,无需保存状态,ä¹
19131Ÿä¸ä¼šäº§ç”Ÿç«¯å£å†²çªã€‚</p>
19132
19133  <div class="code-block">
19134    <div class="code-label">PowerShell — 通过 A1111 兼容 API 发送提示词</div>
19135    <pre>$body = @{
19136    prompt         = "a lovely cat, detailed fur, studio lighting"
19137    negative_prompt = ""
19138    width          = 1024
19139    height         = 1024
19140    steps          = 20
19141    cfg_scale      = 7
19142    sampler_name   = "Euler a"
19143} | ConvertTo-Json
19144
19145$response = Invoke-RestMethod \`
19146    -Uri "http://localhost:8081/sdapi/v1/txt2img" \`
19147    -Method Post \`
19148    -ContentType "application/json" \`
19149    -Body $body
19150
19151$bytes = [Convert]::FromBase64String($response.images[0])
19152[IO.File]::WriteAllBytes("E:\\models\\teste_sdxl_1024.png", $bytes)</pre>
19153  </div>
19154
19155  <h2>完整基准测试</h2>
19156
19157  <div class="bench-grid">
19158    <div class="bench-card">
19159      <div class="bench-phase">Conditioner (CLIP)</div>
19160      <div class="bench-time">~4s</div>
19161      <div class="bench-detail">CPU/RAM · CLIP-L + OpenCLIP-bigG</div>
19162    </div>
19163    <div class="bench-card">
19164      <div class="bench-phase">UNet sampling</div>
19165      <div class="bench-time">267s</div>
19166      <div class="bench-detail">20 steps · Euler A · 13.37s/it · RX 580 Vulkan</div>
19167    </div>
19168    <div class="bench-card">
19169      <div class="bench-phase">VAE decode</div>
19170      <div class="bench-time">~390s</div>
19171      <div class="bench-detail">49 tiles 32×32 · ~8s/tile · CPU/RAM</div>
19172    </div>
19173    <div class="bench-card">
19174      <div class="bench-phase">VRAM 峰值</div>
19175      <div class="bench-time">5.7 GB</div>
19176      <div class="bench-detail">可用 8.0 GB · 剩余 2.3 GB</div>
19177    </div>
19178    <div class="bench-card total">
19179      <div class="bench-phase">总耗时</div>
19180      <div class="bench-time">662s · ~11 分钟</div>
19181      <div class="bench-detail">峰值温度 67°C → 39°C 待机 · RAM 使用 17.7/31.8 GB</div>
19182    </div>
19183  </div>
19184
19185  <h2>速度背景</h2>
19186  <p>这并不快。但这并非重点。</p>
19187
19188  <table class="comparison-table">
19189    <thead><tr><th>硬件</th><th>技术栈</th><th>SDXL 1024×1024 时间</th></tr></thead>
19190    <tbody>
19191      <tr><td>RTX 4090</td><td>CUDA</td><td>~8s</td></tr>
19192      <tr><td>RTX 3080</td><td>CUDA</td><td>~25s</td></tr>
19193      <tr class="highlight-row"><td>RX 580 8GB (2017)</td><td>Vulkan · 无 CUDA · 无 ROCm</td><td>662s <span class="tag">可行</span></td></tr>
19194      <tr><td>纯 CPU (Xeon E5-2690 v3)</td><td>AVX2</td><td>与上述配置范围相似</td></tr>
19195    </tbody>
19196  </table>
19197
19198  <h2>生成输出</h2>
19199  <p>提示词:<em>"a lovely cat, detailed fur, studio lighting"</em></p>
19200  <p>结果:照片级真实的 Maine Coon,可见独立毛发,眼睛清晰,背景虚化,具有戏剧性对比的摄影棚灯光。无伪影,无噪点,无黑图。VAE FP16 fix 的效果与文档描述完全一致。</p>
19201
19202  <div class="result-box">
19203    <p>✓ SDXL 1.0 @ 1024×1024 — 在 RX 580 8GB 上通过纯 Vulkan 确认实现。该硬件发布于 2017 年,已超出 ROCm 官方支持范围,且没有任何供应商专有依赖。使用 --clip-on-cpu + --vae-on-cpu + --vae-tiling 的 CPU/GPU 混合拆分是使其在 8 GB VRAM 内成为可能的关键组合。</p>
19204  </div>
19205
19206  <h2>AMD Developer Community 的回应</h2>
19207  <p>该基准测试已发布在 AMD 官方服务器上,包含日志、推理期间的任务管理器截图以及生成的图像,直接回应了 POIZONE 在 #rocm-ai-assistant 频道提出的问题。反应非常迅速:<em>"wow, that was fast thanks alot, and also pretty good results"</em>。</p>
19208  <p>随后,针对关于项目动机的更长回复——即访问旧硬件、Polaris 被 ROCm 和 DirectML 抛弃,以及“硬件不会死,只是官方支持消失了”的理念——POIZONE 评论道:<em>"Today, someone who wanted to run local AI and couldn't — now can. That's what matters. — this is exactly why i like this idea"</em>。</p>
19209
19210  <h2>模型下载</h2>
19211  <div class="code-block">
19212    <div class="code-label">PowerShell — 下载至 E:\\models\\</div>
19213    <pre>cd E:\\models\\
19214
19215# SDXL 基础模型 (~6.9 GB)
19216curl.exe -L -o sd_xl_base_1.0.safetensors \`
19217  https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
19218
19219# VAE FP16 修复 — 必选 (~319 MB)
19220curl.exe -L -o sdxl_vae-fp16-fix.safetensors \`
19221  https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors</pre>
19222  </div>
19223
19224  <div class="footer-note">
19225    AIVisionsLab · 第 26/36 节 · 硬件:AMD RX 580 8GB (2017) + Xeon E5-2690 v3 + 32 GB DDR4 ECC · Windows 10 Pro + WSL2 · stable-diffusion.cpp leejet 分支 · Vulkan backend · 在回应 AMD Developer Community Discord 挑战时现场测试并记录。
19226  </div>
19227
19228</div>`},solucao:{id:"solucao",title:"04. A SOLUÇÃO — ARQUITETURA DUPLA",desc:"最终工程策略:Vulkan GPU 和 Xeon CPU 之间的智能负载分配。",meta:{version:"1.0.0",type:"artigo",category:"introducao",subcategory:"arquitetura",difficulty:"intermediate",estimated_time_min:15,tags:["vulkan-api","co-processamento","otimizacao-barramento"],last_reviewed:"2026-07-01",relationships:{prerequisites:["falhas"],previous:"falhas",next:"prereqs",related:["contexto","stack"]}},html:`<div class="card acc"><h3 style="color:#fff;font-family:'Syne',sans-serif;font-size:1.05rem;font-weight:800;margin-bottom:.9rem">系统流程逻辑</h3><div class="code"><pre>路径 1 — VULKAN GPU (RX 580 本地加速):
19229llama.cpp 生态系统通过原生 Vulkan 调用映射 GPU
19230        ↓
19231stable-diffusion.cpp 继承并共享相同的干净 ggml 引擎基础
19232        ↓
19233转换为 GGUF 的 SD 1.5 模型在约 72 秒内生成稳定图像 ✅
19234
19235路径 2 — XEON CPU (重型 SOTA 模型扩展):
19236FLUX.1 Schnell FP8 模型需要 16GB,超出了显卡 8GB 的物理 VRAM
19237        ↓
19238将工作流映射到在 WSL2 Linux 内通过 CPU 运行的 ComfyUI
19239        ↓
19240DDR4 REG ECC RAM 充当“高稳定性虚拟 VRAM”
19241        ↓
19242FLUX.1 768x768 分辨率完整生成在约 24 分钟内完成 ✅</pre></div></div><h4 class="s" style="margin-top:1.25rem;margin-bottom:.6rem;color:#fff;font-family:'Syne',sans-serif">协调端口和服务映射</h4><div class="code"><pre>用户界面 (通过 Docker 运行 OpenWebUI — 端口 :3000)
19243        │
19244        ├──► 文本编排:llama-server.exe (端口 :8081 — RX 580 上的 Vulkan 后端)
19245        │     └── 应急替代方案:Ollama Engine (端口 :11434 — 纯 CPU 模式)
19246        │
19247        └──► 图像编排 (动态 Prompt 路由):
19248              ├──► 超快需求 (SD 1.5 GGUF):sd-server.exe (端口 :7860 — Vulkan 后端)
19249              └──► SOTA/复杂需求 (FLUX.1):ComfyUI Server (端口 :8188 — WSL2 CPU Xeon)</pre></div>`},stack:{id:"stack",title:"20. MAPA DE SERVIÇOS DO STACK INTEGRADO",desc:"基础设施监控表、本地流量路由和活动后端。",meta:{version:"1.0.0",type:"documento",category:"automacao",subcategory:"monitoramento",difficulty:"beginner",estimated_time_min:10,tags:["network-stack","ports-mapping","security-local"],last_reviewed:"2026-07-01",relationships:{prerequisites:["animatediff-video"],previous:"animatediff-video",next:"scripts",related:["sd_bat_automation","scripts"]}},html:'<div class="tbl"><table><thead><tr><th>AI 服务</th><th>访问端口</th><th>协议 / 引擎</th><th>活动硬件后端</th></tr></thead><tbody><tr><td><strong>Open WebUI</strong></td><td><code>:3000</code></td><td>Docker Container</td><td>WSL2 虚拟化环境</td></tr><tr class="hig"><td><strong>llama-server</strong></td><td><code>:8081</code></td><td>原生 ggml 可执行文件</td><td>AMD Radeon RX 580 GPU (Vulkan 1.x)</td></tr><tr class="hig"><td><strong>sd-server</strong></td><td><code>:7860</code></td><td>原生 ggml 可执行文件</td><td>AMD Radeon RX 580 GPU (Vulkan 1.x)</td></tr><tr><td><strong>ComfyUI Server</strong></td><td><code>:8188</code></td><td>隔离的 Python 运行时</td><td>Xeon E5-2690 v3 CPU (纯 CPU 模式)</td></tr><tr><td><strong>Ollama Engine</strong></td><td><code>:11434</code></td><td>应急服务</td><td>Xeon E5-2690 v3 CPU (纯 CPU 模式)</td></tr></tbody></table></div>'},"troubleshoot-comfyui":{id:"troubleshoot-comfyui",title:"28. CATASTROFE DE MEMÓRIA NO COMFYUI WINDOWS",desc:"处理物理 VRAM 分配溢出和紧急使用分页标志。",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"comfyui",difficulty:"intermediate",estimated_time_min:15,tags:["vram-spillfix","pagefile-allocation","comfyui-out-of-memory"],last_reviewed:"2026-07-01",relationships:{prerequisites:["flux-vulkan"],previous:"flux-vulkan",next:"comfyui-portable-amd",related:["comfyui-directml","comfyui-directml-func"]}},html:'<div class="err">
19249<div class="err-t">运行时异常:RuntimeError: Could not allocate tensor with...</div><p style="margin-top:.35rem"><strong style="color:#e2e8f0">故障机制:</strong>在 Windows 上尝试使用不稳定的加速后端运行复杂的图像流时发生,这些后端尝试预留比显卡此时可用的更多的连续内存块。</p><p style="margin-top:.35rem"><strong style="color:#fff">生存标志:</strong>通过注入负载碎片化命令来更改初始化文件调用:<code>--lowvram</code> 或 <code>--normalvram</code>。这迫使 ComfyUI 管理器在初始化 KSampler 处理之前从显存中卸载 CLIP 层。</p></div>'},troubleshooting:{id:"troubleshooting",title:"27. GUIA DE RESOLUÇÃO DE PROBLEMAS (TROUBLESHOOTING)",desc:"绕过服务器上的 API 超时故障和空 seed 的快速诊断。",meta:{version:"1.0.0",type:"documento",category:"troubleshooting",subcategory:"geral",difficulty:"beginner",estimated_time_min:10,tags:["port-fixing","network-troubleshoot","timeout-mitigation"],last_reviewed:"2026-07-01",relationships:{prerequisites:["cpu"],previous:"cpu",next:"flux-vulkan",related:["falhas","troubleshoot-comfyui"]}},html:'<div class="err"><div class="err-t">严重症状:generate_image returned no results / 终端冻结</div><p style="margin-top:.35rem"><strong style="color:#e2e8f0">已识别原因:</strong><code>sd-server.exe</code> 服务器在处理以随机模式配置种子 (Seed: -1) 发送的生成时,会出现间歇性的数字溢出错误。</p><p style="margin-top:.35rem"><strong style="color:#22c55e">纠正措施:</strong>在 OpenWebUI 界面中,禁用高级提示选项中的动态种子键,并强制使用固定的有效整数值(例如:<code>42</code>、<code>1337</code>)。</p></div>'}}},zx={},Lx={},Nx={},Vx={},Ux={},Bx={},Gx={};function Wa(r,e){return Object.keys(Zb[r]).reduce((t,o)=>{var d,c;const a=Zb[r][o];return t[o]={id:a.id||o,title:((d=e[o])==null?void 0:d.title)||a.title,desc:((c=e[o])==null?void 0:c.desc)||a.desc,meta:a.meta,html:a.html},t},{})}const Id={"pt-BR":{dir:"ltr",meta:{title:"RX 580 + IA Local — Guia Definitivo 2026 | AIVisionsLab",description:"Guia técnico completo para aceleração de Inteligência Artificial local na AMD Radeon RX 580 via Vulkan, com Xeon E5-2690 v3 e RAM ECC.",lang:"pt-BR"},nav:{languageLabel:"Idioma",github:"GitHub",theme:"Tema",themeLight:"Claro",themeDark:"Escuro",brand:"REGENERAÇÃO DE HARDWARE // 2026",subtitle:"RX 580 IA — DOCUMENTAÇÃO MASTER UNIFICADA",status:"SUPORTE_VULKAN: ATIVO"},sidebar:{title:"Manual Técnico",search:"Buscar seção...",sections:"Seções",progress:"Progresso de leitura",directory:"Diretório",syslog:"● LOG DO SISTEMA"},hero:{badge:"Laboratório AIVisionsLab · 2026",title:"RX 580 +",titleAccent:"IA Local",subtitle:"Guia definitivo de engenharia para acelerar Inteligência Artificial na AMD Radeon RX 580 8GB via Vulkan, com Xeon E5-2690 v3 e 32GB de RAM ECC.",cta:"Começar a leitura",ctaSecondary:"Ver stack completo",stats:{gpu:"GPU",gpuValue:"RX 580 2048SP",cpu:"CPU",cpuValue:"Xeon E5-2690 v3",ram:"RAM",ramValue:"32GB DDR4 ECC",storage:"Armazenamento",storageValue:"NVMe 1TB"}},share:{title:"Compartilhar",copy:"Copiar link",copied:"Link copiado!",guerrilla_title:"Preservação de Hardware & Distribuição de Documentação // 2026",guerrilla_desc:"Este guia consolida configurações, scripts e métodos de otimização de baixo nível para mitigar a obsolescência programada e viabilizar inteligência artificial offline.",btn_copy_link:"Copiar Link da Documentação 🔗",btn_offline_html:"Baixar Guia Offline (.HTML) 💾",btn_pdf_print:"Gerar PDF / Imprimir 🖨️",btn_qr_code:"QR Code p/ Workshops 📱",qr_code_text:"Escaneie este código para carregar o guia instantaneamente em dispositivos móveis durante workshops de hardware livre.",toast_copied:"LINK DA DOCUMENTAÇÃO COPIADO COM SUCESSO!"},footer:{rights:"Todos os direitos reservados.",disclaimer:"Hardware de 2017 processando IA de 2026. O conhecimento é livre e evolutivo.",brand:"HARDWARE REVIVAL PROJECT",q1:'"GPU AMD de 2017 executando IA local em 2026 — sem CUDA, sem ROCm, sem DirectML."',q2:'"Xeon de 2014 gerando arte SOTA de 2026 com 32GB ECC RDIMM."',note:'"Muitas limitações atribuídas ao hardware de herança decorrem da falta de softw
19249are otimizado.\\nOs módulos de hardware legado mantêm capacidade operacional através de backends abertos (Vulkan)."',tech_label:"TECNOLOGIA",authors_label:"AUTORES / ASSISTENTES",copyright:"© 2026 AIVisionsLab. Todos os direitos reservados. / PROJETO DE REUSO GLOBAL (RX 580 + XEON v3)",version_tag:"VULKAN_DEPLOY_V3.0_COMPLETO"},sections:Wa("pt-BR",zx)},en:{dir:"ltr",meta:{title:"RX 580 + Local AI — Definitive Guide 2026 | AIVisionsLab",description:"Complete technical guide for local Artificial Intelligence acceleration on AMD Radeon RX 580 via Vulkan, with Xeon E5-2690 v3 and ECC RAM.",lang:"en"},nav:{languageLabel:"Language",github:"GitHub",theme:"Theme",themeLight:"Light",themeDark:"Dark",brand:"HARDWARE REVIVAL // 2026",subtitle:"RX 580 AI — UNIFIED MASTER DOCUMENTATION",status:"VULKAN_BACKEND: ACTIVE"},sidebar:{title:"Technical Manual",search:"Search section...",sections:"Sections",progress:"Reading progress",directory:"Directory",syslog:"● SYSTEM LOG"},hero:{badge:"AIVisionsLab Laboratory · 2026",title:"RX 580 +",titleAccent:"Local AI",subtitle:"Definitive engineering guide to accelerate Artificial Intelligence on AMD Radeon RX 580 8GB via Vulkan, with Xeon E5-2690 v3 and 32GB ECC RAM.",cta:"Start reading",ctaSecondary:"View full stack",stats:{gpu:"GPU",gpuValue:"RX 580 2048SP",cpu:"CPU",cpuValue:"Xeon E5-2690 v3",ram:"RAM",ramValue:"32GB DDR4 ECC",storage:"Storage",storageValue:"NVMe 1TB"}},share:{title:"Share",copy:"Copy link",copied:"Link copied!",guerrilla_title:"Hardware Preservation & Free Documentation Distribution // 2026",guerrilla_desc:"This guide consolidates low-level optimization templates, configurations, and scripts to counter planned obsolescence and sustain offline localized AI.",btn_copy_link:"Copy Documentation Link 🔗",btn_offline_html:"Download Offline Guide (.HTML) 💾",btn_pdf_print:"Generate PDF / Print 🖨️",btn_qr_code:"Workshops QR Code 📱",qr_code_text:"Scan this code to load the guide instantly on mobile devices during free hardware workshops.",toast_copied:"DOCUMENTATION LINK COPIED!"},footer:{rights:"All rights reserved.",disclaimer:"2017 hardware processing 2026 AI. Knowledge is free and evolutionary.",brand:"HARDWARE REVIVAL PROJECT",q1:'"2017 AMD GPU running local AI in 2026 — no CUDA, no ROCm, no DirectML."',q2:'"2014 Xeon generating art of 2026 with 32GB ECC RDIMM."',note:'"Many limitations attributed to legacy hardware stem from the absence of optimized software.\\nLegacy hardware modules maintain operational limits through open backends (Vulkan)."',tech_label:"TECHNOLOGY",authors_label:"AUTHORS / ASSISTANTS",copyright:"© 2026 AIVisionsLab. All rights reserved. / GLOBAL REUSE PROJECT (RX 580 + XEON v3)",version_tag:"VULKAN_DEPLOY_V3.0_COMPLETO"},sections:Wa("en",Lx)},es:{dir:"ltr",meta:{title:"RX 580 + IA Local — Guía Definitiva 2026 | AIVisionsLab",description:"Guía técnica completa para la aceleración de Inteligencia Artificial local en AMD Radeon RX 580 vía Vulkan, con Xeon E5-2690 v3 y RAM ECC.",lang:"es"},nav:{languageLabel:"Idioma",github:"GitHub",theme:"Tema",themeLight:"Claro",themeDark:"Oscuro",brand:"REGENERACIÓN DE HARDWARE // 2026",subtitle:"RX 580 IA — DOCUMENTACIÓN MAESTRA UNIFICADA",status:"SOPORTE_VULKAN: ACTIVO"},sidebar:{title:"Manual Técnico",search:"Buscar sección...",sections:"Secciones",progress:"Progreso de lectura",directory:"Directorio",syslog:"● LOG DEL SISTEMA"},hero:{badge:"Laboratorio AIVisionsLab · 2026",title:"RX 580 +",titleAccent:"IA Local",subtitle:"Guía definitiva de ingeniería para acelerar Inteligencia Artificial en AMD Radeon RX 580 8GB vía Vulkan, con Xeon E5-2690 v3 y 32GB de RAM ECC.",cta:"Comenzar a leer",ctaSecondary:"Ver stack completo",stats:{gpu:"GPU",gpuValue:"RX 580 2048SP",cpu:"CPU",cpuValue:"Xeon E5-2690 v3",ram:"RAM",ramValue:"32GB DDR4 ECC",storage:"Almacenamiento",storageValue:"NVMe 1TB"}},share:{title:"Compartir",copy:"Copiar enlace",copied:"¡Enlace copiado!",guerrilla_title:"Guerrilla y Distribución Libre SOTA // 2026",guerrilla_desc:"Este conocimiento pertenece a la humanidad. Evite la obsolescencia programada y ayude a democratizar la Inteligencia Artificial offline de alto rendimiento.",btn_copy_link:"Copiar Enlace Autónomo 🔗",btn_offline_html:"Descargar Guía en Línea (.HTML) 💾",btn_pdf_print:"Generar PDF / Imprimir 🖨️",btn_qr_code:"Código QR para Talleres 📱",qr_code_text:"Escanee este código para cargar la guía instantáneamente en dispositivos móviles durante talleres de hardware libre.",toast_copied:"¡ENLACE DE GUERRILLA COPIADO!"},footer:{rights:"Todos los derechos reservados.",disclaimer:"Hardware de 2017 procesando IA de 2026. El conocimiento es libre y evolutivo.",brand:"PROYECTO REGENERACIÓN DE HARDWARE",q1:'"GPU AMD de 2017 ejecutando IA local en 2026 — sem CUDA, sem ROCm, sem DirectML."',q2:'"Xeon de 2014 generando arte SOTA de 2026 con 32GB ECC RDIMM."',note:'"El problema nunca fue la tarjeta. 
19249Clama por optimizaciones.\\nEl hardware se transforma."',tech_label:"TECNOLOGÍA",authors_label:"AUTORES / ASISTENTES",copyright:"© 2026 AIVisionsLab. Reservados todos los derechos. / PROYECTO DE REUTILIZACIÓN GLOBAL",version_tag:"VULKAN_DEPLOY_V3.0_COMPLETO"},sections:Wa("es",Nx)},fr:{dir:"ltr",meta:{title:"RX 580 + IA Locale — Guide Définitif 2026 | AIVisionsLab",description:"Guide technique complet pour l'accélération locale de l'Intelligence Artificielle sur AMD Radeon RX 580 via Vulkan, avec Xeon E5-2690 v3 et RAM ECC.",lang:"fr"},nav:{languageLabel:"Langue",github:"GitHub",theme:"Thème",themeLight:"Clair",themeDark:"Sombre",brand:"RÉGÉNÉRATION DU MATÉRIEL // 2026",subtitle:"RX 580 IA — GUIDE DÉFINITIF",status:"SUPPORT_VULKAN: ACTIF"},sidebar:{title:"Manuel Technique",search:"Rechercher une section...",sections:"Sections",progress:"Progression de lecture",directory:"Directoire",syslog:"● LOG DU SYSTÈME"},hero:{badge:"Laboratoire AIVisionsLab · 2026",title:"RX 580 +",titleAccent:"IA Locale",subtitle:"Guide d'ingénierie définitif pour accélérer l'Intelligence Artificielle sur AMD Radeon RX 580 8GB via Vulkan, avec Xeon E5-2690 v3 et 32GB de RAM ECC.",cta:"Commencer la lecture",ctaSecondary:"Voir le stack complet",stats:{gpu:"GPU",gpuValue:"RX 580 2048SP",cpu:"CPU",cpuValue:"Xeon E5-2690 v3",ram:"RAM",ramValue:"32GB DDR4 ECC",storage:"Stockage",storageValue:"NVMe 1TB"}},share:{title:"Partager",copy:"Copiar le lien",copied:"Lien copié !",guerrilla_title:"Distribution Libérée et Résistance SOTA // 2026",guerrilla_desc:"La connaissance appartient à toute l'humanité. Contournez l'obsolescence programmée des fabricants et aidez à démocratiser l'IA离线 haute performance.",btn_copy_link:"Copier le lien direct 🔗",btn_offline_html:"Télécharger la version de secours (.HTML) 💾",btn_pdf_print:"Imprimer / Exporter en PDF 🖨️",btn_qr_code:"Code QR pour les hacklabs 📱",qr_code_text:"Scannez ce QR Code pour charger le guide instantanément sur mobile durant les ateliers de recyclage numérique",toast_copied:"LIEN DE DISTRIBUTION COPIÉ!"},footer:{rights:"Tous droits réservés.",disclaimer:"Matériel de 2017 traitant l'IA de 2026. La connaissance est libre et évolutive.",brand:"PROJET DE SURVIE DU DOUBLE SILICIUM",q1:`"Obsolescence commerciale vaincue: GPU de 2017 exécutant de l'IA locale en 2026."`,q2:'"Serveur Xeon de 2014 produisant des créations SOTA avec RAM ECC unifiée."',note:`"Le silicium résiste.\\nOptimisez le logiciel d'abord."`,tech_label:"TECHNOLOGIES EN ACTION",authors_label:"COMPAGNONS ET RECIPIENDAIRES",copyright:"© 2026 AIVisionsLab. Tous droits réservés. / SAUVEGARDES GLOBALES",version_tag:"VULKAN_DEPLOY_V3.0_COMPLETO"},sections:Wa("fr",Vx)},"zh-CN":{dir:"ltr",meta:{title:"RX 580 + 本地 AI — 2026 权威指南 | AIVisionsLab",description:"通过 Vulkan 在 AMD Radeon RX 580 上加速本地人工智能的完整技术指南,搭配 Xeon E5-2690 v3 和 ECC 内存。",lang:"zh-CN"},nav:{languageLabel:"语言",github:"GitHub",theme:"主题",themeLight:"浅色",themeDark:"深色",brand:"硬件复兴 // 2026",subtitle:"RX 580 智能 — 统一主干文档",status:"VULKAN后端: 已激活"},sidebar:{title:"技术手册",search:"搜索章节...",sections:"章节",progress:"阅读进度",directory:"目录列表",syslog:"● 系统日志记录"},hero:{badge:"AIVisionsLab 实验室 · 2026",title:"RX 580 +",titleAccent:"本地 AI",subtitle:"通过 Vulkan 在 AMD Radeon RX 580 8GB 上加速人工智能的权威工程指南,搭配 Xeon E5-2690 v3 和 32GB ECC 内存。",cta:"开始阅读",ctaSecondary:"查看完整堆栈",stats:{gpu:"GPU",gpuValue:"RX 580 2048SP",cpu:"CPU",cpuValue:"Xeon E5-2690 v3",ram:"内存",ramValue:"32GB DDR4 ECC",storage:"存储",storageValue:"NVMe 1TB"}},share:{title:"分享",copy:"复制链接",copied:"链接已复制!",guerrilla_title:"开源极客分发部署 // 2026",guerrilla_desc:"技术应该属于全人类。突破厂商的计划性淘汰,帮助普及高价值的本地离线人工智能。",btn_copy_link:"复制主链接 🔗",btn_offline_html:"下载离线版 (.HTML) 💾",btn_pdf_print:"页面生成 PDF 并打印 🖨️",btn_qr_code:"共享用 QR 码 📱",qr_code_text:"在独立硬件沙龙现场,用手机扫此码可秒打开部署手册指南。",toast_copied:"共享分发链接复制成功!"},footer:{rights:"保留所有权利。",disclaimer:"2017 年的硬件处理 2026 年的 AI。知识是自由且不断进化的。",brand:"全球硬件再回收计划",q1:"“2017年发布的 AMD 显卡在2026年无需 CUDA、ROCm 及 DirectML 也能跑本地 AI。”",q2:"“2014年出产 of Xeon 至强核心依靠 32GB ECC 双路内存依然可以生产 2026 顶级艺术品。”",note:"“显卡从未有错,它渴望被发掘极限。”\\n“硬件复兴,新生而战ã€
19249‚”",tech_label:"构建技术",authors_label:"开源作者与伙伴列表",copyright:"© 2026 AIVisionsLab. 版权所有,保留所有权利。/ 全球资源保护及重用框架",version_tag:"VULKAN_DEPLOY_V3.0_COMPLETO"},sections:Wa("zh-CN",Gx)},de:{dir:"ltr",meta:{title:"RX 580 + Lokale KI — Definitiver Leitfaden 2026 | AIVisionsLab",description:"Vollständiger technischer Leitfaden zur lokalen Beschleunigung künstlicher Intelligenz auf der AMD Radeon RX 580 über Vulkan, mit Xeon E5-2690 v3 und ECC RAM.",lang:"de"},nav:{languageLabel:"Sprache",github:"GitHub",theme:"Thema",themeLight:"Hell",themeDark:"Dunkel",brand:"HARDWARE-REGENERATION // 2026",subtitle:"RX 580 IA — UNIFIZIERTE MASTER-DOKUMENTATION",status:"VULKAN-SUPPORT: AKTIV"},sidebar:{title:"Technisches Handbuch",search:"Abschnitt suchen...",sections:"Abschnitte",progress:"Lesefortschritt",directory:"Verzeichnis",syslog:"● SYSTEMPROTOKOLL"},hero:{badge:"Labor AIVisionsLab · 2026",title:"RX 580 +",titleAccent:"Lokale KI",subtitle:"Definitiver Leitfaden für die Beschleunigung lokaler künstlicher Intelligenz auf der AMD Radeon RX 580 8GB via Vulkan mit Xeon E5-2690 v3 und 32GB ECC-RAM.",cta:"Lesen starten",ctaSecondary:"Vollständigen Stack anzeigen",stats:{gpu:"GPU",gpuValue:"RX 580 2048SP",cpu:"CPU",cpuValue:"Xeon E5-2690 v3",ram:"RAM",ramValue:"32GB DDR4 ECC",storage:"Speicher",storageValue:"NVMe 1TB"}},share:{title:"Teilen",copy:"Link kopieren",copied:"Link kopiert!",guerrilla_title:"Hardware-Erhaltung & freie Verteilung der Dokumentation // 2026",guerrilla_desc:"Dieser Leitfaden konsolidiert Low-Level-Konfigurationen, Skripte und Optimierungsmethoden, um geplante Obsoleszenz zu bekämpfen und lokale, offline funktionierende KI zu ermöglichen.",btn_copy_link:"Dokumentations-Link kopieren 🔗",btn_offline_html:"Offline-Guide herunterladen (.HTML) 💾",btn_pdf_print:"PDF generieren / Drucken 🖨️",btn_qr_code:"QR-Code für Workshops 📱",qr_code_text:"Scannen Sie diesen Code, um das Handbuch während freier Hardware-Workshops sofort auf Mobilgeräten zu laden.",toast_copied:"DOKUMENTATIONSLINK ERFOLGREICH KOPIERT!"},footer:{rights:"Alle Rechte vorbehalten.",disclaimer:"Hardware von 2017 verarbeitet KI von 2026. Wissen ist frei evolutiv.",brand:"HARDWARE REVIVAL PROJECT",q1:'"AMD GPU von 2017 führt lokale KI im Jahr 2026 aus — ohne CUDA, ohne ROCm, sem DirectML."',q2:'"Xeon-Server von 2014 erzeugt SOTA-Kunst von 2026 mit 32GB ECC RDIMM."',note:'"Viele dem Erbe-Hardware zugeschriebene Einschränkungen resultieren aus dem Mangel an optimierter Software.\\nLegacy-Hardwaremodule behalten ihre Betriebsgrenzen durch offene Backends (Vulkan)."',tech_label:"TECHNOLOGIE",authors_label:"AUTOREN / ASSISTENTEN",copyright:"© 2026 AIVisionsLab. Alle Rechte vorbehalten. / GLOBAL REUSE PROJECT (RX 580 + XEON v3)",version_tag:"VULKAN_DEPLOY_V3.0_COMPLETO"},sections:Wa("de",Ux)},ru:{dir:"ltr",meta:{title:"RX 580 + Локальный ИИ — Полное руководство 2026 | AIVisionsLab",description:"Полное техническое руководство по локальному ускорению искусственного интеллекта на AMD Radeon RX 580 через Vulkan, с Xeon E5-2690 v3 и ECC RAM.",lang:"ru"},nav:{languageLabel:"Язык",github:"GitHub",theme:"Тема",themeLight:"Светлая",themeDark:"Темная",brand:"РЕГЕНЕРАЦИЯ ОБОРУДОВАНИЯ // 2026",subtitle:"RX 580 ИИ — ЕДИНАЯ МАСТЕР-ДОКУМЕНТАЦИЯ",status:"ПОДДЕРЖКА VULKAN: АКТИВНА"},sidebar:{title:"Техническое руководство",search:"Поиск раздела...",sections:"Разделы",progress:"Прогресс чтения",directory:"Содержание",syslog:"● СИСТЕМНЫЙ ЖУРНАЛ"},hero:{badge:"Лаборатория AIVisionsLab · 2026",title:"RX 580 +",titleAccent:"Локальный ИИ",subtitle:"Полное инженерное руководство по ускорению искусственного интеллекта на AMD Radeon RX 580 8GB через Vulkan, с Xeon E5-2690 v3 и 32GB ECC RAM.",cta:"Начать чтение",ctaSecondary:"Посмотреть весь стек",stats:{gpu:"Видеокарта",gpuValue:"RX 580 2048SP",cpu:"Процессор",cpuValue:"Xeon E5-2690 v3",ram:"Память",ramValue:"32GB DDR4 ECC",storage:"Накопитель",storageValue:"NVMe 1TB"}},share:{title:"Поделиться",copy:"Копировать ссылку",copied:"Ссылка скопирована!",guerrilla_title:"Сохранение железа и свободное распространение док
19249ументации // 2026",guerrilla_desc:"Это руководство объединяет низкоуровневые конфигурации, скрипты и методы оптимизации для борьбы с запланированным устареванием оборудования и обеспечения работы локального автономного ИИ.",btn_copy_link:"Копировать ссылку на руководство 🔗",btn_offline_html:"Скачать автономную версию (.HTML) 💾",btn_pdf_print:"Создать PDF / Печать 🖨️",btn_qr_code:"QR-код для воркшопов 📱",qr_code_text:"Отсканируйте этот код для мгновенной загрузки руководства на мобильных устройствах во время воркшопов по свободному оборудованию.",toast_copied:"ССЫЛКА НА ДОКУМЕНТАЦИЮ УСПЕШНО СКОПИРОВАНА!"},footer:{rights:"Все права защищены.",disclaimer:"Железо 2017 года обрабатывает ИИ 2026 года. Знание свободно и эволюционно.",brand:"HARDWARE REVIVAL PROJECT",q1:'"Видеокарта AMD 2017 года запускает локальный ИИ в 2026 году — без CUDA, без ROCm, без DirectML."',q2:'"Серверный Xeon 2014 года генерирует современное искусство SOTA 2026 года с 32 ГБ ECC RDIMM."',note:'"Многие ограничения, приписываемые старому оборудованию, возникают из-за отсутствия оптимизированного софта.\\nУнаследованные аппаратные модули сохраняют свою работоспособность благодаря открытым бэкендам (Vulkan)."',tech_label:"ТЕХНОЛОГИИ",authors_label:"АВТОРЫ / АССИСТЕНТЫ",copyright:"© 2026 AIVisionsLab. Все права защищены. / ПРОЕКТ ГЛОБАЛЬНОГО ПОВТОРНОГО ИСПОЛЬЗОВАНИЯ (RX 580 + XEON v3)",version_tag:"VULKAN_DEPLOY_V3.0_COMPLETO"},sections:Wa("ru",Bx)}},qx=()=>{};var e2={};/**
19250 * @license
19251 * Copyright 2017 Google LLC
19252 *
19253 * Licensed under the Apache License, Version 2.0 (the "License");
19254 * you may not use this file except in compliance with the License.
19255 * You may obtain a copy of the License at
19256 *
19257 *   http://www.apache.org/licenses/LICENSE-2.0
19258 *
19259 * Unless required by applicable law or agreed to in writing, software
19260 * distributed under the License is distributed on an "AS IS" BASIS,
19261 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19262 * See the License for the specific language governing permissions and
19263 * limitations under the License.
19264 */const $5=function(r){const e=[];let t=0;for(let o=0;o<r.length;o++){let a=r.charCodeAt(o);a<128?e[t++]=a:a<2048?(e[t++]=a>>6|192,e[t++]=a&63|128):(a&64512)===55296&&o+1<r.length&&(r.charCodeAt(o+1)&64512)===56320?(a=65536+((a&1023)<<10)+(r.charCodeAt(++o)&1023),e[t++]=a>>18|240,e[t++]=a>>12&63|128,e[t++]=a>>6&63|128,e[t++]=a&63|128):(e[t++]=a>>12|224,e[t++]=a>>6&63|128,e[t++]=a&63|128)}return e},Fx=function(r){const e=[];let t=0,o=0;for(;t<r.length;){const a=r[t++];if(a<128)e[o++]=String.fromCharCode(a);else if(a>191&&a<224){const d=r[t++];e[o++]=String.fromCharCode((a&31)<<6|d&63)}else if(a>239&&a<365){const d=r[t++],c=r[t++],g=r[t++],h=((a&7)<<18|(d&63)<<12|(c&63)<<6|g&63)-65536;e[o++]=String.fromCharCode(55296+(h>>10)),e[o++]=String.fromCharCode(56320+(h&1023))}else{const d=r[t++],c=r[t++];e[o++]=String.fromCharCode((a&15)<<12|(d&63)<<6|c&63)}}return e.join("")},J5={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,o=[];for(let a=0;a<r.length;a+=3){const d=r[a],c=a+1<r.length,g=c?r[a+1]:0,h=a+2<r.length,v=h?r[a+2]:0,_=d>>2,E=(d&3)<<4|g>>4;let M=(g&15)<<2|v>>
192646,G=v&63;h||(G=64,c||(M=64)),o.push(t[_],t[E],t[M],t[G])}return o.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray($5(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):Fx(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,o=[];for(let a=0;a<r.length;){const d=t[r.charAt(a++)],g=a<r.length?t[r.charAt(a)]:0;++a;const v=a<r.length?t[r.charAt(a)]:64;++a;const E=a<r.length?t[r.charAt(a)]:64;if(++a,d==null||g==null||v==null||E==null)throw new jx;const M=d<<2|g>>4;if(o.push(M),v!==64){const G=g<<4&240|v>>2;if(o.push(G),E!==64){const B=v<<6&192|E;o.push(B)}}}return o},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r<this.ENCODED_VALS.length;r++)this.byteToCharMap_[r]=this.ENCODED_VALS.charAt(r),this.charToByteMap_[this.byteToCharMap_[r]]=r,this.byteToCharMapWebSafe_[r]=this.ENCODED_VALS_WEBSAFE.charAt(r),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[r]]=r,r>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}};class jx extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Xx=function(r){const e=$5(r);return J5.encodeByteArray(e,!0)},xu=function(r){return Xx(r).replace(/\./g,"")},Z5=function(r){try{return J5.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
19265 * @license
19266 * Copyright 2022 Google LLC
19267 *
19268 * Licensed under the Apache License, Version 2.0 (the "License");
19269 * you may not use this file except in compliance with the License.
19270 * You may obtain a copy of the License at
19271 *
19272 *   http://www.apache.org/licenses/LICENSE-2.0
19273 *
19274 * Unless required by applicable law or agreed to in writing, software
19275 * distributed under the License is distributed on an "AS IS" BASIS,
19276 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19277 * See the License for the specific language governing permissions and
19278 * limitations under the License.
19279 */function Hx(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
19280 * @license
19281 * Copyright 2022 Google LLC
19282 *
19283 * Licensed under the Apache License, Version 2.0 (the "License");
19284 * you may not use this file except in compliance with the License.
19285 * You may obtain a copy of the License at
19286 *
19287 *   http://www.apache.org/licenses/LICENSE-2.0
19288 *
19289 * Unless required by applicable law or agreed to in writing, software
19290 * distributed under the License is distributed on an "AS IS" BASIS,
19291 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19292 * See the License for the specific language governing permissions and
19293 * limitations under the License.
19294 */const Wx=()=>Hx().__FIREBASE_DEFAULTS__,Kx=()=>{if(typeof process>"u"||typeof e2>"u")return;const r=e2.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},Qx=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=r&&Z5(r[1]);return e&&JSON.parse(e)},Xu=()=>{try{return qx()||Wx()||Kx()||Qx()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},ey=r=>{var e,t;return(t=(e=Xu())==null?void 0:e.emulatorHosts)==null?void 0:t[r]},Yx=r=>{const e=ey(r);if(!e)return;const t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const o=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),o]:[e.substring(0,t),o]},ty=()=>{var r;return(r=Xu())==null?void 0:r.config},ny=r=>{var e;return(e=Xu())==null?void 0:e[`_${r}`]};/**
19295 * @license
19296 * Copyright 2017 Google LLC
19297 *
19298 * Licensed under the Apache License, Version 2.0 (the "License");
19299 * you may not use this file except in compliance with the License.
19300 * You may obtain a copy of the License at
19301 *
19302 *   http://www.apache.org/licenses/LICENSE-2.0
19303 *
19304 * Unless required by applicable law or agreed to in writing, softw
19304are
19305 * distributed under the License is distributed on an "AS IS" BASIS,
19306 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19307 * See the License for the specific language governing permissions and
19308 * limitations under the License.
19309 */class $x{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,o)=>{t?this.reject(t):this.resolve(o),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,o))}}}/**
19310 * @license
19311 * Copyright 2021 Google LLC
19312 *
19313 * Licensed under the Apache License, Version 2.0 (the "License");
19314 * you may not use this file except in compliance with the License.
19315 * You may obtain a copy of the License at
19316 *
19317 *   http://www.apache.org/licenses/LICENSE-2.0
19318 *
19319 * Unless required by applicable law or agreed to in writing, software
19320 * distributed under the License is distributed on an "AS IS" BASIS,
19321 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19322 * See the License for the specific language governing permissions and
19323 * limitations under the License.
19324 */function Jx(r,e){if(r.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const t={alg:"none",type:"JWT"},o=e||"demo-project",a=r.iat||0,d=r.sub||r.user_id;if(!d)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const c={iss:`https://securetoken.google.com/${o}`,aud:o,iat:a,exp:a+3600,auth_time:a,sub:d,user_id:d,firebase:{sign_in_provider:"custom",identities:{}},...r};return[xu(JSON.stringify(t)),xu(JSON.stringify(c)),""].join(".")}/**
19325 * @license
19326 * Copyright 2017 Google LLC
19327 *
19328 * Licensed under the Apache License, Version 2.0 (the "License");
19329 * you may not use this file except in compliance with the License.
19330 * You may obtain a copy of the License at
19331 *
19332 *   http://www.apache.org/licenses/LICENSE-2.0
19333 *
19334 * Unless required by applicable law or agreed to in writing, software
19335 * distributed under the License is distributed on an "AS IS" BASIS,
19336 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19337 * See the License for the specific language governing permissions and
19338 * limitations under the License.
19339 */function Mn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Zx(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Mn())}function e7(){var e;const r=(e=Xu())==null?void 0:e.forceEnvironment;if(r==="node")return!0;if(r==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function t7(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function n7(){const r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function o7(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function s7(){const r=Mn();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function r7(){return!e7()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function a7(){try{return typeof indexedDB=="object"}catch{return!1}}function i7(){return new Promise((r,e)=>{try{let t=!0;const o="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(o);a.onsuccess=()=>{a.result.close(),t||self.indexedDB.deleteDatabase(o),r(!0)},a.onupgradeneeded=()=>{t=!1},a.onerror=()=>{var d;e(((d=a.error)==null?void 0:d.message)||"")}}catch(t){e(t)}})}/**
19340 * @license
19341 * Copyright 2017 Google LLC
19342 *
19343 * Licensed under the Apache License, Version 2.0 (the "License");
19344 * you may not use this file except in compliance with the License.
19345 * You may obtain a copy of the License at
19346 *
19347 *   http://www.apache.org/licenses/LICENSE-2.0
19348 *
19349 * Unless required by applicable law or agreed to in writing, software
19350 * distributed under the License is distributed on an "AS IS" BASIS,
19351 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19352 * See the License for the specific language governing permissions and
19353 * limitations under the License.
19354 */const l7="FirebaseError";
19354class ar extends Error{constructor(e,t,o){super(t),this.code=e,this.customData=o,this.name=l7,Object.setPrototypeOf(this,ar.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,gc.prototype.create)}}class gc{constructor(e,t,o){this.service=e,this.serviceName=t,this.errors=o}create(e,...t){const o=t[0]||{},a=`${this.service}/${e}`,d=this.errors[e],c=d?d7(d,o):"Error",g=`${this.serviceName}: ${c} (${a}).`;return new ar(a,g,o)}}function d7(r,e){return r.replace(c7,(t,o)=>{const a=e[o];return a!=null?String(a):`<${o}?>`})}const c7=/\{\$([^}]+)}/g;function m7(r){for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function ni(r,e){if(r===e)return!0;const t=Object.keys(r),o=Object.keys(e);for(const a of t){if(!o.includes(a))return!1;const d=r[a],c=e[a];if(t2(d)&&t2(c)){if(!ni(d,c))return!1}else if(d!==c)return!1}for(const a of o)if(!t.includes(a))return!1;return!0}function t2(r){return r!==null&&typeof r=="object"}/**
19355 * @license
19356 * Copyright 2017 Google LLC
19357 *
19358 * Licensed under the Apache License, Version 2.0 (the "License");
19359 * you may not use this file except in compliance with the License.
19360 * You may obtain a copy of the License at
19361 *
19362 *   http://www.apache.org/licenses/LICENSE-2.0
19363 *
19364 * Unless required by applicable law or agreed to in writing, software
19365 * distributed under the License is distributed on an "AS IS" BASIS,
19366 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19367 * See the License for the specific language governing permissions and
19368 * limitations under the License.
19369 */function fc(r){const e=[];for(const[t,o]of Object.entries(r))Array.isArray(o)?o.forEach(a=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(a))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(o));return e.length?"&"+e.join("&"):""}function u7(r,e){const t=new p7(r,e);return t.subscribe.bind(t)}class p7{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(o=>{this.error(o)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,o){let a;if(e===void 0&&t===void 0&&o===void 0)throw new Error("Missing Observer.");g7(e,["next","error","complete"])?a=e:a={next:e,error:t,complete:o},a.next===void 0&&(a.next=_f),a.error===void 0&&(a.error=_f),a.complete===void 0&&(a.complete=_f);const d=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?a.error(this.finalError):a.complete()}catch{}}),this.observers.push(a),d}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(o){typeof console<"u"&&console.error&&console.error(o)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function g7(r,e){if(typeof r!="object"||r===null)return!1;for(const t of e)if(t in r&&typeof r[t]=="function")return!0;return!1}function _f(){}/**
19370 * @license
19371 * Copyright 2021 Google LLC
19372 *
19373 * Licensed under the Apache License, Version 2.0 (the "License");
19374 * you may not use this file except in compliance with the License.
19375 * You may obtain a copy of the License at
19376 *
19377 *   http://www.apache.org/licenses/LICENSE-2.0
19378 *
19379 * Unless required by applicable law or agreed to in writing, software
19380 * distributed under the License is distributed on an "AS IS" BASIS,
19381 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19382 * See the License for the specific language governing permissions and
19383 * limitations under the License.
19384 */function _n(r){return r&&r._delegate?r._delegate:r}/**
19385 * @license
19386 * Copyright 2025 Google LLC
19387 *
19388 * Licensed under the Apache License, Version 2.0 (the "License");
19389 * you may not use this file except in compliance with the License.
19390 * You may obtain a copy of the License at
19391 *
19392 *   http://www.apache.org/licenses/LICENSE-2.0
19393 *
19394 * Unless required by applicable law or agreed to in writing, software
19395 * distributed under the License is distributed on an "AS IS" BASIS,
19396 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19397 * See the License for the specific language governing permissions and
19398 * limitations under the License.
19399 */function hc(r){try{return(r.startsWith("http://")||r.startsWith("https://")?new URL(r).hostname:r).endsWith(".cloudworkstations.dev")}catch{return!1}}async function oy(r){return(await fetch(r,{credentials:"include"})).ok}class oi{constructor(e,t,o){this.name=e,this.instanceFactory=t,this.type=o,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
19400 * @license
19401 * Copyright 2019 Google LLC
19402 *
19403 * Licensed under the Apache License, Version 2.0 (the "License");
19404 * you may not use this file except in compliance with the License.
19405 * You may obtain a copy of the License at
19406 *
19407 *   http://www.apache.org/licenses/LICENSE-2.0
19408 *
19409 * Unless required by applicable law or agreed to in writing, software
19410 * distributed under the License is distributed on an "AS IS" BASIS,
19411 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19412 * See the License for the specific language governing permissions and
19413 * limitations under the License.
19414 */const Ka="[DEFAULT]";/**
19415 * @license
19416 * Copyright 2019 Google LLC
19417 *
19418 * Licensed under the Apache License, Version 2.0 (the "License");
19419 * you may not use this file except in compliance with the License.
19420 * You may obtain a copy of the License at
19421 *
19422 *   http://www.apache.org/licenses/LICENSE-2.0
19423 *
19424 * Unless required by applicable law or agreed to in writing, software
19425 * distributed under the License is distributed on an "AS IS" BASIS,
19426 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19427 * See the License for the specific language governing permissions and
19428 * limitations under the License.
19429 */class f7{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const o=new $x;if(this.instancesDeferred.set(t,o),this.isInitialized(t)||this.shouldAutoInitialize())try{const a=this.getOrInitializeService({instanceIdentifier:t});a&&o.resolve(a)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){const t=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),o=(e==null?void 0:e.optional)??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(a){if(o)return null;throw a}else{if(o)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(v7(e))try{this.getOrInitializeService({instanceIdentifier:Ka})}catch{}for(const[t,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(t);try{const d=this.getOrInitializeService({instanceIdentifier:a});o.resolve(d)}catch{}}}}clearInstance(e=Ka){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=Ka){return this.instances.has(e)}getOptions(e=Ka){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,o=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(o))throw Error(`${this.name}(${o}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const a=this.getOrInitializeService({instanceIdentifier:o,options:t});for(const[d,c]of this.instancesDeferred.entries()){const g=this.normalizeInstanceIdentifier(d);o===g&&c.resolve(a)}return a}onInit(e,t){const o=this.normalizeInstanceIdentifier(t),a=this.onInitCallbacks.get(o)??new Set;a.add(e),this.onInitCallbacks.set(o,a);const d=this.instances.get(o);return d&&e(d,o),()=>{a.delete(e)}}invokeOnInitCallbacks(e,t){const o=this.onInitCallbacks.get(t);if(o)for(const a of o)try{a(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let o=this.instances.get(e);if(!o&&this.component&&(o=this.component.instanceFactory(this.container,{instanceIdentifier:h7(e),options:t}),this.instances.set(e,o),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(o,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,o)}catch{}return o||null}normalizeInstanceIdentifier(e=Ka){return this.component?this.component.multipleInstances?e:Ka:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function h7(r){return r===Ka?void 0:r}function v7(r){return r.instantiationMode==="EAGER"}/**
19430 * @license
19431 * Copyright 2019 Google LLC
19432 *
19433 * Licensed under the Apache License, Version 2.0 (the "License");
19434 * you may not use this file except in compliance with the License.
19435 * You may obtain a copy of the License at
19436 *
19437 *   http://www.apache.org/licenses/LICENSE-2.0
19438 *
19439 * Unless required by applicable law or agreed to in writing, software
19440 * distributed under the License is distributed on an "AS IS" BASIS,
19441 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19442 * See the License for the specific language governing permissions and
19443 * limitations under the License.
19444 */class b7{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new f7(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
19445 * @license
19446 * Copyright 2017 Google LLC
19447 *
19448 * Licensed under the Apache License, Version 2.0 (the "License");
19449 * you may not use this file except in compliance with the License.
19450 * You may obtain a copy of the License at
19451 *
19452 *   http://www.apache.org/licenses/LICENSE-2.0
19453 *
19454 * Unless required by applicable law or agreed to in writing, software
19455 * distributed under the License is distributed on an "AS IS" BASIS,
19456 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19457 * See the License for the specific language governing permissions and
19458 * limitations under the License.
19459 */var st;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(st||(st={}));const y7={debug:st.DEBUG,verbose:st.VERBOSE,info:st.INFO,warn:st.WARN,error:st.ERROR,silent:st.SILENT},x7=st.INFO,A7={[st.DEBUG]:"log",[st.VERBOSE]:"log",[st.INFO]:"info",[st.WARN]:"warn",[st.ERROR]:"error"},_7=(r,e,...t)=>{if(e<r.logLevel)return;const o=new Date().toISOString(),a=A7[e];if(a)console[a](`[${o}]  ${r.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class ph{constructor(e){this.name=e,this._logLevel=x7,this._logHandler=_7,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in st))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?y7[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,st.DEBUG,...e),this._logHandler(this,st.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,st.VERBOSE,...e),this._logHandler(this,st.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,st.INFO,...e),this._logHandler(this,st.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,st.WARN,...e),this._logHandler(this,st.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,st.ERROR,...e),this._logHandler(this,st.ERROR,...e)}}const w7=(r,e)=>e.some(t=>r instanceof t);let n2,o2;function E7(){return n2||(n2=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function S7(){return o2||(o2=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const sy=new WeakMap,Uf=new WeakMap,ry=new WeakMap,wf=new WeakMap,gh=new WeakMap;function k7(r){const e=new Promise((t,o)=>{const a=()=>{r.removeEventListener("success",d),r.removeEventListener("error",c)},d=()=>{t(Kr(r.result)),a()},c=()=>{o(r.error),a()};r.addEventListener("success",d),r.addEventListener("error",c)});return e.then(t=>{t instanceof IDBCursor&&sy.set(t,r)}).catch(()=>{}),gh.set(e,r),e}function C7(r){if(Uf.has(r))return;const e=new Promise((t,o)=>{const a=()=>{r.removeEventListener("complete",d),r.removeEventListener("error",c),r.removeEventListener("abort",c)},d=()=>{t(),a()},c=()=>{o(r.error||new DOMException("AbortError","AbortError")),a()};r.addEventListener("complete",d),r.addEventListener("error",c),r.addEventListener("abort",c)});Uf.set(r,e)}let Bf={get(r,e,t){if(r instanceof IDBTransaction){if(e==="done")return Uf.get(r);if(e==="objectStoreNames")return r.objectStoreNames||ry.get(r);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return Kr(r[e])},set(r,e,t){return r[e]=t,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function R7(r){Bf=r(Bf)}function D7(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const o=r.call(Ef(this),e,...t);return ry.set(o,e.sort?e.sort():[e]),Kr(o)}
19459:S7().includes(r)?function(...e){return r.apply(Ef(this),e),Kr(sy.get(this))}:function(...e){return Kr(r.apply(Ef(this),e))}}function M7(r){return typeof r=="function"?D7(r):(r instanceof IDBTransaction&&C7(r),w7(r,E7())?new Proxy(r,Bf):r)}function Kr(r){if(r instanceof IDBRequest)return k7(r);if(wf.has(r))return wf.get(r);const e=M7(r);return e!==r&&(wf.set(r,e),gh.set(e,r)),e}const Ef=r=>gh.get(r);function T7(r,e,{blocked:t,upgrade:o,blocking:a,terminated:d}={}){const c=indexedDB.open(r,e),g=Kr(c);return o&&c.addEventListener("upgradeneeded",h=>{o(Kr(c.result),h.oldVersion,h.newVersion,Kr(c.transaction),h)}),t&&c.addEventListener("blocked",h=>t(h.oldVersion,h.newVersion,h)),g.then(h=>{d&&h.addEventListener("close",()=>d()),a&&h.addEventListener("versionchange",v=>a(v.oldVersion,v.newVersion,v))}).catch(()=>{}),g}const I7=["get","getKey","getAll","getAllKeys","count"],O7=["put","add","delete","clear"],Sf=new Map;function s2(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(Sf.get(e))return Sf.get(e);const t=e.replace(/FromIndex$/,""),o=e!==t,a=O7.includes(t);if(!(t in(o?IDBIndex:IDBObjectStore).prototype)||!(a||I7.includes(t)))return;const d=async function(c,...g){const h=this.transaction(c,a?"readwrite":"readonly");let v=h.store;return o&&(v=v.index(g.shift())),(await Promise.all([v[t](...g),a&&h.done]))[0]};return Sf.set(e,d),d}R7(r=>({...r,get:(e,t,o)=>s2(e,t)||r.get(e,t,o),has:(e,t)=>!!s2(e,t)||r.has(e,t)}));/**
19460 * @license
19461 * Copyright 2019 Google LLC
19462 *
19463 * Licensed under the Apache License, Version 2.0 (the "License");
19464 * you may not use this file except in compliance with the License.
19465 * You may obtain a copy of the License at
19466 *
19467 *   http://www.apache.org/licenses/LICENSE-2.0
19468 *
19469 * Unless required by applicable law or agreed to in writing, software
19470 * distributed under the License is distributed on an "AS IS" BASIS,
19471 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19472 * See the License for the specific language governing permissions and
19473 * limitations under the License.
19474 */class P7{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(z7(t)){const o=t.getImmediate();return`${o.library}/${o.version}`}else return null}).filter(t=>t).join(" ")}}function z7(r){const e=r.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Gf="@firebase/app",r2="0.15.0";/**
19475 * @license
19476 * Copyright 2019 Google LLC
19477 *
19478 * Licensed under the Apache License, Version 2.0 (the "License");
19479 * you may not use this file except in compliance with the License.
19480 * You may obtain a copy of the License at
19481 *
19482 *   http://www.apache.org/licenses/LICENSE-2.0
19483 *
19484 * Unless required by applicable law or agreed to in writing, software
19485 * distributed under the License is distributed on an "AS IS" BASIS,
19486 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19487 * See the License for the specific language governing permissions and
19488 * limitations under the License.
19489 */const tr=new ph("@firebase/app"),L7="@firebase/app-compat",N7="@firebase/analytics-compat",V7="@firebase/analytics",U7="@firebase/app-check-compat",B7="@firebase/app-check",G7="@firebase/auth",q7="@firebase/auth-compat",F7="@firebase/database",j7="@firebase/data-connect",X7="@firebase/database-compat",H7="@firebase/functions",W7="@firebase/functions-compat",K7="@firebase/installations",Q7="@firebase/installations-compat",Y7="@firebase/messaging",$7="@firebase/messaging-compat",J7="@firebase/performance",Z7="@firebase/performance-compat",e9="@firebase/remote-config",t9="@firebase/remote-config-compat",n9="@firebase/storage",o9="@firebase/storage-compat",s9="@firebase/firestore",r9="@firebase/ai",a9="@firebase/firestore-compat",i9="firebase",l9="12.15.0";/**
19490 * @license
19491 * Copyright 2019 Google LLC
19492 *
19493 * Licensed under the Apache License, Version 2.0 (the "License");
19494 * you may not use this file except in compliance with the License.
19495 * You may obtain a copy of the License at
19496 *
19497 *   http://www.apache.org/licenses/LICENSE-2.0
19498 *
19499 * Unless required by applicable law or agreed to in writing, softw
19499are
19500 * distributed under the License is distributed on an "AS IS" BASIS,
19501 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19502 * See the License for the specific language governing permissions and
19503 * limitations under the License.
19504 */const qf="[DEFAULT]",d9={[Gf]:"fire-core",[L7]:"fire-core-compat",[V7]:"fire-analytics",[N7]:"fire-analytics-compat",[B7]:"fire-app-check",[U7]:"fire-app-check-compat",[G7]:"fire-auth",[q7]:"fire-auth-compat",[F7]:"fire-rtdb",[j7]:"fire-data-connect",[X7]:"fire-rtdb-compat",[H7]:"fire-fn",[W7]:"fire-fn-compat",[K7]:"fire-iid",[Q7]:"fire-iid-compat",[Y7]:"fire-fcm",[$7]:"fire-fcm-compat",[J7]:"fire-perf",[Z7]:"fire-perf-compat",[e9]:"fire-rc",[t9]:"fire-rc-compat",[n9]:"fire-gcs",[o9]:"fire-gcs-compat",[s9]:"fire-fst",[a9]:"fire-fst-compat",[r9]:"fire-vertex","fire-js":"fire-js",[i9]:"fire-js-all"};/**
19505 * @license
19506 * Copyright 2019 Google LLC
19507 *
19508 * Licensed under the Apache License, Version 2.0 (the "License");
19509 * you may not use this file except in compliance with the License.
19510 * You may obtain a copy of the License at
19511 *
19512 *   http://www.apache.org/licenses/LICENSE-2.0
19513 *
19514 * Unless required by applicable law or agreed to in writing, software
19515 * distributed under the License is distributed on an "AS IS" BASIS,
19516 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19517 * See the License for the specific language governing permissions and
19518 * limitations under the License.
19519 */const Au=new Map,c9=new Map,Ff=new Map;function a2(r,e){try{r.container.addComponent(e)}catch(t){tr.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,t)}}function cl(r){const e=r.name;if(Ff.has(e))return tr.debug(`There were multiple attempts to register component ${e}.`),!1;Ff.set(e,r);for(const t of Au.values())a2(t,r);for(const t of c9.values())a2(t,r);return!0}function fh(r,e){const t=r.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),r.container.getProvider(e)}function vs(r){return r==null?!1:r.settings!==void 0}/**
19520 * @license
19521 * Copyright 2019 Google LLC
19522 *
19523 * Licensed under the Apache License, Version 2.0 (the "License");
19524 * you may not use this file except in compliance with the License.
19525 * You may obtain a copy of the License at
19526 *
19527 *   http://www.apache.org/licenses/LICENSE-2.0
19528 *
19529 * Unless required by applicable law or agreed to in writing, software
19530 * distributed under the License is distributed on an "AS IS" BASIS,
19531 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19532 * See the License for the specific language governing permissions and
19533 * limitations under the License.
19534 */const m9={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invali
19534d-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Qr=new gc("app","Firebase",m9);/**
19535 * @license
19536 * Copyright 2019 Google LLC
19537 *
19538 * Licensed under the Apache License, Version 2.0 (the "License");
19539 * you may not use this file except in compliance with the License.
19540 * You may obtain a copy of the License at
19541 *
19542 *   http://www.apache.org/licenses/LICENSE-2.0
19543 *
19544 * Unless required by applicable law or agreed to in writing, software
19545 * distributed under the License is distributed on an "AS IS" BASIS,
19546 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19547 * See the License for the specific language governing permissions and
19548 * limitations under the License.
19549 */class u9{constructor(e,t,o){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=o,this.container.addComponent(new oi("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Qr.create("app-deleted",{appName:this._name})}}/**
19550 * @license
19551 * Copyright 2019 Google LLC
19552 *
19553 * Licensed under the Apache License, Version 2.0 (the "License");
19554 * you may not use this file except in compliance with the License.
19555 * You may obtain a copy of the License at
19556 *
19557 *   http://www.apache.org/licenses/LICENSE-2.0
19558 *
19559 * Unless required by applicable law or agreed to in writing, software
19560 * distributed under the License is distributed on an "AS IS" BASIS,
19561 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19562 * See the License for the specific language governing permissions and
19563 * limitations under the License.
19564 */const xl=l9;function ay(r,e={}){let t=r;typeof e!="object"&&(e={name:e});const o={name:qf,automaticDataCollectionEnabled:!0,...e},a=o.name;if(typeof a!="string"||!a)throw Qr.create("bad-app-name",{appName:String(a)});if(t||(t=ty()),!t)throw Qr.create("no-options");const d=Au.get(a);if(d){if(ni(t,d.options)&&ni(o,d.config))return d;throw Qr.create("duplicate-app",{appName:a})}const c=new b7(a);for(const h of Ff.values())c.addComponent(h);const g=new u9(t,o,c);return Au.set(a,g),g}function iy(r=qf){const e=Au.get(r);if(!e&&r===qf&&ty())return ay();if(!e)throw Qr.create("no-app",{appName:r});return e}function Yr(r,e,t){let o=d9[r]??r;t&&(o+=`-${t}`);const a=o.match(/\s|\//),d=e.match(/\s|\//);if(a||d){const c=[`Unable to register library "${o}" with version "${e}":`];a&&c.push(`library name "${o}" contains illegal characters (whitespace or "/")`),a&&d&&c.push("and"),d&&c.push(`version name "${e}" contains illegal characters (whitespace or "/")`),tr.warn(c.join(" "));return}cl(new oi(`${o}-version`,()=>({library:o,version:e}),"VERSION"))}/**
19565 * @license
19566 * Copyright 2021 Google LLC
19567 *
19568 * Licensed under the Apache License, Version 2.0 (the "License");
19569 * you may not use this file except in compliance with the License.
19570 * You may obtain a copy of the License at
19571 *
19572 *   http://www.apache.org/licenses/LICENSE-2.0
19573 *
19574 * Unless required by applicable law or agreed to in writing, softw
19574are
19575 * distributed under the License is distributed on an "AS IS" BASIS,
19576 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19577 * See the License for the specific language governing permissions and
19578 * limitations under the License.
19579 */const p9="firebase-heartbeat-database",g9=1,Qd="firebase-heartbeat-store";let kf=null;function ly(){return kf||(kf=T7(p9,g9,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(Qd)}catch(t){console.warn(t)}}}}).catch(r=>{throw Qr.create("idb-open",{originalErrorMessage:r.message})})),kf}async function f9(r){try{const t=(await ly()).transaction(Qd),o=await t.objectStore(Qd).get(dy(r));return await t.done,o}catch(e){if(e instanceof ar)tr.warn(e.message);else{const t=Qr.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});tr.warn(t.message)}}}async function i2(r,e){try{const o=(await ly()).transaction(Qd,"readwrite");await o.objectStore(Qd).put(e,dy(r)),await o.done}catch(t){if(t instanceof ar)tr.warn(t.message);else{const o=Qr.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});tr.warn(o.message)}}}function dy(r){return`${r.name}!${r.options.appId}`}/**
19580 * @license
19581 * Copyright 2021 Google LLC
19582 *
19583 * Licensed under the Apache License, Version 2.0 (the "License");
19584 * you may not use this file except in compliance with the License.
19585 * You may obtain a copy of the License at
19586 *
19587 *   http://www.apache.org/licenses/LICENSE-2.0
19588 *
19589 * Unless required by applicable law or agreed to in writing, software
19590 * distributed under the License is distributed on an "AS IS" BASIS,
19591 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19592 * See the License for the specific language governing permissions and
19593 * limitations under the License.
19594 */const h9=1024,v9=30;class b9{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new x9(t),this._heartbeatsCachePromise=this._storage.read().then(o=>(this._heartbeatsCache=o,o))}async triggerHeartbeat(){var e,t;try{const a=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),d=l2();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===d||this._heartbeatsCache.heartbeats.some(c=>c.date===d))return;if(this._heartbeatsCache.heartbeats.push({date:d,agent:a}),this._heartbeatsCache.heartbeats.length>v9){const c=A9(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(c,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(o){tr.warn(o)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const t=l2(),{heartbeatsToSend:o,unsentEntries:a}=y9(this._heartbeatsCache.heartbeats),d=xu(JSON.stringify({version:2,heartbeats:o}));return this._heartbeatsCache.lastSentHeartbeatDate=t,a.length>0?(this._heartbeatsCache.heartbeats=a,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),d}catch(t){return tr.warn(t),""}}}function l2(){return new Date().toISOString().substring(0,10)}function y9(r,e=h9){const t=[];let o=r.slice();for(const a of r){const d=t.find(c=>c.agent===a.agent);if(d){if(d.dates.push(a.date),d2(t)>e){d.dates.pop();break}}else if(t.push({agent:a.agent,dates:[a.date]}),d2(t)>e){t.pop();break}o=o.slice(1)}return{heartbeatsToSend:t,unsentEntries:o}}class x9{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return a7()?i7().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await f9(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const o=await this.read();return i2(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??o.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const o=await this.read();return i2(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??o.lastSentHeartbeatDate,heartbeats:[...o.heartbeats,...e.heartbeats]})}else return}}function d2(r){return xu(JSON.stringify({version:2,heartbeats:r})).length}function A9(r){if(r.length===0)return-1;let e=0,t=r[0].date;for(let o=1;o<r.length;o++)r[o].date<t&&(t=r[o].date,e=o);return e}/**
19595 * @license
19596 * Copyright 2019 Google LLC
19597 *
19598 * Licensed under the Apache License, Version 2.0 (the "License");
19599 * you may not use this file except in compliance with the License.
19600 * You may obtain a copy of the License at
19601 *
19602 *   http://www.apache.org/licenses/LICENSE-2.0
19603 *
19604 * Unless required by applicable law or agreed to in writing, software
19605 * distributed under the License is distributed on an "AS IS" BASIS,
19606 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19607 * See the License for the specific language governing permissions and
19608 * limitations under the License.
19609 */function _9(r){cl(new oi("platform-logger",e=>new P7(e),"PRIVATE")),cl(new oi("heartbeat",e=>new b9(e),"PRIVATE")),Yr(Gf,r2,r),Yr(Gf,r2,"esm2020"),Yr("fire-js","")}_9("");var c2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
19610Copyright The Closure Library Authors.
19611SPDX-License-Identifier: Apache-2.0
19612*/var $r,cy;(function(){var r;/** @license
19613
19614 Copyright The Closure Library Authors.
19615 SPDX-License-Identifier: Apache-2.0
19616*/function e(w,C){function T(){}T.prototype=C.prototype,w.F=C.prototype,w.prototype=new T,w.prototype.constructor=w,w.D=function(z,O,N){for(var D=Array(arguments.length-2),_e=2;_e<arguments.length;_e++)D[_e-2]=arguments[_e];return C.prototype[O].apply(z,D)}}function t(){this.blockSize=-1}function o(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}e(o,t),o.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function a(w,C,T){T||(T=0);const z=Array(16);if(typeof C=="string")for(var O=0;O<16;++O)z[O]=C.charCodeAt(T++)|C.charCodeAt(T++)<<8|C.charCodeAt(T++)<<16|C.charCodeAt(T++)<<24;else for(O=0;O<16;++O)z[O]=C[T++]|C[T++]<<8|C[T++]<<16|C[T++]<<24;C=w.g[0],T=w.g[1],O=w.g[2];let N=w.g[3],D;D=C+(N^T&(O^N))+z[0]+3614090360&4294967295,C=T+(D<<7&4294967295|D>>>25),D=N+(O^C&(T^O))+z[1]+3905402710&4294967295,N=C+(D<<12&4294967295|D>>>20),D=O+(T^N&(C^T))+z[2]+606105819&4294967295,O=N+(D<<17&4294967295|D>>>15),D=T+(C^O&(N^C))+z[3]+3250441966&4294967295,T=O+(D<<22&4294967295|D>>>10),D=C+(N^T&(O^N))+z[4]+4118548399&4294967295,C=T+(D<<7&4294967295|D>>>25),D=N+(O^C&(T^O))+z[5]+1200080426&4294967295,N=C+(D<<12&4294967295|D>>>20),D=O+(T^N&(C^T))+z[6]+2821735955&4294967295,O=N+(D<<17&4294967295|D>>>15),D=T+(C^O&(N^C))+z[7]+4249261313&4294967295,T=O+(D<<22&4294967295|D>>>10),D=C+(N^T&(O^N))+z[8]+1770035416&4294967295,C=T+(D<<7&4294967295|D>>>25),D=N+(O^C&(T^O))+z[9]+2336552879&4294967295,N=C+(D<<12&4294967295|D>>>20),D=O+(T^N&(C^T))+z[10]+4294925233&4294967295,O=N+(D<<17&4294967295|D>>>15),D=T+(C^O&(N^C))+z[11]+2304563134&4294967295,T=O+(D<<22&4294967295|D>>>10),D=C+(N^T&(O^N))+z[12]+1804603682&4294967295,C=T+(D<<7&4294967295|D>>>25),D=N+(O^C&(T^O))+z[13]+4254626195&4294967295,N=C+(D<<12&4294967295|D>>>20),D=O+(T^N&(C^T))+z[14]+2792965006&4294967295,O=N+(D<<17&4294967295|D>>>15),D=T+(C^O&(N^C))+z[15]+1236535329&4294967295,T=O+(D<<22&4294967295|D>>>10),D=C+(O^N&(T^O))+z[1]+4129170786&4294967295,C=T+(D<<5&4294967295|D>>>27),D=N+(T^O&(C^T))+z[6]+3225465664&4294967295,N=C+(D<<9&4294967295|D>>>23),D=O+(C^T&(N^C))+z[11]+643717713&4294967295,O=N+(D<<14&4294967295|D>>>18),D=T+(N^C&(O^N))+z[0]+3921069994&4294967295,T=O+(D<<20&4294967295|D>>>12),D=C+(O^N&(T^O))+z[5]+3593408605&4294967295,C=T+(D<<5&4294967295|D>>>27),D=N+(T^O&(C^T))+z[10]+38016083&4294967295,N=C+(D<<9&4294967295|D>>>23),D=O+(C^T&(N^C))+z[15]+3634488961&4294967295,O=N+(D<<14&4294967295|D>>>18),D=T+(N^C&(O^N))+z[4]+3889429448&4294967295,T=O+(D<<20&4294967295|D>>>12),D=C+(O^N&(T^O))+z[9]+568446438&4294967295,C=T+(D<<5&4294967295|D>>>27),D=N+(T^O&(C^T))+z[14]+3275163606&4294967295,N=C+(D<<9&4294967295|D>>>23),D=O+(C^T&(N^C))+z[3]+4107603335&4294967295,O=N+(D<<14&4294967295|D>>>18),D=T+(N^C&(O^N))+z[8]+1163531501&4294967295,T=O+(D<<20&4294967295|D>>>12),D=C+(O^N&(T^O))+z[13]+2850285829&4294967295,C=T+(D<<5&4294967295|D>>>27),D=N+(T^O&(C^T))+z[2]+4243563512&4294967295,N=C+(D<<9&4294967295|D>>>23),D=O+(C^T&(N^C))+z[7]+1735328473&4294967295,O=N+(D<<14&4294967295|D>>>18),D=T+(N^C&(O^N))+z[12]+2368359562&4294967295,T=O+(D<<20&4294967295|D>>>12),D=C+(T^O^N)+z[5]+4294588738&4294967295,C=T+(D<<4&4294967295|D>>>28),D=N+(C^T^O)+z[8]+2272392833&4294967295,N=C+(D<<11&4294967295|D>>>21),D=O+(N^C^T)+z[11]+1839030562&4294967295,O=N+(D<<16&4294967295|D>>>16),D=T+(O^N^C)+z[14]+4259657740&4294967295,T=O+(D<<23&4294967295|D>>>9),D=C+(T^O^N)+z[1]+2763975236&4294967295,C=T+(D<<4&4294967295|D>>>28),D=N+(C^T^O)+z[4]+1272893353&4294967295,N=C+(D<<11&4294967295|D>>>21),D=O+(N^C^T)+z[7]+4139469664&4294967295,O=N+(D<<16&4294967295|D>>>16),D=T+(O^N^C)+z[10]+3200236656&4294967295,T=O+(D<<23&4294967295|D>>>9),D=C+(T^O^N)+z[13]+681279174&4294967295,C=T+(D<<4&4294967295|D>>>28),D=N+(C^T^O)+z[0]+3936430074&4294967295,N=C+(D<<11&4294967295|D>>>21),D=O+(N^C^T)+z[3]+3572445317&4294967295,O=N+(D<<16&4294967295|D>>>16),D=T+(O^N^C)+z[6]+76029189&4294967295,T=O+(D<<23&4294967295|D>>>9),D=C+(T^O^N)+z[9]+3654602809&4294967295,C=T+(D<<4&4294967295|D>>>28),D=N+(C^T^O)+z[12]+3873151461&4294967295,N=C+(D<<11&4294967295|D>>>21),D=O+(N^C^T)+z[15]+530742520&4294967295,O=N+(D<<16&4294967295|D>>>16),D=T+(O^N^C)+z[2]+3299628645&4294967295,T=O+(D<<23&4294967295|D>>>9),D=C+(O^(T|~N))+z[0]+4096336452&4294967295,C=T+(D<<6&4294967295|D>>>26),D=N+(T^(C|~O))+z[7]+1126891415&4294967295,N=C+(D<<10&4294967295|D>>>22),D=O+(C^(N|~T))+z[14]+2878612391&4294967295,O=N+(D<<15&4294967295|D>>>17),D=T+(N^(O|~C))+z[5]+4237533241&4294967295,T=O+(D<<21&4294967295|D>>>11),D=C+(O^(T|~N))+z[12]+1700485571&4294967295,C=T+(D<<6&4294967295|D>>>26),D=N+(T^(C|~O))+z[3]+2399980690&4294967295,N=C+(D<<10&4294967295|D>>>22),D=O+(C^(N|~T))+z[10]+4293915773&4294967295,O=N+(D<<15&4294967295|D>>>17),D=T+(N^(O|~C))+z[1]+2240044497&4294967295,T=O+(D<<21&4294967295|D>>>11),D=C+(O^(T|~N))+z[8]+1873313359&4294967295,C=T+(D<<6&4294967295|D>>>26),D=N+(T^(C|~O))+z[15]+4264355552&4294967295,N=C+(D<<10&4294967295|D>>>22),D=O+(C^(N|~T))+z[6]+2734768916&4294967295,O=N+(D<<15&4294967295|D>>>17),D=T+(N^(O|~C))+z[13]+1309151649&4294967295,T=O+(D<<21&4294967295|D>>>11),D=C+(O^(T|~N))+z[4]+4149444226&4294967295,C=T+(D<<6&4294967295|D>>>26),D=N+(T^(C|~O))+z[11]+3174756917&4294967295,N=C+(D<<10&4294967295|D>>>22),D=O+(C^(N|~T))+z[2]+718787259&4294967295,O=N+(D<<15&4294967295|D>>>17),D=T+(N^(O|~C))+z[9]+3951481745&4294967295,w.g[0]=w.g[0]+C&4294967295,w.g[1]=w.g[1]+(O+(D<<21&4294967295|D>>>11))&4294967295,w.g[2]=w.g[2]+O&4294967295,w.g[3]=w.g[3]+N&4294967295}o.prototype.v=function(w,C){C===void 0&&(C=w.length);const T=C-this.blockSize,z=this.C;let O=this.h,N=0;for(;N<C;){if(O==0)for(;N<=T;)a(this,w,N),N+=this.blockSize;if(typeof w=="string"){for(;N<C;)if(z[O++]=w.charCodeAt(N++),O==this.blockSize){a(this,z),O=0;break}}else for(;N<C;)if(z[O++]=w[N++],O==this.blockSize){a(this,z),O=0;break}}this.h=O,this.o+=C},o.prototype.A=function(){var w=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);w[0]=128;for(var C=1;C<w.length-8;++C)w[C]=0;C=this.o*8;for(var T=w.length-8;T<w.length;++T)w[T]=C&255,C/=256;for(this.v(w),w=Array(16),C=0,T=0;T<4;++T)for(let z=0;z<32;
19616z+=8)w[C++]=this.g[T]>>>z&255;return w};function d(w,C){var T=g;return Object.prototype.hasOwnProperty.call(T,w)?T[w]:T[w]=C(w)}function c(w,C){this.h=C;const T=[];let z=!0;for(let O=w.length-1;O>=0;O--){const N=w[O]|0;z&&N==C||(T[O]=N,z=!1)}this.g=T}var g={};function h(w){return-128<=w&&w<128?d(w,function(C){return new c([C|0],C<0?-1:0)}):new c([w|0],w<0?-1:0)}function v(w){if(isNaN(w)||!isFinite(w))return E;if(w<0)return ie(v(-w));const C=[];let T=1;for(let z=0;w>=T;z++)C[z]=w/T|0,T*=4294967296;return new c(C,0)}function _(w,C){if(w.length==0)throw Error("number format error: empty string");if(C=C||10,C<2||36<C)throw Error("radix out of range: "+C);if(w.charAt(0)=="-")return ie(_(w.substring(1),C));if(w.indexOf("-")>=0)throw Error('number format error: interior "-" character');const T=v(Math.pow(C,8));let z=E;for(let N=0;N<w.length;N+=8){var O=Math.min(8,w.length-N);const D=parseInt(w.substring(N,N+O),C);O<8?(O=v(Math.pow(C,O)),z=z.j(O).add(v(D))):(z=z.j(T),z=z.add(v(D)))}return z}var E=h(0),M=h(1),G=h(16777216);r=c.prototype,r.m=function(){if(ee(this))return-ie(this).m();let w=0,C=1;for(let T=0;T<this.g.length;T++){const z=this.i(T);w+=(z>=0?z:4294967296+z)*C,C*=4294967296}return w},r.toString=function(w){if(w=w||10,w<2||36<w)throw Error("radix out of range: "+w);if(B(this))return"0";if(ee(this))return"-"+ie(this).toString(w);const C=v(Math.pow(w,6));var T=this;let z="";for(;;){const O=tt(T,C).g;T=ve(T,O.j(C));let N=((T.g.length>0?T.g[0]:T.h)>>>0).toString(w);if(T=O,B(T))return N+z;for(;N.length<6;)N="0"+N;z=N+z}},r.i=function(w){return w<0?0:w<this.g.length?this.g[w]:this.h};function B(w){if(w.h!=0)return!1;for(let C=0;C<w.g.length;C++)if(w.g[C]!=0)return!1;return!0}function ee(w){return w.h==-1}r.l=function(w){return w=ve(this,w),ee(w)?-1:B(w)?0:1};function ie(w){const C=w.g.length,T=[];for(let z=0;z<C;z++)T[z]=~w.g[z];return new c(T,~w.h).add(M)}r.abs=function(){return ee(this)?ie(this):this},r.add=function(w){const C=Math.max(this.g.length,w.g.length),T=[];let z=0;for(let O=0;O<=C;O++){let N=z+(this.i(O)&65535)+(w.i(O)&65535),D=(N>>>16)+(this.i(O)>>>16)+(w.i(O)>>>16);z=D>>>16,N&=65535,D&=65535,T[O]=D<<16|N}return new c(T,T[T.length-1]&-2147483648?-1:0)};function ve(w,C){return w.add(ie(C))}r.j=function(w){if(B(this)||B(w))return E;if(ee(this))return ee(w)?ie(this).j(ie(w)):ie(ie(this).j(w));if(ee(w))return ie(this.j(ie(w)));if(this.l(G)<0&&w.l(G)<0)return v(this.m()*w.m());const C=this.g.length+w.g.length,T=[];for(var z=0;z<2*C;z++)T[z]=0;for(z=0;z<this.g.length;z++)for(let O=0;O<w.g.length;O++){const N=this.i(z)>>>16,D=this.i(z)&65535,_e=w.i(O)>>>16,he=w.i(O)&65535;T[2*z+2*O]+=D*he,Se(T,2*z+2*O),T[2*z+2*O+1]+=N*he,Se(T,2*z+2*O+1),T[2*z+2*O+1]+=D*_e,Se(T,2*z+2*O+1),T[2*z+2*O+2]+=N*_e,Se(T,2*z+2*O+2)}for(w=0;w<C;w++)T[w]=T[2*w+1]<<16|T[2*w];for(w=C;w<2*C;w++)T[w]=0;return new c(T,0)};function Se(w,C){for(;(w[C]&65535)!=w[C];)w[C+1]+=w[C]>>>16,w[C]&=65535,C++}function Me(w,C){this.g=w,this.h=C}function tt(w,C){if(B(C))throw Error("division by zero");if(B(w))return new Me(E,E);if(ee(w))return C=tt(ie(w),C),new Me(ie(C.g),ie(C.h));if(ee(C))return C=tt(w,ie(C)),new Me(ie(C.g),C.h);if(w.g.length>30){if(ee(w)||ee(C))throw Error("slowDivide_ only works with positive integers.");for(var T=M,z=C;z.l(w)<=0;)T=Ye(T),z=Ye(z);var O=qe(T,1),N=qe(z,1);for(z=qe(z,2),T=qe(T,2);!B(z);){var D=N.add(z);D.l(w)<=0&&(O=O.add(T),N=D),z=qe(z,1),T=qe(T,1)}return C=ve(w,O.j(C)),new Me(O,C)}for(O=E;w.l(C)>=0;){for(T=Math.max(1,Math.floor(w.m()/C.m())),z=Math.ceil(Math.log(T)/Math.LN2),z=z<=48?1:Math.pow(2,z-48),N=v(T),D=N.j(C);ee(D)||D.l(w)>0;)T-=z,N=v(T),D=N.j(C);B(N)&&(N=M),O=O.add(N),w=ve(w,D)}return new Me(O,w)}r.B=function(w){return tt(this,w).h},r.and=function(w){const C=Math.max(this.g.length,w.g.length),T=[];for(let z=0;z<C;z++)T[z]=this.i(z)&w.i(z);return new c(T,this.h&w.h)},r.or=function(w){const C=Math.max(this.g.length,w.g.length),T=[];for(let z=0;z<C;z++)T[z]=this.i(z)|w.i(z);return new c(T,this.h|w.h)},r.xor=function(w){const C=Math.max(this.g.length,w.g.length),T=[];for(let z=0;z<C;z++)T[z]=this.i(z)^w.i(z);return new c(T,this.h^w.h)};function Ye(w){const C=w.g.length+1,T=[];for(let z=0;z<C;z++)T[z]=w.i(z)<<1|w.i(z-1)>>>31;return new c(T,w.h)}function qe(w,C){const T=C>>5;C%=32;const z=w.g.length-T,O=[];for(let N=0;N<z;N++)O[N]=C>0?w.i(N+T)>>>C|w.i(N+T+1)<<32-C:w.i(N+T);return new c(O,w.h)}o.prototype.digest=o.prototype.A,o.prototype.reset=o.prototype.u,o.prototype.update=o.prototype.v,cy=o,c.prototype.add=c.prototype.add,c.prototype.multiply=c.prototype.j,c.prototype.modulo=c.prototype.B,c.prototype.compare=c.prototype.l,c.prototype.toNumber=c.prototype.m,c.prototype.toString=c.prototype.toString,c.prototype.getBits=c.prototype.i,c.fromNumber=v,c.fromString=_,$r=c}).apply(typeof c2<"u"?c2:typeof self<"u"?self:typeof window<"u"?window:{});var nu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
19617Copyright The Closure Library Authors.
19618SPDX-License-Identifier: Apache-2.0
19619*/var my,zd,uy,cu,jf,py,gy,fy;(function(){var r,e=Object.defineProperty;function t(m){m=[typeof globalThis=="object"&&globalThis,m,typeof window=="object"&&window,typeof self=="object"&&self,typeof nu=="object"&&nu];for(var b=0;b<m.length;++b){var x=m[b];if(x&&x.Math==Math)return x}throw Error("Cannot find global object")}var o=t(this);function a(m,b){if(b)e:{var x=o;m=m.split(".");for(var k=0;k<m.length-1;k++){var q=m[k];if(!(q in x))break e;x=x[q]}m=m[m.length-1],k=x[m],b=b(k),b!=k&&b!=null&&e(x,m,{configurable:!0,writable:!0,value:b})}}a("Symbol.dispose",function(m){return m||Symbol("Symbol.dispose")}),a("Array.prototype.values",function(m){return m||function(){return this[Symbol.iterator]()}}),a("Object.entries",function(m){return m||function(b){var x=[],k;for(k in b)Object.prototype.hasOwnProperty.call(b,k)&&x.push([k,b[k]]);return x}});/** @license
19620
19621 Copyright The Closure Library Authors.
19622 SPDX-License-Identifier: Apache-2.0
19623*/var d=d||{},c=this||self;function g(m){var b=typeof m;return b=="object"&&m!=null||b=="function"}
19623function h(m,b,x){return m.call.apply(m.bind,arguments)}function v(m,b,x){return v=h,v.apply(null,arguments)}function _(m,b){var x=Array.prototype.slice.call(arguments,1);return function(){var k=x.slice();return k.push.apply(k,arguments),m.apply(this,k)}}function E(m,b){function x(){}x.prototype=b.prototype,m.Z=b.prototype,m.prototype=new x,m.prototype.constructor=m,m.Ob=function(k,q,W){for(var ue=Array(arguments.length-2),je=2;je<arguments.length;je++)ue[je-2]=arguments[je];return b.prototype[q].apply(k,ue)}}var M=typeof AsyncContext<"u"&&typeof AsyncContext.Snapshot=="function"?m=>m&&AsyncContext.Snapshot.wrap(m):m=>m;function G(m){const b=m.length;if(b>0){const x=Array(b);for(let k=0;k<b;k++)x[k]=m[k];return x}return[]}function B(m,b){for(let k=1;k<arguments.length;k++){const q=arguments[k];var x=typeof q;if(x=x!="object"?x:q?Array.isArray(q)?"array":x:"null",x=="array"||x=="object"&&typeof q.length=="number"){x=m.length||0;const W=q.length||0;m.length=x+W;for(let ue=0;ue<W;ue++)m[x+ue]=q[ue]}else m.push(q)}}class ee{constructor(b,x){this.i=b,this.j=x,this.h=0,this.g=null}get(){let b;return this.h>0?(this.h--,b=this.g,this.g=b.next,b.next=null):b=this.i(),b}}function ie(m){c.setTimeout(()=>{throw m},0)}function ve(){var m=w;let b=null;return m.g&&(b=m.g,m.g=m.g.next,m.g||(m.h=null),b.next=null),b}class Se{constructor(){this.h=this.g=null}add(b,x){const k=Me.get();k.set(b,x),this.h?this.h.next=k:this.g=k,this.h=k}}var Me=new ee(()=>new tt,m=>m.reset());class tt{constructor(){this.next=this.g=this.h=null}set(b,x){this.h=b,this.g=x,this.next=null}reset(){this.next=this.g=this.h=null}}let Ye,qe=!1,w=new Se,C=()=>{const m=Promise.resolve(void 0);Ye=()=>{m.then(T)}};function T(){for(var m;m=ve();){try{m.h.call(m.g)}catch(x){ie(x)}var b=Me;b.j(m),b.h<100&&(b.h++,m.next=b.g,b.g=m)}qe=!1}function z(){this.u=this.u,this.C=this.C}z.prototype.u=!1,z.prototype.dispose=function(){this.u||(this.u=!0,this.N())},z.prototype[Symbol.dispose]=function(){this.dispose()},z.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function O(m,b){this.type=m,this.g=this.target=b,this.defaultPrevented=!1}O.prototype.h=function(){this.defaultPrevented=!0};var N=(function(){if(!c.addEventListener||!Object.defineProperty)return!1;var m=!1,b=Object.defineProperty({},"passive",{get:function(){m=!0}});try{const x=()=>{};c.addEventListener("test",x,b),c.removeEventListener("test",x,b)}catch{}return m})();function D(m){return/^[\s\xa0]*$/.test(m)}function _e(m,b){O.call(this,m?m.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,m&&this.init(m,b)}E(_e,O),_e.prototype.init=function(m,b){const x=this.type=m.type,k=m.changedTouches&&m.changedTouches.length?m.changedTouches[0]:null;this.target=m.target||m.srcElement,this.g=b,b=m.relatedTarget,b||(x=="mouseover"?b=m.fromElement:x=="mouseout"&&(b=m.toElement)),this.relatedTarget=b,k?(this.clientX=k.clientX!==void 0?k.clientX:k.pageX,this.clientY=k.clientY!==void 0?k.clientY:k.pageY,this.screenX=k.screenX||0,this.screenY=k.screenY||0):(this.clientX=m.clientX!==void 0?m.clientX:m.pageX,this.clientY=m.clientY!==void 0?m.clientY:m.pageY,this.screenX=m.screenX||0,this.screenY=m.screenY||0),this.button=m.button,this.key=m.key||"",this.ctrlKey=m.ctrlKey,this.altKey=m.altKey,this.shiftKey=m.shiftKey,this.metaKey=m.metaKey,this.pointerId=m.pointerId||0,this.pointerType=m.pointerType,this.state=m.state,this.i=m,m.defaultPrevented&&_e.Z.h.call(this)},_e.prototype.h=function(){_e.Z.h.call(this);const m=this.i;m.preventDefault?m.preventDefault():m.returnValue=!1};var he="closure_listenable_"+(Math.random()*1e6|0),K=0;function ce(m,b,x,k,q){this.listener=m,this.proxy=null,this.src=b,this.type=x,this.capture=!!k,this.ha=q,this.key=++K,this.da=this.fa=!1}function ae(m){m.da=!0,m.listener=null,m.proxy=null,m.src=null,m.ha=null}function ke(m,b,x){for(const k in m)b.call(x,m[k],k,m)}function Ve(m,b){for(const x in m)b.call(void 0,m[x],x,m)}function P(m){const b={};for(const x in m)b[x]=m[x];return b}const Z="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
19623ing toString valueOf".split(" ");function me(m,b){let x,k;for(let q=1;q<arguments.length;q++){k=arguments[q];for(x in k)m[x]=k[x];for(let W=0;W<Z.length;W++)x=Z[W],Object.prototype.hasOwnProperty.call(k,x)&&(m[x]=k[x])}}function be(m){this.src=m,this.g={},this.h=0}be.prototype.add=function(m,b,x,k,q){const W=m.toString();m=this.g[W],m||(m=this.g[W]=[],this.h++);const ue=Ue(m,b,k,q);return ue>-1?(b=m[ue],x||(b.fa=!1)):(b=new ce(b,this.src,W,!!k,q),b.fa=x,m.push(b)),b};function Pe(m,b){const x=b.type;if(x in m.g){var k=m.g[x],q=Array.prototype.indexOf.call(k,b,void 0),W;(W=q>=0)&&Array.prototype.splice.call(k,q,1),W&&(ae(b),m.g[x].length==0&&(delete m.g[x],m.h--))}}function Ue(m,b,x,k){for(let q=0;q<m.length;++q){const W=m[q];if(!W.da&&W.listener==b&&W.capture==!!x&&W.ha==k)return q}return-1}var $e="closure_lm_"+(Math.random()*1e6|0),Pt={};function wt(m,b,x,k,q){if(Array.isArray(b)){for(let W=0;W<b.length;W++)wt(m,b[W],x,k,q);return null}return x=dr(x),m&&m[he]?m.J(b,x,g(k)?!!k.capture:!1,q):Ho(m,b,x,!1,k,q)}function Ho(m,b,x,k,q,W){if(!b)throw Error("Invalid event type");const ue=g(q)?!!q.capture:!!q;let je=Wo(m);if(je||(m[$e]=je=new be(m)),x=je.add(b,x,k,ue,W),x.proxy)return x;if(k=Cs(),x.proxy=k,k.src=m,k.listener=x,m.addEventListener)N||(q=ue),q===void 0&&(q=!1),m.addEventListener(b.toString(),k,q);else if(m.attachEvent)m.attachEvent($n(b.toString()),k);else if(m.addListener&&m.removeListener)m.addListener(k);else throw Error("addEventListener and attachEvent are unavailable.");return x}function Cs(){function m(x){return b.call(m.src,m.listener,x)}const b=ir;return m}function Rs(m,b,x,k,q){if(Array.isArray(b))for(var W=0;W<b.length;W++)Rs(m,b[W],x,k,q);else k=g(k)?!!k.capture:!!k,x=dr(x),m&&m[he]?(m=m.i,W=String(b).toString(),W in m.g&&(b=m.g[W],x=Ue(b,x,k,q),x>-1&&(ae(b[x]),Array.prototype.splice.call(b,x,1),b.length==0&&(delete m.g[W],m.h--)))):m&&(m=Wo(m))&&(b=m.g[b.toString()],m=-1,b&&(m=Ue(b,x,k,q)),(x=m>-1?b[m]:null)&&Ds(x))}function Ds(m){if(typeof m!="number"&&m&&!m.da){var b=m.src;if(b&&b[he])Pe(b.i,m);else{var x=m.type,k=m.proxy;b.removeEventListener?b.removeEventListener(x,k,m.capture):b.detachEvent?b.detachEvent($n(x),k):b.addListener&&b.removeListener&&b.removeListener(k),(x=Wo(b))?(Pe(x,m),x.h==0&&(x.src=null,b[$e]=null)):ae(m)}}}function $n(m){return m in Pt?Pt[m]:Pt[m]="on"+m}function ir(m,b){if(m.da)m=!0;else{b=new _e(b,this);const x=m.listener,k=m.ha||m.src;m.fa&&Ds(m),m=x.call(k,b)}return m}function Wo(m){return m=m[$e],m instanceof be?m:null}var lr="__closure_events_fn_"+(Math.random()*1e9>>>0);function dr(m){return typeof m=="function"?m:(m[lr]||(m[lr]=function(b){return m.handleEvent(b)}),m[lr])}function Tt(){z.call(this),this.i=new be(this),this.M=this,this.G=null}E(Tt,z),Tt.prototype[he]=!0,Tt.prototype.removeEventListener=function(m,b,x,k){Rs(this,m,b,x,k)};function zt(m,b){var x,k=m.G;if(k)for(x=[];k;k=k.G)x.push(k);if(m=m.M,k=b.type||b,typeof b=="string")b=new O(b,m);else if(b instanceof O)b.target=b.target||m;else{var q=b;b=new O(k,m),me(b,q)}q=!0;let W,ue;if(x)for(ue=x.length-1;ue>=0;ue--)W=b.g=x[ue],q=Do(W,k,!0,b)&&q;if(W=b.g=m,q=Do(W,k,!0,b)&&q,q=Do(W,k,!1,b)&&q,x)for(ue=0;ue<x.length;ue++)W=b.g=x[ue],q=Do(W,k,!1,b)&&q}Tt.prototype.N=function(){if(Tt.Z.N.call(this),this.i){var m=this.i;for(const b in m.g){const x=m.g[b];for(let k=0;k<x.length;k++)ae(x[k]);delete m.g[b],m.h--}}this.G=null},Tt.prototype.J=function(m,b,x,k){return this.i.add(String(m),b,!1,x,k)},Tt.prototype.K=function(m,b,x,k){return this.i.add(String(m),b,!0,x,k)};function Do(m,b,x,k){if(b=m.i.g[String(b)],!b)return!0;b=b.concat();let q=!0;for(let W=0;W<b.length;++W){const ue=b[W];if(ue&&!ue.da&&ue.capture==x){const je=ue.listener,Bt=ue.ha||ue.src;ue.fa&&Pe(m.i,ue),q=je.call(Bt,k)!==!1&&q}}return q&&!k.defaultPrevented}function ci(m,b){if(typeof m!="function")if(m&&typeof m.handleEvent=="function")m=v(m.handleEvent,m);else throw Error("Invalid listener argument");return Number(b)>2147483647?-1:c.setTimeout(m,b||0)}function ne(m){m.g=ci(()=>{m.g=null,m.i&&(m.i=!1,ne(m))},m.l);const b=m.h;m.h=null,m.m.apply(null,b)}class le extends z{constructor(b,x){super(),this.m=b,this.l=x,this.h=null,this.i=!1,this.g=null}j(b){this.h=arguments,this.g?this.i=!0:ne(this)}N(){super.N(),this.g&&(c.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Fe(m){z.call(this),this.h=m,this.g={}}E(Fe,z);var vt=[];function Jn(m){ke(m.g,function(b,x){this.g.hasOwnProperty(x)&&Ds(b)},m),m.g={}}Fe.prototype.N=function(){Fe.Z.N.call(this),Jn(this)},Fe.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var gn=c.JSON.stringify,Ko=c.JSON.parse,va=class{stringify(m){return c.JSON.stringify(m,void 0)}parse(m){return c.JSON.parse(m,void 0)}};function ba(){}function Ml(){}var Mo={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function fn(){O.call(this,"d")}E(fn,O);function po(){O.call(this,"c")}E(po,O);var Ut={},Tc=null;function mi(){return Tc=Tc||new Tt}Ut.Ia="serverreachability";function Ic(m){O.call(this,Ut.Ia,m)}E(Ic,O);function Qo(m){const b=mi();zt(b,new Ic(b))}Ut.STAT_EVENT="statevent";function ya(m,b){O.call(this,Ut.STAT_EVENT,m),this.stat=b}E(ya,O);function Xt(m){const b=mi();zt(b,new ya(b,m))}Ut.Ja="timingevent";function Yo(m,b){O.call(this,Ut.Ja,m),this.size=b}E(Yo,O);function $o(m,b){if(typeof m!="function")throw Error("Fn must not be null and must be a function");return c.setTimeout(function(){m()},b)}function To(){this.g=!0}To.prototype.ua=function(){this.g=!1};function yp(m,b,x,k,q,W){m.info(function(){if(m.g)if(W){var ue="",je=W.split("&");for(let ct=0;ct<je.length;ct++){var Bt=je[ct].split("=");if(Bt.length>1){const Rt=Bt[0];Bt=Bt[1];const vo=Rt.split("_");ue=vo.length>=2&&vo[1]=="type"?ue+(Rt+"="+Bt+"&"):ue+(Rt+"=redacted&")}}}else ue=null;else ue=W;return"XMLHTTP REQ ("+k+") [attempt "+q+"]: "+b+`
19624`+x+`
19625`+ue})}function Oc(m,b,x,k,q,W,ue){m.info(function(){return"XMLHTTP RESP ("+k+") [ attempt "+q+"]: "+b+`
19626`+x+`
19627`+W+" "+ue})}function Jo(m,b,x,k){m.info(function(){return"XMLHTTP TEXT ("+b+"): "+xp(m,x)+(k?" "+k:"")})}function xa(m,b){m.info(function(){return"TIMEOUT: "+b})}To.prototype.info=function(){};function xp(m,b){if(!m.g)return b;if(!b)return null;try{const W=JSON.parse(b);if(W){for(m=0;m<W.length;m++)if(Array.isArray(W[m])){var x=W[m];if(!(x.length<2)){var k=x[1];if(Array.isArray(k)&&!(k.length<1)){var q=k[0];if(q!="noop"&&q!="stop"&&q!="close")for(let ue=1;ue<k.length;ue++)k[ue]=""}}}}return gn(W)}catch{return b}}var Aa={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},Tl={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"},Il;function _a(){}E(_a,ba),_a.prototype.g=function(){return new XMLHttpRequest},Il=new _a;function Ms(m){return encodeURIComponent(String(m))}function Pc(m){var b=1;m=m.split(":");const x=[];for(;b>0&&m.length;)x.push(m.shift()),b--;return m.length&&x.push(m.join(":")),x}function Io(m,b,x,k){this.j=m,this.i=b,this.l=x,this.S=k||1,this.V=new Fe(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Oo}function Oo(){this.i=null,this.g="",this.h=!1}var Ht={},dn={};function Zo(m,b,x){m.M=1,m.A=wa(Kt(b)),m.u=x,m.R=!0,ui(m,null)}function ui(m,b){m.F=Date.now(),es(m),m.B=Kt(m.A);var x=m.B,k=m.S;Array.isArray(k)||(k=[String(k)]),hi(x.i,"t",k),m.C=0,x=m.j.L,m.h=new Oo,m.g=Qc(m.j,x?b:null,!m.u),m.P>0&&(m.O=new le(v(m.Y,m,m.g),m.P)),b=m.V,x=m.g,k=m.ba;var q="readystatechange";Array.isArray(q)||(q&&(vt[0]=q.toString()),q=vt);for(let W=0;W<q.length;W++){const ue=wt(x,q[W],k||b.handleEvent,!1,b.h||b);if(!ue)break;b.g[ue.key]=ue}b=m.J?P(m.J):{},m.u?(m.v||(m.v="POST"),b["Content-Type"]="application/x-www-form-urlencoded",m.g.ea(m.B,m.v,m.u,b)):(m.v="GET",m.g.ea(m.B,m.v,null,b)),Qo(),yp(m.i,m.v,m.B,m.l,m.S,m.u)}Io.prototype.ba=function(m){m=m.target;const b=this.O;b&&Lo(m)==3?b.j():this.Y(m)},Io.prototype.Y=function(m){try{if(m==this.g)e:{const je=Lo(this.g),Bt=this.g.ya(),ct=this.g.ca();if(!(je<3)&&(je!=3||this.g&&(this.h.h||this.g.la()||hn(this.g)))){this.K||je!=4||Bt==7||(Bt==8||ct<=0?Qo(3):Qo(2)),ts(this);var b=this.g.ca();this.X=b;var x=Ap(this);if(this.o=b==200,Oc(this.i,this.v,this.B,this.l,this.S,je,b),this.o){if(this.U&&!this.L){t:{if(this.g){var k,q=this.g;if((k=q.g?q.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!D(k)){var W=k;break t}}W=null}if(m=W)Jo(this.i,this.l,m,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,ns(this,m);else{this.o=!1,this.m=3,Xt(12),Zn(this),go(this);break e}}if(this.R){m=!0;let Rt;
19627for(;!this.K&&this.C<x.length;)if(Rt=Lc(this,x),Rt==dn){je==4&&(this.m=4,Xt(14),m=!1),Jo(this.i,this.l,null,"[Incomplete Response]");break}else if(Rt==Ht){this.m=4,Xt(15),Jo(this.i,this.l,x,"[Invalid Chunk]"),m=!1;break}else Jo(this.i,this.l,Rt,null),ns(this,Rt);if(zc(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),je!=4||x.length!=0||this.h.h||(this.m=1,Xt(16),m=!1),this.o=this.o&&m,!m)Jo(this.i,this.l,x,"[Invalid Chunked Response]"),Zn(this),go(this);else if(x.length>0&&!this.W){this.W=!0;var ue=this.j;ue.g==this&&ue.aa&&!ue.P&&(ue.j.info("Great, no buffering proxy detected. Bytes received: "+x.length),Wl(ue),ue.P=!0,Xt(11))}}else Jo(this.i,this.l,x,null),ns(this,x);je==4&&Zn(this),this.o&&!this.K&&(je==4?Xc(this.j,this):(this.o=!1,es(this)))}else Is(this.g),b==400&&x.indexOf("Unknown SID")>0?(this.m=3,Xt(12)):(this.m=0,Xt(13)),Zn(this),go(this)}}}catch{}finally{}};function Ap(m){if(!zc(m))return m.g.la();const b=hn(m.g);if(b==="")return"";let x="";const k=b.length,q=Lo(m.g)==4;if(!m.h.i){if(typeof TextDecoder>"u")return Zn(m),go(m),"";m.h.i=new c.TextDecoder}for(let W=0;W<k;W++)m.h.h=!0,x+=m.h.i.decode(b[W],{stream:!(q&&W==k-1)});return b.length=0,m.h.g+=x,m.C=0,m.h.g}function zc(m){return m.g?m.v=="GET"&&m.M!=2&&m.j.Aa:!1}function Lc(m,b){var x=m.C,k=b.indexOf(`
19628`,x);return k==-1?dn:(x=Number(b.substring(x,k)),isNaN(x)?Ht:(k+=1,k+x>b.length?dn:(b=b.slice(k,k+x),m.C=k+x,b)))}Io.prototype.cancel=function(){this.K=!0,Zn(this)};function es(m){m.T=Date.now()+m.H,pi(m,m.H)}function pi(m,b){if(m.D!=null)throw Error("WatchDog timer not null");m.D=$o(v(m.aa,m),b)}function ts(m){m.D&&(c.clearTimeout(m.D),m.D=null)}Io.prototype.aa=function(){this.D=null;const m=Date.now();m-this.T>=0?(xa(this.i,this.B),this.M!=2&&(Qo(),Xt(17)),Zn(this),this.m=2,go(this)):pi(this,this.T-m)};function go(m){m.j.I==0||m.K||Xc(m.j,m)}function Zn(m){ts(m);var b=m.O;b&&typeof b.dispose=="function"&&b.dispose(),m.O=null,Jn(m.V),m.g&&(b=m.g,m.g=null,b.abort(),b.dispose())}function ns(m,b){try{var x=m.j;if(x.I!=0&&(x.g==m||ss(x.h,m))){if(!m.L&&ss(x.h,m)&&x.I==3){try{var k=x.Ba.g.parse(b)}catch{k=null}if(Array.isArray(k)&&k.length==3){var q=k;if(q[0]==0){e:if(!x.v){if(x.g)if(x.g.F+3e3<m.F)Ai(x),vr(x);else break e;Ma(x),Xt(18)}}else x.xa=q[1],0<x.xa-x.K&&q[2]<37500&&x.F&&x.A==0&&!x.C&&(x.C=$o(v(x.Va,x),6e3));os(x.h)<=1&&x.ta&&(x.ta=void 0)}else cs(x,11)}else if((m.L||x.g==m)&&Ai(x),!D(b))for(q=x.Ba.g.parse(b),b=0;b<q.length;b++){let ct=q[b];const Rt=ct[0];if(!(Rt<=x.K))if(x.K=Rt,ct=ct[1],x.I==2)if(ct[0]=="c"){x.M=ct[1],x.ba=ct[2];const vo=ct[3];vo!=null&&(x.ka=vo,x.j.info("VER="+x.ka));const ms=ct[4];ms!=null&&(x.za=ms,x.j.info("SVER="+x.za));const No=ct[5];No!=null&&typeof No=="number"&&No>0&&(k=1.5*No,x.O=k,x.j.info("backChannelRequestTimeoutMs_="+k)),k=x;const Vo=m.g;if(Vo){const Ta=Vo.g?Vo.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Ta){var W=k.h;W.g||Ta.indexOf("spdy")==-1&&Ta.indexOf("quic")==-1&&Ta.indexOf("h2")==-1||(W.j=W.l,W.g=new Set,W.h&&(zl(W,W.h),W.h=null))}if(k.G){const _i=Vo.g?Vo.g.getResponseHeader("X-HTTP-Session-Id"):null;_i&&(k.wa=_i,gt(k.J,k.G,_i))}}x.I=3,x.l&&x.l.ra(),x.aa&&(x.T=Date.now()-m.F,x.j.info("Handshake RTT: "+x.T+"ms")),k=x;var ue=m;if(k.na=Kc(k,k.L?k.ba:null,k.W),ue.L){Ll(k.h,ue);var je=ue,Bt=k.O;Bt&&(je.H=Bt),je.D&&(ts(je),es(je)),k.g=ue}else Fc(k);x.i.length>0&&ds(x)}else ct[0]!="stop"&&ct[0]!="close"||cs(x,7);else x.I==3&&(ct[0]=="stop"||ct[0]=="close"?ct[0]=="stop"?cs(x,7):Xl(x):ct[0]!="noop"&&x.l&&x.l.qa(ct),x.A=0)}}Qo(4)}catch{}}var Wt=class{constructor(m,b){this.g=m,this.map=b}};function Ol(m){this.l=m||10,c.PerformanceNavigationTiming?(m=c.performance.getEntriesByType("navigation"),m=m.length>0&&(m[0].nextHopProtocol=="hq"||m[0].nextHopProtocol=="h2")):m=!!(c.chrome&&c.chrome.loadTimes&&c.chrome.loadTimes()&&c.chrome.loadTimes().wasFetchedViaSpdy),this.j=m?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function Pl(m){return m.h?!0:m.g?m.g.size>=m.j:!1}function os(m){return m.h?1:m.g?m.g.size:0}function ss(m,b){return m.h?m.h==b:m.g?m.g.has(b):!1}function zl(m,b){m.g?m.g.add(b):m.h=b}function Ll(m,b){m.h&&m.h==b?m.h=null:m.g&&m.g.has(b)&&m.g.delete(b)}Ol.prototype.cancel=function(){if(this.i=Nl(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const m of this.g.values())m.cancel();this.g.clear()}};function Nl(m){if(m.h!=null)return m.i.concat(m.h.G);if(m.g!=null&&m.g.size!==0){let b=m.i;for(const x of m.g.values())b=b.concat(x.G);return b}return G(m.i)}var Nc=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function gi(m,b){if(m){m=m.split("&");for(let x=0;x<m.length;x++){const k=m[x].indexOf("=");let q,W=null;k>=0?(q=m[x].substring(0,k),W=m[x].substring(k+1)):q=m[x],b(q,W?decodeURIComponent(W.replace(/\+/g," ")):"")}}}function eo(m){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let b;m instanceof eo?(this.l=m.l,cn(this,m.j),this.o=m.o,this.g=m.g,cr(this,m.u),this.h=m.h,Vl(this,Gc(m.i)),this.m=m.m):m&&(b=String(m).match(Nc))?(this.l=!1,cn(this,b[1]||"",!0),this.o=rs(b[2]||""),this.g=rs(b[3]||"",!0),cr(this,b[4]),this.h=rs(b[5]||"",!0),Vl(this,b[6]||"",!0),this.m=rs(b[7]||"")):(this.l=!1,this.i=new ur(null,this.l))}eo.prototype.toString=function(){const m=[];var b=this.j;b&&m.push(Ea(b,fi,!0),":");var x=this.g;return(x||b=="file")&&(m.push("//"),(b=this.o)&&m.push(Ea(b,fi,!0),"@"),m.push(Ms(x).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),x=this.u,x!=null&&m.push(":",String(x))),(x=this.h)&&(this.g&&x.charAt(0)!="/"&&m.push("/"),m.push(Ea(x,x.charAt(0)=="/"?Ul:Vc,!0))),(x=this.i.toString())&&m.push("?",x),(x=this.m)&&m.push("#",Ea(x,Uc)),m.join("")},eo.prototype.resolve=function(m){const b=Kt(this);let x=!!m.j;x?cn(b,m.j):x=!!m.o,x?b.o=m.o:x=!!m.g,x?b.g=m.g:x=m.u!=null;var k=m.h;if(x)cr(b,m.u);else if(x=!!m.h){if(k.charAt(0)!="/")if(this.g&&!this.h)k="/"+k;else{var q=b.h.lastIndexOf("/");q!=-1&&(k=b.h.slice(0,q+1)+k)}if(q=k,q==".."||q==".")k="";else if(q.indexOf("./")!=-1||q.indexOf("/.")!=-1){k=q.lastIndexOf("/",0)==0,q=q.split("/");const W=[];for(let ue=0;ue<q.length;){const je=q[ue++];je=="."?k&&ue==q.length&&W.push(""):je==".."?((W.length>1||W.length==1&&W[0]!="")&&W.pop(),k&&ue==q.length&&W.push("")):(W.push(je),k=!0)}k=W.join("/")}else k=q}
19628return x?b.h=k:x=m.i.toString()!=="",x?Vl(b,Gc(m.i)):x=!!m.m,x&&(b.m=m.m),b};function Kt(m){return new eo(m)}function cn(m,b,x){m.j=x?rs(b,!0):b,m.j&&(m.j=m.j.replace(/:$/,""))}function cr(m,b){if(b){if(b=Number(b),isNaN(b)||b<0)throw Error("Bad port number "+b);m.u=b}else m.u=null}function Vl(m,b,x){b instanceof ur?(m.i=b,vi(m.i,m.l)):(x||(b=Ea(b,mr)),m.i=new ur(b,m.l))}function gt(m,b,x){m.i.set(b,x)}function wa(m){return gt(m,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),m}function rs(m,b){return m?b?decodeURI(m.replace(/%25/g,"%2525")):decodeURIComponent(m):""}function Ea(m,b,x){return typeof m=="string"?(m=encodeURI(m).replace(b,Nn),x&&(m=m.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),m):null}function Nn(m){return m=m.charCodeAt(0),"%"+(m>>4&15).toString(16)+(m&15).toString(16)}var fi=/[#\/\?@]/g,Vc=/[#\?:]/g,Ul=/[#\?]/g,mr=/[#\?@]/g,Uc=/#/g;function ur(m,b){this.h=this.g=null,this.i=m||null,this.j=!!b}function Vn(m){m.g||(m.g=new Map,m.h=0,m.i&&gi(m.i,function(b,x){m.add(decodeURIComponent(b.replace(/\+/g," ")),x)}))}r=ur.prototype,r.add=function(m,b){Vn(this),this.i=null,m=pr(this,m);let x=this.g.get(m);return x||this.g.set(m,x=[]),x.push(b),this.h+=1,this};function Bc(m,b){Vn(m),b=pr(m,b),m.g.has(b)&&(m.i=null,m.h-=m.g.get(b).length,m.g.delete(b))}function Bl(m,b){return Vn(m),b=pr(m,b),m.g.has(b)}r.forEach=function(m,b){Vn(this),this.g.forEach(function(x,k){x.forEach(function(q){m.call(b,q,k,this)},this)},this)};function Gl(m,b){Vn(m);let x=[];if(typeof b=="string")Bl(m,b)&&(x=x.concat(m.g.get(pr(m,b))));else for(m=Array.from(m.g.values()),b=0;b<m.length;b++)x=x.concat(m[b]);return x}r.set=function(m,b){return Vn(this),this.i=null,m=pr(this,m),Bl(this,m)&&(this.h-=this.g.get(m).length),this.g.set(m,[b]),this.h+=1,this},r.get=function(m,b){return m?(m=Gl(this,m),m.length>0?String(m[0]):b):b};function hi(m,b,x){Bc(m,b),x.length>0&&(m.i=null,m.g.set(pr(m,b),G(x)),m.h+=x.length)}r.toString=function(){if(this.i)return this.i;if(!this.g)return"";const m=[],b=Array.from(this.g.keys());for(let k=0;k<b.length;k++){var x=b[k];const q=Ms(x);x=Gl(this,x);for(let W=0;W<x.length;W++){let ue=q;x[W]!==""&&(ue+="="+Ms(x[W])),m.push(ue)}}return this.i=m.join("&")};function Gc(m){const b=new ur;return b.i=m.i,m.g&&(b.g=new Map(m.g),b.h=m.h),b}function pr(m,b){return b=String(b),m.j&&(b=b.toLowerCase()),b}function vi(m,b){b&&!m.j&&(Vn(m),m.i=null,m.g.forEach(function(x,k){const q=k.toLowerCase();k!=q&&(Bc(this,k),hi(this,q,x))},m)),m.j=b}function Po(m,b){const x=new To;if(c.Image){const k=new Image;k.onload=_(fo,x,"TestLoadImage: loaded",!0,b,k),k.onerror=_(fo,x,"TestLoadImage: error",!1,b,k),k.onabort=_(fo,x,"TestLoadImage: abort",!1,b,k),k.ontimeout=_(fo,x,"TestLoadImage: timeout",!1,b,k),c.setTimeout(function(){k.ontimeout&&k.ontimeout()},1e4),k.src=m}else b(!1)}function ql(m,b){const x=new To,k=new AbortController,q=setTimeout(()=>{k.abort(),fo(x,"TestPingServer: timeout",!1,b)},1e4);fetch(m,{signal:k.signal}).then(W=>{clearTimeout(q),W.ok?fo(x,"TestPingServer: ok",!0,b):fo(x,"TestPingServer: server error",!1,b)}).catch(()=>{clearTimeout(q),fo(x,"TestPingServer: error",!1,b)})}function fo(m,b,x,k,q){try{q&&(q.onload=null,q.onerror=null,q.onabort=null,q.ontimeout=null),k(x)}catch{}}function gr(){this.g=new va}function as(m){this.i=m.Sb||null,this.h=m.ab||!1}E(as,ba),as.prototype.g=function(){return new Sa(this.i,this.h)};function Sa(m,b){Tt.call(this),this.H=m,this.o=b,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}E(Sa,Tt),r=Sa.prototype,r.open=function(m,b){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=m,this.D=b,this.readyState=1,zo(this)},r.send=function(m){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const b={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};
vendor: 5,856 bytes, lines 19628-19631
19628m&&(b.body=m),(this.H||c).fetch(new Request(this.D,b)).then(this.Pa.bind(this),this.ga.bind(this))},r.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,fr(this)),this.readyState=0},r.Pa=function(m){if(this.g&&(this.l=m,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=m.headers,this.readyState=2,zo(this)),this.g&&(this.readyState=3,zo(this),this.g)))if(this.responseType==="arraybuffer")m.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof c.ReadableStream<"u"&&"body"in m){if(this.j=m.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;bi(this)}else m.text().then(this.Oa.bind(this),this.ga.bind(this))};function bi(m){m.j.read().then(m.Ma.bind(m)).catch(m.ga.bind(m))}r.Ma=function(m){if(this.g){if(this.o&&m.value)this.response.push(m.value);else if(!this.o){var b=m.value?m.value:new Uint8Array(0);(b=this.B.decode(b,{stream:!m.done}))&&(this.response=this.responseText+=b)}m.done?fr(this):zo(this),this.readyState==3&&bi(this)}},r.Oa=function(m){this.g&&(this.response=this.responseText=m,fr(this))},r.Na=function(m){this.g&&(this.response=m,fr(this))},r.ga=function(){this.g&&fr(this)};function fr(m){m.readyState=4,m.l=null,m.j=null,m.B=null,zo(m)}r.setRequestHeader=function(m,b){this.A.append(m,b)},r.getResponseHeader=function(m){return this.h&&this.h.get(m.toLowerCase())||""},r.getAllResponseHeaders=function(){if(!this.h)return"";const m=[],b=this.h.entries();for(var x=b.next();!x.done;)x=x.value,m.push(x[0]+": "+x[1]),x=b.next();return m.join(`\r
19629`)};function zo(m){m.onreadystatechange&&m.onreadystatechange.call(m)}Object.defineProperty(Sa.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(m){this.m=m?"include":"same-origin"}});function ho(m){let b="";return ke(m,function(x,k){b+=k,b+=":",b+=x,b+=`\r
19630`}),b}function ka(m,b,x){e:{for(k in x){var k=!1;break e}k=!0}k||(x=ho(x),typeof m=="string"?x!=null&&Ms(x):gt(m,b,x))}function bt(m){Tt.call(this),this.headers=new Map,this.L=m||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}E(bt,Tt);var is=/^https?$/i,Fl=["POST","PUT"];r=bt.prototype,r.Fa=function(m){this.H=m},r.ea=function(m,b,x,k){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+m);b=b?b.toUpperCase():"GET",this.D=m,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Il.g(),this.g.onreadystatechange=M(v(this.Ca,this));try{this.B=!0,this.g.open(b,String(m),!0),this.B=!1}catch(W){Ca(this,W);return}if(m=x||"",x=new Map(this.headers),k)if(Object.getPrototypeOf(k)===Object.prototype)for(var q in k)x.set(q,k[q]);else if(typeof k.keys=="function"&&typeof k.get=="function")for(const W of k.keys())x.set(W,k.get(W));else throw Error("Unknown input type for opt_headers: "+String(k));k=Array.from(x.keys()).find(W=>W.toLowerCase()=="content-type"),q=c.FormData&&m instanceof c.FormData,!(Array.prototype.indexOf.call(Fl,b,void 0)>=0)||k||q||x.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[W,ue]of x)this.g.setRequestHeader(W,ue);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(m),this.v=!1}catch(W){Ca(this,W)}};function Ca(m,b){m.h=!1,m.g&&(m.j=!0,m.g.abort(),m.j=!1),m.l=b,m.o=5,jl(m),Ts(m)}function jl(m){m.A||(m.A=!0,zt(m,"complete"),zt(m,"error"))}r.abort=function(m){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=m||7,zt(this,"complete"),zt(this,"abort"),Ts(this))},r.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Ts(this,!0)),bt.Z.N.call(this)},r.Ca=function(){this.u||(this.B||this.v||this.j?Ra(this):this.Xa())},r.Xa=function(){Ra(this)};function Ra(m){if(m.h&&typeof d<"u"){if(m.v&&Lo(m)==4)setTimeout(m.Ca.bind(m),0);else if(zt(m,"readystatechange"),Lo(m)==4){m.h=!1;try{const W=m.ca();e:switch(W){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var b=!0;break e;default:b=!1}var x;if(!(x=b)){var k;if(k=W===0){let ue=String(m.D).match(Nc)[1]||null;!ue&&c.self&&c.self.location&&(ue=c.self.location.protocol.slice(0,-1)),k=!is.test(ue?ue.toLowerCase():"")}x=k}if(x)zt(m,"complete"),zt(m,"success");else{m.o=6;try{var q=Lo(m)>2?m.g.statusText:""}catch{q=""}m.l=q+" ["+m.ca()+"]",jl(m)}}finally{Ts(m)}}}}function Ts(m,b){if(m.g){m.m&&(clearTimeout(m.m),m.m=null);const x=m.g;m.g=null,b||zt(m,"ready");try{x.onreadystatechange=null}catch{}}}r.isActive=function(){return!!this.g};function Lo(m){return m.g?m.g.readyState:0}r.ca=function(){try{return Lo(this)>2?this.g.status:-1}catch{return-1}},r.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},r.La=function(m){if(this.g){var b=this.g.responseText;return m&&b.indexOf(m)==0&&(b=b.substring(m.length)),Ko(b)}};function hn(m){try{if(!m.g)return null;if("response"in m.g)return m.g.response;switch(m.F){case"":case"text":return m.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in m.g)return m.g.mozResponseArrayBuffer}return null}catch{return null}}function Is(m){const b={};m=(m.g&&Lo(m)>=2&&m.g.getAllResponseHeaders()||"").split(`\r
19631`);for(let k=0;k<m.length;k++){if(D(m[k]))continue;var x=Pc(m[k]);const q=x[0];if(x=x[1],typeof x!="string")continue;x=x.trim();const W=b[q]||[];b[q]=W,W.push(x)}Ve(b,function(k){return k.join(", ")})}r.ya=function(){return this.o},r.Ha=function(){return typeof this.l=="string"?this.l:String(this.l)};
vendor: 4,172 bytes, line 19631
19631function ls(m,b,x){return x&&x.internalChannelParams&&x.internalChannelParams[m]||b}function hr(m){this.za=0,this.i=[],this.j=new To,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=ls("failFast",!1,m),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=ls("baseRetryDelayMs",5e3,m),this.Za=ls("retryDelaySeedMs",1e4,m),this.Ta=ls("forwardChannelMaxRetries",2,m),this.va=ls("forwardChannelRequestTimeoutMs",2e4,m),this.ma=m&&m.xmlHttpFactory||void 0,this.Ua=m&&m.Rb||void 0,this.Aa=m&&m.useFetchStreams||!1,this.O=void 0,this.L=m&&m.supportsCrossDomainXhr||!1,this.M="",this.h=new Ol(m&&m.concurrentRequestLimit),this.Ba=new gr,this.S=m&&m.fastHandshake||!1,this.R=m&&m.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=m&&m.Pb||!1,m&&m.ua&&this.j.ua(),m&&m.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&m&&m.detectBufferingProxy||!1,this.ia=void 0,m&&m.longPollingTimeout&&m.longPollingTimeout>0&&(this.ia=m.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}r=hr.prototype,r.ka=8,r.I=1,r.connect=function(m,b,x,k){Xt(0),this.W=m,this.H=b||{},x&&k!==void 0&&(this.H.OSID=x,this.H.OAID=k),this.F=this.X,this.J=Kc(this,null,this.W),ds(this)};function Xl(m){if(yi(m),m.I==3){var b=m.V++,x=Kt(m.J);if(gt(x,"SID",m.M),gt(x,"RID",b),gt(x,"TYPE","terminate"),Da(m,x),b=new Io(m,m.j,b),b.M=2,b.A=wa(Kt(x)),x=!1,c.navigator&&c.navigator.sendBeacon)try{x=c.navigator.sendBeacon(b.A.toString(),"")}catch{}!x&&c.Image&&(new Image().src=b.A,x=!0),x||(b.g=Qc(b.j,null),b.g.ea(b.A)),b.F=Date.now(),es(b)}Wc(m)}function vr(m){m.g&&(Wl(m),m.g.cancel(),m.g=null)}function yi(m){vr(m),m.v&&(c.clearTimeout(m.v),m.v=null),Ai(m),m.h.cancel(),m.m&&(typeof m.m=="number"&&c.clearTimeout(m.m),m.m=null)}function ds(m){if(!Pl(m.h)&&!m.m){m.m=!0;var b=m.Ea;Ye||C(),qe||(Ye(),qe=!0),w.add(b,m),m.D=0}}function xi(m,b){return os(m.h)>=m.h.j-(m.m?1:0)?!1:m.m?(m.i=b.G.concat(m.i),!0):m.I==1||m.I==2||m.D>=(m.Sa?0:m.Ta)?!1:(m.m=$o(v(m.Ea,m,b),Hc(m,m.D)),m.D++,!0)}r.Ea=function(m){if(this.m)if(this.m=null,this.I==1){if(!m){this.V=Math.floor(Math.random()*1e5),m=this.V++;const q=new Io(this,this.j,m);let W=this.o;if(this.U&&(W?(W=P(W),me(W,this.U)):W=this.U),this.u!==null||this.R||(q.J=W,W=null),this.S)e:{for(var b=0,x=0;x<this.i.length;x++){t:{var k=this.i[x];if("__data__"in k.map&&(k=k.map.__data__,typeof k=="string")){k=k.length;break t}k=void 0}if(k===void 0)break;if(b+=k,b>4096){b=x;break e}if(b===4096||x===this.i.length-1){b=x+1;break e}}b=1e3}else b=1e3;b=qc(this,q,b),x=Kt(this.J),gt(x,"RID",m),gt(x,"CVER",22),this.G&&gt(x,"X-HTTP-Session-Id",this.G),Da(this,x),W&&(this.R?b="headers="+Ms(ho(W))+"&"+b:this.u&&ka(x,this.u,W)),zl(this.h,q),this.Ra&&gt(x,"TYPE","init"),this.S?(gt(x,"$req",b),gt(x,"SID","null"),q.U=!0,Zo(q,x,null)):Zo(q,x,b),this.I=2}}else this.I==3&&(m?Hl(this,m):this.i.length==0||Pl(this.h)||Hl(this))};function Hl(m,b){var x;b?x=b.l:x=m.V++;const k=Kt(m.J);gt(k,"SID",m.M),gt(k,"RID",x),gt(k,"AID",m.K),Da(m,k),m.u&&m.o&&ka(k,m.u,m.o),x=new Io(m,m.j,x,m.D+1),m.u===null&&(x.J=m.o),b&&(m.i=b.G.concat(m.i)),b=qc(m,x,1e3),x.H=Math.round(m.va*.5)+Math.round(m.va*.5*Math.random()),zl(m.h,x),Zo(x,k,b)}function Da(m,b){m.H&&ke(m.H,function(x,k){gt(b,k,x)}),m.l&&ke({},function(x,k){gt(b,k,x)})}function qc(m,b,x){x=Math.min(m.i.length,x);const k=m.l?v(m.l.Ka,m.l,m):null;e:{var q=m.i;let je=-1;for(;;){const Bt=["count="+x];je==-1?x>0?(je=q[0].g,Bt.push("ofs="+je)):je=0:Bt.push("ofs="+je);let ct=!0;for(let Rt=0;Rt<x;Rt++){var W=q[Rt].g;const vo=q[Rt].map;if(W-=je,W<0)je=Math.max(0,q[Rt].g-100),ct=!1;else try{W="req"+W+"_"||"";try{var ue=vo instanceof Map?vo:Object.entries(vo);for(const[ms,No]of ue){let Vo=No;g(No)&&(Vo=gn(No)),Bt.push(W+ms+"="+encodeURIComponent(Vo))}}catch(ms){throw Bt.push(W+"type="+encodeURIComponent("_badmap")),ms}}catch{k&&k(vo)}}if(ct){ue=Bt.join("&");break e}}ue=void 0}return m=m.i.splice(0,x),b.G=m,ue}function Fc(m){if(!m.g&&!m.v){m.Y=1;var b=m.Da;Ye||C(),qe||(Ye(),qe=!0),w.add(b,m),m.A=0}}function Ma(m){return m.g||m.v||m.A>=3?!1:(m.Y++,m.v=$o(v(m.Da,m),Hc(m,m.A)),m.A++,!0)}
vendor: 4,168 bytes, line 19631
19631r.Da=function(){if(this.v=null,jc(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var m=4*this.T;this.j.info("BP detection timer enabled: "+m),this.B=$o(v(this.Wa,this),m)}},r.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,Xt(10),vr(this),jc(this))};function Wl(m){m.B!=null&&(c.clearTimeout(m.B),m.B=null)}function jc(m){m.g=new Io(m,m.j,"rpc",m.Y),m.u===null&&(m.g.J=m.o),m.g.P=0;var b=Kt(m.na);gt(b,"RID","rpc"),gt(b,"SID",m.M),gt(b,"AID",m.K),gt(b,"CI",m.F?"0":"1"),!m.F&&m.ia&&gt(b,"TO",m.ia),gt(b,"TYPE","xmlhttp"),Da(m,b),m.u&&m.o&&ka(b,m.u,m.o),m.O&&(m.g.H=m.O);var x=m.g;m=m.ba,x.M=1,x.A=wa(Kt(b)),x.u=null,x.R=!0,ui(x,m)}r.Va=function(){this.C!=null&&(this.C=null,vr(this),Ma(this),Xt(19))};function Ai(m){m.C!=null&&(c.clearTimeout(m.C),m.C=null)}function Xc(m,b){var x=null;if(m.g==b){Ai(m),Wl(m),m.g=null;var k=2}else if(ss(m.h,b))x=b.G,Ll(m.h,b),k=1;else return;if(m.I!=0){if(b.o)if(k==1){x=b.u?b.u.length:0,b=Date.now()-b.F;var q=m.D;k=mi(),zt(k,new Yo(k,x)),ds(m)}else Fc(m);else if(q=b.m,q==3||q==0&&b.X>0||!(k==1&&xi(m,b)||k==2&&Ma(m)))switch(x&&x.length>0&&(b=m.h,b.i=b.i.concat(x)),q){case 1:cs(m,5);break;case 4:cs(m,10);break;case 3:cs(m,6);break;default:cs(m,2)}}}function Hc(m,b){let x=m.Qa+Math.floor(Math.random()*m.Za);return m.isActive()||(x*=2),x*b}function cs(m,b){if(m.j.info("Error code "+b),b==2){var x=v(m.bb,m),k=m.Ua;const q=!k;k=new eo(k||"//www.google.com/images/cleardot.gif"),c.location&&c.location.protocol=="http"||cn(k,"https"),wa(k),q?Po(k.toString(),x):ql(k.toString(),x)}else Xt(2);m.I=0,m.l&&m.l.pa(b),Wc(m),yi(m)}r.bb=function(m){m?(this.j.info("Successfully pinged google.com"),Xt(2)):(this.j.info("Failed to ping google.com"),Xt(1))};function Wc(m){if(m.I=0,m.ja=[],m.l){const b=Nl(m.h);(b.length!=0||m.i.length!=0)&&(B(m.ja,b),B(m.ja,m.i),m.h.i.length=0,G(m.i),m.i.length=0),m.l.oa()}}function Kc(m,b,x){var k=x instanceof eo?Kt(x):new eo(x);if(k.g!="")b&&(k.g=b+"."+k.g),cr(k,k.u);else{var q=c.location;k=q.protocol,b=b?b+"."+q.hostname:q.hostname,q=+q.port;const W=new eo(null);k&&cn(W,k),b&&(W.g=b),q&&cr(W,q),x&&(W.h=x),k=W}return x=m.G,b=m.wa,x&&b&&gt(k,x,b),gt(k,"VER",m.ka),Da(m,k),k}function Qc(m,b,x){if(b&&!m.L)throw Error("Can't create secondary domain capable XhrIo object.");return b=m.Aa&&!m.ma?new bt(new as({ab:x})):new bt(m.ma),b.Fa(m.L),b}r.isActive=function(){return!!this.l&&this.l.isActive(this)};function Yc(){}r=Yc.prototype,r.ra=function(){},r.qa=function(){},r.pa=function(){},r.oa=function(){},r.isActive=function(){return!0},r.Ka=function(){};function br(){}br.prototype.g=function(m,b){return new In(m,b)};function In(m,b){Tt.call(this),this.g=new hr(b),this.l=m,this.h=b&&b.messageUrlParams||null,m=b&&b.messageHeaders||null,b&&b.clientProtocolHeaderRequired&&(m?m["X-Client-Protocol"]="webchannel":m={"X-Client-Protocol":"webchannel"}),this.g.o=m,m=b&&b.initMessageHeaders||null,b&&b.messageContentType&&(m?m["X-WebChannel-Content-Type"]=b.messageContentType:m={"X-WebChannel-Content-Type":b.messageContentType}),b&&b.sa&&(m?m["X-WebChannel-Client-Profile"]=b.sa:m={"X-WebChannel-Client-Profile":b.sa}),this.g.U=m,(m=b&&b.Qb)&&!D(m)&&(this.g.u=m),this.A=b&&b.supportsCrossDomainXhr||!1,this.v=b&&b.sendRawJson||!1,(b=b&&b.httpSessionIdParam)&&!D(b)&&(this.g.G=b,m=this.h,m!==null&&b in m&&(m=this.h,b in m&&delete m[b])),this.j=new Os(this)}E(In,Tt),In.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},In.prototype.close=function(){Xl(this.g)},In.prototype.o=function(m){var b=this.g;if(typeof m=="string"){var x={};x.__data__=m,m=x}else this.v&&(x={},x.__data__=gn(m),m=x);b.i.push(new Wt(b.Ya++,m)),b.I==3&&ds(b)},In.prototype.N=function(){this.g.l=null,delete this.j,Xl(this.g),delete this.g,In.Z.N.call(this)};function $c(m){fn.call(this),m.__headers__&&(this.headers=m.__headers__,this.statusCode=m.__status__,delete m.__headers__,delete m.__status__);var b=m.__sm__;if(b){e:{for(const x in b){m=x;break e}m=void 0}(this.i=m)&&(m=this.i,b=b!==null&&m in b?b[m]:void 0),this.data=b}else this.data=m}E($c,fn);
19631function Jc(){po.call(this),this.status=1}E(Jc,po);function Os(m){this.g=m}E(Os,Yc),Os.prototype.ra=function(){zt(this.g,"a")},Os.prototype.qa=function(m){zt(this.g,new $c(m))},Os.prototype.pa=function(m){zt(this.g,new Jc)},Os.prototype.oa=function(){zt(this.g,"b")},br.prototype.createWebChannel=br.prototype.g,In.prototype.send=In.prototype.o,In.prototype.open=In.prototype.m,In.prototype.close=In.prototype.close,fy=function(){return new br},gy=function(){return mi()},py=Ut,jf={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},Aa.NO_ERROR=0,Aa.TIMEOUT=8,Aa.HTTP_ERROR=6,cu=Aa,Tl.COMPLETE="complete",uy=Tl,Ml.EventType=Mo,Mo.OPEN="a",Mo.CLOSE="b",Mo.ERROR="c",Mo.MESSAGE="d",Tt.prototype.listen=Tt.prototype.J,zd=Ml,bt.prototype.listenOnce=bt.prototype.K,bt.prototype.getLastError=bt.prototype.Ha,bt.prototype.getLastErrorCode=bt.prototype.ya,bt.prototype.getStatus=bt.prototype.ca,bt.prototype.getResponseJson=bt.prototype.La,bt.prototype.getResponseText=bt.prototype.la,bt.prototype.send=bt.prototype.ea,bt.prototype.setWithCredentials=bt.prototype.Fa,my=bt}).apply(typeof nu<"u"?nu:typeof self<"u"?self:typeof window<"u"?window:{});/*!
19632 * re2js
19633 * RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
19634 *
19635 * @version v0.4.3
19636 * @author Alexey Vasiliev
19637 * @homepage https://github.com/le0pard/re2js#readme
19638 * @repository github:le0pard/re2js
19639 * @license MIT
19640 */const It=class It{};R(It,"FOLD_CASE",1),R(It,"LITERAL",2),R(It,"CLASS_NL",4),R(It,"DOT_NL",8),R(It,"ONE_LINE",16),R(It,"NON_GREEDY",32),R(It,"PERL_X",64),R(It,"UNICODE_GROUPS",128),R(It,"WAS_DOLLAR",256),R(It,"MATCH_NL",It.CLASS_NL|It.DOT_NL),R(It,"PERL",It.CLASS_NL|It.ONE_LINE|It.PERL_X|It.UNICODE_GROUPS),R(It,"POSIX",0),R(It,"UNANCHORED",0),R(It,"ANCHOR_START",1),R(It,"ANCHOR_BOTH",2);let fe=It;class H{static toUpperCase(e){const t=String.fromCodePoint(e).toUpperCase();if(t.length>1)return e;const o=String.fromCodePoint(t.codePointAt(0)).toLowerCase();return o.length>1||o.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){const t=String.fromCodePoint(e).toLowerCase();if(t.length>1)return e;const o=String.fromCodePoint(t.codePointAt(0)).toUpperCase();return o.length>1||o.codePointAt(0)!==e?e:t.codePointAt(0)}}R(H,"CODES",new Map([["\x07",7],["\b",8],["	",9],[`
19641`,10],["\v",11],["\f",12],["\r",13],[" ",32],['"',34],["$",36],["&",38],["(",40],[")",41],["*",42],["+",43],["-",45],[".",46],["0",48],["1",49],["2",50],["3",51],["4",52],["5",53],["6",54],["7",55],["8",56],["9",57],[":",58],["<",60],[">",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]));const A=class A{};R(A,"CASE_ORBIT",new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8
19641147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[937
1964171,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]])),R(A,"C",[[0,31,1],[127,159,1],[173,888,715],[889,896,7],[897,899,1],[907,909,2],[930,1328,398],[1367,1368,1],[1419,1420,1],[1424,1480,56],[1481,1487,1],[1515,1518,1],[1525,1541,1],[1564,1757,193],[1806,1807,1],[1867,1868,1],[1970,1983,1],[2043,2044,1],[2094,2095,1],[2111,2140,29],[2141,2143,2],[2155,2159,1],[2191,2199,1],[2274,2436,162],[2445,2446,1],[2449,2450,1],[2473,2481,8],[2483,2485,1],[2490,2491,1],[2501,2502,1],[2505,2506,1],[2511,2518,1],[2520,2523,1],[2526,2532,6],[2533,2559,26],[2560,2564,4],[2571,2574,1],[2577,2578,1],[2601,2609,8],[2612,2618,3],[2619,2621,2],[2627,2630,1],[2633,2634,1],[2638,2640,1],[2642,2648,1],[2653,2655,2],[2656,2661,1],[2679,2688,1],[2692,2702,10],[2706,2729,23],[2737,2740,3],[2746,2747,1],[2758,2766,4],[2767,2769,2],[2770,2783,1],[2788,2789,1],[2802,2808,1],[2816,2820,4],[2829,2830,1],[2833,2834,1],[2857,2865,8],[2868,2874,6],[2875,2885,10],[2886,2889,3],[2890,2894,4],[2895,2900,1],[2904,2907,1],[2910,2916,6],[2917,2936,19],[2937,2945,1],[2948,2955,7],[2956,2957,1],[2961,2966,5],[2967,2968,1],[2971,2973,2],[2976,2978,1],[2981,2983,1],[2987,2989,1],[3002,3005,1],[3011,3013,1],[3017,3022,5],[3023,3025,2],[3026,3030,1],[3032,3045,1],[3067,3071,1],[3085,3089,4],[3113,3130,17],[3131,3141,10],[3145,3150,5],[3151,3156,1],[3159,3163,4],[3164,3166,2],[3167,3172,5],[3173,3184,11],[3185,3190,1],[3213,3217,4],[3241,3252,11],[3258,3259,1],[3269,3273,4],[3278,3284,1],[3287,3292,1],[3295,3300,5],[3301,3312,11],[3316,3327,1],[3341,3345,4],[3397,3401,4],[3408,3411,1],[3428,3429,1],[3456,3460,4],[3479,3481,1],[3506,3516,10],[3518,3519,1],[3527,3529,1],[3531,3534,1],[3541,3543,2],[3552,3557,1],[3568,3569,1],[3573,3584,1],[3643,3646,1],[3676,3712,1],[3715,3717,2],[3723,3748,25],[3750,3774,24],[3775,3781,6],[3783,3791,8],[3802,3803,1],[3808,3839,1],[3912,3949,37],[3950,3952,1],[3992,4029,37],[4045,4059,14],[4060,4095,1],[4294,4296,2],[4297,4300,1],[4302,4303,1],[4681,4686,5],[4687,4695,8],[4697,4702,5],[4703,4745,42],[4750,4751,1],[4785,4790,5],[4791,4799,8],[4801,4806,5],[4807,4823,16],[4881,4886,5],[4887,4955,68],[4956,4989,33],[4990,4991,1],[5018,5023,1],[5110,5111,1],[5118,5119,1],[5789,5791,1],[5881,5887,1],[5910,5918,1],[5943,5951,1],[5972,5983,1],[5997,6001,4],[6004,6015,1],[6110,6111,1],[6122,6127,1],[6138,6143,1],[6158,6170,12],[6171,6175,1],[6265,6271,1],[6315,6319,1],[6390,6399,1],[6431,6444,13],[6445,6447,1],[6460,6463,1],[6465,6467,1],[6510,6511,1],[6517,6527,1],[6572,6575,1],[6602,6607,1],[6619,6621,1],[6684,6685,1],[6751,6781,30],[6782,6794,12],[6795,6799,1],[6810,6815,1],[6830,6831,1],[6863,6911,1],[6989,6991,1],[7039,7156,117],[7157,7163,1],[7224,7226,1],[7242,7244,1],[7305,7311,1],[7355,7356,1],[7368,7375,1],[7419,7423,1],[7958,7959,1],[7966,7967,1],[8006,8007,1],[8014,8015,1],[8024,8030,2],[8062,8063,1],[8117,8133,16],[8148,8149,1],[8156,8176,20],[8177,8181,4],[8191,8203,12],[8204,8207,1],[8234,8238,1],[8288,8303,1],[8306,8307,1],[8335,8349,14],[8350,8351,1],[8385,8399,1],[8433,8447,1],[8588,8591,1],[9255,9279,1],[9291,9311,1],[11124,11125,1],[11158,11508,350],[11509,11512,1],[11558,11560,2],[11561,11564,1],[11566,11567,1],[11624,11630,1],[11633,11646,1],[11671,11679,1],[11687,11743,8],[11870,11903,1],[11930,12020,90],[12021,12031,1],[12246,12271,1],[12352,12439,87],[12440,12544,104],[12545,12548,1],[12592,12687,95],[12772,12782,1],[12831,42125,29294],[42126,42127,1],[42183,42191,1],[42540,42559,1],[42744,42751,1],[42955,42959,1],[42962,42964,2],[42970,42993,1],[43053,43055,1],[43066,43071,1],[43128,43135,1],[43206,43213,1],[43226,43231,1],[43348,43358,1],[43389,43391,1],[43470,43482,12],[43483,43485,1],[43519,43575,56],[43576,43583,1],[43598,43599,1],[43610,43611,1],[43715,43738,1],[43767,43776,1],[43783,43784,1],[43791,43792,1],[43799,43807,1],[43815,43823,8],[43884,43887,1],[44014,44015,1],[44026,44031,1],[55204,55215,1],[55239,55242,1],[55292,63743,1],[64110,64111,1],[64218,64255,1],[64263,64274,1],[64280,64284,1],[64311,64317,6],[64319,64325,3],[64451,64466,1],[64912,64913,1],[64968,64974,1],[64976,65007,1],[65050,65055,1],[65107,65127,20],[65132,65135,1],[65141,65277,136],[65278,65280,1],[65471,65473,1],[65480,65481,1],[65488,65489,1],[65496,65497,1],[65501,65503,1],[65511,65519,8],[65520,65531,1],[65534,65535,1],[65548,65575,27],[65595,65598,3],[65614,65615,1],[65630,65663,1],[65787,65791,1],[65795,65798,1],[65844,65846,1],[65935,65949,14],[65950,65951,1],[65953,65999,1],[66046,66175,1],[66205,66207,1],[66257,66271,1],[66300,66303,1],[66340,66348,1],[66379,66383,1],[66427,66431,1],[66462,66500,38],[66501,66503,1],[66518,66559,1],[66718,66719,1],[66730,66735,1],[66772,66775,1],[66812,66815,1],[66856,66863,1],[66916,66926,1],[66939,66955,16],[66963,66966,3],[66978,66994,16],[67002,67005,3],[67006,67071,1],[67383,67391,1],[67414,67423,1],[67432,67455,1],[67462,67505,43],[67515,67583,1],[67590,67591,1],[67593,67638,45],[67641,67643,1],[67645,67646,1],[67670,67743,73],[67744,67750,1],[67760,67807,1],[67827,67830,3],[67831,67834,1],[67868,67870,1],[67898,67902,1],[67904,67967,1],[68024,68027,1],[68048,68049,1],[68100,68103,3],[68104,68107,1],[68116,68120,4],[68150,68151,1],[68155,68158,1],[68169,68175,1],[68185,68191,1],[68256,68287,1],[68327,68330,1],[68343,68351,1],[68406,68408,1],[68438,68439,1],[68467,68471,1],[68498,68504,1],[68509,68520,1],[68528,68607,1],[68681,68735,1],[68787,68799,1],[68851,68857,1],[68904,68911,1],[68922,69215,1],[69247,69290,43],[69294,69295,1],[69298,69372,1],[69416,69423,1],[69466,69487,1],[69514,69551,1],[69580,69599,1],[69623,69631,1],[69710,69713,1],[69750,69758,1],[69821,69827,6],[69828,69839,1],[69865,69871,1],[69882,69887,1],[69941,69960,19],[69961,69967,1],[70007,70015,1],[70112,70133,21],[70134,70143,1],[70162,70210,48],[70211,70271,1],[70279,70281,2],[70286,70302,16],[70314,70319,1],[70379,70383,1],[70394,70399,1],[70404,70413,9],[70414,70417,3],[70418,70441,23],[70449,70452,3],[70458,70469,11],[70470,70473,3],[70474,70478,4],[70479,70481,2],[70482,70486,1],[70488,70492,1],[70500,70501,1],[70509,70511,
196411],[70517,70655,1],[70748,70754,6],[70755,70783,1],[70856,70863,1],[70874,71039,1],[71094,71095,1],[71134,71167,1],[71237,71247,1],[71258,71263,1],[71277,71295,1],[71354,71359,1],[71370,71423,1],[71451,71452,1],[71468,71471,1],[71495,71679,1],[71740,71839,1],[71923,71934,1],[71943,71944,1],[71946,71947,1],[71956,71959,3],[71990,71993,3],[71994,72007,13],[72008,72015,1],[72026,72095,1],[72104,72105,1],[72152,72153,1],[72165,72191,1],[72264,72271,1],[72355,72367,1],[72441,72447,1],[72458,72703,1],[72713,72759,46],[72774,72783,1],[72813,72815,1],[72848,72849,1],[72872,72887,15],[72888,72959,1],[72967,72970,3],[73015,73017,1],[73019,73022,3],[73032,73039,1],[73050,73055,1],[73062,73065,3],[73103,73106,3],[73113,73119,1],[73130,73439,1],[73465,73471,1],[73489,73531,42],[73532,73533,1],[73562,73647,1],[73649,73663,1],[73714,73726,1],[74650,74751,1],[74863,74869,6],[74870,74879,1],[75076,77711,1],[77811,77823,1],[78896,78911,1],[78934,82943,1],[83527,92159,1],[92729,92735,1],[92767,92778,11],[92779,92781,1],[92863,92874,11],[92875,92879,1],[92910,92911,1],[92918,92927,1],[92998,93007,1],[93018,93026,8],[93048,93052,1],[93072,93759,1],[93851,93951,1],[94027,94030,1],[94088,94094,1],[94112,94175,1],[94181,94191,1],[94194,94207,1],[100344,100351,1],[101590,101631,1],[101641,110575,1],[110580,110588,8],[110591,110883,292],[110884,110897,1],[110899,110927,1],[110931,110932,1],[110934,110947,1],[110952,110959,1],[111356,113663,1],[113771,113775,1],[113789,113791,1],[113801,113807,1],[113818,113819,1],[113824,118527,1],[118574,118575,1],[118599,118607,1],[118724,118783,1],[119030,119039,1],[119079,119080,1],[119155,119162,1],[119275,119295,1],[119366,119487,1],[119508,119519,1],[119540,119551,1],[119639,119647,1],[119673,119807,1],[119893,119965,72],[119968,119969,1],[119971,119972,1],[119975,119976,1],[119981,119994,13],[119996,120004,8],[120070,120075,5],[120076,120085,9],[120093,120122,29],[120127,120133,6],[120135,120137,1],[120145,120486,341],[120487,120780,293],[120781,121484,703],[121485,121498,1],[121504,121520,16],[121521,122623,1],[122655,122660,1],[122667,122879,1],[122887,122905,18],[122906,122914,8],[122917,122923,6],[122924,122927,1],[122990,123022,1],[123024,123135,1],[123181,123183,1],[123198,123199,1],[123210,123213,1],[123216,123535,1],[123567,123583,1],[123642,123646,1],[123648,124111,1],[124154,124895,1],[124903,124908,5],[124911,124927,16],[125125,125126,1],[125143,125183,1],[125260,125263,1],[125274,125277,1],[125280,126064,1],[126133,126208,1],[126270,126463,1],[126468,126496,28],[126499,126501,2],[126502,126504,2],[126515,126520,5],[126522,126524,2],[126525,126529,1],[126531,126534,1],[126536,126540,2],[126544,126547,3],[126549,126550,1],[126552,126560,2],[126563,126565,2],[126566,126571,5],[126579,126589,5],[126591,126602,11],[126620,126624,1],[126628,126634,6],[126652,126703,1],[126706,126975,1],[127020,127023,1],[127124,127135,1],[127151,127152,1],[127168,127184,16],[127222,127231,1],[127406,127461,1],[127491,127503,1],[127548,127551,1],[127561,127567,1],[127570,127583,1],[127590,127743,1],[128728,128731,1],[128749,128751,1],[128765,128767,1],[128887,128890,1],[128986,128991,1],[129004,129007,1],[129009,129023,1],[129036,129039,1],[129096,129103,1],[129114,129119,1],[129160,129167,1],[129198,129199,1],[129202,129279,1],[129620,129631,1],[129646,129647,1],[129661,129663,1],[129673,129679,1],[129726,129734,8],[129735,129741,1],[129756,129759,1],[129769,129775,1],[129785,129791,1],[129939,129995,56],[129996,130031,1],[130042,131071,1],[173792,173823,1],[177978,177983,1],[178206,178207,1],[183970,183983,1],[191457,191471,1],[192094,194559,1],[195102,196607,1],[201547,201551,1],[205744,917759,1],[918e3,1114111,1]]),R(A,"Cc",[[0,31,1],[127,159,1]]),R(A,"Cf",[[173,1536,1363],[1537,1541,1],[1564,1757,193],[1807,2192,385],[2193,2274,81],[6158,8203,2045],[8204,8207,1],[8234,8238,1],[8288,8292,1],[8294,8303,1],[65279,65529,250],[65530,65531,1],[69821,69837,16],[78896,78911,1],[113824,113827,1],[119155,119162,1],[917505,917536,31],[917537,917631,1]]),R(A,"Co",[[57344,63743,1],[983040,1048573,1],[1048576,1114109,1]]),R(A,"Cs",[[55296,57343,1]]),R(A,"L",[[65,90,1],[97,122,1],[170,181,11],[186,192,6],[193,214,1],[216,246,1],[248,705,1],[710,721,1],[736,740,1],[748,750,2],[880,884,1],[886,887,1],[890,893,1],[895,902,7],[904,906,1],[908,910,2],[911,929,1],[931,1013,1],[1015,1153,1],[1162,1327,1],[1329,1366,1],[1369,1376,7
19641],[1377,1416,1],[1488,1514,1],[1519,1522,1],[1568,1610,1],[1646,1647,1],[1649,1747,1],[1749,1765,16],[1766,1774,8],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2036,2037,1],[2042,2048,6],[2049,2069,1],[2074,2084,10],[2088,2112,24],[2113,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2249,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2417,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3654,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3782,3804,22],[3805,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4256,18],[4257,4293,1],[4295,4301,6],[4304,4346,1],[4348,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5024,5109,1],[5112,5117,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6103,6108,5],[6176,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6823,6917,94],[6918,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7293,1],[7296,7304,1],[7312,7354,1],[7357,7359,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,7424,6],[7425,7615,1],[7680,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8124,1],[8126,8130,4],[8131,8132,1],[8134,8140,1],[8144,8147,1],[8150,8155,1],[8160,8172,1],[8178,8180,1],[8182,8188,1],[8305,8319,14],[8336,8348,1],[8450,8455,5],[8458,8467,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8495,8505,1],[8508,8511,1],[8517,8521,1],[8526,8579,53],[8580,11264,2684],[11265,11492,1],[11499,11502,1],[11506,11507,1],[11520,11557,1],[11559,11565,6],[11568,11623,1],[11631,11648,17],[11649,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[11823,12293,470],[12294,12337,43],[12338,12341,1],[12347,12348,1],[12353,12438,1],[12445,12447,1],[12449,12538,1],[12540,12543,1],[12549,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,42124,1],[42192,42237,1],[42240,42508,1],[42512,42527,1],[42538,42539,1],[42560,42606,1],[42623,42653,1],[42656,42725,1],[42775,42783,1],[42786,42888,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43471,43488,17],[43489,43492,1],[43494,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43741,1],[43744,43754,1],[43762,43764,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43824,43866,1],[43868,43881,1],[43888,44002,1],[44032,55203,1],[55216,55238,1],[55243,5
196415291,1],[63744,64109,1],[64112,64217,1],[64256,64262,1],[64275,64279,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65313,65338,1],[65345,65370,1],[65382,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66560,66717,1],[66736,66771,1],[66776,66811,1],[66816,66855,1],[66864,66915,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68736,68786,1],[68800,68850,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71840,71903,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[92992,92995,1],[93027,93047,1],[93053,93071,1],[93760,93823,1],[93952,94026,1],[94032,94099,67],[94100,94111,1],[94176,94177,1],[94179,94208,29],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120512,1],[120514,120538,1],[120540,120570,1],[120572,120596,1],[120598,120628,1],[120630,120654,1],[120656,120686,1],[120688,120712,1],[120714,120744,1],[120746,120770,1],[120772,120779,1],[122624,122654,1],[122661,122666,1],[122928,122989,1],[123136,123180,1],[123191,123197,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124139,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[125184,125251,1],[125259,126464,1205],[126465,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]]),R(A,"foldL",[[837,837,1]]),R(A,"Ll",[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,311,2],[312,328,2],[329,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[397,402,5],[405,409,4],[410,411,1],[414,417,3],[419,421,2],[424,426,2],[427,429,2],[432,436,4],[438,441,3],[442,445,3],[446,447,1],[454,460,3],[462,476,2],[477,495,2],[496,499,3],[501,505,4],[507,563,2],[564,569,1],[572,575,3],[576,578,2],[583,591,2],[592,659,1],[661,687,1],[881,883,2],[887,891,4],[892,893,1],[912,940,28],[941,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1020,1072,52],[1073,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1376,1416,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7424,7467,1],[7531,7543,1],[7545,7578,1],[7681,7829,2],[7830,7837,1],[7839,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8016,8023,1],[8032,8039,1],[8048,8061,1],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8112,8116,1],[8118,8119,1],[8126,8130,4],[8131,8132,1],[8134,8135,1],[8144,8147,1],[8150,8151,1],[8160,8167,1],[8178,8180,1],[8182,8183,1],[8458,8462,4],[8463,8467,4],[8495,8505,5],[8508,8509,1],[8518,8521,1],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11377,11379,2],[11380,11382,2],[11383,11387,1],[11393,11491,2],[11492,11500,8],[11502,11507,5],[11520,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42800,42801,1],[42803,42865,2],[42866,42872,1],[42874,42876,2],[42879,42887,2],[42892,42894,2],[42897,42899,2],[42900,42901,1],[42903,42921,2],[42927,42933,6],[42935,42947,2],[42952,42954,2],[42961,42969,2],[42998,43002,4],[43824,43866,1],[43872,43880,1],[43888,43967,1],[64256,64262,1],[64275,64279,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[119834,119859,1],[119886,119892,1],[119894,119911,1],[119938,119963,1],[119990,119993,1],[119995,119997,2],[119998,120003,1],[120005,120015,1],[120042,120067,1],[120094,120119,1],[120146,120171,1],[120198,120223,1],[120250,12
196410275,1],[120302,120327,1],[120354,120379,1],[120406,120431,1],[120458,120485,1],[120514,120538,1],[120540,120545,1],[120572,120596,1],[120598,120603,1],[120630,120654,1],[120656,120661,1],[120688,120712,1],[120714,120719,1],[120746,120770,1],[120772,120777,1],[120779,122624,1845],[122625,122633,1],[122635,122654,1],[122661,122666,1],[125218,125251,1]]),R(A,"foldLl",[[65,90,1],[192,214,1],[216,222,1],[256,302,2],[306,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,453,1],[455,456,1],[458,459,1],[461,475,2],[478,494,2],[497,498,1],[500,502,2],[503,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[837,880,43],[882,886,4],[895,902,7],[904,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,984,9],[986,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8072,8079,1],[8088,8095,1],[8104,8111,1],[8120,8124,1],[8136,8140,1],[8152,8155,1],[8168,8172,1],[8184,8188,1],[8486,8490,4],[8491,8498,7],[8579,11264,2685],[11265,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[125184,125217,1]]),R(A,"Lm",[[688,705,1],[710,721,1],[736,740,1],[748,750,2],[884,890,6],[1369,1600,231],[1765,1766,1],[2036,2037,1],[2042,2074,32],[2084,2088,4],[2249,2417,168],[3654,3782,128],[4348,6103,1755],[6211,6823,612],[7288,7293,1],[7468,7530,1],[7544,7579,35],[7580,7615,1],[8305,8319,14],[8336,8348,1],[11388,11389,1],[11631,11823,192],[12293,12337,44],[12338,12341,1],[12347,12445,98],[12446,12540,94],[12541,12542,1],[40981,42232,1251],[42233,42237,1],[42508,42623,115],[42652,42653,1],[42775,42783,1],[42864,42888,24],[42994,42996,1],[43e3,43001,1],[43471,43494,23],[43632,43741,109],[43763,43764,1],[43868,43871,1],[43881,65392,21511],[65438,65439,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[92992,92995,1],[94099,94111,1],[94176,94177,1],[94179,110576,16397],[110577,110579,1],[110581,110587,1],[110589,110590,1],[122928,122989,1],[123191,123197,1],[124139,125259,1120]]),R(A,"Lo",[[170,186,16],[443,448,5],[449,451,1],[660,1488,828],[1489,1514,1],[1519,1522,1],[1568,1599,1],[1601,1610,1],[1646,1647,1],[1649,1747,1],[1749,1774,25],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2048,2069,1],[2112,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2248,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2418,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3653,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3804,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4352,114],[4353,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6108,6176,68],[6177,6210,1],[6212,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6917,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7287,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,8501,1083],[8502,8504,1],[11568,11623,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11
19641742,1],[12294,12348,54],[12353,12438,1],[12447,12449,2],[12450,12538,1],[12543,12549,6],[12550,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,40980,1],[40982,42124,1],[42192,42231,1],[42240,42507,1],[42512,42527,1],[42538,42539,1],[42606,42656,50],[42657,42725,1],[42895,42999,104],[43003,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43488,43492,1],[43495,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43631,1],[43633,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43740,1],[43744,43754,1],[43762,43777,15],[43778,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43968,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65382,65391,1],[65393,65437,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66640,66717,1],[66816,66855,1],[66864,66915,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[93027,93047,1],[93053,93071,1],[93952,94026,1],[94032,94208,176],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[122634,123136,502],[123137,123180,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124138,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]]),R(A,"Lt",[[453,459,3],[498,8072,7574],[8073,8079,1],[8088,8095,1],[8104,8111,1],[8124,8140,16],[8188,8188,1]]),R(A,"foldLt",[[452,454,2],[455,457,2],[458,460,2],[497,499,2],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8115,8131,16],[8179,8179,1]]),R(A,"Lu",[[65,90,1],[192,214,1],[216,222,1],[256,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,461,3],[463,475,2],[478,494,2],[497,500,3],[502,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[880,882,2],[886,895,9],[902,904,2],[905,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,978,3],[979,980,1],[984,1006,2],[1012,1015,3],[1017,1018,1],[1021,10
1964171,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8120,8123,1],[8136,8139,1],[8152,8155,1],[8168,8172,1],[8184,8187,1],[8450,8455,5],[8459,8461,1],[8464,8466,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8496,8499,1],[8510,8511,1],[8517,8579,62],[11264,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[119808,119833,1],[119860,119885,1],[119912,119937,1],[119964,119966,2],[119967,119973,3],[119974,119977,3],[119978,119980,1],[119982,119989,1],[120016,120041,1],[120068,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120120,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120172,120197,1],[120224,120249,1],[120276,120301,1],[120328,120353,1],[120380,120405,1],[120432,120457,1],[120488,120512,1],[120546,120570,1],[120604,120628,1],[120662,120686,1],[120720,120744,1],[120778,125184,4406],[125185,125217,1]]),R(A,"Upper",A.Lu),R(A,"foldLu",[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,303,2],[307,311,2],[314,328,2],[331,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[402,405,3],[409,410,1],[414,417,3],[419,421,2],[424,429,5],[432,436,4],[438,441,3],[445,447,2],[453,454,1],[456,457,1],[459,460,1],[462,476,2],[477,495,2],[498,499,1],[501,505,4],[507,543,2],[547,563,2],[572,575,3],[576,578,2],[583,591,2],[592,596,1],[598,599,1],[601,603,2],[604,608,4],[609,613,2],[614,616,2],[617,620,1],[623,625,2],[626,629,3],[637,640,3],[642,643,1],[647,652,1],[658,669,11],[670,837,167],[881,883,2],[887,891,4],[892,893,1],[940,943,1],[945,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1072,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1377,1414,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7545,7549,4],[7566,7681,115],[7683,7829,2],[7835,7841,6],[7843,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8017,8023,2],[8032,8039,1],[8048,8061,1],[8112,8113,1],[8126,8144,18],[8145,8160,15],[8161,8165,4],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11379,11382,3],[11393,11491,2],[11500,11502,2],[11507,11520,13],[11521,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42803,42863,2],[42874,42876,2],[42879,42887,2],[42892,42897,5],[42899,42900,1],[42903,42921,2],[42933,42947,2],[42952,42954,2],[42961,42967,6],[42969,42998,29],[43859,43888,29],[43889,43967,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[125218,125251,1]]),R(A,"M",[[768,879,1],[1155,1161,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2307,1],[2362,2364,1],[2366,2383,1],[2385,2391,1],[2402,2403,1],[2433,2435,1],[2492,2494,2],[2495,2500,1],[2503,2504,1],[2507,2509,1],[2519,2530,11],[2531,2558,27],[2561,2563,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2672,31],[2673,2677,4],[2689,2691,1],[2748,2750,2],[2751,2757,1],[2759,2761,1],[2763,2765,1],[2786,2787,1],[2810,2815,1],[2817,2819,1],[2876,2878,2],[2879,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2914,2915,1],[2946,3006,60],[3007,3010,1],[3014,3016,1],[3018,3021,1],[3031,3072,41],[3073,3076,1],[3132,3134,2],[3135,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3203,1],[3260,3262,2],[3263,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3298,3299,1],[3315,3328,13],[3329,3331,1],[3387,3388,1],[3390,3396,1],[3398,3400,1],[3402,3405,1],[3415,3426,11],[3427,3457,30],[3458,3459,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3570,3571,1],[3633,3636,3],[3637,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3902,3903,1],[3953,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4139,101],[4140,4158,1],[4182,4185,1],[4190,4192,1],[4194,4196,1],[4199,4205,1],[4209,4212,1],[4226,4237,1],[4239,4250,11],[4251,4253,1],[4957,4959,1],[5906,5909,1],[5938,5940,1],[5970,5971,1],[6002,6003,1],[6068,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6443,1],[6448,6459,1],[6679,6683,1],[6741,6750,1],[6752,6780,1],[6783,6832,49],[6833,6862,1],[6912,6916,1],[6964,6980,1],[7019,7027,1],[7040,7042,1],[7073,7085,
196411],[7142,7155,1],[7204,7223,1],[7376,7378,1],[7380,7400,1],[7405,7412,7],[7415,7417,1],[7616,7679,1],[8400,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12335,1],[12441,12442,1],[42607,42610,1],[42612,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43043,24],[43044,43047,1],[43052,43136,84],[43137,43188,51],[43189,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43347,1],[43392,43395,1],[43443,43456,1],[43493,43561,68],[43562,43574,1],[43587,43596,9],[43597,43643,46],[43644,43645,1],[43696,43698,2],[43699,43700,1],[43703,43704,1],[43710,43711,1],[43713,43755,42],[43756,43759,1],[43765,43766,1],[44003,44010,1],[44012,44013,1],[64286,65024,738],[65025,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69632,69634,1],[69688,69702,1],[69744,69747,3],[69748,69759,11],[69760,69762,1],[69808,69818,1],[69826,69888,62],[69889,69890,1],[69927,69940,1],[69957,69958,1],[70003,70016,13],[70017,70018,1],[70067,70080,1],[70089,70092,1],[70094,70095,1],[70188,70199,1],[70206,70209,3],[70367,70378,1],[70400,70403,1],[70459,70460,1],[70462,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70502,3],[70503,70508,1],[70512,70516,1],[70709,70726,1],[70750,70832,82],[70833,70851,1],[71087,71093,1],[71096,71104,1],[71132,71133,1],[71216,71232,1],[71339,71351,1],[71453,71467,1],[71724,71738,1],[71984,71989,1],[71991,71992,1],[71995,71998,1],[72e3,72002,2],[72003,72145,142],[72146,72151,1],[72154,72160,1],[72164,72193,29],[72194,72202,1],[72243,72249,1],[72251,72254,1],[72263,72273,10],[72274,72283,1],[72330,72345,1],[72751,72758,1],[72760,72767,1],[72850,72871,1],[72873,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73098,67],[73099,73102,1],[73104,73105,1],[73107,73111,1],[73459,73462,1],[73472,73473,1],[73475,73524,49],[73525,73530,1],[73534,73538,1],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94033,2],[94034,94087,1],[94095,94098,1],[94180,94192,12],[94193,113821,19628],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119141,119145,1],[119149,119154,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]]),R(A,"foldM",[[921,953,32],[8126,8126,1]]),R(A,"Mc",[[2307,2363,56],[2366,2368,1],[2377,2380,1],[2382,2383,1],[2434,2435,1],[2494,2496,1],[2503,2504,1],[2507,2508,1],[2519,2563,44],[2622,2624,1],[2691,2750,59],[2751,2752,1],[2761,2763,2],[2764,2818,54],[2819,2878,59],[2880,2887,7],[2888,2891,3],[2892,2903,11],[3006,3007,1],[3009,3010,1],[3014,3016,1],[3018,3020,1],[3031,3073,42],[3074,3075,1],[3137,3140,1],[3202,3203,1],[3262,3264,2],[3265,3268,1],[3271,3272,1],[3274,3275,1],[3285,3286,1],[3315,3330,15],[3331,3390,59],[3391,3392,1],[3398,3400,1],[3402,3404,1],[3415,3458,43],[3459,3535,76],[3536,3537,1],[3544,3551,1],[3570,3571,1],[3902,3903,1],[3967,4139,172],[4140,4145,5],[4152,4155,3],[4156,4182,26],[4183,4194,11],[4195,4196,1],[4199,4205,1],[4227,4228,1],[4231,4236,1],[4239,4250,11],[4251,4252,1],[5909,5940,31],[6070,6078,8],[6079,6085,1],[6087,6088,1],[6435,6438,1],[6441,6443,1],[6448,6449,1],[6451,6456,1],[6681,6682,1],[6741,6743,2],[6753,6755,2],[6756,6765,9],[6766,6770,1],[6916,6965,49],[6971,6973,2],[6974,6977,1],[6979,6980,1],[7042,7073,31],[7078,7079,1],[7082,7143,61],[7146,7148,1],[7150,7154,4],[7155,7204,49],[7205,7211,1],[7220,7221,1],[7393,7415,22],[12334,12335,1],[43043,43044,1],[43047,43136,89],[43137,43188,51],[43189,43203,1],[43346,43347,1],[43395,43444,49],[43445,43450,5],[43451,43454,3],[43455,43456,1],[43567,43568,1],[43571,43572,1],[43597,43643,46],[43645,43755,110],[43758,43759,1],[43765,44003,238],[44004,44006,2],[44007,44009,2],[44010,44012,2],[69632,69634,2],[69762,69808,46],[69809,69810,1],[69815,69816,1],[69932,69957,25],[69958,70018,60],[70067,70069,1],[70079,70080,1],[70094,70188,94],[70189,70190,1],[70194,70195,1],[70197,70368,171],[70369,70370,1],[70402,70403,1],[70462,70463,1],[70465,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70709,210],[70710,70711,1],[70720,70721,1],[70725,70832,107],[70833,70834,1],[70841,70843,2],[70844,70846,1],[70849,71087,238],[71088,71089,1],[71096,71099,1],[71102,71216,114],[71217,71218,1],[71227,71228,1],[71230,71340,110],[71342,71343,1],[71350,71456,106],[71457,71462,5],[71724,71726,1],[71736,71984,248],[71985,71989,1],[71991,71992,1],[71997,72e3,3],[72002,72145,143],[72146,72147,1],[72156,72159,1],[72164,72249,85],[72279,72280,1],[72343,72751,408],[72766,72873,107],[72881,72884,3],[73098,73102,1],[73107,73108,1],[73110,73461,351],[73462,73475,13],[73524,73525,1],[73534,73535,1],[73537,94033,20496],[94034,94087,1],[94192,94193,1],[119141,119142,1],[119149,119154,1]]),R(A,"Me",[[1160,1161,1],[6846,8413,1567],[8414,8416,1],[8418,8420,1],[42608,42610,1]]),R(A,"Mn",[[768,879,1],[1155,1159,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,
196411],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2306,1],[2362,2364,2],[2369,2376,1],[2381,2385,4],[2386,2391,1],[2402,2403,1],[2433,2492,59],[2497,2500,1],[2509,2530,21],[2531,2558,27],[2561,2562,1],[2620,2625,5],[2626,2631,5],[2632,2635,3],[2636,2637,1],[2641,2672,31],[2673,2677,4],[2689,2690,1],[2748,2753,5],[2754,2757,1],[2759,2760,1],[2765,2786,21],[2787,2810,23],[2811,2815,1],[2817,2876,59],[2879,2881,2],[2882,2884,1],[2893,2901,8],[2902,2914,12],[2915,2946,31],[3008,3021,13],[3072,3076,4],[3132,3134,2],[3135,3136,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3260,59],[3263,3270,7],[3276,3277,1],[3298,3299,1],[3328,3329,1],[3387,3388,1],[3393,3396,1],[3405,3426,21],[3427,3457,30],[3530,3538,8],[3539,3540,1],[3542,3633,91],[3636,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3953,3966,1],[3968,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4141,103],[4142,4144,1],[4146,4151,1],[4153,4154,1],[4157,4158,1],[4184,4185,1],[4190,4192,1],[4209,4212,1],[4226,4229,3],[4230,4237,7],[4253,4957,704],[4958,4959,1],[5906,5908,1],[5938,5939,1],[5970,5971,1],[6002,6003,1],[6068,6069,1],[6071,6077,1],[6086,6089,3],[6090,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6434,1],[6439,6440,1],[6450,6457,7],[6458,6459,1],[6679,6680,1],[6683,6742,59],[6744,6750,1],[6752,6754,2],[6757,6764,1],[6771,6780,1],[6783,6832,49],[6833,6845,1],[6847,6862,1],[6912,6915,1],[6964,6966,2],[6967,6970,1],[6972,6978,6],[7019,7027,1],[7040,7041,1],[7074,7077,1],[7080,7081,1],[7083,7085,1],[7142,7144,2],[7145,7149,4],[7151,7153,1],[7212,7219,1],[7222,7223,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8400,8412,1],[8417,8421,4],[8422,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12333,1],[12441,12442,1],[42607,42612,5],[42613,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43045,26],[43046,43052,6],[43204,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43345,1],[43392,43394,1],[43443,43446,3],[43447,43449,1],[43452,43453,1],[43493,43561,68],[43562,43566,1],[43569,43570,1],[43573,43574,1],[43587,43596,9],[43644,43696,52],[43698,43700,1],[43703,43704,1],[43710,43711,1],[43713,43756,43],[43757,43766,9],[44005,44008,3],[44013,64286,20273],[65024,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69633,69688,55],[69689,69702,1],[69744,69747,3],[69748,69759,11],[69760,69761,1],[69811,69814,1],[69817,69818,1],[69826,69888,62],[69889,69890,1],[69927,69931,1],[69933,69940,1],[70003,70016,13],[70017,70070,53],[70071,70078,1],[70089,70092,1],[70095,70191,96],[70192,70193,1],[70196,70198,2],[70199,70206,7],[70209,70367,158],[70371,70378,1],[70400,70401,1],[70459,70460,1],[70464,70502,38],[70503,70508,1],[70512,70516,1],[70712,70719,1],[70722,70724,1],[70726,70750,24],[70835,70840,1],[70842,70847,5],[70848,70850,2],[70851,71090,239],[71091,71093,1],[71100,71101,1],[71103,71104,1],[71132,71133,1],[71219,71226,1],[71229,71231,2],[71232,71339,107],[71341,71344,3],[71345,71349,1],[71351,71453,102],[71454,71455,1],[71458,71461,1],[71463,71467,1],[71727,71735,1],[71737,71738,1],[71995,71996,1],[71998,72003,5],[72148,72151,1],[72154,72155,1],[72160,72193,33],[72194,72202,1],[72243,72248,1],[72251,72254,1],[72263,72273,10],[72274,72278,1],[72281,72283,1],[72330,72342,1],[72344,72345,1],[72752,72758,1],[72760,72765,1],[72767,72850,83],[72851,72871,1],[72874,72880,1],[72882,72883,1],[72885,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73104,73],[73105,73109,4],[73111,73459,348],[73460,73472,12],[73473,73526,53],[73527,73530,1],[73536,73538,2],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94095,64],[94096,94098,1],[94180,113821,19641],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]]),R(A,"foldMn",[[921,953,32],[8126,8126,1]]),R(A,"N",[[48,57,1],[178,179,1],[185,188,3],[189,190,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2548,2553,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[2930,2935,1],[3046,3058,1],[3174,3183,1],[3192,3198,1],[3302,3311,1],[3416,3422,1],[3430,3448,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3891,1],[4160,4169,1],[4240,4249,1],[4969,4988,1],[5870,5872,1],[6112,6121,1],[6128,6137,1],[6160,6169,1],[6470,6479,1],[6608,6618,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[8304,8308,4],[8309,8313,1],[8320,8329,1],[8528,8578,1],[8581,8585,1],[9312,9371,1],[9450,9471,1],[10102,10131,1],[11517,12295,778],[12321,12329,1],[12344,12346,1],[12690,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[42528,42537,1],[42726,42735,1],[43056,43061,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[65799,65843,1],[65856,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[66369,66378,9],[66513,66517,1],[66720,66729,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[68912,68921,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70113,70132,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71483,1],[71904,71922,1],[72016,72025,1],[72784,72812,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[73664,73684,1],[74752,74862,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125127,125135,1],[125264,125273,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1],[130032,130041,1]]),R(A,"Nd",[[48,57,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[3046,3055,1],[3174,3183,1],[3302,3311,1],[3430,3439,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3881,1],[4160,4169,1],[4240,4249,1],[6112,6121,1],[6160,6169,1],[6470,6479,1],[6608,6617,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[42528,42537,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[66720,66729,1],[68912,68921,1],[69734,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71481,1],[71904,71913,1],[72016,72025,1],[72784,72793,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125264,125273,1],[130032,130041,1]]),R(A,"Nl",[[5870,5872,1],[8544,8578,1],[8581,8584,1],[12295,12321,26],[12322,12329,1],[12344,12346,1],[42726,42735,1],[65856,65908,1],[66369,66378,9],[66513,66517,1],[74752,74862,1]]),R(A,"No",[[178,179,1],[185,188,3],[189,190,1],[2548,2553,1],[2930,2935,1],[3056,3058,1],[3192,3198,1],[3416,3422,1],[3440,3448,1],[3882,3891,1],[4969,4988,1],[6128,6137,1],[6618,8304,1686],[8308,8313,1],[8320,8329,1],[8528,8543,1],[8585,9312,727],[9313,9371,1],[9450,9471,1],[10102,10131,1],[11517,12690,1173],[12691,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[43056,43061,1],[65799,65843,1],[65909,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69733,1],[70113,70132,1],[71482,71483,1],[71914,71922,1],[72794,72812,1],[73664,73684,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[125127,125135,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1]]),R(A,"P",[[33,35,1],[37,42,1],[44,47,1],[58,59,1],[63,64,1],[91,93,1],[95,123,28],[125,161,36],[167,171,4],[182,183,1],[187,191,4],[894,903,9],[1370,1375,1],[1417,1418,1],[1470,1472,2],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,3
1964168],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3898,38],[3899,3901,1],[3973,4048,75],[4049,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5120,5742,622],[5787,5788,1],[5867,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8208,829],[8209,8231,1],[8240,8259,1],[8261,8273,1],[8275,8286,1],[8317,8318,1],[8333,8334,1],[8968,8971,1],[9001,9002,1],[10088,10101,1],[10181,10182,1],[10214,10223,1],[10627,10648,1],[10712,10715,1],[10748,10749,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11822,1],[11824,11855,1],[11858,11869,1],[12289,12291,1],[12296,12305,1],[12308,12319,1],[12336,12349,13],[12448,12539,91],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,64830,20819],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65121,1],[65123,65128,5],[65130,65131,1],[65281,65283,1],[65285,65290,1],[65292,65295,1],[65306,65307,1],[65311,65312,1],[65339,65341,1],[65343,65371,28],[65373,65375,2],[65376,65381,1],[65792,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69293,69461,168],[69462,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]]),R(A,"Pc",[[95,8255,8160],[8256,8276,20],[65075,65076,1],[65101,65103,1],[65343,65343,1]]),R(A,"Pd",[[45,1418,1373],[1470,5120,3650],[6150,8208,2058],[8209,8213,1],[11799,11802,3],[11834,11835,1],[11840,11869,29],[12316,12336,20],[12448,65073,52625],[65074,65112,38],[65123,65293,170],[69293,69293,1]]),R(A,"Pe",[[41,93,52],[125,3899,3774],[3901,5788,1887],[8262,8318,56],[8334,8969,635],[8971,9002,31],[10089,10101,2],[10182,10215,33],[10217,10223,2],[10628,10648,2],[10713,10715,2],[10749,11811,1062],[11813,11817,2],[11862,11868,2],[12297,12305,2],[12309,12315,2],[12318,12319,1],[64830,65048,218],[65078,65092,2],[65096,65114,18],[65116,65118,2],[65289,65341,52],[65373,65379,3]]),R(A,"Pf",[[187,8217,8030],[8221,8250,29],[11779,11781,2],[11786,11789,3],[11805,11809,4]]),R(A,"Pi",[[171,8216,8045],[8219,8220,1],[8223,8249,26],[11778,11780,2],[11785,11788,3],[11804,11808,4]]),R(A,"Po",[[33,35,1],[37,39,1],[42,46,2],[47,58,11],[59,63,4],[64,92,28],[161,167,6],[182,183,1],[191,894,703],[903,1370,467],[1371,1375,1],[1417,1472,55],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3973,113],[4048,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5742,5867,125],[5868,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6149,1],[6151,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8214,835],[8215,8224,9],[8225,8231,1],[8240,8248,1],[8251,8254,1],[8257,8259,1],[8263,8273,1],[8275,8277,2],[8278,8286,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11782,5],[11783,11784,1],[11787,11790,3],[11791,11798,1],[11800,11801,1],[11803,11806,3],[11807,11818,11],[11819,11822,1],[11824,11833,1],[11836,11839,1],[11841,11843,2],[11844,11855,1],[11858,11860,1],[12289,12291,1],[12349,12539,190],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,65040,21029],[65041,65046,1],[65049,65072,23],[65093,65094,1],[65097,65100,1],[65104,65106,1],[65108,65111,1],[65119,65121,1],[65128,65130,2],[65131,65281,150],[65282,65283,1],[65285,65287,1],[65290,65294,2],[65295,65306,11],[65307,65311,4],[65312,65340,28],[65377,65380,3],[65381,65792,411],[65793,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,
1964168342,1],[68409,68415,1],[68505,68508,1],[69461,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]]),R(A,"Ps",[[40,91,51],[123,3898,3775],[3900,5787,1887],[8218,8222,4],[8261,8317,56],[8333,8968,635],[8970,9001,31],[10088,10100,2],[10181,10214,33],[10216,10222,2],[10627,10647,2],[10712,10714,2],[10748,11810,1062],[11812,11816,2],[11842,11861,19],[11863,11867,2],[12296,12304,2],[12308,12314,2],[12317,64831,52514],[65047,65077,30],[65079,65091,2],[65095,65113,18],[65115,65117,2],[65288,65339,51],[65371,65375,4],[65378,65378,1]]),R(A,"S",[[36,43,7],[60,62,1],[94,96,2],[124,126,2],[162,166,1],[168,169,1],[172,174,2],[175,177,1],[180,184,4],[215,247,32],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,1014,113],[1154,1421,267],[1422,1423,1],[1542,1544,1],[1547,1550,3],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2046,2047,1],[2184,2546,362],[2547,2554,7],[2555,2801,246],[2928,3059,131],[3060,3066,1],[3199,3407,208],[3449,3647,198],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6107,366],[6464,6622,158],[6623,6655,1],[7009,7018,1],[7028,7036,1],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8352,8384,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8472,1],[8478,8483,1],[8485,8489,2],[8494,8506,12],[8507,8512,5],[8513,8516,1],[8522,8525,1],[8527,8586,59],[8587,8592,5],[8593,8967,1],[8972,9e3,1],[9003,9254,1],[9280,9290,1],[9372,9449,1],[9472,10087,1],[10132,10180,1],[10183,10213,1],[10224,10626,1],[10649,10711,1],[10716,10747,1],[10750,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12443,12444,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,1],[12992,13311,1],[19904,19967,1],[42128,42182,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43048,43051,1],[43062,43065,1],[43639,43641,1],[43867,43882,15],[43883,64297,20414],[64434,64450,1],[64832,64847,1],[64975,65020,45],[65021,65023,1],[65122,65124,2],[65125,65126,1],[65129,65284,155],[65291,65308,17],[65309,65310,1],[65342,65344,2],[65372,65374,2],[65504,65510,1],[65512,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,123647,432],[126124,126128,4],[126254,126704,450],[126705,126976,271],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129
19641095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]]),R(A,"Sc",[[36,162,126],[163,165,1],[1423,1547,124],[2046,2047,1],[2546,2547,1],[2555,2801,246],[3065,3647,582],[6107,8352,2245],[8353,8384,1],[43064,65020,21956],[65129,65284,155],[65504,65505,1],[65509,65510,1],[73693,73696,1],[123647,126128,2481]]),R(A,"Sk",[[94,96,2],[168,175,7],[180,184,4],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,2184,1283],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[12443,12444,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43867,43882,15],[43883,64434,20551],[64435,64450,1],[65342,65344,2],[65507,127995,62488],[127996,127999,1]]),R(A,"Sm",[[43,60,17],[61,62,1],[124,126,2],[172,177,5],[215,247,32],[1014,1542,528],[1543,1544,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8472,8512,40],[8513,8516,1],[8523,8592,69],[8593,8596,1],[8602,8603,1],[8608,8614,3],[8622,8654,32],[8655,8658,3],[8660,8692,32],[8693,8959,1],[8992,8993,1],[9084,9115,31],[9116,9139,1],[9180,9185,1],[9655,9665,10],[9720,9727,1],[9839,10176,337],[10177,10180,1],[10183,10213,1],[10224,10239,1],[10496,10626,1],[10649,10711,1],[10716,10747,1],[10750,11007,1],[11056,11076,1],[11079,11084,1],[64297,65122,825],[65124,65126,1],[65291,65308,17],[65309,65310,1],[65372,65374,2],[65506,65513,7],[65514,65516,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[126704,126705,1]]),R(A,"So",[[166,169,3],[174,176,2],[1154,1421,267],[1422,1550,128],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2554,2928,374],[3059,3064,1],[3066,3199,133],[3407,3449,42],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6464,723],[6622,6655,1],[7009,7018,1],[7028,7036,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8478,7],[8479,8483,1],[8485,8489,2],[8494,8506,12],[8507,8522,15],[8524,8525,1],[8527,8586,59],[8587,8597,10],[8598,8601,1],[8604,8607,1],[8609,8610,1],[8612,8613,1],[8615,8621,1],[8623,8653,1],[8656,8657,1],[8659,8661,2],[8662,8691,1],[8960,8967,1],[8972,8991,1],[8994,9e3,1],[9003,9083,1],[9085,9114,1],[9140,9179,1],[9186,9254,1],[9280,9290,1],[9372,9449,1],[9472,9654,1],[9656,9664,1],[9666,9719,1],[9728,9838,1],[9840,10087,1],[10132,10175,1],[10240,10495,1],[11008,11055,1],[11077,11078,1],[11085,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,1],[12992,13311,1],[19904,19967,1],[42128,42182,1],[43048,43051,1],[43062,43063,1],[43065,43639,574],[43640,43641,1],[64832,64847,1],[64975,65021,46],[65022,65023,1],[65508,65512,4],[65517,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73692,1],[73697,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,126124,2909],[126254,126976,722],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,127994,1],[128e3,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129
19641095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]]),R(A,"Z",[[32,160,128],[5760,8192,2432],[8193,8202,1],[8232,8233,1],[8239,8287,48],[12288,12288,1]]),R(A,"Zl",[[8232,8232,1]]),R(A,"Zp",[[8233,8233,1]]),R(A,"Zs",[[32,160,128],[5760,8192,2432],[8193,8202,1],[8239,8287,48],[12288,12288,1]]),R(A,"Adlam",[[125184,125259,1],[125264,125273,1],[125278,125279,1]]),R(A,"Ahom",[[71424,71450,1],[71453,71467,1],[71472,71494,1]]),R(A,"Anatolian_Hieroglyphs",[[82944,83526,1]]),R(A,"Arabic",[[1536,1540,1],[1542,1547,1],[1549,1562,1],[1564,1566,1],[1568,1599,1],[1601,1610,1],[1622,1647,1],[1649,1756,1],[1758,1791,1],[1872,1919,1],[2160,2190,1],[2192,2193,1],[2200,2273,1],[2275,2303,1],[64336,64450,1],[64467,64829,1],[64832,64911,1],[64914,64967,1],[64975,65008,33],[65009,65023,1],[65136,65140,1],[65142,65276,1],[69216,69246,1],[69373,69375,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[126704,126705,1]]),R(A,"Armenian",[[1329,1366,1],[1369,1418,1],[1421,1423,1],[64275,64279,1]]),R(A,"Avestan",[[68352,68405,1],[68409,68415,1]]),R(A,"Balinese",[[6912,6988,1],[6992,7038,1]]),R(A,"Bamum",[[42656,42743,1],[92160,92728,1]]),R(A,"Bassa_Vah",[[92880,92909,1],[92912,92917,1]]),R(A,"Batak",[[7104,7155,1],[7164,7167,1]]),R(A,"Bengali",[[2432,2435,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2492,2500,1],[2503,2504,1],[2507,2510,1],[2519,2524,5],[2525,2527,2],[2528,2531,1],[2534,2558,1]]),R(A,"Bhaiksuki",[[72704,72712,1],[72714,72758,1],[72760,72773,1],[72784,72812,1]]),R(A,"Bopomofo",[[746,747,1],[12549,12591,1],[12704,12735,1]]),R(A,"Brahmi",[[69632,69709,1],[69714,69749,1],[69759,69759,1]]),R(A,"Braille",[[10240,10495,1]]),R(A,"Buginese",[[6656,6683,1],[6686,6687,1]]),R(A,"Buhid",[[5952,5971,1]]),R(A,"Canadian_Aboriginal",[[5120,5759,1],[6320,6389,1],[72368,72383,1]]),R(A,"Carian",[[66208,66256,1]]),R(A,"Caucasian_Albanian",[[66864,66915,1],[66927,66927,1]]),R(A,"Chakma",[[69888,69940,1],[69942,69959,1]]),R(A,"Cham",[[43520,43574,1],[43584,43597,1],[43600,43609,1],[43612,43615,1]]),R(A,"Cherokee",[[5024,5109,1],[5112,5117,1],[43888,43967,1]]),R(A,"Chorasmian",[[69552,69579,1]]),R(A,"Common",[[0,64,1],[91,96,1],[123,169,1],[171,185,1],[187,191,1],[215,247,32],[697,735,1],[741,745,1],[748,767,1],[884,894,10],[901,903,2],[1541,1548,7],[1563,1567,4],[1600,1757,157],[2274,2404,130],[2405,3647,1242],[4053,4056,1],[4347,5867,1520],[5868,5869,1],[5941,5942,1],[6146,6147,1],[6149,7379,1230],[7393,7401,8],[7402,7404,1],[7406,7411,1],[7413,7415,1],[7418,8192,774],[8193,8203,1],[8206,8292,1],[8294,8304,1],[8308,8318,1],[8320,8334,1],[8352,8384,1],[8448,8485,1],[8487,8489,1],[8492,8497,1],[8499,8525,1],[8527,8543,1],[8585,8587,1],[8592,9254,1],[9280,9290,1],[9312,10239,1],[10496,11123,1],[11126,11157,1],[11159,11263,1],[11776,11869,1],[12272,12292,1],[12294,12296,2],[12297,12320,1],[12336,12343,1],[12348,12351,1],[12443,12444,1],[12448,12539,91],[12540,12688,148],[12689,12703,1],[12736,12771,1],[12783,12832,49],[12833,12895,1],[12927,13007,1],[13055,13144,89],[13145,13311,1],[19904,19967,1],[42752,42785,1],[42888,42890,1],[43056,43065,1],[43310,43471,161],[43867,43882,15],[43883,64830,20947],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65126,1],[65128,65131,1],[65279,65281,2],[65282,65312,1],[65339,65344,1],[65371,65381,1],[65392,65438,46],[65439,65504,65],[65505,65510,1],[65512,65518,1],[65529,65533,1],[65792,65794,1],[65799,65843,1],[65847,65855,1],[65936,65948,1],[66e3,66044,1],[66273,66299,1],[113824,113827,1],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119142,1],[119146,119162,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119488,119507,1],[119520,119539,1],[119552,119638,1],[119648,119672,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,
19641119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120779,1],[120782,120831,1],[126065,126132,1],[126209,126269,1],[126976,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127232,127405,1],[127462,127487,1],[127489,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1],[130032,130041,1],[917505,917536,31],[917537,917631,1]]),R(A,"foldCommon",[[924,956,32]]),R(A,"Coptic",[[994,1007,1],[11392,11507,1],[11513,11519,1]]),R(A,"Cuneiform",[[73728,74649,1],[74752,74862,1],[74864,74868,1],[74880,75075,1]]),R(A,"Cypriot",[[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3]]),R(A,"Cypro_Minoan",[[77712,77810,1]]),R(A,"Cyrillic",[[1024,1156,1],[1159,1327,1],[7296,7304,1],[7467,7544,77],[11744,11775,1],[42560,42655,1],[65070,65071,1],[122928,122989,1],[123023,123023,1]]),R(A,"Deseret",[[66560,66639,1]]),R(A,"Devanagari",[[2304,2384,1],[2389,2403,1],[2406,2431,1],[43232,43263,1],[72448,72457,1]]),R(A,"Dives_Akuru",[[71936,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71989,1],[71991,71992,1],[71995,72006,1],[72016,72025,1]]),R(A,"Dogra",[[71680,71739,1]]),R(A,"Duployan",[[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[113820,113823,1]]),R(A,"Egyptian_Hieroglyphs",[[77824,78933,1]]),R(A,"Elbasan",[[66816,66855,1]]),R(A,"Elymaic",[[69600,69622,1]]),R(A,"Ethiopic",[[4608,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4957,4988,1],[4992,5017,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1]]),R(A,"Georgian",[[4256,4293,1],[4295,4301,6],[4304,4346,1],[4348,4351,1],[7312,7354,1],[7357,7359,1],[11520,11557,1],[11559,11565,6]]),R(A,"Glagolitic",[[11264,11359,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1]]),R(A,"Gothic",[[66352,66378,1]]),R(A,"Grantha",[[70400,70403,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70460,70468,1],[70471,70472,1],[70475,70477,1],[70480,70487,7],[70493,70499,1],[70502,70508,1],[70512,70516,1]]),R(A,"Greek",[[880,883,1],[885,887,1],[890,893,1],[895,900,5],[902,904,2],[905,906,1],[908,910,2],[911,929,1],[931,993,1],[1008,1023,1],[7462,7466,1],[7517,7521,1],[7526,7530,1],[7615,7936,321],[7937,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8132,1],[8134,8147,1],[8150,8155,1],[8157,8175,1],[8178,8180,1],[8182,8190,1],[8486,43877,35391],[65856,65934,1],[65952,119296,53344],[119297,119365,1]]),R(A,"foldGreek",[[181,837,656]]),R(A,"Gujarati",[[2689,2691,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2748,2757,1],[2759,2761,1],[2763,2765,1],[2768,2784,16],[2785,2787,1],[2790,2801,1],[2809,2815,1]]),R(A,"Gunjala_Gondi",[[73056,73061,1],[73063,73064,1],[73066,73102,1],[73104,73105,1],[73107,73112,1],[73120,73129,1]]),R(A,"Gurmukhi",[[2561,2563,1],[2565,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2649,8],[2650,2652,1],[2654,2662,8],[2663,2678,1]]),R(A,"Han",[[11904,11929,1],[11931,12019,1],[12032,12245,1],[12293,12295,2],[12321,12329,1],[12344,12347,1],[13312,19903,1],[19968,40959,1],[63744,64109,1],[64112,64217,1],[94178,94179,1],[94192,94193,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]]),R(A,"Hangul",[[4352,4607,1],[12334,12335,1],[12593,12
19641686,1],[12800,12830,1],[12896,12926,1],[43360,43388,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1]]),R(A,"Hanifi_Rohingya",[[68864,68903,1],[68912,68921,1]]),R(A,"Hanunoo",[[5920,5940,1]]),R(A,"Hatran",[[67808,67826,1],[67828,67829,1],[67835,67839,1]]),R(A,"Hebrew",[[1425,1479,1],[1488,1514,1],[1519,1524,1],[64285,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64335,1]]),R(A,"Hiragana",[[12353,12438,1],[12445,12447,1],[110593,110879,1],[110898,110928,30],[110929,110930,1],[127488,127488,1]]),R(A,"Imperial_Aramaic",[[67648,67669,1],[67671,67679,1]]),R(A,"Inherited",[[768,879,1],[1157,1158,1],[1611,1621,1],[1648,2385,737],[2386,2388,1],[6832,6862,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8204,8205,1],[8400,8432,1],[12330,12333,1],[12441,12442,1],[65024,65039,1],[65056,65069,1],[66045,66272,227],[70459,118528,48069],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[917760,917999,1]]),R(A,"foldInherited",[[921,953,32],[8126,8126,1]]),R(A,"Inscriptional_Pahlavi",[[68448,68466,1],[68472,68479,1]]),R(A,"Inscriptional_Parthian",[[68416,68437,1],[68440,68447,1]]),R(A,"Javanese",[[43392,43469,1],[43472,43481,1],[43486,43487,1]]),R(A,"Kaithi",[[69760,69826,1],[69837,69837,1]]),R(A,"Kannada",[[3200,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3260,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3293,3294,1],[3296,3299,1],[3302,3311,1],[3313,3315,1]]),R(A,"Katakana",[[12449,12538,1],[12541,12543,1],[12784,12799,1],[13008,13054,1],[13056,13143,1],[65382,65391,1],[65393,65437,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110880,288],[110881,110882,1],[110933,110948,15],[110949,110951,1]]),R(A,"Kawi",[[73472,73488,1],[73490,73530,1],[73534,73561,1]]),R(A,"Kayah_Li",[[43264,43309,1],[43311,43311,1]]),R(A,"Kharoshthi",[[68096,68099,1],[68101,68102,1],[68108,68115,1],[68117,68119,1],[68121,68149,1],[68152,68154,1],[68159,68168,1],[68176,68184,1]]),R(A,"Khitan_Small_Script",[[94180,101120,6940],[101121,101589,1]]),R(A,"Khmer",[[6016,6109,1],[6112,6121,1],[6128,6137,1],[6624,6655,1]]),R(A,"Khojki",[[70144,70161,1],[70163,70209,1]]),R(A,"Khudawadi",[[70320,70378,1],[70384,70393,1]]),R(A,"Lao",[[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3773,1],[3776,3780,1],[3782,3784,2],[3785,3790,1],[3792,3801,1],[3804,3807,1]]),R(A,"Latin",[[65,90,1],[97,122,1],[170,186,16],[192,214,1],[216,246,1],[248,696,1],[736,740,1],[7424,7461,1],[7468,7516,1],[7522,7525,1],[7531,7543,1],[7545,7614,1],[7680,7935,1],[8305,8319,14],[8336,8348,1],[8490,8491,1],[8498,8526,28],[8544,8584,1],[11360,11391,1],[42786,42887,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43007,1],[43824,43866,1],[43868,43876,1],[43878,43881,1],[64256,64262,1],[65313,65338,1],[65345,65370,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[122624,122654,1],[122661,122666,1]]),R(A,"Lepcha",[[7168,7223,1],[7227,7241,1],[7245,7247,1]]),R(A,"Limbu",[[6400,6430,1],[6432,6443,1],[6448,6459,1],[6464,6468,4],[6469,6479,1]]),R(A,"Linear_A",[[67072,67382,1],[67392,67413,1],[67424,67431,1]]),R(A,"Linear_B",[[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1]]),R(A,"Lisu",[[42192,42239,1],[73648,73648,1]]),R(A,"Lycian",[[66176,66204,1]]),R(A,"Lydian",[[67872,67897,1],[67903,67903,1]]),R(A,"Mahajani",[[69968,70006,1]]),R(A,"Makasar",[[73440,73464,1]]),R(A,"Malayalam",[[3328,3340,1],[3342,3344,1],[3346,3396,1],[3398,3400,1],[3402,3407,1],[3412,3427,1],[3430,3455,1]]),R(A,"Mandaic",[[2112,2139,1],[2142,2142,1]]),R(A,"Manichaean",[[68288,68326,1],[68331,68342,1]]),R(A,"Marchen",[[72816,72847,1],[72850,72871,1],[72873,72886,1]]),R(A,"Masaram_Gondi",[[72960,72966,1],[72968,72969,1],[72971,73014,1],[73018,73020,2],[73021,73023,2],[73024,73031,1],[73040,73049,1]]),R(A,"Medefaidrin",[[93760,93850,1]]),R(A,"Meetei_Mayek",[[43744,43766,1],[43968,44013,1],[44016,44025,1]]),R(A,"Mende_Kikakui",[[124928,125124,1],[125127,125142,1]]),R(A,"Meroitic_Cursive",[[68e3,68023,1],[68028,68047,1],[68050,68095,1]]),R(A,"Meroitic_Hieroglyphs",[[67968,67999,1]]),R(A,"Miao",[[93952,94026,1],[94031,94087,1],[94095,94111,1]]),R(A,"Modi",[[71168,71236,1],[71248,71257,1]]),R(A,"Mongolian",[[6144,6145,1],[6148,6150,2],[6151,6169,1],[6176,6264,1],[6272,6314,1],[71264,71276,1]]),R(A,"Mro",[[92736,92766,1],[92768,92777,1],[92782,92783,1]]),R(A,"Multani",[[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70313,1]]),R(A,"Myanmar",[[4096,4255,1],[43488,43518,1],[43616,43647,1]]),R(A,"N
19641abataean",[[67712,67742,1],[67751,67759,1]]),R(A,"Nag_Mundari",[[124112,124153,1]]),R(A,"Nandinagari",[[72096,72103,1],[72106,72151,1],[72154,72164,1]]),R(A,"New_Tai_Lue",[[6528,6571,1],[6576,6601,1],[6608,6618,1],[6622,6623,1]]),R(A,"Newa",[[70656,70747,1],[70749,70753,1]]),R(A,"Nko",[[1984,2042,1],[2045,2047,1]]),R(A,"Nushu",[[94177,110960,16783],[110961,111355,1]]),R(A,"Nyiakeng_Puachue_Hmong",[[123136,123180,1],[123184,123197,1],[123200,123209,1],[123214,123215,1]]),R(A,"Ogham",[[5760,5788,1]]),R(A,"Ol_Chiki",[[7248,7295,1]]),R(A,"Old_Hungarian",[[68736,68786,1],[68800,68850,1],[68858,68863,1]]),R(A,"Old_Italic",[[66304,66339,1],[66349,66351,1]]),R(A,"Old_North_Arabian",[[68224,68255,1]]),R(A,"Old_Permic",[[66384,66426,1]]),R(A,"Old_Persian",[[66464,66499,1],[66504,66517,1]]),R(A,"Old_Sogdian",[[69376,69415,1]]),R(A,"Old_South_Arabian",[[68192,68223,1]]),R(A,"Old_Turkic",[[68608,68680,1]]),R(A,"Old_Uyghur",[[69488,69513,1]]),R(A,"Oriya",[[2817,2819,1],[2821,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2876,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2908,2909,1],[2911,2915,1],[2918,2935,1]]),R(A,"Osage",[[66736,66771,1],[66776,66811,1]]),R(A,"Osmanya",[[66688,66717,1],[66720,66729,1]]),R(A,"Pahawh_Hmong",[[92928,92997,1],[93008,93017,1],[93019,93025,1],[93027,93047,1],[93053,93071,1]]),R(A,"Palmyrene",[[67680,67711,1]]),R(A,"Pau_Cin_Hau",[[72384,72440,1]]),R(A,"Phags_Pa",[[43072,43127,1]]),R(A,"Phoenician",[[67840,67867,1],[67871,67871,1]]),R(A,"Psalter_Pahlavi",[[68480,68497,1],[68505,68508,1],[68521,68527,1]]),R(A,"Rejang",[[43312,43347,1],[43359,43359,1]]),R(A,"Runic",[[5792,5866,1],[5870,5880,1]]),R(A,"Samaritan",[[2048,2093,1],[2096,2110,1]]),R(A,"Saurashtra",[[43136,43205,1],[43214,43225,1]]),R(A,"Sharada",[[70016,70111,1]]),R(A,"Shavian",[[66640,66687,1]]),R(A,"Siddham",[[71040,71093,1],[71096,71133,1]]),R(A,"SignWriting",[[120832,121483,1],[121499,121503,1],[121505,121519,1]]),R(A,"Sinhala",[[3457,3459,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3558,3567,1],[3570,3572,1],[70113,70132,1]]),R(A,"Sogdian",[[69424,69465,1]]),R(A,"Sora_Sompeng",[[69840,69864,1],[69872,69881,1]]),R(A,"Soyombo",[[72272,72354,1]]),R(A,"Sundanese",[[7040,7103,1],[7360,7367,1]]),R(A,"Syloti_Nagri",[[43008,43052,1]]),R(A,"Syriac",[[1792,1805,1],[1807,1866,1],[1869,1871,1],[2144,2154,1]]),R(A,"Tagalog",[[5888,5909,1],[5919,5919,1]]),R(A,"Tagbanwa",[[5984,5996,1],[5998,6e3,1],[6002,6003,1]]),R(A,"Tai_Le",[[6480,6509,1],[6512,6516,1]]),R(A,"Tai_Tham",[[6688,6750,1],[6752,6780,1],[6783,6793,1],[6800,6809,1],[6816,6829,1]]),R(A,"Tai_Viet",[[43648,43714,1],[43739,43743,1]]),R(A,"Takri",[[71296,71353,1],[71360,71369,1]]),R(A,"Tamil",[[2946,2947,1],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3006,3010,1],[3014,3016,1],[3018,3021,1],[3024,3031,7],[3046,3066,1],[73664,73713,1],[73727,73727,1]]),R(A,"Tangsa",[[92784,92862,1],[92864,92873,1]]),R(A,"Tangut",[[94176,94208,32],[94209,100343,1],[100352,101119,1],[101632,101640,1]]),R(A,"Telugu",[[3072,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3132,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3160,3162,1],[3165,3168,3],[3169,3171,1],[3174,3183,1],[3191,3199,1]]),R(A,"Thaana",[[1920,1969,1]]),R(A,"Thai",[[3585,3642,1],[3648,3675,1]]),R(A,"Tibetan",[[3840,3911,1],[3913,3948,1],[3953,3991,1],[3993,4028,1],[4030,4044,1],[4046,4052,1],[4057,4058,1]]),R(A,"Tifinagh",[[11568,11623,1],[11631,11632,1],[11647,11647,1]]),R(A,"Tirhuta",[[70784,70855,1],[70864,70873,1]]),R(A,"Toto",[[123536,123566,1]]),R(A,"Ugaritic",[[66432,66461,1],[66463,66463,1]]),R(A,"Vai",[[42240,42539,1]]),R(A,"Vithkuqi",[[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1]]),R(A,"Wancho",[[123584,123641,1],[123647,123647,1]]),R(A,"Warang_Citi",[[71840,71922,1],[71935,71935,1]]),R(A,"Yezidi",[[69248,69289,1],[69291,69293,1],[69296,69297,1]]),R(A,"Yi",[[40960,42124,1],[42128,42182,1]]),R(A,"Zanabazar_Square",[[72192,72263,1]]),R(A,"CATEGORIES",new Map([["C",A.C],["Cc",A.Cc],["Cf",A.Cf],["Co",A.Co],["Cs",A.Cs],["L",A.L],["Ll",A.Ll],["Lm",A.Lm],["Lo",A.Lo],["Lt",A.Lt],["Lu",A.
19641Lu],["M",A.M],["Mc",A.Mc],["Me",A.Me],["Mn",A.Mn],["N",A.N],["Nd",A.Nd],["Nl",A.Nl],["No",A.No],["P",A.P],["Pc",A.Pc],["Pd",A.Pd],["Pe",A.Pe],["Pf",A.Pf],["Pi",A.Pi],["Po",A.Po],["Ps",A.Ps],["S",A.S],["Sc",A.Sc],["Sk",A.Sk],["Sm",A.Sm],["So",A.So],["Z",A.Z],["Zl",A.Zl],["Zp",A.Zp],["Zs",A.Zs]])),R(A,"SCRIPTS",new Map([["Adlam",A.Adlam],["Ahom",A.Ahom],["Anatolian_Hieroglyphs",A.Anatolian_Hieroglyphs],["Arabic",A.Arabic],["Armenian",A.Armenian],["Avestan",A.Avestan],["Balinese",A.Balinese],["Bamum",A.Bamum],["Bassa_Vah",A.Bassa_Vah],["Batak",A.Batak],["Bengali",A.Bengali],["Bhaiksuki",A.Bhaiksuki],["Bopomofo",A.Bopomofo],["Brahmi",A.Brahmi],["Braille",A.Braille],["Buginese",A.Buginese],["Buhid",A.Buhid],["Canadian_Aboriginal",A.Canadian_Aboriginal],["Carian",A.Carian],["Caucasian_Albanian",A.Caucasian_Albanian],["Chakma",A.Chakma],["Cham",A.Cham],["Cherokee",A.Cherokee],["Chorasmian",A.Chorasmian],["Common",A.Common],["Coptic",A.Coptic],["Cuneiform",A.Cuneiform],["Cypriot",A.Cypriot],["Cypro_Minoan",A.Cypro_Minoan],["Cyrillic",A.Cyrillic],["Deseret",A.Deseret],["Devanagari",A.Devanagari],["Dives_Akuru",A.Dives_Akuru],["Dogra",A.Dogra],["Duployan",A.Duployan],["Egyptian_Hieroglyphs",A.Egyptian_Hieroglyphs],["Elbasan",A.Elbasan],["Elymaic",A.Elymaic],["Ethiopic",A.Ethiopic],["Georgian",A.Georgian],["Glagolitic",A.Glagolitic],["Gothic",A.Gothic],["Grantha",A.Grantha],["Greek",A.Greek],["Gujarati",A.Gujarati],["Gunjala_Gondi",A.Gunjala_Gondi],["Gurmukhi",A.Gurmukhi],["Han",A.Han],["Hangul",A.Hangul],["Hanifi_Rohingya",A.Hanifi_Rohingya],["Hanunoo",A.Hanunoo],["Hatran",A.Hatran],["Hebrew",A.Hebrew],["Hiragana",A.Hiragana],["Imperial_Aramaic",A.Imperial_Aramaic],["Inherited",A.Inherited],["Inscriptional_Pahlavi",A.Inscriptional_Pahlavi],["Inscriptional_Parthian",A.Inscriptional_Parthian],["Javanese",A.Javanese],["Kaithi",A.Kaithi],["Kannada",A.Kannada],["Katakana",A.Katakana],["Kawi",A.Kawi],["Kayah_Li",A.Kayah_Li],["Kharoshthi",A.Kharoshthi],["Khitan_Small_Script",A.Khitan_Small_Script],["Khmer",A.Khmer],["Khojki",A.Khojki],["Khudawadi",A.Khudawadi],["Lao",A.Lao],["Latin",A.Latin],["Lepcha",A.Lepcha],["Limbu",A.Limbu],["Linear_A",A.Linear_A],["Linear_B",A.Linear_B],["Lisu",A.Lisu],["Lycian",A.Lycian],["Lydian",A.Lydian],["Mahajani",A.Mahajani],["Makasar",A.Makasar],["Malayalam",A.Malayalam],["Mandaic",A.Mandaic],["Manichaean",A.Manichaean],["Marchen",A.Marchen],["Masaram_Gondi",A.Masaram_Gondi],["Medefaidrin",A.Medefaidrin],["Meetei_Mayek",A.Meetei_Mayek],["Mende_Kikakui",A.Mende_Kikakui],["Meroitic_Cursive",A.Meroitic_Cursive],["Meroitic_Hieroglyphs",A.Meroitic_Hieroglyphs],["Miao",A.Miao],["Modi",A.Modi],["Mongolian",A.Mongolian],["Mro",A.Mro],["Multani",A.Multani],["Myanmar",A.Myanmar],["Nabataean",A.Nabataean],["Nag_Mundari",A.Nag_Mundari],["Nandinagari",A.Nandinagari],["New_Tai_Lue",A.New_Tai_Lue],["Newa",A.Newa],["Nko",A.Nko],["Nushu",A.Nushu],["Nyiakeng_Puachue_Hmong",A.Nyiakeng_Puachue_Hmong],["Ogham",A.Ogham],["Ol_Chiki",A.Ol_Chiki],["Old_Hungarian",A.Old_Hungarian],["Old_Italic",A.Old_Italic],["Old_North_Arabian",A.Old_North_Arabian],["Old_Permic",A.Old_Permic],["Old_Persian",A.Old_Persian],["Old_Sogdian",A.Old_Sogdian],["Old_South_Arabian",A.Old_South_Arabian],["Old_Turkic",A.Old_Turkic],["Old_Uyghur",A.Old_Uyghur],["Oriya",A.Oriya],["Osage",A.Osage],["Osmanya",A.Osmanya],["Pahawh_Hmong",A.Pahawh_Hmong],["Palmyrene",A.Palmyrene],["Pau_Cin_Hau",A.Pau_Cin_Hau],["Phags_Pa",A.Phags_Pa],["Phoenician",A.Phoenician],["Psalter_Pahlavi",A.Psalter_Pahlavi],["Rejang",A.Rejang],["Runic",A.Runic],["Samaritan",A.Samaritan],["Saurashtra",A.Saurashtra],["Sharada",A.Sharada],["Shavian",A.Shavian],["Siddham",A.Siddham],["SignWriting",A.SignWriting],["Sinhala",A.Sinhala],["Sogdian",A.Sogdian],["Sora_Sompeng",A.Sora_Sompeng],["Soyombo",A.Soyombo],["Sundanese",A.Sundanese],["Syloti_Nagri",A.Syloti_Nagri],["Syriac",A.Syriac],["Tagalog",A.Tagalog],["Tagbanwa",A.Tagbanwa],["Tai_Le",A.Tai_Le],["Tai_Tham",A.Tai_Tham],["Tai_Viet",A.Tai_Viet],["Takri",A.Takri],["Tamil",A.Tamil],["Tangsa",A.Tangsa],["Tangut",A.Tangut],["Telugu",A.Telugu],["Thaana",A.Thaana],["Thai",A.Thai],["Tibetan",A.Tibetan],["Tifinagh",A.Tifinagh],["Tirhuta",A.Tirhuta],["Toto",A.Toto],["Ugaritic",A.Ugaritic],["Vai",A.Vai],["Vithkuqi",A.Vithkuqi],["Wancho",A.Wancho],["Warang_Citi",A.Warang_Citi],["Yezidi",A.Yezidi],["Yi",A.Yi],["Zanabazar_Square",A.Zanabazar_Square]])),R(A,"FOLD_CATEGORIES",new Map([["L",A.foldL],["Ll",A.foldLl],["Lt",A.foldLt],["Lu",A.foldLu],["M",A.foldM],["Mn",A.foldMn]])),R(A,"FOLD_SCRIPT",new Map([["Common",A.foldCommon],["Greek",A.foldGreek],["Inherited",A.foldInherited]]));let kn=A;class ze{static is32(e,t){let o=0,a=e.length;for(;o<a;){let d=o+Math.floor((a-o)/2),c=e[d];if(c[0]<=t&&t<=c[1])return(t-c[0])%c[2]===0;t<c[0]?a=d:o=d+1}return!1}static is(e,t){if(t<=this.MAX_LATIN1){for(let o of e)if(!(t>o[1]))return t<o[0]?!1:(t-o[0])%o[2]===0;return!1}return e.length>0&&t>=e[0][0]&&this.is32(e,t)}static isUpper(e){if(e<=this.MAX_LATIN1){const t=String.fromCodePoint(e);return t.toUpperCase()===t&&t.toLowerCase()!==t}return this.is(kn.Upper,e)}static isPrint(e){return e<=this.MAX_LATIN1?e>=32&&e<127||e>=161&&e!==173:this.is(kn.L,e)||this.is(kn.M,e)||this.is(kn.N,e)||this.is(kn.P,e)||this.is(kn.S,e)}static simpleFold(e){if(kn.CASE_ORBIT.has(e))return kn.CASE_ORBIT.get(e);const t=H.toLowerCase(e);return t!==e?t:H.toUpperCase(e)}static equalsIgnoreCase(e,t){if(e<0||t<0||e===t)return!0;
19641if(e<=this.MAX_ASCII&&t<=this.MAX_ASCII)return H.CODES.get("A")<=e&&e<=H.CODES.get("Z")&&(e|=32),H.CODES.get("A")<=t&&t<=H.CODES.get("Z")&&(t|=32),e===t;for(let o=this.simpleFold(e);o!==e;o=this.simpleFold(o))if(o===t)return!0;return!1}}R(ze,"MAX_RUNE",1114111),R(ze,"MAX_ASCII",127),R(ze,"MAX_LATIN1",255),R(ze,"MAX_BMP",65535),R(ze,"MIN_FOLD",65),R(ze,"MAX_FOLD",125251);class He{static emptyInts(){return[]}static isalnum(e){return H.CODES.get("0")<=e&&e<=H.CODES.get("9")||H.CODES.get("a")<=e&&e<=H.CODES.get("z")||H.CODES.get("A")<=e&&e<=H.CODES.get("Z")}static unhex(e){return H.CODES.get("0")<=e&&e<=H.CODES.get("9")?e-H.CODES.get("0"):H.CODES.get("a")<=e&&e<=H.CODES.get("f")?e-H.CODES.get("a")+10:H.CODES.get("A")<=e&&e<=H.CODES.get("F")?e-H.CODES.get("A")+10:-1}static escapeRune(e){let t="";if(ze.isPrint(e))this.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(t+="\\"),t+=String.fromCodePoint(e);else switch(e){case H.CODES.get('"'):t+='\\"';break;case H.CODES.get("\\"):t+="\\\\";break;case H.CODES.get("	"):t+="\\t";break;case H.CODES.get(`
19642`):t+="\\n";break;case H.CODES.get("\r"):t+="\\r";break;case H.CODES.get("\b"):t+="\\b";break;case H.CODES.get("\f"):t+="\\f";break;default:{let o=e.toString(16);e<256?(t+="\\x",o.length===1&&(t+="0"),t+=o):t+=`\\x{${o}}`;break}}return t}static stringToRunes(e){return String(e).split("").map(t=>t.codePointAt(0))}static runeToString(e){return String.fromCodePoint(e)}static isWordRune(e){return H.CODES.get("a")<=e&&e<=H.CODES.get("z")||H.CODES.get("A")<=e&&e<=H.CODES.get("Z")||H.CODES.get("0")<=e&&e<=H.CODES.get("9")||e===H.CODES.get("_")}static emptyOpContext(e,t){let o=0;return e<0&&(o|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),e===H.CODES.get(`
19643`)&&(o|=this.EMPTY_BEGIN_LINE),t<0&&(o|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),t===H.CODES.get(`
19644`)&&(o|=this.EMPTY_END_LINE),this.isWordRune(e)!==this.isWordRune(t)?o|=this.EMPTY_WORD_BOUNDARY:o|=this.EMPTY_NO_WORD_BOUNDARY,o}static quoteMeta(e){return e.split("").map(t=>this.METACHARACTERS.indexOf(t)>=0?`\\${t}`:t).join("")}static charCount(e){return e>ze.MAX_BMP?2:1}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(e));{let t=[],o=0;for(let a=0;a<e.length;a++){let d=e.charCodeAt(a);d<128?t[o++]=d:d<2048?(t[o++]=d>>6|192,t[o++]=d&63|128):(d&64512)===55296&&a+1<e.length&&(e.charCodeAt(a+1)&64512)===56320?(d=65536+((d&1023)<<10)+(e.charCodeAt(++a)&1023),t[o++]=d>>18|240,t[o++]=d>>12&63|128,t[o++]=d>>6&63|128,t[o++]=d&63|128):(t[o++]=d>>12|224,t[o++]=d>>6&63|128,t[o++]=d&63|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(e));{let t=[],o=0,a=0;for(;o<e.length;){let d=e[o++];if(d<128)t[a++]=String.fromCharCode(d);else if(d>191&&d<224){let c=e[o++];t[a++]=String.fromCharCode((d&31)<<6|c&63)}else if(d>239&&d<365){let c=e[o++],g=e[o++],h=e[o++],v=((d&7)<<18|(c&63)<<12|(g&63)<<6|h&63)-65536;t[a++]=String.fromCharCode(55296+(v>>10)),t[a++]=String.fromCharCode(56320+(v&1023))}else{let c=e[o++],g=e[o++];t[a++]=String.fromCharCode((d&15)<<12|(c&63)<<6|g&63)}}return t.join("")}}}R(He,"METACHARACTERS","\\.+*?()|[]{}^$"),R(He,"EMPTY_BEGIN_LINE",1),R(He,"EMPTY_END_LINE",2),R(He,"EMPTY_BEGIN_TEXT",4),R(He,"EMPTY_END_TEXT",8),R(He,"EMPTY_WORD_BOUNDARY",16),R(He,"EMPTY_NO_WORD_BOUNDARY",32),R(He,"EMPTY_ALL",-1);const hy=(r=[],e=0)=>{const t={};for(let o=0;o<r.length;o++){const a=r[o],d=e+o;t[a]=d,t[d]=a}return Object.freeze(t)},Kd=class Kd{getEncoding(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===Kd.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===Kd.Encoding.UTF_16}};R(Kd,"Encoding",hy(["UTF_16","UTF_8"]));let na=Kd;class m2 extends na{constructor(e=null){super(),this.bytes=e}getEncoding(){return na.Encoding.UTF_8}asCharSequence(){return He.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}}class w9 extends na{constructor(e=null){super(),this.charSequence=e}getEncoding(){return na.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split("").map(e=>e.codePointAt(0))}length(){return this.charSequence.length}}class _u{static utf16(e){return new w9(e)}static utf8(e){return Array.isArray(e)?new m2(e):new m2(He.stringToUtf8ByteArray(e))}}
19644class Hu extends Error{constructor(e){super(e),this.name="RE2JSException"}}class Ft extends Hu{constructor(e,t=null){let o=`error parsing regexp: ${e}`;t&&(o+=`: \`${t}\``),super(o),this.name="RE2JSSyntaxException",this.message=o,this.error=e,this.input=t}getDescription(){return this.error}getPattern(){return this.input}}class E9 extends Hu{constructor(e){super(e),this.name="RE2JSCompileException"}}class Qs extends Hu{constructor(e){super(e),this.name="RE2JSGroupException"}}class S9 extends Hu{constructor(e){super(e),this.name="RE2JSFlagsException"}}class k9{static quoteReplacement(e){return e.indexOf("\\")<0&&e.indexOf("$")<0?e:e.split("").map(t=>{const o=t.codePointAt(0);return o===H.CODES["\\"]||o===H.CODES.$?`\\${t}`:t}).join("")}constructor(e,t){if(e===null)throw new Error("pattern is null");this.patternInput=e;const o=this.patternInput.re2();this.patternGroupCount=o.numberOfCapturingGroups(),this.groups=[],this.namedGroups=o.namedGroups,t instanceof na?this.resetMatcherInput(t):Array.isArray(t)?this.resetMatcherInput(_u.utf8(t)):this.resetMatcherInput(_u.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(e===null)throw new Error("input is null");return this.matcherInput=e,this.reset(),this}start(e=0){if(typeof e=="string"){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new Qs(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if(typeof e=="string"){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new Qs(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}group(e=0){if(typeof e=="string"){const a=this.namedGroups[e];if(!Number.isFinite(a))throw new Qs(`group '${e}' not found`);e=a}const t=this.start(e),o=this.end(e);return t<0&&o<0?null:this.substring(t,o)}groupCount(){return this.patternGroupCount}loadGroup(e){if(e<0||e>this.patternGroupCount)throw new Qs(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new Qs("perhaps no match attempted");if(e===0||this.hasGroups)return;let t=this.groups[1]+1;t>this.matcherInputLength&&(t=this.matcherInputLength);const o=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount);if(!o[0])throw new Qs("inconsistency in matching group data");this.groups=o[1],this.hasGroups=!0}matches(){return this.genMatch(0,fe.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,fe.ANCHOR_START)}find(e=null){if(e!==null){if(e<0||e>this.matcherInputLength)throw new Qs(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}return e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1]&&e++),this.genMatch(e,fe.UNANCHORED)}genMatch(e,t){const o=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1);return o[0]?(this.groups=o[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=t,!0):!1}substring(e,t){return this.matcherInput.isUTF8Encoding()?He.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let o="";const a=this.start(),d=this.end();return this.appendPos<a&&(o+=this.substring(this.appendPos,a)),this.appendPos=d,o+=t?this.appendReplacementInternalPerl(e):this.appendReplacementInternal(e),o}appendReplacementInternal(e){let t="",o=0;const a=e.length;for(let d=0;d<a-1;d++){if(e.codePointAt(d)===H.CODES.get("\\")){o<d&&(t+=e.substring(o,d)),d++,o=d;continue}if(e.codePointAt(d)===H.CODES.get("$")){let c=e.codePointAt(d+1);if(H.CODES.get("0")<=c&&c<=H.CODES.get("9")){let g=c-H.CODES.get("0");for(o<d&&(t+=e.substring(o,d)),d+=2;d<a&&(c=e.codePointAt(d),!(c<H.CODES.get("0")||c>H.CODES.get("9")||g*10+c-H.CODES.get("0")>this.patternGroupCount));d++)g=g*10+c-H.CODES.get("0");if(g>this.patternGroupCount)throw new Qs(`n > number of groups: ${g}`);const h=this.group(g);h!==null&&(t+=h),o=d,d--;continue}else if(c===H.CODES.get("{")){o<d&&(t+=e.substring(o,d)),d++;let g=d+1;for(;g<e.length&&e.codePointAt(g)!==H.CODES.get("}")&&e.codePointAt(g)!==H.CODES.get(" ");
19644)g++;if(g===e.length||e.codePointAt(g)!==H.CODES.get("}"))throw new Qs("named capture group is missing trailing '}'");const h=e.substring(d+1,g);t+=this.group(h),o=g+1}}}return o<a&&(t+=e.substring(o,a)),t}appendReplacementInternalPerl(e){let t="",o=0;const a=e.length;for(let d=0;d<a-1;d++)if(e.codePointAt(d)===H.CODES.get("$")){let c=e.codePointAt(d+1);if(H.CODES.get("$")===c){o<d&&(t+=e.substring(o,d)),t+="$",d++,o=d+1;continue}else if(H.CODES.get("&")===c){o<d&&(t+=e.substring(o,d));const g=this.group(0);g!==null?t+=g:t+="$&",d++,o=d+1;continue}else if(H.CODES.get("1")<=c&&c<=H.CODES.get("9")){let g=c-H.CODES.get("0");for(o<d&&(t+=e.substring(o,d)),d+=2;d<a&&(c=e.codePointAt(d),!(c<H.CODES.get("0")||c>H.CODES.get("9")||g*10+c-H.CODES.get("0")>this.patternGroupCount));d++)g=g*10+c-H.CODES.get("0");if(g>this.patternGroupCount){t+=`$${g}`,o=d,d--;continue}const h=this.group(g);h!==null&&(t+=h),o=d,d--;continue}else if(c===H.CODES.get("<")){o<d&&(t+=e.substring(o,d)),d++;let g=d+1;for(;g<e.length&&e.codePointAt(g)!==H.CODES.get(">")&&e.codePointAt(g)!==H.CODES.get(" ");)g++;if(g===e.length||e.codePointAt(g)!==H.CODES.get(">")){t+=e.substring(d-1,g+1),o=g+1;continue}const h=e.substring(d+1,g);Object.prototype.hasOwnProperty.call(this.namedGroups,h)?t+=this.group(h):t+=`$<${h}>`,o=g+1}}return o<a&&(t+=e.substring(o,a)),t}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(e,t=!1){return this.replace(e,!0,t)}replaceFirst(e,t=!1){return this.replace(e,!1,t)}replace(e,t=!0,o=!1){let a="";for(this.reset();this.find()&&(a+=this.appendReplacement(e,o),!!t););return a+=this.appendTail(),a}}class Fr{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}}class C9 extends Fr{constructor(e,t=0,o=e.length){super(),this.bytes=e,this.start=t,this.end=o}step(e){if(e+=this.start,e>=this.end)return Fr.EOF();let t=this.bytes[e++]&255;return(t&128)===0?t<<3|1:(t&224)===192?(t=t&31,e>=this.end?Fr.EOF():(t=t<<6|this.bytes[e++]&63,t<<3|2)):(t&240)===224?(t=t&15,e+1>=this.end?Fr.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|3)):(t=t&7,e+2>=this.end?Fr.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|4))}index(e,t){t+=this.start;const o=this.indexOf(this.bytes,e.prefixUTF8,t);return o<0?o:o-t}context(e){e+=this.start;let t=-1;if(e>this.start&&e<=this.end){let a=e-1;if(t=this.bytes[a--],t>=128){let d=e-4;for(d<this.start&&(d=this.start);a>=d&&(this.bytes[a]&192)===128;)a--;a<this.start&&(a=this.start),t=this.step(a)>>3}}const o=e<this.end?this.step(e)>>3:-1;return He.emptyOpContext(t,o)}indexOf(e,t,o=0){let a=t.length;if(a===0)return-1;let d=e.length;for(let c=o;c<=d-a;c++)for(let g=0;g<a&&e[c+g]===t[g];g++)if(g===a-1)return c;return-1}}class R9 extends Fr{constructor(e,t=0,o=e.length){super(),this.charSequence=e,this.start=t,this.end=o}step(e){if(e+=this.start,e<this.end){const t=this.charSequence.codePointAt(e);return t<<3|He.charCount(t)}else return Fr.EOF()}index(e,t){t+=this.start;const o=this.charSequence.indexOf(e.prefix,t);return o<0?o:o-t}context(e){e+=this.start;const t=e>0&&e<=this.charSequence.length?this.charSequence.codePointAt(e-1):-1,o=e<this.charSequence.length?this.charSequence.codePointAt(e):-1;return He.emptyOpContext(t,o)}}class jt{static fromUTF8(e,t=0,o=e.length){return new C9(e,t,o)}static fromUTF16(e,t=0,o=e.length){return new R9(e,t,o)}}const Oe=class Oe{static isPseudoOp(e){return e>=Oe.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(e){return e===H.CODES.get("-")?"\\":""}static fromRegexp(e){const t=new Oe(e.op);return t.flags=e.flags,t.subs=e.subs,t.runes=e.runes,t.cap=e.cap,t.min=e.min,t.max=e.max,t.name=e.name,t.namedGroups=e.namedGroups,t}constructor(e){this.op=e,this.flags=0,this.subs=Oe.emptySubs(),this.runes=null,this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=Oe.emptySubs(),this.runes=null,this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let e="";switch(this.op){case Oe.Op.NO_MATCH:e+="[^\\x00-\\x{10FFFF}]";break;case Oe.Op.EMPTY_MATCH:e+="(?:)";break;case Oe.Op.STAR:case Oe.Op.PLUS:case Oe.Op.QUEST:case Oe.Op.REPEAT:{const t=this.subs[
196440];switch(t.op>Oe.Op.CAPTURE||t.op===Oe.Op.LITERAL&&t.runes.length>1?e+=`(?:${t.appendTo()})`:e+=t.appendTo(),this.op){case Oe.Op.STAR:e+="*";break;case Oe.Op.PLUS:e+="+";break;case Oe.Op.QUEST:e+="?";break;case Oe.Op.REPEAT:e+=`{${this.min}`,this.min!==this.max&&(e+=",",this.max>=0&&(e+=this.max)),e+="}";break}(this.flags&fe.NON_GREEDY)!==0&&(e+="?");break}case Oe.Op.CONCAT:{for(let t of this.subs)t.op===Oe.Op.ALTERNATE?e+=`(?:${t.appendTo()})`:e+=t.appendTo();break}case Oe.Op.ALTERNATE:{let t="";for(let o of this.subs)e+=t,t="|",e+=o.appendTo();break}case Oe.Op.LITERAL:(this.flags&fe.FOLD_CASE)!==0&&(e+="(?i:");for(let t of this.runes)e+=He.escapeRune(t);(this.flags&fe.FOLD_CASE)!==0&&(e+=")");break;case Oe.Op.ANY_CHAR_NOT_NL:e+="(?-s:.)";break;case Oe.Op.ANY_CHAR:e+="(?s:.)";break;case Oe.Op.CAPTURE:this.name===null||this.name.length===0?e+="(":e+=`(?P<${this.name}>`,this.subs[0].op!==Oe.Op.EMPTY_MATCH&&(e+=this.subs[0].appendTo()),e+=")";break;case Oe.Op.BEGIN_TEXT:e+="\\A";break;case Oe.Op.END_TEXT:(this.flags&fe.WAS_DOLLAR)!==0?e+="(?-m:$)":e+="\\z";break;case Oe.Op.BEGIN_LINE:e+="^";break;case Oe.Op.END_LINE:e+="$";break;case Oe.Op.WORD_BOUNDARY:e+="\\b";break;case Oe.Op.NO_WORD_BOUNDARY:e+="\\B";break;case Oe.Op.CHAR_CLASS:if(this.runes.length%2!==0){e+="[invalid char class]";break}if(e+="[",this.runes.length===0)e+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===ze.MAX_RUNE){e+="^";for(let t=1;t<this.runes.length-1;t+=2){const o=this.runes[t]+1,a=this.runes[t+1]-1;e+=Oe.quoteIfHyphen(o),e+=He.escapeRune(o),o!==a&&(e+="-",e+=Oe.quoteIfHyphen(a),e+=He.escapeRune(a))}}else for(let t=0;t<this.runes.length;t+=2){const o=this.runes[t],a=this.runes[t+1];e+=Oe.quoteIfHyphen(o),e+=He.escapeRune(o),o!==a&&(e+="-",e+=Oe.quoteIfHyphen(a),e+=He.escapeRune(a))}e+="]";break;default:e+=this.op;break}return e}maxCap(){let e=0;if(this.op===Oe.Op.CAPTURE&&(e=this.cap),this.subs!==null)for(let t of this.subs){const o=t.maxCap();e<o&&(e=o)}return e}equals(e){if(!(e!==null&&e instanceof Oe)||this.op!==e.op)return!1;switch(this.op){case Oe.Op.END_TEXT:{if((this.flags&fe.WAS_DOLLAR)!==(e.flags&fe.WAS_DOLLAR))return!1;break}case Oe.Op.LITERAL:case Oe.Op.CHAR_CLASS:{if(this.runes===null&&e.runes===null)break;if(this.runes===null||e.runes===null||this.runes.length!==e.runes.length)return!1;for(let t=0;t<this.runes.length;t++)if(this.runes[t]!==e.runes[t])return!1;break}case Oe.Op.ALTERNATE:case Oe.Op.CONCAT:{if(this.subs.length!==e.subs.length)return!1;for(let t=0;t<this.subs.length;++t)if(!this.subs[t].equals(e.subs[t]))return!1;break}case Oe.Op.STAR:case Oe.Op.PLUS:case Oe.Op.QUEST:{if((this.flags&fe.NON_GREEDY)!==(e.flags&fe.NON_GREEDY)||!this.subs[0].equals(e.subs[0]))return!1;break}case Oe.Op.REPEAT:{if((this.flags&fe.NON_GREEDY)!==(e.flags&fe.NON_GREEDY)||this.min!==e.min||this.max!==e.max||!this.subs[0].equals(e.subs[0]))return!1;break}case Oe.Op.CAPTURE:{if(this.cap!==e.cap||(this.name===null?e.name!==null:this.name!==e.name)||!this.subs[0].equals(e.subs[0]))return!1;break}}return!0}};R(Oe,"Op",hy(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]));let $=Oe;const _t=class _t{static isRuneOp(e){return _t.RUNE<=e&&e<=_t.RUNE_ANY_NOT_NL}static escapeRunes(e){let t='"';for(let o of e)t+=He.escapeRune(o);return t+='"',t}constructor(e){this.op=e,this.out=0,this.arg=0,this.runes=null}matchRune(e){if(this.runes.length===1){const a=this.runes[0];return(this.arg&fe.FOLD_CASE)!==0?ze.equalsIgnoreCase(a,e):e===a}for(let a=0;a<this.runes.length&&a<=8;a+=2){if(e<this.runes[a])return!1;if(e<=this.runes[a+1])return!0}let t=0,o=this.runes.length/2|0;for(;t<o;){const a=t+((o-t)/2|0);if(this.runes[2*a]<=e){if(e<=this.runes[2*a+1])return!0;t=a+1}else o=a}return!1}toString(){switch(this.op){case _t.ALT:return`alt -> ${this.out}, ${this.arg}`;case _t.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case _t.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case _t.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case _t.MATCH:return"match";case _t.FAIL:return"fail";case _t.NOP:return`nop -> ${this.out}`;case _t.RUNE:return this.runes===null?"rune <null>":["rune ",_t.escapeRunes(this.runes),(this.arg&fe.FOLD_CASE)!==0?"/i":""," -> ",this.out].join("");case _t.RUNE1:return`rune1 ${_t.escapeRunes(this.runes)} -> ${this.out}`;case _t.RUNE_ANY:return`any -> ${this.out}`;case _t.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}};R(_t,"ALT",1),R(_t,"ALT_MATCH",2),R(_t,"CAPTURE",3),R(_t,"EMPTY_WIDTH",4),R(_t,"FAIL",5),R(_t,"MATCH",6),R(_t,"NOP",7),R(_t,"RUNE",8),R(_t,"RUNE1",9),R(_t,"RUNE_ANY",10),R(_t,"RUNE_ANY_NOT_NL",11);let Ke=_t;
19644class D9{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(e){return this.inst[e]}numInst(){return this.inst.length}addInst(e){this.inst.push(new Ke(e))}skipNop(e){let t=this.inst[e];for(;t.op===Ke.NOP||t.op===Ke.CAPTURE;)t=this.inst[e],e=t.out;return t}prefix(){let e="",t=this.skipNop(this.start);if(!Ke.isRuneOp(t.op)||t.runes.length!==1)return[t.op===Ke.MATCH,e];for(;Ke.isRuneOp(t.op)&&t.runes.length===1&&(t.arg&fe.FOLD_CASE)===0;)e+=String.fromCodePoint(t.runes[0]),t=this.skipNop(t.out);return[t.op===Ke.MATCH,e]}startCond(){let e=0,t=this.start;e:for(;;){const o=this.inst[t];switch(o.op){case Ke.EMPTY_WIDTH:e|=o.arg;break;case Ke.FAIL:return-1;case Ke.CAPTURE:case Ke.NOP:break;default:break e}t=o.out}return e}next(e){const t=this.inst[e>>1];return(e&1)===0?t.out:t.arg}patch(e,t){for(;e!==0;){const o=this.inst[e>>1];(e&1)===0?(e=o.out,o.out=t):(e=o.arg,o.arg=t)}}append(e,t){if(e===0)return t;if(t===0)return e;let o=e;for(;;){const d=this.next(o);if(d===0)break;o=d}const a=this.inst[o>>1];return(o&1)===0?a.out=t:a.arg=t,e}toString(){let e="";for(let t=0;t<this.inst.length;t++){const o=e.length;e+=t,t===this.start&&(e+="*"),e+="        ".substring(e.length-o),e+=this.inst[t],e+=`
19645`}return e}}class ou{constructor(e=0,t=0,o=!1){this.i=e,this.out=t,this.nullable=o}}class Ud{static ANY_RUNE_NOT_NL(){return[0,H.CODES.get(`
19646`)-1,H.CODES.get(`
19647`)+1,ze.MAX_RUNE]}static ANY_RUNE(){return[0,ze.MAX_RUNE]}static compileRegexp(e){const t=new Ud,o=t.compile(e);return t.prog.patch(o.out,t.newInst(Ke.MATCH).i),t.prog.start=o.i,t.prog}constructor(){this.prog=new D9,this.newInst(Ke.FAIL)}newInst(e){return this.prog.addInst(e),new ou(this.prog.numInst()-1,0,!0)}nop(){const e=this.newInst(Ke.NOP);return e.out=e.i<<1,e}fail(){return new ou}cap(e){const t=this.newInst(Ke.CAPTURE);return t.out=t.i<<1,this.prog.getInst(t.i).arg=e,this.prog.numCap<e+1&&(this.prog.numCap=e+1),t}cat(e,t){return e.i===0||t.i===0?this.fail():(this.prog.patch(e.out,t.i),new ou(e.i,t.out,e.nullable&&t.nullable))}alt(e,t){if(e.i===0)return t;if(t.i===0)return e;const o=this.newInst(Ke.ALT),a=this.prog.getInst(o.i);return a.out=e.i,a.arg=t.i,o.out=this.prog.append(e.out,t.out),o.nullable=e.nullable||t.nullable,o}loop(e,t){const o=this.newInst(Ke.ALT),a=this.prog.getInst(o.i);return t?(a.arg=e.i,o.out=o.i<<1):(a.out=e.i,o.out=o.i<<1|1),this.prog.patch(e.out,o.i),o}quest(e,t){const o=this.newInst(Ke.ALT),a=this.prog.getInst(o.i);return t?(a.arg=e.i,o.out=o.i<<1):(a.out=e.i,o.out=o.i<<1|1),o.out=this.prog.append(o.out,e.out),o}star(e,t){return e.nullable?this.quest(this.plus(e,t),t):this.loop(e,t)}plus(e,t){return new ou(e.i,this.loop(e,t).out,e.nullable)}empty(e){const t=this.newInst(Ke.EMPTY_WIDTH);return this.prog.getInst(t.i).arg=e,t.out=t.i<<1,t}rune(e,t){const o=this.newInst(Ke.RUNE);o.nullable=!1;const a=this.prog.getInst(o.i);return a.runes=e,t&=fe.FOLD_CASE,(e.length!==1||ze.simpleFold(e[0])===e[0])&&(t&=-2),a.arg=t,o.out=o.i<<1,(t&fe.FOLD_CASE)===0&&e.length===1||e.length===2&&e[0]===e[1]?a.op=Ke.RUNE1:e.length===2&&e[0]===0&&e[1]===ze.MAX_RUNE?a.op=Ke.RUNE_ANY:e.length===4&&e[0]===0&&e[1]===H.CODES.get(`
19648`)-1&&e[2]===H.CODES.get(`
19649`)+1&&e[3]===ze.MAX_RUNE&&(a.op=Ke.RUNE_ANY_NOT_NL),o}compile(e){switch(e.op){case $.Op.NO_MATCH:return this.fail();case $.Op.EMPTY_MATCH:return this.nop();case $.Op.LITERAL:if(e.runes.length===0)return this.nop();{let t=null;for(let o of e.runes){const a=this.rune([o],e.flags);t=t===null?a:this.cat(t,a)}return t}case $.Op.CHAR_CLASS:return this.rune(e.runes,e.flags);case $.Op.ANY_CHAR_NOT_NL:return this.rune(Ud.ANY_RUNE_NOT_NL(),0);case $.Op.ANY_CHAR:return this.rune(Ud.ANY_RUNE(),0);case $.Op.BEGIN_LINE:return this.empty(He.EMPTY_BEGIN_LINE);case $.Op.END_LINE:return this.empty(He.EMPTY_END_LINE);case $.Op.BEGIN_TEXT:return this.empty(He.EMPTY_BEGIN_TEXT);case $.Op.END_TEXT:return this.empty(He.EMPTY_END_TEXT);case $.Op.WORD_BOUNDARY:return this.empty(He.EMPTY_WORD_BOUNDARY);case $.Op.NO_WORD_BOUNDARY:return this.empty(He.EMPTY_NO_WORD_BOUNDARY);case $.Op.CAPTURE:{const t=this.cap(e.cap<<1),o=this.compile(e.subs[0]),a=this.cap(e.cap<<1|1);return this.cat(this.cat(t,o),a)}case $.Op.STAR:return this.star(this.compile(e.subs[0]),(e.flags&fe.NON_GREEDY)!==0);case $.Op.PLUS:return this.plus(this.compile(e.subs[0]),(e.flags&fe.NON_GREEDY)!==0);case $.Op.QUEST:return this.quest(this.compile(e.subs[0]),(e.flags&fe.NON_GREEDY)!==0);case $.Op.CONCAT:{if(e.subs.length===0)return this.nop();{let t=null;for(let o of e.subs){const a=this.compile(o);t=t===null?a:this.cat(t,a)}return t}}case $.Op.ALTERNATE:{if(e.subs.length===0)return this.nop();{let t=null;for(let o of e.subs){const a=this.compile(o);t=t===null?a:this.alt(t,a)}return t}}default:throw new E9("regexp: unhandled case in compile")}}}class qo{static simplify(e){if(e===null)return null;switch(e.op){case $.Op.CAPTURE:case $.Op.CONCAT:case $.Op.ALTERNATE:{let t=e;for(let o=0;o<e.subs.length;o++){const a=e.subs[o],d=qo.simplify(a);t===e&&d!==a&&(t=$.fromRegexp(e),t.runes=null,t.subs=e.subs.slice(0,e.subs.length)),t!==e&&(t.subs[o]=d)}return t}case $.Op.STAR:case $.Op.PLUS:case $.Op.QUEST:{const t=qo.simplify(e.subs[0]);return qo.simplify1(e.op,e.flags,t,e)}case $.Op.REPEAT:{if(e.min===0&&e.max===0)return new $($.Op.EMPTY_MATCH);const t=qo.simplify(e.subs[0]);if(e.max===-1){if(e.min===0)return qo.simplify1($.Op.STAR,e.flags,t,null);if(e.min===1)return qo.simplify1($.Op.PLUS,e.flags,t,null);const a=new $($.Op.CONCAT),d=[];for(let c=0;c<e.min-1;c++)d.push(t);return d.push(qo.simplify1($.Op.PLUS,e.flags,t,null)),a.subs=d.slice(0),a}if(e.min===1&&e.max===1)return t;let o=null;if(e.min>0){o=[];for(let a=0;a<e.min;a++)o.push(t)}if(e.max>e.min){let a=qo.simplify1($.Op.QUEST,e.flags,t,null);for(let d=e.min+1;d<e.max;d++){const c=new $($.Op.CONCAT);c.subs=[t,a],a=qo.simplify1($.Op.QUEST,e.flags,c,null)}if(o===null)return a;o.push(a)}if(o!==null){const a=new $($.Op.CONCAT);return a.subs=o.slice(0),a}return new $($.Op.NO_MATCH)}}return e}static simplify1(e,t,o,a){return o.op===$.Op.EMPTY_MATCH||e===o.op&&(t&fe.NON_GREEDY)===(o.flags&fe.NON_GREEDY)?o:(a!==null&&a.op===e&&(a.flags&fe.NON_GREEDY)===(t&fe.NON_GREEDY)&&o===a.subs[0]||(a=new $(e),a.flags=t,a.subs=[o]),a)}}class it{constructor(e,t){this.sign=e,this.cls=t}}const u2=[48,57],p2=[9,10,12,13,32,32],g2=[48,57,65,90,95,95,97,122],f2=new Map([["\\d",new it(1,u2)],["\\D",new it(-1,u2)],["\\s",new it(1,p2)],["\\S",new it(-1,p2)],["\\w",new it(1,g2)],["\\W",new it(-1,g2)]]),h2=[48,57,65,90,97,122],v2=[65,90,97,122],b2=[0,127],y2=[9,9,32,32],x2=[0,31,127,127],A2=[48,57],_2=[33,126],w2=[97,122],E2=[32,126],S2=[33,47,58,64,91,96,123,126],k2=[9,13,32,32],C2=[65,90],R2=[48,57,65,90,95,95,97,122],D2=[48,57,65,70,97,102],M2=new Map([["[:alnum:]",new it(1,h2)],["[:^alnum:]",new it(-1,h2)],["[:alpha:]",new it(1,v2)],["[:^alpha:]",new it(-1,v2)],["[:ascii:]",new it(1,b2)],["[:^ascii:]",new it(-1,b2)],["[:blank:]",new it(1,y2)],["[:^blank:]",new it(-1,y2)],["[:cntrl:]",new it(1,x2)],["[:^cntrl:]",new it(-1,x2)],["[:digit:]",new it(1,A2)],["[:^digit:]",new it(-1,A2)],["[:graph:]",new it(1,_2)],["[:^graph:]",new it(-1,_2)],["[:lower:]",new it(1,w2)],["[:^lower:]",new it(-1,w2)],["[:print:]",new it(1,E2)],["[:^print:]",new it(-1,E2)],["[:punct:]",new it(1,S2)],["[:^punct:]",new it(-1,S2)],["[:space:]",new it(1,k2)],["[:^space
19649:]",new it(-1,k2)],["[:upper:]",new it(1,C2)],["[:^upper:]",new it(-1,C2)],["[:word:]",new it(1,R2)],["[:^word:]",new it(-1,R2)],["[:xdigit:]",new it(1,D2)],["[:^xdigit:]",new it(-1,D2)]]);class Cn{static charClassToString(e,t){let o="[";for(let a=0;a<t;a+=2){a>0&&(o+=" ");const d=e[a],c=e[a+1];d===c?o+=`0x${d.toString(16)}`:o+=`0x${d.toString(16)}-0x${c.toString(16)}`}return o+="]",o}static cmp(e,t,o,a){const d=e[t]-o;return d!==0?d:a-e[t+1]}static qsortIntPair(e,t,o){const a=((t+o)/2|0)&-2,d=e[a],c=e[a+1];let g=t,h=o;for(;g<=h;){for(;g<o&&Cn.cmp(e,g,d,c)<0;)g+=2;for(;h>t&&Cn.cmp(e,h,d,c)>0;)h-=2;if(g<=h){if(g!==h){let v=e[g];e[g]=e[h],e[h]=v,v=e[g+1],e[g+1]=e[h+1],e[h+1]=v}g+=2,h-=2}}t<h&&Cn.qsortIntPair(e,t,h),g<o&&Cn.qsortIntPair(e,g,o)}constructor(e=He.emptyInts()){this.r=e,this.len=e.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;Cn.qsortIntPair(this.r,0,this.len-2);let e=2;for(let t=2;t<this.len;t+=2){const o=this.r[t],a=this.r[t+1];if(o<=this.r[e-1]+1){a>this.r[e-1]&&(this.r[e-1]=a);continue}this.r[e]=o,this.r[e+1]=a,e+=2}return this.len=e,this}appendLiteral(e,t){return(t&fe.FOLD_CASE)!==0?this.appendFoldedRange(e,e):this.appendRange(e,e)}appendRange(e,t){if(this.len>0){for(let o=2;o<=4;o+=2)if(this.len>=o){const a=this.r[this.len-o],d=this.r[this.len-o+1];if(e<=d+1&&a<=t+1)return e<a&&(this.r[this.len-o]=e),t>d&&(this.r[this.len-o+1]=t),this}}return this.r[this.len++]=e,this.r[this.len++]=t,this}appendFoldedRange(e,t){if(e<=ze.MIN_FOLD&&t>=ze.MAX_FOLD)return this.appendRange(e,t);if(t<ze.MIN_FOLD||e>ze.MAX_FOLD)return this.appendRange(e,t);e<ze.MIN_FOLD&&(this.appendRange(e,ze.MIN_FOLD-1),e=ze.MIN_FOLD),t>ze.MAX_FOLD&&(this.appendRange(ze.MAX_FOLD+1,t),t=ze.MAX_FOLD);for(let o=e;o<=t;o++){this.appendRange(o,o);for(let a=ze.simpleFold(o);a!==o;a=ze.simpleFold(a))this.appendRange(a,a)}return this}appendClass(e){for(let t=0;t<e.length;t+=2)this.appendRange(e[t],e[t+1]);return this}appendFoldedClass(e){for(let t=0;t<e.length;t+=2)this.appendFoldedRange(e[t],e[t+1]);return this}appendNegatedClass(e){let t=0;for(let o=0;o<e.length;o+=2){const a=e[o],d=e[o+1];t<=a-1&&this.appendRange(t,a-1),t=d+1}return t<=ze.MAX_RUNE&&this.appendRange(t,ze.MAX_RUNE),this}appendTable(e){for(let t of e){const o=t[0],a=t[1],d=t[2];if(d===1){this.appendRange(o,a);continue}for(let c=o;c<=a;c+=d)this.appendRange(c,c)}return this}appendNegatedTable(e){let t=0;for(let o of e){const a=o[0],d=o[1],c=o[2];if(c===1){t<=a-1&&this.appendRange(t,a-1),t=d+1;continue}for(let g=a;g<=d;g+=c)t<=g-1&&this.appendRange(t,g-1),t=g+1}return t<=ze.MAX_RUNE&&this.appendRange(t,ze.MAX_RUNE),this}appendTableWithSign(e,t){return t<0?this.appendNegatedTable(e):this.appendTable(e)}negateClass(){let e=0,t=0;for(let o=0;o<this.len;o+=2){const a=this.r[o],d=this.r[o+1];e<=a-1&&(this.r[t]=e,this.r[t+1]=a-1,t+=2),e=d+1}return this.len=t,e<=ze.MAX_RUNE&&(this.r[this.len++]=e,this.r[this.len++]=ze.MAX_RUNE),this}appendClassWithSign(e,t){return t<0?this.appendNegatedClass(e):this.appendClass(e)}appendGroup(e,t){let o=e.cls;return t&&(o=new Cn().appendFoldedClass(o).cleanClass().toArray()),this.appendClassWithSign(o,e.sign)}toString(){return Cn.charClassToString(this.r,this.len)}}class Bd{static of(e,t){return new Bd(e,t)}constructor(e,t){this.first=e,this.second=t}}class M9{constructor(e){this.str=e,this.position=0}pos(){return this.position}rewindTo(e){this.position=e}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(e){this.position+=e}skipString(e){this.position+=e.length}pop(){const e=this.str.codePointAt(this.position);return this.position+=He.charCount(e),e}lookingAt(e){return this.rest().startsWith(e)}
19649rest(){return this.str.substring(this.position)}from(e){return this.str.substring(e,this.position)}toString(){return this.rest()}}const we=class we{static ANY_TABLE(){return[[0,ze.MAX_RUNE,1]]}static unicodeTable(e){return e==="Any"?Bd.of(we.ANY_TABLE(),we.ANY_TABLE()):kn.CATEGORIES.has(e)?Bd.of(kn.CATEGORIES.get(e),kn.FOLD_CATEGORIES.get(e)):kn.SCRIPTS.has(e)?Bd.of(kn.SCRIPTS.get(e),kn.FOLD_SCRIPT.get(e)):null}static minFoldRune(e){if(e<ze.MIN_FOLD||e>ze.MAX_FOLD)return e;let t=e;const o=e;for(e=ze.simpleFold(e);e!==o;e=ze.simpleFold(e))t>e&&(t=e);return t}static leadingRegexp(e){if(e.op===$.Op.EMPTY_MATCH)return null;if(e.op===$.Op.CONCAT&&e.subs.length>0){const t=e.subs[0];return t.op===$.Op.EMPTY_MATCH?null:t}return e}static literalRegexp(e,t){const o=new $($.Op.LITERAL);return o.flags=t,o.runes=He.stringToRunes(e),o}static parse(e,t){return new we(e,t).parseInternal()}static parseRepeat(e){const t=e.pos();if(!e.more()||!e.lookingAt("{"))return-1;e.skip(1);const o=we.parseInt(e);if(o===-1||!e.more())return-1;let a;if(!e.lookingAt(","))a=o;else{if(e.skip(1),!e.more())return-1;if(e.lookingAt("}"))a=-1;else if((a=we.parseInt(e))===-1)return-1}if(!e.more()||!e.lookingAt("}"))return-1;if(e.skip(1),o<0||o>1e3||a===-2||a>1e3||a>=0&&o>a)throw new Ft(we.ERR_INVALID_REPEAT_SIZE,e.from(t));return o<<16|a&ze.MAX_BMP}static isValidCaptureName(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){const o=e.codePointAt(t);if(o!==H.CODES.get("_")&&!He.isalnum(o))return!1}return!0}static parseInt(e){const t=e.pos();for(;e.more()&&e.peek()>=H.CODES.get("0")&&e.peek()<=H.CODES.get("9");)e.skip(1);const o=e.from(t);return o.length===0||o.length>1&&o.codePointAt(0)===H.CODES.get("0")?-1:o.length>8?-2:parseFloat(o,10)}static isCharClass(e){return e.op===$.Op.LITERAL&&e.runes.length===1||e.op===$.Op.CHAR_CLASS||e.op===$.Op.ANY_CHAR_NOT_NL||e.op===$.Op.ANY_CHAR}static matchRune(e,t){switch(e.op){case $.Op.LITERAL:return e.runes.length===1&&e.runes[0]===t;case $.Op.CHAR_CLASS:for(let o=0;o<e.runes.length;o+=2)if(e.runes[o]<=t&&t<=e.runes[o+1])return!0;return!1;case $.Op.ANY_CHAR_NOT_NL:return t!==H.CODES.get(`
19650`);case $.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(e,t){switch(e.op){case $.Op.ANY_CHAR:break;case $.Op.ANY_CHAR_NOT_NL:we.matchRune(t,H.CODES.get(`
19651`))&&(e.op=$.Op.ANY_CHAR);break;case $.Op.CHAR_CLASS:t.op===$.Op.LITERAL?e.runes=new Cn(e.runes).appendLiteral(t.runes[0],t.flags).toArray():e.runes=new Cn(e.runes).appendClass(t.runes).toArray();break;case $.Op.LITERAL:if(t.runes[0]===e.runes[0]&&t.flags===e.flags)break;e.op=$.Op.CHAR_CLASS,e.runes=new Cn().appendLiteral(e.runes[0],e.flags).appendLiteral(t.runes[0],t.flags).toArray();break}}static parseEscape(e){const t=e.pos();if(e.skip(1),!e.more())throw new Ft(we.ERR_TRAILING_BACKSLASH);let o=e.pop();e:switch(o){case H.CODES.get("1"):case H.CODES.get("2"):case H.CODES.get("3"):case H.CODES.get("4"):case H.CODES.get("5"):case H.CODES.get("6"):case H.CODES.get("7"):if(!e.more(
19651)||e.peek()<H.CODES.get("0")||e.peek()>H.CODES.get("7"))break;case H.CODES.get("0"):{let a=o-H.CODES.get("0");for(let d=1;d<3&&!(!e.more()||e.peek()<H.CODES.get("0")||e.peek()>H.CODES.get("7"));d++)a=a*8+e.peek()-H.CODES.get("0"),e.skip(1);return a}case H.CODES.get("x"):{if(!e.more())break;if(o=e.pop(),o===H.CODES.get("{")){let c=0,g=0;for(;;){if(!e.more())break e;if(o=e.pop(),o===H.CODES.get("}"))break;const h=He.unhex(o);if(h<0||(g=g*16+h,g>ze.MAX_RUNE))break e;c++}if(c===0)break e;return g}const a=He.unhex(o);if(!e.more())break;o=e.pop();const d=He.unhex(o);if(a<0||d<0)break;return a*16+d}case H.CODES.get("a"):return H.CODES.get("\x07");case H.CODES.get("f"):return H.CODES.get("\f");case H.CODES.get("n"):return H.CODES.get(`
19652`);case H.CODES.get("r"):return H.CODES.get("\r");case H.CODES.get("t"):return H.CODES.get("	");case H.CODES.get("v"):return H.CODES.get("\v");default:if(!He.isalnum(o))return o;break}throw new Ft(we.ERR_INVALID_ESCAPE,e.from(t))}static parseClassChar(e,t){if(!e.more())throw new Ft(we.ERR_MISSING_BRACKET,e.from(t));return e.lookingAt("\\")?we.parseEscape(e):e.pop()}static concatRunes(e,t){return[...e,...t]}constructor(e,t=0){this.wholeRegexp=e,this.flags=t,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null}newRegexp(e){let t=this.free;return t!==null&&t.subs!==null&&t.subs.length>0?(this.free=t.subs[0],t.reinit(),t.op=e):t=new $(e),t}reuse(e){e.subs!==null&&e.subs.length>0&&(e.subs[0]=this.free),this.free=e}pop(){return this.stack.pop()}popToPseudo(){const e=this.stack.length;let t=e;for(;t>0&&!$.isPseudoOp(this.stack[t-1].op);)t--;const o=this.stack.slice(t,e);return this.stack=this.stack.slice(0,t),o}push(e){if(e.op===$.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]===e.runes[1]){if(this.maybeConcat(e.runes[0],this.flags&-2))return null;e.op=$.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags&-2}else if(e.op===$.Op.CHAR_CLASS&&e.runes.length===4&&e.runes[0]===e.runes[1]&&e.runes[2]===e.runes[3]&&ze.simpleFold(e.runes[0])===e.runes[2]&&ze.simpleFold(e.runes[2])===e.runes[0]||e.op===$.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]+1===e.runes[1]&&ze.simpleFold(e.runes[0])===e.runes[1]&&ze.simpleFold(e.runes[1])===e.runes[0]){if(this.maybeConcat(e.runes[0],this.flags|fe.FOLD_CASE))return null;e.op=$.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags|fe.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(e),e}maybeConcat(e,t){const o=this.stack.length;if(o<2)return!1;const a=this.stack[o-1],d=this.stack[o-2];
19652return a.op!==$.Op.LITERAL||d.op!==$.Op.LITERAL||(a.flags&fe.FOLD_CASE)!==(d.flags&fe.FOLD_CASE)?!1:(d.runes=we.concatRunes(d.runes,a.runes),e>=0?(a.runes=[e],a.flags=t,!0):(this.pop(),this.reuse(a),!1))}newLiteral(e,t){const o=this.newRegexp($.Op.LITERAL);return o.flags=t,(t&fe.FOLD_CASE)!==0&&(e=we.minFoldRune(e)),o.runes=[e],o}literal(e){this.push(this.newLiteral(e,this.flags))}op(e){const t=this.newRegexp(e);return t.flags=this.flags,this.push(t)}repeat(e,t,o,a,d,c){let g=this.flags;if((g&fe.PERL_X)!==0&&(d.more()&&d.lookingAt("?")&&(d.skip(1),g^=fe.NON_GREEDY),c!==-1))throw new Ft(we.ERR_INVALID_REPEAT_OP,d.from(c));const h=this.stack.length;if(h===0)throw new Ft(we.ERR_MISSING_REPEAT_ARGUMENT,d.from(a));const v=this.stack[h-1];if($.isPseudoOp(v.op))throw new Ft(we.ERR_MISSING_REPEAT_ARGUMENT,d.from(a));const _=this.newRegexp(e);_.min=t,_.max=o,_.flags=g,_.subs=[v],this.stack[h-1]=_}concat(){this.maybeConcat(-1,0);const e=this.popToPseudo();return e.length===0?this.push(this.newRegexp($.Op.EMPTY_MATCH)):this.push(this.collapse(e,$.Op.CONCAT))}alternate(){const e=this.popToPseudo();return e.length>0&&this.cleanAlt(e[e.length-1]),e.length===0?this.push(this.newRegexp($.Op.NO_MATCH)):this.push(this.collapse(e,$.Op.ALTERNATE))}cleanAlt(e){e.op===$.Op.CHAR_CLASS&&(e.runes=new Cn(e.runes).cleanClass().toArray(),e.runes.length===2&&e.runes[0]===0&&e.runes[1]===ze.MAX_RUNE?(e.runes=null,e.op=$.Op.ANY_CHAR):e.runes.length===4&&e.runes[0]===0&&e.runes[1]===H.CODES.get(`
19653`)-1&&e.runes[2]===H.CODES.get(`
19654`)+1&&e.runes[3]===ze.MAX_RUNE&&(e.runes=null,e.op=$.Op.ANY_CHAR_NOT_NL))}collapse(e,t){if(e.length===1)return e[0];let o=0;for(let g of e)o+=g.op===t?g.subs.length:1;let a=new Array(o).fill(null),d=0;for(let g of e)g.op===t?(a.splice(d,g.subs.length,...g.subs),d+=g.subs.length,this.reuse(g)):a[d++]=g;let c=this.newRegexp(t);if(c.subs=a,t===$.Op.ALTERNATE&&(c.subs=this.factor(c.subs),c.subs.length===1)){const g=c;c=c.subs[0],this.reuse(g)}return c}factor(e){if(e.length<2)return e;let t=0,o=e.length,a=0,d=null,c=0,g=0,h=0;for(let _=0;_<=o;_++){let E=null,M=0,G=0;if(_<o){let B=e[t+_];if(B.op===$.Op.CONCAT&&B.subs.length>0&&(B=B.subs[0]),B.op===$.Op.LITERAL&&(E=B.runes,M=B.runes.length,G=B.flags&fe.FOLD_CASE),G===g){let ee=0;for(;ee<c&&ee<M&&d[ee]===E[ee];)ee++;if(ee>0){c=ee;continue}}}if(_!==h)if(_===h+1)e[a++]=e[t+h];else{const B=this.newRegexp($.Op.LITERAL);B.flags=g,B.runes=d.slice(0,c);for(let ve=h;ve<_;ve++)e[t+ve]=this.removeLeadingString(e[t+ve],c);const ee=this.collapse(e.slice(t+h,t+_),$.Op.ALTERNATE),ie=this.newRegexp($.Op.CONCAT);ie.subs=[B,ee],e[a++]=ie}h=_,d=E,c=M,g=G}o=a,t=0,h=0,a=0;let v=null;for(let _=0;_<=o;_++){let E=null;if(!(_<o&&(E=we.leadingRegexp(e[t+_]),v!==null&&v.equals(E)&&(we.isCharClass(v)||v.op===$.Op.REPEAT&&v.min===v.max&&we.isCharClass(v.subs[0]))))){if(_!==h)if(_===h+1)e[a++]=e[t+h];else{const M=v;for(let ee=h;ee<_;ee++){const ie=ee!==h;e[t+ee]=this.removeLeadingRegexp(e[t+ee],ie)}const G=this.collapse(e.slice(t+h,t+_),$.Op.ALTERNATE),B=this.newRegexp($.Op.CONCAT);B.subs=[M,G],e[a++]=B}h=_,v=E}}o=a,t=0,h=0,a=0;for(let _=0;_<=o;_++)if(!(_<o&&we.isCharClass(e[t+_]))){if(_!==h)if(_===h+1)e[a++]=e[t+h];else{let E=h;for(let G=h+1;G<_;G++){const B=e[t+E],ee=e[t+G];(B.op<ee.op||B.op===ee.op&&(B.runes!==null?B.runes.length:0)<(ee.runes!==null?ee.runes.length:0))&&(E=G)}const M=e[t+h];e[t+h]=e[t+E],e[t+E]=M;for(let G=h+1;G<_;G++)we.mergeCharClass(e[t+h],e[t+G]),this.reuse(e[t+G]);this.cleanAlt(e[t+h]),e[a++]=e[t+h]}_<o&&(e[a++]=e[t+_]),h=_+1}o=a,t=0,h=0,a=0;for(let _=0;_<o;++_)_+1<o&&e[t+_].op===$.Op.EMPTY_MATCH&&e[t+_+1].op===$.Op.EMPTY_MATCH||(e[a++]=e[t+_]);return o=a,t=0,e.slice(t,o)}removeLeadingString(e,t){if(e.op===$.Op.CONCAT&&e.subs.length>0){const o=this.removeLeadingString(e.subs[0],t);if(e.subs[0]=o,o.op===$.Op.EMPTY_MATCH)switch(this.reuse(o),e.subs.length){case 0:case 1:e.op=$.Op.EMPTY_MATCH,e.subs=null;break;case 2:{const a=e;e=e.subs[1],this.reuse(a);break}default:e.subs=e.subs.slice(1,e.subs.length);break}return e}return e.op===$.Op.LITERAL&&(e.runes=e.runes.slice(t,e.runes.length),e.runes.length===0&&(e.op=$.Op.EMPTY_MATCH)),e}removeLeadingRegexp(e,t){if(e.op===$.Op.CONCAT&&e.subs.length>0){switch(t&&this.reuse(e.subs[0]),e.subs=e.subs.slice(1,e.subs.length),e.subs.length){case 0:{e.op=$.Op.EMPTY_MATCH,e.subs=$.emptySubs();break}case 1:{const o=e;e=e.subs[0],this.reuse(o);break}}return e}return t&&this.reuse(e),this.newRegexp($.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&fe.LITERAL)!==0)return we.literalRegexp(this.wholeRegexp,this.flags);let e=-1,t=-1,o=-1;const a=new M9(this.wholeRegexp);for(;a.more();){let c=-1;e:switch(a.peek()){case H.CODES.get("("):if((this.flags&fe.PERL_X)!==0&&a.lookingAt("(?")){this.parsePerlFlags(a);break}this.op($.Op.LEFT_PAREN).cap=++this.numCap,a.skip(1);break;case H.CODES.get("|"):this.parseVerticalBar(),a.skip(1);break;case H.CODES.get(")"):this.parseRightParen(),a.skip(1);break;case H.CODES.get("^"):(this.flags&fe.ONE_LINE)!==0?this.op($.Op.BEGIN_TEXT):this.op($.Op.BEGIN_LINE),a.skip(1);break;case H.CODES.get("$"):(this.flags&fe.ONE_LINE)!==0?this.op($.Op.END_TEXT).flags|=fe.WAS_DOLLAR:this.op($.Op.END_LINE),a.skip(1);break;case H.CODES.get("."):(this.flags&fe.DOT_NL)!==0?this.op($.Op.ANY_CHAR):this.op($.Op.ANY_CHAR_NOT_NL),a.skip(1);break;case H.CODES.get("["):this.parseClass(a);break;case H.CODES.get("*"):case H.CODES.get("+"):case H.CODES.get("?"):{c=a.pos();let g=null;switch(a.pop()){case H.CODES.get("*"):g=$.Op.STAR;break;case H.CODES.get("+"):g=$.Op.PLUS;break;case H.CODES.get("?"):g=$.Op.QUEST;break}this.repeat(g,t,o,c,a,e);break}case H.CODES.get("{"):{c=a.pos();const g=we.parseRepeat(a);if(g<0){a.rewindTo(c),this.literal(a.pop());break}t=g>>16,o=(g&ze.MAX_BMP)<<16>>16,this.repeat($.Op.REPEAT,t,o,c,a,e);break}case H.CODES.get("\\"):{const g=a.pos();if(a.skip(1),(this.flags&fe.PERL_X)!==0&&a.more())switch(a.pop()){case H.CODES.get("A"):this.op($.Op.BEGIN_TEXT);break e;case H.CODES.get("b"):this.op($.Op.WORD_BOUNDARY);break e;case H.CODES.get("B"):this.op($.Op.NO_WORD_BOUNDARY);break e;case H.CODES.get("C"):throw new Ft(we.ERR_INVALID_ESCAPE,"\\C");case H.CODES.get("Q"):{let E=a.rest();const M=E.indexOf("\\E");M>=0&&(E=E.substring(0,M)),a.skipString(E),a.skipString("\\E");let G=0;for(;G<E.length;){const B=E.codePointAt(G);this.literal(B),G+=He.charCount(B)}break e}case H.CODES.get("z"):this.op($.Op.END_TEXT);break e;default:a.rewindTo(g);break}const h=this.newRegexp($.Op.CHAR_CLASS);if(h.flags=this.flags,a.lookingAt("\\p")||a.lookingAt("\\P")){const _=new Cn;if(this.parseUnicodeClass(a,_)){h.runes=_.toArray(),this.push(h);break e}}const v=new Cn;if(this.parsePerlClassEscape(a,v)){h.runes=v.toArray(),this.push(h);break e}a.rewindTo(g),this.reuse(h),this.literal(we.parseEscape(a));break}default:this.literal(a.pop());break}e=c}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new Ft(we.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(e){const t=e.pos(),o=e.rest();if(o.startsWith("(?P<")||o.startsWith("(?<")){const g=o.charAt(2)==="P"?4:3,h=o.indexOf(">");
19654if(h<0)throw new Ft(we.ERR_INVALID_NAMED_CAPTURE,o);const v=o.substring(g,h);if(e.skipString(v),e.skip(g+1),!we.isValidCaptureName(v))throw new Ft(we.ERR_INVALID_NAMED_CAPTURE,o.substring(0,h+1));const _=this.op($.Op.LEFT_PAREN);if(_.cap=++this.numCap,this.namedGroups[v])throw new Ft(we.ERR_DUPLICATE_NAMED_CAPTURE,v);this.namedGroups[v]=this.numCap,_.name=v;return}e.skip(2);let a=this.flags,d=1,c=!1;e:for(;e.more();){const g=e.pop();switch(g){case H.CODES.get("i"):a|=fe.FOLD_CASE,c=!0;break;case H.CODES.get("m"):a&=-17,c=!0;break;case H.CODES.get("s"):a|=fe.DOT_NL,c=!0;break;case H.CODES.get("U"):a|=fe.NON_GREEDY,c=!0;break;case H.CODES.get("-"):if(d<0)break e;d=-1,a=~a,c=!1;break;case H.CODES.get(":"):case H.CODES.get(")"):if(d<0){if(!c)break e;a=~a}g===H.CODES.get(":")&&this.op($.Op.LEFT_PAREN),this.flags=a;return;default:break e}}throw new Ft(we.ERR_INVALID_PERL_OP,e.from(t))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op($.Op.VERTICAL_BAR)}swapVerticalBar(){const e=this.stack.length;if(e>=3&&this.stack[e-2].op===$.Op.VERTICAL_BAR&&we.isCharClass(this.stack[e-1])&&we.isCharClass(this.stack[e-3])){let t=this.stack[e-1],o=this.stack[e-3];if(t.op>o.op){const a=o;o=t,t=a,this.stack[e-3]=o}return we.mergeCharClass(o,t),this.reuse(t),this.pop(),!0}if(e>=2){const t=this.stack[e-1],o=this.stack[e-2];if(o.op===$.Op.VERTICAL_BAR)return e>=3&&this.cleanAlt(this.stack[e-3]),this.stack[e-2]=t,this.stack[e-1]=o,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new Ft(we.ERR_INTERNAL_ERROR,"stack underflow");const t=this.pop(),o=this.pop();if(o.op!==$.Op.LEFT_PAREN)throw new Ft(we.ERR_MISSING_PAREN,this.wholeRegexp);this.flags=o.flags,o.cap===0?this.push(t):(o.op=$.Op.CAPTURE,o.subs=[t],this.push(o))}parsePerlClassEscape(e,t){const o=e.pos();if((this.flags&fe.PERL_X)===0||!e.more()||e.pop()!==H.CODES.get("\\")||!e.more())return!1;e.pop();const a=e.from(o),d=f2.has(a)?f2.get(a):null;return d===null?!1:(t.appendGroup(d,(this.flags&fe.FOLD_CASE)!==0),!0)}parseNamedClass(e,t){const o=e.rest(),a=o.indexOf(":]");if(a<0)return!1;const d=o.substring(0,a+2);e.skipString(d);const c=M2.has(d)?M2.get(d):null;if(c===null)throw new Ft(we.ERR_INVALID_CHAR_RANGE,d);return t.appendGroup(c,(this.flags&fe.FOLD_CASE)!==0),!0}parseUnicodeClass(e,t){const o=e.pos();if((this.flags&fe.UNICODE_GROUPS)===0||!e.lookingAt("\\p")&&!e.lookingAt("\\P"))return!1;e.skip(1);let a=1,d=e.pop();if(d===H.CODES.get("P")&&(a=-1),!e.more())throw e.rewindTo(o),new Ft(we.ERR_INVALID_CHAR_RANGE,e.rest());d=e.pop();let c;if(d!==H.CODES.get("{"))c=He.runeToString(d);else{const _=e.rest(),E=_.indexOf("}");if(E<0)throw e.rewindTo(o),new Ft(we.ERR_INVALID_CHAR_RANGE,e.rest());c=_.substring(0,E),e.skipString(c),e.skip(1)}c.length!==0&&c.codePointAt(0)===H.CODES.get("^")&&(a=0-a,c=c.substring(1));const g=we.unicodeTable(c);if(g===null)throw new Ft(we.ERR_INVALID_CHAR_RANGE,e.from(o));const h=g.first,v=g.second;if((this.flags&fe.FOLD_CASE)===0||v===null)t.appendTableWithSign(h,a);else{const _=new Cn().appendTable(h).appendTable(v).cleanClass().toArray();t.appendClassWithSign(_,a)}return!0}parseClass(e){const t=e.pos();e.skip(1);const o=this.newRegexp($.Op.CHAR_CLASS);o.flags=this.flags;const a=new Cn;let d=1;e.more()&&e.lookingAt("^")&&(d=-1,e.skip(1),(this.flags&fe.CLASS_NL)===0&&a.appendRange(H.CODES.get(`
19655`),H.CODES.get(`
19656`)));let c=!0;for(;!e.more()||e.peek()!==H.CODES.get("]")||c;){if(e.more()&&e.lookingAt("-")&&(this.flags&fe.PERL_X)===0&&!c){const _=e.rest();if(_==="-"||!_.startsWith("-]"))throw e.rewindTo(t),new Ft(we.ERR_INVALID_CHAR_RANGE,e.rest())}c=!1;const g=e.pos();if(e.lookingAt("[:")){if(this.parseNamedClass(e,a))continue;e.rewindTo(g)}if(this.parseUnicodeClass(e,a)||this.parsePerlClassEscape(e,a))continue;e.rewindTo(g);const h=we.parseClassChar(e,t);let v=h;if(e.more()&&e.lookingAt("-")){if(e.skip(1),e.more()&&e.lookingAt("]"))e.skip(-1);else if(v=we.parseClassChar(e,t),v<h)throw new Ft(we.ERR_INVALID_CHAR_RANGE,e.from(g))}(this.flags&fe.FOLD_CASE)===0?a.appendRange(h,v):a.appendFoldedRange(h,v)}e.skip(1),a.cleanClass(),d<0&&a.negateClass(),o.runes=a.toArray(),this.push(o)}};R(we,"ERR_INTERNAL_ERROR","regexp/syntax: internal error"),R(we,"ERR_INVALID_CHAR_RANGE","invali
19656d character class range"),R(we,"ERR_INVALID_ESCAPE","invalid escape sequence"),R(we,"ERR_INVALID_NAMED_CAPTURE","invalid named capture"),R(we,"ERR_INVALID_PERL_OP","invalid or unsupported Perl syntax"),R(we,"ERR_INVALID_REPEAT_OP","invalid nested repetition operator"),R(we,"ERR_INVALID_REPEAT_SIZE","invalid repeat count"),R(we,"ERR_MISSING_BRACKET","missing closing ]"),R(we,"ERR_MISSING_PAREN","missing closing )"),R(we,"ERR_MISSING_REPEAT_ARGUMENT","missing argument to repetition operator"),R(we,"ERR_TRAILING_BACKSLASH","trailing backslash at end of expression"),R(we,"ERR_DUPLICATE_NAMED_CAPTURE","duplicate capture group name");let Xf=we;class T9{constructor(){this.inst=null,this.cap=[]}}class T2{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(e){const t=this.sparse[e];return t<this.size&&this.densePcs[t]===e}isEmpty(){return this.size===0}add(e){const t=this.size++;return this.sparse[e]=t,this.denseThreads[t]=null,this.densePcs[t]=e,t}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let e="{";for(let t=0;t<this.size;t++)t!==0&&(e+=", "),e+=this.densePcs[t];return e+="}",e}}class ol{static fromRE2(e){const t=new ol;return t.prog=e.prog,t.re2=e,t.q0=new T2(t.prog.numInst()),t.q1=new T2(t.prog.numInst()),t.pool=[],t.poolSize=0,t.matched=!1,t.matchcap=Array(t.prog.numCap<2?2:t.prog.numCap).fill(0),t.ncap=0,t}static fromMachine(e){const t=new ol;return t.re2=e.re2,t.prog=e.prog,t.q0=e.q0,t.q1=e.q1,t.pool=e.pool,t.poolSize=e.poolSize,t.matched=e.matched,t.matchcap=e.matchcap,t.ncap=e.ncap,t}init(e){this.ncap=e,e>this.matchcap.length?this.initNewCap(e):this.resetCap(e)}resetCap(e){for(let t=0;t<this.poolSize;t++){const o=this.pool[t];o.cap=Array(e).fill(0)}}initNewCap(e){for(let t=0;t<this.poolSize;t++){const o=this.pool[t];o.cap=Array(e).fill(0)}this.matchcap=Array(e).fill(0)}submatches(){return this.ncap===0?He.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(e){let t;return this.poolSize>0?(this.poolSize--,t=this.pool[this.poolSize]):t=new T9,t.inst=e,t}freeQueue(e,t=0){const o=e.size-t,a=this.poolSize+o;this.pool.length<a&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,a)));for(let d=t;d<e.size;d++){const c=e.denseThreads[d];c!==null&&(this.pool[this.poolSize]=c,this.poolSize++)}e.clear()}freeThread(e){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=e,this.poolSize++}match(e,t,o){const a=this.re2.cond;if(a===He.EMPTY_ALL||(o===fe.ANCHOR_START||o===fe.ANCHOR_BOTH)&&t!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let d=this.q0,c=this.q1,g=e.step(t),h=g>>3,v=g&7,_=-1,E=0;g!==Fr.EOF()&&(g=e.step(t+v),_=g>>3,E=g&7);let M;for(t===0?M=He.emptyOpContext(-1,h):M=e.context(t);;){if(d.isEmpty()){if((a&He.EMPTY_BEGIN_TEXT)!==0&&t!==0||this.matched)break;if(this.re2.prefix.length!==0&&_!==this.re2.prefixRune&&e.canCheckPrefix()){const ee=e.index(this.re2,t);if(ee<0)break;t+=ee,g=e.step(t),h=g>>3,v=g&7,g=e.step(t+v),_=g>>3,E=g&7}}!this.matched&&(t===0||o===fe.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=t),this.add(d,this.prog.start,t,this.matchcap,M,null));const G=t+v;if(M=e.context(G),this.step(d,c,t,G,h,M,o,t===e.endPos()),v===0||this.ncap===0&&this.matched)break;t+=v,h=_,v=E,h!==-1&&(g=e.step(t+v),_=g>>3,E=g&7);const B=d;d=c,c=B}return this.freeQueue(c),this.matched}step(e,t,o,a,d,c,g,h){const v=this.re2.longest;for(let _=0;_<e.size;_++){let E=e.denseThreads[_];if(E===null)continue;if(v&&this.matched&&this.ncap>0&&this.matchcap[0]<E.cap[0]){this.freeThread(E);continue}const M=E.inst;let G=!1;switch(M.op){case Ke.MATCH:if(g===fe.ANCHOR_BOTH&&!h)break;this.ncap>0&&(!v||!this.matched||this.matchcap[1]<o)&&(E.cap[1]=o,this.matchcap=E.cap.slice(0,this.ncap)),v||this.freeQueue(e,_+1),this.matched=!0;break;case Ke.RUNE:G=M.matchRune(d);break;case Ke.RUNE1:G=d===M.runes[0];break;case Ke.RUNE_ANY:G=!0;break;case Ke.RUNE_ANY_NOT_NL:G=d!==H.CODES.get(`
19657`);break;default:throw new Error("bad inst")}G&&(E=this.add(t,M.out,a,E.cap,c,E)),E!==null&&(this.freeThread(E),e.denseThreads[_]=null)}e.clear()}add(e,t,o,a,d,c){if(t===0||e.contains(t))return c;const g=e.add(t),h=this.prog.inst[t];switch(h.op){case Ke.FAIL:break;case Ke.ALT:case Ke.ALT_MATCH:c=this.add(e,h.out,o,a,d,c),c=this.add(e,h.arg,o,a,d,c);break;case Ke.EMPTY_WIDTH:(h.arg&~d)===0&&(c=this.add(e,h.out,o,a,d,c));break;case Ke.NOP:c=this.add(e,h.out,o,a,d,c);break;case Ke.CAPTURE:if(h.arg<this.ncap){const v=a[h.arg];a[h.arg]=o,this.add(e,h.out,o,a,d,null),a[h.arg]=v}else c=this.add(e,h.out,o,a,d,c);break;case Ke.MATCH:case Ke.RUNE:case Ke.RUNE1:case Ke.RUNE_ANY:case Ke.RUNE_ANY_NOT_NL:c===null?c=this.alloc(h):c.inst=h,this.ncap>0&&c.cap!==a&&(c.cap=a.slice(0,this.ncap)),e.denseThreads[g]=c,c=null;break;default:throw new Error("unhandled")}return c}}class I9{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}compareAndSet(e,t){return this.value===e?(this.value=t,!0):!1}}class qr{static initTest(e){const t=qr.compile(e),o=new qr(t.expr,t.prog,t.numSubexp,t.longest);return o.cond=t.cond,o.prefix=t.prefix,o.prefixUTF8=t.prefixUTF8,o.prefixComplete=t.prefixComplete,o.prefixRune=t.prefixRune,o}static compile(e){return qr.compileImpl(e,fe.PERL,!1)}static compilePOSIX(e){return qr.compileImpl(e,fe.POSIX,!0)}static compileImpl(e,t,o){let a=Xf.parse(e,t);const d=a.maxCap();a=qo.simplify(a);const c=Ud.compileRegexp(a),g=new qr(e,c,d,o),[h,v]=c.prefix();return g.prefixComplete=h,g.prefix=v,g.prefixUTF8=He.stringToUtf8ByteArray(g.prefix),g.prefix.length>0&&(g.prefixRune=g.prefix.codePointAt(0)),g.namedGroups=a.namedGroups,g}static match(e,t){return qr.compile(e).match(t)}constructor(e,t,o=0,a=0){this.expr=e,this.prog=t,this.numSubexp=o,this.longest=a,this.cond=t.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new I9}numberOfCapturingGroups(){return this.numSubexp}get(){let e;do e=this.pooled.get();while(e&&!this.pooled.compareAndSet(e,e.next));return e}reset(){this.pooled.set(null)}put(e,t){let o=this.pooled.get();do o=this.pooled.get(),!t&&o&&(e=ol.fromMachine(e),t=!0),e.next!==o&&(e.next=o);while(!this.pooled.compareAndSet(o,e))}toString(){return this.expr}doExecute(e,t,o,a){let d=this.get(),c=!1;d?d.next!==null&&(d=ol.fromMachine(d),c=!0):(d=ol.fromRE2(this),c=!0),d.init(a);const g=d.match(e,t,o)?d.submatches():null;return this.put(d,c),g}match(e){return this.doExecute(jt.fromUTF16(e),0,fe.UNANCHORED,0)!==null}matchWithGroup(e,t,o,a,d){return e instanceof na||(e=_u.utf16(e)),this.matchMachineInput(e,t,o,a,d)}matchMachineInput(e,t,o,a,d){if(t>o)return[!1,null];
19657const c=e.isUTF16Encoding()?jt.fromUTF16(e.asCharSequence(),0,o):jt.fromUTF8(e.asBytes(),0,o),g=this.doExecute(c,t,a,2*d);return g===null?[!1,null]:[!0,g]}matchUTF8(e){return this.doExecute(jt.fromUTF8(e),0,fe.UNANCHORED,0)!==null}replaceAll(e,t){return this.replaceAllFunc(e,()=>t,2*e.length+1)}replaceFirst(e,t){return this.replaceAllFunc(e,()=>t,1)}replaceAllFunc(e,t,o){let a=0,d=0,c="";const g=jt.fromUTF16(e);let h=0;for(;d<=e.length;){const v=this.doExecute(g,d,fe.UNANCHORED,2);if(v===null||v.length===0)break;c+=e.substring(a,v[0]),(v[1]>a||v[0]===0)&&(c+=t(e.substring(v[0],v[1])),h++),a=v[1];const _=g.step(d)&7;if(d+_>v[1]?d+=_:d+1>v[1]?d++:d=v[1],h>=o)break}return c+=e.substring(a),c}pad(e){if(e===null)return null;let t=(1+this.numSubexp)*2;if(e.length<t){let o=new Array(t).fill(-1);for(let a=0;a<e.length;a++)o[a]=e[a];e=o}return e}allMatches(e,t,o=a=>a){let a=[];const d=e.endPos();t<0&&(t=d+1);let c=0,g=0,h=-1;for(;g<t&&c<=d;){const v=this.doExecute(e,c,fe.UNANCHORED,this.prog.numCap);if(v===null||v.length===0)break;let _=!0;if(v[1]===c){v[0]===h&&(_=!1);const E=e.step(c);E<0?c=d+1:c+=E&7}else c=v[1];h=v[1],_&&(a.push(o(this.pad(v))),g++)}return a}findUTF8(e){const t=this.doExecute(jt.fromUTF8(e),0,fe.UNANCHORED,2);return t===null?null:e.slice(t[0],t[1])}findUTF8Index(e){const t=this.doExecute(jt.fromUTF8(e),0,fe.UNANCHORED,2);return t===null?null:t.slice(0,2)}find(e){const t=this.doExecute(jt.fromUTF16(e),0,fe.UNANCHORED,2);return t===null?"":e.substring(t[0],t[1])}findIndex(e){return this.doExecute(jt.fromUTF16(e),0,fe.UNANCHORED,2)}findUTF8Submatch(e){const t=this.doExecute(jt.fromUTF8(e),0,fe.UNANCHORED,this.prog.numCap);if(t===null)return null;const o=new Array(1+this.numSubexp).fill(null);for(let a=0;a<o.length;a++)2*a<t.length&&t[2*a]>=0&&(o[a]=e.slice(t[2*a],t[2*a+1]));return o}findUTF8SubmatchIndex(e){return this.pad(this.doExecute(jt.fromUTF8(e),0,fe.UNANCHORED,this.prog.numCap))}findSubmatch(e){const t=this.doExecute(jt.fromUTF16(e),0,fe.UNANCHORED,this.prog.numCap);if(t===null)return null;const o=new Array(1+this.numSubexp).fill(null);for(let a=0;a<o.length;a++)2*a<t.length&&t[2*a]>=0&&(o[a]=e.substring(t[2*a],t[2*a+1]));return o}findSubmatchIndex(e){return this.pad(this.doExecute(jt.fromUTF16(e),0,fe.UNANCHORED,this.prog.numCap))}findAllUTF8(e,t){const o=this.allMatches(jt.fromUTF8(e),t,a=>e.slice(a[0],a[1]));return o.length===0?null:o}findAllUTF8Index(e,t){const o=this.allMatches(jt.fromUTF8(e),t,a=>a.slice(0,2));return o.length===0?null:o}findAll(e,t){const o=this.allMatches(jt.fromUTF16(e),t,a=>e.substring(a[0],a[1]));return o.length===0?null:o}findAllIndex(e,t){const o=this.allMatches(jt.fromUTF16(e),t,a=>a.slice(0,2));return o.length===0?null:o}findAllUTF8Submatch(e,t){const o=this.allMatches(jt.fromUTF8(e),t,a=>{let d=new Array(a.length/2|0).fill(null);for(let c=0;c<d.length;c++)a[2*c]>=0&&(d[c]=e.slice(a[2*c],a[2*c+1]));return d});return o.length===0?null:o}findAllUTF8SubmatchIndex(e,t){const o=this.allMatches(jt.fromUTF8(e),t);return o.length===0?null:o}findAllSubmatch(e,t){const o=this.allMatches(jt.fromUTF16(e),t,a=>{let d=new Array(a.length/2|0).fill(null);for(let c=0;c<d.length;c++)a[2*c]>=0&&(d[c]=e.substring(a[2*c],a[2*c+1]));return d});return o.length===0?null:o}findAllSubmatchIndex(e,t){const o=this.allMatches(jt.fromUTF16(e),t);return o.length===0?null:o}}const Pn=class Pn{static quote(e){return He.quoteMeta(e)}static compile(e,t=0){let o=e;if((t&Pn.CASE_INSENSITIVE)!==0&&(o=`(?i)${o}`),(t&Pn.DOTALL)!==0&&(o=`(?s)${o}`),(t&Pn.MULTILINE)!==0&&(o=`(?m)${o}`),(t&-32)!==0)throw new S9("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let a=fe.PERL;(t&Pn.DISABLE_UNICODE_GROUPS)!==0&&(a&=-129);const d=new Pn(e,t);return d.re2Input=qr.compileImpl(o,a,(t&Pn.LONGEST_MATCH)!==0),d}static matches(e,t){return Pn.compile(e).matcher(t).matches()}static initTest(e,t,o){if(e==null)throw new Error("pattern is null");if(o==null)throw new Error("re2 is null");const a=new Pn(e,t);return a.re2Input=o,a}constructor(e,t){this.patternInput=e,this.flagsInput=t}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(e){return this.matcher(e).matches()}matcher(e){return Array.isArray(e)&&(e=_u.utf8(e)),new k9(this,e)}split(e,t=0){const o=this.matcher(e),a=[];let d=0,c=0;for(;o.find();){if(c===0&&o.end()===0){c=o.end();continue}if(t>0&&a.length===t-1)break;if(c===o.start()){if(t===0){d+=1,c=o.end();continue}}else for(;d>0;)a.push(""),d-=1;a.push(o.substring(c,o.start())),c=o.end()}if(t===0&&c!==o.inputLength()){for(;d>0;)a.push(""),d-=1;a.push(o.substring(c,o.inputLength()))}return(t!==0||a.length===0)&&a.push(o.substring(c,o.inputLength())),a}toString(){return this.patternInput}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(e){return this===e?!0:e===null||this.constructor!==e.constructor?!1:this.flagsInput===e.flagsInput&&this.patternInput
19657===e.patternInput}};R(Pn,"CASE_INSENSITIVE",1),R(Pn,"DOTALL",2),R(Pn,"MULTILINE",4),R(Pn,"DISABLE_UNICODE_GROUPS",8),R(Pn,"LONGEST_MATCH",16);let Yd=Pn;/**
19658 * @license
19659 * Copyright 2017 Google LLC
19660 *
19661 * Licensed under the Apache License, Version 2.0 (the "License");
19662 * you may not use this file except in compliance with the License.
19663 * You may obtain a copy of the License at
19664 *
19665 *   http://www.apache.org/licenses/LICENSE-2.0
19666 *
19667 * Unless required by applicable law or agreed to in writing, software
19668 * distributed under the License is distributed on an "AS IS" BASIS,
19669 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19670 * See the License for the specific language governing permissions and
19671 * limitations under the License.
19672 */class Rn{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Rn.UNAUTHENTICATED=new Rn(null),Rn.GOOGLE_CREDENTIALS=new Rn("google-credentials-uid"),Rn.FIRST_PARTY=new Rn("first-party-uid"),Rn.MOCK_USER=new Rn("mock-user");/**
19673 * @license
19674 * Copyright 2017 Google LLC
19675 *
19676 * Licensed under the Apache License, Version 2.0 (the "License");
19677 * you may not use this file except in compliance with the License.
19678 * You may obtain a copy of the License at
19679 *
19680 *   http://www.apache.org/licenses/LICENSE-2.0
19681 *
19682 * Unless required by applicable law or agreed to in writing, software
19683 * distributed under the License is distributed on an "AS IS" BASIS,
19684 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19685 * See the License for the specific language governing permissions and
19686 * limitations under the License.
19687 */let Al="12.15.0";function O9(r){Al=r}/**
19688 * @license
19689 * Copyright 2020 Google LLC
19690 *
19691 * Licensed under the Apache License, Version 2.0 (the "License");
19692 * you may not use this file except in compliance with the License.
19693 * You may obtain a copy of the License at
19694 *
19695 *   http://www.apache.org/licenses/LICENSE-2.0
19696 *
19697 * Unless required by applicable law or agreed to in writing, software
19698 * distributed under the License is distributed on an "AS IS" BASIS,
19699 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19700 * See the License for the specific language governing permissions and
19701 * limitations under the License.
19702 *//**
19703 * @license
19704 * Copyright 2017 Google LLC
19705 *
19706 * Licensed under the Apache License, Version 2.0 (the "License");
19707 * you may not use this file except in compliance with the License.
19708 * You may obtain a copy of the License at
19709 *
19710 *   http://www.apache.org/licenses/LICENSE-2.0
19711 *
19712 * Unless required by applicable law or agreed to in writing, software
19713 * distributed under the License is distributed on an "AS IS" BASIS,
19714 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19715 * See the License for the specific language governing permissions and
19716 * limitations under the License.
19717 */const si=new ph("@firebase/firestore");function Ji(){return si.logLevel}function ge(r,...e){if(si.logLevel<=st.DEBUG){const t=e.map(hh);si.debug(`Firestore (${Al}): ${r}`,...t)}}function nr(r,...e){if(si.logLevel<=st.ERROR){const t=e.map(hh);si.error(`Firestore (${Al}): ${r}`,...t)}}function jo(r,...e){if(si.logLevel<=st.WARN){const t=e.map(hh);si.warn(`Firestore (${Al}): ${r}`,...t)}}function hh(r){if(typeof r=="string")return r;try{return(function(t){return JSON.stringify(t)})(r)}catch{return r}}/**
19718 * @license
19719 * Copyright 2017 Google LLC
19720 *
19721 * Licensed under the Apache License, Version 2.0 (the "License");
19722 * you may not use this file except in compliance with the License.
19723 * You may obtain a copy of the License at
19724 *
19725 *   http://www.apache.org/licenses/LICENSE-2.0
19726 *
19727 * Unless required by applicable law or agreed to in writing, software
19728 * distributed under the License is distributed on an "AS IS" BASIS,
19729 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19730 * See the License for the specific language governing permissions and
19731 * limitations under the License.
19732 */function De(r,e,t){let o="Unexpected state";
vendor: 5,270 bytes, lines 19732-19777
19732typeof e=="string"?o=e:t=e,vy(r,o,t)}function vy(r,e,t){let o=`FIRESTORE (${Al}) INTERNAL ASSERTION FAILED: ${e} (ID: ${r.toString(16)})`;if(t!==void 0)try{o+=" CONTEXT: "+JSON.stringify(t)}catch{o+=" CONTEXT: "+t}throw nr(o),new Error(o)}function Ae(r,e,t,o){let a="Unexpected state";typeof t=="string"?a=t:o=t,r||vy(e,a,o)}function Ge(r,e){return r}/**
19733 * @license
19734 * Copyright 2017 Google LLC
19735 *
19736 * Licensed under the Apache License, Version 2.0 (the "License");
19737 * you may not use this file except in compliance with the License.
19738 * You may obtain a copy of the License at
19739 *
19740 *   http://www.apache.org/licenses/LICENSE-2.0
19741 *
19742 * Unless required by applicable law or agreed to in writing, software
19743 * distributed under the License is distributed on an "AS IS" BASIS,
19744 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19745 * See the License for the specific language governing permissions and
19746 * limitations under the License.
19747 */const oe={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class pe extends ar{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
19748 * @license
19749 * Copyright 2017 Google LLC
19750 *
19751 * Licensed under the Apache License, Version 2.0 (the "License");
19752 * you may not use this file except in compliance with the License.
19753 * You may obtain a copy of the License at
19754 *
19755 *   http://www.apache.org/licenses/LICENSE-2.0
19756 *
19757 * Unless required by applicable law or agreed to in writing, software
19758 * distributed under the License is distributed on an "AS IS" BASIS,
19759 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19760 * See the License for the specific language governing permissions and
19761 * limitations under the License.
19762 */class $a{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}/**
19763 * @license
19764 * Copyright 2017 Google LLC
19765 *
19766 * Licensed under the Apache License, Version 2.0 (the "License");
19767 * you may not use this file except in compliance with the License.
19768 * You may obtain a copy of the License at
19769 *
19770 *   http://www.apache.org/licenses/LICENSE-2.0
19771 *
19772 * Unless required by applicable law or agreed to in writing, software
19773 * distributed under the License is distributed on an "AS IS" BASIS,
19774 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19775 * See the License for the specific language governing permissions and
19776 * limitations under the License.
19777 */class by{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class P9{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(Rn.UNAUTHENTICATED)))}shutdown(){}}class z9{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable((()=>t(this.token.user)))}shutdown(){this.changeListener=null}}class L9{constructor(e){this.t=e,this.currentUser=Rn.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){Ae(this.o===void 0,42304);let o=this.i;const a=h=>this.i!==o?(o=this.i,t(h)):Promise.resolve();let d=new $a;this.o=()=>{this.i++,this.currentUser=this.u(),d.resolve(),d=new $a,e.enqueueRetryable((()=>a(this.currentUser)))};const c=()=>{const h=d;e.enqueueRetryable((async()=>{await h.promise,await a(this.currentUser)}))},g=h=>{ge("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=h,this.o&&(this.auth.addAuthTokenListener(this.o),c())};this.t.onInit((h=>g(h))),setTimeout((()=>{if(!this.auth){const h=this.t.getImmediate({optional:!0});h?g(h):(ge("FirebaseAuthCredentialsProvider","Auth not yet detected"),d.resolve(),d=new $a)}}),0),c()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((o=>this.i!==e?(ge("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):o?(Ae(typeof o.accessToken=="string",31837,{l:o}),new by(o.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Ae(e===null||typeof e=="string",2055,{h:e}),new Rn(e)}}class N9{constructor(e,t,o){this.T=e,this.P=t,this.R=o,this.type="FirstParty",this.user=Rn.FIRST_PARTY,this.I=new Map}A(){return this.R?this.R():null}get headers(){this.I.set("X-Goog-AuthUser",this.T);const e=this.A();return e&&this.I.set("Authorization",e),this.P&&this.I.set("X-Goog-Iam-Authorization-Token",this.P),this.I}}class V9{constructor(e,t,o){this.T=e,this.P=t,this.R=o}getToken(){return Promise.resolve(new N9(this.T,this.P,this.R))}start(e,t){e.enqueueRetryable((()=>t(Rn.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}
19777class I2{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class U9{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,vs(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){Ae(this.o===void 0,3512);const o=d=>{d.error!=null&&ge("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${d.error.message}`);const c=d.token!==this.m;return this.m=d.token,ge("FirebaseAppCheckTokenProvider",`Received ${c?"new":"existing"} token.`),c?t(d.token):Promise.resolve()};this.o=d=>{e.enqueueRetryable((()=>o(d)))};const a=d=>{ge("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=d,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((d=>a(d))),setTimeout((()=>{if(!this.appCheck){const d=this.V.getImmediate({optional:!0});d?a(d):ge("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){if(this.p)return Promise.resolve(new I2(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((t=>t?(Ae(typeof t.token=="string",44558,{tokenResult:t}),this.m=t.token,new I2(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
19778 * @license
19779 * Copyright 2020 Google LLC
19780 *
19781 * Licensed under the Apache License, Version 2.0 (the "License");
19782 * you may not use this file except in compliance with the License.
19783 * You may obtain a copy of the License at
19784 *
19785 *   http://www.apache.org/licenses/LICENSE-2.0
19786 *
19787 * Unless required by applicable law or agreed to in writing, software
19788 * distributed under the License is distributed on an "AS IS" BASIS,
19789 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19790 * See the License for the specific language governing permissions and
19791 * limitations under the License.
19792 */function B9(r){const e=typeof self<"u"&&(self.crypto||self.msCrypto),t=new Uint8Array(r);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let o=0;o<r;o++)t[o]=Math.floor(256*Math.random());return t}/**
19793 * @license
19794 * Copyright 2017 Google LLC
19795 *
19796 * Licensed under the Apache License, Version 2.0 (the "License");
19797 * you may not use this file except in compliance with the License.
19798 * You may obtain a copy of the License at
19799 *
19800 *   http://www.apache.org/licenses/LICENSE-2.0
19801 *
19802 * Unless required by applicable law or agreed to in writing, software
19803 * distributed under the License is distributed on an "AS IS" BASIS,
19804 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19805 * See the License for the specific language governing permissions and
19806 * limitations under the License.
19807 */class vh{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(4.129032258064516);let o="";for(;o.length<20;){const a=B9(40);for(let d=0;d<a.length;++d)o.length<20&&a[d]<t&&(o+=e.charAt(a[d]%62))}return o}}function et(r,e){return r<e?-1:r>e?1:0}function Hf(r,e){const t=Math.min(r.length,e.length);for(let o=0;o<t;o++){const a=r.charAt(o),d=e.charAt(o);if(a!==d)return Cf(a)===Cf(d)?et(a,d):Cf(a)?1:-1}return et(r.length,e.length)}const G9=55296,q9=57343;function Cf(r){const e=r.charCodeAt(0);return e>=G9&&e<=q9}function ml(r,e,t){return r.length===e.length&&r.every(((o,a)=>t(o,e[a])))}/**
19808 * @license
19809 * Copyright 2017 Google LLC
19810 *
19811 * Licensed under the Apache License, Version 2.0 (the "License");
19812 * you may not use this file except in compliance with the License.
19813 * You may obtain a copy of the License at
19814 *
19815 *   http://www.apache.org/licenses/LICENSE-2.0
19816 *
19817 * Unless required by applicable law or agreed to in writing, software
19818 * distributed under the License is distributed on an "AS IS" BASIS,
19819 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19820 * See the License for the specific language governing permissions and
19821 * limitations under the License.
19822 */const ul="__name__";class hs{constructor(e,t,o){t===void 0?t=0:t>e.length&&De(637,{offset:t,range:e.length}),o===void 0?o=e.length-t:o>e.length-t&&De(1746,{length:o,range:e.length-t}),this.segments=e,this.offset=t,this.len=o}get length(){return this.len}isEqual(e){return hs.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof hs?e.forEach((o=>{t.push(o)})):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,o=this.limit();t<o;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const o=Math.min(e.length,t.length);for(let a=0;a<o;a++){const d=hs.compareSegments(e.get(a),t.get(a));if(d!==0)return d}return et(e.length,t.length)}static compareSegments(e,t){const o=hs.isNumericId(e),a=hs.isNumericId(t);return o&&!a?-1:!o&&a?1:o&&a?hs.extractNumericId(e).compare(hs.extractNumericId(t)):Hf(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return $r.fromString(e.substring(4,e.length-2))}}class ut extends hs{construct(e,t,o){return new ut(e,t,o)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toStringWithLeadingSlash(){return`/${this.canonicalString()}`}
19822toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const o of e){if(o.indexOf("//")>=0)throw new pe(oe.INVALID_ARGUMENT,`Invalid segment (${o}). Paths must not contain // in them.`);t.push(...o.split("/").filter((a=>a.length>0)))}return new ut(t)}static emptyPath(){return new ut([])}}const F9=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class an extends hs{construct(e,t,o){return new an(e,t,o)}static isValidIdentifier(e){return F9.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),an.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===ul}static keyField(){return new an([ul])}static fromServerFormat(e){const t=[];let o="",a=0;const d=()=>{if(o.length===0)throw new pe(oe.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(o),o=""};let c=!1;for(;a<e.length;){const g=e[a];if(g==="\\"){if(a+1===e.length)throw new pe(oe.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const h=e[a+1];if(h!=="\\"&&h!=="."&&h!=="`")throw new pe(oe.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);o+=h,a+=2}else g==="`"?(c=!c,a++):g!=="."||c?(o+=g,a++):(d(),a++)}if(d(),c)throw new pe(oe.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new an(t)}static emptyPath(){return new an([])}}/**
19823 * @license
19824 * Copyright 2017 Google LLC
19825 *
19826 * Licensed under the Apache License, Version 2.0 (the "License");
19827 * you may not use this file except in compliance with the License.
19828 * You may obtain a copy of the License at
19829 *
19830 *   http://www.apache.org/licenses/LICENSE-2.0
19831 *
19832 * Unless required by applicable law or agreed to in writing, software
19833 * distributed under the License is distributed on an "AS IS" BASIS,
19834 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19835 * See the License for the specific language governing permissions and
19836 * limitations under the License.
19837 */class Ee{constructor(e){this.path=e}static fromPath(e){return new Ee(ut.fromString(e))}static fromName(e){return new Ee(ut.fromString(e).popFirst(5))}static empty(){return new Ee(ut.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&ut.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return ut.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new Ee(new ut(e.slice()))}}/**
19838 * @license
19839 * Copyright 2017 Google LLC
19840 *
19841 * Licensed under the Apache License, Version 2.0 (the "License");
19842 * you may not use this file except in compliance with the License.
19843 * You may obtain a copy of the License at
19844 *
19845 *   http://www.apache.org/licenses/LICENSE-2.0
19846 *
19847 * Unless required by applicable law or agreed to in writing, software
19848 * distributed under the License is distributed on an "AS IS" BASIS,
19849 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19850 * See the License for the specific language governing permissions and
19851 * limitations under the License.
19852 */function yy(r,e,t){if(!t)throw new pe(oe.INVALID_ARGUMENT,`Function ${r}() cannot be called with an empty ${e}.`)}function j9(r,e,t,o){if(e===!0&&o===!0)throw new pe(oe.INVALID_ARGUMENT,`${r} and ${t} cannot be used together.`)}function O2(r){if(!Ee.isDocumentKey(r))throw new pe(oe.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${r} has ${r.length}.`)}function P2(r){if(Ee.isDocumentKey(r))throw new pe(oe.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${r} has ${r.length}.`)}function vc(r){return typeof r=="object"&&r!==null&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}function Wu(r){if(r===void 0)return"undefined";if(r===null)return"null";if(typeof r=="string")return r.length>20&&(r=`${r.substring(0,20)}...`),JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean")return""+r;if(typeof r=="object"){if(r instanceof Array)return"an array";{const e=(function(o){return o.constructor?o.constructor.name:null})(r);return e?`a custom ${e} object`:"an object"}}return typeof r=="function"?"a function":De(12329,{type:typeof r})}function ys(r,e){if("_delegate"in r&&(r=r._delegate),!(r instanceof e)){if(e.name===r.constructor.name)throw new pe(oe.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=Wu(r);throw new pe(oe.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return r}/**
19853 * @license
19854 * Copyright 2025 Google LLC
19855 *
19856 * Licensed under the Apache License, Version 2.0 (the "License");
19857 * you may not use this file except in compliance with the License.
19858 * You may obtain a copy of the License at
19859 *
19860 *   http://www.apache.org/licenses/LICENSE-2.0
19861 *
19862 * Unless required by applicable law or agreed to in writing, software
19863 * distributed under the License is distributed on an "AS IS" BASIS,
19864 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19865 * See the License for the specific language governing permissions and
19866 * limitations under the License.
19867 */function tn(r,e){const t={typeString:r};return e&&(t.value=e),t}function bc(r,e){if(!vc(r))throw new pe(oe.INVALID_ARGUMENT,"JSON must be an object");let t;for(const o in e)if(e[o]){const a=e[o].typeString,d="value"in e[o]?{value:e[o].value}:void 0;if(!(o in r)){t=`JSON missing required field: '${o}'`;break}const c=r[o];if(a&&typeof c!==a){t=`JSON field '${o}' must be a ${a}.`;break}if(d!==void 0&&c!==d.value){t=`Expected '${o}' field to equal '${d.value}'`;break}}if(t)throw new pe(oe.INVALID_ARGUMENT,t);return!0}/**
19868 * @license
19869 * Copyright 2017 Google LLC
19870 *
19871 * Licensed under the Apache License, Version 2.0 (the "License");
19872 * you may not use this file except in compliance with the License.
19873 * You may obtain a copy of the License at
19874 *
19875 *   http://www.apache.org/licenses/LICENSE-2.0
19876 *
19877 * Unless required by applicable law or agreed to in writing, software
19878 * distributed under the License is distributed on an "AS IS" BASIS,
19879 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19880 * See the License for the specific language governing permissions and
19881 * limitations under the License.
19882 */const z2=-62135596800,L2=1e6;class Ct{static now(){return Ct.fromMillis(Date.now())}static fromDate(e){return Ct.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),o=Math.floor((e-1e3*t)*L2);return new Ct(t,o)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new pe(oe.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new pe(oe.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<z2)throw new pe(oe.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new pe(oe.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/L2}_compareTo(e){return this.seconds===e.seconds?et(this.nanoseconds,e.nanoseconds):et(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:Ct._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(bc(e,Ct._jsonSchema))return new Ct(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-z2;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Ct._jsonSchemaVersion="firestore/timestamp/1.0",Ct._jsonSchema={type:tn("string",Ct._jsonSchemaVersion),seconds:tn("number"),nanoseconds:tn("number")};/**
19883 * @license
19884 * Copyright 2017 Google LLC
19885 *
19886 * Licensed under the Apache License, Version 2.0 (the "License");
19887 * you may not use this file except in compliance with the License.
19888 * You may obtain a copy of the License at
19889 *
19890 *   http://www.apache.org/licenses/LICENSE-2.0
19891 *
19892 * Unless required by applicable law or agreed to in writing, software
19893 * distributed under the License is distributed on an "AS IS" BASIS,
19894 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19895 * See the License for the specific language governing permissions and
19896 * limitations under the License.
19897 */class Ne{static fromTimestamp(e){return new Ne(e)}static min(){return new Ne(new Ct(0,0))}static max(){return new Ne(new Ct(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
19898 * @license
19899 * Copyright 2021 Google LLC
19900 *
19901 * Licensed under the Apache License, Version 2.0 (the "License");
19902 * you may not use this file except in compliance with the License.
19903 * You may obtain a copy of the License at
19904 *
19905 *   http://www.apache.org/licenses/LICENSE-2.0
19906 *
19907 * Unless required by applicable law or agreed to in writing, software
19908 * distributed under the License is distributed on an "AS IS" BASIS,
19909 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19910 * See the License for the specific language governing permissions and
19911 * limitations under the License.
19912 */const $d=-1;function X9(r,e){const t=r.toTimestamp().seconds,o=r.toTimestamp().nanoseconds+1,a=Ne.fromTimestamp(o===1e9?new Ct(t+1,0):new Ct(t,o));return new oa(a,Ee.empty(),e)}function H9(r){return new oa(r.readTime,r.key,$d)}class oa{constructor(e,t,o){this.readTime=e,this.documentKey=t,this.largestBatchId=o}static min(){return new oa(Ne.min(),Ee.empty(),$d)}static max(){return new oa(Ne.max(),Ee.empty(),$d)}}function W9(r,e){let t=r.readTime.compareTo(e.readTime);return t!==0?t:(t=Ee.comparator(r.documentKey,e.documentKey),t!==0?t:et(r.largestBatchId,e.largestBatchId))}/**
19913 * @license
19914 * Copyright 2020 Google LLC
19915 *
19916 * Licensed under the Apache License, Version 2.0 (the "License");
19917 * you may not use this file except in compliance with the License.
19918 * You may obtain a copy of the License at
19919 *
19920 *   http://www.apache.org/licenses/LICENSE-2.0
19921 *
19922 * Unless required by applicable law or agreed to in writing, software
19923 * distributed under the License is distributed on an "AS IS" BASIS,
19924 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19925 * See the License for the specific language governing permissions and
19926 * limitations under the License.
19927 */const K9="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class Q9{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}/**
19928 * @license
19929 * Copyright 2017 Google LLC
19930 *
19931 * Licensed under the Apache License, Version 2.0 (the "License");
19932 * you may not use this file except in compliance with the License.
19933 * You may obtain a copy of the License at
19934 *
19935 *   http://www.apache.org/licenses/LICENSE-2.0
19936 *
19937 * Unless required by applicable law or agreed to in writing, software
19938 * distributed under the License is distributed on an "AS IS" BASIS,
19939 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19940 * See the License for the specific language governing permissions and
19941 * limitations under the License.
19942 */async function _l(r){if(r.code!==oe.FAILED_PRECONDITION||r.message!==K9)throw r;ge("LocalStore","Unexpectedly lost primary lease")}/**
19943 * @license
19944 * Copyright 2017 Google LLC
19945 *
19946 * Licensed under the Apache License, Version 2.0 (the "License");
19947 * you may not use this file except in compliance with the License.
19948 * You may obtain a copy of the License at
19949 *
19950 *   http://www.apache.org/licenses/LICENSE-2.0
19951 *
19952 * Unless required by applicable law or agreed to in writing, software
19953 * distributed under the License is distributed on an "AS IS" BASIS,
19954 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19955 * See the License for the specific language governing permissions and
19956 * limitations under the License.
19957 */class se{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&De(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new se(((o,a)=>{this.nextCallback=d=>{this.wrapSuccess(e,d).next(o,a)},this.catchCallback=d=>{this.wrapFailure(t,d).next(o,a)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(e){try{const t=e();return t instanceof se?t:se.resolve(t)}catch(t){return se.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction((()=>e(t))):se.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction((()=>e(t))):se.reject(t)}static resolve(e){return new se(((t,o)=>{t(e)}))}static reject(e){return new se(((t,o)=>{o(e)}))}static waitFor(e){return new se(((t,o)=>{let a=0,d=0,c=!1;e.forEach((g=>{++a,g.next((()=>{++d,c&&d===a&&t()}),(h=>o(h)))})),c=!0,d===a&&t()}))}static or(e){let t=se.resolve(!1);for(const o of e)t=t.next((a=>a?se.resolve(a):o()));return t}static forEach(e,t){const o=[];return e.forEach(((a,d)=>{o.push(t.call(this,a,d))})),this.waitFor(o)}static mapArray(e,t){return new se(((o,a)=>{const d=e.length,c=new Array(d);let g=0;for(let h=0;h<d;h++){const v=h;t(e[v]).next((_=>{c[v]=_,++g,g===d&&o(c)}),(_=>a(_)))}}))}static doWhile(e,t){return new se(((o,a)=>{const d=()=>{e()===!0?t().next((()=>{d()}),a):o()};d()}))}}function Y9(r){const e=r.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function wl(r){return r.name==="IndexedDbTransactionError"}/**
19958 * @license
19959 * Copyright 2018 Google LLC
19960 *
19961 * Licensed under the Apache License, Version 2.0 (the "License");
19962 * you may not use this file except in compliance with the License.
19963 * You may obtain a copy of the License at
19964 *
19965 *   http://www.apache.org/licenses/LICENSE-2.0
19966 *
19967 * Unless required by applicable law or agreed to in writing, software
19968 * distributed under the License is distributed on an "AS IS" BASIS,
19969 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19970 * See the License for the specific language governing permissions and
19971 * limitations under the License.
19972 */class Ku{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=o=>this.ae(o),this.ue=o=>t.writeSequenceNumber(o))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}Ku.ce=-1;/**
19973 * @license
19974 * Copyright 2017 Google LLC
19975 *
19976 * Licensed under the Apache License, Version 2.0 (the "License");
19977 * you may not use this file except in compliance with the License.
19978 * You may obtain a copy of the License at
19979 *
19980 *   http://www.apache.org/licenses/LICENSE-2.0
19981 *
19982 * Unless required by applicable law or agreed to in writing, software
19983 * distributed under the License is distributed on an "AS IS" BASIS,
19984 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19985 * See the License for the specific language governing permissions and
19986 * limitations under the License.
19987 */const bh=-1;function Qu(r){return r==null}function Jd(r){return r===0&&1/r==-1/0}function $9(r){return typeof r=="number"&&Number.isInteger(r)&&!Jd(r)&&r<=Number.MAX_SAFE_INTEGER&&r>=Number.MIN_SAFE_INTEGER}function J9(r){return typeof r=="string"}/**
19988 * @license
19989 * Copyright 2017 Google LLC
19990 *
19991 * Licensed under the Apache License, Version 2.0 (the "License");
19992 * you may not use this file except in compliance with the License.
19993 * You may obtain a copy of the License at
19994 *
19995 *   http://www.apache.org/licenses/LICENSE-2.0
19996 *
19997 * Unless required by applicable law or agreed to in writing, software
19998 * distributed under the License is distributed on an "AS IS" BASIS,
19999 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20000 * See the License for the specific language governing permissions and
20001 * limitations under the License.
20002 */const xy="�";function Z9(r){let e="";for(let t=0;t<r.length;t++)e.length>0&&(e=N2(e)),e=eA(r.get(t),e);return N2(e)}function eA(r,e){let t=e;const o=r.length;for(let a=0;a<o;a++){const d=r.charAt(a);switch(d){case"\0":t+="��";break;case xy:t+="��";break;default:t+=d}}return t}function N2(r){return r+xy+"�"}/**
20003 * @license
20004 * Copyright 2017 Google LLC
20005 *
20006 * Licensed under the Apache License, Version 2.0 (the "License");
20007 * you may not use this file except in compliance with the License.
20008 * You may obtain a copy of the License at
20009 *
20010 *   http://www.apache.org/licenses/LICENSE-2.0
20011 *
20012 * Unless required by applicable law or agreed to in writing, software
20013 * distributed under the License is distributed on an "AS IS" BASIS,
20014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20015 * See the License for the specific language governing permissions and
20016 * limitations under the License.
20017 */class Mt{constructor(e,t){this.comparator=e,this.root=t||An.EMPTY}insert(e,t){return new Mt(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,An.BLACK,null,null))}remove(e){return new Mt(this.comparator,this.root.remove(e,this.comparator).copy(null,null,An.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const o=this.comparator(e,t.key);if(o===0)return t.value;o<0?t=t.left:o>0&&(t=t.right)}return null}indexOf(e){let t=0,o=this.root;for(;!o.isEmpty();){const a=this.comparator(e,o.key);if(a===0)return t+o.left.size;a<0?o=o.left:(t+=o.left.size+1,o=o.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal(((t,o)=>(e(t,o),!1)))}toString(){const e=[];return this.inorderTraversal(((t,o)=>(e.push(`${t}:${o}`),!1))),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new su(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new su(this.root,e,this.comparator,!1)}getReverseIterator(){return new su(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new su(this.root,e,this.comparator,!0)}}class su{constructor(e,t,o,a){this.isReverse=a,this.nodeStack=[];let d=1;for(;!e.isEmpty();
vendor: 4,139 bytes, lines 20017-20027
20017)if(d=t?o(e.key,t):1,t&&a&&(d*=-1),d<0)e=this.isReverse?e.left:e.right;else{if(d===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class An{constructor(e,t,o,a,d){this.key=e,this.value=t,this.color=o??An.RED,this.left=a??An.EMPTY,this.right=d??An.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,o,a,d){return new An(e??this.key,t??this.value,o??this.color,a??this.left,d??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,o){let a=this;const d=o(e,a.key);return a=d<0?a.copy(null,null,null,a.left.insert(e,t,o),null):d===0?a.copy(null,t,null,null,null):a.copy(null,null,null,null,a.right.insert(e,t,o)),a.fixUp()}removeMin(){if(this.left.isEmpty())return An.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let o,a=this;if(t(e,a.key)<0)a.left.isEmpty()||a.left.isRed()||a.left.left.isRed()||(a=a.moveRedLeft()),a=a.copy(null,null,null,a.left.remove(e,t),null);else{if(a.left.isRed()&&(a=a.rotateRight()),a.right.isEmpty()||a.right.isRed()||a.right.left.isRed()||(a=a.moveRedRight()),t(e,a.key)===0){if(a.right.isEmpty())return An.EMPTY;o=a.right.min(),a=a.copy(o.key,o.value,null,null,a.right.removeMin())}a=a.copy(null,null,null,null,a.right.remove(e,t))}return a.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,An.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,An.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw De(43730,{key:this.key,value:this.value});if(this.right.isRed())throw De(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw De(27949);return e+(this.isRed()?0:1)}}An.EMPTY=null,An.RED=!0,An.BLACK=!1;An.EMPTY=new class{constructor(){this.size=0}get key(){throw De(57766)}get value(){throw De(16141)}get color(){throw De(16727)}get left(){throw De(29726)}get right(){throw De(36894)}copy(e,t,o,a,d){return this}insert(e,t,o){return new An(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/**
20018 * @license
20019 * Copyright 2017 Google LLC
20020 *
20021 * Licensed under the Apache License, Version 2.0 (the "License");
20022 * you may not use this file except in compliance with the License.
20023 * You may obtain a copy of the License at
20024 *
20025 *   http://www.apache.org/licenses/LICENSE-2.0
20026 *
20027 * Unless required by applicable law or agreed to in writing, softw
20027are
20028 * distributed under the License is distributed on an "AS IS" BASIS,
20029 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20030 * See the License for the specific language governing permissions and
20031 * limitations under the License.
20032 */class nn{constructor(e){this.comparator=e,this.data=new Mt(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((t,o)=>(e(t),!1)))}forEachInRange(e,t){const o=this.data.getIteratorFrom(e[0]);for(;o.hasNext();){const a=o.getNext();if(this.comparator(a.key,e[1])>=0)return;t(a.key)}}forEachWhile(e,t){let o;for(o=t!==void 0?this.data.getIteratorFrom(t):this.data.getIterator();o.hasNext();)if(!e(o.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new V2(this.data.getIterator())}getIteratorFrom(e){return new V2(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach((o=>{t=t.add(o)})),t}isEqual(e){if(!(e instanceof nn)||this.size!==e.size)return!1;const t=this.data.getIterator(),o=e.data.getIterator();for(;t.hasNext();){const a=t.getNext().key,d=o.getNext().key;if(this.comparator(a,d)!==0)return!1}return!0}toArray(){const e=[];return this.forEach((t=>{e.push(t)})),e}toString(){const e=[];return this.forEach((t=>e.push(t))),"SortedSet("+e.toString()+")"}copy(e){const t=new nn(this.comparator);return t.data=e,t}}class V2{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
20033 * @license
20034 * Copyright 2020 Google LLC
20035 *
20036 * Licensed under the Apache License, Version 2.0 (the "License");
20037 * you may not use this file except in compliance with the License.
20038 * You may obtain a copy of the License at
20039 *
20040 *   http://www.apache.org/licenses/LICENSE-2.0
20041 *
20042 * Unless required by applicable law or agreed to in writing, software
20043 * distributed under the License is distributed on an "AS IS" BASIS,
20044 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20045 * See the License for the specific language governing permissions and
20046 * limitations under the License.
20047 */class co{constructor(e){this.fields=e,e.sort(an.comparator)}static empty(){return new co([])}unionWith(e){let t=new nn(an.comparator);for(const o of this.fields)t=t.add(o);for(const o of e)t=t.add(o);return new co(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return ml(this.fields,e.fields,((t,o)=>t.isEqual(o)))}}/**
20048 * @license
20049 * Copyright 2017 Google LLC
20050 *
20051 * Licensed under the Apache License, Version 2.0 (the "License");
20052 * you may not use this file except in compliance with the License.
20053 * You may obtain a copy of the License at
20054 *
20055 *   http://www.apache.org/licenses/LICENSE-2.0
20056 *
20057 * Unless required by applicable law or agreed to in writing, software
20058 * distributed under the License is distributed on an "AS IS" BASIS,
20059 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20060 * See the License for the specific language governing permissions and
20061 * limitations under the License.
20062 */function wu(r){let e=0;for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&e++;return e}function ga(r,e){for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&e(t,r[t])}function tA(r,e){const t=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&t.push(e(r[o],o,r));return t}function Ay(r){for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}/**
20063 * @license
20064 * Copyright 2023 Google LLC
20065 *
20066 * Licensed under the Apache License, Version 2.0 (the "License");
20067 * you may not use this file except in compliance with the License.
20068 * You may obtain a copy of the License at
20069 *
20070 *   http://www.apache.org/licenses/LICENSE-2.0
20071 *
20072 * Unless required by applicable law or agreed to in writing, softw
20072are
20073 * distributed under the License is distributed on an "AS IS" BASIS,
20074 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20075 * See the License for the specific language governing permissions and
20076 * limitations under the License.
20077 */class _y extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
20078 * @license
20079 * Copyright 2020 Google LLC
20080 *
20081 * Licensed under the Apache License, Version 2.0 (the "License");
20082 * you may not use this file except in compliance with the License.
20083 * You may obtain a copy of the License at
20084 *
20085 *   http://www.apache.org/licenses/LICENSE-2.0
20086 *
20087 * Unless required by applicable law or agreed to in writing, software
20088 * distributed under the License is distributed on an "AS IS" BASIS,
20089 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20090 * See the License for the specific language governing permissions and
20091 * limitations under the License.
20092 */class on{constructor(e){this.binaryString=e}static fromBase64String(e){const t=(function(a){try{return atob(a)}catch(d){throw typeof DOMException<"u"&&d instanceof DOMException?new _y("Invalid base64 string: "+d):d}})(e);return new on(t)}static fromUint8Array(e){const t=(function(a){let d="";for(let c=0;c<a.length;++c)d+=String.fromCharCode(a[c]);return d})(e);return new on(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return(function(t){return btoa(t)})(this.binaryString)}toUint8Array(){return(function(t){const o=new Uint8Array(t.length);for(let a=0;a<t.length;a++)o[a]=t.charCodeAt(a);return o})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return et(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}on.EMPTY_BYTE_STRING=new on("");const nA=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function sa(r){if(Ae(!!r,39018),typeof r=="string"){let e=0;const t=nA.exec(r);if(Ae(!!t,46558,{timestamp:r}),t[1]){let a=t[1];a=(a+"000000000").substr(0,9),e=Number(a)}const o=new Date(r);return{seconds:Math.floor(o.getTime()/1e3),nanos:e}}return{seconds:Ot(r.seconds),nanos:Ot(r.nanos)}}function Ot(r){return typeof r=="number"?r:typeof r=="string"?Number(r):0}function ra(r){return typeof r=="string"?on.fromBase64String(r):on.fromUint8Array(r)}/**
20093 * @license
20094 * Copyright 2020 Google LLC
20095 *
20096 * Licensed under the Apache License, Version 2.0 (the "License");
20097 * you may not use this file except in compliance with the License.
20098 * You may obtain a copy of the License at
20099 *
20100 *   http://www.apache.org/licenses/LICENSE-2.0
20101 *
20102 * Unless required by applicable law or agreed to in writing, software
20103 * distributed under the License is distributed on an "AS IS" BASIS,
20104 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20105 * See the License for the specific language governing permissions and
20106 * limitations under the License.
20107 */const wy="server_timestamp",Ey="__type__",Sy="__previous_value__",ky="__local_write_time__";function Yu(r){var t,o;return((o=(((t=r==null?void 0:r.mapValue)==null?void 0:t.fields)||{})[Ey])==null?void 0:o.stringValue)===wy}function yc(r){const e=r.mapValue.fields[Sy];return Yu(e)?yc(e):e}function pl(r){const e=sa(r.mapValue.fields[ky].timestampValue);return new Ct(e.seconds,e.nanos)}/**
20108 * @license
20109 * Copyright 2017 Google LLC
20110 *
20111 * Licensed under the Apache License, Version 2.0 (the "License");
20112 * you may not use this file except in compliance with the License.
20113 * You may obtain a copy of the License at
20114 *
20115 *   http://www.apache.org/licenses/LICENSE-2.0
20116 *
20117 * Unless required by applicable law or agreed to in writing, software
20118 * distributed under the License is distributed on an "AS IS" BASIS,
20119 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20120 * See the License for the specific language governing permissions and
20121 * limitations under the License.
20122 */class oA{constructor(e,t,o,a,d,c,g,h,v,_,E){this.databaseId=e,this.appId=t,this.persistenceKey=o,this.host=a,this.ssl=d,this.forceLongPolling=c,this.autoDetectLongPolling=g,this.longPollingOptions=h,this.useFetchStreams=v,this.isUsingEmulator=_,this.apiKey=E}}const Eu="(default)";class Zd{constructor(e,t){this.projectId=e,this.database=t||Eu}static empty(){return new Zd("","")}get isDefaultDatabase(){return this.database===Eu}isEqual(e){return e instanceof Zd&&e.projectId===this.projectId&&e.database===this.database}}function sA(r,e){if(!Object.prototype.hasOwnProperty.apply(r.options,["projectId"]))throw new pe(oe.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Zd(r.options.projectId,e)}/**
20123 * @license
20124 * Copyright 2020 Google LLC
20125 *
20126 * Licensed under the Apache License, Version 2.0 (the "License");
20127 * you may not use this file except in compliance with the License.
20128 * You may obtain a copy of the License at
20129 *
20130 *   http://www.apache.org/licenses/LICENSE-2.0
20131 *
20132 * Unless required by applicable law or agreed to in writing, software
20133 * distributed under the License is distributed on an "AS IS" BASIS,
20134 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20135 * See the License for the specific language governing permissions and
20136 * limitations under the License.
20137 */const Cy="__type__",rA="__max__",ru={mapValue:{}},Ry="__vector__",ec="value",gl={nullValue:"NULL_VALUE"},Kn={booleanValue:!0},pn={booleanValue:!1};function sn(r){return"nullValue"in r?0:"booleanValue"in r?1:"integerValue"in r||"doubleValue"in r?2:"timestampValue"in r?3:"stringValue"in r?5:"bytesValue"in r?6:"referenceValue"in r?7:"geoPointValue"in r?8:"arrayValue"in r?9:"mapValue"in r?Yu(r)?4:aA(r)?9007199254740991:Su(r)?10:11:De(28295,{value:r})}function Ro(r,e,t){if(r===e)return!0;const o=sn(r);if(o!==sn(e))return!1;switch(o){case 0:case 9007199254740991:return!0;case 1:return r.booleanValue===e.booleanValue;case 4:return pl(r).isEqual(pl(e));case 3:return(function(d,c){if(typeof d.timestampValue=="string"&&typeof c.timestampValue=="string"&&d.timestampValue.length===c.timestampValue.length)return d.timestampValue===c.timestampValue;const g=sa(d.timestampValue),h=sa(c.timestampValue);return g.seconds===h.seconds&&g.nanos===h.nanos})(r,e);case 5:return r.stringValue===e.stringValue;case 6:return(function(d,c){return ra(d.bytesValue).isEqual(ra(c.bytesValue))})(r,e);case 7:return r.referenceValue===e.referenceValue;case 8:return(function(d,c){return Ot(d.geoPointValue.latitude)===Ot(c.geoPointValue.latitude)&&Ot(d.geoPointValue.longitude)===Ot(c.geoPointValue.longitude)})(r,e);case 2:return(function(d,c,g){if("integerValue"in d&&"integerValue"in c)return Ot(d.integerValue)===Ot(c.integerValue);let h,v;if("doubleValue"in d&&"doubleValue"in c)h=Ot(d.doubleValue),v=Ot(c.doubleValue);else{if(!(g!=null&&g.Ee))return!1;h=Ot(d.integerValue??d.doubleValue),v=Ot(c.integerValue??c.doubleValue)}return h===v?!!(g!=null&&g.he)||Jd(h)===Jd(v):!!(g===void 0||g.Te)&&isNaN(h)&&isNaN(v)})(r,e,t);case 9:return ml(r.arrayValue.values||[],e.arrayValue.values||[],((a,d)=>Ro(a,d,t)));case 10:case 11:return(function(d,c,g){const h=d.mapValue.fields||{},v=c.mapValue.fields||{};if(wu(h)!==wu(v))return!1;for(const _ in h)if(h.hasOwnProperty(_)&&(v[_]===void 0||!Ro(h[_],v[_],g)))return!1;return!0})(r,e,t);default:return De(52216,{left:r})}}function tc(r,e){return(r.values||[]).find((t=>Ro(t,e)))!==void 0}function Qn(r,e){if(r===e)return 0;const t=sn(r),o=sn(e);if(t!==o)return et(t,o);switch(t){case 0:case 9007199254740991:return 0;case 1:return et(r.booleanValue,e.booleanValue);case 2:return(function(d,c){const g=Ot(d.integerValue||d.doubleValue),h=Ot(c.integerValue||c.doubleValue);return g<h?-1:g>h?1:g===h?0:isNaN(g)?isNaN(h)?0:-1:1})(r,e);case 3:return U2(r.timestampValue,e.timestampValue);case 4:return U2(pl(r),pl(e));case 5:return Hf(r.stringValue,e.stringValue);case 6:return(function(d,c){const g=ra(d),h=ra(c);return g.compareTo(h)})(r.bytesValue,e.bytesValue);case 7:return(function(d,c){const g=d.split("/"),h=c.split("/");for(let v=0;v<g.length&&v<h.length;v++){const _=et(g[v],h[v]);if(_!==0)return _}return et(g.length,h.length)})(r.referenceValue,e.referenceValue);case 8:return(function(d,c){const g=et(Ot(d.latitude),Ot(c.latitude));return g!==0?g:et(Ot(d.longitude),Ot(c.longitude))})(r.geoPointValue,e.geoPointValue);case 9:return B2(r.arrayValue,e.arrayValue);case 10:return(function(d,c){var M,G,B,ee;const g=d.fields||{},h=c.fields||{},v=(M=g[ec])==null?void 0:M.arrayValue,_=(G=h[ec])==null?void 0:G.arrayValue,E=et(((B=v==null?void 0:v.values)==null?void 0:B.length)||0,((ee=_==null?void 0:_.values)==null?void 0:ee.length)||0);return E!==0?E:B2(v,_)}
20137)(r.mapValue,e.mapValue);case 11:return(function(d,c){if(d===ru.mapValue&&c===ru.mapValue)return 0;if(d===ru.mapValue)return 1;if(c===ru.mapValue)return-1;const g=d.fields||{},h=Object.keys(g),v=c.fields||{},_=Object.keys(v);h.sort(),_.sort();for(let E=0;E<h.length&&E<_.length;++E){const M=Hf(h[E],_[E]);if(M!==0)return M;const G=Qn(g[h[E]],v[_[E]]);if(G!==0)return G}return et(h.length,_.length)})(r.mapValue,e.mapValue);default:throw De(23264,{Pe:t})}}function U2(r,e){if(typeof r=="string"&&typeof e=="string"&&r.length===e.length)return et(r,e);const t=sa(r),o=sa(e),a=et(t.seconds,o.seconds);return a!==0?a:et(t.nanos,o.nanos)}function B2(r,e){const t=r.values||[],o=e.values||[];for(let a=0;a<t.length&&a<o.length;++a){const d=Qn(t[a],o[a]);if(d!==void 0&&d!==0)return d}return et(t.length,o.length)}function fl(r){return Wf(r)}function Wf(r){return"nullValue"in r?"null":"booleanValue"in r?""+r.booleanValue:"integerValue"in r?""+r.integerValue:"doubleValue"in r?""+r.doubleValue:"timestampValue"in r?(function(t){const o=sa(t);return`time(${o.seconds},${o.nanos})`})(r.timestampValue):"stringValue"in r?r.stringValue:"bytesValue"in r?(function(t){return ra(t).toBase64()})(r.bytesValue):"referenceValue"in r?(function(t){return Ee.fromName(t).toString()})(r.referenceValue):"geoPointValue"in r?(function(t){return`geo(${t.latitude},${t.longitude})`})(r.geoPointValue):"arrayValue"in r?(function(t){let o="[",a=!0;for(const d of t.values||[])a?a=!1:o+=",",o+=Wf(d);return o+"]"})(r.arrayValue):"mapValue"in r?(function(t){const o=Object.keys(t.fields||{}).sort();let a="{",d=!0;for(const c of o)d?d=!1:a+=",",a+=`${c}:${Wf(t.fields[c])}`;return a+"}"})(r.mapValue):De(61005,{value:r})}function mu(r){switch(sn(r)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=yc(r);return e?16+mu(e):16;case 5:return 2*r.stringValue.length;case 6:return ra(r.bytesValue).approximateByteSize();case 7:return r.referenceValue.length;case 9:return(function(o){return(o.values||[]).reduce(((a,d)=>a+mu(d)),0)})(r.arrayValue);case 10:case 11:return(function(o){let a=0;return ga(o.fields,((d,c)=>{a+=d.length+mu(c)})),a})(r.mapValue);default:throw De(13486,{value:r})}}function G2(r,e){return{referenceValue:`projects/${r.projectId}/databases/${r.database}/documents/${e.path.canonicalString()}`}}function bs(r){return!!r&&"integerValue"in r}function Ya(r){return!!r&&"doubleValue"in r}function aa(r){return bs(r)||Ya(r)}function hl(r){return!!r&&"arrayValue"in r}function mo(r){return!!r&&"nullValue"in r}function Yn(r){return!!r&&"doubleValue"in r&&isNaN(Number(r.doubleValue))}function Ja(r){return!!r&&"mapValue"in r}function Su(r){var t,o;return((o=(((t=r==null?void 0:r.mapValue)==null?void 0:t.fields)||{})[Cy])==null?void 0:o.stringValue)===Ry}function Kf(r){var e,t;return(t=(((e=r==null?void 0:r.mapValue)==null?void 0:e.fields)||{})[ec])==null?void 0:t.arrayValue}function Gd(r){if(r.geoPointValue)return{geoPointValue:{...r.geoPointValue}};if(r.timestampValue&&typeof r.timestampValue=="object")return{timestampValue:{...r.timestampValue}};if(r.mapValue){const e={mapValue:{fields:{}}};return ga(r.mapValue.fields,((t,o)=>e.mapValue.fields[t]=Gd(o))),e}if(r.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(r.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=Gd(r.arrayValue.values[t]);return e}return{...r}}function aA(r){return(((r.mapValue||{}).fields||{}).__type__||{}).stringValue===rA}/**
20138 * @license
20139 * Copyright 2017 Google LLC
20140 *
20141 * Licensed under the Apache License, Version 2.0 (the "License");
20142 * you may not use this file except in compliance with the License.
20143 * You may obtain a copy of the License at
20144 *
20145 *   http://www.apache.org/licenses/LICENSE-2.0
20146 *
20147 * Unless required by applicable law or agreed to in writing, software
20148 * distributed under the License is distributed on an "AS IS" BASIS,
20149 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20150 * See the License for the specific language governing permissions and
20151 * limitations under the License.
20152 */class Ln{constructor(e){this.value=e}static empty(){return new Ln({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let o=0;o<e.length-1;++o)if(t=(t.mapValue.fields||{})[e.get(o)],!Ja(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Gd(t)}setAll(e){let t=an.emptyPath(),o={},a=[];e.forEach(((c,g)=>{if(!t.isImmediateParentOf(g)){const h=this.getFieldsMap(t);this.applyChanges(h,o,a),o={},a=[],t=g.popLast()}c?o[g.lastSegment()]=Gd(c):a.push(g.lastSegment())}
vendor: 4,132 bytes, lines 20152-20192
20152));const d=this.getFieldsMap(t);this.applyChanges(d,o,a)}delete(e){const t=this.field(e.popLast());Ja(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Ro(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let o=0;o<e.length;++o){let a=t.mapValue.fields[e.get(o)];Ja(a)&&a.mapValue.fields||(a={mapValue:{fields:{}}},t.mapValue.fields[e.get(o)]=a),t=a}return t.mapValue.fields}applyChanges(e,t,o){ga(t,((a,d)=>e[a]=d));for(const a of o)delete e[a]}clone(){return new Ln(Gd(this.value))}}function Dy(r){const e=[];return ga(r.fields,((t,o)=>{const a=new an([t]);if(Ja(o)){const d=Dy(o.mapValue).fields;if(d.length===0)e.push(a);else for(const c of d)e.push(a.child(c))}else e.push(a)})),new co(e)}/**
20153 * @license
20154 * Copyright 2020 Google LLC
20155 *
20156 * Licensed under the Apache License, Version 2.0 (the "License");
20157 * you may not use this file except in compliance with the License.
20158 * You may obtain a copy of the License at
20159 *
20160 *   http://www.apache.org/licenses/LICENSE-2.0
20161 *
20162 * Unless required by applicable law or agreed to in writing, software
20163 * distributed under the License is distributed on an "AS IS" BASIS,
20164 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20165 * See the License for the specific language governing permissions and
20166 * limitations under the License.
20167 */function $u(r,e){if(r.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Jd(e)?"-0":e}}function yh(r){return{integerValue:""+r}}function Ju(r,e,t){return Number.isInteger(e)&&(t!=null&&t.preferIntegers)||$9(e)?yh(e):$u(r,e)}/**
20168 * @license
20169 * Copyright 2018 Google LLC
20170 *
20171 * Licensed under the Apache License, Version 2.0 (the "License");
20172 * you may not use this file except in compliance with the License.
20173 * You may obtain a copy of the License at
20174 *
20175 *   http://www.apache.org/licenses/LICENSE-2.0
20176 *
20177 * Unless required by applicable law or agreed to in writing, software
20178 * distributed under the License is distributed on an "AS IS" BASIS,
20179 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20180 * See the License for the specific language governing permissions and
20181 * limitations under the License.
20182 */class Zu{constructor(){this._=void 0}}function iA(r,e,t){return r instanceof nc?(function(a,d){const c={fields:{[Ey]:{stringValue:wy},[ky]:{timestampValue:{seconds:a.seconds,nanos:a.nanoseconds}}}};return d&&Yu(d)&&(d=yc(d)),d&&(c.fields[Sy]=d),{mapValue:c}})(t,e):r instanceof oc?Ty(r,e):r instanceof sc?Iy(r,e):r instanceof vl?(function(a,d){const c=My(a,d),g=Ru(c)+Ru(a.Re);return bs(c)&&bs(a.Re)?yh(g):$u(a.serializer,g)})(r,e):r instanceof ku?(function(a,d){return q2(a,d,Math.min)})(r,e):r instanceof Cu?(function(a,d){return q2(a,d,Math.max)})(r,e):void 0}function lA(r,e,t){return r instanceof oc?Ty(r,e):r instanceof sc?Iy(r,e):t}function My(r,e){return r instanceof vl?aa(e)?e:{integerValue:0}:null}class nc extends Zu{}class oc extends Zu{constructor(e){super(),this.elements=e}}function Ty(r,e){const t=Oy(e);for(const o of r.elements)t.some((a=>Ro(a,o)))||t.push(o);return{arrayValue:{values:t}}}class sc extends Zu{constructor(e){super(),this.elements=e}}function Iy(r,e){let t=Oy(e);for(const o of r.elements)t=t.filter((a=>!Ro(a,o)));return{arrayValue:{values:t}}}class xh extends Zu{constructor(e,t){super(),this.serializer=e,this.Re=t}}class vl extends xh{}class ku extends xh{}class Cu extends xh{}function q2(r,e,t){if(!aa(e))return r.Re;const o=t(Ru(e),Ru(r.Re));return bs(e)&&bs(r.Re)?yh(o):$u(r.serializer,o)}function Ru(r){return Ot(r.integerValue||r.doubleValue)}function Oy(r){return hl(r)&&r.arrayValue.values?r.arrayValue.values.slice():[]}/**
20183 * @license
20184 * Copyright 2017 Google LLC
20185 *
20186 * Licensed under the Apache License, Version 2.0 (the "License");
20187 * you may not use this file except in compliance with the License.
20188 * You may obtain a copy of the License at
20189 *
20190 *   http://www.apache.org/licenses/LICENSE-2.0
20191 *
20192 * Unless required by applicable law or agreed to in writing, softw
20192are
20193 * distributed under the License is distributed on an "AS IS" BASIS,
20194 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20195 * See the License for the specific language governing permissions and
20196 * limitations under the License.
20197 */class Py{constructor(e,t){this.field=e,this.transform=t}}function dA(r,e){return r.field.isEqual(e.field)&&(function(o,a){return o instanceof oc&&a instanceof oc||o instanceof sc&&a instanceof sc?ml(o.elements,a.elements,Ro):o instanceof vl&&a instanceof vl||o instanceof ku&&a instanceof ku||o instanceof Cu&&a instanceof Cu?Ro(o.Re,a.Re):o instanceof nc&&a instanceof nc})(r.transform,e.transform)}class cA{constructor(e,t){this.version=e,this.transformResults=t}}class Co{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Co}static exists(e){return new Co(void 0,e)}static updateTime(e){return new Co(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function uu(r,e){return r.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(r.updateTime):r.exists===void 0||r.exists===e.isFoundDocument()}class ep{}function zy(r,e){if(!r.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return r.isNoDocument()?new Ah(r.key,Co.none()):new xc(r.key,r.data,Co.none());{const t=r.data,o=Ln.empty();let a=new nn(an.comparator);for(let d of e.fields)if(!a.has(d)){let c=t.field(d);c===null&&d.length>1&&(d=d.popLast(),c=t.field(d)),c===null?o.delete(d):o.set(d,c),a=a.add(d)}return new fa(r.key,o,new co(a.toArray()),Co.none())}}function mA(r,e,t){r instanceof xc?(function(a,d,c){const g=a.value.clone(),h=j2(a.fieldTransforms,d,c.transformResults);g.setAll(h),d.convertToFoundDocument(c.version,g).setHasCommittedMutations()})(r,e,t):r instanceof fa?(function(a,d,c){if(!uu(a.precondition,d))return void d.convertToUnknownDocument(c.version);const g=j2(a.fieldTransforms,d,c.transformResults),h=d.data;h.setAll(Ly(a)),h.setAll(g),d.convertToFoundDocument(c.version,h).setHasCommittedMutations()})(r,e,t):(function(a,d,c){d.convertToNoDocument(c.version).setHasCommittedMutations()})(0,e,t)}function qd(r,e,t,o){return r instanceof xc?(function(d,c,g,h){if(!uu(d.precondition,c))return g;const v=d.value.clone(),_=X2(d.fieldTransforms,h,c);return v.setAll(_),c.convertToFoundDocument(c.version,v).setHasLocalMutations(),null})(r,e,t,o):r instanceof fa?(function(d,c,g,h){if(!uu(d.precondition,c))return g;const v=X2(d.fieldTransforms,h,c),_=c.data;return _.setAll(Ly(d)),_.setAll(v),c.convertToFoundDocument(c.version,_).setHasLocalMutations(),g===null?null:g.unionWith(d.fieldMask.fields).unionWith(d.fieldTransforms.map((E=>E.field)))})(r,e,t,o):(function(d,c,g){return uu(d.precondition,c)?(c.convertToNoDocument(c.version).setHasLocalMutations(),null):g})(r,e,t)}function uA(r,e){let t=null;for(const o of r.fieldTransforms){const a=e.data.field(o.field),d=My(o.transform,a||null);d!=null&&(t===null&&(t=Ln.empty()),t.set(o.field,d))}return t||null}function F2(r,e){return r.type===e.type&&!!r.key.isEqual(e.key)&&!!r.precondition.isEqual(e.precondition)&&!!(function(o,a){return o===void 0&&a===void 0||!(!o||!a)&&ml(o,a,((d,c)=>dA(d,c)))})(r.fieldTransforms,e.fieldTransforms)&&(r.type===0?r.value.isEqual(e.value):r.type!==1||r.data.isEqual(e.data)&&r.fieldMask.isEqual(e.fieldMask))}class xc extends ep{constructor(e,t,o,a=[]){super(),this.key=e,this.value=t,this.precondition=o,this.fieldTransforms=a,this.type=0}getFieldMask(){return null}}class fa extends ep{constructor(e,t,o,a,d=[]){super(),this.key=e,this.data=t,this.fieldMask=o,this.precondition=a,this.fieldTransforms=d,this.type=1}getFieldMask(){return this.fieldMask}}function Ly(r){const e=new Map;return r.fieldMask.fields.forEach((t=>{if(!t.isEmpty()){const o=r.data.field(t);e.set(t,o)}})),e}function j2(r,e,t){const o=new Map;Ae(r.length===t.length,32656,{Ie:t.length,Ae:r.length});for(let a=0;a<t.length;a++){const d=r[a],c=d.transform,g=e.data.field(d.field);o.set(d.field,lA(c,g,t[a]))}return o}function X2(r,e,t){const o=new Map;for(const a of r){const d=a.transform,c=t.data.field(a.field);o.set(a.field,iA(d,c,e))}return o}class Ah extends ep{constructor(e,t){super(),this.key=e,this.prec
20197ondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class pA extends ep{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
20198 * @license
20199 * Copyright 2022 Google LLC
20200 *
20201 * Licensed under the Apache License, Version 2.0 (the "License");
20202 * you may not use this file except in compliance with the License.
20203 * You may obtain a copy of the License at
20204 *
20205 *   http://www.apache.org/licenses/LICENSE-2.0
20206 *
20207 * Unless required by applicable law or agreed to in writing, software
20208 * distributed under the License is distributed on an "AS IS" BASIS,
20209 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20210 * See the License for the specific language governing permissions and
20211 * limitations under the License.
20212 */class Du{constructor(e,t){this.position=e,this.inclusive=t}}function H2(r,e,t){let o=0;for(let a=0;a<r.position.length;a++){const d=e[a],c=r.position[a];if(d.field.isKeyField()?o=Ee.comparator(Ee.fromName(c.referenceValue),t.key):o=Qn(c,t.data.field(d.field)),d.dir==="desc"&&(o*=-1),o!==0)break}return o}function W2(r,e){if(r===null)return e===null;if(e===null||r.inclusive!==e.inclusive||r.position.length!==e.position.length)return!1;for(let t=0;t<r.position.length;t++)if(!Ro(r.position[t],e.position[t]))return!1;return!0}/**
20213 * @license
20214 * Copyright 2022 Google LLC
20215 *
20216 * Licensed under the Apache License, Version 2.0 (the "License");
20217 * you may not use this file except in compliance with the License.
20218 * You may obtain a copy of the License at
20219 *
20220 *   http://www.apache.org/licenses/LICENSE-2.0
20221 *
20222 * Unless required by applicable law or agreed to in writing, software
20223 * distributed under the License is distributed on an "AS IS" BASIS,
20224 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20225 * See the License for the specific language governing permissions and
20226 * limitations under the License.
20227 */class Ny{}class en extends Ny{constructor(e,t,o){super(),this.field=e,this.op=t,this.value=o}static create(e,t,o){return e.isKeyField()?t==="in"||t==="not-in"?this.createKeyFieldInFilter(e,t,o):new fA(e,t,o):t==="array-contains"?new bA(e,o):t==="in"?new yA(e,o):t==="not-in"?new xA(e,o):t==="array-contains-any"?new AA(e,o):new en(e,t,o)}static createKeyFieldInFilter(e,t,o){return t==="in"?new hA(e,o):new vA(e,o)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&t.nullValue===void 0&&this.matchesComparison(Qn(t,this.value)):t!==null&&sn(this.value)===sn(t)&&this.matchesComparison(Qn(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return De(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Xo extends Ny{constructor(e,t){super(),this.filters=e,this.op=t,this.Ve=null}static create(e,t){return new Xo(e,t)}matches(e){return Vy(this)?this.filters.find((t=>!t.matches(e)))===void 0:this.filters.find((t=>t.matches(e)))!==void 0}getFlattenedFilters(){return this.Ve!==null||(this.Ve=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.Ve}getFilters(){return Object.assign([],this.filters)}}function Vy(r){return r.op==="and"}function Uy(r){return gA(r)&&Vy(r)}function gA(r){for(const e of r.filters)if(e instanceof Xo)return!1;return!0}function Qf(r){if(r instanceof en)return r.field.canonicalString()+r.op.toString()+fl(r.value);if(Uy(r))return r.filters.map((e=>Qf(e))).join(",");{const e=r.filters.map((t=>Qf(t))).join(",");return`${r.op}(${e})`}}function By(r,e){return r instanceof en?(function(o,a){return a instanceof en&&o.op===a.op&&o.field.isEqual(a.field)&&Ro(o.value,a.value)})(r,e):r instanceof Xo?(function(o,a){return a instanceof Xo&&o.op===a.op&&o.filters.length===a.filters.length?o.filters.reduce(((d,c,g)=>d&&By(c,a.filters[g])),!0):!1})(r,e):void De(19439)}function Gy(r){return r instanceof en?(function(t){return`${t.field.canonicalString()} ${t.op} ${fl(t.value)}`})(r):r instanceof Xo?(function(t){return t.op.toString()+" {"+t.getFilters().map(Gy).join(" ,")+"}"})(r):"Filter"}class fA extends en{constructor(e,t,o){super(e,t,o),this.key=Ee.fromName(o.referenceValue)}matches(e){const t=Ee.comparator(e.key,this.key);return this.matchesComparison(t)}}class hA extends en{constructor(e,t){super(e,"in",t),this.keys=qy("in",t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}}class vA extends en{constructor(e,t){super(e,"not-in",t),this.keys=qy("not-in",t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}}function qy(r,e){var t;return(((t=e.arrayValue)==null?void 0:t.values)||[]).map((o=>Ee.fromName(o.referenceValue)))}class bA extends en{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return hl(t)&&tc(t.arrayValue,this.value)}}class yA extends en{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&tc(this.value.arrayValue,t)}}class xA extends en{constructor(e,t){super(e,"not-in",t)}matches(e){if(tc(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&t.nullValue===void 0&&!tc(this.value.arrayValue,t)}}class AA extends en{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!hl(t)||!t.arrayValue.values)&&t.arrayValue.values.some((o=>tc(this.value.arrayValue,o)))}}/**
20228 * @license
20229 * Copyright 2022 Google LLC
20230 *
20231 * Licensed under the Apache License, Version 2.0 (the "License");
20232 * you may not use this file except in compliance with the License.
20233 * You may obtain a copy of the License at
20234 *
20235 *   http://www.apache.org/licenses/LICENSE-2.0
20236 *
20237 * Unless required by applicable law or agreed to in writing, software
20238 * distributed under the License is distributed on an "AS IS" BASIS,
20239 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20240 * See the License for the specific language governing permissions and
20241 * limitations under the License.
20242 */class rc{constructor(e,t="asc"){this.field=e,this.dir=t}}function _A(r,e){return r.dir===e.dir&&r.field.isEqual(e.field)}/**
20243 * @license
20244 * Copyright 2017 Google LLC
20245 *
20246 * Licensed under the Apache License, Version 2.0 (the "License");
20247 * you may not use this file except in compliance with the License.
20248 * You may obtain a copy of the License at
20249 *
20250 *   http://www.apache.org/licenses/LICENSE-2.0
20251 *
20252 * Unless required by applicable law or agreed to in writing, software
20253 * distributed under the License is distributed on an "AS IS" BASIS,
20254 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20255 * See the License for the specific language governing permissions and
20256 * limitations under the License.
20257 */class Dn{constructor(e,t,o,a,d,c,g){this.key=e,this.documentType=t,this.version=o,this.readTime=a,this.createTime=d,this.data=c,this.documentState=g}static newInvalidDocument(e){return new Dn(e,0,Ne.min(),Ne.min(),Ne.min(),Ln.empty(),0)}static newFoundDocument(e,t,o,a){return new Dn(e,1,t,Ne.min(),o,a,0)}static newNoDocument(e,t){return new Dn(e,2,t,Ne.min(),Ne.min(),Ln.empty(),0)}static newUnknownDocument(e,t){return new Dn(e,3,t,Ne.min(),Ne.min(),Ln.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(Ne.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Ln.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Ln.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Ne.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof Dn&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new Dn(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/**
20258 * @license
20259 * Copyright 2019 Google LLC
20260 *
20261 * Licensed under the Apache License, Version 2.0 (the "License");
20262 * you may not use this file except in compliance with the License.
20263 * You may obtain a copy of the License at
20264 *
20265 *   http://www.apache.org/licenses/LICENSE-2.0
20266 *
20267 * Unless required by applicable law or agreed to in writing, software
20268 * distributed under the License is distributed on an "AS IS" BASIS,
20269 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20270 * See the License for the specific language governing permissions and
20271 * limitations under the License.
20272 */class wA{constructor(e,t=null,o=[],a=[],d=null,c=null,g=null){this.path=e,this.collectionGroup=t,this.orderBy=o,this.filters=a,this.limit=d,this.startAt=c,this.endAt=g,this.de=null}}function K2(r,e=null,t=[],o=[],a=null,d=null,c=null){return new wA(r,e,t,o,a,d,c)}function Fy(r){const e=Ge(r);if(e.de===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((o=>Qf(o))).join(","),t+="|ob:",t+=e.orderBy.map((o=>(function(d){return d.field.canonicalString()+d.dir})(o))).join(","),Qu(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((o=>fl(o))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((o=>fl(o))).join(",")),e.de=t}return e.de}function jy(r,e){if(r.limit!==e.limit||r.orderBy.length!==e.orderBy.length)return!1;for(let t=0;t<r.orderBy.length;t++)if(!_A(r.orderBy[t],e.orderBy[t]))return!1;if(r.filters.length!==e.filters.length)return!1;for(let t=0;t<r.filters.length;t++)if(!By(r.filters[t],e.filters[t]))return!1;return r.collectionGroup===e.collectionGroup&&!!r.path.isEqual(e.path)&&!!W2(r.startAt,e.startAt)&&W2(r.endAt,e.endAt)}function Qa(r){return!!r.isCorePipeline}function Xy(r){return!!r.path&&Ee.isDocumentKey(r.path)&&r.collectionGroup===null&&r.filters.length===0}/**
20273 * @license
20274 * Copyright 2017 Google LLC
20275 *
20276 * Licensed under the Apache License, Version 2.0 (the "License");
20277 * you may not use this file except in compliance with the License.
20278 * You may obtain a copy of the License at
20279 *
20280 *   http://www.apache.org/licenses/LICENSE-2.0
20281 *
20282 * Unless required by applicable law or agreed to in writing, software
20283 * distributed under the License is distributed on an "AS IS" BASIS,
20284 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20285 * See the License for the specific language governing permissions and
20286 * limitations under the License.
20287 */class El{constructor(e,t=null,o=[],a=[],d=null,c="F",g=null,h=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=o,this.filters=a,this.limit=d,this.limitType=c,this.startAt=g,this.endAt=h,this.fe=null,this.me=null,this.pe=null,this.startAt,this.endAt}}function EA(r,e,t,o,a,d,c,g){return new El(r,e,t,o,a,d,c,g)}function _h(r){return new El(r)}function Q2(r){return r.filters.length===0&&r.limit===null&&r.startAt==null&&r.endAt==null&&(r.explicitOrderBy.length===0||r.explicitOrderBy.length===1&&r.explicitOrderBy[0].field.isKeyField())}function SA(r){return Ee.isDocumentKey(r.path)&&r.collectionGroup===null&&r.filters.length===0}function Hy(r){return r.collectionGroup!==null}function Fd(r){const e=Ge(r);if(e.fe===null){e.fe=[];const t=new Set;for(const d of e.explicitOrderBy)e.fe.push(d),t.add(d.field.canonicalString());const o=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(c){let g=new nn(an.comparator);return c.filters.forEach((h=>{h.getFlattenedFilters().forEach((v=>{v.isInequality()&&(g=g.add(v.field))}))})),g})(e).forEach((d=>{t.has(d.canonicalString())||d.isKeyField()||e.fe.push(new rc(d,o))})),t.has(an.keyField().canonicalString())||e.fe.push(new rc(an.keyField(),o))}return e.fe}function xs(r){const e=Ge(r);return e.me||(e.me=kA(e,Fd(r))),e.me}function kA(r,e){if(r.limitType==="F")return K2(r.path,r.collectionGroup,e,r.filters,r.limit,r.startAt,r.endAt);{e=e.map((a=>{const d=a.dir==="desc"?"asc":"desc";return new rc(a.field,d)}));const t=r.endAt?new Du(r.endAt.position,r.endAt.inclusive):null,o=r.startAt?new Du(r.startAt.position,r.startAt.inclusive):null;return K2(r.path,r.collectionGroup,e,r.filters,r.limit,t,o)}}function Yf(r,e){const t=r.filters.concat([e]);return new El(r.path,r.collectionGroup,r.explicitOrderBy.slice(),t,r.limit,r.limitType,r.startAt,r.endAt)}function CA(r,e){const t=r.explicitOrderBy.concat([e]);return new El(r.path,r.collectionGroup,t,r.filters.slice(),r.limit,r.limitType,r.startAt,r.endAt)}function Mu(r,e,t){return new El(r.path,r.collectionGroup,r.explicitOrderBy.slice(),r.filters.slice(),e,t,r.startAt,r.endAt)}function RA(r,e){return jy(xs(r),xs(e))&&r.limitType===e.limitType}function jd(r){return`Query(target=${(function(t){let o=t.path.canonicalString();return t.collectionGroup!==null&&(o+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(o+=`, filters: [${t.filters.map((a=>Gy(a))).join(", ")}]`),Qu(t.limit)||(o+=", limit: "+t.limit),t.orderBy.length>0&&(o+=`, orderBy: [${t.orderBy.map((a=>(function(c){return`${c.field.canonicalString()} (${c.dir})`})(a))).join(", ")}]`),t.startAt&&(o+=", startAt: ",o+=t.startAt.inclusive?"b:":"a:",o+=t.startAt.position.map((a=>fl(a))).join(",")),t.endAt&&(o+=", endAt: ",o+=t.endAt.inclusive?"a:":"b:",o+=t.endAt.position.map((a=>fl(a))).join(",")),`Target(${o})`})(xs(r))}; limitType=${r.limitType})`}function tp(r,e){return e.isFoundDocument()&&(function(o,a){const d=a.key.path;return o.collectionGroup!==null?a.key.hasCollectionId(o.collectionGroup)&&o.path.isPrefixOf(d):Ee.isDocumentKey(o.path)?o.path.isEqual(d):o.path.isImmediateParentOf(d)})(r,e)&&(function(o,a){for(const d of Fd(o))if(!d.field.isKeyField()&&a.data.field(d.field)===null)return!1;return!0})(r,e)&&(function(o,a){for(const d of o.filters)if(!d.matches(a))return!1;return!0})(r,e)&&(function(o,a){return!(o.startAt&&!(function(c,g,h){const v=H2(c,g,h);return c.inclusive?v<=0:v<0})(o.startAt,Fd(o),a)||o.endAt&&!(function(c,g,h){const v=H2(c,g,h);return c.inclusive?v>=0:v>0})(o.endAt,Fd(o),a))})(r,e)}function wh(r){return(e,t)=>{let o=!1;for(const a of Fd(r)){const d=DA(a,e,t);if(d!==0)return d;o=o||a.field.isKeyField()}return 0}}function DA(r,e,t){const o=r.field.isKeyField()?Ee.comparator(e.key,t.key):(function(d,c,g){const h=c.data.field(d),v=g.data.field(d);return h!==null&&v!==null?Qn(h,v):De(42886)})(r.field,e,t);switch(r.dir){case"asc":return o;
vendor: 4,833 bytes, lines 20287-20336
20287case"desc":return-1*o;default:return De(19790,{direction:r.dir})}}/**
20288 * @license
20289 * Copyright 2017 Google LLC
20290 *
20291 * Licensed under the Apache License, Version 2.0 (the "License");
20292 * you may not use this file except in compliance with the License.
20293 * You may obtain a copy of the License at
20294 *
20295 *   http://www.apache.org/licenses/LICENSE-2.0
20296 *
20297 * Unless required by applicable law or agreed to in writing, software
20298 * distributed under the License is distributed on an "AS IS" BASIS,
20299 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20300 * See the License for the specific language governing permissions and
20301 * limitations under the License.
20302 */class MA{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
20303 * @license
20304 * Copyright 2017 Google LLC
20305 *
20306 * Licensed under the Apache License, Version 2.0 (the "License");
20307 * you may not use this file except in compliance with the License.
20308 * You may obtain a copy of the License at
20309 *
20310 *   http://www.apache.org/licenses/LICENSE-2.0
20311 *
20312 * Unless required by applicable law or agreed to in writing, software
20313 * distributed under the License is distributed on an "AS IS" BASIS,
20314 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20315 * See the License for the specific language governing permissions and
20316 * limitations under the License.
20317 */var Zt,at;function TA(r){switch(r){case oe.OK:return De(64938);case oe.CANCELLED:case oe.UNKNOWN:case oe.DEADLINE_EXCEEDED:case oe.RESOURCE_EXHAUSTED:case oe.INTERNAL:case oe.UNAVAILABLE:case oe.UNAUTHENTICATED:return!1;case oe.INVALID_ARGUMENT:case oe.NOT_FOUND:case oe.ALREADY_EXISTS:case oe.PERMISSION_DENIED:case oe.FAILED_PRECONDITION:case oe.ABORTED:case oe.OUT_OF_RANGE:case oe.UNIMPLEMENTED:case oe.DATA_LOSS:return!0;default:return De(15467,{code:r})}}function Wy(r){if(r===void 0)return nr("GRPC error has no .code"),oe.UNKNOWN;switch(r){case Zt.OK:return oe.OK;case Zt.CANCELLED:return oe.CANCELLED;case Zt.UNKNOWN:return oe.UNKNOWN;case Zt.DEADLINE_EXCEEDED:return oe.DEADLINE_EXCEEDED;case Zt.RESOURCE_EXHAUSTED:return oe.RESOURCE_EXHAUSTED;case Zt.INTERNAL:return oe.INTERNAL;case Zt.UNAVAILABLE:return oe.UNAVAILABLE;case Zt.UNAUTHENTICATED:return oe.UNAUTHENTICATED;case Zt.INVALID_ARGUMENT:return oe.INVALID_ARGUMENT;case Zt.NOT_FOUND:return oe.NOT_FOUND;case Zt.ALREADY_EXISTS:return oe.ALREADY_EXISTS;case Zt.PERMISSION_DENIED:return oe.PERMISSION_DENIED;case Zt.FAILED_PRECONDITION:return oe.FAILED_PRECONDITION;case Zt.ABORTED:return oe.ABORTED;case Zt.OUT_OF_RANGE:return oe.OUT_OF_RANGE;case Zt.UNIMPLEMENTED:return oe.UNIMPLEMENTED;case Zt.DATA_LOSS:return oe.DATA_LOSS;default:return De(39323,{code:r})}}(at=Zt||(Zt={}))[at.OK=0]="OK",at[at.CANCELLED=1]="CANCELLED",at[at.UNKNOWN=2]="UNKNOWN",at[at.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",at[at.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",at[at.NOT_FOUND=5]="NOT_FOUND",at[at.ALREADY_EXISTS=6]="ALREADY_EXISTS",at[at.PERMISSION_DENIED=7]="PERMISSION_DENIED",at[at.UNAUTHENTICATED=16]="UNAUTHENTICATED",at[at.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",at[at.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",at[at.ABORTED=10]="ABORTED",at[at.OUT_OF_RANGE=11]="OUT_OF_RANGE",at[at.UNIMPLEMENTED=12]="UNIMPLEMENTED",at[at.INTERNAL=13]="INTERNAL",at[at.UNAVAILABLE=14]="UNAVAILABLE",at[at.DATA_LOSS=15]="DATA_LOSS";/**
20318 * @license
20319 * Copyright 2017 Google LLC
20320 *
20321 * Licensed under the Apache License, Version 2.0 (the "License");
20322 * you may not use this file except in compliance with the License.
20323 * You may obtain a copy of the License at
20324 *
20325 *   http://www.apache.org/licenses/LICENSE-2.0
20326 *
20327 * Unless required by applicable law or agreed to in writing, software
20328 * distributed under the License is distributed on an "AS IS" BASIS,
20329 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20330 * See the License for the specific language governing permissions and
20331 * limitations under the License.
20332 */class ii{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),o=this.inner[t];if(o!==void 0){for(const[a,d]of o)if(this.equalsFn(a,e))return d}}has(e){return this.get(e)!==void 0}set(e,t){const o=this.mapKeyFn(e),a=this.inner[o];if(a===void 0)return this.inner[o]=[[e,t]],void this.innerSize++;for(let d=0;d<a.length;d++)if(this.equalsFn(a[d][0],e))return void(a[d]=[e,t]);a.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),o=this.inner[t];if(o===void 0)return!1;for(let a=0;a<o.length;a++)if(this.equalsFn(o[a][0],e))return o.length===1?delete this.inner[t]:o.splice(a,1),this.innerSize--,!0;return!1}forEach(e){ga(this.inner,((t,o)=>{for(const[a,d]of o)e(a,d)}))}isEmpty(){return Ay(this.inner)}size(){return this.innerSize}}/**
20333 * @license
20334 * Copyright 2017 Google LLC
20335 *
20336 * Licensed under the Apache License, Version 2.0 (the "License");
20337 * you may not use this file except in compliance with the License.
20338 * You may obtain a copy of the License at
20339 *
20340 *   http://www.apache.org/licenses/LICENSE-2.0
20341 *
20342 * Unless required by applicable law or agreed to in writing, software
20343 * distributed under the License is distributed on an "AS IS" BASIS,
20344 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20345 * See the License for the specific language governing permissions and
20346 * limitations under the License.
20347 */const IA=new Mt(Ee.comparator);function Hn(){return IA}const Ky=new Mt(Ee.comparator);function Zi(...r){let e=Ky;for(const t of r)e=e.insert(t.key,t);return e}function Qy(r){let e=Ky;return r.forEach(((t,o)=>e=e.insert(t,o.overlayedDocument))),e}function jr(){return Xd()}function Yy(){return Xd()}function Xd(){return new ii((r=>r.toString()),((r,e)=>r.isEqual(e)))}const OA=new Mt(Ee.comparator),PA=new nn(Ee.comparator);function Qe(...r){let e=PA;for(const t of r)e=e.add(t);return e}const zA=new nn(et);function LA(){return zA}/**
20348 * @license
20349 * Copyright 2023 Google LLC
20350 *
20351 * Licensed under the Apache License, Version 2.0 (the "License");
20352 * you may not use this file except in compliance with the License.
20353 * You may obtain a copy of the License at
20354 *
20355 *   http://www.apache.org/licenses/LICENSE-2.0
20356 *
20357 * Unless required by applicable law or agreed to in writing, software
20358 * distributed under the License is distributed on an "AS IS" BASIS,
20359 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20360 * See the License for the specific language governing permissions and
20361 * limitations under the License.
20362 */function NA(){return new TextEncoder}/**
20363 * @license
20364 * Copyright 2022 Google LLC
20365 *
20366 * Licensed under the Apache License, Version 2.0 (the "License");
20367 * you may not use this file except in compliance with the License.
20368 * You may obtain a copy of the License at
20369 *
20370 *   http://www.apache.org/licenses/LICENSE-2.0
20371 *
20372 * Unless required by applicable law or agreed to in writing, software
20373 * distributed under the License is distributed on an "AS IS" BASIS,
20374 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20375 * See the License for the specific language governing permissions and
20376 * limitations under the License.
20377 */const VA=new $r([4294967295,4294967295],0);function Y2(r){const e=NA().encode(r),t=new cy;return t.update(e),new Uint8Array(t.digest())}function $2(r){const e=new DataView(r.buffer),t=e.getUint32(0,!0),o=e.getUint32(4,!0),a=e.getUint32(8,!0),d=e.getUint32(12,!0);return[new $r([t,o],0),new $r([a,d],0)]}class Eh{constructor(e,t,o){if(this.bitmap=e,this.padding=t,this.hashCount=o,t<0||t>=8)throw new Ld(`Invalid padding: ${t}`);if(o<0)throw new Ld(`Invalid hash count: ${o}`);if(e.length>0&&this.hashCount===0)throw new Ld(`Invalid hash count: ${o}`);if(e.length===0&&t!==0)throw new Ld(`Invalid padding when bitmap length is 0: ${t}`);this.ge=8*e.length-t,this.ye=$r.fromNumber(this.ge)}we(e,t,o){let a=e.add(t.multiply($r.fromNumber(o)));return a.compare(VA)===1&&(a=new $r([a.getBits(0),a.getBits(1)],0)),a.modulo(this.ye).toNumber()}be(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.ge===0)return!1;const t=Y2(e),[o,a]=$2(t);for(let d=0;d<this.hashCount;d++){const c=this.we(o,a,d);if(!this.be(c))return!1}return!0}static create(e,t,o){const a=e%8==0?0:8-e%8,d=new Uint8Array(Math.ceil(e/8)),c=new Eh(d,a,t);return o.forEach((g=>c.insert(g))),c}insert(e){if(this.ge===0)return;const t=Y2(e),[o,a]=$2(t);for(let d=0;d<this.hashCount;d++){const c=this.we(o,a,d);this.ve(c)}}ve(e){const t=Math.floor(e/8),o=e%8;this.bitmap[t]|=1<<o}}class Ld extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
20378 * @license
20379 * Copyright 2017 Google LLC
20380 *
20381 * Licensed under the Apache License, Version 2.0 (the "License");
20382 * you may not use this file except in compliance with the License.
20383 * You may obtain a copy of the License at
20384 *
20385 *   http://www.apache.org/licenses/LICENSE-2.0
20386 *
20387 * Unless required by applicable law or agreed to in writing, software
20388 * distributed under the License is distributed on an "AS IS" BASIS,
20389 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20390 * See the License for the specific language governing permissions and
20391 * limitations under the License.
20392 */class Ac{constructor(e,t,o,a,d,c){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=o,this.documentUpdates=a,this.augmentedDocumentUpdates=d,this.resolvedLimboDocuments=c}static createSynthesizedRemoteEventForCurrentChange(e,t,o){const a=new Map;return a.set(e,_c.createSynthesizedTargetChangeForCurrentChange(e,t,o)),new Ac(Ne.min(),a,new Mt(et),Hn(),Hn(),Qe()
vendor: 4,484 bytes, lines 20392-20407
20392)}}class _c{constructor(e,t,o,a,d){this.resumeToken=e,this.current=t,this.addedDocuments=o,this.modifiedDocuments=a,this.removedDocuments=d}static createSynthesizedTargetChangeForCurrentChange(e,t,o){return new _c(o,t,Qe(),Qe(),Qe())}}/**
20393 * @license
20394 * Copyright 2017 Google LLC
20395 *
20396 * Licensed under the Apache License, Version 2.0 (the "License");
20397 * you may not use this file except in compliance with the License.
20398 * You may obtain a copy of the License at
20399 *
20400 *   http://www.apache.org/licenses/LICENSE-2.0
20401 *
20402 * Unless required by applicable law or agreed to in writing, software
20403 * distributed under the License is distributed on an "AS IS" BASIS,
20404 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20405 * See the License for the specific language governing permissions and
20406 * limitations under the License.
20407 */class pu{constructor(e,t,o,a){this.Se=e,this.removedTargetIds=t,this.key=o,this.De=a}}class $y{constructor(e,t){this.targetId=e,this.xe=t}}class Jy{constructor(e,t,o=on.EMPTY_BYTE_STRING,a=null){this.state=e,this.targetIds=t,this.resumeToken=o,this.cause=a}}class J2{constructor(e){this.targetId=e,this.Ce=0,this.Fe=Z2(),this.Oe=on.EMPTY_BYTE_STRING,this.Me=!1,this.Ne=!0}get current(){return this.Me}get resumeToken(){return this.Oe}get Le(){return this.Ce!==0}get Be(){return this.Ne}Ue(e){e.approximateByteSize()>0&&(this.Ne=!0,this.Oe=e)}ke(){let e=Qe(),t=Qe(),o=Qe();return this.Fe.forEach(((a,d)=>{switch(d){case 0:e=e.add(a);break;case 2:t=t.add(a);break;case 1:o=o.add(a);break;default:De(38017,{changeType:d})}})),new _c(this.Oe,this.Me,e,t,o)}qe(){this.Ne=!1,this.Fe=Z2()}$e(e,t){this.Ne=!0,this.Fe=this.Fe.insert(e,t)}Ke(e){this.Ne=!0,this.Fe=this.Fe.remove(e)}We(){this.Ce+=1}Qe(){this.Ce-=1,Ae(this.Ce>=0,3241,{Ce:this.Ce,targetId:this.targetId})}Ge(){this.Ne=!0,this.Me=!0}}const Od="WatchChangeAggregator";class UA{constructor(e){this.ze=e,this.je=new Map,this.He=Hn(),this.Je=au(),this.Ye=Hn(),this.Ze=au(),this.Xe=new Mt(et)}et(e){for(const t of e.Se)e.De&&e.De.isFoundDocument()?this.tt(t,e.De):this.nt(t,e.key,e.De);for(const t of e.removedTargetIds)this.nt(t,e.key,e.De)}rt(e){this.forEachTarget(e,(t=>{const o=this.je.get(t);if(o)switch(e.state){case 0:this.it(t)&&o.Ue(e.resumeToken);break;case 1:o.Qe(),o.Le||o.qe(),o.Ue(e.resumeToken);break;case 2:o.Qe(),o.Le||this.removeTarget(t);break;case 3:this.it(t)&&(o.Ge(),o.Ue(e.resumeToken));break;case 4:this.it(t)&&(this.st(t),o.Ue(e.resumeToken));break;default:De(56790,{state:e.state})}else ge(Od,`handleTargetChange received targetChange for untracked target ID (${t}) with state (${e.state})`)}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.je.forEach(((o,a)=>{this.it(a)&&t(a)}))}_t(e){var t;return Qa(e)?e.getPipelineSourceType()==="documents"&&((t=e.getPipelineDocuments())==null?void 0:t.length)===1:Xy(e)}ot(e){const t=e.targetId,o=e.xe.count,a=this.ut(t);if(a){const d=a.target;if(this._t(d))if(o===0){const c=new Ee(Qa(d)?ut.fromString(d.getPipelineDocuments()[0]):d.path);this.nt(t,c,Dn.newNoDocument(c,Ne.min()))}else Ae(o===1,20013,"Single document existence filter with count: "+o);else{const c=this.ct(t);if(c!==o){const g=this.lt(e),h=g?this.Et(g,e,c):1;if(h!==0){this.st(t);const v=h===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Xe=this.Xe.insert(t,v)}}}}}lt(e){const t=e.xe.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:o="",padding:a=0},hashCount:d=0}=t;let c,g;try{c=ra(o).toUint8Array()}catch(h){if(h instanceof _y)return jo("Decoding the base64 bloom filter in existence filter failed ("+h.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw h}try{g=new Eh(c,a,d)}catch(h){return jo(h instanceof Ld?"BloomFilter error: ":"Applying bloom filter failed: ",h),null}return g.ge===0?null:g}Et(e,t,o){return t.xe.count===o-this.Pt(e,t.targetId)?0:2}Pt(e,t){const o=this.ze.getRemoteKeysForTarget(t);let a=0;return o.forEach((d=>{const c=this.ze.Tt(),g=`projects/${c.projectId}/databases/${c.database}/documents/${d.path.canonicalString()}`;e.mightContain(g)||(this.nt(t,d,null),a++)})),a}Rt(e){const t=new Map;this.je.forEach(((d,c)=>{const g=this.ut(c);if(g){if(d.current&&this._t(g.target)){const h=Qa(g.target)?ut.fromString(g.target.getPipelineDocuments()[0]):g.target.path,v=new Ee(h);this.It(v).has(c)||this.At(c,v)||this.nt(c,v,Dn.newNoDocument(v,e))}d.Be&&(t.set(c,d.ke()),d.qe())}}));let o=Qe();this.Ze.forEach(((d,c)=>{let g=!0;
20407c.forEachWhile((h=>{const v=this.ut(h);return!v||v.purpose==="TargetPurposeLimboResolution"||(g=!1,!1)})),g&&(o=o.add(d))})),this.He.forEach(((d,c)=>c.setReadTime(e))),this.Ye.forEach(((d,c)=>c.setReadTime(e)));const a=new Ac(e,t,this.Xe,this.He,this.Ye,o);return this.He=Hn(),this.Je=au(),this.Ye=Hn(),this.Ze=au(),this.Xe=new Mt(et),a}tt(e,t){const o=this.je.get(e);if(!o||!this.it(e))return void ge(Od,`addDocumentToTarget received document for unknown inactive target (${e})`);const a=this.At(e,t.key)?2:0;o.$e(t.key,a),Qa(this.ut(e).target)&&this.ut(e).target.getPipelineFlavor()!=="exact"?this.Ye=this.Ye.insert(t.key,t):this.He=this.He.insert(t.key,t),this.Je=this.Je.insert(t.key,this.It(t.key).add(e)),this.Ze=this.Ze.insert(t.key,this.Vt(t.key).add(e))}nt(e,t,o){const a=this.je.get(e);a&&this.it(e)?(this.At(e,t)?a.$e(t,1):a.Ke(t),this.Ze=this.Ze.insert(t,this.Vt(t).delete(e)),this.Ze=this.Ze.insert(t,this.Vt(t).add(e)),o&&(Qa(this.ut(e).target)&&this.ut(e).target.getPipelineFlavor()!=="exact"?this.Ye=this.Ye.insert(t,o):this.He=this.He.insert(t,o))):ge(Od,`removeDocumentFromTarget received document for unknown or inactive target (${e})`)}removeTarget(e){this.je.delete(e)}ct(e){const t=this.je.get(e);if(!t)return 0;const o=t.ke();return this.ze.getRemoteKeysForTarget(e).size+o.addedDocuments.size-o.removedDocuments.size}We(e){let t=this.je.get(e);t||(ge(Od,`recordPendingTargetRequest set up tracking for target ID ${e}`),t=new J2(e),this.je.set(e,t)),t.We()}Vt(e){let t=this.Ze.get(e);return t||(t=new nn(et),this.Ze=this.Ze.insert(e,t)),t}It(e){let t=this.Je.get(e);return t||(t=new nn(et),this.Je=this.Je.insert(e,t)),t}it(e){const t=this.ut(e)!==null;return t||ge(Od,"Detected inactive target",e),t}ut(e){const t=this.je.get(e);return t===void 0||t.Le?null:this.ze.dt(e)}st(e){this.je.set(e,new J2(e)),this.ze.getRemoteKeysForTarget(e).forEach((t=>{this.nt(e,t,null)}))}At(e,t){return this.ze.getRemoteKeysForTarget(e).has(t)}}function au(){return new Mt(Ee.comparator)}function Z2(){return new Mt(Ee.comparator)}const BA={asc:"ASCENDING",desc:"DESCENDING"},GA={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},qA={and:"AND",or:"OR"};class FA{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function $f(r,e){return r.useProto3Json||Qu(e)?e:{value:e}}function Tu(r,e){return r.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Sh(r){const e=sa(r);return new Ct(e.seconds,e.nanos)}function Zy(r,e){return r.useProto3Json?e.toBase64():e.toUint8Array()}function gu(r,e){return Tu(r,e.toTimestamp())}function As(r){return Ae(!!r,49232),Ne.fromTimestamp(Sh(r))}function kh(r,e){return Jf(r,e).canonicalString()}function Jf(r,e){const t=(function(a){return new ut(["projects",a.projectId,"databases",a.database])})(r).child("documents");return e===void 0?t:t.child(e)}function e4(r){const e=ut.fromString(r);return Ae(r4(e),10190,{key:e.toString()}),e}function Iu(r,e){return kh(r.databaseId,e.path)}function Rf(r,e){const t=e4(e);if(t.get(1)!==r.databaseId.projectId)throw new pe(oe.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+t.get(1)+" vs "+r.databaseId.projectId);if(t.get(3)!==r.databaseId.database)throw new pe(oe.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+r.databaseId.database);return new Ee(n4(t))}function t4(r,e){return kh(r.databaseId,e)}function jA(r){const e=e4(r);return e.length===4?ut.emptyPath():n4(e)}function Zf(r){return new ut(["projects",r.databaseId.projectId,"databases",r.databaseId.database]).canonicalString()}function n4(r){return Ae(r.length>4&&r.get(4)==="documents",29091,{key:r.toString()}),r.popFirst(5)}function e5(r,e,t){return{name:Iu(r,e),fields:t.value.mapValue.fields}}function XA(r,e){let t;if("targetChange"in e){e.targetChange;const o=(function(v){return v==="NO_CHANGE"?0:v==="ADD"?1:v==="REMOVE"?2:v==="CURRENT"?3:v==="RESET"?4:De(39313,{state:v})})(e.targetChange.targetChangeType||"NO_CHANGE"),a=e.targetChange.targetIds||[],d=(function(v,_){return v.useProto3Json?(Ae(_===void 0||typeof _=="string",58123),on.fromBase64String(_||"")):(Ae(_===void 0||_ instanceof Buffer||_ instanceof Uint8Array,16193),on.fromUint8Array(_||new Uint8Array))})(r,e.targetChange.resumeToken),c=e.targetChange.cause,g=c&&(function(v){const _=v.code===void 0?oe.UNKNOWN:Wy(v.code);return new pe(_,v.message||"")})(c);t=new Jy(o,a,d,g||null)}else if("documentChange"in e){e.documentChange;const o=e.documentChange;o.document,o.document.name,o.document.updateTime;const a=Rf(r,o.document.name),d=As(o.document.updateTime),c=o.document.createTime?As(o.document.createTime):Ne.min(),g=new Ln({mapValue:{fields:o.document.fields}}),h=Dn.newFoundDocument(a,d,c,g),v=o.targetIds||[],_=o.removedTargetIds||[];t=new pu(v,_,h.key,h)}else if("documentDelete"in e){e.documentDelete;const o=e.documentDelete;o.document;const a=Rf(r,o.document),d=o.readTime?As(o.readTime):Ne.min(),c=Dn.newNoDocument(a,d),g=o.removedTargetIds||[];t=new pu([],g,c.key,c)}else if("documentRemove"in e){e.documentRemove;const o=e.documentRemove;o.document;const a=Rf(r,o.document),d=o.removedTargetIds||[];t=new pu([],d,a,null)}else{if(!("filter"in e))return De(11601,{ft:e});{e.filter;const o=e.filter;o.targetId;const{count:a=0,unchangedNames:d}=o,c=new MA(a,d),g=o.targetId;t=new $y(g,c)}}return t}function HA(r,e){let t;if(e instanceof xc)t={update:e5(r,e.key,e.value)};else if(e instanceof Ah)t={delete:Iu(r,e.key)};else if(e instanceof fa)t={update:e5(r,e.key,e.data),updateMask:n_(e.fieldMask)};else{if(!(e instanceof pA))return De(16599,{gt:e.type});t={verify:Iu(r,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map((o=>(function(d,c){const g=c.transform;if(g instanceof nc)return{fieldPath:c.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(g instanceof oc)return{fieldPath:c.field.canonicalString(),appendMissingElements:{values:g.elements}};if(g instanceof sc)return{fieldPath:c.field.canonicalString(),removeAllFromArray:{values:g.elements}};if(g instanceof vl)return{fieldPath:c.field.canonicalString(),increment:g.Re};if(g instanceof ku)return{fieldPath:c.field.canonicalString(),minimum:g.Re};if(g instanceof Cu)return{fieldPath:c.field.canonicalString(),maximum:g.Re};throw De(20930,{transform:c.transform})})(0,o)))),e.precondition.isNone||(t.currentDocument=(function(a,d){return d.updateTime!==void 0?{updateTime:gu(a,d.updateTime)}:d.exists!==void 0?{exists:d.exists}:De(27497)})(r,e.precondition)),t}function WA(r,e){return r&&r.length>0?(Ae(e!==void 0,14353),r.map((t=>(function(a,d){let c=a.updateTime?As(a.updateTime):As(d);return c.isEqual(Ne.min())&&(c=As(d)),new cA(c,a.transformResults||[])})(t,e)))):[]}function KA(r,e){return{documents:[t4(r,e.path)]}}function QA(r,e){const t={structuredQuery:{}},o=e.path;let a;e.collectionGroup!==null?(a=o,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(a=o.popLast(),t.structuredQuery.from=[{collectionId:o.lastSegment()}]),t.parent=t4(r,a);const d=(function(v){if(v.length!==0)return s4(Xo.create(v,"and"))})(e.filters);d&&(t.structuredQuery.where=d);const c=(function(v){if(v.length!==0)return v.map((_=>(function(M){return{field:el(M.field),direction:ZA(M.dir)}})(_)))})(e.orderBy);c&&(t.structuredQuery.orderBy=c);const g=$f(r,e.limit);return g!==null&&(t.structuredQuery.limit=g),e.startAt&&(t.structuredQuery.startAt=(function(v){return{before:v.inclusive,values:v.position}})(e.startAt)),e.endAt&&(t.structuredQuery.endAt=(function(v){return{before:!v.inclusive,values:v.position}})(e.endAt)),{yt:t,parent:a}}function YA(r){let e=jA(r.parent);const t=r.structuredQuery,o=t.from?t.from.length:0;let a=null;if(o>0){Ae(o===1,65062);const _=t.from[0];_.allDescendants?a=_.collectionId:e=e.child(_.collectionId)}let d=[];t.where&&(d=(function(E){const M=o4(E);return M instanceof Xo&&Uy(M)?M.getFilters():[M]})(t.where));let c=[];t.orderBy&&(c=(function(E){return E.map((M=>(function(B){return new rc(tl(B.field),(function(ie){switch(ie){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(B.direction))})(M)))})(t.orderBy));let g=null;t.limit&&(g=(function(E){let M;return M=typeof E=="object"?E.value:E,Qu(M)?null:M})(t.limit));let h=null;t.startAt&&(h=(function(E){const M=!!E.before,G=E.values||[];return new Du(G,M)})(t.startAt));let v=null;return t.endAt&&(v=(function(E){const M=!E.before,G=E.values||[];return new Du(G,M)})(t.endAt)),EA(e,a,c,d,g,"F",h,v)}function $A(r,e){const t=(function(a){switch(a){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return De(28987,{purpose:a})}})(e.purpose);return t==null?null:{"goog-listen-tags":t}}function JA(r,e){return{structuredPipeline:{pipeline:{stages:e.stages.map((t=>t._toProto(r)))}}}}function o4(r){return r.unaryFilter!==void 0?(function(t){switch(t.unaryFilter.op){case"IS_NAN":const o=tl(t.unaryFilter.field);return en.create(o,"==",{doubleValue:NaN});case"IS_NULL":const a=tl(t.unaryFilter.field);return en.create(a,"==",{nullValue:"NULL_VALUE"});
20407case"IS_NOT_NAN":const d=tl(t.unaryFilter.field);return en.create(d,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const c=tl(t.unaryFilter.field);return en.create(c,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return De(61313);default:return De(60726)}})(r):r.fieldFilter!==void 0?(function(t){return en.create(tl(t.fieldFilter.field),(function(a){switch(a){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return De(58110);default:return De(50506)}})(t.fieldFilter.op),t.fieldFilter.value)})(r):r.compositeFilter!==void 0?(function(t){return Xo.create(t.compositeFilter.filters.map((o=>o4(o))),(function(a){switch(a){case"AND":return"and";case"OR":return"or";default:return De(1026)}})(t.compositeFilter.op))})(r):De(30097,{filter:r})}function ZA(r){return BA[r]}function e_(r){return GA[r]}function t_(r){return qA[r]}function el(r){return{fieldPath:r.canonicalString()}}function tl(r){return an.fromServerFormat(r.fieldPath)}function s4(r){return r instanceof en?(function(t){if(t.op==="=="){if(Yn(t.value))return{unaryFilter:{field:el(t.field),op:"IS_NAN"}};if(mo(t.value))return{unaryFilter:{field:el(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(Yn(t.value))return{unaryFilter:{field:el(t.field),op:"IS_NOT_NAN"}};if(mo(t.value))return{unaryFilter:{field:el(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:el(t.field),op:e_(t.op),value:t.value}}})(r):r instanceof Xo?(function(t){const o=t.getFilters().map((a=>s4(a)));return o.length===1?o[0]:{compositeFilter:{op:t_(t.op),filters:o}}})(r):De(54877,{filter:r})}function n_(r){const e=[];return r.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function r4(r){return r.length>=4&&r.get(0)==="projects"&&r.get(2)==="databases"}function a4(r){return!!r&&typeof r._toProto=="function"&&r._protoValueType==="ProtoValue"}function ac(r,e){const t={fields:{}};return e.forEach(((o,a)=>{if(typeof a!="string")throw new Error(`Cannot encode map with non-string key: ${a}`);t.fields[a]=o._toProto(r)})),{mapValue:t}}function i4(r){return{stringValue:r}}/**
20408 * @license
20409 * Copyright 2020 Google LLC
20410 *
20411 * Licensed under the Apache License, Version 2.0 (the "License");
20412 * you may not use this file except in compliance with the License.
20413 * You may obtain a copy of the License at
20414 *
20415 *   http://www.apache.org/licenses/LICENSE-2.0
20416 *
20417 * Unless required by applicable law or agreed to in writing, software
20418 * distributed under the License is distributed on an "AS IS" BASIS,
20419 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20420 * See the License for the specific language governing permissions and
20421 * limitations under the License.
20422 */function np(r){return new FA(r,!0)}/**
20423 * @license
20424 * Copyright 2020 Google LLC
20425 *
20426 * Licensed under the Apache License, Version 2.0 (the "License");
20427 * you may not use this file except in compliance with the License.
20428 * You may obtain a copy of the License at
20429 *
20430 *   http://www.apache.org/licenses/LICENSE-2.0
20431 *
20432 * Unless required by applicable law or agreed to in writing, software
20433 * distributed under the License is distributed on an "AS IS" BASIS,
20434 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20435 * See the License for the specific language governing permissions and
20436 * limitations under the License.
20437 */class ko{constructor(e){this._byteString=e}static fromBase64String(e){try{return new ko(on.fromBase64String(e))}catch(t){throw new pe(oe.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new ko(on.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:ko._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(bc(e,ko._jsonSchema))return ko.fromBase64String(e.bytes)}}
vendor: 4,167 bytes, lines 20437-20507
20437ko._jsonSchemaVersion="firestore/bytes/1.0",ko._jsonSchema={type:tn("string",ko._jsonSchemaVersion),bytes:tn("string")};/**
20438 * @license
20439 * Copyright 2020 Google LLC
20440 *
20441 * Licensed under the Apache License, Version 2.0 (the "License");
20442 * you may not use this file except in compliance with the License.
20443 * You may obtain a copy of the License at
20444 *
20445 *   http://www.apache.org/licenses/LICENSE-2.0
20446 *
20447 * Unless required by applicable law or agreed to in writing, software
20448 * distributed under the License is distributed on an "AS IS" BASIS,
20449 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20450 * See the License for the specific language governing permissions and
20451 * limitations under the License.
20452 */class op{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new pe(oe.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new an(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}function o_(){return new op(ul)}/**
20453 * @license
20454 * Copyright 2020 Google LLC
20455 *
20456 * Licensed under the Apache License, Version 2.0 (the "License");
20457 * you may not use this file except in compliance with the License.
20458 * You may obtain a copy of the License at
20459 *
20460 *   http://www.apache.org/licenses/LICENSE-2.0
20461 *
20462 * Unless required by applicable law or agreed to in writing, software
20463 * distributed under the License is distributed on an "AS IS" BASIS,
20464 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20465 * See the License for the specific language governing permissions and
20466 * limitations under the License.
20467 */class wc{constructor(e){this._methodName=e}}/**
20468 * @license
20469 * Copyright 2017 Google LLC
20470 *
20471 * Licensed under the Apache License, Version 2.0 (the "License");
20472 * you may not use this file except in compliance with the License.
20473 * You may obtain a copy of the License at
20474 *
20475 *   http://www.apache.org/licenses/LICENSE-2.0
20476 *
20477 * Unless required by applicable law or agreed to in writing, software
20478 * distributed under the License is distributed on an "AS IS" BASIS,
20479 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20480 * See the License for the specific language governing permissions and
20481 * limitations under the License.
20482 */class _s{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new pe(oe.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new pe(oe.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return et(this._lat,e._lat)||et(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:_s._jsonSchemaVersion}}static fromJSON(e){if(bc(e,_s._jsonSchema))return new _s(e.latitude,e.longitude)}}function l4(r){const e={};return r.timeoutSeconds!==void 0&&(e.timeoutSeconds=r.timeoutSeconds),e}/**
20483 * @license
20484 * Copyright 2019 Google LLC
20485 *
20486 * Licensed under the Apache License, Version 2.0 (the "License");
20487 * you may not use this file except in compliance with the License.
20488 * You may obtain a copy of the License at
20489 *
20490 *   http://www.apache.org/licenses/LICENSE-2.0
20491 *
20492 * Unless required by applicable law or agreed to in writing, software
20493 * distributed under the License is distributed on an "AS IS" BASIS,
20494 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20495 * See the License for the specific language governing permissions and
20496 * limitations under the License.
20497 */_s._jsonSchemaVersion="firestore/geoPoint/1.0",_s._jsonSchema={type:tn("string",_s._jsonSchemaVersion),latitude:tn("number"),longitude:tn("number")};class s_{bt(e){}shutdown(){}}/**
20498 * @license
20499 * Copyright 2019 Google LLC
20500 *
20501 * Licensed under the Apache License, Version 2.0 (the "License");
20502 * you may not use this file except in compliance with the License.
20503 * You may obtain a copy of the License at
20504 *
20505 *   http://www.apache.org/licenses/LICENSE-2.0
20506 *
20507 * Unless required by applicable law or agreed to in writing, softw
20507are
20508 * distributed under the License is distributed on an "AS IS" BASIS,
20509 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20510 * See the License for the specific language governing permissions and
20511 * limitations under the License.
20512 */const t5="ConnectivityMonitor";class n5{constructor(){this.vt=()=>this.St(),this.Dt=()=>this.xt(),this.Ct=[],this.Ft()}bt(e){this.Ct.push(e)}shutdown(){window.removeEventListener("online",this.vt),window.removeEventListener("offline",this.Dt)}Ft(){window.addEventListener("online",this.vt),window.addEventListener("offline",this.Dt)}St(){ge(t5,"Network connectivity changed: AVAILABLE");for(const e of this.Ct)e(0)}xt(){ge(t5,"Network connectivity changed: UNAVAILABLE");for(const e of this.Ct)e(1)}static C(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
20513 * @license
20514 * Copyright 2023 Google LLC
20515 *
20516 * Licensed under the Apache License, Version 2.0 (the "License");
20517 * you may not use this file except in compliance with the License.
20518 * You may obtain a copy of the License at
20519 *
20520 *   http://www.apache.org/licenses/LICENSE-2.0
20521 *
20522 * Unless required by applicable law or agreed to in writing, software
20523 * distributed under the License is distributed on an "AS IS" BASIS,
20524 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20525 * See the License for the specific language governing permissions and
20526 * limitations under the License.
20527 */let iu=null;function eh(){return iu===null?iu=(function(){return 268435456+Math.round(2147483648*Math.random())})():iu++,"0x"+iu.toString(16)}/**
20528 * @license
20529 * Copyright 2020 Google LLC
20530 *
20531 * Licensed under the Apache License, Version 2.0 (the "License");
20532 * you may not use this file except in compliance with the License.
20533 * You may obtain a copy of the License at
20534 *
20535 *   http://www.apache.org/licenses/LICENSE-2.0
20536 *
20537 * Unless required by applicable law or agreed to in writing, software
20538 * distributed under the License is distributed on an "AS IS" BASIS,
20539 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20540 * See the License for the specific language governing permissions and
20541 * limitations under the License.
20542 */const Df="RestConnection",r_={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class a_{get Ot(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",o=encodeURIComponent(this.databaseId.projectId),a=encodeURIComponent(this.databaseId.database);this.Mt=t+"://"+e.host,this.Nt=`projects/${o}/databases/${a}`,this.Lt=this.databaseId.database===Eu?`project_id=${o}`:`project_id=${o}&database_id=${a}`}Bt(e,t,o,a,d){const c=eh(),g=this.Ut(e,t.toUriEncodedString());ge(Df,`Sending RPC '${e}' ${c}:`,g,o);const h={"google-cloud-resource-prefix":this.Nt,"x-goog-request-params":this.Lt};this.kt(h,a,d);const{host:v}=new URL(g),_=hc(v);return this.qt(e,g,h,o,_).then((E=>(ge(Df,`Received RPC '${e}' ${c}: `,E),E)),(E=>{throw jo(Df,`RPC '${e}' ${c} failed with error: `,E,"url: ",g,"request:",o),E}))}$t(e,t,o,a,d,c){return this.Bt(e,t,o,a,d)}kt(e,t,o){e["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+Al})(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach(((a,d)=>e[d]=a)),o&&o.headers.forEach(((a,d)=>e[d]=a))}Ut(e,t){const o=r_[e];let a=`${this.Mt}/v1/${t}:${o}`;return this.databaseInfo.apiKey&&(a=`${a}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),a}terminate(){}}/**
20543 * @license
20544 * Copyright 2017 Google LLC
20545 *
20546 * Licensed under the Apache License, Version 2.0 (the "License");
20547 * you may not use this file except in compliance with the License.
20548 * You may obtain a copy of the License at
20549 *
20550 *   http://www.apache.org/licenses/LICENSE-2.0
20551 *
20552 * Unless required by applicable law or agreed to in writing, software
20553 * distributed under the License is distributed on an "AS IS" BASIS,
20554 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20555 * See the License for the specific language governing permissions and
20556 * limitations under the License.
20557 */class i_{constructor(e){this.Kt=e.Kt,this.Wt=e.Wt}
vendor: 12,922 bytes, lines 20557-20621
20557Qt(e){this.Gt=e}zt(e){this.jt=e}Ht(e){this.Jt=e}onMessage(e){this.Yt=e}close(){this.Wt()}send(e){this.Kt(e)}Zt(){this.Gt()}Xt(){this.jt()}en(e){this.Jt(e)}tn(e){this.Yt(e)}}/**
20558 * @license
20559 * Copyright 2017 Google LLC
20560 *
20561 * Licensed under the Apache License, Version 2.0 (the "License");
20562 * you may not use this file except in compliance with the License.
20563 * You may obtain a copy of the License at
20564 *
20565 *   http://www.apache.org/licenses/LICENSE-2.0
20566 *
20567 * Unless required by applicable law or agreed to in writing, software
20568 * distributed under the License is distributed on an "AS IS" BASIS,
20569 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20570 * See the License for the specific language governing permissions and
20571 * limitations under the License.
20572 */const Sn="WebChannelConnection",Pd=(r,e,t)=>{r.listen(e,(o=>{try{t(o)}catch(a){setTimeout((()=>{throw a}),0)}}))};class sl extends a_{constructor(e){super(e),this.nn=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static rn(){if(!sl.sn){const e=gy();Pd(e,py.STAT_EVENT,(t=>{t.stat===jf.PROXY?ge(Sn,"STAT_EVENT: detected buffering proxy"):t.stat===jf.NOPROXY&&ge(Sn,"STAT_EVENT: detected no buffering proxy")})),sl.sn=!0}}qt(e,t,o,a,d){const c=eh();return new Promise(((g,h)=>{const v=new my;v.setWithCredentials(!0),v.listenOnce(uy.COMPLETE,(()=>{try{switch(v.getLastErrorCode()){case cu.NO_ERROR:const E=v.getResponseJson();ge(Sn,`XHR for RPC '${e}' ${c} received:`,JSON.stringify(E)),g(E);break;case cu.TIMEOUT:ge(Sn,`RPC '${e}' ${c} timed out`),h(new pe(oe.DEADLINE_EXCEEDED,"Request time out"));break;case cu.HTTP_ERROR:const M=v.getStatus();if(ge(Sn,`RPC '${e}' ${c} failed with status:`,M,"response text:",v.getResponseText()),M>0){let G=v.getResponseJson();Array.isArray(G)&&(G=G[0]);const B=G==null?void 0:G.error;if(B&&B.status&&B.message){const ee=(function(ve){const Se=ve.toLowerCase().replace(/_/g,"-");return Object.values(oe).indexOf(Se)>=0?Se:oe.UNKNOWN})(B.status);h(new pe(ee,B.message))}else h(new pe(oe.UNKNOWN,"Server responded with status "+v.getStatus()))}else h(new pe(oe.UNAVAILABLE,"Connection failed."));break;default:De(9055,{_n:e,streamId:c,an:v.getLastErrorCode(),un:v.getLastError()})}}finally{ge(Sn,`RPC '${e}' ${c} completed.`)}}));const _=JSON.stringify(a);ge(Sn,`RPC '${e}' ${c} sending request:`,a),v.send(t,"POST",_,o,15)}))}cn(e,t,o){const a=eh(),d=[this.Mt,"/","google.firestore.v1.Firestore","/",e,"/channel"],c=this.createWebChannelTransport(),g={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},h=this.longPollingOptions.timeoutSeconds;h!==void 0&&(g.longPollingTimeout=Math.round(1e3*h)),this.useFetchStreams&&(g.useFetchStreams=!0),this.kt(g.initMessageHeaders,t,o),g.encodeInitMessageHeaders=!0;const v=d.join("");ge(Sn,`Creating RPC '${e}' stream ${a}: ${v}`,g);const _=c.createWebChannel(v,g);this.En(_);let E=!1,M=!1;const G=new i_({Kt:B=>{M?ge(Sn,`Not sending because RPC '${e}' stream ${a} is closed:`,B):(E||(ge(Sn,`Opening RPC '${e}' stream ${a} transport.`),_.open(),E=!0),ge(Sn,`RPC '${e}' stream ${a} sending:`,B),_.send(B))},Wt:()=>_.close()});return Pd(_,zd.EventType.OPEN,(()=>{M||(ge(Sn,`RPC '${e}' stream ${a} transport opened.`),G.Zt())})),Pd(_,zd.EventType.CLOSE,(()=>{M||(M=!0,ge(Sn,`RPC '${e}' stream ${a} transport closed`),G.en(),this.hn(_))})),Pd(_,zd.EventType.ERROR,(B=>{M||(M=!0,jo(Sn,`RPC '${e}' stream ${a} transport errored. Name:`,B.name,"Message:",B.message),G.en(new pe(oe.UNAVAILABLE,"The operation could not be completed")))})),Pd(_,zd.EventType.MESSAGE,(B=>{var ee;if(!M){const ie=B.data[0];Ae(!!ie,16349);const ve=ie,Se=(ve==null?void 0:ve.error)||((ee=ve[0])==null?void 0:ee.error);if(Se){ge(Sn,`RPC '${e}' stream ${a} received error:`,Se);const Me=Se.status;let tt=(function(w){const C=Zt[w];if(C!==void 0)return Wy(C)})(Me),Ye=Se.message;Me==="NOT_FOUND"&&Ye.includes("database")&&Ye.includes("does not exist")&&Ye.includes(this.databaseId.database)&&jo(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),tt===void 0&&(tt=oe.INTERNAL,Ye="Unknown error status: "+Me+" with message "+Se.message),M=!0,G.en(new pe(tt,Ye)),_.close()}else ge(Sn,`RPC '${e}' stream ${a} received:`,ie),G.tn(ie)}})),sl.rn(),setTimeout((()=>{G.Xt()}),0),G}terminate(){this.nn.forEach((e=>e.close())),this.nn=[]}En(e){this.nn.push(e)}hn(e){this.nn=this.nn.filter((t=>t===e))}kt(e,t,o){super.kt(e,t,o),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return fy()}}/**
20573 * @license
20574 * Copyright 2020 Google LLC
20575 *
20576 * Licensed under the Apache License, Version 2.0 (the "License");
20577 * you may not use this file except in compliance with the License.
20578 * You may obtain a copy of the License at
20579 *
20580 *   http://www.apache.org/licenses/LICENSE-2.0
20581 *
20582 * Unless required by applicable law or agreed to in writing, software
20583 * distributed under the License is distributed on an "AS IS" BASIS,
20584 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20585 * See the License for the specific language governing permissions and
20586 * limitations under the License.
20587 */function l_(r){return new sl(r)}sl.sn=!1;class d4{constructor(e,t,o=1e3,a=1.5,d=6e4){this.Tn=e,this.timerId=t,this.Pn=o,this.Rn=a,this.In=d,this.An=0,this.Vn=null,this.dn=Date.now(),this.reset()}reset(){this.An=0}fn(){this.An=this.In}mn(e){this.cancel();const t=Math.floor(this.An+this.pn()),o=Math.max(0,Date.now()-this.dn),a=Math.max(0,t-o);a>0&&ge("ExponentialBackoff",`Backing off for ${a} ms (base delay: ${this.An} ms, delay with jitter: ${t} ms, last attempt: ${o} ms ago)`),this.Vn=this.Tn.enqueueAfterDelay(this.timerId,a,(()=>(this.dn=Date.now(),e()))),this.An*=this.Rn,this.An<this.Pn&&(this.An=this.Pn),this.An>this.In&&(this.An=this.In)}gn(){this.Vn!==null&&(this.Vn.skipDelay(),this.Vn=null)}cancel(){this.Vn!==null&&(this.Vn.cancel(),this.Vn=null)}pn(){return(Math.random()-.5)*this.An}}/**
20588 * @license
20589 * Copyright 2017 Google LLC
20590 *
20591 * Licensed under the Apache License, Version 2.0 (the "License");
20592 * you may not use this file except in compliance with the License.
20593 * You may obtain a copy of the License at
20594 *
20595 *   http://www.apache.org/licenses/LICENSE-2.0
20596 *
20597 * Unless required by applicable law or agreed to in writing, software
20598 * distributed under the License is distributed on an "AS IS" BASIS,
20599 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20600 * See the License for the specific language governing permissions and
20601 * limitations under the License.
20602 */const o5="PersistentStream";class c4{constructor(e,t,o,a,d,c,g,h){this.Tn=e,this.yn=o,this.wn=a,this.connection=d,this.authCredentialsProvider=c,this.appCheckCredentialsProvider=g,this.listener=h,this.state=0,this.bn=0,this.vn=null,this.Sn=null,this.stream=null,this.Dn=0,this.xn=new d4(e,t)}Cn(){return this.state===1||this.state===5||this.Fn()}Fn(){return this.state===2||this.state===3}start(){this.Dn=0,this.state!==4?this.auth():this.On()}async stop(){this.Cn()&&await this.close(0)}Mn(){this.state=0,this.xn.reset()}Nn(){this.Fn()&&this.vn===null&&(this.vn=this.Tn.enqueueAfterDelay(this.yn,6e4,(()=>this.Ln())))}Bn(e){this.Un(),this.stream.send(e)}async Ln(){if(this.Fn())return this.close(0)}Un(){this.vn&&(this.vn.cancel(),this.vn=null)}kn(){this.Sn&&(this.Sn.cancel(),this.Sn=null)}async close(e,t){this.Un(),this.kn(),this.xn.cancel(),this.bn++,e!==4?this.xn.reset():t&&t.code===oe.RESOURCE_EXHAUSTED?(nr(t.toString()),nr("Using maximum backoff delay to prevent overloading the backend."),this.xn.fn()):t&&t.code===oe.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.qn(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Ht(t)}qn(){}auth(){this.state=1;const e=this.$n(this.bn),t=this.bn;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([o,a])=>{this.bn===t&&this.Kn(o,a)}),(o=>{e((()=>{const a=new pe(oe.UNKNOWN,"Fetching auth token failed: "+o.message);return this.Wn(a)}))}))}Kn(e,t){const o=this.$n(this.bn);this.stream=this.Qn(e,t),this.stream.Qt((()=>{o((()=>this.listener.Qt()))})),this.stream.zt((()=>{o((()=>(this.state=2,this.Sn=this.Tn.enqueueAfterDelay(this.wn,1e4,(()=>(this.Fn()&&(this.state=3),Promise.resolve()))),this.listener.zt())))})),this.stream.Ht((a=>{o((()=>this.Wn(a)))})),this.stream.onMessage((a=>{o((()=>++this.Dn==1?this.Gn(a):this.onNext(a)))}))}On(){this.state=5,this.xn.mn((async()=>{this.state=0,this.start()}))}Wn(e){return ge(o5,`close with error: ${e}`),this.stream=null,this.close(4,e)}$n(e){return t=>{this.Tn.enqueueAndForget((()=>this.bn===e?t():(ge(o5,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class d_ extends c4{constructor(e,t,o,a,d,c){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,o,a,c),this.serializer=d}Qn(e,t){return this.connection.cn("Listen",e,t)}Gn(e){return this.onNext(e)}onNext(e){this.xn.reset();const t=XA(this.serializer,e),o=(function(d){if(!("targetChange"in d))return Ne.min();const c=d.targetChange;return c.targetIds&&c.targetIds.length?Ne.min():c.readTime?As(c.readTime):Ne.min()})(e);return this.listener.zn(t,o)}jn(e){const t={};t.database=Zf(this.serializer),t.addTarget=(function(d,c){let g;const h=c.target;if(g=Qa(h)?{pipelineQuery:JA(d,h)}:Xy(h)?{documents:KA(d,h)}:{query:QA(d,h).yt},g.targetId=c.targetId,c.resumeToken.approximateByteSize()>0){g.resumeToken=Zy(d,c.resumeToken);const v=$f(d,c.expectedCount);v!==null&&(g.expectedCount=v)}else if(c.snapshotVersion.compareTo(Ne.min())>0){g.readTime=Tu(d,c.snapshotVersion.toTimestamp());const v=$f(d,c.expectedCount);v!==null&&(g.expectedCount=v)}return g})(this.serializer,e);const o=$A(this.serializer,e);o&&(t.labels=o),this.Bn(t)}Hn(e){const t={};t.database=Zf(this.serializer),t.removeTarget=e,this.Bn(t)}}class c_ extends c4{constructor(e,t,o,a,d,c){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,o,a,c),this.serializer=d}get Jn(){return this.Dn>0}start(){this.lastStreamToken=void 0,super.start()}qn(){this.Jn&&this.Yn([])}Qn(e,t){return this.connection.cn("Write",e,t)}Gn(e){return Ae(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,Ae(!e.writeResults||e.writeResults.length===0,55816),this.listener.Zn()}onNext(e){Ae(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.xn.reset();const t=WA(e.writeResults,e.commitTime),o=As(e.commitTime);return this.listener.Xn(o,t)}er(){const e={};e.database=Zf(this.serializer),this.Bn(e)}Yn(e){const t={streamToken:this.lastStreamToken,writes:e.map((o=>HA(this.serializer,o)))};this.Bn(t)}}/**
20603 * @license
20604 * Copyright 2017 Google LLC
20605 *
20606 * Licensed under the Apache License, Version 2.0 (the "License");
20607 * you may not use this file except in compliance with the License.
20608 * You may obtain a copy of the License at
20609 *
20610 *   http://www.apache.org/licenses/LICENSE-2.0
20611 *
20612 * Unless required by applicable law or agreed to in writing, software
20613 * distributed under the License is distributed on an "AS IS" BASIS,
20614 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20615 * See the License for the specific language governing permissions and
20616 * limitations under the License.
20617 */class m_{}class u_ extends m_{constructor(e,t,o,a){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=o,this.serializer=a,this.tr=!1}nr(){if(this.tr)throw new pe(oe.FAILED_PRECONDITION,"The client has already been terminated.")}Bt(e,t,o,a){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([d,c])=>this.connection.Bt(e,Jf(t,o),a,d,c))).catch((d=>{throw d.name==="FirebaseError"?(d.code===oe.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),d):new pe(oe.UNKNOWN,d.toString())}))}$t(e,t,o,a,d){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([c,g])=>this.connection.$t(e,Jf(t,o),a,c,g,d))).catch((c=>{throw c.name==="FirebaseError"?(c.code===oe.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),c):new pe(oe.UNKNOWN,c.toString())}))}terminate(){this.tr=!0,this.connection.terminate()}}function p_(r,e,t,o){return new u_(r,e,t,o)}/**
20618 * @license
20619 * Copyright 2020 Google LLC
20620 *
20621 * Licensed under the Apache License, Version 2.0 (the "License");
20622 * you may not use this file except in compliance with the License.
20623 * You may obtain a copy of the License at
20624 *
20625 *   http://www.apache.org/licenses/LICENSE-2.0
20626 *
20627 * Unless required by applicable law or agreed to in writing, software
20628 * distributed under the License is distributed on an "AS IS" BASIS,
20629 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20630 * See the License for the specific language governing permissions and
20631 * limitations under the License.
20632 */const g_="ComponentProvider",s5=new Map;function f_(r,e,t,o,a){return new oA(r,e,t,a.host,a.ssl,a.experimentalForceLongPolling,a.experimentalAutoDetectLongPolling,l4(a.experimentalLongPollingOptions),a.useFetchStreams,a.isUsingEmulator,o)}/**
20633 * @license
20634 * Copyright 2018 Google LLC
20635 *
20636 * Licensed under the Apache License, Version 2.0 (the "License");
20637 * you may not use this file except in compliance with the License.
20638 * You may obtain a copy of the License at
20639 *
20640 *   http://www.apache.org/licenses/LICENSE-2.0
20641 *
20642 * Unless required by applicable law or agreed to in writing, software
20643 * distributed under the License is distributed on an "AS IS" BASIS,
20644 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20645 * See the License for the specific language governing permissions and
20646 * limitations under the License.
20647 */const r5={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},m4=41943040;class jn{static withCacheSize(e){return new jn(e,jn.DEFAULT_COLLECTION_PERCENTILE,jn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,o){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=o}}jn.DEFAULT_COLLECTION_PERCENTILE=10,jn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,jn.DEFAULT=new jn(m4,jn.DEFAULT_COLLECTION_PERCENTILE,jn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),jn.DISABLED=new jn(-1,0,0);/**
20648 * @license
20649 * Copyright 2020 Google LLC
20650 *
20651 * Licensed under the Apache License, Version 2.0 (the "License");
20652 * you may not use this file except in compliance with the License.
20653 * You may obtain a copy of the License at
20654 *
20655 *   http://www.apache.org/licenses/LICENSE-2.0
20656 *
20657 * Unless required by applicable law or agreed to in writing, software
20658 * distributed under the License is distributed on an "AS IS" BASIS,
20659 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20660 * See the License for the specific language governing permissions and
20661 * limitations under the License.
20662 */const a5="LruGarbageCollector",h_=1048576;function i5([r,e],[t,o]){const a=et(r,t);return a===0?et(e,o):a}class v_{constructor(e){this.rr=e,this.buffer=new nn(i5),this.ir=0}sr(){return++this.ir}_r(e){const t=[e,this.sr()];if(this.buffer.size<this.rr)this.buffer=this.buffer.add(t);else{const o=this.buffer.last();i5(t,o)<0&&(this.buffer=this.buffer.delete(o).add(t))}}get maxValue(){return this.buffer.last()[0]}}class b_{constructor(e,t,o){this.garbageCollector=e,this.asyncQueue=t,this.localStore=o,this.ar=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.ur(6e4)}stop(){this.ar&&(this.ar.cancel(),this.ar=null)}get started(){return this.ar!==null}ur(e){ge(a5,`Garbage collection scheduled in ${e}ms`),this.ar=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,(async()=>{this.ar=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){wl(t)?ge(a5,"Ignoring IndexedDB error during garbage collection: ",t):await _l(t)}await this.ur(3e5)}))}}class y_{constructor(e,t){this.cr=e,this.params=t}calculateTargetCount(e,t){return this.cr.lr(e).next((o=>Math.floor(t/100*o)))}nthSequenceNumber(e,t){if(t===0)return se.resolve(Ku.ce);const o=new v_(t);return this.cr.forEachTarget(e,(a=>o._r(a.sequenceNumber))).next((()=>this.cr.Er(e,(a=>o._r(a))))).next((()=>o.maxValue))}removeTargets(e,t,o){return this.cr.removeTargets(e,t,o)}removeOrphanedDocuments(e,t){return this.cr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(ge("LruGarbageCollector","Garbage collection skipped; disabled"),se.resolve(r5)):this.getCacheSize(e).next((o=>o<this.params.cacheSizeCollectionThreshold?(ge("LruGarbageCollector",`Garbage collection skipped; Cache size ${o} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),r5):this.hr(e,t)))}getCacheSize(e){return this.cr.getCacheSize(e)}hr(e,t){let o,a,d,c,g,h,v;const _=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((E=>(E>this.params.maximumSequenceNumbersToCollect?(ge("LruGarbageCollector",`C
20662apping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${E}`),a=this.params.maximumSequenceNumbersToCollect):a=E,c=Date.now(),this.nthSequenceNumber(e,a)))).next((E=>(o=E,g=Date.now(),this.removeTargets(e,o,t)))).next((E=>(d=E,h=Date.now(),this.removeOrphanedDocuments(e,o)))).next((E=>(v=Date.now(),Ji()<=st.DEBUG&&ge("LruGarbageCollector",`LRU Garbage Collection
20663	Counted targets in ${c-_}ms
20664	Determined least recently used ${a} in `+(g-c)+`ms
20665	Removed ${d} targets in `+(h-g)+`ms
20666	Removed ${E} documents in `+(v-h)+`ms
20667Total Duration: ${v-_}ms`),se.resolve({didRun:!0,sequenceNumbersCollected:a,targetsRemoved:d,documentsRemoved:E}))))}}function x_(r,e){return new y_(r,e)}/**
20668 * @license
20669 * Copyright 2020 Google LLC
20670 *
20671 * Licensed under the Apache License, Version 2.0 (the "License");
20672 * you may not use this file except in compliance with the License.
20673 * You may obtain a copy of the License at
20674 *
20675 *   http://www.apache.org/licenses/LICENSE-2.0
20676 *
20677 * Unless required by applicable law or agreed to in writing, software
20678 * distributed under the License is distributed on an "AS IS" BASIS,
20679 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20680 * See the License for the specific language governing permissions and
20681 * limitations under the License.
20682 */const u4="firestore.googleapis.com",l5=!0;class d5{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new pe(oe.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=u4,this.ssl=l5}else this.host=e.host,this.ssl=e.ssl??l5;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=m4;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<h_)throw new pe(oe.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}j9("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=l4(e.experimentalLongPollingOptions??{}),(function(o){if(o.timeoutSeconds!==void 0){if(isNaN(o.timeoutSeconds))throw new pe(oe.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (must not be NaN)`);if(o.timeoutSeconds<5)throw new pe(oe.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (minimum allowed value is 5)`);if(o.timeoutSeconds>30)throw new pe(oe.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (maximum allowed value is 30)`)}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(function(o,a){return o.timeoutSeconds===a.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class sp{constructor(e,t,o,a){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=o,this._app=a,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new d5({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new pe(oe.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new pe(oe.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new d5(e),this._emulatorOptions=e.emulatorOptions||{}
20682,e.credentials!==void 0&&(this._authCredentials=(function(o){if(!o)return new P9;switch(o.type){case"firstParty":return new V9(o.sessionIndex||"0",o.iamToken||null,o.authTokenFactory||null);case"provider":return o.client;default:throw new pe(oe.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}})(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(t){const o=s5.get(t);o&&(ge(g_,"Removing Datastore"),s5.delete(t),o.terminate())})(this),Promise.resolve()}}function A_(r,e,t,o={}){var v;r=ys(r,sp);const a=hc(e),d=r._getSettings(),c={...d,emulatorOptions:r._getEmulatorOptions()},g=`${e}:${t}`;a&&oy(`https://${g}`),d.host!==u4&&d.host!==g&&jo("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const h={...d,host:g,ssl:a,emulatorOptions:o};if(!ni(h,c)&&(r._setSettings(h),o.mockUserToken)){let _,E;if(typeof o.mockUserToken=="string")_=o.mockUserToken,E=Rn.MOCK_USER;else{_=Jx(o.mockUserToken,(v=r._app)==null?void 0:v.options.projectId);const M=o.mockUserToken.sub||o.mockUserToken.user_id;if(!M)throw new pe(oe.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");E=new Rn(M)}r._authCredentials=new z9(new by(_,E))}}/**
20683 * @license
20684 * Copyright 2020 Google LLC
20685 *
20686 * Licensed under the Apache License, Version 2.0 (the "License");
20687 * you may not use this file except in compliance with the License.
20688 * You may obtain a copy of the License at
20689 *
20690 *   http://www.apache.org/licenses/LICENSE-2.0
20691 *
20692 * Unless required by applicable law or agreed to in writing, software
20693 * distributed under the License is distributed on an "AS IS" BASIS,
20694 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20695 * See the License for the specific language governing permissions and
20696 * limitations under the License.
20697 */class ha{constructor(e,t,o){this.converter=t,this._query=o,this.type="query",this.firestore=e}withConverter(e){return new ha(this.firestore,e,this._query)}}class Vt{constructor(e,t,o){this.converter=t,this._key=o,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Jr(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Vt(this.firestore,e,this._key)}toJSON(){return{type:Vt._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,o){if(bc(t,Vt._jsonSchema))return new Vt(e,o||null,new Ee(ut.fromString(t.referencePath)))}}Vt._jsonSchemaVersion="firestore/documentReference/1.0",Vt._jsonSchema={type:tn("string",Vt._jsonSchemaVersion),referencePath:tn("string")};class Jr extends ha{constructor(e,t,o){super(e,t,_h(o)),this._path=o,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Vt(this.firestore,null,new Ee(e))}withConverter(e){return new Jr(this.firestore,e,this._path)}}function th(r,e,...t){if(r=_n(r),yy("collection","path",e),r instanceof sp){const o=ut.fromString(e,...t);return P2(o),new Jr(r,null,o)}{if(!(r instanceof Vt||r instanceof Jr))throw new pe(oe.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const o=r._path.child(ut.fromString(e,...t));return P2(o),new Jr(r.firestore,null,o)}}function Ou(r,e,...t){if(r=_n(r),arguments.length===1&&(e=vh.newId()),yy("doc","path",e),r instanceof sp){const o=ut.fromString(e,...t);return O2(o),new Vt(r,null,new Ee(o))}{if(!(r instanceof Vt||r instanceof Jr))throw new pe(oe.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const o=r._path.child(ut.fromString(e,...t));return O2(o),new Vt(r.firestore,r instanceof Jr?r.converter:null,new Ee(o))}}/**
20698 * @license
20699 * Copyright 2017 Google LLC
20700 *
20701 * Licensed under the Apache License, Version 2.0 (the "License");
20702 * you may not use this file except in compliance with the License.
20703 * You may obtain a copy of the License at
20704 *
20705 *   http://www.apache.org/licenses/LICENSE-2.0
20706 *
20707 * Unless required by applicable law or agreed to in writing, software
20708 * distributed under the License is distributed on an "AS IS" BASIS,
20709 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20710 * See the License for the specific language governing permissions and
20711 * limitations under the License.
20712 *//**
20713 * @license
20714 * Copyright 2024 Google LLC
20715 *
20716 * Licensed under the Apache License, Version 2.0 (the "License");
20717 * you may not use this file except in compliance with the License.
20718 * You may obtain a copy of the License at
20719 *
20720 *   http://www.apache.org/licenses/LICENSE-2.0
20721 *
20722 * Unless required by applicable law or agreed to in writing, software
20723 * distributed under the License is distributed on an "AS IS" BASIS,
20724 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20725 * See the License for the specific language governing permissions and
20726 * limitations under the License.
20727 */class Wn{constructor(e){this._values=(e||[]).map((t=>t))}toArray(){return this._values.map((e=>e))}isEqual(e){return(function(o,a){if(o.length!==a.length)return!1;for(let d=0;d<o.length;++d)if(o[d]!==a[d])return!1;return!0})(this._values,e._values)}toJSON(){return{type:Wn._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(bc(e,Wn._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every((t=>typeof t=="number")))return new Wn(e.vectorValues);throw new pe(oe.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}Wn._jsonSchemaVersion="firestore/vectorValue/1.0",Wn._jsonSchema={type:tn("string",Wn._jsonSchemaVersion),vectorValues:tn("object")};/**
20728 * @license
20729 * Copyright 2017 Google LLC
20730 *
20731 * Licensed under the Apache License, Version 2.0 (the "License");
20732 * you may not use this file except in compliance with the License.
20733 * You may obtain a copy of the License at
20734 *
20735 *   http://www.apache.org/licenses/LICENSE-2.0
20736 *
20737 * Unless required by applicable law or agreed to in writing, software
20738 * distributed under the License is distributed on an "AS IS" BASIS,
20739 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20740 * See the License for the specific language governing permissions and
20741 * limitations under the License.
20742 */const __=/^__.*__$/;class w_{constructor(e,t,o){this.data=e,this.fieldMask=t,this.fieldTransforms=o}toMutation(e,t){return this.fieldMask!==null?new fa(e,this.data,this.fieldMask,t,this.fieldTransforms):new xc(e,this.data,t,this.fieldTransforms)}}class p4{constructor(e,t,o){this.data=e,this.fieldMask=t,this.fieldTransforms=o}toMutation(e,t){return new fa(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function g4(r){switch(r){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw De(40011,{dataSource:r})}}class Ch{constructor(e,t,o,a,d,c){this.settings=e,this.databaseId=t,this.serializer=o,this.ignoreUndefinedProperties=a,d===void 0&&this.validatePath(),this.fieldTransforms=d||[],this.fieldMask=c||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(e){return new Ch({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){var a;const t=(a=this.path)==null?void 0:a.child(e),o=this.contextWith({path:t,arrayElement:!1});return o.validatePathSegment(e),o}childContextForFieldPath(e){var a;const t=(a=this.path)==null?void 0:a.child(e),o=this.contextWith({path:t,arrayElement:!1});return o.validatePath(),o}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return Pu(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find((t=>e.isPrefixOf(t)))!==void 0||this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))!==void 0}validatePath(){if(this.path)for(let e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))}validatePathSegment(e){if(e.length===0)throw this.createError("Document fields must not be empty");if(g4(this.dataSource)&&__.test(e))throw this.createError('Document fields cannot begin and end with "__"')}}class E_{constructor(e,t,o){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer
20742=o||np(e)}createContext(e,t,o,a=!1){return new Ch({dataSource:e,methodName:t,targetDoc:o,path:an.emptyPath(),arrayElement:!1,hasConverter:a},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function rp(r){const e=r._freezeSettings(),t=np(r._databaseId);return new E_(r._databaseId,!!e.ignoreUndefinedProperties,t)}function f4(r,e,t,o,a,d={}){const c=r.createContext(d.merge||d.mergeFields?2:0,e,t,a);Mh("Data must be an object, but it was:",c,o);const g=h4(o,c);let h,v;if(d.merge)h=new co(c.fieldMask),v=c.fieldTransforms;else if(d.mergeFields){const _=[];for(const E of d.mergeFields){const M=la(e,E,t);if(!c.contains(M))throw new pe(oe.INVALID_ARGUMENT,`Field '${M}' is specified in your field mask but missing from your input data.`);y4(_,M)||_.push(M)}h=new co(_),v=c.fieldTransforms.filter((E=>h.covers(E.field)))}else h=null,v=c.fieldTransforms;return new w_(new Ln(g),h,v)}class ap extends wc{_toFieldTransform(e){if(e.dataSource!==2)throw e.dataSource===1?e.createError(`${this._methodName}() can only appear at the top level of your update data`):e.createError(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof ap}}class Rh extends wc{_toFieldTransform(e){return new Py(e.path,new nc)}isEqual(e){return e instanceof Rh}}class Dh extends wc{constructor(e,t){super(e),this.Pr=t}_toFieldTransform(e){const t=new vl(e.serializer,Ju(e.serializer,this.Pr));return new Py(e.path,t)}isEqual(e){return e instanceof Dh&&(this.Pr===e.Pr||Number.isNaN(this.Pr)&&Number.isNaN(e.Pr))}}function S_(r,e,t,o){const a=r.createContext(1,e,t);Mh("Data must be an object, but it was:",a,o);const d=[],c=Ln.empty();ga(o,((h,v)=>{const _=b4(e,h,t);v=_n(v);const E=a.childContextForFieldPath(_);if(v instanceof ap)d.push(_);else{const M=ia(v,E);M!=null&&(d.push(_),c.set(_,M))}}));const g=new co(d);return new p4(c,g,a.fieldTransforms)}function k_(r,e,t,o,a,d){const c=r.createContext(1,e,t),g=[la(e,o,t)],h=[a];if(d.length%2!=0)throw new pe(oe.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let M=0;M<d.length;M+=2)g.push(la(e,d[M])),h.push(d[M+1]);const v=[],_=Ln.empty();for(let M=g.length-1;M>=0;--M)if(!y4(v,g[M])){const G=g[M];let B=h[M];B=_n(B);const ee=c.childContextForFieldPath(G);if(B instanceof ap)v.push(G);else{const ie=ia(B,ee);ie!=null&&(v.push(G),_.set(G,ie))}}const E=new co(v);return new p4(_,E,c.fieldTransforms)}function C_(r,e,t,o=!1){return ia(t,r.createContext(o?4:3,e))}function ia(r,e,t){if(v4(r=_n(r)))return Mh("Unsupported field value:",e,r),h4(r,e);if(r instanceof wc)return(function(a,d){if(!g4(d.dataSource))throw d.createError(`${a._methodName}() can only be used with update() and set()`);if(!d.path)throw d.createError(`${a._methodName}() is not currently supported inside arrays`);const c=a._toFieldTransform(d);c&&d.fieldTransforms.push(c)})(r,e),null;if(r===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),r instanceof Array){if(e.settings.arrayElement&&e.dataSource!==4)throw e.createError("Nested arrays are not supported");return(function(a,d){const c=[];let g=0;for(const h of a){let v=ia(h,d.childContextForArray(g));v==null&&(v={nullValue:"NULL_VALUE"}),c.push(v),g++}return{arrayValue:{values:c}}})(r,e)}return(function(a,d,c){if((a=_n(a))===null)return{nullValue:"NULL_VALUE"};if(typeof a=="number")return Ju(d.serializer,a,c);if(typeof a=="boolean")return{booleanValue:a};if(typeof a=="string")return{stringValue:a};if(a instanceof Date){const g=Ct.fromDate(a);return{timestampValue:Tu(d.serializer,g)}}if(a instanceof Ct){const g=new Ct(a.seconds,1e3*Math.floor(a.nanoseconds/1e3));return{timestampValue:Tu(d.serializer,g)}}if(a instanceof _s)return{geoPointValue:{latitude:a.latitude,longitude:a.longitude}};if(a instanceof ko)return{bytesValue:Zy(d.serializer,a._byteString)};if(a instanceof Vt){const g=d.databaseId,h=a.firestore._databaseId;if(!h.isEqual(g))throw d.createError(`Document reference is for database ${h.projectId}/${h.database} but should be for database ${g.projectId}/${g.database}`);return{referenceValue:kh(a.firestore._databaseId||d.databaseId,a._key.path)}}if(a instanceof Wn)return(function(h,v){const _=h instanceof Wn?h.toArray():h;return{mapValue:{fields:{[Cy]:{stringValue:Ry},[ec]:{arrayValue:{values:_.map((M=>{if(typeof M!="number")throw v.createError("VectorValues must only contain numeric values.");return $u(v.serializer,M)}))}}}}}})(a,d);if(a4(a))return a._toProto(d.serializer);throw d.createError(`Unsupported field value: ${Wu(a)}`)})(r,e,t)}function h4(r,e){const t={};return Ay(r)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):ga(r,((o,a)=>{const d=ia(a,e.childContextForField(o));d!=null&&(t[o]=d)})),{mapValue:{fields:t}}}function v4(r){return!(typeof r!="object"||r===null||r instanceof Array||r instanceof Date||r instanceof Ct||r instanceof _s||r instanceof ko||r instanceof Vt||r instanceof wc||r instanceof Wn||a4(r))}function Mh(r,e,t){if(!v4(t)||!vc(t)){const o=Wu(t);throw o==="an object"?e.createError(r+" a custom object"):e.createError(r+" "+o)}}function la(r,e,t){if((e=_n(e))instanceof op)return e._internalPath;if(typeof e=="string")return b4(r,e);throw Pu("Field path arguments must be of type string or ",r,!1,void 0,t)}const R_=new RegExp("[~\\*/\\[\\]]");function b4(r,e,t){if(e.search(R_)>=0)throw Pu(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,r,!1,void 0,t);try{return new op(...e.split("."))._internalPath}catch{throw Pu(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,r,!1,void 0,t)}}function Pu(r,e,t,o,a){const d=o&&!o.isEmpty(),c=a!==void 0;let g=`Function ${e}
20742() called with invalid data`;t&&(g+=" (via `toFirestore()`)"),g+=". ";let h="";return(d||c)&&(h+=" (found",d&&(h+=` in field ${o}`),c&&(h+=` in document ${a}`),h+=")"),new pe(oe.INVALID_ARGUMENT,g+r+h)}function y4(r,e){return r.some((t=>t.isEqual(e)))}function D_(r){return typeof r._readUserData=="function"}/**
20743 * @license
20744 * Copyright 2025 Google LLC
20745 *
20746 * Licensed under the Apache License, Version 2.0 (the "License");
20747 * you may not use this file except in compliance with the License.
20748 * You may obtain a copy of the License at
20749 *
20750 *   http://www.apache.org/licenses/LICENSE-2.0
20751 *
20752 * Unless required by applicable law or agreed to in writing, software
20753 * distributed under the License is distributed on an "AS IS" BASIS,
20754 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20755 * See the License for the specific language governing permissions and
20756 * limitations under the License.
20757 */class Tn{constructor(e){this.optionDefinitions=e}_getKnownOptions(e,t){const o=Ln.empty();for(const a in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(a)){const d=this.optionDefinitions[a];if(a in e){const c=e[a];let g;d.nestedOptions&&vc(c)?g={mapValue:{fields:new Tn(d.nestedOptions).getOptionsProto(t,c)}}:c&&(g=ia(c,t)??void 0),g&&o.set(an.fromServerFormat(d.serverName),g)}}return o}getOptionsProto(e,t,o){const a=this._getKnownOptions(t,e);if(o){const d=new Map(tA(o,((c,g)=>[an.fromServerFormat(g),c!==void 0?ia(c,e):null])));a.setAll(d)}return a.value.mapValue.fields??{}}}/**
20758 * @license
20759 * Copyright 2024 Google LLC
20760 *
20761 * Licensed under the Apache License, Version 2.0 (the "License");
20762 * you may not use this file except in compliance with the License.
20763 * You may obtain a copy of the License at
20764 *
20765 *   http://www.apache.org/licenses/LICENSE-2.0
20766 *
20767 * Unless required by applicable law or agreed to in writing, software
20768 * distributed under the License is distributed on an "AS IS" BASIS,
20769 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20770 * See the License for the specific language governing permissions and
20771 * limitations under the License.
20772 */function M_(r){return typeof r=="object"&&r!==null&&!!("nullValue"in r&&(r.nullValue===null||r.nullValue==="NULL_VALUE")||"booleanValue"in r&&(r.booleanValue===null||typeof r.booleanValue=="boolean")||"integerValue"in r&&(r.integerValue===null||typeof r.integerValue=="number"||typeof r.integerValue=="string")||"doubleValue"in r&&(r.doubleValue===null||typeof r.doubleValue=="number")||"timestampValue"in r&&(r.timestampValue===null||(function(t){return typeof t=="object"&&t!==null&&"seconds"in t&&(t.seconds===null||typeof t.seconds=="number"||typeof t.seconds=="string")&&"nanos"in t&&(t.nanos===null||typeof t.nanos=="number")})(r.timestampValue))||"stringValue"in r&&(r.stringValue===null||typeof r.stringValue=="string")||"bytesValue"in r&&(r.bytesValue===null||r.bytesValue instanceof Uint8Array)||"referenceValue"in r&&(r.referenceValue===null||typeof r.referenceValue=="string")||"geoPointValue"in r&&(r.geoPointValue===null||(function(t){return typeof t=="object"&&t!==null&&"latitude"in t&&(t.latitude===null||typeof t.latitude=="number")&&"longitude"in t&&(t.longitude===null||typeof t.longitude=="number")})(r.geoPointValue))||"arrayValue"in r&&(r.arrayValue===null||(function(t){return typeof t=="object"&&t!==null&&!(!("values"in t)||t.values!==null&&!Array.isArray(t.values))})(r.arrayValue))||"mapValue"in r&&(r.mapValue===null||(function(t){return typeof t=="object"&&t!==null&&!(!("fields"in t)||t.fields!==null&&!vc(t.fields))})(r.mapValue))||"fieldReferenceValue"in r&&(r.fieldReferenceValue===null||typeof r.fieldReferenceValue=="string")||"functionValue"in r&&(r.functionValue===null||(function(t){return typeof t=="object"&&t!==null&&!(!("name"in t)||t.name!==null&&typeof t.name!="string"||!("args"in t)||t.args!==null&&!Array.isArray(t.args))})(r.functionValue))||"pipelineValue"in r&&(r.pipelineValue===null||(function(t){return typeof t=="object"&&t!==null&&!(!("stages"in t)||t.stages!==null&&!Array.isArray(t.stages))})(r.pipelineValue)))}
vendor: 14,401 bytes, lines 20772-20791
20772function T_(){return new Rh("serverTimestamp")}function I_(r){return new Dh("increment",r)}function O_(r){return new Wn(r)}/**
20773 * @license
20774 * Copyright 2024 Google LLC
20775 *
20776 * Licensed under the Apache License, Version 2.0 (the "License");
20777 * you may not use this file except in compliance with the License.
20778 * You may obtain a copy of the License at
20779 *
20780 *   http://www.apache.org/licenses/LICENSE-2.0
20781 *
20782 * Unless required by applicable law or agreed to in writing, software
20783 * distributed under the License is distributed on an "AS IS" BASIS,
20784 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20785 * See the License for the specific language governing permissions and
20786 * limitations under the License.
20787 */function de(r){let e;return r instanceof li?r:(e=vc(r)?U_(r):r instanceof Array?B_(r):x4(r,void 0),e)}function Mf(r){if(r instanceof li)return r;if(r instanceof Wn)return ic(r);if(Array.isArray(r))return ic(O_(r));throw new Error("Unsupported value: "+typeof r)}function Th(r){return J9(r)?L_(r):de(r)}class li{constructor(){this._protoValueType="ProtoValue"}add(e){return new Y("add",[this,de(e)],"add")}asBoolean(){if(this instanceof da)return this;if(this instanceof Sl)return new _4(this);if(this instanceof Ec)return new V_(this);if(this instanceof Y)return new A4(this);throw new pe("invalid-argument",`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(e){return new Y("subtract",[this,de(e)],"subtract")}multiply(e){return new Y("multiply",[this,de(e)],"multiply")}divide(e){return new Y("divide",[this,de(e)],"divide")}mod(e){return new Y("mod",[this,de(e)],"mod")}equal(e){return new Y("equal",[this,de(e)],"equal").asBoolean()}notEqual(e){return new Y("not_equal",[this,de(e)],"notEqual").asBoolean()}lessThan(e){return new Y("less_than",[this,de(e)],"lessThan").asBoolean()}lessThanOrEqual(e){return new Y("less_than_or_equal",[this,de(e)],"lessThanOrEqual").asBoolean()}greaterThan(e){return new Y("greater_than",[this,de(e)],"greaterThan").asBoolean()}greaterThanOrEqual(e){return new Y("greater_than_or_equal",[this,de(e)],"greaterThanOrEqual").asBoolean()}arrayConcat(e,...t){const o=[e,...t].map((a=>de(a)));return new Y("array_concat",[this,...o],"arrayConcat")}arrayContains(e){return new Y("array_contains",[this,de(e)],"arrayContains").asBoolean()}arrayContainsAll(e){const t=Array.isArray(e)?new Nd(e.map(de),"arrayContainsAll"):e;return new Y("array_contains_all",[this,t],"arrayContainsAll").asBoolean()}arrayContainsAny(e){const t=Array.isArray(e)?new Nd(e.map(de),"arrayContainsAny"):e;return new Y("array_contains_any",[this,t],"arrayContainsAny").asBoolean()}arrayReverse(){return new Y("array_reverse",[this])}arrayLength(){return new Y("array_length",[this],"arrayLength")}equalAny(e){const t=Array.isArray(e)?new Nd(e.map(de),"equalAny"):e;return new Y("equal_any",[this,t],"equalAny").asBoolean()}notEqualAny(e){const t=Array.isArray(e)?new Nd(e.map(de),"notEqualAny"):e;return new Y("not_equal_any",[this,t],"notEqualAny").asBoolean()}exists(){return new Y("exists",[this],"exists").asBoolean()}charLength(){return new Y("char_length",[this],"charLength")}like(e){return new Y("like",[this,de(e)],"like").asBoolean()}regexContains(e){return new Y("regex_contains",[this,de(e)],"regexContains").asBoolean()}regexFind(e){return new Y("regex_find",[this,de(e)],"regexFind")}regexFindAll(e){return new Y("regex_find_all",[this,de(e)],"regexFindAll")}regexMatch(e){return new Y("regex_match",[this,de(e)],"regexMatch").asBoolean()}stringContains(e){return new Y("string_contains",[this,de(e)],"stringContains").asBoolean()}startsWith(e){return new Y("starts_with",[this,de(e)],"startsWith").asBoolean()}endsWith(e){return new Y("ends_with",[this,de(e)],"endsWith").asBoolean()}toLower(){return new Y("to_lower",[this],"toLower")}toUpper(){return new Y("to_upper",[this],"toUpper")}trim(e){const t=[this];return e&&t.push(de(e)),new Y("trim",t,"trim")}ltrim(e){const t=[this];return e&&t.push(de(e)),new Y("ltrim",t,"ltrim")}rtrim(e){const t=[this];return e&&t.push(de(e)),new Y("rtrim",t,"rtrim")}type(){return new Y("type",[this])}isType(e){return new Y("is_type",[this,ic(e)],"isType").asBoolean()}stringConcat(e,...t){const o=[e,...t].map(de);return new Y("string_concat",[this,...o],"stringConcat")}stringIndexOf(e){return new Y("string_index_of",[this,de(e)],"stringIndexOf")}stringRepeat(e){return new Y("string_repeat",[this,de(e)],"stringRepeat")}stringReplaceAll(e,t){return new Y("string_replace_all",[this,de(e),de(t)],"stringReplaceAll")}stringReplaceOne(e,t){return new Y("string_replace_one",[this,de(e),de(t)],"stringReplaceOne")}concat(e,...t){const o=[e,...t].map(de);return new Y("concat",[this,...o],"concat")}reverse(){return new Y("reverse",[this],"reverse")}arrayFilter(e,t){return new Y("array_filter",[this,de(e),t],"arrayFilter")}arrayTransform(e,t){return new Y("array_transform",[this,de(e),t],"arrayTransform")}arrayTransformWithIndex(e,t,o){return new Y("array_transform",[this,de(e),de(t),o],"arrayTransformWithIndex")}arraySlice(e,t){const o=[this,de(e)];return t!==void 0&&o.push(de(t)),new Y("array_slice",o,"arraySlice")}arrayFirst(){return new Y("array_first",[this],"arrayFirst")}arrayFirstN(e){return new Y("array_first_n",[this,de(e)],"arrayFirstN")}arrayLast(){return new Y("array_last",[this],"arrayLast")}arrayLastN(e){return new Y("array_last_n",[this,de(e)],"arrayLastN")}arrayMaximum(){return new Y("maximum",[this],"arrayMaximum")}arrayMaximumN(e){return new Y("maximum_n",[this,de(e)],"arrayMaximumN")}arrayMinimum(){return new Y("minimum",[this],"arrayMinimum")}arrayMinimumN(e){return new Y("minimum_n",[this,de(e)],"arrayMinimumN")}arrayIndexOf(e){return new Y("array_index_of",[this,de(e),de("first")],"arrayIndexOf")}arrayLastIndexOf(e){return new Y("array_index_of",[this,de(e),de("last")],"arrayLastIndexOf")}arrayIndexOfAll(e){return new Y("array_index_of_all",[this,de(e)],"arrayIndexOfAll")}byteLength(){return new Y("byte_length",[this],"byteLength")}ceil(){return new Y("ceil",[this])}floor(){return new Y("floor",[this])}abs(){return new Y("abs",[this])}exp(){return new Y("exp",[this])}mapGet(e){return new Y("map_get",[this,ic(e)],"mapGet")}mapSet(e,t,...o){const a=[this,de(e),de(t),...o.map(de)];return new Y("map_set",a,"mapSet")}mapKeys(){return new Y("map_keys",[this],"mapKeys")}mapValues(){return new Y("map_values",[this],"mapValues")}mapEntries(){return new Y("map_entries",[this],"mapEntries")}getField(e){return new Y("get_field",[this,de(e)],"get_field")}count(){return lo._create("count",[this],"count")}sum(){return lo._create("sum",[this],"sum")}average(){return lo._create("average",[this],"average")}minimum(){return lo._create("minimum",[this],"minimum")}maximum(){return lo._create("maximum",[this],"maximum")}first(){return lo._create("first",[this],"first")}last(){return lo._create("last",[this],"last")}arrayAgg(){return lo._create("array_agg",[this],"arrayAgg")}arrayAggDistinct(){return lo._create("array_agg_distinct",[this],"arrayAggDistinct")}countDistinct(){return lo._create("count_distinct",[this],"countDistinct")}logicalMaximum(e,...t){const o=[e,...t];return new Y("maximum",[this,...o.map(de)],"logicalMaximum")}logicalMinimum(e,...t){const o=[e,...t];return new Y("minimum",[this,...o.map(de)],"minimum")}vectorLength(){return new Y("vector_length",[this],"vectorLength")}cosineDistance(e){return new Y("cosine_distance",[this,Mf(e)],"cosineDistance")}dotProduct(e){return new Y("dot_product",[this,Mf(e)],"dotProduct")}euclideanDistance(e){return new Y("euclidean_distance",[this,Mf(e)],"euclideanDistance")}unixMicrosToTimestamp(){return new Y("unix_micros_to_timestamp",[this],"unixMicrosToTimestamp")}timestampToUnixMicros(){return new Y("timestamp_to_unix_micros",[this],"timestampToUnixMicros")}unixMillisToTimestamp(){return new Y("unix_millis_to_timestamp",[this],"unixMillisToTimestamp")}timestampToUnixMillis(){return new Y("timestamp_to_unix_millis",[this],"timestampToUnixMillis")}unixSecondsToTimestamp(){return new Y("unix_seconds_to_timestamp",[this],"unixSecondsToTimestamp")}timestampToUnixSeconds(){return new Y("timestamp_to_unix_seconds",[this],"timestampToUnixSeconds")}timestampAdd(e,t){return new Y("timestamp_add",[this,de(e),de(t)],"timestampAdd")}timestampSubtract(e,t){return new Y("timestamp_subtract",[this,de(e),de(t)],"timestampSubtract")}timestampDiff(e,t){return new Y("timestamp_diff",[this,Th(e),de(t)],"timestampDiff")}timestampExtract(e,t){const o=[this,de(e)];return t&&o.push(de(t)),new Y("timestamp_extract",o,"timestampExtract")}documentId(){return new Y("document_id",[this],"documentId")}parent(){return new Y("parent",[this],"parent")}substring(e,t){const o=de(e);return new Y("substring",t===void 0?[this,o]:[this,o,de(t)],"substring")}arrayGet(e){return new Y("array_get",[this,de(e)],"arrayGet")}isError(){return new Y("is_error",[this],"isError").asBoolean()}ifError(e){const t=new Y("if_error",[this,de(e)],"ifError");return e instanceof da?t.asBoolean():t}isAbsent(){return new Y("is_absent",[this],"isAbsent").asBoolean()}mapRemove(e){return new Y("map_remove",[this,de(e)],"mapRemove")}mapMerge(e,...t){const o=de(e),a=t.map(de);return new Y("map_merge",[this,o,...a],"mapMerge")}pow(e){return new Y("pow",[this,de(e)])}trunc(e){return e===void 0?new Y("trunc",[this]):new Y("trunc",[this,de(e)],"trunc")}round(e){return e===void 0?new Y("round",[this]):new Y("round",[this,de(e)],"round")}collectionId(){return new Y("collection_id",[this])}length(){return new Y("length",[this])}ln(){return new Y("ln",[this])}sqrt(){return new Y("sqrt",[this])}stringReverse(){return new Y("string_reverse",[this])}ifAbsent(e){return new Y("if_absent",[this,de(e)],"ifAbsent")}ifNull(e){return new Y("if_null",[this,de(e)],"ifNull")}coalesce(e,...t){return new Y("coalesce",[this,de(e),...t.map(de)],"coalesce")}join(e){return new Y("join",[this,de(e)],"join")}log10(){return new Y("log10",[this])}arraySum(){return new Y("sum",[this])}split(e){return new Y("split",[this,de(e)])}timestampTruncate(e,t){const o=[this,de(e)];return t&&o.push(de(t)),new Y("timestamp_trunc",o)}ascending(){return G_(this)}descending(){return q_(this)}as(e){return new z_(this,e,"as")}}class lo{constructor(e,t){this.name=e,this.params=t,this.exprType="AggregateFunction",this._protoValueType="ProtoValue"}static _create(e,t,o){const a=new lo(e,t);return a._methodName=o,a}as(e){return new P_(this,e,"as")}_toProto(e){return{functionValue:{name:this.name,args:this.params.map((t=>t._toProto(e)))}}}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach((t=>t._readUserData(e)))}}class P_{constructor(e,t,o){this.aggregate=e,this.alias=t,this._methodName=o}_readUserData(e){this.aggregate._readUserData(e)}}class z_{constructor(e,t,o){this.expr=e,this.alias=t,this._methodName=o,this.exprType="AliasedExpression",this.selectable=!0}_readUserData(e){this.expr._readUserData(e)}}class Nd extends li{constructor(e,t){super(),this.Rr=e,this._methodName=t,this.expressionType="ListOfExpressions"}_toProto(e){return{arrayValue:{values:this.Rr.map((t=>t._toProto(e)))}}}_readUserData(e){this.Rr.forEach((t=>t._readUserData(e)))}}class Ec extends li{constructor(e,t){super(),this.fieldPath=e,this._methodName=t,this.expressionType="Field",this.selectable=!0}get _fieldPath(){return this.fieldPath}get fieldName(){return this.fieldPath.canonicalString()}get alias(){return this.fieldName}get expr(){return this}geoDistance(e){return new Y("geo_distance",[this,de(e)],"geoDistance")}_toProto(e){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(e){}}function L_(r){return N_(r,"field")}function N_(r,e){return new Ec(typeof r=="string"?ul===r?o_()._internalPath:la("field",r):r._internalPath,e)}class Sl extends li{constructor(e,t){super(),this.value=e,this._methodName=t,this.expressionType="Constant"}static _fromProto(e){const t=new Sl(e,void 0);return t._protoValue=e,t}_toProto(e){return Ae(this._protoValue!==void 0,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,M_(this._protoValue)||(this._protoValue=ia(this.value,e))}}function ic(r,e){return x4(r,"constant")}function x4(r,e){const t=new Sl(r,e);return typeof r=="boolean"?new _4(t):t}class Y extends li{constructor(e,t,o,a){super(),this.name=e,this.params=t,this.expressionType="Function",this._optionsProto=void 0,o!==void 0&&(this._methodName=o),a!==void 0&&(this._options=a)}get _optionsUtil(){return new Tn({})}_toProto(e){const t={functionValue:{name:this.name,args:this.params.map((o=>o._toProto(e)))}};return this._optionsProto&&(t.functionValue.options=this._optionsProto),t}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach((t=>t._readUserData(e))),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(e,this._options))}}class da extends li{get _methodName(){return this._expr._methodName}countIf(){return lo._create("count_if",[this],"countIf")}not(){return new Y("not",[this],"not").asBoolean()}conditional(e,t){return new Y("conditional",[this,e,t],"conditional")}ifError(e){const t=de(e),o=new Y("if_error",[this,t],"ifError");return t instanceof da?o.asBoolean():o}_toProto(e){return this._expr._toProto(e)}_readUserData(e){this._expr._readUserData(e)}}class A4 extends da{constructor(e){super(),this._expr=e,this.expressionType="Function"}}class _4 extends da{constructor(e){super(),this._expr=e,this.expressionType="Constant"}_getValue(){return this._expr._getValue()}}class V_ extends da{constructor(e){super(),this._expr=e,this.expressionType="Field"}}function U_(r,e){const t=[];for(const o in r)if(Object.prototype.hasOwnProperty.call(r,o)){const a=r[o];t.push(ic(o)),t.push(de(a))}return new Y("map",t,"map")}function B_(r){return(function(t,o){return new Y("array",t.map((a=>de(a))),o)})(r,"array")}function G_(r){return new w4(Th(r),"ascending","ascending")}function q_(r){return new w4(Th(r),"descending","descending")}class w4{constructor(e,t,o){this.expr=e,this.direction=t,this._methodName=o,this._protoValueType="ProtoValue"}_toProto(e){return{mapValue:{fields:{direction:i4(this.direction),expression:this.expr._toProto(e)}}}}_readUserData(e){this.expr._readUserData(e)}}/**
20788 * @license
20789 * Copyright 2024 Google LLC
20790 *
20791 * Licensed under the Apache License, Version 2.0 (the "License");
20792 * you may not use this file except in compliance with the License.
20793 * You may obtain a copy of the License at
20794 *
20795 *   http://www.apache.org/licenses/LICENSE-2.0
20796 *
20797 * Unless required by applicable law or agreed to in writing, software
20798 * distributed under the License is distributed on an "AS IS" BASIS,
20799 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20800 * See the License for the specific language governing permissions and
20801 * limitations under the License.
20802 */class uo{constructor(e){this.optionsProto=void 0,{rawOptions:this.rawOptions,...this.knownOptions}=e}_readUserData(e){this.optionsProto=this._optionsUtil.getOptionsProto(e,this.knownOptions,this.rawOptions)}_toProto(e){return{name:this._name,options:this.optionsProto}}}class E4 extends uo{get _name(){return"add_fields"}get _optionsUtil(){return new Tn({})}constructor(e,t){super(t),this.fields=e}_toProto(e){return{...super._toProto(e),args:[ac(e,this.fields)]}}_readUserData(e){super._readUserData(e),ca(this.fields,e)}}class S4 extends uo{get _name(){return"aggregate"}get _optionsUtil(){return new Tn({})}constructor(e,t,o){super(o),this.groups=e,this.accumulators=t}_toProto(e){return{...super._toProto(e),args:[ac(e,this.accumulators),ac(e,this.groups)]}}_readUserData(e){super._readUserData(e),ca(this.groups,e),ca(this.accumulators,e)}}class k4 extends uo{get _name(){return"distinct"}get _optionsUtil(){return new Tn({})}constructor(e,t){super(t),this.groups=e}_toProto(e){return{...super._toProto(e),args:[ac(e,this.groups)]}}_readUserData(e){super._readUserData(e),ca(this.groups,e)}}class ip extends uo{get _name(){return"collection"}get _optionsUtil(){return new Tn({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.Vr=e.startsWith("/")?e:"/"+e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:this.Vr}]}}_readUserData(e){super._readUserData(e)}}class lp extends uo{get _name(){return"collection_group"}get _optionsUtil(){return new Tn({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.collectionId=e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:""},{stringValue:this.collectionId}]}}_readUserData(e){super._readUserData(e)}}class Ih extends uo{get _name(){return"database"}get _optionsUtil(){return new Tn({})}_toProto(e){return{...super._toProto(e)}}_readUserData(e){super._readUserData(e)}}class Oh extends uo{get _name(){return"documents"}get _optionsUtil(){return new Tn({})}constructor(e,t){if(super(t),!e||e.length===0)throw new pe(oe.INVALID_ARGUMENT,"Empty document paths are not allowed in DocumentsSource");const o=e.map((d=>d.startsWith("/")?d:"/"+d)),a=new Set(o);if(a.size!==o.length)throw new pe(oe.INVALID_ARGUMENT,"Duplicate document paths are not allowed in DocumentsSource");this.dr=o,this.mr=a}_toProto(e){return{...super._toProto(e),args:this.dr.map((t=>({referenceValue:t})))}}_readUserData(e){super._readUserData(e)}}class Ph extends uo{get _name(){return"where"}get _optionsUtil(){return new Tn({})}constructor(e,t){super(t),this.condition=e}_toProto(e){return{...super._toProto(e),args:[this.condition._toProto(e)]}}_readUserData(e){super._readUserData(e),ca(this.condition,e)}}class lc extends uo{get _name(){return"limit"}get _optionsUtil(){return new Tn({})}constructor(e,t){Ae(!isNaN(e)&&e!==1/0&&e!==-1/0,34860),super(t),this.limit=e}_toProto(e){return{...super._toProto(e),args:[Ju(e,this.limit)]}}}class c5 extends uo{get _name(){return"offset"}get _optionsUtil(){return new Tn({})}constructor(e,t){super(t),this.offset=e}_toProto(e){return{...super._toProto(e),args:[Ju(e,this.offset)]}}}class F_ extends uo{get _name(){return"select"}get _optionsUtil(){return new Tn({})}constructor(e,t){super(t),this.selections=e}_toProto(e){return{...super._toProto(e),args:[ac(e,this.selections)]}}_readUserData(e){super._readUserData(e),ca(this.selections,e)}}class zh extends uo{get _name(){return"sort"}get _optionsUtil(){return new Tn({})}constructor(e,t){super(t),this.orderings=e}_toProto(e){return{...super._toProto(e),args:this.orderings.map((t=>t._toProto(e)))}}_readUserData(e){super._readUserData(e),ca(this.orderings,e)}}class Lh extends uo{get _name(){return"replace_with"}get _optionsUtil(){return new Tn({})}constructor(e,t){super(t),this.map=e}_toProto(e){return{...super._toProto(e),args:[this.map._toProto(e),i4(Lh.pr)]}}_readUserData(e){super._readUserData(e),ca(this.map,e)}}Lh.pr="full_replace";function ca(r,e){return D_(r)?r._readUserData(e):Array.isArray(r)?r.forEach((t=>t._readUserData(e))):r instanceof Map?r.forEach((t=>t._readUserData(e))):Object.values(r).forEach((t=>t._readUserData(e))),r}// Copyright 2024 Google LLC* @license
20803class Xn{constructor(e,t,o){this.serializer=e,this.stages=t,this.listenOptions=o,this.isCorePipeline=!0}getPipelineCollection(){return dp(this)}getPipelineCollectionGroup(){return Nh(this)}getPipelineCollectionId(){return j_(this)}getPipelineDocuments(){return nh(this)}getPipelineFlavor(){return(function(t){let o="exact";return t.stages.forEach(((a,d)=>{a._name!==k4.name&&a._name!==S4.name||(o="keyless"),a._name===F_.name&&o==="exact"&&(o="augmented"),a._name===E4.name&&d<t.stages.length-1&&o==="exact"&&(o="augmented")})),o})(this)}getPipelineSourceType(){return Zr(this)}}function Zr(r){const e=r.stages[0];return e instanceof ip||e instanceof lp||e instanceof Ih||e instanceof Oh?e._name:"unknown"}function dp(r){if(Zr(r)==="collection")return r.stages[0].Vr}function Nh(r){if(Zr(r)==="collection_group")return r.stages[0].collectionId}function j_(r){switch(Zr(r)){case"collection":return ut.fromString(dp(r)).lastSegment();case"collection_group":return Nh(r);default:return}}function nh(r){if(Zr(r)==="documents")return r.stages[0].dr}// Copyright 2024 Google LLC* @license
20804class V{constructor(e,t){this.type=e,this.value=t}static vr(){return new V("ERROR",void 0)}static Sr(){return new V("UNSET",void 0)}static Dr(){return new V("NULL",gl)}static newValue(e){return mo(e)?new V("NULL",gl):(function(o){return!!o&&"booleanValue"in o})(e)?new V("BOOLEAN",e):bs(e)?new V("INT",e):Ya(e)?new V("DOUBLE",e):(function(o){return!!o&&"timestampValue"in o&&!!o.timestampValue})(e)?new V("TIMESTAMP",e):(function(o){return!!o&&"stringValue"in o})(e)?new V("STRING",e):(function(o){return!!o&&"bytesValue"in o})(e)?new V("BYTES",e):e.referenceValue?new V("REFERENCE",e):e.geoPointValue?new V("GEO_POINT",e):hl(e)?new V("ARRAY",e):Su(e)?new V("VECTOR",e):Ja(e)?new V("MAP",e):new V("ERROR",void 0)}Cr(){return this.type==="ERROR"||this.type==="UNSET"}Fr(){return this.type==="NULL"}}function Hd(r){if(!r.Cr())return r.value}function C4(r){return r instanceof da?r._expr:r}function Ie(r){if((r=C4(r))instanceof Ec)return new X_(r);if(r instanceof Sl)return new H_(r);if(r instanceof Nd)return new W_(r);if(r instanceof Y){if(r.name==="add")return new Y_(r);if(r.name==="subtract")return new $_(r);if(r.name==="multiply")return new J_(r);if(r.name==="divide")return new Z_(r);if(r.name==="mod")return new ew(r);if(r.name==="and")return new tw(r);if(r.name==="equal")return new pw(r);if(r.name==="not_equal")return new gw(r);if(r.name==="less_than")return new fw(r);if(r.name==="less_than_or_equal")return new hw(r);if(r.name==="greater_than")return new vw(r);if(r.name==="greater_than_or_equal")return new bw(r);if(r.name==="array_concat")return new yw(r);if(r.name==="array_reverse")return new xw(r);if(r.name==="array_contains")return new Aw(r);if(r.name==="array_contains_all")return new _w(r);if(r.name==="array_contains_any")return new ww(r);if(r.name==="array_length")return new Ew(r);if(r.name==="array_element")return new Sw(r);if(r.name==="equal_any")return new R4(r);if(r.name==="not_equal_any")return new ow(r);if(r.name==="is_nan")return new sw(r);if(r.name==="is_not_nan")return new rw(r);if(r.name==="is_null")return new aw(r);if(r.name==="is_not_null")return new iw(r);if(r.name==="is_error")return new lw(r);if(r.name==="exists")return new dw(r);if(r.name==="not")return new cp(r);if(r.name==="or")return new nw(r);if(r.name==="xor")return new Vh(r);if(r.name==="conditional")return new cw(r);if(r.name==="maximum")return new mw(r);if(r.name==="minimum")return new uw(r);if(r.name==="reverse")return new kw(r);if(r.name==="replace_first")return new Cw(r);if(r.name==="replace_all")return new Rw(r);if(r.name==="char_length")return new Dw(r);if(r.name==="byte_length")return new Mw(r);if(r.name==="like")return new Tw(r);if(r.name==="regex_contains")return new Iw(r);if(r.name==="regex_match")return new Ow(r);if(r.name==="string_contains")return new Pw(r);if(r.name==="starts_with")return new zw(r);if(r.name==="ends_with")return new Lw(r);if(r.name==="to_lower")return new Nw(r);if(r.name==="to_upper")return new Vw(r);if(r.name==="trim")return new Uw(r);if(r.name==="string_concat")return new Bw(r);if(r.name==="map_get")return new Gw(r);if(r.name==="cosine_distance")return new qw(r);if(r.name==="dot_product")return new Fw(r);if(r.name==="euclidean_distance")return new jw(r);if(r.name==="vector_length")return new Xw(r);if(r.name==="unix_micros_to_timestamp")return new Yw(r);if(r.name==="timestamp_to_unix_micros")return new Zw(r);if(r.name==="unix_millis_to_timestamp")return new $w(r);if(r.name==="timestamp_to_unix_millis")return new eE(r);if(r.name==="unix_seconds_to_timestamp")return new Jw(r);if(r.name==="timestamp_to_unix_seconds")return new tE(r);if(r.name==="timestamp_add")return new nE(r);if(r.name==="timestamp_subtract")return new oE(r)}throw new Error(`Unknown Expr : ${r}`)}class X_{constructor(e){this.expr=e}evaluate(e,t){if(this.expr.fieldName===ul)return V.newValue({referenceValue:Iu(e.serializer,t.key)});if(this.expr.fieldName==="__update_time__")return V.newValue({timestampValue:gu(e.serializer,t.version)});if(this.expr.fieldName==="__create_time__")return V.newValue({timestampValue:gu(e.serializer,t.createTime)});const o=t.data.field(this.expr._fieldPath);return o?Yu(o)?V.newValue((function(d,c){if(d.serverTimestampBehavior==="estimate")return{timestampValue:gu(d.serializer,Ne.fromTimestamp(pl(c)))};if(d.serverTimestampBehavior==="previous"){const g=yc(c);if(g)return g}return{nullValue:"NULL_VALUE"}})(e,o)):V.newValue(o):V.Sr()}}class H_{constructor(e){this.expr=e}evaluate(e,t){return V.newValue(this.expr._getValue())}}class W_{constructor(e){this.expr=e}evaluate(e,t){const o=this.expr.Rr.map((a=>Ie(a).evaluate(e,t)));return o.some((a=>a.Cr()))?V.vr():V.newValue({arrayValue:{values:o.map((a=>a.value))}})}}function wn(r){return Ya(r)?Number(r.doubleValue):Number(r.integerValue)}function Ss(r){return BigInt(r.integerValue)}const K_=BigInt("0x7fffffffffffffff"),Q_=-BigInt("0x8000000000000000");class Sc{constructor(e){this.expr=e}evaluate(e,t){Ae(this.expr.params.length>=2,24778);const o=Ie(this.expr.params[0]).evaluate(e,t),a=Ie(this.expr.params[1]).evaluate(e,t);let d=this.Or(o,a);for(const c of this.expr.params.slice(2)){const g=Ie(c).evaluate(e,t);d=this.Or(d,g)}return d}Or(e,t){if(e.Cr()||t.Cr())return V.vr();if(e.Fr()||t.Fr())return V.Dr();const o=e.value,a=t.value;if(!Ya(o)&&!bs(o)||!Ya(a)&&!bs(a))return V.vr();if(Ya(o)||Ya(a)){const d=this.Mr(o,a);return d?V.newValue(d):V.vr()}if(bs(o)&&bs(a)){const d=this.Nr(o,a);return d===void 0?V.vr():typeof d=="number"?V.newValue({doubleValue:d}):d<Q_||d>K_?V.vr():V.newValue({integerValue:`${d}`})}return V.vr()}}
20804function or(r,e){return sn(r)!==sn(e)?"TYPE_MISMATCH":Yn(r)||Yn(e)?"NOT_EQ":mo(r)&&mo(e)?"EQ":mo(r)||mo(e)?"NULL":hl(r)&&hl(e)?(function(o,a){var c,g,h;if(((c=o.values)==null?void 0:c.length)!==((g=a.values)==null?void 0:g.length))return"NOT_EQ";let d=!1;for(let v=0;v<(((h=o.values)==null?void 0:h.length)??0);v++){const _=o.values[v],E=a.values[v];switch(or(_,E)){case"EQ":break;case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":d=!0;break;default:De(44609,{Lr:_,Br:E})}}return d?"NULL":"EQ"})(r.arrayValue,e.arrayValue):Su(r)&&Su(e)||Ja(r)&&Ja(e)?(function(o,a){const d=o.fields||{},c=a.fields||{};if(wu(d)!==wu(c))return"NOT_EQ";let g=!1;for(const h in d)if(d.hasOwnProperty(h)){if(c[h]===void 0)return"NOT_EQ";switch(or(d[h],c[h])){case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":g=!0}}return g?"NULL":"EQ"})(r.mapValue,e.mapValue):(function(o,a){return Ro(o,a,{Te:!1,Ee:!0,he:!0})})(r,e)?"EQ":"NOT_EQ"}class Y_ extends Sc{Nr(e,t){return Ss(e)+Ss(t)}Mr(e,t){return{doubleValue:wn(e)+wn(t)}}}class $_ extends Sc{constructor(e){super(e),this.expr=e}Nr(e,t){return Ss(e)-Ss(t)}Mr(e,t){return{doubleValue:wn(e)-wn(t)}}}class J_ extends Sc{constructor(e){super(e),this.expr=e}Nr(e,t){return Ss(e)*Ss(t)}Mr(e,t){return{doubleValue:wn(e)*wn(t)}}}class Z_ extends Sc{constructor(e){super(e),this.expr=e}Nr(e,t){const o=Ss(t);if(o!==BigInt(0))return Ss(e)/o}Mr(e,t){const o=wn(t);return o===0?{doubleValue:Jd(o)?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}:{doubleValue:wn(e)/o}}}class ew extends Sc{constructor(e){super(e),this.expr=e}Nr(e,t){const o=Ss(t);if(o!==BigInt(0))return Ss(e)%o}Mr(e,t){const o=wn(t);if(o!==0)return{doubleValue:wn(e)%o}}}class tw{constructor(e){this.expr=e}evaluate(e,t){var d;let o=!1,a=!1;for(const c of this.expr.params){const g=Ie(c).evaluate(e,t);switch(g.type){case"BOOLEAN":if(!((d=g.value)!=null&&d.booleanValue))return V.newValue(pn);break;case"NULL":a=!0;break;default:o=!0}}return o?V.vr():a?V.Dr():V.newValue(Kn)}}class cp{constructor(e){this.expr=e}evaluate(e,t){var a;Ae(this.expr.params.length===1,9634);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"BOOLEAN":return V.newValue({booleanValue:!((a=o.value)!=null&&a.booleanValue)});case"NULL":return V.Dr();default:return V.vr()}}}class nw{constructor(e){this.expr=e}evaluate(e,t){var d;let o=!1,a=!1;for(const c of this.expr.params){const g=Ie(c).evaluate(e,t);switch(g.type){case"BOOLEAN":if((d=g.value)!=null&&d.booleanValue)return V.newValue(Kn);break;case"NULL":a=!0;break;default:o=!0}}return o?V.vr():a?V.Dr():V.newValue(pn)}}class Vh{constructor(e){this.expr=e}evaluate(e,t){var d;let o=!1,a=!1;for(const c of this.expr.params){const g=Ie(c).evaluate(e,t);switch(g.type){case"BOOLEAN":o=Vh.xor(o,!!((d=g.value)!=null&&d.booleanValue));break;case"NULL":a=!0;break;default:return V.vr()}}return a?V.Dr():V.newValue({booleanValue:o})}static xor(e,t){return(e||t)&&!(e&&t)}}class R4{constructor(e){this.expr=e}evaluate(e,t){var c,g;Ae(this.expr.params.length===2,55094);let o=!1;const a=Ie(this.expr.params[0]).evaluate(e,t);switch(a.type){case"NULL":o=!0;break;case"ERROR":case"UNSET":return V.vr()}const d=Ie(this.expr.params[1]).evaluate(e,t);switch(d.type){case"ARRAY":break;case"NULL":o=!0;break;default:return V.vr()}if(o)return V.Dr();for(const h of((g=(c=d.value)==null?void 0:c.arrayValue)==null?void 0:g.values)??[])switch(mo(a.value)&&mo(h)?"EQ":or(a.value,h)){case"EQ":return V.newValue(Kn);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":o=!0;break;default:De(44608,{value:a.value,candidate:h})}return o?V.Dr():V.newValue(pn)}}class ow{constructor(e){this.expr=e}evaluate(e,t){return new cp(new Y("not",[new Y("equal_any",this.expr.params)])).evaluate(e,t)}}class sw{constructor(e){this.expr=e}evaluate(e,t){Ae(this.expr.params.length===1,23322);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"INT":return V.newValue(pn);case"DOUBLE":return V.newValue({booleanValue:isNaN(wn(o.value))});case"NULL":return V.Dr();default:return V.vr()}}}class rw{constructor(e){this.expr=e}evaluate(e,t){return Ae(this.expr.params.length===1,50406),new cp(new Y("not",[new Y("is_nan",this.expr.params)])).evaluate(e,t)}}class aw{constructor(e){this.expr=e}evaluate(e,t){switch(Ae(this.expr.params.length===1,23123),Ie(this.expr.params[0]).evaluate(e,t).type){case"NULL":return V.newValue(Kn);case"UNSET":case"ERROR":return V.vr();default:return V.newValue(pn)}}}class iw{constructor(e){this.expr=e}evaluate(e,t){return Ae(this.expr.params.length===1,23167),new cp(new Y("not",[new Y("is_null",this.expr.params)])).evaluate(e,t)}}class lw{constructor(e){this.expr=e}evaluate(e,t){return Ae(this.expr.params.length===1,5228),Ie(this.expr.params[0]).evaluate(e,t).type==="ERROR"?V.newValue(Kn):V.newValue(pn)}}class dw{constructor(e){this.expr=e}evaluate(e,t){switch(Ae(this.expr.params.length===1,6877),Ie(this.expr.params[0]).evaluate(e,t).type){case"ERROR":return V.vr();case"UNSET":return V.newValue(pn);default:return V.newValue(Kn)}}}class cw{constructor(e){this.expr=e}evaluate(e,t){var a;Ae(this.expr.params.length===3,11706);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"BOOLEAN":return(a=o.value)!=null&&a.booleanValue?Ie(this.expr.params[1]).evaluate(e,t):Ie(this.expr.params[2]).evaluate(e,t);case"NULL":return Ie(this.expr.params[2]).evaluate(e,t);default:return V.vr()}}}class mw{constructor(e){this.expr=e}evaluate(e,t){const o=this.expr.params.map((d=>Ie(d).evaluate(e,t)));let a;for(const d of o)switch(d.type){case"ERROR":case"UNSET":case"NULL":continue;default:a=a===void 0||Qn(d.value,a.value)>0?d:a}return a===void 0?V.Dr():a}}class uw{constructor(e){this.expr=e}evaluate(e,t){const o=this.expr.params.map((d=>Ie(d).evaluate(e,t)));let a;for(const d of o)switch(d.type){case"ERROR":case"UNSET":case"NULL":continue;default:a=a===void 0||Qn(d.value,a.value)<0?d:a}return a===void 0?V.Dr():a}}class kl{constructor(e){this.expr=e}evaluate(e,t){Ae(this.expr.params.length===2,31033,`${this.expr.name}() function should have exactly 2 params`);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"ERROR":case"UNSET":return V.vr()}const a=Ie(this.expr.params[1]).evaluate(e,t);switch(a.type){case"ERROR":case"UNSET":return V.vr()}return this.Ur(o,a)}}class pw extends kl{constructor(e){super(e),this.expr=e}Ur(e,t){if(e.Fr()&&t.Fr())return V.newValue(Kn);if(e.Fr()||t.Fr()||Yn(e.value)||Yn(t.value)||sn(e.value)!==sn(t.value))return V.newValue(pn);switch(or(e.value,t.value)){case"EQ":return V.newValue(Kn);case"NOT_EQ":return V.newValue(pn);case"NULL":return V.Dr();default:De(44615,{left:e,right:t})}}}class gw extends kl{constructor(e){super(e),this.expr=e}Ur(e,t){switch(or(e.value,t.value)){case"EQ":return V.newValue(pn);case"NOT_EQ":case"TYPE_MISMATCH":return V.newValue(Kn);case"NULL":return V.Dr();default:De(44614,{left:e,right:t})}}}class fw extends kl{constructor(e){super(e),this.expr=e}Ur(e,t){return sn(e.value)!==sn(t.value)||Yn(e.value)||Yn(t.value)?V.newValue(pn):V.newValue({booleanValue:Qn(e.value,t.value)<0})}}class hw extends kl{constructor(e){super(e),this.expr=e}Ur(e,t){return sn(e.value)!==sn(t.value)||Yn(e.value)||Yn(t.value)?V.newValue(pn):or(e.value,t.value)==="EQ"?V.newValue(Kn):V.newValue({booleanValue:Qn(e.value,t.value)<0})}}class vw extends kl{constructor(e){super(e),this.expr=e}Ur(e,t){return sn(e.value)!==sn(t.value)||Yn(e.value)||Yn(t.value)?V.newValue(pn):V.newValue({booleanValue:Qn(e.value,t.value)>0})}}class bw extends kl{constructor(e){super(e),this.expr=e}Ur(e,t){return sn(e.value)!==sn(t.value)||Yn(e.value)||Yn(t.value)?V.newValue(pn):or(e.value,t.value)==="EQ"?V.newValue(Kn):V.newValue({booleanValue:Qn(e.value,t.value)>0})}}class yw{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class xw{constructor(e){this.expr=e}evaluate(e,t){var a;Ae(this.expr.params.length===1,216);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"NULL":return V.Dr();case"ARRAY":{const d=((a=o.value.arrayValue)==null?void 0:a.values)??[];return V.newValue({arrayValue:{values:[...d].reverse()}})}default:return V.vr()}}}class Aw{constructor(e){this.expr=e}evaluate(e,t){return Ae(this.expr.params.length===2,52884),new R4(new Y("eq_any",[this.expr.params[1],this.expr.params[0]])).evaluate(e,t)}}class _w{constructor(e){this.expr=e}evaluate(e,t){var h,v,_,E;Ae(this.expr.params.length===2,1392);let o=!1;const a=Ie(this.expr.params[0]).evaluate(e,t);switch(a.type){case"ARRAY":break;case"NULL":o=!0;break;default:return V.vr()}const d=Ie(this.expr.params[1]).evaluate(e,t);switch(d.type){case"ARRAY":break;case"NULL":o=!0;break;default:return V.vr()}if(o)return V.Dr();const c=((v=(h=d.value)==null?void 0:h.arrayValue)==null?void 0:v.values)??[],g=((E=(_=a.value)==null?void 0:_.arrayValue)==null?void 0:E.values)??[];for(const M of c){let G=!1;o=!1;for(const B of g){switch(mo(M)&&mo(B)?"EQ":or(M,B)){case"EQ":G=!0;break;case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":o=!0;break;default:De(44613,{value:B,search:M})}if(G)break}if(!G)return V.newValue(pn)}return V.newValue(Kn)}}class ww{constructor(e){this.expr=e}evaluate(e,t){var h,v,_,E;Ae(this.expr.params.length===2,2680);let o=!1;const a=Ie(this.expr.params[0]).evaluate(e,t);switch(a.type){case"ARRAY":break;case"NULL":o=!0;break;default:return V.vr()}const d=Ie(this.expr.params[1]).evaluate(e,t);switch(d.type){case"ARRAY":break;case"NULL":o=!0;break;default:return V.vr()}if(o)return V.Dr();const c=((v=(h=d.value)==null?void 0:h.arrayValue)==null?void 0:v.values)??[],g=((E=(_=a.value)==null?void 0:_.arrayValue)==null?void 0:E.values)??[];for(const M of g)for(const G of c)switch(mo(M)&&mo(G)?"EQ":or(M,G)){case"EQ":return V.newValue(Kn);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":o=!0;break;default:De(44608,{value:M,search:G})}return o?V.Dr():V.newValue(pn)}}class Ew{constructor(e){this.expr=e}evaluate(e,t){var a,d,c;Ae(this.expr.params.length===1,38605);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"NULL":return V.Dr();case"ARRAY":return V.newValue({integerValue:`${((c=(d=(a=o.value)==null?void 0:a.arrayValue)==null?void 0:d.values)==null?void 0:c.length)??0}`});default:return V.vr()}}}class Sw{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class kw{constructor(e){this.expr=e}evaluate(e,t){var a,d;Ae(this.expr.params.length===1,1508);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"NULL":return V.Dr();case"BYTES":{const c=(a=o.value)==null?void 0:a.bytesValue;if(typeof c=="string"){const g=on.fromBase64String(c).toUint8Array();return g.reverse(),V.newValue({bytesValue:on.fromUint8Array(g).toBase64()})}return V.newValue({bytesValue:new Uint8Array(c).reverse()})}case"STRING":{const c=(d=o.value)==null?void 0:d.stringValue,g=new Intl.__PRIVATE_Segmenter(void 0,{granularity:"grapheme"}).segment(c),h=Array.from(g,(v=>v.segment)).reverse();return V.newValue({stringValue:h.join("")})}default:return V.vr()}}}class Cw{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class Rw{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class Dw{constructor(e){this.expr=e}evaluate(e,t){Ae(this.expr.params.length===1,19400);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"NULL":return V.Dr();case"STRING":{const a=(function(c){let g=0;for(let h=0;h<c.length;h++){const v=c.codePointAt(h);if(v===void 0)return;if(v<=65535)if(v>=55296&&v<=57343)if(v<=56319){const _=c.codePointAt(h+1);_!==void 0&&_>=56320&&_<=57343?(g+=1,h++):g+=1}else g+=1;else g+=1;else{if(!(v<=1114111))return;g+=1,h++}}return g})(o.value.stringValue);return a===void 0?V.vr():V.newValue({integerValue:a})}default:return V.vr()}}}class Mw{constructor(e){this.expr=e}evaluate(e,t){var a,d;Ae(this.expr.params.length===1,8486);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"BYTES":{const c=(a=o.value)==null?void 0:a.bytesValue;return typeof c=="string"?V.newValue({integerValue:on.fromBase64String(c).toUint8Array().length}):V.newValue({integerValue:new Uint8Array(c).length})}case"STRING":{const c=(function(h){let v=0;for(let _=0;_<h.length;_++){const E=h.codePointAt(_);if(E===void 0)return;if(E>=55296&&E<=57343){if(!(E<=56319))return;{const M=h.codePointAt(_+1);if(M===void 0||!(M>=56320&&M<=57343))return;v+=4,_++}}else if(E<=127)v+=1;else if(E<=2047)v+=2;else if(E<=65535)v+=3;else{if(!(E<=1114111))return;v+=4,_++}}return v})((d=o.value)==null?void 0:d.stringValue);return c===void 0?V.vr():V.newValue({integerValue:c})}case"NULL":return V.Dr();default:return V.vr()}}}class Cl{constructor(e){this.expr=e}evaluate(e,t){var c,g;Ae(this.expr.params.length===2,39773,`${this.expr.name}() function should have exactly two parameters`);let o=!1;const a=Ie(this.expr.params[0]).evaluate(e,t);switch(a.type){case"STRING":break;case"NULL":o=!0;break;default:return V.vr()}const d=Ie(this.expr.params[1]).evaluate(e,t);switch(d.type){case"STRING":break;case"NULL":o=!0;break;default:return V.vr()}return o?V.Dr():this.kr((c=a.value)==null?void 0:c.stringValue,(g=d.value)==null?void 0:g.stringValue)}}class Tw extends Cl{kr(e,t){try{const o=(function(c){let g="";for(let h=0;h<c.length;h++){const v=c.charAt(h);switch(v){case"_":g+=".";break;case"%":g+=".*";break;case"\\":case".":case"*":case"?":case"+":case"^":case"$":case"|":case"(":case")":case"[":case"]":case"{":case"}":g+="\\"+v;break;default:g+=v}}return"^"+g+"$"})(t),a=Yd.compile(o);return V.newValue({booleanValue:a.matches(e)})}catch(o){return jo(`Invalid LIKE pattern converted to regex: ${t}, returning error. Error: ${o}`),V.vr()}}}class Iw extends Cl{kr(e,t){try{const o=Yd.compile(t);return V.newValue({booleanValue:o.matcher(e).find()})}catch{return jo(`Invalid regex pattern found in regex_contains: ${t}, returning error`),V.vr()}}}class Ow extends Cl{kr(e,t){try{return V.newValue({booleanValue:Yd.compile(t).matches(e)})}catch{return jo(`Invalid regex pattern found in regex_match: ${t}, returning error`),V.vr()}}}class Pw extends Cl{kr(e,t){return V.newValue({booleanValue:e.includes(t)})}}class zw extends Cl{kr(e,t){return V.newValue({booleanValue:e.startsWith(t)})}}class Lw extends Cl{kr(e,t){return V.newValue({booleanValue:e.endsWith(t)})}}class Nw{constructor(e){this.expr=e}evaluate(e,t){var a,d;Ae(this.expr.params.length===1,29079);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"STRING":return V.newValue({stringValue:(d=(a=o.value)==null?void 0:a.stringValue)==null?void 0:d.toLowerCase()});case"NULL":return V.Dr();default:return V.vr()}}}class Vw{constructor(e){this.expr=e}evaluate(e,t){var a,d;Ae(this.expr.params.length===1,60487);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"STRING":return V.newValue({stringValue:(d=(a=o.value)==null?void 0:a.stringValue)==null?void 0:d.toUpperCase()});case"NULL":return V.Dr();default:return V.vr()}}}class Uw{constructor(e){this.expr=e}evaluate(e,t){var a,d;Ae(this.expr.params.length===1,28544);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"STRING":return V.newValue({stringValue:(d=(a=o.value)==null?void 0:a.stringValue)==null?void 0:d.trim()});case"NULL":return V.Dr();default:return V.vr()}}}class Bw{constructor(e){this.expr=e}evaluate(e,t){const o=this.expr.params.map((c=>Ie(c).evaluate(e,t)));let a="",d=!1;for(const c of o)switch(c.type){case"STRING":a+=c.value.stringValue;break;case"NULL":d=!0;break;default:return V.vr()}return d?V.Dr():V.newValue({stringValue:a})}}class Gw{constructor(e){this.expr=e}evaluate(e,t){var c,g,h,v;Ae(this.expr.params.length===2,4483);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"UNSET":return V.Sr();case"MAP":break;default:return V.vr()}const a=Ie(this.expr.params[1]).evaluate(e,t);if(a.type!=="STRING")return V.vr();const d=(v=(g=(c=o.value)==null?void 0:c.mapValue)==null?void 0:g.fields)==null?void 0:v[(h=a.value)==null?void 0:h.stringValue];return d===void 0?V.Sr():V.newValue(d)}}class Uh{constructor(e){this.expr=e}evaluate(e,t){var v,_;Ae(this.expr.params.length===2,25231,`${this.expr.name}() function should have exactly 2 params`);let o=!1;const a=Ie(this.expr.params[0]).evaluate(e,t);switch(a.type){case"VECTOR":break;case"NULL":o=!0;break;default:return V.vr()}const d=Ie(this.expr.params[1]).evaluate(e,t);switch(d.type){case"VECTOR":break;case"NULL":o=!0;break;default:return V.vr()}if(o)return V.Dr();const c=Kf(a.value),g=Kf(d.value);if(c
20804===void 0||g===void 0||((v=c.values)==null?void 0:v.length)!==((_=g.values)==null?void 0:_.length))return V.vr();const h=this.qr(c,g);return h===void 0||isNaN(h)?V.vr():V.newValue({doubleValue:h})}}class qw extends Uh{qr(e,t){const o=(e==null?void 0:e.values)??[],a=(t==null?void 0:t.values)??[];if(o.length===0)return;let d=0,c=0,g=0;for(let v=0;v<o.length;v++){if(!aa(o[v])||!aa(a[v]))return;const _=wn(o[v]),E=wn(a[v]);d+=_*E,c+=_*_,g+=E*E}const h=Math.sqrt(c)*Math.sqrt(g);if(h!==0)return 1-Math.max(-1,Math.min(1,d/h))}}class Fw extends Uh{qr(e,t){const o=(e==null?void 0:e.values)??[],a=(t==null?void 0:t.values)??[];if(o.length===0)return 0;let d=0;for(let c=0;c<o.length;c++){if(!aa(o[c])||!aa(a[c]))return;d+=wn(o[c])*wn(a[c])}return d}}class jw extends Uh{qr(e,t){const o=(e==null?void 0:e.values)??[],a=(t==null?void 0:t.values)??[];if(o.length===0)return 0;let d=0;for(let c=0;c<o.length;c++){if(!aa(o[c])||!aa(a[c]))return;const g=wn(o[c]),h=wn(a[c]);d+=Math.pow(g-h,2)}return Math.sqrt(d)}}class Xw{constructor(e){this.expr=e}evaluate(e,t){var a;Ae(this.expr.params.length===1,39044);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"VECTOR":{const d=Kf(o.value);return V.newValue({integerValue:((a=d==null?void 0:d.values)==null?void 0:a.length)??0})}case"NULL":return V.Dr();default:return V.vr()}}}const dc=BigInt(-62135596800),cc=BigInt(253402300799),zu=BigInt(1e3),ea=BigInt(1e6),Hw=dc*zu,Ww=cc*zu+BigInt(999),Kw=dc*ea,Qw=cc*ea+BigInt(999999);function Bh(r){return r>=Kw&&r<=Qw}function D4(r){return r>=dc&&r<=cc}function mc(r,e){const t=BigInt(r);return!(t<dc||t>cc)&&!(e<0||e>=1e9)&&(t!==dc||e===0)&&!(t===cc&&e>999999999)}function M4(r,e){return e<0?{seconds:r-1,nanos:e+1e9}:{seconds:r,nanos:e}}function Gh(r){return BigInt(r.seconds)*ea+BigInt(Math.trunc(r.nanoseconds/1e3))}class qh{constructor(e){this.expr=e}evaluate(e,t){Ae(this.expr.params.length===1,49262,`${this.expr.name}() function should have exactly one parameter`);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"INT":return this.toTimestamp(BigInt(o.value.integerValue));case"NULL":return V.Dr();default:return V.vr()}}}class Yw extends qh{toTimestamp(e){if(!Bh(e))return V.vr();let t=Number(e/ea),o=Number(e%ea*BigInt(1e3));const a=M4(t,o);return t=a.seconds,o=a.nanos,mc(t,o)?V.newValue({timestampValue:{seconds:t,nanos:o}}):V.vr()}}class $w extends qh{toTimestamp(e){if(!(function(c){return c>=Hw&&c<=Ww})(e))return V.vr();let t=Number(e/zu),o=Number(e%zu*BigInt(1e6));const a=M4(t,o);return t=a.seconds,o=a.nanos,mc(t,o)?V.newValue({timestampValue:{seconds:t,nanos:o}}):V.vr()}}class Jw extends qh{toTimestamp(e){if(!D4(e))return V.vr();const t=Number(e);return V.newValue({timestampValue:{seconds:t,nanos:0}})}}class Fh{constructor(e){this.expr=e}evaluate(e,t){Ae(this.expr.params.length===1,1265,`${this.expr.name}() function should have exactly one parameter`);const o=Ie(this.expr.params[0]).evaluate(e,t);switch(o.type){case"TIMESTAMP":break;case"NULL":return V.Dr();default:return V.vr()}const a=Sh(o.value.timestampValue);return mc(a.seconds,a.nanoseconds)?this.$r(a):V.vr()}}class Zw extends Fh{$r(e){const t=Gh(e);return Bh(t)?V.newValue({integerValue:`${t.toString()}`}):V.vr()}}class eE extends Fh{$r(e){const t=Gh(e),o=t/BigInt(1e3),a=t%BigInt(1e3);return o>BigInt(0)||a===BigInt(0)?V.newValue({integerValue:o.toString()}):V.newValue({integerValue:(o-BigInt(1)).toString()})}}class tE extends Fh{$r(e){const t=BigInt(e.seconds);return D4(t)?V.newValue({integerValue:t.toString()}):V.vr()}}class T4{constructor(e){this.expr=e}evaluate(e,t){Ae(this.expr.params.length===3,2775,`${this.expr.name}() function should have exactly 3 parameters`);let o=!1;const a=Ie(this.expr.params[0]).evaluate(e,t);switch(a.type){case"TIMESTAMP":break;case"NULL":o=!0;break;default:return V.vr()}const d=Ie(this.expr.params[1]).evaluate(e,t);let c;switch(d.type){case"STRING":if(c=(function(Se){switch(Se){case"microsecond":return"microsecond";case"millisecond":return"millisecond";case"second":return"second";case"minute":return"minute";case"hour":return"hour";case"day":return"day";default:return}})(d.value.stringValue),c===void 0)return V.vr();break;case"NULL":o=!0;break;default:return V.vr()}const g=Ie(this.expr.params[2]).evaluate(e,t);switch(g.type){case"INT":break;case"NULL":o=!0;break;default:return V.vr()}if(o)return V.Dr();const h=BigInt(g.value.integerValue);let v;try{switch(c){case"microsecond":v=h;break;case"millisecond":v=h*BigInt(1e3);break;case"second":v=h*BigInt(1e6);break;case"minute":v=h*BigInt(6e7);break;case"hour":v=h*BigInt(36e8);break;case"day":v=h*BigInt(864e8);break;default:return V.vr()}if(c!=="microsecond"&&h!==BigInt(0)&&v/h!==BigInt(this.Kr(c)))return V.vr()}catch(ve){return jo(`Error during timestamp arithmetic: ${ve}`),V.vr()}const _=Sh(a.value.timestampValue);if(!mc(_.seconds,_.nanoseconds))return V.vr();const E=Gh(_),M=this.Wr(E,v);if(!Bh(M))return V.vr();const G=Number(M/ea),B=M%ea,ee=Number((B<0?B+ea:B)*BigInt(1e3)),ie=B<0?G-1:G;return mc(ie,ee)?V.newValue({timestampValue:{seconds:ie,nanos:ee}}):V.vr()}Kr(e){switch(e){case"millisecond":return 1e3;case"second":return 1e6;case"minute":return 6e7;case"hour":return 36e8;case"day":return 864e8;default:return 1}}}class nE extends T4{Wr(e,t){return e+t}}class oE extends T4{Wr(e,t){return e-t}}
vendor: 4,219 bytes, lines 20804-20829
20804function uc(r){if((r=C4(r))instanceof Ec)return`fld(${r.fieldName})`;if(r instanceof Sl)return`cst(${(function(t){return t===null?"null":typeof t=="number"?t.toString():typeof t=="string"?`"${t}"`:t instanceof Vt?`ref(${t.path})`:t instanceof Wn?`vec(${JSON.stringify(t)})`:JSON.stringify(t)})(r.value)})`;if(r instanceof Y)return`fn(${r.name},[${r.params.map(uc).join(",")}])`;if(r.expressionType==="ListOfExpressions")return`list([${r.Rr.map(uc).join(",")}])`;throw new Error(`Unrecognized expr ${JSON.stringify(r,null,2)}`)}function sE(r){if(r instanceof E4)return`${r._name}(${lu(r.fields)})`;if(r instanceof S4){let e=`${r._name}(${lu(r.accumulators)})`;return r.groups.size>0&&(e+=`grouping(${lu(r.groups)})`),e}if(r instanceof k4)return`${r._name}(${lu(r.groups)})`;if(r instanceof ip)return`${r._name}(${r.Vr})`;if(r instanceof lp)return`${r._name}(${r.collectionId})`;if(r instanceof Ih)return`${r._name}()`;if(r instanceof Oh)return`${r._name}(${r.dr.sort()})`;if(r instanceof Ph)return`${r._name}(${uc(r.condition)})`;if(r instanceof lc)return`${r._name}(${r.limit})`;if(r instanceof zh)return`${r._name}(${(function(t){return t.map((o=>`${uc(o.expr)}${o.direction}`)).join(",")})(r.orderings)})`;throw new Error(`Unrecognized stage ${r._name}`)}function lu(r){return`${Array.from(r.entries()).sort().map((([e,t])=>`${e}=${uc(t)}`)).join(",")}`}function er(r){return r.stages.map((e=>sE(e))).join("|")}function I4(r,e){return er(r)===er(e)}function ln(r){return r instanceof Xn}function m5(r){return ln(r)?er(r):jd(r)}function O4(r){return ln(r)?er(r):(function(t){return`${Fy(xs(t))}|lt:${t.limitType}`})(r)}function mp(r,e){return r instanceof Xn&&e instanceof Xn?I4(r,e):!(r instanceof Xn&&!(e instanceof Xn)||!(r instanceof Xn)&&e instanceof Xn)&&RA(r,e)}function P4(r){return Qa(r)?er(r):Fy(r)}function z4(r,e){return r instanceof Xn&&e instanceof Xn?I4(r,e):!(r instanceof Xn&&!(e instanceof Xn)||!(r instanceof Xn)&&e instanceof Xn)&&jy(r,e)}/**
20805 * @license
20806 * Copyright 2017 Google LLC
20807 *
20808 * Licensed under the Apache License, Version 2.0 (the "License");
20809 * you may not use this file except in compliance with the License.
20810 * You may obtain a copy of the License at
20811 *
20812 *   http://www.apache.org/licenses/LICENSE-2.0
20813 *
20814 * Unless required by applicable law or agreed to in writing, software
20815 * distributed under the License is distributed on an "AS IS" BASIS,
20816 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20817 * See the License for the specific language governing permissions and
20818 * limitations under the License.
20819 */class rE{constructor(e,t,o,a){this.batchId=e,this.localWriteTime=t,this.baseMutations=o,this.mutations=a}applyToRemoteDocument(e,t){const o=t.mutationResults;for(let a=0;a<this.mutations.length;a++){const d=this.mutations[a];d.key.isEqual(e.key)&&mA(d,e,o[a])}}applyToLocalView(e,t){for(const o of this.baseMutations)o.key.isEqual(e.key)&&(t=qd(o,e,t,this.localWriteTime));for(const o of this.mutations)o.key.isEqual(e.key)&&(t=qd(o,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const o=Yy();return this.mutations.forEach((a=>{const d=e.get(a.key),c=d.overlayedDocument;let g=this.applyToLocalView(c,d.mutatedFields);g=t.has(a.key)?null:g;const h=zy(c,g);h!==null&&o.set(a.key,h),c.isValidDocument()||c.convertToNoDocument(Ne.min())})),o}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),Qe())}isEqual(e){return this.batchId===e.batchId&&ml(this.mutations,e.mutations,((t,o)=>F2(t,o)))&&ml(this.baseMutations,e.baseMutations,((t,o)=>F2(t,o)))}}class jh{constructor(e,t,o,a){this.batch=e,this.commitVersion=t,this.mutationResults=o,this.docVersions=a}static from(e,t,o){Ae(e.mutations.length===o.length,58842,{Qr:e.mutations.length,Gr:o.length});let a=(function(){return OA})();const d=e.mutations;for(let c=0;c<d.length;c++)a=a.insert(d[c].key,o[c].version);return new jh(e,t,o,a)}}/**
20820 * @license
20821 * Copyright 2022 Google LLC
20822 *
20823 * Licensed under the Apache License, Version 2.0 (the "License");
20824 * you may not use this file except in compliance with the License.
20825 * You may obtain a copy of the License at
20826 *
20827 *   http://www.apache.org/licenses/LICENSE-2.0
20828 *
20829 * Unless required by applicable law or agreed to in writing, softw
20829are
20830 * distributed under the License is distributed on an "AS IS" BASIS,
20831 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20832 * See the License for the specific language governing permissions and
20833 * limitations under the License.
20834 */class aE{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
20835      largestBatchId: ${this.largestBatchId},
20836      mutation: ${this.mutation.toString()}
20837    }`}}/**
20838 * @license
20839 * Copyright 2017 Google LLC
20840 *
20841 * Licensed under the Apache License, Version 2.0 (the "License");
20842 * you may not use this file except in compliance with the License.
20843 * You may obtain a copy of the License at
20844 *
20845 *   http://www.apache.org/licenses/LICENSE-2.0
20846 *
20847 * Unless required by applicable law or agreed to in writing, software
20848 * distributed under the License is distributed on an "AS IS" BASIS,
20849 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20850 * See the License for the specific language governing permissions and
20851 * limitations under the License.
20852 */class $s{constructor(e,t,o,a,d=Ne.min(),c=Ne.min(),g=on.EMPTY_BYTE_STRING,h=null){this.target=e,this.targetId=t,this.purpose=o,this.sequenceNumber=a,this.snapshotVersion=d,this.lastLimboFreeSnapshotVersion=c,this.resumeToken=g,this.expectedCount=h}withSequenceNumber(e){return new $s(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new $s(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new $s(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new $s(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
20853 * @license
20854 * Copyright 2017 Google LLC
20855 *
20856 * Licensed under the Apache License, Version 2.0 (the "License");
20857 * you may not use this file except in compliance with the License.
20858 * You may obtain a copy of the License at
20859 *
20860 *   http://www.apache.org/licenses/LICENSE-2.0
20861 *
20862 * Unless required by applicable law or agreed to in writing, software
20863 * distributed under the License is distributed on an "AS IS" BASIS,
20864 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20865 * See the License for the specific language governing permissions and
20866 * limitations under the License.
20867 */class iE{constructor(e){this.zr=e}}function lE(r){const e=YA({parent:r.parent,structuredQuery:r.structuredQuery});return r.limitType==="LAST"?Mu(e,e.limit,"L"):e}/**
20868 * @license
20869 * Copyright 2019 Google LLC
20870 *
20871 * Licensed under the Apache License, Version 2.0 (the "License");
20872 * you may not use this file except in compliance with the License.
20873 * You may obtain a copy of the License at
20874 *
20875 *   http://www.apache.org/licenses/LICENSE-2.0
20876 *
20877 * Unless required by applicable law or agreed to in writing, software
20878 * distributed under the License is distributed on an "AS IS" BASIS,
20879 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20880 * See the License for the specific language governing permissions and
20881 * limitations under the License.
20882 */class dE{constructor(){this.Hi=new cE}addToCollectionParentIndex(e,t){return this.Hi.add(t),se.resolve()}getCollectionParents(e,t){return se.resolve(this.Hi.getEntries(t))}addFieldIndex(e,t){return se.resolve()}deleteFieldIndex(e,t){return se.resolve()}deleteAllFieldIndexes(e){return se.resolve()}createTargetIndexes(e,t){return se.resolve()}getDocumentsMatchingTarget(e,t){return se.resolve(null)}getIndexType(e,t){return se.resolve(0)}getFieldIndexes(e,t){return se.resolve([])}getNextCollectionGroupToUpdate(e){return se.resolve(null)}getMinOffset(e,t){return se.resolve(oa.min())}getMinOffsetFromCollectionGroup(e,t){return se.resolve(oa.min())}updateCollectionGroup(e,t,o){return se.resolve()}updateIndexEntries(e,t){return se.resolve()}}class cE{constructor(){this.index={}}add(e){const t=e.lastSegment(),o=e.popLast(),a=this.index[t]||new nn(ut.comparator),d=!a.has(o);return this.index[t]=a.add(o),d}has(e){const t=e.lastSegment(),o=e.popLast(),a=this.index[t];return a&&a.has(o)}getEntries(e){return(this.index[e]||new nn(ut.comparator)).toArray()}}/**
20883 * @license
20884 * Copyright 2017 Google LLC
20885 *
20886 * Licensed under the Apache License, Version 2.0 (the "License");
20887 * you may not use this file except in compliance with the License.
20888 * You may obtain a copy of the License at
20889 *
20890 *   http://www.apache.org/licenses/LICENSE-2.0
20891 *
20892 * Unless required by applicable law or agreed to in writing, software
20893 * distributed under the License is distributed on an "AS IS" BASIS,
20894 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20895 * See the License for the specific language governing permissions and
20896 * limitations under the License.
20897 */class ma{constructor(e){this.Ds=e}next(){return this.Ds+=2,this.Ds}static xs(){return new ma(0)}static Cs(){return new ma(-1)}}// Copyright 2024 Google LLC* @license
20898function L4(r,e){var o;let t=e;for(const a of r.stages)t=uE({serializer:r.serializer,serverTimestampBehavior:(o=r.listenOptions)==null?void 0:o.serverTimestampBehavior},a,t);return t}function up(r,e){return L4(r,[e]).length>0}function mE(r,e){return ln(r)?up(r,e):tp(r,e)}function uE(r,e,t){if(e instanceof ip)return(function(a,d,c){return c.filter((g=>g.isFoundDocument()&&`/${g.key.getCollectionPath().canonicalString()}`===d.Vr))})(0,e,t);if(e instanceof Ph)return(function(a,d,c){return c.filter((g=>{const h=Hd(Ie(d.condition).evaluate(a,g));return h!==void 0&&Ro(h,Kn)}))})(r,e,t);if(e instanceof lp)return(function(a,d,c){return c.filter((g=>g.isFoundDocument()&&g.key.getCollectionPath().lastSegment()===d.collectionId))})(0,e,t);if(e instanceof Ih)return(function(a,d,c){return c.filter((g=>g.isFoundDocument()))})(0,0,t);if(e instanceof Oh)return(function(a,d,c){return c.filter((g=>g.isFoundDocument()&&d.mr.has(g.key.path.toStringWithLeadingSlash())))})(0,e,t);if(e instanceof lc)return(function(a,d,c){return c.slice(0,d.limit)})(0,e,t);if(e instanceof zh)return(function(a,d,c){const g=d.orderings.map((h=>({ks:Ie(h.expr),direction:h.direction})));return[...c].sort(((h,v)=>{for(const{ks:_,direction:E}of g){const M=Hd(_.evaluate(a,h)),G=Hd(_.evaluate(a,v)),B=Qn(M??gl,G??gl);if(B!==0)return E==="ascending"?B:-B}return 0}))})(r,e,t);throw new Error(`Unknown stage: ${e._name}`)}function oh(r){const e=(function(o){for(let a=o.stages.length-1;a>=0;a--){const d=o.stages[a];if(d instanceof zh)return d.orderings}throw new Error("Pipeline must contain at least one Sort stage")})(r);return(t,o)=>{for(const a of e){const d=Hd(Ie(a.expr).evaluate({serializer:r.serializer},t)),c=Hd(Ie(a.expr).evaluate({serializer:r.serializer},o)),g=Qn(d||gl,c||gl);if(g!==0)return a.direction==="ascending"?g:-g}return 0}}function Tf(r){for(let e=r.stages.length-1;e>=0;e--){const t=r.stages[e];if(t instanceof lc)return{limit:t.limit}}}/**
20899 * @license
20900 * Copyright 2017 Google LLC
20901 *
20902 * Licensed under the Apache License, Version 2.0 (the "License");
20903 * you may not use this file except in compliance with the License.
20904 * You may obtain a copy of the License at
20905 *
20906 *   http://www.apache.org/licenses/LICENSE-2.0
20907 *
20908 * Unless required by applicable law or agreed to in writing, software
20909 * distributed under the License is distributed on an "AS IS" BASIS,
20910 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20911 * See the License for the specific language governing permissions and
20912 * limitations under the License.
20913 */class pE{constructor(){this.changes=new ii((e=>e.toString()),((e,t)=>e.isEqual(t))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,Dn.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const o=this.changes.get(t);return o!==void 0?se.resolve(o):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
20914 * @license
20915 * Copyright 2017 Google LLC
20916 *
20917 * Licensed under the Apache License, Version 2.0 (the "License");
20918 * you may not use this file except in compliance with the License.
20919 * You may obtain a copy of the License at
20920 *
20921 *   http://www.apache.org/licenses/LICENSE-2.0
20922 *
20923 * Unless required by applicable law or agreed to in writing, software
20924 * distributed under the License is distributed on an "AS IS" BASIS,
20925 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20926 * See the License for the specific language governing permissions and
20927 * limitations under the License.
20928 *//**
20929 * @license
20930 * Copyright 2022 Google LLC
20931 *
20932 * Licensed under the Apache License, Version 2.0 (the "License");
20933 * you may not use this file except in compliance with the License.
20934 * You may obtain a copy of the License at
20935 *
20936 *   http://www.apache.org/licenses/LICENSE-2.0
20937 *
20938 * Unless required by applicable law or agreed to in writing, software
20939 * distributed under the License is distributed on an "AS IS" BASIS,
20940 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20941 * See the License for the specific language governing permissions and
20942 * limitations under the License.
20943 */class gE{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
20944 * @license
20945 * Copyright 2017 Google LLC
20946 *
20947 * Licensed under the Apache License, Version 2.0 (the "License");
20948 * you may not use this file except in compliance with the License.
20949 * You may obtain a copy of the License at
20950 *
20951 *   http://www.apache.org/licenses/LICENSE-2.0
20952 *
20953 * Unless required by applicable law or agreed to in writing, software
20954 * distributed under the License is distributed on an "AS IS" BASIS,
20955 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20956 * See the License for the specific language governing permissions and
20957 * limitations under the License.
20958 */class fE{constructor(e,t,o,a){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=o,this.indexManager=a}getDocument(e,t){let o=null;return this.documentOverlayCache.getOverlay(e,t).next((a=>(o=a,this.remoteDocumentCache.getEntry(e,t)))).next((a=>(o!==null&&qd(o.mutation,a,co.empty(),Ct.now()),a)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((o=>this.getLocalViewOfDocuments(e,o,Qe()).next((()=>o))))}getLocalViewOfDocuments(e,t,o=Qe()){const a=jr();return this.populateOverlays(e,a,t).next((()=>this.computeViews(e,t,a,o).next((d=>{let c=Zi();return d.forEach(((g,h)=>{c=c.insert(g,h.overlayedDocument)})),c}))))}getOverlayedDocuments(e,t){const o=jr();return this.populateOverlays(e,o,t).next((()=>this.computeViews(e,t,o,Qe())))}populateOverlays(e,t,o){const a=[];return o.forEach((d=>{t.has(d)||a.push(d)})),this.documentOverlayCache.getOverlays(e,a).next((d=>{d.forEach(((c,g)=>{t.set(c,g)}))}))}computeViews(e,t,o,a){let d=Hn();const c=Xd(),g=(function(){return Xd()})();return t.forEach(((h,v)=>{const _=o.get(v.key);a.has(v.key)&&(_===void 0||_.mutation instanceof fa)?d=d.insert(v.key,v):_!==void 0?(c.set(v.key,_.mutation.getFieldMask()),qd(_.mutation,v,_.mutation.getFieldMask(),Ct.now())):c.set(v.key,co.empty())})),this.recalculateAndSaveOverlays(e,d).next((h=>(h.forEach(((v,_)=>c.set(v,_))),t.forEach(((v,_)=>g.set(v,new gE(_,c.get(v)??null)))),g)))}recalculateAndSaveOverlays(e,t){const o=Xd();let a=new Mt(((c,g)=>c-g)),d=Qe();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((c=>{for(const g of c)g.keys().forEach((h=>{const v=t.get(h);if(v===null)return;let _=o.get(h)||co.empty();_=g.applyToLocalView(v,_),o.set(h,_);const E=(a.get(g.batchId)||Qe()).add(h);a=a.insert(g.batchId,E)}))})).next((()=>{const c=[],g=a.getReverseIterator();for(;g.hasNext();){const h=g.getNext(),v=h.key,_=h.value,E=Yy();_.forEach((M=>{if(!d.has(M)){const G=zy(t.get(M),o.get(M));G!==null&&E.set(M,G),d=d.add(M)}})),c.push(this.documentOverlayCache.saveOverlays(e,v,E))}return se.waitFor(c)})).next((()=>o))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((o=>this.recalculateAndSaveOverlays(e,o)))}getDocumentsMatchingQuery(e,t,o,a){return ln(t)?this.getDocumentsMatchingPipeline(e,t,o,a):SA(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Hy(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,o,a):this.getDocumentsMatchingCollectionQuery(e,t,o,a)}getNextDocuments(e,t,o,a){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,o,a).next((d=>{const c=a-d.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,o.largestBatchId,a-d.size):se.resolve(jr());let g=$d,h=d;return c.next((v=>se.forEach(v,((_,E)=>(g<E.largestBatchId&&(g=E.largestBatchId),d.get(_)?se.resolve():this.remoteDocumentCache.getEntry(e,_).next((M=>{h=h.insert(_,M)}))))).next((()=>this.populateOverlays(e,v,d))).next((()=>this.computeViews(e,h,v,Qe()))).next((_=>({batchId:g,changes:Qy(_)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new Ee(t)).next((o=>{let a=Zi();
vendor: 22,507 bytes, lines 20958-21118
20958return o.isFoundDocument()&&(a=a.insert(o.key,o)),a}))}getDocumentsMatchingCollectionGroupQuery(e,t,o,a){const d=t.collectionGroup;let c=Zi();return this.indexManager.getCollectionParents(e,d).next((g=>se.forEach(g,(h=>{const v=(function(E,M){return new El(M,null,E.explicitOrderBy.slice(),E.filters.slice(),E.limit,E.limitType,E.startAt,E.endAt)})(t,h.child(d));return this.getDocumentsMatchingCollectionQuery(e,v,o,a).next((_=>{_.forEach(((E,M)=>{c=c.insert(E,M)}))}))})).next((()=>c))))}getDocumentsMatchingCollectionQuery(e,t,o,a){let d;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,o.largestBatchId).next((c=>(d=c,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,o,d,a)))).next((c=>this.retrieveMatchingLocalDocuments(d,c,(g=>tp(t,g)))))}getDocumentsMatchingPipeline(e,t,o,a){if(Zr(t)==="collection_group"){const d=Nh(t);let c=Zi();return this.indexManager.getCollectionParents(e,d).next((g=>se.forEach(g,(h=>{const v=(function(E,M){const G=E.stages.map((B=>B instanceof lp?new ip(M.canonicalString(),{}):B));return new Xn(E.serializer,G)})(t,h.child(d));return this.getDocumentsMatchingPipeline(e,v,o,a).next((_=>{_.forEach(((E,M)=>{c=c.insert(E,M)}))}))})).next((()=>c))))}{let d;return this.getOverlaysForPipeline(e,t,o.largestBatchId).next((c=>{switch(d=c,Zr(t)){case"collection":return this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,o,d,a);case"documents":let g=Qe();for(const h of nh(t))g=g.add(Ee.fromPath(h));return this.remoteDocumentCache.getEntries(e,g);case"database":return this.remoteDocumentCache.getAllEntries(e);default:throw new pe("invalid-argument",`Invalid pipeline source to execute offline: ${er(t)}`)}})).next((c=>this.retrieveMatchingLocalDocuments(d,c,(g=>up(t,g)))))}}retrieveMatchingLocalDocuments(e,t,o){e.forEach(((d,c)=>{const g=c.getKey();t.get(g)===null&&(t=t.insert(g,Dn.newInvalidDocument(g)))}));let a=Zi();return t.forEach(((d,c)=>{const g=e.get(d);g!==void 0&&qd(g.mutation,c,co.empty(),Ct.now()),o(c)&&(a=a.insert(d,c))})),a}getOverlaysForPipeline(e,t,o){switch(Zr(t)){case"collection":return this.documentOverlayCache.getOverlaysForCollection(e,ut.fromString(dp(t)),o);case"collection_group":throw new pe("invalid-argument",`Unexpected collection group pipeline: ${er(t)}`);case"documents":return this.documentOverlayCache.getOverlays(e,nh(t).map((a=>Ee.fromPath(a))));case"database":return this.documentOverlayCache.getAllOverlays(e,o);default:throw new pe("invalid-argument",`Failed to get overlays for pipeline: ${er(t)}`)}}}/**
20959 * @license
20960 * Copyright 2020 Google LLC
20961 *
20962 * Licensed under the Apache License, Version 2.0 (the "License");
20963 * you may not use this file except in compliance with the License.
20964 * You may obtain a copy of the License at
20965 *
20966 *   http://www.apache.org/licenses/LICENSE-2.0
20967 *
20968 * Unless required by applicable law or agreed to in writing, software
20969 * distributed under the License is distributed on an "AS IS" BASIS,
20970 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20971 * See the License for the specific language governing permissions and
20972 * limitations under the License.
20973 */class hE{constructor(e){this.serializer=e,this.Hs=new Map,this.Js=new Map}getBundleMetadata(e,t){return se.resolve(this.Hs.get(t))}saveBundleMetadata(e,t){return this.Hs.set(t.id,(function(a){return{id:a.id,version:a.version,createTime:As(a.createTime)}})(t)),se.resolve()}getNamedQuery(e,t){return se.resolve(this.Js.get(t))}saveNamedQuery(e,t){return this.Js.set(t.name,(function(a){return{name:a.name,query:lE(a.bundledQuery),readTime:As(a.readTime)}})(t)),se.resolve()}}/**
20974 * @license
20975 * Copyright 2022 Google LLC
20976 *
20977 * Licensed under the Apache License, Version 2.0 (the "License");
20978 * you may not use this file except in compliance with the License.
20979 * You may obtain a copy of the License at
20980 *
20981 *   http://www.apache.org/licenses/LICENSE-2.0
20982 *
20983 * Unless required by applicable law or agreed to in writing, software
20984 * distributed under the License is distributed on an "AS IS" BASIS,
20985 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20986 * See the License for the specific language governing permissions and
20987 * limitations under the License.
20988 */class vE{constructor(){this.overlays=new Mt(Ee.comparator),this.Ys=new Map}getOverlay(e,t){return se.resolve(this.overlays.get(t))}getOverlays(e,t){const o=jr();return se.forEach(t,(a=>this.getOverlay(e,a).next((d=>{d!==null&&o.set(a,d)})))).next((()=>o))}getAllOverlays(e,t){const o=jr();return this.overlays.forEach(((a,d)=>{d.largestBatchId>t&&o.set(a,d)})),se.resolve(o)}saveOverlays(e,t,o){return o.forEach(((a,d)=>{this.Hr(e,t,d)})),se.resolve()}removeOverlaysForBatchId(e,t,o){const a=this.Ys.get(o);return a!==void 0&&(a.forEach((d=>this.overlays=this.overlays.remove(d))),this.Ys.delete(o)),se.resolve()}getOverlaysForCollection(e,t,o){const a=jr(),d=t.length+1,c=new Ee(t.child("")),g=this.overlays.getIteratorFrom(c);for(;g.hasNext();){const h=g.getNext().value,v=h.getKey();if(!t.isPrefixOf(v.path))break;v.path.length===d&&h.largestBatchId>o&&a.set(h.getKey(),h)}return se.resolve(a)}getOverlaysForCollectionGroup(e,t,o,a){let d=new Mt(((v,_)=>v-_));const c=this.overlays.getIterator();for(;c.hasNext();){const v=c.getNext().value;if(v.getKey().getCollectionGroup()===t&&v.largestBatchId>o){let _=d.get(v.largestBatchId);_===null&&(_=jr(),d=d.insert(v.largestBatchId,_)),_.set(v.getKey(),v)}}const g=jr(),h=d.getIterator();for(;h.hasNext()&&(h.getNext().value.forEach(((v,_)=>g.set(v,_))),!(g.size()>=a)););return se.resolve(g)}Hr(e,t,o){const a=this.overlays.get(o.key);if(a!==null){const c=this.Ys.get(a.largestBatchId).delete(o.key);this.Ys.set(a.largestBatchId,c)}this.overlays=this.overlays.insert(o.key,new aE(t,o));let d=this.Ys.get(t);d===void 0&&(d=Qe(),this.Ys.set(t,d)),this.Ys.set(t,d.add(o.key))}}/**
20989 * @license
20990 * Copyright 2024 Google LLC
20991 *
20992 * Licensed under the Apache License, Version 2.0 (the "License");
20993 * you may not use this file except in compliance with the License.
20994 * You may obtain a copy of the License at
20995 *
20996 *   http://www.apache.org/licenses/LICENSE-2.0
20997 *
20998 * Unless required by applicable law or agreed to in writing, software
20999 * distributed under the License is distributed on an "AS IS" BASIS,
21000 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21001 * See the License for the specific language governing permissions and
21002 * limitations under the License.
21003 */class bE{constructor(){this.sessionToken=on.EMPTY_BYTE_STRING}getSessionToken(e){return se.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,se.resolve()}}/**
21004 * @license
21005 * Copyright 2017 Google LLC
21006 *
21007 * Licensed under the Apache License, Version 2.0 (the "License");
21008 * you may not use this file except in compliance with the License.
21009 * You may obtain a copy of the License at
21010 *
21011 *   http://www.apache.org/licenses/LICENSE-2.0
21012 *
21013 * Unless required by applicable law or agreed to in writing, software
21014 * distributed under the License is distributed on an "AS IS" BASIS,
21015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21016 * See the License for the specific language governing permissions and
21017 * limitations under the License.
21018 */class Xh{constructor(){this.Zs=new nn(un.Xs),this.e_=new nn(un.t_)}isEmpty(){return this.Zs.isEmpty()}addReference(e,t){const o=new un(e,t);this.Zs=this.Zs.add(o),this.e_=this.e_.add(o)}n_(e,t){e.forEach((o=>this.addReference(o,t)))}removeReference(e,t){this.r_(new un(e,t))}i_(e,t){e.forEach((o=>this.removeReference(o,t)))}s_(e){const t=new Ee(new ut([])),o=new un(t,e),a=new un(t,e+1),d=[];return this.e_.forEachInRange([o,a],(c=>{this.r_(c),d.push(c.key)})),d}__(){this.Zs.forEach((e=>this.r_(e)))}r_(e){this.Zs=this.Zs.delete(e),this.e_=this.e_.delete(e)}o_(e){const t=new Ee(new ut([])),o=new un(t,e),a=new un(t,e+1);let d=Qe();return this.e_.forEachInRange([o,a],(c=>{d=d.add(c.key)})),d}containsKey(e){const t=new un(e,0),o=this.Zs.firstAfterOrEqual(t);return o!==null&&e.isEqual(o.key)}}class un{constructor(e,t){this.key=e,this.a_=t}static Xs(e,t){return Ee.comparator(e.key,t.key)||et(e.a_,t.a_)}static t_(e,t){return et(e.a_,t.a_)||Ee.comparator(e.key,t.key)}}/**
21019 * @license
21020 * Copyright 2017 Google LLC
21021 *
21022 * Licensed under the Apache License, Version 2.0 (the "License");
21023 * you may not use this file except in compliance with the License.
21024 * You may obtain a copy of the License at
21025 *
21026 *   http://www.apache.org/licenses/LICENSE-2.0
21027 *
21028 * Unless required by applicable law or agreed to in writing, software
21029 * distributed under the License is distributed on an "AS IS" BASIS,
21030 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21031 * See the License for the specific language governing permissions and
21032 * limitations under the License.
21033 */class yE{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.gs=1,this.u_=new nn(un.Xs)}checkEmpty(e){return se.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,o,a){const d=this.gs;this.gs++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const c=new rE(d,t,o,a);this.mutationQueue.push(c);for(const g of a)this.u_=this.u_.add(new un(g.key,d)),this.indexManager.addToCollectionParentIndex(e,g.key.path.popLast());return se.resolve(c)}lookupMutationBatch(e,t){return se.resolve(this.c_(t))}getNextMutationBatchAfterBatchId(e,t){const o=t+1,a=this.l_(o),d=a<0?0:a;return se.resolve(this.mutationQueue.length>d?this.mutationQueue[d]:null)}getHighestUnacknowledgedBatchId(){return se.resolve(this.mutationQueue.length===0?bh:this.gs-1)}getAllMutationBatches(e){return se.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const o=new un(t,0),a=new un(t,Number.POSITIVE_INFINITY),d=[];return this.u_.forEachInRange([o,a],(c=>{const g=this.c_(c.a_);d.push(g)})),se.resolve(d)}getAllMutationBatchesAffectingDocumentKeys(e,t){let o=new nn(et);return t.forEach((a=>{const d=new un(a,0),c=new un(a,Number.POSITIVE_INFINITY);this.u_.forEachInRange([d,c],(g=>{o=o.add(g.a_)}))})),se.resolve(this.E_(o))}getAllMutationBatchesAffectingQuery(e,t){const o=t.path,a=o.length+1;let d=o;Ee.isDocumentKey(d)||(d=d.child(""));const c=new un(new Ee(d),0);let g=new nn(et);return this.u_.forEachWhile((h=>{const v=h.key.path;return!!o.isPrefixOf(v)&&(v.length===a&&(g=g.add(h.a_)),!0)}),c),se.resolve(this.E_(g))}E_(e){const t=[];return e.forEach((o=>{const a=this.c_(o);a!==null&&t.push(a)})),t}removeMutationBatch(e,t){Ae(this.h_(t.batchId,"removed")===0,55003),this.mutationQueue.shift();let o=this.u_;return se.forEach(t.mutations,(a=>{const d=new un(a.key,t.batchId);return o=o.delete(d),this.referenceDelegate.markPotentiallyOrphaned(e,a.key)})).next((()=>{this.u_=o}))}bs(e){}containsKey(e,t){const o=new un(t,0),a=this.u_.firstAfterOrEqual(o);return se.resolve(t.isEqual(a&&a.key))}performConsistencyCheck(e){return this.mutationQueue.length,se.resolve()}h_(e,t){return this.l_(e)}l_(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}c_(e){const t=this.l_(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}/**
21034 * @license
21035 * Copyright 2017 Google LLC
21036 *
21037 * Licensed under the Apache License, Version 2.0 (the "License");
21038 * you may not use this file except in compliance with the License.
21039 * You may obtain a copy of the License at
21040 *
21041 *   http://www.apache.org/licenses/LICENSE-2.0
21042 *
21043 * Unless required by applicable law or agreed to in writing, software
21044 * distributed under the License is distributed on an "AS IS" BASIS,
21045 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21046 * See the License for the specific language governing permissions and
21047 * limitations under the License.
21048 */class xE{constructor(e){this.T_=e,this.docs=(function(){return new Mt(Ee.comparator)})(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const o=t.key,a=this.docs.get(o),d=a?a.size:0,c=this.T_(t);return this.docs=this.docs.insert(o,{document:t.mutableCopy(),size:c}),this.size+=c-d,this.indexManager.addToCollectionParentIndex(e,o.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const o=this.docs.get(t);return se.resolve(o?o.document.mutableCopy():Dn.newInvalidDocument(t))}getEntries(e,t){let o=Hn();return t.forEach((a=>{const d=this.docs.get(a);o=o.insert(a,d?d.document.mutableCopy():Dn.newInvalidDocument(a))})),se.resolve(o)}getAllEntries(e){let t=Hn();return this.docs.forEach(((o,a)=>{t=t.insert(o,a.document)})),se.resolve(t)}getDocumentsMatchingQuery(e,t,o,a){let d,c;ln(t)?(d=ut.fromString(dp(t)),c=_=>up(t,_)):(d=t.path,c=_=>tp(t,_));let g=Hn();const h=new Ee(d.child("__id-9223372036854775808__")),v=this.docs.getIteratorFrom(h);for(;v.hasNext();){const{key:_,value:{document:E}}=v.getNext();if(!d.isPrefixOf(_.path))break;_.path.length>d.length+1||W9(H9(E),o)<=0||(a.has(E.key)||c(E))&&(g=g.insert(E.key,E.mutableCopy()))}return se.resolve(g)}getAllFromCollectionGroup(e,t,o,a){De(9500)}P_(e,t){return se.forEach(this.docs,(o=>t(o)))}newChangeBuffer(e){return new AE(this)}getSize(e){return se.resolve(this.size)}}class AE extends pE{constructor(e){super(),this.zs=e}applyChanges(e){const t=[];return this.changes.forEach(((o,a)=>{a.isValidDocument()?t.push(this.zs.addEntry(e,a)):this.zs.removeEntry(o)})),se.waitFor(t)}getFromCache(e,t){return this.zs.getEntry(e,t)}getAllFromCache(e,t){return this.zs.getEntries(e,t)}}/**
21049 * @license
21050 * Copyright 2017 Google LLC
21051 *
21052 * Licensed under the Apache License, Version 2.0 (the "License");
21053 * you may not use this file except in compliance with the License.
21054 * You may obtain a copy of the License at
21055 *
21056 *   http://www.apache.org/licenses/LICENSE-2.0
21057 *
21058 * Unless required by applicable law or agreed to in writing, software
21059 * distributed under the License is distributed on an "AS IS" BASIS,
21060 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21061 * See the License for the specific language governing permissions and
21062 * limitations under the License.
21063 */class _E{constructor(e){this.persistence=e,this.R_=new ii((t=>P4(t)),z4),this.lastRemoteSnapshotVersion=Ne.min(),this.highestTargetId=0,this.I_=0,this.A_=new Xh,this.targetCount=0,this.V_=ma.xs()}forEachTarget(e,t){return this.R_.forEach(((o,a)=>t(a))),se.resolve()}getLastRemoteSnapshotVersion(e){return se.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return se.resolve(this.I_)}allocateTargetId(e){return this.highestTargetId=this.V_.next(),se.resolve(this.highestTargetId)}setTargetsMetadata(e,t,o){return o&&(this.lastRemoteSnapshotVersion=o),t>this.I_&&(this.I_=t),se.resolve()}Ms(e){this.R_.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.V_=new ma(t),this.highestTargetId=t),e.sequenceNumber>this.I_&&(this.I_=e.sequenceNumber)}addTargetData(e,t){return this.Ms(t),this.targetCount+=1,se.resolve()}updateTargetData(e,t){return this.Ms(t),se.resolve()}removeTargetData(e,t){return this.R_.delete(t.target),this.A_.s_(t.targetId),this.targetCount-=1,se.resolve()}removeTargets(e,t,o){let a=0;const d=[];return this.R_.forEach(((c,g)=>{g.sequenceNumber<=t&&o.get(g.targetId)===null&&(this.R_.delete(c),d.push(this.removeMatchingKeysForTargetId(e,g.targetId)),a++)})),se.waitFor(d).next((()=>a))}getTargetCount(e){return se.resolve(this.targetCount)}getTargetData(e,t){const o=this.R_.get(t)||null;return se.resolve(o)}addMatchingKeys(e,t,o){return this.A_.n_(t,o),se.resolve()}removeMatchingKeys(e,t,o){this.A_.i_(t,o);const a=this.persistence.referenceDelegate,d=[];return a&&t.forEach((c=>{d.push(a.markPotentiallyOrphaned(e,c))})),se.waitFor(d)}removeMatchingKeysForTargetId(e,t){return this.A_.s_(t),se.resolve()}getMatchingKeysForTargetId(e,t){const o=this.A_.o_(t);return se.resolve(o)}containsKey(e,t){return se.resolve(this.A_.containsKey(t))}}/**
21064 * @license
21065 * Copyright 2017 Google LLC
21066 *
21067 * Licensed under the Apache License, Version 2.0 (the "License");
21068 * you may not use this file except in compliance with the License.
21069 * You may obtain a copy of the License at
21070 *
21071 *   http://www.apache.org/licenses/LICENSE-2.0
21072 *
21073 * Unless required by applicable law or agreed to in writing, software
21074 * distributed under the License is distributed on an "AS IS" BASIS,
21075 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21076 * See the License for the specific language governing permissions and
21077 * limitations under the License.
21078 */class N4{constructor(e,t){this.d_={},this.overlays={},this.f_=new Ku(0),this.m_=!1,this.m_=!0,this.p_=new bE,this.referenceDelegate=e(this),this.g_=new _E(this),this.indexManager=new dE,this.remoteDocumentCache=(function(a){return new xE(a)})((o=>this.referenceDelegate.y_(o))),this.serializer=new iE(t),this.w_=new hE(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.m_=!1,Promise.resolve()}get started(){return this.m_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new vE,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let o=this.d_[e.toKey()];return o||(o=new yE(t,this.referenceDelegate),this.d_[e.toKey()]=o),o}getGlobalsCache(){return this.p_}getTargetCache(){return this.g_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.w_}runTransaction(e,t,o){ge("MemoryPersistence","Starting transaction:",e);const a=new wE(this.f_.next());return this.referenceDelegate.b_(),o(a).next((d=>this.referenceDelegate.v_(a).next((()=>d)))).toPromise().then((d=>(a.raiseOnCommittedEvent(),d)))}S_(e,t){return se.or(Object.values(this.d_).map((o=>()=>o.containsKey(e,t))))}}class wE extends Q9{constructor(e){super(),this.currentSequenceNumber=e}}class Hh{constructor(e){this.persistence=e,this.D_=new Xh,this.x_=null}static C_(e){return new Hh(e)}get F_(){if(this.x_)return this.x_;throw De(60996)}addReference(e,t,o){return this.D_.addReference(o,t),this.F_.delete(o.toString()),se.resolve()}removeReference(e,t,o){return this.D_.removeReference(o,t),this.F_.add(o.toString()),se.resolve()}markPotentiallyOrphaned(e,t){return this.F_.add(t.toString()),se.resolve()}removeTarget(e,t){this.D_.s_(t.targetId).forEach((a=>this.F_.add(a.toString())));const o=this.persistence.getTargetCache();return o.getMatchingKeysForTargetId(e,t.targetId).next((a=>{a.forEach((d=>this.F_.add(d.toString())))})).next((()=>o.removeTargetData(e,t)))}b_(){this.x_=new Set}v_(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return se.forEach(this.F_,(o=>{const a=Ee.fromPath(o);return this.O_(e,a).next((d=>{d||t.removeEntry(a,Ne.min())}))})).next((()=>(this.x_=null,t.apply(e))))}updateLimboDocument(e,t){return this.O_(e,t).next((o=>{o?this.F_.delete(t.toString()):this.F_.add(t.toString())}))}y_(e){return 0}O_(e,t){return se.or([()=>se.resolve(this.D_.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.S_(e,t)])}}class Lu{constructor(e,t){this.persistence=e,this.M_=new ii((o=>Z9(o.path)),((o,a)=>o.isEqual(a))),this.garbageCollector=x_(this,t)}static C_(e,t){return new Lu(e,t)}b_(){}v_(e){return se.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}lr(e){const t=this.Ls(e);return this.persistence.getTargetCache().getTargetCount(e).next((o=>t.next((a=>o+a))))}Ls(e){let t=0;return this.Er(e,(o=>{t++})).next((()=>t))}Er(e,t){return se.forEach(this.M_,((o,a)=>this.Us(e,o,a).next((d=>d?se.resolve():t(a)))))}removeTargets(e,t,o){return this.persistence.getTargetCache().removeTargets(e,t,o)}removeOrphanedDocuments(e,t){let o=0;const a=this.persistence.getRemoteDocumentCache(),d=a.newChangeBuffer();return a.P_(e,(c=>this.Us(e,c,t).next((g=>{g||(o++,d.removeEntry(c,Ne.min()))})))).next((()=>d.apply(e))).next((()=>o))}markPotentiallyOrphaned(e,t){return this.M_.set(t,e.currentSequenceNumber),se.resolve()}removeTarget(e,t){const o=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,o)}addReference(e,t,o){return this.M_.set(o,e.currentSequenceNumber),se.resolve()}removeReference(e,t,o){return this.M_.set(o,e.currentSequenceNumber),se.resolve()}updateLimboDocument(e,t){return this.M_.set(t,e.currentSequenceNumber),se.resolve()}y_(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=mu(e.data.value)),t}Us(e,t,o){return se.or([()=>this.persistence.S_(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const a=this.M_.get(t);return se.resolve(a!==void 0&&a>o)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/**
21079 * @license
21080 * Copyright 2017 Google LLC
21081 *
21082 * Licensed under the Apache License, Version 2.0 (the "License");
21083 * you may not use this file except in compliance with the License.
21084 * You may obtain a copy of the License at
21085 *
21086 *   http://www.apache.org/licenses/LICENSE-2.0
21087 *
21088 * Unless required by applicable law or agreed to in writing, software
21089 * distributed under the License is distributed on an "AS IS" BASIS,
21090 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21091 * See the License for the specific language governing permissions and
21092 * limitations under the License.
21093 */class Wh{constructor(e,t,o,a){this.targetId=e,this.fromCache=t,this.wo=o,this.bo=a}static vo(e,t){let o=Qe(),a=Qe();for(const d of t.docChanges)switch(d.type){case 0:o=o.add(d.doc.key);break;case 1:a=a.add(d.doc.key)}return new Wh(e,t.fromCache,o,a)}}/**
21094 * @license
21095 * Copyright 2017 Google LLC
21096 *
21097 * Licensed under the Apache License, Version 2.0 (the "License");
21098 * you may not use this file except in compliance with the License.
21099 * You may obtain a copy of the License at
21100 *
21101 *   http://www.apache.org/licenses/LICENSE-2.0
21102 *
21103 * Unless required by applicable law or agreed to in writing, software
21104 * distributed under the License is distributed on an "AS IS" BASIS,
21105 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21106 * See the License for the specific language governing permissions and
21107 * limitations under the License.
21108 */function EE(r,e){return Ee.comparator(r.key,e.key)}/**
21109 * @license
21110 * Copyright 2023 Google LLC
21111 *
21112 * Licensed under the Apache License, Version 2.0 (the "License");
21113 * you may not use this file except in compliance with the License.
21114 * You may obtain a copy of the License at
21115 *
21116 *   http://www.apache.org/licenses/LICENSE-2.0
21117 *
21118 * Unless required by applicable law or agreed to in writing, softw
21118are
21119 * distributed under the License is distributed on an "AS IS" BASIS,
21120 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21121 * See the License for the specific language governing permissions and
21122 * limitations under the License.
21123 */class SE{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
21124 * @license
21125 * Copyright 2019 Google LLC
21126 *
21127 * Licensed under the Apache License, Version 2.0 (the "License");
21128 * you may not use this file except in compliance with the License.
21129 * You may obtain a copy of the License at
21130 *
21131 *   http://www.apache.org/licenses/LICENSE-2.0
21132 *
21133 * Unless required by applicable law or agreed to in writing, software
21134 * distributed under the License is distributed on an "AS IS" BASIS,
21135 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21136 * See the License for the specific language governing permissions and
21137 * limitations under the License.
21138 */class kE{constructor(){this.So=!1,this.Do=!1,this.xo=100,this.Co=(function(){return r7()?8:Y9(Mn())>0?6:4})()}initialize(e,t){this.Fo=e,this.indexManager=t,this.So=!0}getDocumentsMatchingQuery(e,t,o,a){const d={result:null};return this.Oo(e,t).next((c=>{d.result=c})).next((()=>{if(!d.result)return this.Mo(e,t,a,o).next((c=>{d.result=c}))})).next((()=>{if(d.result)return;const c=new SE;return this.No(e,t,c).next((g=>{if(d.result=g,this.Do)return this.Lo(e,t,c,g.size)}))})).next((()=>d.result))}Lo(e,t,o,a){return ln(t)?se.resolve():o.documentReadCount<this.xo?(Ji()<=st.DEBUG&&ge("QueryEngine","SDK will not create cache indexes for query:",jd(t),"since it only creates cache indexes for collection contains","more than or equal to",this.xo,"documents"),se.resolve()):(Ji()<=st.DEBUG&&ge("QueryEngine","Query:",jd(t),"scans",o.documentReadCount,"local documents and returns",a,"documents as results."),o.documentReadCount>this.Co*a?(Ji()<=st.DEBUG&&ge("QueryEngine","The SDK decides to create cache indexes for query:",jd(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,xs(t))):se.resolve())}Oo(e,t){if(ln(t))return se.resolve(null);let o=t;if(Q2(o))return se.resolve(null);let a=xs(o);return this.indexManager.getIndexType(e,a).next((d=>d===0?null:(o.limit!==null&&d===1&&(o=Mu(o,null,"F"),a=xs(o)),this.indexManager.getDocumentsMatchingTarget(e,a).next((c=>{const g=Qe(...c);return this.Fo.getDocuments(e,g).next((h=>this.indexManager.getMinOffset(e,a).next((v=>{const _=this.Bo(o,h);return this.Uo(o,_,g,v.readTime)?this.Oo(e,Mu(o,null,"F")):this.ko(e,_,o,v)}))))})))))}Mo(e,t,o,a){return(ln(t)?(function(c){for(const g of c.stages){if(g instanceof lc||g instanceof c5)return!1;if(g instanceof Ph){if(g.condition instanceof A4&&g.condition._expr.name==="exists"&&g.condition._expr.params[0]instanceof Ec&&g.condition._expr.params[0].fieldName===ul)continue;return!1}}return!0})(t):Q2(t))||a.isEqual(Ne.min())?se.resolve(null):this.Fo.getDocuments(e,o).next((d=>{const c=this.Bo(t,d);return this.Uo(t,c,o,a)?se.resolve(null):(Ji()<=st.DEBUG&&ge("QueryEngine","Re-using previous result from %s to execute query: %s",a.toString(),m5(t)),this.ko(e,c,t,X9(a,$d)).next((g=>g)))}))}Bo(e,t){let o,a;return ln(e)?(o=new nn(EE),a=d=>up(e,d)):(o=new nn(wh(e)),a=d=>tp(e,d)),t.forEach(((d,c)=>{a(c)&&(o=o.add(c))})),o}Uo(e,t,o,a){if(ln(e))return(function(g){return g.stages.some((h=>h instanceof lc||h instanceof c5))})(e);if(e.limit===null)return!1;if(o.size!==t.size)return!0;const d=e.limitType==="F"?t.last():t.first();return!!d&&(d.hasPendingWrites||d.version.compareTo(a)>0)}No(e,t,o){return Ji()<=st.DEBUG&&ge("QueryEngine","Using full collection scan to execute query:",m5(t)),this.Fo.getDocumentsMatchingQuery(e,t,oa.min(),o)}ko(e,t,o,a){return this.Fo.getDocumentsMatchingQuery(e,o,a).next((d=>(t.forEach((c=>{d=d.insert(c.key,c)})),d)))}}/**
21139 * @license
21140 * Copyright 2020 Google LLC
21141 *
21142 * Licensed under the Apache License, Version 2.0 (the "License");
21143 * you may not use this file except in compliance with the License.
21144 * You may obtain a copy of the License at
21145 *
21146 *   http://www.apache.org/licenses/LICENSE-2.0
21147 *
21148 * Unless required by applicable law or agreed to in writing, softw
21148are
21149 * distributed under the License is distributed on an "AS IS" BASIS,
21150 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21151 * See the License for the specific language governing permissions and
21152 * limitations under the License.
21153 */const Kh="LocalStore",CE=3e8;class RE{constructor(e,t,o,a){this.persistence=e,this.qo=t,this.serializer=a,this.$o=new Mt(et),this.Ko=new ii((d=>P4(d)),z4),this.Wo=new Map,this.Qo=e.getRemoteDocumentCache(),this.g_=e.getTargetCache(),this.w_=e.getBundleCache(),this.Go(o)}Go(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new fE(this.Qo,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Qo.setIndexManager(this.indexManager),this.qo.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(t=>e.collect(t,this.$o)))}}function DE(r,e,t,o){return new RE(r,e,t,o)}async function V4(r,e){const t=Ge(r);return await t.persistence.runTransaction("Handle user change","readonly",(o=>{let a;return t.mutationQueue.getAllMutationBatches(o).next((d=>(a=d,t.Go(e),t.mutationQueue.getAllMutationBatches(o)))).next((d=>{const c=[],g=[];let h=Qe();for(const v of a){c.push(v.batchId);for(const _ of v.mutations)h=h.add(_.key)}for(const v of d){g.push(v.batchId);for(const _ of v.mutations)h=h.add(_.key)}return t.localDocuments.getDocuments(o,h).next((v=>({zo:v,removedBatchIds:c,addedBatchIds:g})))}))}))}function ME(r,e){const t=Ge(r);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",(o=>{const a=e.batch.keys(),d=t.Qo.newChangeBuffer({trackRemovals:!0});return(function(g,h,v,_){const E=v.batch,M=E.keys();let G=se.resolve();return M.forEach((B=>{G=G.next((()=>_.getEntry(h,B))).next((ee=>{const ie=v.docVersions.get(B);Ae(ie!==null,48541),ee.version.compareTo(ie)<0&&(E.applyToRemoteDocument(ee,v),ee.isValidDocument()&&(ee.setReadTime(v.commitVersion),_.addEntry(ee)))}))})),G.next((()=>g.mutationQueue.removeMutationBatch(h,E)))})(t,o,e,d).next((()=>d.apply(o))).next((()=>t.mutationQueue.performConsistencyCheck(o))).next((()=>t.documentOverlayCache.removeOverlaysForBatchId(o,a,e.batch.batchId))).next((()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(o,(function(g){let h=Qe();for(let v=0;v<g.mutationResults.length;++v)g.mutationResults[v].transformResults.length>0&&(h=h.add(g.batch.mutations[v].key));return h})(e)))).next((()=>t.localDocuments.getDocuments(o,a)))}))}function U4(r){const e=Ge(r);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.g_.getLastRemoteSnapshotVersion(t)))}function TE(r,e){const t=Ge(r),o=e.snapshotVersion;let a=t.$o;return t.persistence.runTransaction("Apply remote event","readwrite-primary",(d=>{const c=t.Qo.newChangeBuffer({trackRemovals:!0});a=t.$o;const g=[];
21153e.targetChanges.forEach(((_,E)=>{const M=a.get(E);if(!M)return;g.push(t.g_.removeMatchingKeys(d,_.removedDocuments,E).next((()=>t.g_.addMatchingKeys(d,_.addedDocuments,E))));let G=M.withSequenceNumber(d.currentSequenceNumber);e.targetMismatches.get(E)!==null?G=G.withResumeToken(on.EMPTY_BYTE_STRING,Ne.min()).withLastLimboFreeSnapshotVersion(Ne.min()):_.resumeToken.approximateByteSize()>0&&(G=G.withResumeToken(_.resumeToken,o)),a=a.insert(E,G),(function(ee,ie,ve){return ee.resumeToken.approximateByteSize()===0||ie.snapshotVersion.toMicroseconds()-ee.snapshotVersion.toMicroseconds()>=CE?!0:ve.addedDocuments.size+ve.modifiedDocuments.size+ve.removedDocuments.size>0})(M,G,_)&&g.push(t.g_.updateTargetData(d,G))}));let h=Hn(),v=Qe();if(e.documentUpdates.forEach((_=>{e.resolvedLimboDocuments.has(_)&&g.push(t.persistence.referenceDelegate.updateLimboDocument(d,_))})),g.push(IE(d,c,e.documentUpdates).next((_=>{h=_.jo,v=_.Ho}))),!o.isEqual(Ne.min())){const _=t.g_.getLastRemoteSnapshotVersion(d).next((E=>t.g_.setTargetsMetadata(d,d.currentSequenceNumber,o)));g.push(_)}return se.waitFor(g).next((()=>c.apply(d))).next((()=>t.localDocuments.getLocalViewOfDocuments(d,h,v))).next((()=>h))})).then((d=>(t.$o=a,d)))}function IE(r,e,t){let o=Qe(),a=Qe();return t.forEach((d=>o=o.add(d))),e.getEntries(r,o).next((d=>{let c=Hn();return t.forEach(((g,h)=>{const v=d.get(g);h.isFoundDocument()!==v.isFoundDocument()&&(a=a.add(g)),h.isNoDocument()&&h.version.isEqual(Ne.min())?(e.removeEntry(g,h.readTime),c=c.insert(g,h)):!v.isValidDocument()||h.version.compareTo(v.version)>0||h.version.compareTo(v.version)===0&&v.hasPendingWrites?(e.addEntry(h),c=c.insert(g,h)):ge(Kh,"Ignoring outdated watch update for ",g,". Current version:",v.version," Watch version:",h.version)})),{jo:c,Ho:a}}))}function OE(r,e){const t=Ge(r);return t.persistence.runTransaction("Get next mutation batch","readonly",(o=>(e===void 0&&(e=bh),t.mutationQueue.getNextMutationBatchAfterBatchId(o,e))))}function PE(r,e){const t=Ge(r);return t.persistence.runTransaction("Allocate target","readwrite",(o=>{let a;return t.g_.getTargetData(o,e).next((d=>d?(a=d,se.resolve(a)):t.g_.allocateTargetId(o).next((c=>(a=new $s(e,c,"TargetPurposeListen",o.currentSequenceNumber),t.g_.addTargetData(o,a).next((()=>a)))))))})).then((o=>{const a=t.$o.get(o.targetId);return(a===null||o.snapshotVersion.compareTo(a.snapshotVersion)>0)&&(t.$o=t.$o.insert(o.targetId,o),t.Ko.set(e,o.targetId)),o}))}async function sh(r,e,t){const o=Ge(r),a=o.$o.get(e),d=t?"readwrite":"readwrite-primary";try{t||await o.persistence.runTransaction("Release target",d,(c=>o.persistence.referenceDelegate.removeTarget(c,a)))}catch(c){if(!wl(c))throw c;ge(Kh,`Failed to update sequence numbers for target ${e}: ${c}`)}o.$o=o.$o.remove(e),o.Ko.delete(a.target)}function u5(r,e,t){const o=Ge(r);let a=Ne.min(),d=Qe();return o.persistence.runTransaction("Execute query","readwrite",(c=>(function(h,v,_){const E=Ge(h),M=E.Ko.get(_);return M!==void 0?se.resolve(E.$o.get(M)):E.g_.getTargetData(v,_)})(o,c,ln(e)?e:xs(e)).next((g=>{if(g)return a=g.lastLimboFreeSnapshotVersion,o.g_.getMatchingKeysForTargetId(c,g.targetId).next((h=>{d=h}))})).next((()=>o.qo.getDocumentsMatchingQuery(c,e,t?a:Ne.min(),t?d:Qe()))).next((g=>(zE(o,g),{documents:g,Jo:d})))))}function zE(r,e){e.forEach(((t,o)=>{const a=o.key.getCollectionGroup(),d=r.Wo.get(a)||Ne.min();o.readTime.compareTo(d)>0&&r.Wo.set(a,o.readTime)}))}class p5{constructor(){this.activeTargetIds=LA()}na(e){this.activeTargetIds=this.activeTargetIds.add(e)}ra(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ta(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class LE{constructor(){this.Ua=new p5,this.ka={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,o){}addLocalQueryTarget(e,t=!0){return t&&this.Ua.na(e),this.ka[e]||"not-current"}updateQueryState(e,t,o){this.ka[e]=t}removeLocalQueryTarget(e){this.Ua.ra(e)}isLocalQueryTarget(e){return this.Ua.activeTargetIds.has(e)}clearQueryState(e){delete this.ka[e]}getAllActiveQueryTargets(){return this.Ua.activeTargetIds}isActiveQueryTarget(e){return this.Ua.activeTargetIds.has(e)}start(){return this.Ua=new p5,Promise.resolve()}handleUserChange(e,t,o){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}function If(){return typeof document<"u"?document:null}/**
21154 * @license
21155 * Copyright 2018 Google LLC
21156 *
21157 * Licensed under the Apache License, Version 2.0 (the "License");
21158 * you may not use this file except in compliance with the License.
21159 * You may obtain a copy of the License at
21160 *
21161 *   http://www.apache.org/licenses/LICENSE-2.0
21162 *
21163 * Unless required by applicable law or agreed to in writing, software
21164 * distributed under the License is distributed on an "AS IS" BASIS,
21165 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21166 * See the License for the specific language governing permissions and
21167 * limitations under the License.
21168 */class NE{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.qa=0,this.$a=null,this.Ka=!0}Wa(){this.qa===0&&(this.Qa("Unknown"),this.$a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.$a=null,this.Ga("Backend didn't respond within 10 seconds."),this.Qa("Offline"),Promise.resolve()))))}za(e){this.state==="Online"?this.Qa("Unknown"):(this.qa++,this.qa>=1&&(this.ja(),this.Ga(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.Qa("Offline")))}set(e){this.ja(),this.qa=0,e==="Online"&&(this.Ka=!1),this.Qa(e)}Qa(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}Ga(e){const t=`Could not reach Cloud Firestore backend. ${e}
21169This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.Ka?(nr(t),this.Ka=!1):ge("OnlineStateTracker",t)}ja(){this.$a!==null&&(this.$a.cancel(),this.$a=null)}}/**
21170 * @license
21171 * Copyright 2017 Google LLC
21172 *
21173 * Licensed under the Apache License, Version 2.0 (the "License");
21174 * you may not use this file except in compliance with the License.
21175 * You may obtain a copy of the License at
21176 *
21177 *   http://www.apache.org/licenses/LICENSE-2.0
21178 *
21179 * Unless required by applicable law or agreed to in writing, software
21180 * distributed under the License is distributed on an "AS IS" BASIS,
21181 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21182 * See the License for the specific language governing permissions and
21183 * limitations under the License.
21184 */const ks="RemoteStore";class VE{constructor(e,t,o,a,d){this.localStore=e,this.datastore=t,this.asyncQueue=o,this.remoteSyncer={},this.Ha=[],this.Ja=new Map,this.Ya=new Map,this.Za=new Map,this.Xa=new ma(1e3),this.eu=new ma(1001),this.tu=new Set,this.nu=[],this.ru=d,this.ru.bt((c=>{o.enqueueAndForget((async()=>{di(this)&&(ge(ks,"Restarting streams for network reachability change."),await(async function(h){const v=Ge(h);v.tu.add(4),await kc(v),v.iu.set("Unknown"),v.tu.delete(4),await pp(v)})(this))}))})),this.iu=new NE(o,a)}}async function pp(r){if(di(r))for(const e of r.nu)await e(!0)}async function kc(r){for(const e of r.nu)await e(!1)}function rh(r,e){return r.Ya.get(e)||void 0}function B4(r,e){const t=Ge(r),o=rh(t,e.targetId);if(o!==void 0&&t.Ja.has(o))return;const a=(function(g,h){const v=rh(g,h);v!==void 0&&g.Za.delete(v);const _=(function(M,G){return G%2!=0?M.eu.next():M.Xa.next()})(g,h);return g.Ya.set(h,_),g.Za.set(_,h),_})(t,e.targetId);ge(ks,"remoteStoreListen mapping SDK target ID to remote",e.targetId,a);const d=new $s(e.target,a,e.purpose,e.sequenceNumber,e.snapshotVersion,e.lastLimboFreeSnapshotVersion,e.resumeToken);t.Ja.set(a,d),Jh(t)?$h(t):Rl(t).Fn()&&Yh(t,d)}function Qh(r,e){const t=Ge(r),o=Rl(t),a=rh(t,e);ge(ks,"remoteStoreUnlisten removing mapping of SDK target ID to remote",e,a),t.Ja.delete(a),t.Ya.delete(e),t.Za.delete(a),o.Fn()&&G4(t,a),t.Ja.size===0&&(o.Fn()?o.Nn():di(t)&&t.iu.set("Unknown"))}function Yh(r,e){if(r.su.We(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(Ne.min())>0){const t=r.Za.get(e.targetId);if(t===void 0)return void ge(ks,"SDK target ID not found for remote ID: "+e.targetId);const o=r.remoteSyncer.getRemoteKeysForTarget(t).size;e=e.withExpectedCount(o)}Rl(r).jn(e)}function G4(r,e){r.su.We(e),Rl(r).Hn(e)}function $h(r){r.su=new UA({getRemoteKeysForTarget:e=>{const t=r.Za.get(e);return t!==void 0?r.remoteSyncer.getRemoteKeysForTarget(t):Qe()},dt:e=>r.Ja.get(e)||null,Tt:()=>r.datastore.serializer.databaseId}),Rl(r).start(),r.iu.Wa()}function Jh(r){return di(r)&&!Rl(r).Cn()&&r.Ja.size>0}function di(r){return Ge(r).tu.size===0}function q4(r){r.su=void 0}async function UE(r){r.iu.set("Online")}async function BE(r){r.Ja.forEach(((e,t)=>{Yh(r,e)}))}async function GE(r,e){q4(r),Jh(r)?(r.iu.za(e),$h(r)):r.iu.set("Unknown")}async function qE(r,e,t){if(r.iu.set("Online"),e instanceof Jy&&e.state===2&&e.cause)try{await(async function(a,d){const c=d.cause;for(const g of d.targetIds){if(a.Ja.has(g)){const h=a.Za.get(g);h!==void 0&&(await a.remoteSyncer.rejectListen(h,c),a.Ya.delete(h),a.Za.delete(g)),a.Ja.delete(g)}a.su.removeTarget(g)}})(r,e)}catch(o){ge(ks,"Failed to remove targets %s: %s ",e.targetIds.join(","),o),await Nu(r,o)}else if(e instanceof pu?r.su.et(e):e instanceof $y?r.su.ot(e):r.su.rt(e),!t.isEqual(Ne.min()))try{const o=await U4(r.localStore);t.compareTo(o)>=0&&await(function(d,c){const g=d.su.Rt(c);
21184g.targetChanges.forEach(((v,_)=>{if(v.resumeToken.approximateByteSize()>0){const E=d.Ja.get(_);E&&d.Ja.set(_,E.withResumeToken(v.resumeToken,c))}})),g.targetMismatches.forEach(((v,_)=>{const E=d.Ja.get(v);if(!E)return;d.Ja.set(v,E.withResumeToken(on.EMPTY_BYTE_STRING,E.snapshotVersion)),G4(d,v);const M=new $s(E.target,v,_,E.sequenceNumber);Yh(d,M)}));const h=(function(_,E){const M=new Map;E.targetChanges.forEach(((B,ee)=>{const ie=_.Za.get(ee);ie!==void 0&&M.set(ie,B)}));let G=new Mt(et);return E.targetMismatches.forEach(((B,ee)=>{const ie=_.Za.get(B);ie!==void 0&&(G=G.insert(ie,ee))})),new Ac(E.snapshotVersion,M,G,E.documentUpdates,E.augmentedDocumentUpdates,E.resolvedLimboDocuments)})(d,g);return d.remoteSyncer.applyRemoteEvent(h)})(r,t)}catch(o){ge(ks,"Failed to raise snapshot:",o),await Nu(r,o)}}async function Nu(r,e,t){if(!wl(e))throw e;r.tu.add(1),await kc(r),r.iu.set("Offline"),t||(t=()=>U4(r.localStore)),r.asyncQueue.enqueueRetryable((async()=>{ge(ks,"Retrying IndexedDB access"),await t(),r.tu.delete(1),await pp(r)}))}function F4(r,e){return e().catch((t=>Nu(r,t,e)))}async function gp(r){const e=Ge(r),t=ua(e);let o=e.Ha.length>0?e.Ha[e.Ha.length-1].batchId:bh;for(;FE(e);)try{const a=await OE(e.localStore,o);if(a===null){e.Ha.length===0&&t.Nn();break}o=a.batchId,jE(e,a)}catch(a){await Nu(e,a)}j4(e)&&X4(e)}function FE(r){return di(r)&&r.Ha.length<10}function jE(r,e){r.Ha.push(e);const t=ua(r);t.Fn()&&t.Jn&&t.Yn(e.mutations)}function j4(r){return di(r)&&!ua(r).Cn()&&r.Ha.length>0}function X4(r){ua(r).start()}async function XE(r){ua(r).er()}async function HE(r){const e=ua(r);for(const t of r.Ha)e.Yn(t.mutations)}async function WE(r,e,t){const o=r.Ha.shift(),a=jh.from(o,e,t);await F4(r,(()=>r.remoteSyncer.applySuccessfulWrite(a))),await gp(r)}async function KE(r,e){e&&ua(r).Jn&&await(async function(o,a){if((function(c){return TA(c)&&c!==oe.ABORTED})(a.code)){const d=o.Ha.shift();ua(o).Mn(),await F4(o,(()=>o.remoteSyncer.rejectFailedWrite(d.batchId,a))),await gp(o)}})(r,e),j4(r)&&X4(r)}async function g5(r,e){const t=Ge(r);t.asyncQueue.verifyOperationInProgress(),ge(ks,"RemoteStore received new credentials");const o=di(t);t.tu.add(3),await kc(t),o&&t.iu.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.tu.delete(3),await pp(t)}async function QE(r,e){const t=Ge(r);e?(t.tu.delete(2),await pp(t)):e||(t.tu.add(2),await kc(t),t.iu.set("Unknown"))}function Rl(r){return r._u||(r._u=(function(t,o,a){const d=Ge(t);return d.nr(),new d_(o,d.connection,d.authCredentials,d.appCheckCredentials,d.serializer,a)})(r.datastore,r.asyncQueue,{Qt:UE.bind(null,r),zt:BE.bind(null,r),Ht:GE.bind(null,r),zn:qE.bind(null,r)}),r.nu.push((async e=>{e?(r._u.Mn(),Jh(r)?$h(r):r.iu.set("Unknown")):(await r._u.stop(),q4(r))}))),r._u}function ua(r){return r.ou||(r.ou=(function(t,o,a){const d=Ge(t);return d.nr(),new c_(o,d.connection,d.authCredentials,d.appCheckCredentials,d.serializer,a)})(r.datastore,r.asyncQueue,{Qt:()=>Promise.resolve(),zt:XE.bind(null,r),Ht:KE.bind(null,r),Zn:HE.bind(null,r),Xn:WE.bind(null,r)}),r.nu.push((async e=>{e?(r.ou.Mn(),await gp(r)):(await r.ou.stop(),r.Ha.length>0&&(ge(ks,`Stopping write stream with ${r.Ha.length} pending writes`),r.Ha=[]))}))),r.ou}/**
21185 * @license
21186 * Copyright 2017 Google LLC
21187 *
21188 * Licensed under the Apache License, Version 2.0 (the "License");
21189 * you may not use this file except in compliance with the License.
21190 * You may obtain a copy of the License at
21191 *
21192 *   http://www.apache.org/licenses/LICENSE-2.0
21193 *
21194 * Unless required by applicable law or agreed to in writing, software
21195 * distributed under the License is distributed on an "AS IS" BASIS,
21196 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21197 * See the License for the specific language governing permissions and
21198 * limitations under the License.
21199 */class Zh{constructor(e,t,o,a,d){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=o,this.op=a,this.removalCallback=d,this.deferred=new $a,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((c=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,t,o,a,d){const c=Date.now()+o,g=new Zh(e,t,c,a,d);return g.start(o),g}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new pe(oe.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then((e=>
21199this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function e1(r,e){if(nr("AsyncQueue",`${e}: ${r}`),wl(r))return new pe(oe.UNAVAILABLE,`${e}: ${r}`);throw r}/**
21200 * @license
21201 * Copyright 2017 Google LLC
21202 *
21203 * Licensed under the Apache License, Version 2.0 (the "License");
21204 * you may not use this file except in compliance with the License.
21205 * You may obtain a copy of the License at
21206 *
21207 *   http://www.apache.org/licenses/LICENSE-2.0
21208 *
21209 * Unless required by applicable law or agreed to in writing, software
21210 * distributed under the License is distributed on an "AS IS" BASIS,
21211 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21212 * See the License for the specific language governing permissions and
21213 * limitations under the License.
21214 */class Za{static emptySet(e){return new Za(e.comparator)}constructor(e){this.comparator=e?(t,o)=>e(t,o)||Ee.comparator(t.key,o.key):(t,o)=>Ee.comparator(t.key,o.key),this.keyedMap=Zi(),this.sortedSet=new Mt(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((t,o)=>(e(t),!1)))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof Za)||this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),o=e.sortedSet.getIterator();for(;t.hasNext();){const a=t.getNext().key,d=o.getNext().key;if(!a.isEqual(d))return!1}return!0}toString(){const e=[];return this.forEach((t=>{e.push(t.toString())})),e.length===0?"DocumentSet ()":`DocumentSet (
21215  `+e.join(`  
21216`)+`
21217)`}copy(e,t){const o=new Za;return o.comparator=this.comparator,o.keyedMap=e,o.sortedSet=t,o}}/**
21218 * @license
21219 * Copyright 2017 Google LLC
21220 *
21221 * Licensed under the Apache License, Version 2.0 (the "License");
21222 * you may not use this file except in compliance with the License.
21223 * You may obtain a copy of the License at
21224 *
21225 *   http://www.apache.org/licenses/LICENSE-2.0
21226 *
21227 * Unless required by applicable law or agreed to in writing, software
21228 * distributed under the License is distributed on an "AS IS" BASIS,
21229 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21230 * See the License for the specific language governing permissions and
21231 * limitations under the License.
21232 */class f5{constructor(){this.au=new Mt(Ee.comparator)}track(e){const t=e.doc.key,o=this.au.get(t);o?e.type!==0&&o.type===3?this.au=this.au.insert(t,e):e.type===3&&o.type!==1?this.au=this.au.insert(t,{type:o.type,doc:e.doc}):e.type===2&&o.type===2?this.au=this.au.insert(t,{type:2,doc:e.doc}):e.type===2&&o.type===0?this.au=this.au.insert(t,{type:0,doc:e.doc}):e.type===1&&o.type===0?this.au=this.au.remove(t):e.type===1&&o.type===2?this.au=this.au.insert(t,{type:1,doc:o.doc}):e.type===0&&o.type===1?this.au=this.au.insert(t,{type:2,doc:e.doc}):De(63341,{ft:e,uu:o}):this.au=this.au.insert(t,e)}cu(){const e=[];return this.au.inorderTraversal(((t,o)=>{e.push(o)})),e}}class bl{constructor(e,t,o,a,d,c,g,h,v){this.query=e,this.docs=t,this.oldDocs=o,this.docChanges=a,this.mutatedKeys=d,this.fromCache=c,this.syncStateChanged=g,this.excludesMetadataChanges=h,this.hasCachedResults=v}static fromInitialDocuments(e,t,o,a,d){const c=[];return t.forEach((g=>{c.push({type:0,doc:g})})),new bl(e,t,Za.emptySet(t),c,o,a,!0,!1,d)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&mp(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,o=e.docChanges;if(t.length!==o.length)return!1;for(let a=0;a<t.length;a++)if(t[a].type!==o[a].type||!t[a].doc.isEqual(o[a].doc))return!1;return!0}}/**
21233 * @license
21234 * Copyright 2017 Google LLC
21235 *
21236 * Licensed under the Apache License, Version 2.0 (the "License");
21237 * you may not use this file except in compliance with the License.
21238 * You may obtain a copy of the License at
21239 *
21240 *   http://www.apache.org/licenses/LICENSE-2.0
21241 *
21242 * Unless required by applicable law or agreed to in writing, software
21243 * distributed under the License is distributed on an "AS IS" BASIS,
21244 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21245 * See the License for the specific language governing permissions and
21246 * limitations under the License.
21247 */class YE{constructor(){this.lu=void 0,this.Eu=[]}hu(){return this.Eu.some((e=>e.Tu()))}}class $E{constructor(){this.queries=h5(),this.onlineState="Unknown",this.Pu=new Set}terminate(){(function(t,o){const a=Ge(t),d=a.queries;a.queries=h5(),d.forEach(((c,g)=>{for(const h of g.Eu)h.onError(o)}))})(this,new pe(oe.ABORTED,"Firestore shutting down"))}}function h5(){return new ii((r=>O4(r)),mp)}async function JE(r,e){const t=Ge(r);let o=3;const a=e.query;let d=t.queries.get(a);d?!d.hu()&&e.Tu()&&(o=2):(d=new YE,o=e.Tu()?0:1);try{switch(o){case 0:d.lu=await t.onListen(a,!0);break;case 1:d.lu=await t.onListen(a,!1);break;case 2:await t.onFirstRemoteStoreListen(a)}}catch(c){const g=e1(c,`Initialization of query '${ln(e.query)?er(e.query):jd(e.query)}' failed`);return void e.onError(g)}t.queries.set(a,d),d.Eu.push(e),e.Ru(t.onlineState),d.lu&&e.Iu(d.lu)&&t1(t)}async function ZE(r,e){const t=Ge(r),o=e.query;let a=3;const d=t.queries.get(o);if(d){const c=d.Eu.indexOf(e);c>=0&&(d.Eu.splice(c,1),d.Eu.length===0?a=e.Tu()?0:1:!d.hu()&&e.Tu()&&(a=2))}switch(a){case 0:return t.queries.delete(o),t.onUnlisten(o,!0);case 1:return t.queries.delete(o),t.onUnlisten(o,!1);case 2:return t.onLastRemoteStoreUnlisten(o);default:return}}function eS(r,e){const t=Ge(r);let o=!1;for(const a of e){const d=a.query,c=t.queries.get(d);if(c){for(const g of c.Eu)g.Iu(a)&&(o=!0);c.lu=a}}o&&t1(t)}function tS(r,e,t){const o=Ge(r),a=o.queries.get(e);if(a)for(const d of a.Eu)d.onError(t);o.queries.delete(e)}function t1(r){r.Pu.forEach((e=>{e.next()}))}var ah;(function(r){r.Default="default",r.Cache="cache"})(ah||(ah={}));class nS{constructor(e,t,o){this.query=e,this.Au=t,this.Vu=!1,this.du=null,this.onlineState="Unknown",this.options=o||{}}Iu(e){if(!this.options.includeMetadataChanges){const o=[];for(const a of e.docChanges)a.type!==3&&o.push(a);e=new bl(e.query,e.docs,e.oldDocs,o,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Vu?this.fu(e)&&(this.Au.next(e),t=!0):this.mu(e,this.onlineState)&&(this.pu(e),t=!0),this.du=e,t}onError(e){this.Au.error(e)}Ru(e){this.onlineState=e;let t=!1;return this.du&&!this.Vu&&this.mu(this.du,e)&&(this.pu(this.du),t=!0),t}mu(e,t){if(!e.fromCache||!this.Tu())return!0;const o=t!=="Offline";return(!this.options.waitForSyncWhenOnline||!o)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}fu(e){if(e.docChanges.length>0)return!0;const t=this.du&&this.du.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}pu(e){e=bl.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Vu=!0,this.Au.next(e)}Tu(){return this.options.source!==ah.Cache}}/**
21248 * @license
21249 * Copyright 2017 Google LLC
21250 *
21251 * Licensed under the Apache License, Version 2.0 (the "License");
21252 * you may not use this file except in compliance with the License.
21253 * You may obtain a copy of the License at
21254 *
21255 *   http://www.apache.org/licenses/LICENSE-2.0
21256 *
21257 * Unless required by applicable law or agreed to in writing, software
21258 * distributed under the License is distributed on an "AS IS" BASIS,
21259 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21260 * See the License for the specific language governing permissions and
21261 * limitations under the License.
21262 */class H4{constructor(e){this.key=e}}class W4{constructor(e){this.key=e}}class oS{constructor(e,t){this.query=e,this.Ou=t,this.Mu=null,this.hasCachedResults=!1,this.current=!1,this.Nu=Qe(),this.mutatedKeys=Qe(),this.Lu=ln(e)?oh(e):wh(e),this.Bu=new Za(this.Lu)}get Uu(){return this.Ou}ku(e,t){const o=t?t.qu:new f5,a=t?t.Bu:this.Bu;let d=t?t.mutatedKeys:this.mutatedKeys,c=a,g=!1;const[h,v]=this.$u(this.query,a);e.inorderTraversal(((E,M)=>{const G=a.get(E),B=mE(this.query,M)?M:null,ee=!!G&&this.mutatedKeys.has(G.key),ie=!!B&&(B.hasLocalMutations||this.mutatedKeys.has(B.key)&&B.hasCommittedMutations);let ve=!1;G&&B?G.data.isEqual(B.data)?ee!==ie&&(o.track({type:3,doc:B}),ve=!0):this.Ku(G,B)||(o.track({type:2,doc:B}),ve=!0,(h&&this.Lu(B,h)>0||v&&this.Lu(B,v)<0)&&(g=!0)):!G&&B?(o.track({type:0,doc:B}),ve=!0):G&&!B&&(o.track({type:1,doc:G}),ve=!0,(h||v)&&(g=!0)),ve&&(B?(c=c.add(B),d=ie?d.add(E):d.delete(E)):(c=c.delete(E),d=d.delete(E)))}));const _=this.Wu(this.query);if(_)if(ln(this.query)){const E=[];
21262c.forEach((B=>E.push(B)));const M=L4(this.query,E);let G=new Za(oh(this.query));for(const B of M)G=G.add(B);c.forEach((B=>{G.has(B.key)||(d=d.delete(B.key),o.track({type:1,doc:B}))})),c=G}else{const E=this.Qu(this.query);for(;c.size>_;){const M=E==="F"?c.last():c.first();c=c.delete(M.key),d=d.delete(M.key),o.track({type:1,doc:M})}}return{Bu:c,qu:o,Uo:g,mutatedKeys:d}}Wu(e){var t;return ln(e)?(t=Tf(e))==null?void 0:t.limit:e.limit||void 0}Qu(e){if(ln(e)){const t=Tf(e);return t&&t.limit<0?"L":"F"}return e.limitType}$u(e,t){var o;if(ln(e)){const a=(o=Tf(e))==null?void 0:o.limit;return[t.size===a?t.last():null,null]}return[e.limitType==="F"&&t.size===this.Wu(this.query)?t.last():null,e.limitType==="L"&&t.size===this.Wu(this.query)?t.first():null]}Ku(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,o,a){const d=this.Bu;this.Bu=e.Bu,this.mutatedKeys=e.mutatedKeys;const c=e.qu.cu();c.sort(((_,E)=>(function(G,B){const ee=ie=>{switch(ie){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return De(20277,{ft:ie})}};return ee(G)-ee(B)})(_.type,E.type)||this.Lu(_.doc,E.doc))),this.Gu(o),a=a??!1;const g=t&&!a?this.zu():[],h=this.Nu.size===0&&this.current&&!a?1:0,v=h!==this.Mu;return this.Mu=h,c.length!==0||v?{snapshot:new bl(this.query,e.Bu,d,c,e.mutatedKeys,h===0,v,!1,!!o&&o.resumeToken.approximateByteSize()>0),ju:g}:{ju:g}}Ru(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Bu:this.Bu,qu:new f5,mutatedKeys:this.mutatedKeys,Uo:!1},!1)):{ju:[]}}Hu(e){return!this.Ou.has(e)&&!!this.Bu.has(e)&&!this.Bu.get(e).hasLocalMutations}Gu(e){e&&(e.addedDocuments.forEach((t=>this.Ou=this.Ou.add(t))),e.modifiedDocuments.forEach((t=>{})),e.removedDocuments.forEach((t=>this.Ou=this.Ou.delete(t))),this.current=e.current)}zu(){if(!this.current)return[];const e=this.Nu;this.Nu=Qe(),this.Bu.forEach((o=>{this.Hu(o.key)&&(this.Nu=this.Nu.add(o.key))}));const t=[];return e.forEach((o=>{this.Nu.has(o)||t.push(new W4(o))})),this.Nu.forEach((o=>{e.has(o)||t.push(new H4(o))})),t}Ju(e){this.Ou=e.Jo,this.Nu=Qe();const t=this.ku(e.documents);return this.applyChanges(t,!0)}Yu(){return bl.fromInitialDocuments(this.query,this.Bu,this.mutatedKeys,this.Mu===0,this.hasCachedResults)}}const n1="SyncEngine";class sS{constructor(e,t,o){this.query=e,this.targetId=t,this.view=o}}class rS{constructor(e){this.key=e,this.Zu=!1}}class aS{constructor(e,t,o,a,d,c){this.localStore=e,this.remoteStore=t,this.eventManager=o,this.sharedClientState=a,this.currentUser=d,this.maxConcurrentLimboResolutions=c,this.Xu={},this.ec=new ii((g=>O4(g)),mp),this.tc=new Map,this.nc=new Set,this.rc=new Mt(Ee.comparator),this.sc=new Map,this._c=new Xh,this.oc={},this.ac=new Map,this.uc=ma.Cs(),this.onlineState="Unknown",this.cc=void 0}get isPrimaryClient(){return this.cc===!0}}async function iS(r,e,t=!0){const o=Z4(r);let a;const d=o.ec.get(e);return d?(o.sharedClientState.addLocalQueryTarget(d.targetId),a=d.view.Yu()):a=await K4(o,e,t,!0),a}async function lS(r,e){const t=Z4(r);await K4(t,e,!0,!1)}async function K4(r,e,t,o){const a=await PE(r.localStore,ln(e)?e:xs(e)),d=a.targetId,c=r.sharedClientState.addLocalQueryTarget(d,t);let g;return o&&(g=await dS(r,e,d,c==="current",a.resumeToken)),r.isPrimaryClient&&t&&B4(r.remoteStore,a),g}async function dS(r,e,t,o,a){r.lc=(E,M,G)=>(async function(ee,ie,ve,Se){let Me=ie.view.ku(ve);Me.Uo&&(Me=await u5(ee.localStore,ie.query,!1).then((({documents:w})=>ie.view.ku(w,Me))));const tt=Se&&Se.targetChanges.get(ie.targetId),Ye=Se&&Se.targetMismatches.get(ie.targetId)!=null,qe=ie.view.applyChanges(Me,ee.isPrimaryClient,tt,Ye);return b5(ee,ie.targetId,qe.ju),qe.snapshot})(r,E,M,G);const d=await u5(r.localStore,e,!0),c=new oS(e,d.Jo),g=c.ku(d.documents),h=_c.createSynthesizedTargetChangeForCurrentChange(t,o&&r.onlineState!=="Offline",a),v=c.applyChanges(g,r.isPrimaryClient,h);b5(r,t,v.ju);const _=new sS(e,t,c);return r.ec.set(e,_),r.tc.has(t)?r.tc.get(t).push(e):r.tc.set(t,[e]),v.snapshot}async function cS(r,e,t){const o=Ge(r),a=o.ec.get(e),d=o.tc.get(a.targetId);if(d.length>1)return o.tc.set(a.targetId,d.filter((c=>!mp(c,e)))),void o.ec.delete(e);
21262o.isPrimaryClient?(o.sharedClientState.removeLocalQueryTarget(a.targetId),o.sharedClientState.isActiveQueryTarget(a.targetId)||await sh(o.localStore,a.targetId,!1).then((()=>{o.sharedClientState.clearQueryState(a.targetId),t&&Qh(o.remoteStore,a.targetId),ih(o,a.targetId)})).catch(_l)):(ih(o,a.targetId),await sh(o.localStore,a.targetId,!0))}async function mS(r,e){const t=Ge(r),o=t.ec.get(e),a=t.tc.get(o.targetId);t.isPrimaryClient&&a.length===1&&(t.sharedClientState.removeLocalQueryTarget(o.targetId),Qh(t.remoteStore,o.targetId))}async function uS(r,e,t){const o=yS(r);try{const a=await(function(c,g){const h=Ge(c),v=Ct.now(),_=g.reduce(((G,B)=>G.add(B.key)),Qe());let E,M;return h.persistence.runTransaction("Locally write mutations","readwrite",(G=>{let B=Hn(),ee=Qe();return h.Qo.getEntries(G,_).next((ie=>{B=ie,B.forEach(((ve,Se)=>{Se.isValidDocument()||(ee=ee.add(ve))}))})).next((()=>h.localDocuments.getOverlayedDocuments(G,B))).next((ie=>{E=ie;const ve=[];for(const Se of g){const Me=uA(Se,E.get(Se.key).overlayedDocument);Me!=null&&ve.push(new fa(Se.key,Me,Dy(Me.value.mapValue),Co.exists(!0)))}return h.mutationQueue.addMutationBatch(G,v,ve,g)})).next((ie=>{M=ie;const ve=ie.applyToLocalDocumentSet(E,ee);return h.documentOverlayCache.saveOverlays(G,ie.batchId,ve)}))})).then((()=>({batchId:M.batchId,changes:Qy(E)})))})(o.localStore,e);o.sharedClientState.addPendingMutation(a.batchId),(function(c,g,h){let v=c.oc[c.currentUser.toKey()];v||(v=new Mt(et)),v=v.insert(g,h),c.oc[c.currentUser.toKey()]=v})(o,a.batchId,t),await Cc(o,a.changes),await gp(o.remoteStore)}catch(a){const d=e1(a,"Failed to persist write");t.reject(d)}}async function Q4(r,e){const t=Ge(r);try{const o=await TE(t.localStore,e);
vendor: 4,622 bytes, line 21262
21262e.targetChanges.forEach(((a,d)=>{const c=t.sc.get(d);c&&(Ae(a.addedDocuments.size+a.modifiedDocuments.size+a.removedDocuments.size<=1,22616),a.addedDocuments.size>0?c.Zu=!0:a.modifiedDocuments.size>0?Ae(c.Zu,14607):a.removedDocuments.size>0&&(Ae(c.Zu,42227),c.Zu=!1))})),await Cc(t,o,e)}catch(o){await _l(o)}}function v5(r,e,t){const o=Ge(r);if(o.isPrimaryClient&&t===0||!o.isPrimaryClient&&t===1){const a=[];o.ec.forEach(((d,c)=>{const g=c.view.Ru(e);g.snapshot&&a.push(g.snapshot)})),(function(c,g){const h=Ge(c);h.onlineState=g;let v=!1;h.queries.forEach(((_,E)=>{for(const M of E.Eu)M.Ru(g)&&(v=!0)})),v&&t1(h)})(o.eventManager,e),a.length&&o.Xu.zn(a),o.onlineState=e,o.isPrimaryClient&&o.sharedClientState.setOnlineState(e)}}async function pS(r,e,t){const o=Ge(r);o.sharedClientState.updateQueryState(e,"rejected",t);const a=o.sc.get(e),d=a&&a.key;if(d){let c=new Mt(Ee.comparator);c=c.insert(d,Dn.newNoDocument(d,Ne.min()));const g=Qe().add(d),h=new Ac(Ne.min(),new Map,new Mt(et),c,Hn(),g);await Q4(o,h),o.rc=o.rc.remove(d),o.sc.delete(e),o1(o)}else await sh(o.localStore,e,!1).then((()=>ih(o,e,t))).catch(_l)}async function gS(r,e){const t=Ge(r),o=e.batch.batchId;try{const a=await ME(t.localStore,e);$4(t,o,null),Y4(t,o),t.sharedClientState.updateMutationState(o,"acknowledged"),await Cc(t,a)}catch(a){await _l(a)}}async function fS(r,e,t){const o=Ge(r);try{const a=await(function(c,g){const h=Ge(c);return h.persistence.runTransaction("Reject batch","readwrite-primary",(v=>{let _;return h.mutationQueue.lookupMutationBatch(v,g).next((E=>(Ae(E!==null,37113),_=E.keys(),h.mutationQueue.removeMutationBatch(v,E)))).next((()=>h.mutationQueue.performConsistencyCheck(v))).next((()=>h.documentOverlayCache.removeOverlaysForBatchId(v,_,g))).next((()=>h.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(v,_))).next((()=>h.localDocuments.getDocuments(v,_)))}))})(o.localStore,e);$4(o,e,t),Y4(o,e),o.sharedClientState.updateMutationState(e,"rejected",t),await Cc(o,a)}catch(a){await _l(a)}}function Y4(r,e){(r.ac.get(e)||[]).forEach((t=>{t.resolve()})),r.ac.delete(e)}function $4(r,e,t){const o=Ge(r);let a=o.oc[o.currentUser.toKey()];if(a){const d=a.get(e);d&&(t?d.reject(t):d.resolve(),a=a.remove(e)),o.oc[o.currentUser.toKey()]=a}}function ih(r,e,t=null){r.sharedClientState.removeLocalQueryTarget(e);for(const o of r.tc.get(e))r.ec.delete(o),t&&r.Xu.Ec(o,t);r.tc.delete(e),r.isPrimaryClient&&r._c.s_(e).forEach((o=>{r._c.containsKey(o)||J4(r,o)}))}function J4(r,e){r.nc.delete(e.path.canonicalString());const t=r.rc.get(e);t!==null&&(Qh(r.remoteStore,t),r.rc=r.rc.remove(e),r.sc.delete(t),o1(r))}function b5(r,e,t){for(const o of t)o instanceof H4?(r._c.addReference(o.key,e),hS(r,o)):o instanceof W4?(ge(n1,"Document no longer in limbo: "+o.key),r._c.removeReference(o.key,e),r._c.containsKey(o.key)||J4(r,o.key)):De(19791,{hc:o})}function hS(r,e){const t=e.key,o=t.path.canonicalString();r.rc.get(t)||r.nc.has(o)||(ge(n1,"New document in limbo: "+t),r.nc.add(o),o1(r))}function o1(r){for(;r.nc.size>0&&r.rc.size<r.maxConcurrentLimboResolutions;){const e=r.nc.values().next().value;r.nc.delete(e);const t=new Ee(ut.fromString(e)),o=r.uc.next();r.sc.set(o,new rS(t)),r.rc=r.rc.insert(t,o),B4(r.remoteStore,new $s(xs(_h(t.path)),o,"TargetPurposeLimboResolution",Ku.ce))}}async function Cc(r,e,t){const o=Ge(r),a=[],d=[],c=[];o.ec.isEmpty()||(o.ec.forEach(((g,h)=>{c.push(o.lc(h,e,t).then((v=>{var _;if((v||t)&&o.isPrimaryClient){const E=v?!v.fromCache:(_=t==null?void 0:t.targetChanges.get(h.targetId))==null?void 0:_.current;o.sharedClientState.updateQueryState(h.targetId,E?"current":"not-current")}if(v){a.push(v);const E=Wh.vo(h.targetId,v);d.push(E)}})))})),await Promise.all(c),o.Xu.zn(a),await(async function(h,v){const _=Ge(h);try{await _.persistence.runTransaction("notifyLocalViewChanges","readwrite",(E=>se.forEach(v,(M=>se.forEach(M.wo,(G=>_.persistence.referenceDelegate.addReference(E,M.targetId,G))).next((()=>se.forEach(M.bo,(G=>_.persistence.referenceDelegate.removeReference(E,M.targetId,G)))))))))}catch(E){if(!wl(E))throw E;ge(Kh,"Failed to update sequence numbers: "+E)}for(const E of v){const M=E.targetId;if(!E.fromCache){const G=_.$o.get(M),B=G.snapshotVersion,ee=G.withLastLimboFreeSnapshotVersion(B);_.$o=_.$o.insert(M,ee)}}})(o.localStore,d))}async function vS(r,e){const t=Ge(r);if(!t.currentUser.isEqual(e)){ge(n1,"User change. New user:",e.toKey());const o=await V4(t.localStore,e);t.currentUser=e,(function(d,c){d.ac.forEach((g=>{g.forEach((h=>{h.reject(new pe(oe.CANCELLED,c))}))})),d.ac.clear()})(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedCl
21262ientState.handleUserChange(e,o.removedBatchIds,o.addedBatchIds),await Cc(t,o.zo)}}function bS(r,e){const t=Ge(r),o=t.sc.get(e);if(o&&o.Zu)return Qe().add(o.key);{let a=Qe();const d=t.tc.get(e);if(!d)return a;for(const c of d??[]){const g=t.ec.get(c);a=a.unionWith(g.view.Uu)}return a}}function Z4(r){const e=Ge(r);return e.remoteStore.remoteSyncer.applyRemoteEvent=Q4.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=bS.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=pS.bind(null,e),e.Xu.zn=eS.bind(null,e.eventManager),e.Xu.Ec=tS.bind(null,e.eventManager),e}function yS(r){const e=Ge(r);return e.remoteStore.remoteSyncer.applySuccessfulWrite=gS.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=fS.bind(null,e),e}class Vu{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=np(e.databaseInfo.databaseId),this.sharedClientState=this.Rc(e),this.persistence=this.Ic(e),await this.persistence.start(),this.localStore=this.Ac(e),this.gcScheduler=this.Vc(e,this.localStore),this.indexBackfillerScheduler=this.dc(e,this.localStore)}Vc(e,t){return null}dc(e,t){return null}Ac(e){return DE(this.persistence,new kE,e.initialUser,this.serializer)}Ic(e){return new N4(Hh.C_,this.serializer)}Rc(e){return new LE}async terminate(){var e,t;(e=this.gcScheduler)==null||e.stop(),(t=this.indexBackfillerScheduler)==null||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Vu.provider={build:()=>new Vu};class xS extends Vu{constructor(e){super(),this.cacheSizeBytes=e}Vc(e,t){Ae(this.persistence.referenceDelegate instanceof Lu,46915);const o=this.persistence.referenceDelegate.garbageCollector;return new b_(o,e.asyncQueue,t)}Ic(e){const t=this.cacheSizeBytes!==void 0?jn.withCacheSize(this.cacheSizeBytes):jn.DEFAULT;return new N4((o=>Lu.C_(o,t)),this.serializer)}}class lh{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=o=>v5(this.syncEngine,o,1),this.remoteStore.remoteSyncer.handleCredentialChange=vS.bind(null,this.syncEngine),await QE(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return(function(){return new $E})()}createDatastore(e){const t=np(e.databaseInfo.databaseId),o=l_(e.databaseInfo);return p_(e.authCredentials,e.appCheckCredentials,o,t)}createRemoteStore(e){return(function(o,a,d,c,g){return new VE(o,a,d,c,g)})(this.localStore,this.datastore,e.asyncQueue,(t=>v5(this.syncEngine,t,0)),(function(){return n5.C()?new n5:new s_})())}createSyncEngine(e,t){return(function(a,d,c,g,h,v,_){const E=new aS(a,d,c,g,h,v);return _&&(E.cc=!0),E})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await(async function(a){const d=Ge(a);ge(ks,"RemoteStore shutting down."),d.tu.add(5),await kc(d),d.ru.shutdown(),d.iu.set("Unknown")})(this.remoteStore),(e=this.datastore)==null||e.terminate(),(t=this.eventManager)==null||t.terminate()}}lh.provider={build:()=>new lh};/**
21263 * @license
21264 * Copyright 2020 Google LLC
21265 *
21266 * Licensed under the Apache License, Version 2.0 (the "License");
21267 * you may not use this file except in compliance with the License.
21268 * You may obtain a copy of the License at
21269 *
21270 *   http://www.apache.org/licenses/LICENSE-2.0
21271 *
21272 * Unless required by applicable law or agreed to in writing, software
21273 * distributed under the License is distributed on an "AS IS" BASIS,
21274 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21275 * See the License for the specific language governing permissions and
21276 * limitations under the License.
21277 *//**
21278 * @license
21279 * Copyright 2017 Google LLC
21280 *
21281 * Licensed under the Apache License, Version 2.0 (the "License");
21282 * you may not use this file except in compliance with the License.
21283 * You may obtain a copy of the License at
21284 *
21285 *   http://www.apache.org/licenses/LICENSE-2.0
21286 *
21287 * Unless required by applicable law or agreed to in writing, softw
21287are
21288 * distributed under the License is distributed on an "AS IS" BASIS,
21289 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21290 * See the License for the specific language governing permissions and
21291 * limitations under the License.
21292 */class AS{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.mc(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.mc(this.observer.error,e):nr("Uncaught Error in snapshot listener:",e.toString()))}gc(){this.muted=!0}mc(e,t){setTimeout((()=>{this.muted||e(t)}),0)}}/**
21293 * @license
21294 * Copyright 2017 Google LLC
21295 *
21296 * Licensed under the Apache License, Version 2.0 (the "License");
21297 * you may not use this file except in compliance with the License.
21298 * You may obtain a copy of the License at
21299 *
21300 *   http://www.apache.org/licenses/LICENSE-2.0
21301 *
21302 * Unless required by applicable law or agreed to in writing, software
21303 * distributed under the License is distributed on an "AS IS" BASIS,
21304 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21305 * See the License for the specific language governing permissions and
21306 * limitations under the License.
21307 */const pa="FirestoreClient";class _S{constructor(e,t,o,a,d){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=o,this._databaseInfo=a,this.user=Rn.UNAUTHENTICATED,this.clientId=vh.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=d,this.authCredentials.start(o,(async c=>{ge(pa,"Received user=",c.uid),await this.authCredentialListener(c),this.user=c})),this.appCheckCredentials.start(o,(c=>(ge(pa,"Received new app check token=",c),this.appCheckCredentialListener(c,this.user))))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new $a;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const o=e1(t,"Failed to shutdown persistence");e.reject(o)}})),e.promise}}async function Of(r,e){r.asyncQueue.verifyOperationInProgress(),ge(pa,"Initializing OfflineComponentProvider");const t=r.configuration;await e.initialize(t);let o=t.initialUser;r.setCredentialChangeListener((async a=>{o.isEqual(a)||(await V4(e.localStore,a),o=a)})),e.persistence.setDatabaseDeletedListener((()=>r.terminate())),r._offlineComponents=e}async function y5(r,e){r.asyncQueue.verifyOperationInProgress();const t=await wS(r);ge(pa,"Initializing OnlineComponentProvider"),await e.initialize(t,r.configuration),r.setCredentialChangeListener((o=>g5(e.remoteStore,o))),r.setAppCheckTokenChangeListener(((o,a)=>g5(e.remoteStore,a))),r._onlineComponents=e}async function wS(r){if(!r._offlineComponents)if(r._uninitializedComponentsProvider){ge(pa,"Using user provided OfflineComponentProvider");try{await Of(r,r._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!(function(a){return a.name==="FirebaseError"?a.code===oe.FAILED_PRECONDITION||a.code===oe.UNIMPLEMENTED:!(typeof DOMException<"u"&&a instanceof DOMException)||a.code===22||a.code===20||a.code===11})(t))throw t;jo("Error using user provided cache. Falling back to memory cache: "+t),await Of(r,new Vu)}}else ge(pa,"Using default OfflineComponentProvider"),await Of(r,new xS(void 0));return r._offlineComponents}async function e8(r){return r._onlineComponents||(r._uninitializedComponentsProvider?(ge(pa,"Using user provided OnlineComponentProvider"),await y5(r,r._uninitializedComponentsProvider._online)):(ge(pa,"Using default OnlineComponentProvider"),await y5(r,new lh))
vendor: 4,107 bytes, lines 21307-21323
21307),r._onlineComponents}function ES(r){return e8(r).then((e=>e.syncEngine))}async function x5(r){const e=await e8(r),t=e.eventManager;return t.onListen=iS.bind(null,e.syncEngine),t.onUnlisten=cS.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=lS.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=mS.bind(null,e.syncEngine),t}function SS(r,e,t,o){const a=new AS(o),d=new nS(e,a,t);return r.asyncQueue.enqueueAndForget((async()=>JE(await x5(r),d))),()=>{a.gc(),r.asyncQueue.enqueueAndForget((async()=>ZE(await x5(r),d)))}}function kS(r,e){const t=new $a;return r.asyncQueue.enqueueAndForget((async()=>uS(await ES(r),e,t))),t.promise}/**
21308 * @license
21309 * Copyright 2020 Google LLC
21310 *
21311 * Licensed under the Apache License, Version 2.0 (the "License");
21312 * you may not use this file except in compliance with the License.
21313 * You may obtain a copy of the License at
21314 *
21315 *   http://www.apache.org/licenses/LICENSE-2.0
21316 *
21317 * Unless required by applicable law or agreed to in writing, software
21318 * distributed under the License is distributed on an "AS IS" BASIS,
21319 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21320 * See the License for the specific language governing permissions and
21321 * limitations under the License.
21322 */const A5="AsyncQueue";class _5{constructor(e=Promise.resolve()){this.qc=[],this.$c=!1,this.Kc=[],this.Wc=null,this.Qc=!1,this.Gc=!1,this.zc=[],this.xn=new d4(this,"async_queue_retry"),this.jc=()=>{const o=If();o&&ge(A5,"Visibility state changed to "+o.visibilityState),this.xn.gn()},this.Hc=e;const t=If();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.jc)}get isShuttingDown(){return this.$c}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Jc(),this.Yc(e)}enterRestrictedMode(e){if(!this.$c){this.$c=!0,this.Gc=e||!1;const t=If();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.jc)}}enqueue(e){if(this.Jc(),this.$c)return new Promise((()=>{}));const t=new $a;return this.Yc((()=>this.$c&&this.Gc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.qc.push(e),this.Zc())))}async Zc(){if(this.qc.length!==0){try{await this.qc[0](),this.qc.shift(),this.xn.reset()}catch(e){if(!wl(e))throw e;ge(A5,"Operation failed with retryable error: "+e)}this.qc.length>0&&this.xn.mn((()=>this.Zc()))}}Yc(e){const t=this.Hc.then((()=>(this.Qc=!0,e().catch((o=>{throw this.Wc=o,this.Qc=!1,nr("INTERNAL UNHANDLED ERROR: ",w5(o)),o})).then((o=>(this.Qc=!1,o))))));return this.Hc=t,t}enqueueAfterDelay(e,t,o){this.Jc(),this.zc.indexOf(e)>-1&&(t=0);const a=Zh.createAndSchedule(this,e,t,o,(d=>this.Xc(d)));return this.Kc.push(a),a}Jc(){this.Wc&&De(47125,{el:w5(this.Wc)})}verifyOperationInProgress(){}async tl(){let e;do e=this.Hc,await e;while(e!==this.Hc)}nl(e){for(const t of this.Kc)if(t.timerId===e)return!0;return!1}rl(e){return this.tl().then((()=>{this.Kc.sort(((t,o)=>t.targetTimeMs-o.targetTimeMs));for(const t of this.Kc)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.tl()}))}il(e){this.zc.push(e)}Xc(e){const t=this.Kc.indexOf(e);this.Kc.splice(t,1)}}function w5(r){let e=r.message||"";return r.stack&&(e=r.stack.includes(r.message)?r.stack:r.message+`
21323`+r.stack),e}class ri extends sp{constructor(e,t,o,a){super(e,t,o,a),this.type="firestore",this._queue=new _5,this._persistenceKey=(a==null?void 0:a.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new _5(e),this._firestoreClient=void 0,await e}}}function CS(r,e){const t=typeof r=="object"?r:iy(),o=typeof r=="string"?r:e||Eu,a=fh(t,"firestore").getImmediate({identifier:o});if(!a._initialized){const d=Yx("firestore");d&&A_(a,...d)}return a}function t8(r){if(r._terminated)throw new pe(oe.FAILED_PRECONDITION,"The client has already been terminated.");return r._firestoreClient||RS(r),r._firestoreClient}function RS(r){var o,a,d,c;const e=r._freezeSettings(),t=f_(r._databaseId,((o=r._app)==null?void 0:o.options.appId)||"",r._persistenceKey,(
21323a=r._app)==null?void 0:a.options.apiKey,e);r._componentsProvider||(d=e.localCache)!=null&&d._offlineComponentProvider&&((c=e.localCache)!=null&&c._onlineComponentProvider)&&(r._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),r._firestoreClient=new _S(r._authCredentials,r._appCheckCredentials,r._queue,t,r._componentsProvider&&(function(h){const v=h==null?void 0:h._online.build();return{_offline:h==null?void 0:h._offline.build(v),_online:v}})(r._componentsProvider))}/**
21324 * @license
21325 * Copyright 2020 Google LLC
21326 *
21327 * Licensed under the Apache License, Version 2.0 (the "License");
21328 * you may not use this file except in compliance with the License.
21329 * You may obtain a copy of the License at
21330 *
21331 *   http://www.apache.org/licenses/LICENSE-2.0
21332 *
21333 * Unless required by applicable law or agreed to in writing, software
21334 * distributed under the License is distributed on an "AS IS" BASIS,
21335 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21336 * See the License for the specific language governing permissions and
21337 * limitations under the License.
21338 */class DS{convertValue(e,t="none"){switch(sn(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Ot(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(ra(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw De(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const o={};return ga(e,((a,d)=>{o[a]=this.convertValue(d,t)})),o}convertVectorValue(e){var o,a,d;const t=(d=(a=(o=e.fields)==null?void 0:o[ec].arrayValue)==null?void 0:a.values)==null?void 0:d.map((c=>Ot(c.doubleValue)));return new Wn(t)}convertGeoPoint(e){return new _s(Ot(e.latitude),Ot(e.longitude))}convertArray(e,t){return(e.values||[]).map((o=>this.convertValue(o,t)))}convertServerTimestamp(e,t){switch(t){case"previous":const o=yc(e);return o==null?null:this.convertValue(o,t);case"estimate":return this.convertTimestamp(pl(e));default:return null}}convertTimestamp(e){const t=sa(e);return new Ct(t.seconds,t.nanos)}convertDocumentKey(e,t){const o=ut.fromString(e);Ae(r4(o),9688,{name:e});const a=new Zd(o.get(1),o.get(3)),d=new Ee(o.popFirst(5));return a.isEqual(t)||nr(`Document ${d} contains a document reference within a different database (${a.projectId}/${a.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),d}}/**
21339 * @license
21340 * Copyright 2024 Google LLC
21341 *
21342 * Licensed under the Apache License, Version 2.0 (the "License");
21343 * you may not use this file except in compliance with the License.
21344 * You may obtain a copy of the License at
21345 *
21346 *   http://www.apache.org/licenses/LICENSE-2.0
21347 *
21348 * Unless required by applicable law or agreed to in writing, software
21349 * distributed under the License is distributed on an "AS IS" BASIS,
21350 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21351 * See the License for the specific language governing permissions and
21352 * limitations under the License.
21353 */class n8 extends DS{constructor(e){super(),this.firestore=e}convertBytes(e){return new ko(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new Vt(this.firestore,null,t)}}const E5="@firebase/firestore",S5="4.16.0";/**
21354 * @license
21355 * Copyright 2017 Google LLC
21356 *
21357 * Licensed under the Apache License, Version 2.0 (the "License");
21358 * you may not use this file except in compliance with the License.
21359 * You may obtain a copy of the License at
21360 *
21361 *   http://www.apache.org/licenses/LICENSE-2.0
21362 *
21363 * Unless required by applicable law or agreed to in writing, software
21364 * distributed under the License is distributed on an "AS IS" BASIS,
21365 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21366 * See the License for the specific language governing permissions and
21367 * limitations under the License.
21368 */function k5(r){return(function(t,o){if(typeof t!="object"||t===null)return!1;const a=t;for(const d of o)if(d in a&&typeof a[d]=="function")return!0;return!1})(r,["next","error","complete"])}/**
21369 * @license
21370 * Copyright 2020 Google LLC
21371 *
21372 * Licensed under the Apache License, Version 2.0 (the "License");
21373 * you may not use this file except in compliance with the License.
21374 * You may obtain a copy of the License at
21375 *
21376 *   http://www.apache.org/licenses/LICENSE-2.0
21377 *
21378 * Unless required by applicable law or agreed to in writing, software
21379 * distributed under the License is distributed on an "AS IS" BASIS,
21380 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21381 * See the License for the specific language governing permissions and
21382 * limitations under the License.
21383 */class o8{constructor(e,t,o,a,d){this._firestore=e,this._userDataWriter=t,this._key=o,this._document=a,this._converter=d}get id(){return this._key.path.lastSegment()}get ref(){return new Vt(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new MS(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){var e;return((e=this._document)==null?void 0:e.data.clone().value.mapValue.fields)??void 0}get(e){if(this._document){const t=this._document.data.field(la("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class MS extends o8{data(){return super.data()}}/**
21384 * @license
21385 * Copyright 2020 Google LLC
21386 *
21387 * Licensed under the Apache License, Version 2.0 (the "License");
21388 * you may not use this file except in compliance with the License.
21389 * You may obtain a copy of the License at
21390 *
21391 *   http://www.apache.org/licenses/LICENSE-2.0
21392 *
21393 * Unless required by applicable law or agreed to in writing, software
21394 * distributed under the License is distributed on an "AS IS" BASIS,
21395 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21396 * See the License for the specific language governing permissions and
21397 * limitations under the License.
21398 */function TS(r){if(r.limitType==="L"&&r.explicitOrderBy.length===0)throw new pe(oe.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class s1{}class r1 extends s1{}function s8(r,e,...t){let o=[];e instanceof s1&&o.push(e),o=o.concat(t),(function(d){const c=d.filter((h=>h instanceof a1)).length,g=d.filter((h=>h instanceof fp)).length;if(c>1||c>0&&g>0)throw new pe(oe.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")})(o);for(const a of o)r=a._apply(r);return r}class fp extends r1{constructor(e,t,o){super(),this._field=e,this._op=t,this._value=o,this.type="where"}static _create(e,t,o){return new fp(e,t,o)}_apply(e){const t=this._parse(e);return r8(e._query,t),new ha(e.firestore,e.converter,Yf(e._query,t))}_parse(e){const t=rp(e.firestore);return(function(d,c,g,h,v,_,E){let M;if(v.isKeyField()){if(_==="array-contains"||_==="array-contains-any")throw new pe(oe.INVALID_ARGUMENT,`Invalid Query. You can't perform '${_}' queries on documentId().`);if(_==="in"||_==="not-in"){R5(E,_);const B=[];for(const ee of E)B.push(C5(h,d,ee));M={arrayValue:{values:B}}}else M=C5(h,d,E)}else _!=="in"&&_!=="not-in"&&_!=="array-contains-any"||R5(E,_),M=C_(g,c,E,_==="in"||_==="not-in");return en.create(v,_,M)})(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function IS(r,e,t){const o=e,a=la("where",r);return fp._create(a,o,t)}class a1 extends s1{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new a1(e,t)}_parse(e){const t=this._queryConstraints.map((o=>o._parse(e))).filter((o=>o.getFilters().length>0));return t.length===1?t[0]:Xo.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:((function(a,d){let c=a;const g=d.getFlattenedFilters();for(const h of g)r8(c,h),c=Yf(c,h)})(e._query,t),new ha(e.firestore,e.converter,Yf(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}
21398class i1 extends r1{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new i1(e,t)}_apply(e){const t=(function(a,d,c){if(a.startAt!==null)throw new pe(oe.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(a.endAt!==null)throw new pe(oe.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new rc(d,c)})(e._query,this._field,this._direction);return new ha(e.firestore,e.converter,CA(e._query,t))}}function dh(r,e="asc"){const t=e,o=la("orderBy",r);return i1._create(o,t)}class l1 extends r1{constructor(e,t,o){super(),this.type=e,this._limit=t,this._limitType=o}static _create(e,t,o){return new l1(e,t,o)}_apply(e){return new ha(e.firestore,e.converter,Mu(e._query,this._limit,this._limitType))}}function OS(r){return l1._create("limit",r,"F")}function C5(r,e,t){if(typeof(t=_n(t))=="string"){if(t==="")throw new pe(oe.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Hy(e)&&t.indexOf("/")!==-1)throw new pe(oe.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${t}' contains a '/' character.`);const o=e.path.child(ut.fromString(t));if(!Ee.isDocumentKey(o))throw new pe(oe.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${o}' is not because it has an odd number of segments (${o.length}).`);return G2(r,new Ee(o))}if(t instanceof Vt)return G2(r,t._key);throw new pe(oe.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Wu(t)}.`)}function R5(r,e){if(!Array.isArray(r)||r.length===0)throw new pe(oe.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function r8(r,e){const t=(function(a,d){for(const c of a)for(const g of c.getFlattenedFilters())if(d.indexOf(g.op)>=0)return g.op;return null})(r.filters,(function(a){switch(a){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}})(e.op));if(t!==null)throw t===e.op?new pe(oe.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new pe(oe.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}function a8(r,e,t){let o;return o=r?r.toFirestore(e):e,o}class Vd{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class ei extends o8{constructor(e,t,o,a,d,c){super(e,t,o,a,c),this._firestore=e,this._firestoreImpl=e,this.metadata=d}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new fu(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const o=this._document.data.field(la("DocumentSnapshot.get",e));if(o!==null)return this._userDataWriter.convertValue(o,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new pe(oe.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=ei._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?t:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t)}}ei._jsonSchemaVersion="firestore/documentSnapshot/1.0",ei._jsonSchema={type:tn("string",ei._jsonSchemaVersion),bundleSource:tn("string","DocumentSnapshot"),bundleName:tn("string"),bundle:tn("string")};class fu extends ei{data(e={}){return super.data(e)}}class rl{constructor(e,t,o,a){this._firestore=e,this._userDataWriter=t,this._snapshot=a,this.metadata=new Vd(a.hasPendingWrites,a.fromCache),this.query=o}get docs(){const e=[];return this.forEach((t=>e.push(t))),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach((o=>{e.call(t,new fu(this._firestore,this._userDataWriter,o.key,o,new Vd(this._snapshot.mutatedKeys.has(o.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new pe(oe.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=(function(a,d){if(a._snapshot.oldDocs.isEmpty()){let c=0;return a._snapshot.docChanges.map((g=>
21398{ln(a._snapshot.query)?oh(a._snapshot.query):wh(a.query._query);const h=new fu(a._firestore,a._userDataWriter,g.doc.key,g.doc,new Vd(a._snapshot.mutatedKeys.has(g.doc.key),a._snapshot.fromCache),a.query.converter);return g.doc,{type:"added",doc:h,oldIndex:-1,newIndex:c++}}))}{let c=a._snapshot.oldDocs;return a._snapshot.docChanges.filter((g=>d||g.type!==3)).map((g=>{const h=new fu(a._firestore,a._userDataWriter,g.doc.key,g.doc,new Vd(a._snapshot.mutatedKeys.has(g.doc.key),a._snapshot.fromCache),a.query.converter);let v=-1,_=-1;return g.type!==0&&(v=c.indexOf(g.doc.key),c=c.delete(g.doc.key)),g.type!==1&&(c=c.add(g.doc),_=c.indexOf(g.doc.key)),{type:PS(g.type),doc:h,oldIndex:v,newIndex:_}}))}})(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new pe(oe.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=rl._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=vh.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],o=[],a=[];return this.docs.forEach((d=>{d._document!==null&&(t.push(d._document),o.push(this._userDataWriter.convertObjectMap(d._document.data.value.mapValue.fields,"previous")),a.push(d.ref.path))})),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function PS(r){switch(r){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return De(61501,{type:r})}}/**
21399 * @license
21400 * Copyright 2022 Google LLC
21401 *
21402 * Licensed under the Apache License, Version 2.0 (the "License");
21403 * you may not use this file except in compliance with the License.
21404 * You may obtain a copy of the License at
21405 *
21406 *   http://www.apache.org/licenses/LICENSE-2.0
21407 *
21408 * Unless required by applicable law or agreed to in writing, software
21409 * distributed under the License is distributed on an "AS IS" BASIS,
21410 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21411 * See the License for the specific language governing permissions and
21412 * limitations under the License.
21413 */rl._jsonSchemaVersion="firestore/querySnapshot/1.0",rl._jsonSchema={type:tn("string",rl._jsonSchemaVersion),bundleSource:tn("string","QuerySnapshot"),bundleName:tn("string"),bundle:tn("string")};function zS(r,e,t){r=ys(r,Vt);const o=ys(r.firestore,ri),a=a8(r.converter,e),d=rp(o);return hp(o,[f4(d,"setDoc",r._key,a,r.converter!==null,t).toMutation(r._key,Co.none())])}function LS(r,e,t,...o){r=ys(r,Vt);const a=ys(r.firestore,ri),d=rp(a);let c;return c=typeof(e=_n(e))=="string"||e instanceof op?k_(d,"updateDoc",r._key,e,t,o):S_(d,"updateDoc",r._key,e),hp(a,[c.toMutation(r._key,Co.exists(!0))])}function NS(r){return hp(ys(r.firestore,ri),[new Ah(r._key,Co.none())])}function VS(r,e){const t=ys(r.firestore,ri),o=Ou(r),a=a8(r.converter,e),d=rp(r.firestore);return hp(t,[f4(d,"addDoc",o._key,a,r.converter!==null,{}).toMutation(o._key,Co.exists(!1))]).then((()=>o))}function i8(r,...e){var v,_,E;r=_n(r);let t={includeMetadataChanges:!1,source:"default"},o=0;typeof e[o]!="object"||k5(e[o])||(t=e[o++]);const a={includeMetadataChanges:t.includeMetadataChanges,source:t.source};if(k5(e[o])){const M=e[o];e[o]=(v=M.next)==null?void 0:v.bind(M),e[o+1]=(_=M.error)==null?void 0:_.bind(M),e[o+2]=(E=M.complete)==null?void 0:E.bind(M)}let d,c,g;if(r instanceof Vt)c=ys(r.firestore,ri),g=_h(r._key.path),d={next:
21413M=>{e[o]&&e[o](US(c,r,M))},error:e[o+1],complete:e[o+2]};else{const M=ys(r,ha);c=ys(M.firestore,ri),g=M._query;const G=new n8(c);d={next:B=>{e[o]&&e[o](new rl(c,G,M,B))},error:e[o+1],complete:e[o+2]},TS(r._query)}const h=t8(c);return SS(h,g,a,d)}function hp(r,e){const t=t8(r);return kS(t,e)}function US(r,e,t){const o=t.docs.get(e._key),a=new n8(r);return new ei(r,a,e._key,o,new Vd(t.hasPendingWrites,t.fromCache),e.converter)}(function(e,t=!0){O9(xl),cl(new oi("firestore",((o,{instanceIdentifier:a,options:d})=>{const c=o.getProvider("app").getImmediate(),g=new ri(new L9(o.getProvider("auth-internal")),new U9(c,o.getProvider("app-check-internal")),sA(c,a),c);return d={useFetchStreams:t,...d},g._setSettings(d),g}),"PUBLIC").setMultipleInstances(!0)),Yr(E5,S5,e),Yr(E5,S5,"esm2020")})();var BS="firebase",GS="12.15.0";/**
21414 * @license
21415 * Copyright 2020 Google LLC
21416 *
21417 * Licensed under the Apache License, Version 2.0 (the "License");
21418 * you may not use this file except in compliance with the License.
21419 * You may obtain a copy of the License at
21420 *
21421 *   http://www.apache.org/licenses/LICENSE-2.0
21422 *
21423 * Unless required by applicable law or agreed to in writing, software
21424 * distributed under the License is distributed on an "AS IS" BASIS,
21425 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21426 * See the License for the specific language governing permissions and
21427 * limitations under the License.
21428 */Yr(BS,GS,"app");function l8(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const qS=l8,d8=new gc("auth","Firebase",l8());/**
21429 * @license
21430 * Copyright 2020 Google LLC
21431 *
21432 * Licensed under the Apache License, Version 2.0 (the "License");
21433 * you may not use this file except in compliance with the License.
21434 * You may obtain a copy of the License at
21435 *
21436 *   http://www.apache.org/licenses/LICENSE-2.0
21437 *
21438 * Unless required by applicable law or agreed to in writing, software
21439 * distributed under the License is distributed on an "AS IS" BASIS,
21440 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21441 * See the License for the specific language governing permissions and
21442 * limitations under the License.
21443 */const Uu=new ph("@firebase/auth");function FS(r,...e){Uu.logLevel<=st.WARN&&Uu.warn(`Auth (${xl}): ${r}`,...e)}function hu(r,...e){Uu.logLevel<=st.ERROR&&Uu.error(`Auth (${xl}): ${r}`,...e)}/**
21444 * @license
21445 * Copyright 2020 Google LLC
21446 *
21447 * Licensed under the Apache License, Version 2.0 (the "License");
21448 * you may not use this file except in compliance with the License.
21449 * You may obtain a copy of the License at
21450 *
21451 *   http://www.apache.org/licenses/LICENSE-2.0
21452 *
21453 * Unless required by applicable law or agreed to in writing, software
21454 * distributed under the License is distributed on an "AS IS" BASIS,
21455 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21456 * See the License for the specific language governing permissions and
21457 * limitations under the License.
21458 */function sr(r,...e){throw d1(r,...e)}function ws(r,...e){return d1(r,...e)}function c8(r,e,t){const o={...qS(),[e]:t};return new gc("auth","Firebase",o).create(e,{appName:r.name})}function ti(r){return c8(r,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function d1(r,...e){if(typeof r!="string"){const t=e[0],o=[...e.slice(1)];return o[0]&&(o[0].appName=r.name),r._errorFactory.create(t,...o)}return d8.create(r,...e)}function Le(r,e,...t){if(!r)throw d1(e,...t)}function Js(r){const e="INTERNAL ASSERTION FAILED: "+r;throw hu(e),new Error(e)}function rr(r,e){r||Js(e)}/**
21459 * @license
21460 * Copyright 2020 Google LLC
21461 *
21462 * Licensed under the Apache License, Version 2.0 (the "License");
21463 * you may not use this file except in compliance with the License.
21464 * You may obtain a copy of the License at
21465 *
21466 *   http://www.apache.org/licenses/LICENSE-2.0
21467 *
21468 * Unless required by applicable law or agreed to in writing, softw
21468are
21469 * distributed under the License is distributed on an "AS IS" BASIS,
21470 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21471 * See the License for the specific language governing permissions and
21472 * limitations under the License.
21473 */function ch(){var r;return typeof self<"u"&&((r=self.location)==null?void 0:r.href)||""}function jS(){return D5()==="http:"||D5()==="https:"}function D5(){var r;return typeof self<"u"&&((r=self.location)==null?void 0:r.protocol)||null}/**
21474 * @license
21475 * Copyright 2020 Google LLC
21476 *
21477 * Licensed under the Apache License, Version 2.0 (the "License");
21478 * you may not use this file except in compliance with the License.
21479 * You may obtain a copy of the License at
21480 *
21481 *   http://www.apache.org/licenses/LICENSE-2.0
21482 *
21483 * Unless required by applicable law or agreed to in writing, software
21484 * distributed under the License is distributed on an "AS IS" BASIS,
21485 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21486 * See the License for the specific language governing permissions and
21487 * limitations under the License.
21488 */function XS(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(jS()||n7()||"connection"in navigator)?navigator.onLine:!0}function HS(){if(typeof navigator>"u")return null;const r=navigator;return r.languages&&r.languages[0]||r.language||null}/**
21489 * @license
21490 * Copyright 2020 Google LLC
21491 *
21492 * Licensed under the Apache License, Version 2.0 (the "License");
21493 * you may not use this file except in compliance with the License.
21494 * You may obtain a copy of the License at
21495 *
21496 *   http://www.apache.org/licenses/LICENSE-2.0
21497 *
21498 * Unless required by applicable law or agreed to in writing, software
21499 * distributed under the License is distributed on an "AS IS" BASIS,
21500 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21501 * See the License for the specific language governing permissions and
21502 * limitations under the License.
21503 */class Rc{constructor(e,t){this.shortDelay=e,this.longDelay=t,rr(t>e,"Short delay should be less than long delay!"),this.isMobile=Zx()||o7()}get(){return XS()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
21504 * @license
21505 * Copyright 2020 Google LLC
21506 *
21507 * Licensed under the Apache License, Version 2.0 (the "License");
21508 * you may not use this file except in compliance with the License.
21509 * You may obtain a copy of the License at
21510 *
21511 *   http://www.apache.org/licenses/LICENSE-2.0
21512 *
21513 * Unless required by applicable law or agreed to in writing, software
21514 * distributed under the License is distributed on an "AS IS" BASIS,
21515 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21516 * See the License for the specific language governing permissions and
21517 * limitations under the License.
21518 */function c1(r,e){rr(r.emulator,"Emulator should always be set here");const{url:t}=r.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
21519 * @license
21520 * Copyright 2020 Google LLC
21521 *
21522 * Licensed under the Apache License, Version 2.0 (the "License");
21523 * you may not use this file except in compliance with the License.
21524 * You may obtain a copy of the License at
21525 *
21526 *   http://www.apache.org/licenses/LICENSE-2.0
21527 *
21528 * Unless required by applicable law or agreed to in writing, software
21529 * distributed under the License is distributed on an "AS IS" BASIS,
21530 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21531 * See the License for the specific language governing permissions and
21532 * limitations under the License.
21533 */class m8{static initialize(e,t,o){this.fetchImpl=e,t&&(this.headersImpl=t),o&&(this.responseImpl=o)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Js("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Js("Could not find Headers implementation, make sure you call FetchProvi
21533der.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Js("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
21534 * @license
21535 * Copyright 2020 Google LLC
21536 *
21537 * Licensed under the Apache License, Version 2.0 (the "License");
21538 * you may not use this file except in compliance with the License.
21539 * You may obtain a copy of the License at
21540 *
21541 *   http://www.apache.org/licenses/LICENSE-2.0
21542 *
21543 * Unless required by applicable law or agreed to in writing, software
21544 * distributed under the License is distributed on an "AS IS" BASIS,
21545 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21546 * See the License for the specific language governing permissions and
21547 * limitations under the License.
21548 */const WS={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
21549 * @license
21550 * Copyright 2020 Google LLC
21551 *
21552 * Licensed under the Apache License, Version 2.0 (the "License");
21553 * you may not use this file except in compliance with the License.
21554 * You may obtain a copy of the License at
21555 *
21556 *   http://www.apache.org/licenses/LICENSE-2.0
21557 *
21558 * Unless required by applicable law or agreed to in writing, software
21559 * distributed under the License is distributed on an "AS IS" BASIS,
21560 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21561 * See the License for the specific language governing permissions and
21562 * limitations under the License.
21563 */const KS=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],QS=new Rc(3e4,6e4);function m1(r,e){return r.tenantId&&!e.tenantId?{...e,tenantId:r.tenantId}:e}async function Dl(r,e,t,o,a={}){return u8(r,a,async()=>{let d={},c={};o&&(e==="GET"?c=o:d={body:JSON.stringify(o)});const g=fc({...c,key:r.config.apiKey}).slice(1),h=await r._getAdditionalHeaders();h["Content-Type"]="application/json",r.languageCode&&(h["X-Firebase-Locale"]=r.languageCode);const v={method:e,headers:h,...d};
21563return t7()||(v.referrerPolicy="strict-origin-when-cross-origin"),r.emulatorConfig&&hc(r.emulatorConfig.host)&&(v.credentials="include"),m8.fetch()(await p8(r,r.config.apiHost,t,g),v)})}async function u8(r,e,t){r._canInitEmulator=!1;const o={...WS,...e};try{const a=new $S(r),d=await Promise.race([t(),a.promise]);a.clearNetworkTimeout();const c=await d.json();if("needConfirmation"in c)throw du(r,"account-exists-with-different-credential",c);if(d.ok&&!("errorMessage"in c))return c;{const g=d.ok?c.errorMessage:c.error.message,[h,v]=g.split(" : ");if(h==="FEDERATED_USER_ID_ALREADY_LINKED")throw du(r,"credential-already-in-use",c);if(h==="EMAIL_EXISTS")throw du(r,"email-already-in-use",c);if(h==="USER_DISABLED")throw du(r,"user-disabled",c);const _=o[h]||h.toLowerCase().replace(/[_\s]+/g,"-");if(v)throw c8(r,_,v);sr(r,_)}}catch(a){if(a instanceof ar)throw a;sr(r,"network-request-failed",{message:String(a)})}}async function YS(r,e,t,o,a={}){const d=await Dl(r,e,t,o,a);return"mfaPendingCredential"in d&&sr(r,"multi-factor-auth-required",{_serverResponse:d}),d}async function p8(r,e,t,o){const a=`${e}${t}?${o}`,d=r,c=d.config.emulator?c1(r.config,a):`${r.config.apiScheme}://${a}`;return KS.includes(t)&&(await d._persistenceManagerAvailable,d._getPersistenceType()==="COOKIE")?d._getPersistence()._getFinalTarget(c).toString():c}class $S{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,o)=>{this.timer=setTimeout(()=>o(ws(this.auth,"network-request-failed")),QS.get())})}}function du(r,e,t){const o={appName:r.name};t.email&&(o.email=t.email),t.phoneNumber&&(o.phoneNumber=t.phoneNumber);const a=ws(r,e,o);return a.customData._tokenResponse=t,a}/**
21564 * @license
21565 * Copyright 2020 Google LLC
21566 *
21567 * Licensed under the Apache License, Version 2.0 (the "License");
21568 * you may not use this file except in compliance with the License.
21569 * You may obtain a copy of the License at
21570 *
21571 *   http://www.apache.org/licenses/LICENSE-2.0
21572 *
21573 * Unless required by applicable law or agreed to in writing, software
21574 * distributed under the License is distributed on an "AS IS" BASIS,
21575 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21576 * See the License for the specific language governing permissions and
21577 * limitations under the License.
21578 */async function JS(r,e){return Dl(r,"POST","/v1/accounts:delete",e)}async function Bu(r,e){return Dl(r,"POST","/v1/accounts:lookup",e)}/**
21579 * @license
21580 * Copyright 2020 Google LLC
21581 *
21582 * Licensed under the Apache License, Version 2.0 (the "License");
21583 * you may not use this file except in compliance with the License.
21584 * You may obtain a copy of the License at
21585 *
21586 *   http://www.apache.org/licenses/LICENSE-2.0
21587 *
21588 * Unless required by applicable law or agreed to in writing, software
21589 * distributed under the License is distributed on an "AS IS" BASIS,
21590 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21591 * See the License for the specific language governing permissions and
21592 * limitations under the License.
21593 */function Wd(r){if(r)try{const e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function ZS(r,e=!1){const t=_n(r),o=await t.getIdToken(e),a=u1(o);Le(a&&a.exp&&a.auth_time&&a.iat,t.auth,"internal-error");const d=typeof a.firebase=="object"?a.firebase:void 0,c=d==null?void 0:d.sign_in_provider;return{claims:a,token:o,authTime:Wd(Pf(a.auth_time)),issuedAtTime:Wd(Pf(a.iat)),expirationTime:Wd(Pf(a.exp)),signInProvider:c||null,signInSecondFactor:(d==null?void 0:d.sign_in_second_factor)||null}}function Pf(r){return Number(r)*1e3}function u1(r){const[e,t,o]=r.split(".");if(e===void 0||t===void 0||o===void 0)return hu("JWT malformed, contained fewer than 3 sections"),null;try{const a=Z5(t);return a?JSON.parse(a):(hu("Failed to decode base64 JWT payload"),null)}catch(a){return hu("Caught error parsing JWT payload as JSON",a==null?void 0:a.toString()),null}}function M5(r){const e=u1(r);return Le(e,"internal-error"),Le(typeof e.exp<"u","internal-error"),Le(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
21594 * @license
21595 * Copyright 2020 Google LLC
21596 *
21597 * Licensed under the Apache License, Version 2.0 (the "License");
21598 * you may not use this file except in compliance with the License.
21599 * You may obtain a copy of the License at
21600 *
21601 *   http://www.apache.org/licenses/LICENSE-2.0
21602 *
21603 * Unless required by applicable law or agreed to in writing, software
21604 * distributed under the License is distributed on an "AS IS" BASIS,
21605 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21606 * See the License for the specific language governing permissions and
21607 * limitations under the License.
21608 */async function pc(r,e,t=!1){if(t)return e;try{return await e}catch(o){throw o instanceof ar&&ek(o)&&r.auth.currentUser===r&&await r.auth.signOut(),o}}function ek({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}/**
21609 * @license
21610 * Copyright 2020 Google LLC
21611 *
21612 * Licensed under the Apache License, Version 2.0 (the "License");
21613 * you may not use this file except in compliance with the License.
21614 * You may obtain a copy of the License at
21615 *
21616 *   http://www.apache.org/licenses/LICENSE-2.0
21617 *
21618 * Unless required by applicable law or agreed to in writing, software
21619 * distributed under the License is distributed on an "AS IS" BASIS,
21620 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21621 * See the License for the specific language governing permissions and
21622 * limitations under the License.
21623 */class tk{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;const o=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,o)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
21624 * @license
21625 * Copyright 2020 Google LLC
21626 *
21627 * Licensed under the Apache License, Version 2.0 (the "License");
21628 * you may not use this file except in compliance with the License.
21629 * You may obtain a copy of the License at
21630 *
21631 *   http://www.apache.org/licenses/LICENSE-2.0
21632 *
21633 * Unless required by applicable law or agreed to in writing, software
21634 * distributed under the License is distributed on an "AS IS" BASIS,
21635 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21636 * See the License for the specific language governing permissions and
21637 * limitations under the License.
21638 */class mh{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Wd(this.lastLoginAt),this.creationTime=Wd(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
21639 * @license
21640 * Copyright 2019 Google LLC
21641 *
21642 * Licensed under the Apache License, Version 2.0 (the "License");
21643 * you may not use this file except in compliance with the License.
21644 * You may obtain a copy of the License at
21645 *
21646 *   http://www.apache.org/licenses/LICENSE-2.0
21647 *
21648 * Unless required by applicable law or agreed to in writing, software
21649 * distributed under the License is distributed on an "AS IS" BASIS,
21650 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21651 * See the License for the specific language governing permissions and
21652 * limitations under the License.
21653 */async function Gu(r){var E;const e=r.auth,t=await r.getIdToken(),o=await pc(r,Bu(e,{idToken:t}));Le(o==null?void 0:o.users.length,e,"internal-error");const a=o.users[0];r._notifyReloadListener(a);const d=(E=a.providerUserInfo)!=null&&E.length?g8(a.providerUserInfo):[],c=ok(r.providerData,d),g=r.isAnonymous,h=!(r.email&&a.passwordHash)&&!(c!=null&&c.length),v=g?h:!1,_={uid:a.localId,displayName:a.displayName||null,photoURL:a.photoUrl||null,email:a.email||null,emailVerified:a.emailVerified||!1,phoneNumber:a.phoneNumber||null,tenantId:a.tenantId||null,providerData:c,metadata:new mh(a.createdAt,a.lastLoginAt),isAnonymous:v};Object.assign(r,_)}async function nk(r){const e=_n(r);await Gu(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ok(r,e){return[...r.filter(o=>!e.some(a=>a.providerId===o.providerId)),...e]}function g8(r){return r.map(({providerId:e,...t})=>
21653({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}/**
21654 * @license
21655 * Copyright 2020 Google LLC
21656 *
21657 * Licensed under the Apache License, Version 2.0 (the "License");
21658 * you may not use this file except in compliance with the License.
21659 * You may obtain a copy of the License at
21660 *
21661 *   http://www.apache.org/licenses/LICENSE-2.0
21662 *
21663 * Unless required by applicable law or agreed to in writing, software
21664 * distributed under the License is distributed on an "AS IS" BASIS,
21665 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21666 * See the License for the specific language governing permissions and
21667 * limitations under the License.
21668 */async function sk(r,e){const t=await u8(r,{},async()=>{const o=fc({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:a,apiKey:d}=r.config,c=await p8(r,a,"/v1/token",`key=${d}`),g=await r._getAdditionalHeaders();g["Content-Type"]="application/x-www-form-urlencoded";const h={method:"POST",headers:g,body:o};return r.emulatorConfig&&hc(r.emulatorConfig.host)&&(h.credentials="include"),m8.fetch()(c,h)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function rk(r,e){return Dl(r,"POST","/v2/accounts:revokeToken",m1(r,e))}/**
21669 * @license
21670 * Copyright 2020 Google LLC
21671 *
21672 * Licensed under the Apache License, Version 2.0 (the "License");
21673 * you may not use this file except in compliance with the License.
21674 * You may obtain a copy of the License at
21675 *
21676 *   http://www.apache.org/licenses/LICENSE-2.0
21677 *
21678 * Unless required by applicable law or agreed to in writing, software
21679 * distributed under the License is distributed on an "AS IS" BASIS,
21680 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21681 * See the License for the specific language governing permissions and
21682 * limitations under the License.
21683 */class al{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Le(e.idToken,"internal-error"),Le(typeof e.idToken<"u","internal-error"),Le(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):M5(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){Le(e.length!==0,"internal-error");const t=M5(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(Le(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:o,refreshToken:a,expiresIn:d}=await sk(e,t);this.updateTokensAndExpiration(o,a,Number(d))}updateTokensAndExpiration(e,t,o){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+o*1e3}static fromJSON(e,t){const{refreshToken:o,accessToken:a,expirationTime:d}=t,c=new al;return o&&(Le(typeof o=="string","internal-error",{appName:e}),c.refreshToken=o),a&&(Le(typeof a=="string","internal-error",{appName:e}),c.accessToken=a),d&&(Le(typeof d=="number","internal-error",{appName:e}),c.expirationTime=d),c}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new al,this.toJSON())}_performRefresh(){return Js("not implemented")}}/**
21684 * @license
21685 * Copyright 2020 Google LLC
21686 *
21687 * Licensed under the Apache License, Version 2.0 (the "License");
21688 * you may not use this file except in compliance with the License.
21689 * You may obtain a copy of the License at
21690 *
21691 *   http://www.apache.org/licenses/LICENSE-2.0
21692 *
21693 * Unless required by applicable law or agreed to in writing, software
21694 * distributed under the License is distributed on an "AS IS" BASIS,
21695 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21696 * See the License for the specific language governing permissions and
21697 * limitations under the License.
21698 */function Gr(r,e){Le(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}class Fo{constructor({uid:e,auth:t,stsTokenManager:o,...a}
21698){this.providerId="firebase",this.proactiveRefresh=new tk(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=o,this.accessToken=o.accessToken,this.displayName=a.displayName||null,this.email=a.email||null,this.emailVerified=a.emailVerified||!1,this.phoneNumber=a.phoneNumber||null,this.photoURL=a.photoURL||null,this.isAnonymous=a.isAnonymous||!1,this.tenantId=a.tenantId||null,this.providerData=a.providerData?[...a.providerData]:[],this.metadata=new mh(a.createdAt||void 0,a.lastLoginAt||void 0)}async getIdToken(e){const t=await pc(this,this.stsTokenManager.getToken(this.auth,e));return Le(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return ZS(this,e)}reload(){return nk(this)}_assign(e){this!==e&&(Le(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>({...t})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new Fo({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){Le(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let o=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),o=!0),t&&await Gu(this),await this.auth._persistUserIfCurrent(this),o&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(vs(this.auth.app))return Promise.reject(ti(this.auth));const e=await this.getIdToken();return await pc(this,JS(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){const o=t.displayName??void 0,a=t.email??void 0,d=t.phoneNumber??void 0,c=t.photoURL??void 0,g=t.tenantId??void 0,h=t._redirectEventId??void 0,v=t.createdAt??void 0,_=t.lastLoginAt??void 0,{uid:E,emailVerified:M,isAnonymous:G,providerData:B,stsTokenManager:ee}=t;Le(E&&ee,e,"internal-error");const ie=al.fromJSON(this.name,ee);Le(typeof E=="string",e,"internal-error"),Gr(o,e.name),Gr(a,e.name),Le(typeof M=="boolean",e,"internal-error"),Le(typeof G=="boolean",e,"internal-error"),Gr(d,e.name),Gr(c,e.name),Gr(g,e.name),Gr(h,e.name),Gr(v,e.name),Gr(_,e.name);const ve=new Fo({uid:E,auth:e,email:a,emailVerified:M,displayName:o,isAnonymous:G,photoURL:c,phoneNumber:d,tenantId:g,stsTokenManager:ie,createdAt:v,lastLoginAt:_});return B&&Array.isArray(B)&&(ve.providerData=B.map(Se=>({...Se}))),h&&(ve._redirectEventId=h),ve}static async _fromIdTokenResponse(e,t,o=!1){const a=new al;a.updateFromServerResponse(t);const d=new Fo({uid:t.localId,auth:e,stsTokenManager:a,isAnonymous:o});return await Gu(d),d}static async _fromGetAccountInfoResponse(e,t,o){const a=t.users[0];Le(a.localId!==void 0,"internal-error");const d=a.providerUserInfo!==void 0?g8(a.providerUserInfo):[],c=!(a.email&&a.passwordHash)&&!(d!=null&&d.length),g=new al;g.updateFromIdToken(o);const h=new Fo({uid:a.localId,auth:e,stsTokenManager:g,isAnonymous:c}),v={uid:a.localId,displayName:a.displayName||null,photoURL:a.photoUrl||null,email:a.email||null,emailVerified:a.emailVerified||!1,phoneNumber:a.phoneNumber||null,tenantId:a.tenantId||null,providerData:d,metadata:new mh(a.createdAt,a.lastLoginAt),isAnonymous:!(a.email&&a.passwordHash)&&!(d!=null&&d.length)};return Object.assign(h,v),h}}/**
21699 * @license
21700 * Copyright 2020 Google LLC
21701 *
21702 * Licensed under the Apache License, Version 2.0 (the "License");
21703 * you may not use this file except in compliance with the License.
21704 * You may obtain a copy of the License at
21705 *
21706 *   http://www.apache.org/licenses/LICENSE-2.0
21707 *
21708 * Unless required by applicable law or agreed to in writing, software
21709 * distributed under the License is distributed on an "AS IS" BASIS,
21710 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21711 * See the License for the specific language governing permissions and
21712 * limitations under the License.
21713 */const T5=new Map;function Zs(r){rr(r instanceof Function,"Expected a class definition");let e=T5.get(r);return e?(rr(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,T5.set(r,e),e)}/**
21714 * @license
21715 * Copyright 2019 Google LLC
21716 *
21717 * Licensed under the Apache License, Version 2.0 (the "License");
21718 * you may not use this file except in compliance with the License.
21719 * You may obtain a copy of the License at
21720 *
21721 *   http://www.apache.org/licenses/LICENSE-2.0
21722 *
21723 * Unless required by applicable law or agreed to in writing, software
21724 * distributed under the License is distributed on an "AS IS" BASIS,
21725 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21726 * See the License for the specific language governing permissions and
21727 * limitations under the License.
21728 */class f8{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}f8.type="NONE";const I5=f8;/**
21729 * @license
21730 * Copyright 2019 Google LLC
21731 *
21732 * Licensed under the Apache License, Version 2.0 (the "License");
21733 * you may not use this file except in compliance with the License.
21734 * You may obtain a copy of the License at
21735 *
21736 *   http://www.apache.org/licenses/LICENSE-2.0
21737 *
21738 * Unless required by applicable law or agreed to in writing, software
21739 * distributed under the License is distributed on an "AS IS" BASIS,
21740 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21741 * See the License for the specific language governing permissions and
21742 * limitations under the License.
21743 */function vu(r,e,t){return`firebase:${r}:${e}:${t}`}class il{constructor(e,t,o){this.persistence=e,this.auth=t,this.userKey=o;const{config:a,name:d}=this.auth;this.fullUserKey=vu(this.userKey,a.apiKey,d),this.fullPersistenceKey=vu("persistence",a.apiKey,d),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const t=await Bu(this.auth,{idToken:e}).catch(()=>{});return t?Fo._fromGetAccountInfoResponse(this.auth,t,e):null}return Fo._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,o="authUser"){if(!t.length)return new il(Zs(I5),e,o);const a=(await Promise.all(t.map(async v=>{if(await v._isAvailable())return v}))).filter(v=>v);let d=a[0]||Zs(I5);const c=vu(o,e.config.apiKey,e.name);let g=null;for(const v of t)try{const _=await v._get(c);if(_){let E;if(typeof _=="string"){const M=await Bu(e,{idToken:_}).catch(()=>{});if(!M)break;E=await Fo._fromGetAccountInfoResponse(e,M,_)}else E=Fo._fromJSON(e,_);v!==d&&(g=E),d=v;break}}catch{}const h=a.filter(v=>v._shouldAllowMigration);return!d._shouldAllowMigration||!h.length?new il(d,e,o):(d=h[0],g&&await d._set(c,g.toJSON()),await Promise.all(t.map(async v=>{if(v!==d)try{await v._remove(c)}catch{}})),new il(d,e,o))}}/**
21744 * @license
21745 * Copyright 2020 Google LLC
21746 *
21747 * Licensed under the Apache License, Version 2.0 (the "License");
21748 * you may not use this file except in compliance with the License.
21749 * You may obtain a copy of the License at
21750 *
21751 *   http://www.apache.org/licenses/LICENSE-2.0
21752 *
21753 * Unless required by applicable law or agreed to in writing, software
21754 * distributed under the License is distributed on an "AS IS" BASIS,
21755 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21756 * See the License for the specific language governing permissions and
21757 * limitations under the License.
21758 */function O5(r){const e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(y8(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(h8(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(A8(e))return"Blackberry";if(_8(e))return"Webos";if(v8(e))return"Safari";if((e.includes("chrome/")||b8(e))&&!e.includes("edge/"))return"Chrome";if(x8(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,o=r.match(t);if((o==null?void 0:o.length)===2)return o[1]}return"Other"}function h8(r=Mn()){return/firefox\//i.test(r)}function v8(r=Mn()){const e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function b8(r=Mn()){return/crios\//i.test(r)}function y8(r=Mn()){return/iemobile/i.test(r)}function x8(r=Mn()){return/android/i.test(r)}function A8(r=Mn()){return/blackberry/i.test(r)}function _8(r=Mn()){return/webos/i.test(r)}function p1(r=Mn()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function ak(r=Mn()){var e;return p1(r)&&!!((e=window.navigator)!=null&&e.standalone)}function ik(){return s7()&&document.documentMode===10}function w8(r=Mn()){return p1(r)||x8(r)||_8(r)||A8(r)||/windows phone/i.test(r)||y8(r)}/**
21759 * @license
21760 * Copyright 2020 Google LLC
21761 *
21762 * Licensed under the Apache License, Version 2.0 (the "License");
21763 * you may not use this file except in compliance with the License.
21764 * You may obtain a copy of the License at
21765 *
21766 *   http://www.apache.org/licenses/LICENSE-2.0
21767 *
21768 * Unless required by applicable law or agreed to in writing, software
21769 * distributed under the License is distributed on an "AS IS" BASIS,
21770 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21771 * See the License for the specific language governing permissions and
21772 * limitations under the License.
21773 */function E8(r,e=[]){let t;switch(r){case"Browser":t=O5(Mn());break;case"Worker":t=`${O5(Mn())}-${r}`;break;default:t=r}const o=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${xl}/${o}`}/**
21774 * @license
21775 * Copyright 2022 Google LLC
21776 *
21777 * Licensed under the Apache License, Version 2.0 (the "License");
21778 * you may not use this file except in compliance with the License.
21779 * You may obtain a copy of the License at
21780 *
21781 *   http://www.apache.org/licenses/LICENSE-2.0
21782 *
21783 * Unless required by applicable law or agreed to in writing, software
21784 * distributed under the License is distributed on an "AS IS" BASIS,
21785 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21786 * See the License for the specific language governing permissions and
21787 * limitations under the License.
21788 */class lk{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const o=d=>new Promise((c,g)=>{try{const h=e(d);c(h)}catch(h){g(h)}});o.onAbort=t,this.queue.push(o);const a=this.queue.length-1;return()=>{this.queue[a]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const o of this.queue)await o(e),o.onAbort&&t.push(o.onAbort)}catch(o){t.reverse();for(const a of t)try{a()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:o==null?void 0:o.message})}}}/**
21789 * @license
21790 * Copyright 2023 Google LLC
21791 *
21792 * Licensed under the Apache License, Version 2.0 (the "License");
21793 * you may not use this file except in compliance with the License.
21794 * You may obtain a copy of the License at
21795 *
21796 *   http://www.apache.org/licenses/LICENSE-2.0
21797 *
21798 * Unless required by applicable law or agreed to in writing, softw
21798are
21799 * distributed under the License is distributed on an "AS IS" BASIS,
21800 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21801 * See the License for the specific language governing permissions and
21802 * limitations under the License.
21803 */async function dk(r,e={}){return Dl(r,"GET","/v2/passwordPolicy",m1(r,e))}/**
21804 * @license
21805 * Copyright 2023 Google LLC
21806 *
21807 * Licensed under the Apache License, Version 2.0 (the "License");
21808 * you may not use this file except in compliance with the License.
21809 * You may obtain a copy of the License at
21810 *
21811 *   http://www.apache.org/licenses/LICENSE-2.0
21812 *
21813 * Unless required by applicable law or agreed to in writing, software
21814 * distributed under the License is distributed on an "AS IS" BASIS,
21815 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21816 * See the License for the specific language governing permissions and
21817 * limitations under the License.
21818 */const ck=6;class mk{constructor(e){var o;const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??ck,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((o=e.allowedNonAlphanumericCharacters)==null?void 0:o.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){const o=this.customStrengthOptions.minPasswordLength,a=this.customStrengthOptions.maxPasswordLength;o&&(t.meetsMinPasswordLength=e.length>=o),a&&(t.meetsMaxPasswordLength=e.length<=a)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let o;for(let a=0;a<e.length;a++)o=e.charAt(a),this.updatePasswordCharacterOptionsStatuses(t,o>="a"&&o<="z",o>="A"&&o<="Z",o>="0"&&o<="9",this.allowedNonAlphanumericCharacters.includes(o))}updatePasswordCharacterOptionsStatuses(e,t,o,a,d){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=o)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=a)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=d))}}/**
21819 * @license
21820 * Copyright 2020 Google LLC
21821 *
21822 * Licensed under the Apache License, Version 2.0 (the "License");
21823 * you may not use this file except in compliance with the License.
21824 * You may obtain a copy of the License at
21825 *
21826 *   http://www.apache.org/licenses/LICENSE-2.0
21827 *
21828 * Unless required by applicable law or agreed to in writing, software
21829 * distributed under the License is distributed on an "AS IS" BASIS,
21830 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21831 * See the License for the specific language governing permissions and
21832 * limitations under the License.
21833 */class uk{constructor(e,t,o,a){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=o,this.config=a,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new P5(this),this.idTokenSubscription=new P5(this),this.beforeStateQueue=new lk(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=d8,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=a.sdkClientVersion,this._persistenceManagerAvailable=new Promise(d=>this._resolvePersistenceManagerAvailable=d)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=Zs(t)),this._initializationPromise=this.queue(async()=>{var o,a,d;if(!this._deleted&&(this.persistenceManager=await il.create(this,e),(o=this._resolvePersistenceManagerAvailable)==null||o.call(this),!this._deleted)){if
21833((a=this._popupRedirectResolver)!=null&&a._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((d=this.currentUser)==null?void 0:d.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const t=await Bu(this,{idToken:e}),o=await Fo._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(o)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var d;if(vs(this.app)){const c=this.app.settings.authIdToken;return c?new Promise(g=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(c).then(g,g))}):this.directlySetCurrentUser(null)}const t=await this.assertedPersistence.getCurrentUser();let o=t,a=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const c=(d=this.redirectUser)==null?void 0:d._redirectEventId,g=o==null?void 0:o._redirectEventId,h=await this.tryRedirectSignIn(e);(!c||c===g)&&(h!=null&&h.user)&&(o=h.user,a=!0)}if(!o)return this.directlySetCurrentUser(null);if(!o._redirectEventId){if(a)try{await this.beforeStateQueue.runMiddleware(o)}catch(c){o=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(c))}return o?this.reloadAndSetCurrentUserOrClear(o):this.directlySetCurrentUser(null)}return Le(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===o._redirectEventId?this.directlySetCurrentUser(o):this.reloadAndSetCurrentUserOrClear(o)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await Gu(e)}catch(t){if((t==null?void 0:t.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=HS()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(vs(this.app))return Promise.reject(ti(this));const t=e?_n(e):null;return t&&Le(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&Le(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return vs(this.app)?Promise.reject(ti(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return vs(this.app)?Promise.reject(ti(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Zs(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await dk(this),t=new mk(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new gc("auth","Firebase",e())}onAuthStateChanged(e,t,o){return this.registerStateListener(this.authStateSubscription,e,t,o)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,o){return this.registerStateListener(this.idTokenSubscription,e,t,o)}authStateReady(){return new Promise((e,t)=>
21833{if(this.currentUser)e();else{const o=this.onAuthStateChanged(()=>{o(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),o={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(o.tenantId=this.tenantId),await rk(this,o)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?void 0:e.toJSON()}}async _setRedirectUser(e,t){const o=await this.getOrInitRedirectPersistenceManager(t);return e===null?o.removeCurrentUser():o.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&Zs(e)||this._popupRedirectResolver;Le(t,this,"argument-error"),this.redirectPersistenceManager=await il.create(this,[Zs(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,o;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)==null?void 0:t._redirectEventId)===e?this._currentUser:((o=this.redirectUser)==null?void 0:o._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((t=this.currentUser)==null?void 0:t.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,o,a){if(this._deleted)return()=>{};const d=typeof t=="function"?t:t.next.bind(t);let c=!1;const g=this._isInitialized?Promise.resolve():this._initializationPromise;if(Le(g,this,"internal-error"),g.then(()=>{c||d(this.currentUser)}),typeof t=="function"){const h=e.addObserver(t,o,a);return()=>{c=!0,h()}}else{const h=e.addObserver(t);return()=>{c=!0,h()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Le(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=E8(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var a;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const t=await((a=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:a.getHeartbeatsHeader());t&&(e["X-Firebase-Client"]=t);const o=await this._getAppCheckToken();return o&&(e["X-Firebase-AppCheck"]=o),e}async _getAppCheckToken(){var t;if(vs(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((t=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:t.getToken());return e!=null&&e.error&&FS(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function g1(r){return _n(r)}class P5{constructor(e){this.auth=e,this.observer=null,this.addObserver=u7(t=>this.observer=t)}get next(){return Le(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
21834 * @license
21835 * Copyright 2020 Google LLC
21836 *
21837 * Licensed under the Apache License, Version 2.0 (the "License");
21838 * you may not use this file except in compliance with the License.
21839 * You may obtain a copy of the License at
21840 *
21841 *   http://www.apache.org/licenses/LICENSE-2.0
21842 *
21843 * Unless required by applicable law or agreed to in writing, software
21844 * distributed under the License is distributed on an "AS IS" BASIS,
21845 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21846 * See the License for the specific language governing permissions and
21847 * limitations under the License.
21848 */let f1={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function pk(r){f1=r}function gk(r){return f1.loadJS(r)}function fk(){return f1.gapiScript}function hk(r){return`__${r}${Math.floor(Math.random()*1e6)}`}/**
21849 * @license
21850 * Copyright 2020 Google LLC
21851 *
21852 * Licensed under the Apache License, Version 2.0 (the "License");
21853 * you may not use this file except in compliance with the License.
21854 * You may obtain a copy of the License at
21855 *
21856 *   http://www.apache.org/licenses/LICENSE-2.0
21857 *
21858 * Unless required by applicable law or agreed to in writing, software
21859 * distributed under the License is distributed on an "AS IS" BASIS,
21860 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21861 * See the License for the specific language governing permissions and
21862 * limitations under the License.
21863 */function vk(r,e){const t=fh(r,"auth");if(t.isInitialized()){const a=t.getImmediate(),d=t.getOptions();if(ni(d,e??{}))return a;sr(a,"already-initialized")}return t.initialize({options:e})}function bk(r,e){const t=(e==null?void 0:e.persistence)||[],o=(Array.isArray(t)?t:[t]).map(Zs);e!=null&&e.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(o,e==null?void 0:e.popupRedirectResolver)}function yk(r,e,t){const o=g1(r);Le(/^https?:\/\//.test(e),o,"invalid-emulator-scheme");const a=!1,d=S8(e),{host:c,port:g}=xk(e),h=g===null?"":`:${g}`,v={url:`${d}//${c}${h}/`},_=Object.freeze({host:c,port:g,protocol:d.replace(":",""),options:Object.freeze({disableWarnings:a})});if(!o._canInitEmulator){Le(o.config.emulator&&o.emulatorConfig,o,"emulator-config-failed"),Le(ni(v,o.config.emulator)&&ni(_,o.emulatorConfig),o,"emulator-config-failed");return}o.config.emulator=v,o.emulatorConfig=_,o.settings.appVerificationDisabledForTesting=!0,hc(c)?oy(`${d}//${c}${h}`):Ak()}function S8(r){const e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function xk(r){const e=S8(r),t=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!t)return{host:"",port:null};const o=t[2].split("@").pop()||"",a=/^(\[[^\]]+\])(:|$)/.exec(o);if(a){const d=a[1];return{host:d,port:z5(o.substr(d.length+1))}}else{const[d,c]=o.split(":");return{host:d,port:z5(c)}}}function z5(r){if(!r)return null;const e=Number(r);return isNaN(e)?null:e}function Ak(){function r(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}/**
21864 * @license
21865 * Copyright 2020 Google LLC
21866 *
21867 * Licensed under the Apache License, Version 2.0 (the "License");
21868 * you may not use this file except in compliance with the License.
21869 * You may obtain a copy of the License at
21870 *
21871 *   http://www.apache.org/licenses/LICENSE-2.0
21872 *
21873 * Unless required by applicable law or agreed to in writing, software
21874 * distributed under the License is distributed on an "AS IS" BASIS,
21875 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21876 * See the License for the specific language governing permissions and
21877 * limitations under the License.
21878 */class k8{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Js("not implemented")}_getIdTokenResponse(e){return Js("not implemented")}_linkToIdToken(e,t){return Js("not implemented")}_getReauthenticationResolver(e){return Js("not implemented")}}/**
21879 * @license
21880 * Copyright 2020 Google LLC
21881 *
21882 * Licensed under the Apache License, Version 2.0 (the "License");
21883 * you may not use this file except in compliance with the License.
21884 * You may obtain a copy of the License at
21885 *
21886 *   http://www.apache.org/licenses/LICENSE-2.0
21887 *
21888 * Unless required by applicable law or agreed to in writing, software
21889 * distributed under the License is distributed on an "AS IS" BASIS,
21890 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21891 * See the License for the specific language governing permissions and
21892 * limitations under the License.
21893 */async function ll(r,e){return YS(r,"POST","/v1/accounts:signInWithIdp",m1(r,e))}/**
21894 * @license
21895 * Copyright 2020 Google LLC
21896 *
21897 * Licensed under the Apache License, Version 2.0 (the "License");
21898 * you may not use this file except in compliance with the License.
21899 * You may obtain a copy of the License at
21900 *
21901 *   http://www.apache.org/licenses/LICENSE-2.0
21902 *
21903 * Unless required by applicable law or agreed to in writing, software
21904 * distributed under the License is distributed on an "AS IS" BASIS,
21905 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21906 * See the License for the specific language governing permissions and
21907 * limitations under the License.
21908 */const _k="http://localhost";class ai extends k8{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new ai(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):sr("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
21908once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:o,signInMethod:a,...d}=t;if(!o||!a)return null;const c=new ai(o,a);return c.idToken=d.idToken||void 0,c.accessToken=d.accessToken||void 0,c.secret=d.secret,c.nonce=d.nonce,c.pendingToken=d.pendingToken||null,c}_getIdTokenResponse(e){const t=this.buildRequest();return ll(e,t)}_linkToIdToken(e,t){const o=this.buildRequest();return o.idToken=t,ll(e,o)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,ll(e,t)}buildRequest(){const e={requestUri:_k,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=fc(t)}return e}}/**
21909 * @license
21910 * Copyright 2020 Google LLC
21911 *
21912 * Licensed under the Apache License, Version 2.0 (the "License");
21913 * you may not use this file except in compliance with the License.
21914 * You may obtain a copy of the License at
21915 *
21916 *   http://www.apache.org/licenses/LICENSE-2.0
21917 *
21918 * Unless required by applicable law or agreed to in writing, software
21919 * distributed under the License is distributed on an "AS IS" BASIS,
21920 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21921 * See the License for the specific language governing permissions and
21922 * limitations under the License.
21923 */class C8{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/**
21924 * @license
21925 * Copyright 2019 Google LLC
21926 *
21927 * Licensed under the Apache License, Version 2.0 (the "License");
21928 * you may not use this file except in compliance with the License.
21929 * You may obtain a copy of the License at
21930 *
21931 *   http://www.apache.org/licenses/LICENSE-2.0
21932 *
21933 * Unless required by applicable law or agreed to in writing, software
21934 * distributed under the License is distributed on an "AS IS" BASIS,
21935 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21936 * See the License for the specific language governing permissions and
21937 * limitations under the License.
21938 */class Dc extends C8{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
21939 * @license
21940 * Copyright 2020 Google LLC
21941 *
21942 * Licensed under the Apache License, Version 2.0 (the "License");
21943 * you may not use this file except in compliance with the License.
21944 * You may obtain a copy of the License at
21945 *
21946 *   http://www.apache.org/licenses/LICENSE-2.0
21947 *
21948 * Unless required by applicable law or agreed to in writing, software
21949 * distributed under the License is distributed on an "AS IS" BASIS,
21950 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21951 * See the License for the specific language governing permissions and
21952 * limitations under the License.
21953 */class Xr extends Dc{constructor(){super("facebook.com")}static credential(e){return ai._fromParams({providerId:Xr.PROVIDER_ID,signInMethod:Xr.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Xr.credentialFromTaggedObject(e)}static credentialFromError(e){return Xr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Xr.credential(e.oauthAccessToken)}catch{return null}}}Xr.FACEBOOK_SIGN_IN_METHOD="facebook.com";Xr.PROVIDER_ID="facebook.com";/**
21954 * @license
21955 * Copyright 2020 Google LLC
21956 *
21957 * Licensed under the Apache License, Version 2.0 (the "License");
21958 * you may not use this file except in compliance with the License.
21959 * You may obtain a copy of the License at
21960 *
21961 *   http://www.apache.org/licenses/LICENSE-2.0
21962 *
21963 * Unless required by applicable law or agreed to in writing, softw
21963are
21964 * distributed under the License is distributed on an "AS IS" BASIS,
21965 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21966 * See the License for the specific language governing permissions and
21967 * limitations under the License.
21968 */class Ys extends Dc{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return ai._fromParams({providerId:Ys.PROVIDER_ID,signInMethod:Ys.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return Ys.credentialFromTaggedObject(e)}static credentialFromError(e){return Ys.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:o}=e;if(!t&&!o)return null;try{return Ys.credential(t,o)}catch{return null}}}Ys.GOOGLE_SIGN_IN_METHOD="google.com";Ys.PROVIDER_ID="google.com";/**
21969 * @license
21970 * Copyright 2020 Google LLC
21971 *
21972 * Licensed under the Apache License, Version 2.0 (the "License");
21973 * you may not use this file except in compliance with the License.
21974 * You may obtain a copy of the License at
21975 *
21976 *   http://www.apache.org/licenses/LICENSE-2.0
21977 *
21978 * Unless required by applicable law or agreed to in writing, software
21979 * distributed under the License is distributed on an "AS IS" BASIS,
21980 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21981 * See the License for the specific language governing permissions and
21982 * limitations under the License.
21983 */class Hr extends Dc{constructor(){super("github.com")}static credential(e){return ai._fromParams({providerId:Hr.PROVIDER_ID,signInMethod:Hr.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Hr.credentialFromTaggedObject(e)}static credentialFromError(e){return Hr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Hr.credential(e.oauthAccessToken)}catch{return null}}}Hr.GITHUB_SIGN_IN_METHOD="github.com";Hr.PROVIDER_ID="github.com";/**
21984 * @license
21985 * Copyright 2020 Google LLC
21986 *
21987 * Licensed under the Apache License, Version 2.0 (the "License");
21988 * you may not use this file except in compliance with the License.
21989 * You may obtain a copy of the License at
21990 *
21991 *   http://www.apache.org/licenses/LICENSE-2.0
21992 *
21993 * Unless required by applicable law or agreed to in writing, software
21994 * distributed under the License is distributed on an "AS IS" BASIS,
21995 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21996 * See the License for the specific language governing permissions and
21997 * limitations under the License.
21998 */class Wr extends Dc{constructor(){super("twitter.com")}static credential(e,t){return ai._fromParams({providerId:Wr.PROVIDER_ID,signInMethod:Wr.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return Wr.credentialFromTaggedObject(e)}static credentialFromError(e){return Wr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:o}=e;if(!t||!o)return null;try{return Wr.credential(t,o)}catch{return null}}}Wr.TWITTER_SIGN_IN_METHOD="twitter.com";Wr.PROVIDER_ID="twitter.com";/**
21999 * @license
22000 * Copyright 2020 Google LLC
22001 *
22002 * Licensed under the Apache License, Version 2.0 (the "License");
22003 * you may not use this file except in compliance with the License.
22004 * You may obtain a copy of the License at
22005 *
22006 *   http://www.apache.org/licenses/LICENSE-2.0
22007 *
22008 * Unless required by applicable law or agreed to in writing, software
22009 * distributed under the License is distributed on an "AS IS" BASIS,
22010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22011 * See the License for the specific language governing permissions and
22012 * limitations under the License.
22013 */class yl{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,o,a=!1){const d=await Fo._fromIdTokenResponse(e,o,a),c=L5(o);return new yl({user:d,providerId:c,_tokenResponse:o,operationType:t})}static async _forOperation(e,t,o){await e._updateTokensIfNecessary(o,!0);const a=L5(o);return new yl({user:e,providerId:a,_tokenResponse:o,operationType:t})}}function L5(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}/**
22014 * @license
22015 * Copyright 2020 Google LLC
22016 *
22017 * Licensed under the Apache License, Version 2.0 (the "License");
22018 * you may not use this file except in compliance with the License.
22019 * You may obtain a copy of the License at
22020 *
22021 *   http://www.apache.org/licenses/LICENSE-2.0
22022 *
22023 * Unless required by applicable law or agreed to in writing, software
22024 * distributed under the License is distributed on an "AS IS" BASIS,
22025 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22026 * See the License for the specific language governing permissions and
22027 * limitations under the License.
22028 */class qu extends ar{constructor(e,t,o,a){super(t.code,t.message),this.operationType=o,this.user=a,Object.setPrototypeOf(this,qu.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:o}}static _fromErrorAndOperation(e,t,o,a){return new qu(e,t,o,a)}}function R8(r,e,t,o){return(e==="reauthenticate"?t._getReauthenticationResolver(r):t._getIdTokenResponse(r)).catch(d=>{throw d.code==="auth/multi-factor-auth-required"?qu._fromErrorAndOperation(r,d,e,o):d})}async function wk(r,e,t=!1){const o=await pc(r,e._linkToIdToken(r.auth,await r.getIdToken()),t);return yl._forOperation(r,"link",o)}/**
22029 * @license
22030 * Copyright 2019 Google LLC
22031 *
22032 * Licensed under the Apache License, Version 2.0 (the "License");
22033 * you may not use this file except in compliance with the License.
22034 * You may obtain a copy of the License at
22035 *
22036 *   http://www.apache.org/licenses/LICENSE-2.0
22037 *
22038 * Unless required by applicable law or agreed to in writing, software
22039 * distributed under the License is distributed on an "AS IS" BASIS,
22040 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22041 * See the License for the specific language governing permissions and
22042 * limitations under the License.
22043 */async function Ek(r,e,t=!1){const{auth:o}=r;if(vs(o.app))return Promise.reject(ti(o));const a="reauthenticate";try{const d=await pc(r,R8(o,a,e,r),t);Le(d.idToken,o,"internal-error");const c=u1(d.idToken);Le(c,o,"internal-error");const{sub:g}=c;return Le(r.uid===g,o,"user-mismatch"),yl._forOperation(r,a,d)}catch(d){throw(d==null?void 0:d.code)==="auth/user-not-found"&&sr(o,"user-mismatch"),d}}/**
22044 * @license
22045 * Copyright 2020 Google LLC
22046 *
22047 * Licensed under the Apache License, Version 2.0 (the "License");
22048 * you may not use this file except in compliance with the License.
22049 * You may obtain a copy of the License at
22050 *
22051 *   http://www.apache.org/licenses/LICENSE-2.0
22052 *
22053 * Unless required by applicable law or agreed to in writing, software
22054 * distributed under the License is distributed on an "AS IS" BASIS,
22055 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22056 * See the License for the specific language governing permissions and
22057 * limitations under the License.
22058 */async function Sk(r,e,t=!1){if(vs(r.app))return Promise.reject(ti(r));
22058const o="signIn",a=await R8(r,o,e),d=await yl._fromIdTokenResponse(r,o,a);return t||await r._updateCurrentUser(d.user),d}function kk(r,e,t,o){return _n(r).onIdTokenChanged(e,t,o)}function Ck(r,e,t){return _n(r).beforeAuthStateChanged(e,t)}function Rk(r,e,t,o){return _n(r).onAuthStateChanged(e,t,o)}const Fu="__sak";/**
22059 * @license
22060 * Copyright 2019 Google LLC
22061 *
22062 * Licensed under the Apache License, Version 2.0 (the "License");
22063 * you may not use this file except in compliance with the License.
22064 * You may obtain a copy of the License at
22065 *
22066 *   http://www.apache.org/licenses/LICENSE-2.0
22067 *
22068 * Unless required by applicable law or agreed to in writing, software
22069 * distributed under the License is distributed on an "AS IS" BASIS,
22070 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22071 * See the License for the specific language governing permissions and
22072 * limitations under the License.
22073 */class D8{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Fu,"1"),this.storage.removeItem(Fu),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
22074 * @license
22075 * Copyright 2020 Google LLC
22076 *
22077 * Licensed under the Apache License, Version 2.0 (the "License");
22078 * you may not use this file except in compliance with the License.
22079 * You may obtain a copy of the License at
22080 *
22081 *   http://www.apache.org/licenses/LICENSE-2.0
22082 *
22083 * Unless required by applicable law or agreed to in writing, software
22084 * distributed under the License is distributed on an "AS IS" BASIS,
22085 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22086 * See the License for the specific language governing permissions and
22087 * limitations under the License.
22088 */const Dk=1e3,Mk=10;class M8 extends D8{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=w8(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const o=this.storage.getItem(t),a=this.localCache[t];o!==a&&e(t,a,o)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((c,g,h)=>{this.notifyListeners(c,h)});return}const o=e.key;t?this.detachListener():this.stopPolling();const a=()=>{const c=this.storage.getItem(o);!t&&this.localCache[o]===c||this.notifyListeners(o,c)},d=this.storage.getItem(o);ik()&&d!==e.newValue&&e.newValue!==e.oldValue?setTimeout(a,Mk):a()}notifyListeners(e,t){this.localCache[e]=t;const o=this.listeners[e];if(o)for(const a of Array.from(o))a(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,o)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:o}),!0)})},Dk)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Ob
22088ject.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}M8.type="LOCAL";const Tk=M8;/**
22089 * @license
22090 * Copyright 2020 Google LLC
22091 *
22092 * Licensed under the Apache License, Version 2.0 (the "License");
22093 * you may not use this file except in compliance with the License.
22094 * You may obtain a copy of the License at
22095 *
22096 *   http://www.apache.org/licenses/LICENSE-2.0
22097 *
22098 * Unless required by applicable law or agreed to in writing, software
22099 * distributed under the License is distributed on an "AS IS" BASIS,
22100 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22101 * See the License for the specific language governing permissions and
22102 * limitations under the License.
22103 */class T8 extends D8{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}T8.type="SESSION";const I8=T8;/**
22104 * @license
22105 * Copyright 2019 Google LLC
22106 *
22107 * Licensed under the Apache License, Version 2.0 (the "License");
22108 * you may not use this file except in compliance with the License.
22109 * You may obtain a copy of the License at
22110 *
22111 *   http://www.apache.org/licenses/LICENSE-2.0
22112 *
22113 * Unless required by applicable law or agreed to in writing, software
22114 * distributed under the License is distributed on an "AS IS" BASIS,
22115 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22116 * See the License for the specific language governing permissions and
22117 * limitations under the License.
22118 */function Ik(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
22119 * @license
22120 * Copyright 2019 Google LLC
22121 *
22122 * Licensed under the Apache License, Version 2.0 (the "License");
22123 * you may not use this file except in compliance with the License.
22124 * You may obtain a copy of the License at
22125 *
22126 *   http://www.apache.org/licenses/LICENSE-2.0
22127 *
22128 * Unless required by applicable law or agreed to in writing, software
22129 * distributed under the License is distributed on an "AS IS" BASIS,
22130 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22131 * See the License for the specific language governing permissions and
22132 * limitations under the License.
22133 */class vp{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(a=>a.isListeningto(e));if(t)return t;const o=new vp(e);return this.receivers.push(o),o}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:o,eventType:a,data:d}=t.data,c=this.handlersMap[a];if(!(c!=null&&c.size))return;t.ports[0].postMessage({status:"ack",eventId:o,eventType:a});const g=Array.from(c).map(async v=>v(t.origin,d)),h=await Ik(g);t.ports[0].postMessage({status:"done",eventId:o,eventType:a,response:h})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}vp.receivers=[];/**
22134 * @license
22135 * Copyright 2020 Google LLC
22136 *
22137 * Licensed under the Apache License, Version 2.0 (the "License");
22138 * you may not use this file except in compliance with the License.
22139 * You may obtain a copy of the License at
22140 *
22141 *   http://www.apache.org/licenses/LICENSE-2.0
22142 *
22143 * Unless required by applicable law or agreed to in writing, software
22144 * distributed under the License is distributed on an "AS IS" BASIS,
22145 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22146 * See the License for the specific language governing permissions and
22147 * limitations under the License.
22148 */function h1(r="",e=10){let t="";for(let o=0;o<e;o++)t+=Math.floor(Math.random()*10);return r+t}/**
22149 * @license
22150 * Copyright 2019 Google LLC
22151 *
22152 * Licensed under the Apache License, Version 2.0 (the "License");
22153 * you may not use this file except in compliance with the License.
22154 * You may obtain a copy of the License at
22155 *
22156 *   http://www.apache.org/licenses/LICENSE-2.0
22157 *
22158 * Unless required by applicable law or agreed to in writing, software
22159 * distributed under the License is distributed on an "AS IS" BASIS,
22160 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22161 * See the License for the specific language governing permissions and
22162 * limitations under the License.
22163 */class Ok{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,o=50){const a=typeof MessageChannel<"u"?new MessageChannel:null;if(!a)throw new Error("connection_unavailable");let d,c;return new Promise((g,h)=>{const v=h1("",20);a.port1.start();const _=setTimeout(()=>{h(new Error("unsupported_event"))},o);c={messageChannel:a,onMessage(E){const M=E;if(M.data.eventId===v)switch(M.data.status){case"ack":clearTimeout(_),d=setTimeout(()=>{h(new Error("timeout"))},3e3);break;case"done":clearTimeout(d),g(M.data.response);break;default:clearTimeout(_),clearTimeout(d),h(new Error("invalid_response"));break}}},this.handlers.add(c),a.port1.addEventListener("message",c.onMessage),this.target.postMessage({eventType:e,eventId:v,data:t},[a.port2])}).finally(()=>{c&&this.removeMessageHandler(c)})}}/**
22164 * @license
22165 * Copyright 2020 Google LLC
22166 *
22167 * Licensed under the Apache License, Version 2.0 (the "License");
22168 * you may not use this file except in compliance with the License.
22169 * You may obtain a copy of the License at
22170 *
22171 *   http://www.apache.org/licenses/LICENSE-2.0
22172 *
22173 * Unless required by applicable law or agreed to in writing, software
22174 * distributed under the License is distributed on an "AS IS" BASIS,
22175 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22176 * See the License for the specific language governing permissions and
22177 * limitations under the License.
22178 */function Es(){return window}function Pk(r){Es().location.href=r}/**
22179 * @license
22180 * Copyright 2020 Google LLC.
22181 *
22182 * Licensed under the Apache License, Version 2.0 (the "License");
22183 * you may not use this file except in compliance with the License.
22184 * You may obtain a copy of the License at
22185 *
22186 *   http://www.apache.org/licenses/LICENSE-2.0
22187 *
22188 * Unless required by applicable law or agreed to in writing, software
22189 * distributed under the License is distributed on an "AS IS" BASIS,
22190 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22191 * See the License for the specific language governing permissions and
22192 * limitations under the License.
22193 */function O8(){return typeof Es().WorkerGlobalScope<"u"&&typeof Es().importScripts=="function"}async function zk(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Lk(){var r;return((r=navigator==null?void 0:navigator.serviceWorker)==null?void 0:r.controller)||null}function Nk(){return O8()?self:null}/**
22194 * @license
22195 * Copyright 2019 Google LLC
22196 *
22197 * Licensed under the Apache License, Version 2.0 (the "License");
22198 * you may not use this file except in compliance with the License.
22199 * You may obtain a copy of the License at
22200 *
22201 *   http://www.apache.org/licenses/LICENSE-2.0
22202 *
22203 * Unless required by applicable law or agreed to in writing, software
22204 * distributed under the License is distributed on an "AS IS" BASIS,
22205 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22206 * See the License for the specific language governing permissions and
22207 * limitations under the License.
22208 */const P8="firebaseLocalStorageDb",Vk=1,ju="firebaseLocalStorage",z8="fbase_key";class Mc{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function bp(r,e){return r.transaction([ju],e?"readwrite":"readonly").objectStore(ju)}function Uk(){const r=indexedDB.deleteDatabase(P8);
22208return new Mc(r).toPromise()}function L8(){const r=indexedDB.open(P8,Vk);return new Promise((e,t)=>{r.addEventListener("error",()=>{t(r.error)}),r.addEventListener("upgradeneeded",()=>{const o=r.result;try{o.createObjectStore(ju,{keyPath:z8})}catch(a){t(a)}}),r.addEventListener("success",async()=>{const o=r.result;o.objectStoreNames.contains(ju)?e(o):(o.close(),await Uk(),e(await L8()))})})}async function N5(r,e,t){const o=bp(r,!0).put({[z8]:e,value:t});return new Mc(o).toPromise()}async function Bk(r,e){const t=bp(r,!1).get(e),o=await new Mc(t).toPromise();return o===void 0?null:o.value}function V5(r,e){const t=bp(r,!0).delete(e);return new Mc(t).toPromise()}const Gk=800,qk=3;class N8{constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise?this.dbPromise:(this.dbPromise=L8(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let t=0;for(;;)try{const o=await this._openDb();return await e(o)}catch(o){if(t++>qk)throw o;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return O8()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=vp._getInstance(Nk()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var t,o;if(this.activeServiceWorker=await zk(),!this.activeServiceWorker)return;this.sender=new Ok(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(t=e[0])!=null&&t.fulfilled&&(o=e[0])!=null&&o.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Lk()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await N5(e,Fu,"1"),await V5(e,Fu)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(o=>N5(o,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(o=>Bk(o,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>V5(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(a=>{const d=bp(a,!1).getAll();return new Mc(d).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],o=new Set;if(e.length!==0)for(const{fbase_key:a,value:d}of e)o.add(a),JSON.stringify(this.localCache[a])!==JSON.stringify(d)&&(this.notifyListeners(a,d),t.push(a));for(const a of Object.keys(this.localCache))this.localCache[a]&&!o.has(a)&&(this.notifyListeners(a,null),t.push(a));return t}notifyListeners(e,t){this.localCache[e]=t;const o=this.listeners[e];if(o)for(const a of Array.from(o))a(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Gk)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Ob
vendor: 4,318 bytes, lines 22208-22257
22208ject.keys(this.listeners).length===0&&this.stopPolling()}}N8.type="LOCAL";const Fk=N8;new Rc(3e4,6e4);/**
22209 * @license
22210 * Copyright 2021 Google LLC
22211 *
22212 * Licensed under the Apache License, Version 2.0 (the "License");
22213 * you may not use this file except in compliance with the License.
22214 * You may obtain a copy of the License at
22215 *
22216 *   http://www.apache.org/licenses/LICENSE-2.0
22217 *
22218 * Unless required by applicable law or agreed to in writing, software
22219 * distributed under the License is distributed on an "AS IS" BASIS,
22220 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22221 * See the License for the specific language governing permissions and
22222 * limitations under the License.
22223 */function jk(r,e){return e?Zs(e):(Le(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}/**
22224 * @license
22225 * Copyright 2019 Google LLC
22226 *
22227 * Licensed under the Apache License, Version 2.0 (the "License");
22228 * you may not use this file except in compliance with the License.
22229 * You may obtain a copy of the License at
22230 *
22231 *   http://www.apache.org/licenses/LICENSE-2.0
22232 *
22233 * Unless required by applicable law or agreed to in writing, software
22234 * distributed under the License is distributed on an "AS IS" BASIS,
22235 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22236 * See the License for the specific language governing permissions and
22237 * limitations under the License.
22238 */class v1 extends k8{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ll(e,this._buildIdpRequest())}_linkToIdToken(e,t){return ll(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return ll(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function Xk(r){return Sk(r.auth,new v1(r),r.bypassAuthState)}function Hk(r){const{auth:e,user:t}=r;return Le(t,e,"internal-error"),Ek(t,new v1(r),r.bypassAuthState)}async function Wk(r){const{auth:e,user:t}=r;return Le(t,e,"internal-error"),wk(t,new v1(r),r.bypassAuthState)}/**
22239 * @license
22240 * Copyright 2020 Google LLC
22241 *
22242 * Licensed under the Apache License, Version 2.0 (the "License");
22243 * you may not use this file except in compliance with the License.
22244 * You may obtain a copy of the License at
22245 *
22246 *   http://www.apache.org/licenses/LICENSE-2.0
22247 *
22248 * Unless required by applicable law or agreed to in writing, software
22249 * distributed under the License is distributed on an "AS IS" BASIS,
22250 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22251 * See the License for the specific language governing permissions and
22252 * limitations under the License.
22253 */class V8{constructor(e,t,o,a,d=!1){this.auth=e,this.resolver=o,this.user=a,this.bypassAuthState=d,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(o){this.reject(o)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:o,postBody:a,tenantId:d,error:c,type:g}=e;if(c){this.reject(c);return}const h={auth:this.auth,requestUri:t,sessionId:o,tenantId:d||void 0,postBody:a||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(g)(h))}catch(v){this.reject(v)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Xk;case"linkViaPopup":case"linkViaRedirect":return Wk;case"reauthViaPopup":case"reauthViaRedirect":return Hk;default:sr(this.auth,"internal-error")}}resolve(e){rr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){rr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
22254 * @license
22255 * Copyright 2020 Google LLC
22256 *
22257 * Licensed under the Apache License, Version 2.0 (the "License");
22258 * you may not use this file except in compliance with the License.
22259 * You may obtain a copy of the License at
22260 *
22261 *   http://www.apache.org/licenses/LICENSE-2.0
22262 *
22263 * Unless required by applicable law or agreed to in writing, software
22264 * distributed under the License is distributed on an "AS IS" BASIS,
22265 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22266 * See the License for the specific language governing permissions and
22267 * limitations under the License.
22268 */const Kk=new Rc(2e3,1e4);class nl extends V8{constructor(e,t,o,a,d){super(e,t,a,d),this.provider=o,this.authWindow=null,this.pollId=null,nl.currentPopupAction&&nl.currentPopupAction.cancel(),nl.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Le(e,this.auth,"internal-error"),e}async onExecution(){rr(this.filter.length===1,"Popup operations only handle one event");const e=h1();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(ws(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(ws(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,nl.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,o;if((o=(t=this.authWindow)==null?void 0:t.window)!=null&&o.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(ws(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Kk.get())};e()}}nl.currentPopupAction=null;/**
22269 * @license
22270 * Copyright 2020 Google LLC
22271 *
22272 * Licensed under the Apache License, Version 2.0 (the "License");
22273 * you may not use this file except in compliance with the License.
22274 * You may obtain a copy of the License at
22275 *
22276 *   http://www.apache.org/licenses/LICENSE-2.0
22277 *
22278 * Unless required by applicable law or agreed to in writing, software
22279 * distributed under the License is distributed on an "AS IS" BASIS,
22280 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22281 * See the License for the specific language governing permissions and
22282 * limitations under the License.
22283 */const Qk="pendingRedirect",bu=new Map;class Yk extends V8{constructor(e,t,o=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,o),this.eventId=null}async execute(){let e=bu.get(this.auth._key());if(!e){try{const o=await $k(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(o)}catch(t){e=()=>Promise.reject(t)}bu.set(this.auth._key(),e)}return this.bypassAuthState||bu.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function $k(r,e){const t=eC(e),o=Zk(r);if(!await o._isAvailable())return!1;const a=await o._get(t)==="true";return await o._remove(t),a}function Jk(r,e){bu.set(r._key(),e)}function Zk(r){return Zs(r._redirectPersistence)}function eC(r){return vu(Qk,r.config.apiKey,r.name)}async function tC(r,e,t=!1){if(vs(r.app))return Promise.reject(ti(r));const o=g1(r),a=jk(o,e),c=await new Yk(o,a,t).execute();return c&&!t&&(delete c.user._redirectEventId,await o._persistUserIfCurrent(c.user),await o._setRedirectUser(null,e)),c}/**
22284 * @license
22285 * Copyright 2020 Google LLC
22286 *
22287 * Licensed under the Apache License, Version 2.0 (the "License");
22288 * you may not use this file except in compliance with the License.
22289 * You may obtain a copy of the License at
22290 *
22291 *   http://www.apache.org/licenses/LICENSE-2.0
22292 *
22293 * Unless required by applicable law or agreed to in writing, softw
22293are
22294 * distributed under the License is distributed on an "AS IS" BASIS,
22295 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22296 * See the License for the specific language governing permissions and
22297 * limitations under the License.
22298 */const nC=600*1e3;class oC{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(o=>{this.isEventForConsumer(e,o)&&(t=!0,this.sendToConsumer(e,o),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!sC(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var o;if(e.error&&!U8(e)){const a=((o=e.error.code)==null?void 0:o.split("auth/")[1])||"internal-error";t.onError(ws(this.auth,a))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const o=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&o}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=nC&&this.cachedEventUids.clear(),this.cachedEventUids.has(U5(e))}saveEventToCache(e){this.cachedEventUids.add(U5(e)),this.lastProcessedEventTime=Date.now()}}function U5(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function U8({type:r,error:e}){return r==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function sC(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return U8(r);default:return!1}}/**
22299 * @license
22300 * Copyright 2020 Google LLC
22301 *
22302 * Licensed under the Apache License, Version 2.0 (the "License");
22303 * you may not use this file except in compliance with the License.
22304 * You may obtain a copy of the License at
22305 *
22306 *   http://www.apache.org/licenses/LICENSE-2.0
22307 *
22308 * Unless required by applicable law or agreed to in writing, software
22309 * distributed under the License is distributed on an "AS IS" BASIS,
22310 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22311 * See the License for the specific language governing permissions and
22312 * limitations under the License.
22313 */async function rC(r,e={}){return Dl(r,"GET","/v1/projects",e)}/**
22314 * @license
22315 * Copyright 2020 Google LLC
22316 *
22317 * Licensed under the Apache License, Version 2.0 (the "License");
22318 * you may not use this file except in compliance with the License.
22319 * You may obtain a copy of the License at
22320 *
22321 *   http://www.apache.org/licenses/LICENSE-2.0
22322 *
22323 * Unless required by applicable law or agreed to in writing, software
22324 * distributed under the License is distributed on an "AS IS" BASIS,
22325 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22326 * See the License for the specific language governing permissions and
22327 * limitations under the License.
22328 */const aC=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,iC=/^https?/;async function lC(r){if(r.config.emulator)return;const{authorizedDomains:e}=await rC(r);for(const t of e)try{if(dC(t))return}catch{}sr(r,"unauthorized-domain")}function dC(r){const e=ch(),{protocol:t,hostname:o}=new URL(e);if(r.startsWith("chrome-extension://")){const c=new URL(r);return c.hostname===""&&o===""?t==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&c.hostname===o}if(!iC.test(t))return!1;if(aC.test(r))return o===r;const a=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+a+"|"+a+")$","i").test(o)}/**
22329 * @license
22330 * Copyright 2020 Google LLC.
22331 *
22332 * Licensed under the Apache License, Version 2.0 (the "License");
22333 * you may not use this file except in compliance with the License.
22334 * You may obtain a copy of the License at
22335 *
22336 *   http://www.apache.org/licenses/LICENSE-2.0
22337 *
22338 * Unless required by applicable law or agreed to in writing, softw
22338are
22339 * distributed under the License is distributed on an "AS IS" BASIS,
22340 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22341 * See the License for the specific language governing permissions and
22342 * limitations under the License.
22343 */const cC=new Rc(3e4,6e4);function B5(){const r=Es().___jsl;if(r!=null&&r.H){for(const e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let t=0;t<r.CP.length;t++)r.CP[t]=null}}function mC(r){return new Promise((e,t)=>{var a,d,c;function o(){B5(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{B5(),t(ws(r,"network-request-failed"))},timeout:cC.get()})}if((d=(a=Es().gapi)==null?void 0:a.iframes)!=null&&d.Iframe)e(gapi.iframes.getContext());else if((c=Es().gapi)!=null&&c.load)o();else{const g=hk("iframefcb");return Es()[g]=()=>{gapi.load?o():t(ws(r,"network-request-failed"))},gk(`${fk()}?onload=${g}`).catch(h=>t(h))}}).catch(e=>{throw yu=null,e})}let yu=null;function uC(r){return yu=yu||mC(r),yu}/**
22344 * @license
22345 * Copyright 2020 Google LLC.
22346 *
22347 * Licensed under the Apache License, Version 2.0 (the "License");
22348 * you may not use this file except in compliance with the License.
22349 * You may obtain a copy of the License at
22350 *
22351 *   http://www.apache.org/licenses/LICENSE-2.0
22352 *
22353 * Unless required by applicable law or agreed to in writing, software
22354 * distributed under the License is distributed on an "AS IS" BASIS,
22355 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22356 * See the License for the specific language governing permissions and
22357 * limitations under the License.
22358 */const pC=new Rc(5e3,15e3),gC="__/auth/iframe",fC="emulator/auth/iframe",hC={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},vC=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function bC(r){const e=r.config;Le(e.authDomain,r,"auth-domain-config-required");const t=e.emulator?c1(e,fC):`https://${r.config.authDomain}/${gC}`,o={apiKey:e.apiKey,appName:r.name,v:xl},a=vC.get(r.config.apiHost);a&&(o.eid=a);const d=r._getFrameworks();return d.length&&(o.fw=d.join(",")),`${t}?${fc(o).slice(1)}`}async function yC(r){const e=await uC(r),t=Es().gapi;return Le(t,r,"internal-error"),e.open({where:document.body,url:bC(r),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:hC,dontclear:!0},o=>new Promise(async(a,d)=>{await o.restyle({setHideOnLeave:!1});const c=ws(r,"network-request-failed"),g=Es().setTimeout(()=>{d(c)},pC.get());function h(){Es().clearTimeout(g),a(o)}o.ping(h).then(h,()=>{d(c)})}))}/**
22359 * @license
22360 * Copyright 2020 Google LLC.
22361 *
22362 * Licensed under the Apache License, Version 2.0 (the "License");
22363 * you may not use this file except in compliance with the License.
22364 * You may obtain a copy of the License at
22365 *
22366 *   http://www.apache.org/licenses/LICENSE-2.0
22367 *
22368 * Unless required by applicable law or agreed to in writing, software
22369 * distributed under the License is distributed on an "AS IS" BASIS,
22370 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22371 * See the License for the specific language governing permissions and
22372 * limitations under the License.
22373 */const xC={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},AC=500,_C=600,wC="_blank",EC="http://localhost";class G5{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function SC(r,e,t,o=AC,a=_C){const d=Math.max((window.screen.availHeight-a)/2,0).toString(),c=Math.max((window.screen.availWidth-o)/2,0).toString();let g="";const h={...xC,width:o.toString(),height:a.toString(),top:d,left:c},v=Mn().toLowerCase();t&&(g=b8(v)?wC:t),h8(v)&&(e=e||EC,h.scrollbars="yes");const _=Object.entries(h).reduce((M,[G,B])=>`${M}${G}=${B},`,"");if(ak(v)&&g!=="_self")return kC(e||"",g),new G5(null);const E=window.open(e||"",g,_);Le(E,r,"popup-blocked");try{E.focus()}catch{}return new G5(E)}function kC(r,e){const t=document.createElement("a");t.href=r,t.target=e;const o=document.createEvent("MouseEvent");
22373o.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(o)}/**
22374 * @license
22375 * Copyright 2021 Google LLC
22376 *
22377 * Licensed under the Apache License, Version 2.0 (the "License");
22378 * you may not use this file except in compliance with the License.
22379 * You may obtain a copy of the License at
22380 *
22381 *   http://www.apache.org/licenses/LICENSE-2.0
22382 *
22383 * Unless required by applicable law or agreed to in writing, software
22384 * distributed under the License is distributed on an "AS IS" BASIS,
22385 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22386 * See the License for the specific language governing permissions and
22387 * limitations under the License.
22388 */const CC="__/auth/handler",RC="emulator/auth/handler",DC=encodeURIComponent("fac");async function q5(r,e,t,o,a,d){Le(r.config.authDomain,r,"auth-domain-config-required"),Le(r.config.apiKey,r,"invalid-api-key");const c={apiKey:r.config.apiKey,appName:r.name,authType:t,redirectUrl:o,v:xl,eventId:a};if(e instanceof C8){e.setDefaultLanguage(r.languageCode),c.providerId=e.providerId||"",m7(e.getCustomParameters())||(c.customParameters=JSON.stringify(e.getCustomParameters()));for(const[_,E]of Object.entries({}))c[_]=E}if(e instanceof Dc){const _=e.getScopes().filter(E=>E!=="");_.length>0&&(c.scopes=_.join(","))}r.tenantId&&(c.tid=r.tenantId);const g=c;for(const _ of Object.keys(g))g[_]===void 0&&delete g[_];const h=await r._getAppCheckToken(),v=h?`#${DC}=${encodeURIComponent(h)}`:"";return`${MC(r)}?${fc(g).slice(1)}${v}`}function MC({config:r}){return r.emulator?c1(r,RC):`https://${r.authDomain}/${CC}`}/**
22389 * @license
22390 * Copyright 2020 Google LLC
22391 *
22392 * Licensed under the Apache License, Version 2.0 (the "License");
22393 * you may not use this file except in compliance with the License.
22394 * You may obtain a copy of the License at
22395 *
22396 *   http://www.apache.org/licenses/LICENSE-2.0
22397 *
22398 * Unless required by applicable law or agreed to in writing, software
22399 * distributed under the License is distributed on an "AS IS" BASIS,
22400 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22401 * See the License for the specific language governing permissions and
22402 * limitations under the License.
22403 */const zf="webStorageSupport";class TC{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=I8,this._completeRedirectFn=tC,this._overrideRedirectResult=Jk}async _openPopup(e,t,o,a){var c;rr((c=this.eventManagers[e._key()])==null?void 0:c.manager,"_initialize() not called before _openPopup()");const d=await q5(e,t,o,ch(),a);return SC(e,d,h1())}async _openRedirect(e,t,o,a){await this._originValidation(e);const d=await q5(e,t,o,ch(),a);return Pk(d),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:a,promise:d}=this.eventManagers[t];return a?Promise.resolve(a):(rr(d,"If manager is not set, promise should be"),d)}const o=this.initAndGetManager(e);return this.eventManagers[t]={promise:o},o.catch(()=>{delete this.eventManagers[t]}),o}async initAndGetManager(e){const t=await yC(e),o=new oC(e);return t.register("authEvent",a=>(Le(a==null?void 0:a.authEvent,e,"invalid-auth-event"),{status:o.onEvent(a.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:o},this.iframes[e._key()]=t,o}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(zf,{type:zf},a=>{var c;const d=(c=a==null?void 0:a[0])==null?void 0:c[zf];d!==void 0&&t(!!d),sr(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=lC(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return w8()||v8()||p1()}}const IC=TC;var F5="@firebase/auth",j5="1.13.3";/**
22404 * @license
22405 * Copyright 2020 Google LLC
22406 *
22407 * Licensed under the Apache License, Version 2.0 (the "License");
22408 * you may not use this file except in compliance with the License.
22409 * You may obtain a copy of the License at
22410 *
22411 *   http://www.apache.org/licenses/LICENSE-2.0
22412 *
22413 * Unless required by applicable law or agreed to in writing, softw
22413are
22414 * distributed under the License is distributed on an "AS IS" BASIS,
22415 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22416 * See the License for the specific language governing permissions and
22417 * limitations under the License.
22418 */class OC{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(o=>{e((o==null?void 0:o.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){Le(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
22419 * @license
22420 * Copyright 2020 Google LLC
22421 *
22422 * Licensed under the Apache License, Version 2.0 (the "License");
22423 * you may not use this file except in compliance with the License.
22424 * You may obtain a copy of the License at
22425 *
22426 *   http://www.apache.org/licenses/LICENSE-2.0
22427 *
22428 * Unless required by applicable law or agreed to in writing, software
22429 * distributed under the License is distributed on an "AS IS" BASIS,
22430 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22431 * See the License for the specific language governing permissions and
22432 * limitations under the License.
22433 */function PC(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function zC(r){cl(new oi("auth",(e,{options:t})=>{const o=e.getProvider("app").getImmediate(),a=e.getProvider("heartbeat"),d=e.getProvider("app-check-internal"),{apiKey:c,authDomain:g}=o.options;Le(c&&!c.includes(":"),"invalid-api-key",{appName:o.name});const h={apiKey:c,authDomain:g,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:E8(r)},v=new uk(o,a,d,h);return bk(v,t),v},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,o)=>{e.getProvider("auth-internal").initialize()})),cl(new oi("auth-internal",e=>{const t=g1(e.getProvider("auth").getImmediate());return(o=>new OC(o))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),Yr(F5,j5,PC(r)),Yr(F5,j5,"esm2020")}/**
22434 * @license
22435 * Copyright 2021 Google LLC
22436 *
22437 * Licensed under the Apache License, Version 2.0 (the "License");
22438 * you may not use this file except in compliance with the License.
22439 * You may obtain a copy of the License at
22440 *
22441 *   http://www.apache.org/licenses/LICENSE-2.0
22442 *
22443 * Unless required by applicable law or agreed to in writing, software
22444 * distributed under the License is distributed on an "AS IS" BASIS,
22445 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22446 * See the License for the specific language governing permissions and
22447 * limitations under the License.
22448 */const LC=300,NC=ny("authIdTokenMaxAge")||LC;let X5=null;const VC=r=>async e=>{const t=e&&await e.getIdTokenResult(),o=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(o&&o>NC)return;const a=t==null?void 0:t.token;X5!==a&&(X5=a,await fetch(r,{method:a?"POST":"DELETE",headers:a?{Authorization:`Bearer ${a}`}:{}}))};function UC(r=iy()){const e=fh(r,"auth");if(e.isInitialized())return e.getImmediate();const t=vk(r,{popupRedirectResolver:IC,persistence:[Fk,Tk,I8]}),o=ny("authTokenSyncURL");if(o&&typeof isSecureContext=="boolean"&&isSecureContext){const d=new URL(o,location.origin);if(location.origin===d.origin){const c=VC(d.toString());Ck(t,c,()=>c(t.currentUser)),kk(t,g=>c(g))}}const a=ey("auth");return a&&yk(t,`http://${a}`),t}function BC(){var r;return((r=document.getElementsByTagName("head"))==null?void 0:r[0])??document}pk({loadJS(r){return new Promise((e,t)=>
22448{const o=document.createElement("script");o.setAttribute("src",r),o.onload=e,o.onerror=a=>{const d=ws("internal-error");d.customData=a,t(d)},o.type="text/javascript",o.charset="UTF-8",BC().appendChild(o)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});zC("Browser");const GC={},zn=GC||{},B8={apiKey:zn.VITE_FIREBASE_API_KEY||"AIzaSyD-dummy-api-key-for-compilation-only",authDomain:zn.VITE_FIREBASE_AUTH_DOMAIN||"setup-ia-local-rx580-vulkan.firebaseapp.com",projectId:zn.VITE_FIREBASE_PROJECT_ID||"setup-ia-local-rx580-vulkan",storageBucket:zn.VITE_FIREBASE_STORAGE_BUCKET||"setup-ia-local-rx580-vulkan.appspot.com",messagingSenderId:zn.VITE_FIREBASE_MESSAGING_SENDER_ID||"000000000000",appId:zn.VITE_FIREBASE_APP_ID||"1:000000000000:web:0000000000000000000000",firestoreDatabaseId:zn.VITE_FIREBASE_DATABASE_ID||"(default)"},ta=!zn.VITE_FIREBASE_API_KEY||zn.VITE_FIREBASE_API_KEY===""||zn.VITE_FIREBASE_API_KEY==="AIzaSyD-dummy-api-key-for-compilation-only"||typeof zn.VITE_FIREBASE_API_KEY!="string"||!zn.VITE_FIREBASE_API_KEY.startsWith("AIzaSy")||zn.VITE_FIREBASE_API_KEY.includes("dummy")||zn.VITE_FIREBASE_API_KEY.includes("placeholder")||zn.VITE_FIREBASE_API_KEY.includes("Sua_Chave"),G8=ta?null:ay(B8),dl=ta?null:CS(G8,B8.firestoreDatabaseId),qC=ta?null:UC(G8);new Ys;const Lf=[{id:"setup",title:"Capítulo 1: Setup utilizado (0:00)",time:"0:00",desc:"Processador moderno de 2024 (Ryzen / Intel i5 12400F) com placa original Sapphire Nitro+ RX 580 8GB lançada em 2017.",verdict:"Original e íntegra (não é modelo capado/recondicionado)",temp:"N/D",vram:"8GB GDDR5",usage:"Idle",power:"Consumo alto nos menus",fps:"N/D"},{id:"warzone",title:"Capítulo 2: RX580 Warzone (1:10)",time:"1:10",desc:"Warzone atual com FSR no modo Qualidade, rodado no preset de gráficos mínimos para manter a estabilidade de quadros.",verdict:"Jogável mas esguela a GPU no talo",temp:"77ºC",vram:"8GB",usage:"100%",power:"155 Watts",fps:"60 - 67 FPS"},{id:"re4",title:"Capítulo 3: Resident Evil 4 Remake (2:15)",time:"2:15",desc:"Preset médio de texturas em 1080p Nativo (Sem FSR ativado
22448). Desempenho surpreendentemente redondo de renderização.",verdict:"Excelente fluidez e frame time estável",temp:"78ºC",vram:"6.5GB",usage:"99%",power:"170 Watts",fps:"50 - 70 FPS"},{id:"hogwarts",title:"Capítulo 4: Hogwarts Legacy (2:48)",time:"2:48",desc:"Nível Médio de detalhamento gráfico utilizando FSR 3 no modo Qualidade para amparar renderização nos pátios extensivos.",verdict:"Frame time firme, mas cai em batalhas",temp:"78ºC",vram:"7.2GB",usage:"100%",power:"185 Watts",fps:"45 - 59 FPS"},{id:"elden",title:"Capítulo 5: Elden Ring (3:46)",time:"3:46",desc:"Elden Ring travado no preset Médio. Combates fluídos contra chefes com resposta de comando sem engasgabilidade.",verdict:"Muito fluido e firme nas lutas",temp:"76ºC",vram:"5.8GB",usage:"99%",power:"165 Watts",fps:"60 FPS (V-Sync)"},{id:"alanwake",title:"Capítulo 6: Alan Wake 2 & SpiderMan 2 (4:15)",time:"4:15",desc:"Alan Wake necessita de Mesh Shaders de herança (inexistentes na RX 580/Polaris). Spider-Man 2 crasha por falta de instruções modernas.",verdict:"Barreira física de tecnologias legadas",temp:"Crush",vram:"N/D",usage:"99%",power:"Crash no menu",fps:"Inviável / Travado"},{id:"cyberpunk",title:"Capítulo 7: Cyberpunk 2077 (5:31)",time:"5:31",desc:"Habilidade de processar reflexos básicos em 1080p com FSR no modo Qualidade. Cintilação visível devido a limitações do construtor.",verdict:"Aproveitável e estável",temp:"78ºC",vram:"6.1GB",usage:"100%",power:"175 Watts",fps:"57 - 60 FPS"},{id:"expedition",title:"Capítulo 8: Expedition 33 (6:35)",time:"6:35",desc:"Teste em título severo planejado para 2025. Roda inteiramente no preset Baixo com FSR ativado sob escala severa de pixels.",verdict:"Gráfico degradado mas frame aceitável",temp:"79ºC",vram:"7.4GB",usage:"100%",power:"180 Watts",fps:"60 - 65 FPS"},{id:"preco",title:"Capítulo 9: O Veredito do Preço (7:30)",time:"7:30",desc:"Se pagar R$ 300 - 400 vale a pena como GPU de transição. Se o custo chegar a R$ 900+ vale mais partir para uma RTX 3050 6GB ou TX modernizada.",verdict:"Não coloque a RX 580 em pedestal!",temp:"N/D",vram:"8GB",usage:"Valor",power:"Consumo x Performance",fps:"RTX 3050 é 40%+ rápida"}];function FC({lang:r}){const[e,t]=Re.useState("preco"),[o,a]=Re.useState([]),[d,c]=Re.useState(""),[g,h]=Re.useState(""),[v,_]=Re.useState("idle"),[E,M]=Re.useState([]),[G,B]=Re.useState(""),[ee,ie]=Re.useState(()=>ta||localStorage.getItem("rx580_local_comments")!==null),ve=[{id:"seed_1",chapterId:"preco",author:"Felipe_AMD",content:"Se pagar R$ 350 - R$ 400 vale super a pena como placa de transição em 2026! Me ajudou muito a jogar títulos indies e competitivos.",likes:12,createdAt:new Date("2026-06-01T12:00:00Z")},{id:"seed_2",chapterId:"preco",author:"Renato_Nvidia",content:"Concordo cara. Se passar de R$ 750, vale muito mais a pena ir direto para uma RTX 3050 6GB ou economizar para uma RX 6600.",likes:8,createdAt:new Date("2026-06-02T15:30:00Z")},{id:"seed_3",chapterId:"cyberpunk",author:"CyberHacker",content:"No Cyberpunk 2077 com FSR no modo Qualidade e texturas no Médio, mantém acima de 55 FPS super estável. Polaris de 2017 é incrível!",likes:15,createdAt:new Date("2026-06-03T18:45:00Z")},{id:"seed_4",chapterId:"alanwake",author:"Alan_Vulkan",content:"Alan Wake 2 sem Mesh Shaders infelizmente não rola, o frame rate despenca. Mas para os jogos DX11 e DX12 normais é guerreira demais.",likes:22,createdAt:new Date("2026-06-04T09:12:00Z")},{id:"seed_5",chapterId:"elden",author:"EldenGamer",content:"Elden Ring cravado a 60 FPS com preset Médio! Derrotei a Malenia nela sem engasgo nenhum.",likes:19,createdAt:new Date("2026-06-05T21:00:00Z")}],Se=()=>{try{const C=localStorage.getItem("rx580_local_comments");if(C)return JSON.parse(C).map(T=>({...T,createdAt:new Date(T.createdAt)}))}catch(C){console.error("Failed to parse local comments:",C)}return localStorage.setItem("rx580_local_comments",JSON.stringify(ve)),ve},Me=C=>{const T=Se(),z=[C,...T];localStorage.setItem("rx580_local_comments",JSON.stringify(z))},tt=(C,T)=>{const O=Se().map(N=>N.id===C?{...N,likes:N.likes+(T?-1:1)}:N);localStorage.setItem("rx580_local_comments",JSON.stringify(O))};Re.useEffect(()=>{try{const C=localStorage.getItem("rx580_dec_likes");C&&M(JSON.parse(C))}catch(C){console.error(C)}},[]),Re.useEffect(()=>{if(ee||ta){const N=Se().filter(D=>D.chapterId===e).sort((D,_e)=>_e.likes-D.likes||_e.createdAt.getTime()-D.createdAt.getTime());a(N);return}const T=s8(th(dl,"video_comments"),IS("chapterId","==",e),dh("like
22448s","desc"),dh("createdAt","desc"),OS(50)),z=i8(T,O=>{const N=[];O.forEach(D=>{const _e=D.data();N.push({id:D.id,chapterId:_e.chapterId,author:_e.author,content:_e.content,likes:_e.likes||0,createdAt:_e.createdAt?_e.createdAt.toDate():new Date})}),a(N)},O=>{console.warn("Firestore comments error, enabling offline storage fallback mode:",O),ie(!0);const D=Se().filter(_e=>_e.chapterId===e).sort((_e,he)=>he.likes-_e.likes||he.createdAt.getTime()-_e.createdAt.getTime());a(D)});return()=>z()},[e,ee]);const Ye=async C=>{if(C.preventDefault(),!d.trim()||!g.trim())return;_("submitting"),B("");const T={id:"comment_"+Date.now()+"_"+Math.random().toString(36).substring(2,6),chapterId:e,author:d.substring(0,50).trim(),content:g.substring(0,1e3).trim(),likes:0,createdAt:new Date};if(ee){Me(T);const D=Se().filter(_e=>_e.chapterId===e).sort((_e,he)=>he.likes-_e.likes||he.createdAt.getTime()-_e.createdAt.getTime());a(D),h(""),_("done"),setTimeout(()=>_("idle"),3e3);return}const z="video_comments",O={chapterId:e,author:T.author,content:T.content,likes:0,createdAt:T_()};try{if(O.author.length===0||O.content.length===0)throw new Error("Validation check: Content cannot be empty!");await VS(th(dl,z),O),h(""),_("done"),setTimeout(()=>_("idle"),3e3)}catch(N){console.warn("Firestore error during write, performing local offline fallback write:",N),ie(!0),Me(T);const _e=Se().filter(he=>he.chapterId===e).sort((he,K)=>K.likes-he.likes||K.createdAt.getTime()-he.createdAt.getTime());a(_e),h(""),_("done"),setTimeout(()=>_("idle"),3e3)}},qe=async(C,T)=>{const z=E.includes(C),O=z?E.filter(D=>D!==C):[...E,C];if(M(O),localStorage.setItem("rx580_dec_likes",JSON.stringify(O)),ee){tt(C,z);const _e=Se().filter(he=>he.chapterId===e).sort((he,K)=>K.likes-he.likes||K.createdAt.getTime()-he.createdAt.getTime());a(_e);return}const N="video_comments";try{const D=Ou(dl,N,C);await LS(D,{likes:I_(z?-1:1)})}catch(D){console.warn("Firestore error during like, performing local offline fallback like:",D),ie(!0),tt(C,z);const he=Se().filter(K=>K.chapterId===e).sort((K,ce)=>ce.likes-K.likes||ce.createdAt.getTime()-K.createdAt.getTime());a(he)}},w=Lf.find(C=>C.id===e)||Lf[0];return f.jsxs("div",{id:"vulkan_debate_section",className:"bg-[#0c0d10] border border-white/5 rounded-lg p-5 mt-6 font-sans",children:[f.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between gap-4 border-b border-white/5 pb-4 mb-5",children:[f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[f.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${ee?"bg-amber-400":"bg-[#E11D48]"} animate-pulse`}),f.jsx("h3",{className:"font-sans font-black text-white text-xs uppercase tracking-[1px]",children:ee?r==="pt-BR"?"MODO OFFLINE (MEMÓRIA LOCAL)":"OFFLINE STORAGE MODE":r==="pt-BR"?"HOSPEDAGEM FIRESTORE DISPONÍVEL":"FIRESTORE HOSTING AVAILABLE"})]}),f.jsx("h2",{className:"text-lg font-black text-white tracking-tight uppercase",children:r==="pt-BR"?"DEBATE EM TEMPO REAL: COMENTÁRIOS DO VÍDEO":"REAL-TIME DEBATE: VIDEO COMMENTS"}),f.jsx("p",{className:"text-[11px] text-[#475569] font-mono mt-0.5",children:'// Ref: "A RX 580 8GB ainda vale a pena em 2026?" sitemap.xml'})]}),f.jsxs("div",{className:"flex items-center gap-2 bg-[#141517] border border-white/5 px-3 py-1.5 rounded text-xs font-mono",children:[f.jsx(ox,{size:12,className:"text-[#E11D48]"}),f.jsx("span",{className:"text-[#e2e8f0]",children:"Polaris GPU GCN4 Testbeds"})]})]}),f.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[f.jsxs("div",{className:"lg:col-span-5 flex flex-col gap-2.5 max-h-[500px] overflow-y-auto pr-1 scrollbar",children:[f.jsx("div",{className:"text-[10px] text-gray-500 font-mono uppercase tracking-[0.5px] mb-1",children:r==="pt-BR"?"Selecione uma parte do vídeo para ver os comentários:":"Select video section to filter:"}),Lf.map(C=>{const T=e===C.id;return f.jsxs("button",{onClick:()=>t(C.id),className:`w-full text-left p-3 rounded border text-xs transition-all cursor-pointer ${T?"bg-[#E11D48]/10 border-[#E11D48] text-white":"bg-[#0f1013] border-white/5 text-gray-400 hover:border-white/10 hover:text-white"}`,children:[f.jsxs("div",{className:"flex items-center justify-between mb-1",children:[f.jsx("span",{className:`font-bold transition-colors ${T?"text-white":"text-gray-200"}`,children:C.title}),f.jsx("span",{className:"font-mono text-[9px] bg-white/5 text-gray-300 px-1.5 py-0.5 rounded",children:C.time})]}),f.jsx("p",{className:"text-[11px] text-gray-400 line-clamp-2 leading-relaxed font-sans mt-1",children:C.desc})]},C.id)})]}),f.jsxs("div",{className:"lg:col-span-7 flex flex-col gap-4",children:[f.jsxs("div",{className:"bg-[#0e0f12] border border-white/5 rounded-lg p-4",children:[f.jsxs("div",{className:"flex items-center justify-between mb-2",children:[f.jsx("span",{className:"font-mono text-[10px] text-[#E11D48] tracking-widest uppercase font-bold",children:r==="pt-BR"?"Métricas do Capítulo Selecionado":"Selected Chapter Metrics"}),f.jsx("span",{className:"bg-[#E11D48]/15 text-[#E11D48] font-mono font-bold text-[9px] px-2 py-0.5 rounded border border-[#
22448E11D48]/20 uppercase",children:w.fps})]}),f.jsx("h3",{className:"font-sans font-extrabold text-white text-sm mb-2",children:w.title}),f.jsx("p",{className:"text-xs text-gray-400 leading-relaxed mb-4",children:w.desc}),f.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-[10px] font-mono border-t border-white/5 pt-3",children:[f.jsxs("div",{children:[f.jsx("span",{className:"text-gray-500 block uppercase",children:"Temp:"}),f.jsx("span",{className:"text-gray-200 font-bold",children:w.temp})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-gray-500 block uppercase",children:"VRAM:"}),f.jsx("span",{className:"text-gray-200 font-bold",children:w.vram})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-gray-500 block uppercase",children:"Consumo:"}),f.jsx("span",{className:"text-gray-200 font-bold",children:w.power})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-gray-500 block uppercase",children:"Análise:"}),f.jsx("span",{className:"text-[#E11D48] font-bold",children:w.verdict})]})]})]}),f.jsxs("div",{className:"flex-1 flex flex-col min-h-[220px] max-h-[300px] overflow-y-auto bg-[#07080a] border border-white/5 rounded-lg p-3 scrollbar",children:[f.jsxs("div",{className:"flex items-center gap-2 border-b border-white/5 pb-2 mb-3",children:[f.jsx(px,{size:13,className:"text-[#E11D48]"}),f.jsx("span",{className:"font-mono text-[10px] text-gray-400 uppercase tracking-wider",children:r==="pt-BR"?`RESPOSTAS DO CANAL (${o.length})`:`CHANNELS DEBATES (${o.length})`})]}),o.length===0?f.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center p-6 text-gray-500 font-mono text-[11px]",children:[f.jsx($6,{size:20,className:"text-gray-600 mb-2"}),f.jsx("p",{children:r==="pt-BR"?"Ainda não há debates salvos para este trecho.":"No debates saved for this chunk."}),f.jsx("p",{className:"text-[10px] text-gray-600 mt-1",children:r==="pt-BR"?"Participe e seja o primeiro a responder!":"Submit yours first!"})]}):f.jsx("div",{className:"flex flex-col gap-2",children:o.map(C=>{const T=E.includes(C.id);return f.jsxs("div",{className:"bg-[#0e0f12] border border-white/5 p-3 rounded hover:border-white/10 transition-all",children:[f.jsxs("div",{className:"flex justify-between items-start gap-2 mb-1.5",children:[f.jsx("span",{className:"font-bold text-xs text-gray-200 font-sans",children:C.author}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"text-[9px] text-[#475569] font-mono",children:C.createdAt.toLocaleDateString()}),f.jsxs("button",{onClick:()=>qe(C.id,C.likes),className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] transition-all cursor-pointer ${T?"bg-[#E11D48]/15 text-[#E11D48] border border-[#E11D48]/20":"text-gray-500 hover:text-gray-300"}`,children:[f.jsx(Rx,{size:10}),f.jsx("span",{children:C.likes})]})]})]}),f.jsx("p",{className:"text-xs text-gray-400 leading-relaxed font-sans whitespace-pre-wrap break-words",children:C.content})]},C.id)})})]}),f.jsxs("form",{onSubmit:Ye,className:"bg-[#0e0f12] border border-white/5 rounded-lg p-3",children:[f.jsx("div",{className:"text-[10px] text-gray-400 font-mono uppercase tracking-[0.5px] mb-2 flex items-center gap-1.5",children:f.jsx("span",{children:r==="pt-BR"?"QUER RESPONDER ESSE CARA?":"WANT TO REPLY TO THIS GUY?"})}),f.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2 mb-2",children:[f.jsx("input",{type:"text",placeholder:r==="pt-BR"?"Seu Nome (Ex: Felipe_AMD)":"Your display name",value:d,onChange:C=>c(C.target.value),maxLength:45,required:!0,className:"col-span-1 bg-[#050506] border border-white/5 rounded px-2.5 py-1.5 text-xs text-white focus:outline-none focus:border-[#E11D48] font-sans"}),f.jsx("input",{type:"text",placeholder:r==="pt-BR"?"Seu argumento técnico sobre este teste...":"Your argument or comment...",value:g,onChange:C=>h(C.target.value),maxLength:950,required:!0,className:"col-span-1 sm:col-span-2 bg-[#050506] border border-white/5 rounded px-2.5 py-1.5 text-xs text-white focus:outline-none focus:border-[#E11D48] font-sans"})]}),f.jsxs("div",{className:"flex items-center justify-between mt-3",children:[v==="done"&&f.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-green-400",children:[f.jsx(Nf,{size:12}),f.jsx("span",{children:r==="pt-BR"?"COMENTÁRIO ADICIONADO AO DB!":"SUBMITTED TO FIRESTORE!"})]}),v==="error"&&f.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-mono text-[#E11D48] max-w-[70%] overflow-hidden",children:[f.jsx(Y5,{size:12}),f.jsx("span",{className:"truncate",children:G})]}),v==="idle"&&f.jsx("div",{}),v==="submitting"&&f.jsx("div",{className:"text-[10px] font-mono text-gray-500 animate-pulse",children:r==="pt-BR"?"SINCRONIZANDO COM FIRESTORE...":"WRITING..."}),f.jsxs("button",{type:"submit",disabled:v==="submitting",className:`flex items-center justify-center gap-1.5 bg-[#E11D48] hover:bg-[#F43F5E] text-white px-3.5 py-1.5 rounded text-xs font-bold transition-all cursor-pointer ${v==="submitting"?"opacity-50 cursor-not-allowed":""}`,children:[f.jsx(Sx,{size:11}),f.jsx("span",{children:r==="pt-BR"?"Enviar":"Post"})]})]})]})]})]})]})}function jC({lang:r}){const[e,t]=Re.useState([]),[o,a]=Re.useState(null),[d,c]=Re.useState(!0),[g,h]=Re.useState(()=>ta||localStorage.getItem("rx580_local_benchmarks")!==null),[v,_]=Re.useState("Sapphire Nitro RX 580 8GB"),[E,M]=Re.useState("Intel Xeon E5-2670 v3"),[G,B]=Re.useState("windows"),[ee,ie]=Re.useState(15.5),[ve,Se]=Re.useState(72),[Me,tt]=Re.useState(""),[Ye,qe]=Re.useState(!1),[w,C]=Re.useState(null),[T,z]=Re.useState(null),O=[{id:"bench_1",userId:"user_felipe",userName:"Felipe_AMD",gpuModel:"Sapphire Nitro RX 580 8GB",cpuModel:"Ryzen 5 5600",os:"windows",llmSpeed:18.2,sdTime:65,fluxTime:25.5,createdAt:new Date("2026-06-05T12:00:00Z")},{id:"bench_2",userId:"user_renato",userName:"Renato_Nvidia",gpuModel:"PowerColor Red Devil RX 580",cpuModel:"Intel i7-4790K",os:"windows",llmSpeed:10.4,sdTime:82,fluxTime:35,createdAt:new Date("2026-06-06T15:30:00Z")},{id:"bench_3",userId:"user_wsl",userName:"WSL2_Dev",gpuModel:"XFX GTS XXX RX 580 8GB",cpuModel:"Intel i5-12400F",os:"wsl2",llmSpeed:15,sdTime:72,fluxTime:29.1,createdAt:new Date("2026-06-07T18:45:00Z")},{id:"bench_4",userId:"user_linux",userName:"LinuxPioneer",gpuModel:"ASUS Dual RX 580 8GB",cpuModel:"Ryzen 7 3700X",os:"ubuntu",llmSpeed:21.3,sdTime:55,fluxTime:20.2,createdAt:new Date("2026-06-08T09:12:00Z")}],N=()=>{try{const ae=localStorage.getItem("rx580_local_benchmarks");if(ae)return JSON.parse(ae).map(ke=>({...ke,createdAt:ke.createdAt?new Date(ke.createdAt):new Date}))}catch(ae){console.error("Failed to parse local benchmarks:",ae)}return localStorage.setItem("rx580_local_benchmarks",JSON.stringify(O)),O},D=ae=>{const ke=N(),Ve=[ae,...ke];localStorage.setItem("rx580_local_benchmarks",JSON.stringify(Ve))},_e=ae=>{const Ve=N().filter(P=>P.id!==ae);localStorage.setItem("rx580_local_benchmarks",JSON.stringify(Ve))}
22448,he={"pt-BR":{title:"SCOREBOARD DE INFRAESTRUTURA COLETIVA",subtitle:"Resultados empíricos submetidos por desenvolvedores",intro:"Compare seu ambiente legado com as compilações enviadas e adicione seus resultados para consolidar nossa base de dados oficial.",loginRequired:"Faça login para submeter seu benchmark na planilha da comunidade.",gpuLabel:"Modelo / Versão da RX 580",cpuLabel:"Trabalho Computacional CPU (Processador)",osLabel:"Ambiente / Sistema Operacional",llmLabel:"Velocidade LLM (Mistral/Llama @ Q4_K_M)",sdLabel:"Render Estável SD 1.5 (512x512, 20 steps, segs)",fluxLabel:"Render Flux.1 Schnell (Opcional, em mins)",submitBtn:"Registrar meus Benchmarks",successMsg:"Benchmark sincronizado com sucesso no banco de dados!",tableGpu:"GPU DISPOSITIVO",tableCpu:"CPU PAREADA",tableOs:"AMBIENTE OS",tableLlm:"SPEED LLM",tableSd:"RENDER SD 1.5",tableFlux:"FLUX SCHNELL",noSubmissions:"Aguardando primeiras submissões oficiais...",deleteTooltip:"Excluir sua entrada",unitTs:"t/s",unitSecs:"s",unitMins:"min"},en:{title:"COLLECTIVE BENCHMARK SCOREBOARD",subtitle:"Empirical outcomes submitted by community engineers",intro:"Compare your legacy system setups with values registered by peers and submit your metrics to augment our master record.",loginRequired:"Sign in to compile and publish your benchmark to the global database.",gpuLabel:"RX 580 Model / Sub-vendor",cpuLabel:"Paired Host CPU Model",osLabel:"Environment Operating System",llmLabel:"LLM Tokens Speed (Mistral/Llama @ Q4_K_M)",sdLabel:"Stable Diffusion 1.5 Time (512x512, 20 steps, secs)",fluxLabel:"Flux.1 Schnell Render Time (Optional, in mins)",submitBtn:"Deploy my Benchmarks",successMsg:"Benchmark synchronized successfully to the cloud!",tableGpu:"HARDWARE GPU",tableCpu:"PAIRED CPU",tableOs:"TARGET OS",tableLlm:"LLM VELOCITY",tableSd:"SD 1.5 DELAY",tableFlux:"FLUX SCHNELL",noSubmissions:"Awaiting initial verified listings...",deleteTooltip:"Delete your entry",unitTs:"t/s",unitSecs:"s",unitMins:"min"}}[r==="pt-BR"?"pt-BR":"en"];Re.useEffect(()=>{if(ta){const ke=localStorage.getItem("rx580_mock_user");a(ke?JSON.parse(ke):null),c(!1);const Ve=P=>{a(P.detail)};return window.addEventListener("rx580-auth-change",Ve),()=>window.removeEventListener("rx580-auth-change",Ve)}return Rk(qC,ke=>{a(ke),c(!1)})},[]),Re.useEffect(()=>{if(g||ta){t(N());return}const ae=th(dl,"benchmarks"),ke=s8(ae,dh("createdAt","desc"));return i8(ke,P=>{const Z=[];P.forEach(me=>{Z.push({id:me.id,...me.data()})}),t(Z)},P=>{console.warn("Firestore benchmarks error, enabling offline storage fallback mode:",P),h(!0),t(N())})},[g]);const K=async ae=>{if(ae.preventDefault(),!o&&!g)return;if(!v.trim()||!E.trim()){C(r==="pt-BR"?"Todos os campos de hardware são obrigatórios!":"All hardware fields are required!");return}if(ee<=0||ve<=0){C(r==="pt-BR"?"Valores devem ser maiores que zero.":"Metric parameters must exceed zero.");return}qe(!0),C(null),z(null);const ke="bench_"+Date.now(),Ve=Me&&!isNaN(parseFloat(Me))?parseFloat(Me):void 0,P={id:ke,userId:o?o.uid:"local_user_"+Math.random().toString(36).substring(2,6),userName:o?o.displayName||"Anonymous Specialist":r==="pt-BR"?"Especialista Local":"Guest Peer",gpuModel:v,cpuModel:E,os:G,llmSpeed:Number(ee),sdTime:Number(ve),...Ve!==void 0&&{fluxTime:Ve},createdAt:new Date};if(g){D(P),t(N()),z(he.successMsg),tt(""),qe(!1),setTimeout(()=>z(null),5e3);return}const Z=Ou(dl,"benchmarks",ke);try{await zS(Z,P),z(he.successMsg),tt(""),setTimeout(()=>z(null),5e3)}catch(me){console.warn("Firestore benchmark write failed, falling back to local mode:",me),h(!0),D(P),t(N()),z(he.successMsg),tt("")}finally{qe(!1)}},ce=async ae=>{if(!window.confirm(r==="pt-BR"?"Excluir este registro?":"Delete this record?"))return;if(g){_e(ae),t(N());return}const ke=Ou(dl,"benchmarks",ae);try{await NS(ke)}catch(Ve){console.warn("Firestore benchmark delete failed, doing local fallback delete:",Ve),h(!0),_e(ae),t(N())}};return f.jsxs("div",{className:"bg-[#111215] border border-white/5 rounded-xl p-6 shadow-2xl relative overflow-hidden mt-8",children:[f.jsx("div",{className:"absolute top-0 right-0 w-[150px] h-[3px] bg-sky-500 shadow-[0_0_12px_#3b82f6]"}),f.jsxs("div",{className:"border-b border-white/5 pb-4 mb-6",children:[f.jsxs("h2",{className:"font-sans font-extrabold text-[#fff] text-xs tracking-[1px] uppercase flex items-center gap-2",children:[f.jsx(tx,{size:13,className:g?"text-amber-500":"text-sky-500"}),he.title,g&&f.jsx("span",{className:"text-[9px] bg-amber-500/15 text-amber-500 border border-amber-500/20 px-2 py-0.5 rounded uppercase font-mono font-bold tracking-normal ml-auto shrink-0",children:r==="pt-BR"?"Modo Offline Ativo":"Offline Storage Mode"})]}),f.jsx("p",{className:"text-[10px] text-[#475569] uppercase font-mono mt-0.5",children:he.subtitle})]}),f.jsx("p",{className:"text-[11px] text-[#94a3b8] leading-relaxed mb-6 font-sans",children:he.intro}),T&&f.jsxs("div",{className:"bg-emerald-500/10 border border-emerald-500/30 text-emerald-300 text-[11px] p-3.5 rounded-md mb-5 flex items-start gap-2.5 animate-pulse",children:[f.jsx(Nf,{size:14,className:"text-emerald-400 shrink-0 mt-0.5"}),f.jsx("p",{children:T})]}),w&&f.jsxs("div",{className:"bg-red-500/10 border border-red-500/30 text-rose-300 text-[11px] p-3.5 rounded-md mb-5 flex items-start gap-2.5",children:[f.jsx(K6,{size:14,className:"text-red-400 shrink-0 mt-0.5"}),f.jsx("p",{children:w})]}),g||!d&&o?f.jsxs("form",{onSubmit:K,className:"mb-10 p-5 bg-black/40 rounded-lg border border-white/5 font-mono",children:[f.jsxs("div",{className:"text-[10px] text-sky-400 font-bold mb-4 uppercase tracking-wider flex items-center gap-1.5 border-b border-white/[0.04] pb-2",children:[f.jsx(yx,{size:12}),r==="pt-BR"?"REPORTE DE LABORATÓRIO":"SUBMIT REPORT"]}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[f.jsxs("div",{children:[f.jsx("label",{className:"block text-[9.5px] text-[#475569] font-bold uppercase mb-1.5",children:he.gpuLabel}
22448),f.jsx("input",{type:"text",value:v,onChange:ae=>_(ae.target.value),required:!0,className:"w-full bg-[#141519] border border-white/10 rounded-md py-1.5 px-3 text-xs text-white focus:outline-none focus:border-sky-500/50"})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-[9.5px] text-[#475569] font-bold uppercase mb-1.5",children:he.cpuLabel}),f.jsx("input",{type:"text",value:E,onChange:ae=>M(ae.target.value),required:!0,className:"w-full bg-[#141519] border border-white/10 rounded-md py-1.5 px-3 text-xs text-white focus:outline-none focus:border-sky-500/50"})]})]}),f.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4 mb-5",children:[f.jsxs("div",{children:[f.jsx("label",{className:"block text-[9.5px] text-[#475569] font-bold uppercase mb-1.5",children:he.osLabel}),f.jsxs("select",{value:G,onChange:ae=>B(ae.target.value),className:"w-full bg-[#141519] border border-white/10 rounded-md py-1.5 px-3 text-xs text-white focus:outline-none focus:border-sky-500/50",children:[f.jsx("option",{value:"windows",children:"Windows Native"}),f.jsx("option",{value:"wsl2",children:"WSL2 Hub"}),f.jsx("option",{value:"ubuntu",children:"Ubuntu OS Native"})]})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-[9.5px] text-[#475569] font-bold uppercase mb-1.5",children:he.llmLabel}),f.jsx("input",{type:"number",step:"0.1",min:"0.1",max:"500",value:ee,onChange:ae=>ie(parseFloat(ae.target.value)),required:!0,className:"w-full bg-[#141519] border border-white/10 rounded-md py-1.5 px-3 text-xs text-white focus:outline-none focus:border-sky-500/50"})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-[9.5px] text-[#475569] font-bold uppercase mb-1.5",children:he.sdLabel}),f.jsx("input",{type:"number",step:"0.5",min:"1",max:"10000",value:ve,onChange:ae=>Se(parseFloat(ae.target.value)),required:!0,className:"w-full bg-[#141519] border border-white/10 rounded-md py-1.5 px-3 text-xs text-white focus:outline-none focus:border-sky-500/50"})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-[9.5px] text-[#475569] font-bold uppercase mb-1.5",children:he.fluxLabel}),f.jsx("input",{type:"number",step:"0.1",min:"0",max:"1000",value:Me,placeholder:"N/A",onChange:ae=>tt(ae.target.value),className:"w-full bg-[#141519] border border-white/10 rounded-md py-1.5 px-3 text-xs text-white focus:outline-none focus:border-sky-500/50"})]})]}),f.jsx("div",{className:"flex justify-end",children:f.jsxs("button",{type:"submit",disabled:Ye,className:"px-4 py-2 bg-sky-600 hover:bg-sky-500 disabled:bg-white/[0.02] disabled:text-[#475569] text-white text-[11px] font-bold rounded-md flex items-center gap-2 cursor-pointer transition border-0 select-none shadow-md shadow-sky-950/20",children:[f.jsx(Nf,{size:12}),Ye?"Sincronizando...":he.submitBtn]})})]}):f.jsxs("div",{className:"p-4 bg-white/[0.01] border border-dashed border-white/5 text-center text-xs text-[#475569] mb-8 font-sans",children:["🔒 ",he.loginRequired]}),f.jsx("div",{className:"w-full overflow-x-auto border border-white/5 rounded-lg bg-[#0E0F12]/80",children:f.jsxs("table",{className:"w-full text-left border-collapse text-xs",children:[f.jsx("thead",{children:f.jsxs("tr",{className:"border-b border-white/10 text-[#475569] text-[9.5px] font-mono tracking-wider font-extrabold bg-white/[0.01]",children:[f.jsx("th",{className:"p-4",children:he.tableGpu}),f.jsx("th",{className:"p-4",children:he.tableCpu}),f.jsx("th",{className:"p-4",children:he.tableOs}),f.jsx("th",{className:"p-4 text-center",children:he.tableLlm}),f.jsx("th",{className:"p-4 text-center",children:he.tableSd}),f.jsx("th",{className:"p-4 text-center",children:he.tableFlux}),f.jsx("th",{className:"p-4"})]})}),f.jsx("tbody",{className:"divide-y divide-white/[0.03]",children:e.length===0?f.jsx("tr",{children:f.jsx("td",{colSpan:7,className:"p-8 text-center text-xs text-[#475569] italic",children:he.noSubmissions})}):e.map(ae=>f.jsxs("tr",{className:"hover:bg-white/[0.02] transition font-mono",children:[f.jsx("td",{className:"p-4 text-white font-bold max-w-[200px] truncate",title:ae.gpuModel,children:ae.gpuModel}),f.jsx("td",{className:"p-4 text-slate-300 max-w-[180px] truncate",title:ae.cpuModel,children:ae.cpuModel}),f.jsx("td",{className:"p-4 uppercase text-[10px]",children:f.jsx("span",{className:`px-2 py-0.5 rounded font-extrabold ${ae.os==="windows"?"bg-blue-500/10 text-blue-300 border border-blue-500/20":ae.os==="ubuntu"?"bg-amber-500/10 text-amber-400 border border-amber-500/25":"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20"}`,children:ae.os})}),f.jsxs("td",{className:"p-4 text-center font-bold text-white text-xs",children:[ae.llmSpeed," ",f.jsx("span",{className:"text-[#E11D48] text-[9px] font-semibold",children:he.unitTs})]}),f.jsxs("td",{className:"p-4 text-center font-bold text-white text-xs",children:[ae.sdTime," ",f.jsx("span",{className:"text-[#3b82f6] text-[9px] font-semibold",children:he.unitSecs})]}),f.jsx("td",{className:"p-4 text-center font-bold text-white text-xs",children:ae.fluxTime?f.jsxs(f.Fragment,{children:[ae.fluxTime," ",f.jsx("span",{className:"text-yellow-500 text-[9px] font-semibold",children:he.unitMins})]}):f.jsx("span",{className:"text-[#475569]",children:"N/A"})}),f.jsx("td",{className:"p-4 text-right",children:(g||o&&o.uid===ae.userId)&&f.jsx("button",{onClick:()=>ce(ae.id),className:"text-[#475569] hover:text-red-400 transition p-1 cursor-pointer bg-none border-none",title:he.deleteTooltip,children:f.jsx(Mx,{size:12})})})]},ae.id))})]})})]})}const XC=[{id:"contexto",title:{"pt-BR":"Contexto Histórico: Por que a RX 580?",en:"Historical Context: Why the RX 580?",es:"Contexto Histórico: ¿Por qué la RX 580?",fr:"Contexte Historique: Pourquoi la RX 580?","zh-CN":"历史背景:为什么选择 RX 580?",de:"Historischer Kontext: Warum die RX 580?"},desc:{"pt-BR":"Entenda por que essa placa lendária de 2017 ainda é altamente relevante e como a comunidade uniu forças.",en:"Understand why this legendary 2017 card is still highly relevant and how the community joined forces.",es:"Entienda por qué esta legendaria tarjeta de 2017 sigue siendo muy relevante y cómo 
22448se unió la comunidad.",fr:"Comprenez pourquoi cette carte légendaire de 2017 est encore très pertinente et comment la communauté s'est unie.","zh-CN":"了解为什么这张 2017 年的传奇显卡仍然具有高度相关性,以及社区是如何联合起来的。",de:"Verstehen Sie, warum diese legendäre Karte aus dem Jahr 2017 immer noch von hoher Relevanz ist und wie die Community ihre Kräfte gebündelt hat."},os:["windows","linux"],goal:["text","image","audio"],terminal:"Leitura",time:"2 min"},{id:"hardware",title:{"pt-BR":"O Hardware de Laboratório",en:"The Laboratory Hardware",es:"El Hardware del Laboratorio",fr:"Le Matériel du Laboratoire","zh-CN":"实验室硬件配置",de:"Die Labor-Hardware"},desc:{"pt-BR":"As especificações do Xeon e da RX 580 que servem como base sólida para este experimento.",en:"The specs of the Xeon and RX 580 serving as a solid base for this experiment.",es:"Las especificaciones del Xeon y la RX 580 que sirven como base sólida para este experimento.",fr:"Les spécifications du Xeon et de la RX 580 servant de base solide pour cette expérience.","zh-CN":"作为该实验坚实基础的 Xeon 和 RX 580 规格。",de:"Die Spezifikationen von Xeon und RX 580, die als solide Grundlage für dieses Experiment dienen."},os:["windows","linux"],goal:["text","image","audio"],terminal:"Leitura",time:"2 min"},{id:"solucao",title:{"pt-BR":"A Solução de Arquitetura Dual",en:"The Dual Architecture Solution",es:"La Solución de Arquitectura Dual",fr:"La Solution d'Architecture Double","zh-CN":"双架构解决方案",de:"Die Dual-Architektur-Lösung"},desc:{"pt-BR":"Como dividimos o processamento entre Vulkan na GPU e instruções Xeon na CPU para evitar gargalos e tela azul.",en:"How we split processing between GPU Vulkan and Xeon CPU instructions to avoid bottlenecks and blue screens.",es:"Cómo dividimos el procesamiento entre GPU Vulkan y las instrucciones Xeon en la CPU para evitar cuellos de botella y pantalla azul.",fr:"Comment nous divisons le traitement entre GPU Vulkan et les instructions Xeon sur le CPU pour éviter les goulots d'étranglement et l'écran bleu.","zh-CN":"我们如何在 GPU Vulkan 和 CPU Xeon 指令之间分配处理,以避免瓶颈和蓝屏。",de:"Wie wir die Verarbeitung zwischen Vulkan auf der GPU und Xeon-Befehlen auf der CPU aufteilen, um Engpässe und Bluescreens zu vermeiden."},os:["windows","linux"],goal:["text","image","audio"],terminal:"Leitura",time:"2 min"},{id:"prereqs",title:{"pt-BR":"Separando os Ingredientes (Pré-requisitos)",en:"Preparing the Kitchen (Prerequisites)",es:"Preparando la Cocina (Requisitos previos)",fr:"Préparation de la Cuisine (Prérequis)","zh-CN":"准备食材(先决条件)",de:"Vorbereitung der Küche (Voraussetzungen)"},desc:{"pt-BR":"Antes de cozinhar, precisamos separar os ingredientes. Instale estas ferramentas exatamente nesta ordem.",en:"Before cooking, we need to gather the ingredients. Install these tools exactly in this order.",es:"Antes de cocinar, necesitamos juntar los ingredientes. Instale estas herramientas exactamente en este orden.",fr:"Avant de cuisiner, nous devons rassembler les ingrédients. Installez ces outils exactement dans cet ordre.","zh-CN":"在开始之前,我们需要收集食材。请完全按照这个顺序安装这些工具。",de:"Vor dem Kochen müssen wir die Zutaten vorbereiten. Installieren Sie diese Tools genau in dieser Reihenfolge."},os:["windows"],goal:["text","image","audio"],terminal:"PowerShell / Navegador",time:"20 min"},{id:"docker_openwebui",title:{"pt-BR":"Instalando a Interface de Chat (Docker + OpenWebUI)",en:"Installing the Chat Interface (Docker + OpenWebUI)",es:"Instalando la Interfaz de Chat (Docker + OpenWebUI)",fr:"Installation de l'Interface de Chat (Docker + OpenWebUI)","zh-CN":"安装聊天界面 (Docker + OpenWebUI)",de:"Installation der Chat-Schnittstelle (Docker + OpenWebUI)"},desc:{"pt-BR":"Vamos subir a interface bonita (idêntica ao ChatGPT) usando Docker com um único comando rápido.",en:"Let's spin up the beautiful interface (identical to ChatGPT) using Docker with a single quick command.",es:"Vamos a levantar la bonita interfaz (idéntica a ChatGPT) usando Docker con un solo comando rápido.",fr:"Lançons la belle interface (identique à ChatGPT) en utilisant Docker avec une seule commande rapide.","zh-CN":"让我们使用 Docker 用一条快速命令启动漂亮的界面(与 ChatGPT 完全相同)。",de:"Lassen Sie uns die schöne Benutzeroberfläche (identisch mit ChatGPT) mit Docker und einem einzigen schnellen Befehl starten."},os:["windows","linux"],goal:["text","image"],terminal:"PowerShell Comum",time:"5 min",customHtml:{"pt-BR":`
22449        <div class="bg-amber-500/10 border-l-4 border-amber-500 p-4 rounded mb-6 text-amber-200 text-sm">
22450          ⚠ Abra o <strong>PowerShell Comum</strong> (não precisa ser como administrador).
22451        </div>
22452        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">Passo 1: Rodar o Container</h4>
22453        <p class="text-slate-300 text-sm mb-4">Cole este comando no seu terminal. Ele baixará e iniciará a interface local na porta 3000 do seu PC.</p>
22454        <div class="relative bg-black p-4 rounded border border-white/5 mb-6">
22455          <pre class="text-[#d4d4d4] font-mono text-xs overflow-x-auto"><code>docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main</code></pre>
22456        </div>
22457        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">Passo 2: Acessar a Interface</h4>
22458        <p class="text-slate-300 text-sm mb-4">Abra o seu navegador e acesse:</p>
22459        <a href="http://localhost:3000" target="_blank" class="inline-flex items-center gap-2 px-4 py-2.5 bg-[#E11D48] text-white font-bold text-xs rounded hover:bg-rose-700 transition-all uppercase tracking-wider mb-6">
22460          Acessar OpenWebUI (localhost:3000) <ExternalLink size={12} />
22461        </a>
22462        <div class="bg-emerald-500/10 border border-emerald-500/30 p-4 rounded text-emerald-300 text-xs">
22463          ✅ <strong>Dica de Ouro:</strong> No primeiro acesso, ele pedirá para criar uma conta de administrador. Pode colocar qualquer email e senha inventados;
22463 todo o login permanece local no seu computador.
22464        </div>
22465      `,en:`
22466        <div class="bg-amber-500/10 border-l-4 border-amber-500 p-4 rounded mb-6 text-amber-200 text-sm">
22467          ⚠ Open <strong>Common PowerShell</strong> (does not need to be Administrator).
22468        </div>
22469        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">Step 1: Run the Container</h4>
22470        <p class="text-slate-300 text-sm mb-4">Paste this command into your terminal. It will download and start the local interface on port 3000 of your PC.</p>
22471        <div class="relative bg-black p-4 rounded border border-white/5 mb-6">
22472          <pre class="text-[#d4d4d4] font-mono text-xs overflow-x-auto"><code>docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main</code></pre>
22473        </div>
22474        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">Step 2: Access the Interface</h4>
22475        <p class="text-slate-300 text-sm mb-4">Open your browser and navigate to:</p>
22476        <a href="http://localhost:3000" target="_blank" class="inline-flex items-center gap-2 px-4 py-2.5 bg-[#E11D48] text-white font-bold text-xs rounded hover:bg-rose-700 transition-all uppercase tracking-wider mb-6">
22477          Open OpenWebUI (localhost:3000) <ExternalLink size={12} />
22478        </a>
22479        <div class="bg-emerald-500/10 border border-emerald-500/30 p-4 rounded text-emerald-300 text-xs">
22480          ✅ <strong>Golden Rule:</strong> On the first run, it will ask you to create an admin account. You can insert any dummy email and password; all credentials stay 100% local on your PC.
22481        </div>
22482      `}},{id:"llama",title:{"pt-BR":"Compilando o Motor de Texto (Llama.cpp)",en:"Compiling the Text Engine (Llama.cpp)",es:"Compilando el Motor de Texto (Llama.cpp)",fr:"Compilation du Moteur de Texte (Llama.cpp)","zh-CN":"编译文本引擎 (Llama.cpp)",de:"Kompilierung der Text-Engine (Llama.cpp)"},desc:{"pt-BR":"Vamos compilar o motor C++ de aceleração de linguagem local para rodar em Vulkan com sua RX 580.",en:"Let's compile the local language acceleration C++ engine to run on Vulkan with your RX 580.",es:"Vamos a compilar el motor C++ de aceleración de lenguaje local para ejecutar en Vulkan con su RX 580.",fr:"Compilons le moteur C++ d'accélération de langage local pour tourner sur Vulkan avec votre RX 580.","zh-CN":"我们将编译本地语言加速的 C++ 引擎,以便在您的 RX 580 上通过 Vulkan 运行。",de:"Lassen Sie uns die C++ Engine für die lokale Sprachbeschleunigung kompilieren, um sie auf Vulkan mit Ihrer RX 580 auszuführen."},os:["windows"],goal:["text"],terminal:"Developer PowerShell",time:"10 min"},{id:"download_modelos",title:{"pt-BR":"Baixando os Modelos de IA (GGUF)",en:"Downloading AI Models (GGUF)",es:"Descargando Modelos de IA (GGUF)",fr:"Téléchargement des Modèles d'IA (GGUF)","zh-CN":"下载 AI 模型 (GGUF)",de:"AI-Modelle herunterladen (GGUF)"},desc:{"pt-BR":"Comandos diretos e simples para baixar os cérebros de IA de última geração direto para sua pasta local.",en:"Simple and direct commands to download state-of-the-art AI brains straight to your local folder.",es:"Comandos directos y sencillos para descargar los cerebros de IA de última generación directo a su carpeta local.",de:"Einfache und direkte Befehle, um hochmoderne KI-Gehirne direkt in Ihren lokalen Ordner herunterzuladen.",fr:"Commandes simples et directes pour télécharger les cerveaux d'IA de dernière génération directement dans votre dossier local.","zh-CN":"简单直接的命令,可将最先进的 AI 大脑直接下载到本地文件夹。"},os:["windows","linux"],goal:["text","image"],terminal:"PowerShell Comum",time:"10 min",customHtml:{"pt-BR":`
22483        <div class="bg-amber-500/10 border-l-4 border-amber-500 p-4 rounded mb-6 text-amber-200 text-sm">
22484          ⚠ Antes de começar, crie uma pasta chamada <code>models</code> no seu HD rápido ou SSD (ex: <code>E:\\models</code>).
22485        </div>
22486        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">1. Modelo de Texto de Alta Performance (Mistral 7B)</h4>
22487        <p class="text-slate-300 text-sm mb-4">Mistral é rápido, extremamente inteligente e cabe perfeito nos 8GB de VRAM da RX 580. Rode no seu PowerShell:</p>
22488        <div class="relative bg-black p-4 rounded border border-white/5 mb-6">
22489          <pre class="text-[#d4d4d4] font-mono text-xs overflow-x-auto"><code>cd E:\\models
22490Invoke-WebRequest -Uri "https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf" -OutFile "mistral-7b-instruct-v0.2.Q4_K_M.gguf"</code></pre>
22491        </div>
22492        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">2. Modelo de Imagem Ultra-Otimizado (DreamShaper 8)</h4>
22493        <p class="text-slate-300 text-sm mb-4">Já empacotado e compactado em GGUF para dispensar qualquer conversão no stable-diffusion.cpp:</p>
22494        <div class="relative bg-black p-4 rounded border border-white/5 mb-6">
22495          <pre class="text-[#d4d4d4] font-mono text-xs overflow-x-auto"><code>Invoke-WebRequest -Uri "https://huggingface.co/leejet/stable-diffusion.cpp/resolve/main/examples/dreamshaper-8bit-gguf.zip" -OutFile "dreamshaper8.zip"
22496Expand-Archive dreamshaper8.zip</code></pre>
22497        </div>
22498        <div class="bg-emerald-500/10 border border-emerald-500/30 p-4 rounded text-emerald-300 text-xs">
22499          ✅ <strong>Excelente:</strong> Agora seus modelos estão carregados e organizados.
22500        </div>
22501      `,en:`
22502        <div class="bg-amber-500/10 border-l-4 border-amber-500 p-4 rounded mb-6 text-amber-200 text-sm">
22503          ⚠ Before starting, create a folder named <code>models</code> on your fast drive or SSD (e.g. <code>E:\\models</code>).
22504        </div>
22505        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">1. High-Performance Text Model (Mistral 7B)</h4>
22506        <p class="text-slate-300 text-sm mb-4">Mistral is fast, smart, and fits perfectly in the RX 580's 8GB VRAM. Run this in PowerShell:</p>
22507        <div class="relative bg-black p-4 rounded border border-white/5 mb-6">
22508          <pre class="text-[#d4d4d4] font-mono text-xs overflow-x-auto"><code>cd E:\\models
22509Invoke-WebRequest -Uri "https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf" -OutFile "mistral-7b-instruct-v0.2.Q4_K_M.gguf"</code></pre>
22510        </div>
22511        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">2. Ultra-Optimized Image Model (DreamShaper 8)</h4>
22512        <p class="text-slate-300 text-sm mb-4">Already compressed and packaged in GGUF to bypass any manual conversion steps in stable-diffusion.cpp:</p>
22513        <div class="relative bg-black p-4 rounded border border-white/5 mb-6">
22514          <pre class="text-[#d4d4d4] font-mono text-xs overflow-x-auto"><code>Invoke-WebRequest -Uri "https://huggingface.co/leejet/stable-diffusion.cpp/resolve/main/examples/dreamshaper-8bit-gguf.zip" -OutFile "dreamshaper8.zip"
22515Expand-Archive dreamshaper8.zip</code></pre>
22516        </div>
22517        <div class="bg-emerald-500/10 border border-emerald-500/30 p-4 rounded text-emerald-300 text-xs">
22518          ✅ <strong>Great:</strong> Your models are now downloaded and ready.
22519        </div>
22520      `}},{id:"llama_server",title:{"pt-BR":"Iniciando o Servidor de Texto e Conectando",en:"Starting and Connecting the Text Server",es:"Iniciando y Conectando el Servidor de Texto",de:"Starten und Verbinden des Text-Servers",fr:"Démarrage et Connexion du Serveur de Texte","zh-CN":"启动并连接文本服务器"},desc:{"pt-BR":"Como levantar o servidor de inferência local na GPU e plugar ele no painel do OpenWebUI.",de:"Wie Sie den lokalen Inferenzserver auf der GPU starten und ihn mit dem OpenWebUI-Panel verbinden.",en:"How to launch the local inference server on the GPU and plug it into the OpenWebUI panel.",es:"Cómo lanzar el servidor de inferencia local en la GPU y conectarlo al panel de OpenWebUI.",fr:"Comment lancer le serveur d'inférence locale sur le GPU et le connecter au panneau OpenWebUI.","zh-CN":"如何在 GPU 上启动本地推理服务器并将其插入 OpenWebUI 面板。"},os:["windows"],goal:["text"],terminal:"PowerShell Comum + Navegador",time:"5 min",customHtml:{"pt-BR":`
22521        <div class="bg-amber-500/10 border-l-4 border-amber-500 p-4 rounded mb-6 text-amber-200 text-sm">
22522          ⚠ Abra o <strong>PowerShell Comum</strong>. Mantenha esta janela aberta; ela representa o motor da IA rodando!
22523        </div>
22524        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">Passo 1: Ligar o Llama Server</h4>
22525        <p class="text-slate-300 text-sm mb-4">Rode o comando especificando a flag de aceleração de GPU Vulkan:</p>
22526        <div class="relative bg-black p-4 rounded border border-white/5 mb-6">
22527          <pre class="text-[#d4d4d4] font-mono text-xs overflow-x-auto"><code>C:\\llama.cpp\\build\\bin\\Release\\llama-server.exe ^
22528  -m "E:\\models\\mistral-7b-instruct-v0.2.Q4_K_M.gguf" ^
22529  --host 0.0.0.0 ^
22530  --port 8081 ^
22531  --device Vulkan0</code></pre>
22532        </div>
22533        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">Passo 2: Conectar ao OpenWebUI</h4>
22534        <p class="text-slate-300 text-sm mb-4">Para fazer o Docker enxergar o servidor rodando no seu Windows Host:</p>
22535        <ol class="list-decimal pl-6 text-slate-300 text-xs space-y-2 mb-6">
22536          <li>Acesse <a href="http://localhost:3000" target="_blank" class="text-[#E11D48] underline">http://localhost:3000</a>.</li>
22537          <li>Vá em <strong>Painel de Administração</strong> &gt; <strong>Conexões</strong>.</li>
22538          <li>Em OpenAI API, clique no botão <strong>"+"</strong>.</li>
22539          <li>Coloque a URL: <code>http://host.docker.internal:8081/v1</code></li>
22540          <li>API Key: <code>sk-local</code> (ou qualquer texto aleatório).</li>
22541          <li>Clique no ícone de <strong>refresh</strong>. Se aparecer uma mensagem de sucesso, está pronto!</li>
22542        </ol>
22543        <div class="bg-emerald-500/10 border border-emerald-500/30 p-4 rounded text-emerald-300 text-xs">
22544          ✅ Agora você tem uma inteligência artificial completa e ultra-rápida rodando offline!
22545        </div>
22546      `,en:`
22547        <div class="bg-amber-500/10 border-l-4 border-amber-500 p-4 rounded mb-6 text-amber-200 text-sm">
22548          ⚠ Open <strong>Common PowerShell</strong>. Keep this window open; it represents the running AI engine!
22549        </div>
22550        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">Step 1: Start Llama Server</h4>
22551        <p class="text-slate-300 text-sm mb-4">Run the command, forcing Vulkan GPU acceleration:</p>
22552        <div class="relative bg-black p-4 rounded border border-white/5 mb-6">
22553          <pre class="text-[#d4d4d4] font-mono text-xs overflow-x-auto"><code>C:\\llama.cpp\\build\\bin\\Release\\llama-server.exe ^
22554  -m "E:\\models\\mistral-7b-instruct-v0.2.Q4_K_M.gguf" ^
22555  --host 0.0.0.0 ^
22556  --port 8081 ^
22557  --device Vulkan0</code></pre>
22558        </div>
22559        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">Step 2: Connect to OpenWebUI</h4>
22560        <p class="text-slate-300 text-sm mb-4">To let Docker locate the backend running on your Windows Host:</p>
22561        <ol class="list-decimal pl-6 text-slate-300 text-xs space-y-2 mb-6">
22562          <li>Go to <a href="http://localhost:3000" target="_blank" class="text-[#E11D48] underline">http://localhost:3000</a>.</li>
22563          <li>Navigate to <strong>Admin Panel</strong> &gt; <strong>Connections</strong>.</li>
22564          <li>In OpenAI API, click the <strong>"+"</strong> button.</li>
22565          <li>Set the URL: <code>http://host.docker.internal:8081/v1</code></li>
22566          <li>API Key: <code>sk-local</code> (or any dummy text).</li>
22567          <li>Click the <strong>refresh</strong> icon. A green success message means you are done!</li>
22568        </ol>
22569        <div class="bg-emerald-500/10 border border-emerald-500/30 p-4 rounded text-emerald-300 text-xs">
22570          ✅ Your offline LLM chatbot is active and ready to chat!
22571        </div>
22572      `}},{id:"sdcpp",title:{"pt-BR":"Compilando o Motor de Imagem (Stable-Diffusion.cpp)",en:"
22572Compiling the Image Engine (Stable-Diffusion.cpp)",es:"Compilando el Motor de Imagen (Stable-Diffusion.cpp)",de:"Kompilierung der Bild-Engine (Stable-Diffusion.cpp)",fr:"Compilation du Moteur d'Image (Stable-Diffusion.cpp)","zh-CN":"编译图像引擎 (Stable-Diffusion.cpp)"},desc:{"pt-BR":"Agora vamos compilar o motor C++ otimizado para renderizar imagens via GPU Vulkan sem dependências NVIDIA.",en:"Now let's compile the optimized C++ engine to render images via Vulkan GPU without NVIDIA dependencies.",es:"Ahora vamos a compilar el motor C++ optimizado para renderizar imágenes vía GPU Vulkan sin dependencias de NVIDIA.",de:"Jetzt kompilieren wir die optimierte C++ Engine für das Rendern von Bildern via Vulkan GPU ohne NVIDIA-Abhängigkeiten.",fr:"Compilons maintenant le moteur C++ optimisé pour générer des images via GPU Vulkan sans dépendances NVIDIA.","zh-CN":"现在我们将编译优化后的 C++ 引擎,以通过 Vulkan GPU 渲染图像,无 NVIDIA 依赖。"},os:["windows"],goal:["image"],terminal:"Developer PowerShell",time:"10 min"},{id:"modelos",title:{"pt-BR":"Conversão e Organização dos Pesos",en:"Quantization & Model Conversion",es:"Conversión y Organización de los Modelos",de:"Quantisierung & Modellkonvertierung",fr:"Quantification et Conversion des Modèles","zh-CN":"模型的转换与优化"},desc:{"pt-BR":"Como converter e comprimir modelos de imagem safetensors pesados para arquivos GGUF leves compatíveis com a engine C++.",de:"Wie man schwere Safetensors-Bildmodelle in kompakte GGUF-Dateien konvertiert, die mit der C++ Engine kompatibel sind.",en:"How to convert and compress heavy safetensors image models into compact GGUF files compatible with the C++ engine.",es:"Cómo convertir y comprimir modelos de imagen safetensors pesados en archivos GGUF compactos compatibles con el motor C++.",fr:"Comment convertir et compresser des modèles d'image safetensors lourds en fichiers GGUF compacts compatibles avec le moteur C++.","zh-CN":"如何将庞大的 safetensors 图像模型转换并压缩为与 C++ 引擎兼容的轻量级 GGUF 文件。"},os:["windows","linux"],goal:["image"],terminal:"Developer PowerShell",time:"5 min"},{id:"sdserver",title:{"pt-BR":"Inicializando o Serviço de Imagem (SD-Server)",de:"Initialisierung des Bilddienstes (SD-Server)",en:"Launching the Image Service (SD-Server)",es:"Inicializando el Servicio de Imagen (SD-Server)",fr:"Démarrage du Service d'Image (SD-Server)","zh-CN":"启动图像服务 (SD-Server)"},desc:{"pt-BR":"Ligando o servidor local que escuta na porta 7860 e desenha os prompts usando a placa AMD.",de:"Starten des lokalen Servers, der auf Port 7860 lauscht und Prompts mithilfe der AMD-Karte zeichnet.",en:"Running the local server listening on port 7860 to generate prompts using the AMD card.",es:"Iniciando el servidor local que escucha en el puerto 7860 y dibuja los prompts usando la tarjeta AMD.",fr:"Lancement du serveur local écoutant sur le port 7860 pour dessiner les invites avec la carte AMD.","zh-CN":"启动本地服务器,监听端口 7860,使用 AMD 显卡绘制提示词。"},os:["windows"],goal:["image"],terminal:"PowerShell Comum",time:"1 min"},{id:"flux_server",title:{"pt-BR":"O Chefão Final: Executando o modelo FLUX.1 (Híbrido)",de:"Der Endgegner: FLUX.1 ausführen (Hybrid)",en:"The Final Boss: Running FLUX.1 (Hybrid CPU/GPU)",es:"El Jefe Final: Ejecutando el modelo FLUX.1 (Híbrido)",fr:"Le Boss Final: Exécution du modèle FLUX.1 (Hybride)","zh-CN":"最终 Boss:运行 FLUX.1 模型(CPU/GPU 混合模式)"},desc:{"pt-BR":"O modelo FLUX de 12 bilhões de parâmetros exige arquitetura segmentada para rodar em GPUs de 8GB sem estourar limites.",de:"Das FLUX-Modell mit 12 Milliarden Parametern erfordert eine segmentierte Speicherarchitektur, um auf 8-GB-GPUs ohne Abstürze zu laufen.",en:"The 12B-parameter FLUX model requires segmented memory to execute on 8GB GPUs without crashes.",es:"El modelo FLUX de 12B parámetros requiere arquitectura segmentada para ejecutarse en GPUs de 8GB sin fallos.",fr:"Le modèle FLUX de 12B paramètres nécessite une architecture segmentée pour tourner sur des GPU de 8 Go sans planter.","zh-CN":"具有 120 亿参数的 FLUX 模型需要分段内存架构,才能在 8GB 显存显卡上运行而不发生崩溃。"},os:["windows"],goal:["image"],terminal:"PowerShell Comum",time:"2 min"},{id:"comfyui-wsl",title:{"pt-BR":"O Plano B: ComfyUI no Linux (WSL2)",de:"Plan B: ComfyUI auf Linux (WSL2)",en:"Plan B: ComfyUI on Linux (WSL2)",es:"Plan B: ComfyUI en Linux (WSL2)",fr:"Plan B: ComfyUI sur Linux (WSL2)","zh-CN":"计划 B:在 Linux (WSL2) 上运行 ComfyUI"},desc:{"pt-BR":"Quando a placa de vídeo de 8GB bate no teto físico de VRAM, convocamos a CPU Xeon e a RAM ECC de 32GB no Linux WSL2.",de:"Wenn die 8-GB-Grafikkarte an ihr physisches VRAM-Limit stößt, rufen wir die Xeon-CPU und 32 GB ECC-RAM unter Linux WSL2 auf.",en:"When the 8GB GPU hits its physical VRAM ceiling, we draft the Xeon CPU and 32GB ECC RAM inside Linux WSL2.",es:"Cuando la GPU de 8GB toca su límite físico de VRAM, reclutamos la CPU Xeon y 32GB de RAM ECC dentro de Linux WSL2.",fr:"Lorsque le GPU de 8 Go atteint son plafond physique de VRAM, nous recrutons le CPU Xeon et 32 Go de RAM ECC sous Linux WSL2.","zh-CN":"当 8GB 显卡触及显存的物理上限时,我们在 Linux WSL2 中调动 Xeon CPU 和 32GB ECC 内存。"},os:["windows"],goal:["image"],terminal:"Ubuntu (WSL2)",time:"15 min"},{id:"comfyui-modelos",title:{"pt-BR":"Organização com Atalhos Mágicos (Zero-Copy Link)",de:"Modelle mit symbolischen Links vereinheitlichen (Zero-Copy Link)",en:"Unifying Models with Symbolic Links (Zero-Copy Link)",es:"Unificando Modelos con Enlaces Simbólicos (Zero-Copy)",fr:"Unification des Modèles par Liens Symboliques (Zero-Copy)","zh-CN":"使用符号链接统一模型(零复制链接)"},desc:{"pt-BR":"Como compartilhar checkpoints pesados de 16GB entre o Windows e o Linux virtualizado sem duplicar arquivos no SSD.",de:"Wie man schwere 16-GB-Checkpoints zwischen Windows und virtualisiertem Linux teilt, ohne Dateien auf Ihrer SSD zu duplizieren.",en:"How to share heavy 16GB checkpoints between Windows and virtualized Linux without duplicating files on your SSD.",es:"Cómo compartir checkpoints pesados de 16GB entre Windows y el Linux virtualizado sin duplicar archivos en el SSD.",fr:"Comment partager de lourds points de contrôle de 16 Go entre Windows et Linux virtualisé sans dupliquer les fichiers sur le SSD.","zh-CN":"如何在 Windows 和虚拟化 Linux 之间共享 16GB 的巨大模型权重,而无需在 SSD 上复制文件。"},os:["windows"],goal:["image"],terminal:"Ubuntu (WSL2)",time:"2 min"},{id:"audio_whisper",title:{"pt-BR":"Transcrições Ultra-Rápidas (Whisper.cpp)",de:"Blitzschnelle Audiotranskription (Whisper.cpp)",en:"Ultra-Fast Audio Transcription (Whisper.cpp)",es:"Transcripción de Audio Ultra Rápida (Whisper.cpp)",fr:"Transcription Audio Ultra-Rapide (Whisper.cpp)","zh-CN":"超快速音频转录 (Whisper.cpp)"},desc:{"pt-BR":"Extraia textos completos de vídeos e áudios locais em segundos usando a aceleração Vulkan da RX 580.",de:"Extrahieren Sie mit der RX 580 Vulkan-Besc
22572hleunigung in Sekundenschnelle vollständige Transkripte aus lokalen Videos und Audiodateien.",en:"Extract full transcripts from local videos and audio files in seconds using RX 580 Vulkan acceleration.",es:"Extraiga textos completos de videos y audios locales en segundos usando la aceleración Vulkan de la RX 580.",fr:"Extrayez des transcriptions complètes de vidéos et d'audios locaux en quelques secondes grâce à l'accélération Vulkan du RX 580.","zh-CN":"使用 RX 580 的 Vulkan 加速,在数秒内从本地视频和音频文件中提取完整的文本转录。"},os:["windows"],goal:["audio"],terminal:"Developer PowerShell + FFmpeg",time:"15 min"},{id:"audio_rvc",title:{"pt-BR":"Clonagem de Vozes por IA (Applio RVC)",de:"KI-Stimmenklonen (Applio RVC)",en:"AI Voice Cloning (Applio RVC)",es:"Clonación de Voces por IA (Applio RVC)",fr:"Clonage de Voix par IA (Applio RVC)","zh-CN":"AI 声音克隆 (Applio RVC)"},desc:{"pt-BR":"Aprenda a desarmar as armadilhas comuns para rodar e treinar clones de voz com total estabilidade na CPU Xeon.",de:"Erfahren Sie, wie Sie häufige Fallen deaktivieren, um Stimmenklone mit absoluter Stabilität auf der Xeon-CPU auszuführen und zu trainieren.",en:"Learn to disable common traps to run and train voice clones with total stability on the Xeon CPU.",es:"Aprenda a desactivar las trampas comunes para ejecutar y entrenar clones de voz con total estabilidad en la CPU Xeon.",fr:"Apprenez à désamorcer les pièges courants pour exécuter et entraîner des clones de voix avec une stabilité totale sur le CPU Xeon.","zh-CN":"学习如何规避常见陷阱,在 Xeon CPU 上极其稳定地运行和训练声音克隆模型。"},os:["windows"],goal:["audio"],terminal:"PowerShell Comum",time:"30 min"},{id:"scripts",title:{"pt-BR":"A Automação Mágica (Script Batch)",de:"Die magische Automatisierung (Batch-Skript)",en:"The Magic Automation (Batch Script)",es:"La Automatización Mágica (Script Batch)",fr:"L'Automatisation Magique (Script Batch)","zh-CN":"魔法自动化(批处理脚本)"},desc:{"pt-BR":"Chega de digitar comandos! Crie um lançador automatizado para limpar a memória RAM e iniciar a IA com dois cliques.",de:"Schluss mit dem manuellen Tippen von Befehlen! Erstellen Sie einen automatisierten Launcher, um den RAM zu leeren und die KI mit zwei Klicks zu starten.",en:"No more typing manual commands! Create an automated launcher to flush memory and start the AI with two clicks.",es:"¡Basta de escribir comandos! Cree un lanzador automatizado para limpiar la memoria RAM e iniciar la IA con dos clics.",fr:"Plus besoin de taper des commandes manuelles! Créez un lanceur automatisé pour vider la RAM et démarrer l'IA en deux clics.","zh-CN":"无需再手动输入命令!创建一个自动启动器,只需双击即可清理内存并启动 AI。"},os:["windows"],goal:["text","image"],terminal:"Bloco de Notas",time:"5 min",customHtml:{"pt-BR":`
22573        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">Passo 1: Criando o seu Arquivo de Inicialização</h4>
22574        <p class="text-slate-300 text-sm mb-4">Abra o Bloco de Notas, cole o código abaixo e salve como <code>iniciar_ia_server.bat</code> na sua Área de Trabalho (tipo: <i>Todos os arquivos</i>).</p>
22575        <div class="relative bg-black p-4 rounded border border-white/5 mb-6">
22576          <pre class="text-[#d4d4d4] font-mono text-xs overflow-x-auto"><code>@echo off
22577title Servidor de IA Local - Producao
22578cls
22579
22580:: 1. Mata processos fantasma presos na memória que causariam erros de conflito
22581taskkill /f /im sd-server.exe 2>nul
22582timeout /t 2 /nobreak >nul
22583
22584:: 2. Força a alteração de drive do terminal antes de mudar de pasta
22585E:
22586cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
22587
22588:: 3. Inicia o servidor local apontando para o modelo compacto
22589sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\models\\dreamshaper8.gguf"
22590pause</code></pre>
22591        </div>
22592        <div class="bg-emerald-500/10 border border-emerald-500/30 p-4 rounded text-emerald-300 text-xs">
22593          ✅ <strong>Por que isso é brilhante?</strong>
22593 O comando <code>taskkill</code> limpa automaticamente travas fantasma de execuções anteriores na placa, garantindo estabilidade imediata.
22594        </div>
22595      `,en:`
22596        <h4 class="text-white font-bold mb-2 text-sm uppercase tracking-wider">Step 1: Creating your Batch File Launcher</h4>
22597        <p class="text-slate-300 text-sm mb-4">Open Notepad, paste the code below, and save as <code>start_ai_server.bat</code> on your Desktop (save as type: <i>All files</i>).</p>
22598        <div class="relative bg-black p-4 rounded border border-white/5 mb-6">
22599          <pre class="text-[#d4d4d4] font-mono text-xs overflow-x-auto"><code>@echo off
22600title Local AI Server - Production
22601cls
22602
22603:: 1. Kills ghost processes stuck in memory that would trigger conflicts
22604taskkill /f /im sd-server.exe 2>nul
22605timeout /t 2 /nobreak >nul
22606
22607:: 2. Force CMD disk partition switch before moving into the directory
22608E:
22609cd "E:\\stable-diffusion.cpp\\build\\bin\\Release"
22610
22611:: 3. Fire up the local server with the quantized model
22612sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 -m "E:\\models\\dreamshaper8.gguf"
22613pause</code></pre>
22614        </div>
22615        <div class="bg-emerald-500/10 border border-emerald-500/30 p-4 rounded text-emerald-300 text-xs">
22616          ✅ <strong>Why is this brilliant?</strong> The <code>taskkill</code> command automatically flushes stalled threads from previous runs off the GPU, securing zero startup glitches.
22617        </div>
22618      `}},{id:"sd_openwebui_integration",title:{"pt-BR":"A Ponte Mágica (Conectando a Interface)",de:"Die magische Brücke (Schnittstellen verbinden)",en:"The Magic Bridge (Connecting Interfaces)",es:"El Puente Mágico (Conectando la Interfaz)",fr:"Le Pont Magique (Connexion des Interfaces)","zh-CN":"魔法桥接(接口互连)"},desc:{"pt-BR":"Como atravessar o Firewall do Windows e liberar o Docker para renderizar as imagens desenhadas na GPU local.",de:"Wie Sie die Windows-Firewall umgehen und Docker so konfigurieren, dass auf Ihrer lokalen GPU berechnete Bilder gerendert werden.",en:"How to cross the Windows Firewall and configure Docker to draw images computed on your local GPU.",es:"Cómo cruzar el Firewall de Windows y configurar Docker para dibujar imágenes computadas en su GPU local.",fr:"Comment franchir le pare-feu Windows et configurer Docker pour dessiner des images calculées sur votre GPU local.","zh-CN":"如何穿过 Windows 防火墙并配置 Docker,以渲染在本地 GPU 上计算的图像。"},os:["windows"],goal:["text","image"],terminal:"Navegador + PowerShell",time:"10 min"},{id:"troubleshooting",title:{"pt-BR":"Resolução de Problemas Rápidas",de:"Schnelle Fehlerbehebung",en:"Quick Troubleshooting",es:"Resolución Rápida de Problemas",fr:"Résolution Rapide des Problèmes","zh-CN":"快速故障排除"},desc:{"pt-BR":"Análise diagnóstica e ações imediatas se a IA travar, renderizar infinitamente ou se deparar com estouros de memória.",de:"Diagnostische Analyse und sofortige Maßnahmen, wenn die KI einfriert, unendlich lädt oder an Speichergrenzen stößt.",en:"Diagnostic analysis and immediate actions if the AI freezes, loads infinitely, or hits memory limits.",es:"Análisis diagnóstico y acciones inmediatas si la IA se congela, carga infinitamente o experimenta desbordamientos de memoria.",fr:"Analyse de diagnostic et actions immédiates si l'IA se fige, charge indéfiniment ou subit des débordements de mémoire.","zh-CN":"如果 AI 冻结、无限加载或超出内存限制时的诊断分析和即时操作。"},os:["windows","linux"],goal:["text","image","audio"],terminal:"Referência",time:"Sob Demanda"}];function HC({lang:r,L:e,onBackToDocs:t}){const[o,a]=Re.useState("windows"),[d,c]=Re.useState("text"),[g,h]=Re.useState(0),[v,_]=Re.useState(!1);Re.useEffect(()=>{const B=()=>{_(window.innerWidth<768)};return B(),window.addEventListener("resize",B),()=>window.removeEventListener("resize",B)},[]);const E=XC.filter(B=>B.os.includes(o)&&B.goal.includes(d));if(Re.useEffect(()=>{g>=E.length&&h(Math.max(0,E.length-1))},[o,d,E]),v)return f.jsxs("div",{className:"bg-[#111215]/80 border border-white/5 rounded-xl p-8 text-center max-w-md mx-auto my-10 shadow-2xl relative overflow-hidden backdrop-blur-sm",children:[f.jsx("div",{className:"absolute inset-0 bg-grid opacity-10 pointer-events-none"}),f.jsx("div",{className:"w-16 h-16 bg-[#E11D48]/10 border border-[#
22618E11D48]/30 rounded-full flex items-center justify-center mx-auto mb-6 text-[#E11D48] animate-pulse",children:f.jsx(dx,{size:30})}),f.jsx("h2",{className:"font-sans font-extrabold text-[#fff] text-xl uppercase tracking-tight mb-3",children:r==="pt-BR"?"📱 Acesso Restrito":"📱 Mobile Blocked"}),f.jsx("p",{className:"text-slate-400 text-sm leading-relaxed mb-6",children:r==="pt-BR"?"Esta 'Receita de Bolo' envolve compilação de códigos abertos, depuração em terminais (PowerShell) e WSL2 Linux. Por isso, só pode ser executada em Computadores (Desktop / Notebook).":"This step-by-step interactive assistant requires source compilation, developer terminal commands (PowerShell) and WSL2 Linux virtualization. Please visit this page on a desktop PC."}),f.jsx("button",{onClick:t,className:"px-5 py-2 bg-white/5 border border-white/10 rounded text-slate-300 font-sans font-extrabold text-xs uppercase hover:bg-white/10 transition-all cursor-pointer",children:r==="pt-BR"?"Voltar ao Guia Principal":"Return to Master Guide"})]});const M=E[g]||E[0];if(!M)return null;let G="";if(M.customHtml&&M.customHtml[r])G=M.customHtml[r];else if(M.customHtml&&M.customHtml.en)G=M.customHtml.en;else{const B=e.sections[M.id];G=(B==null?void 0:B.html)||"<p class='text-slate-400 font-mono'>No translation found</p>"}return f.jsxs("div",{className:"flex flex-col gap-8 w-full animate-fadeIn",children:[f.jsxs("div",{className:"bg-[#111215]/80 border border-white/5 p-6 rounded-xl flex flex-col md:flex-row items-center justify-between gap-6 shadow-xl relative overflow-hidden backdrop-blur-sm",children:[f.jsx("div",{className:"absolute inset-0 bg-grid opacity-5 pointer-events-none"}),f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("button",{onClick:t,className:"p-3 bg-white/5 border border-white/5 hover:border-white/20 rounded-lg text-slate-300 hover:text-white transition-all cursor-pointer shadow-md",title:r==="pt-BR"?"Voltar ao Guia Técnico":"Go Back to Docs",children:f.jsx(U6,{size:16})}),f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("span",{className:"text-xs text-[#E11D48] font-bold tracking-widest uppercase font-mono",children:["[ ",r==="pt-BR"?"MODO RECEITA DE BOLO":"STEP-BY-STEP ASSISTANT"," ]"]}),f.jsx("span",{className:"w-1.5 h-1.5 bg-[#E11D48] rounded-full animate-pulse"})]}),f.jsx("h2",{className:"font-sans font-black text-white text-lg uppercase tracking-tight",children:r==="pt-BR"?"Tutorial Passo a Passo Interativo":"Interactive Guide for Beginners"})]})]}),f.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[f.jsxs("div",{className:"bg-black/40 border border-white/5 p-1 rounded-lg flex items-center gap-1",children:[f.jsx("button",{onClick:()=>{a("windows"),h(0)},className:`px-3 py-1.5 rounded text-[10px] font-sans font-extrabold uppercase tracking-wider transition-all cursor-pointer ${o==="windows"?"bg-rose-600 text-white":"text-slate-500 hover:text-slate-300"}`,children:"Windows"}),f.jsx("button",{onClick:()=>{a("linux"),h(0)},className:`px-3 py-1.5 rounded text-[10px] font-sans font-extrabold uppercase tracking-wider transition-all cursor-pointer ${o==="linux"?"bg-emerald-600 text-white":"text-slate-500 hover:text-slate-300"}`,children:"Linux"})]}),f.jsxs("div",{className:"bg-black/40 border border-white/5 p-1 rounded-lg flex items-center gap-1",children:[f.jsxs("button",{onClick:()=>{c("text"),h(0)},className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-[10px] font-sans font-extrabold uppercase tracking-wider transition-all cursor-pointer ${d==="text"?"bg-rose-600 text-white":"text-slate-500 hover:text-slate-300"}`,children:[f.jsx(Vf,{size:10}),r==="pt-BR"?"Chat Texto":"Text"]}),f.jsxs("button",{onClick:()=>{c("image"),h(0)},className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-[10px] font-sans font-extrabold uppercase tracking-wider transition-all cursor-pointer ${d==="image"?"bg-rose-600 text-white":"text-slate-500 hover:text-slate-300"}`,children:[f.jsx(ix,{size:10}),r==="pt-BR"?"Imagens":"Images"]}),f.jsxs("button",{onClick:()=>{c("audio"),h(0)},className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-[10px] font-sans font-extrabold uppercase tracking-wider transition-all cursor-pointer ${d==="audio"?"bg-rose-600 text-white":"text-slate-500 hover:text-slate-300"}`,children:[f.jsx(rx,{size:10}),r==="pt-BR"?"Áudio/Voz":"Voice Clone"]})]})]})]}),f.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-8 items-start w-full",children:[f.jsxs("div",{className:"lg:col-span-4 flex flex-col gap-2 bg-[#111215]/50 border border-white/5 p-4 rounded-xl max-h-[640px] overflow-y-auto custom-scrollbar shadow-lg",children:[f.jsxs("div",{className:"text-[10px] text-slate-500 font-extrabold tracking-widest uppercase font-mono mb-3 px-2 flex items-center justify-between",children:[f.jsx("span",{children:r==="pt-BR"?"MAPA DO LABORATÓRIO":"LAB TIMELINE MAP"}),f.jsxs("span",{children:[E.length," Steps"]})]}),f.jsx("div",{className:"flex flex-col gap-1.5",children:E.map((B,ee)=>{const ie=ee===g,ve=ee<g,Se=B.title[r]||B.title.en;return f.jsxs("button",{onClick:()=>h(ee),className:`flex items-start gap-3 p-3 rounded-lg text-left transition-all cursor-pointer ${ie?"bg-[#E11D48]/10 border border-[#
22618E11D48]/30 shadow-md shadow-[#E11D48]/5":"bg-transparent border border-transparent hover:bg-white/[0.01]"}`,children:[f.jsx("div",{className:`mt-0.5 w-5 h-5 rounded-full flex items-center justify-center font-mono text-[10px] font-black shrink-0 ${ie?"bg-[#E11D48] text-white":ve?"bg-emerald-500/10 border border-emerald-500/35 text-emerald-400":"bg-white/5 text-slate-500 border border-white/5"}`,children:ve?f.jsx(F6,{size:10}):ee+1}),f.jsxs("div",{className:"min-w-0",children:[f.jsx("p",{className:`text-xs font-sans font-extrabold leading-tight ${ie?"text-white":"text-slate-400 group-hover:text-slate-200"}`,children:Se}),f.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[f.jsx("span",{className:"text-[9px] font-mono text-slate-500 uppercase tracking-wide",children:B.terminal}),f.jsx("span",{className:"text-[8px] text-slate-600",children:"•"}),f.jsxs("span",{className:"text-[9px] font-mono text-slate-500 flex items-center gap-0.5",children:[f.jsx(Yb,{size:8})," ",B.time]})]})]})]},B.id)})})]}),f.jsx("div",{className:"lg:col-span-8 flex flex-col gap-6",children:f.jsxs("div",{className:"bg-[#111215]/85 border border-white/5 rounded-xl p-8 shadow-2xl relative overflow-hidden flex flex-col justify-between min-h-[500px]",children:[f.jsx("div",{className:"absolute inset-0 bg-grid opacity-10 pointer-events-none"}),f.jsxs("div",{children:[f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-white/5 pb-4 mb-6",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"px-2.5 py-1 bg-rose-600/10 border border-rose-600/30 text-[#fca5a5] font-mono text-[10px] font-black rounded uppercase tracking-wider",children:r==="pt-BR"?`PASSO ${g+1} DE ${E.length}`:`STEP ${g+1} OF ${E.length}`}),f.jsx("span",{className:"px-2.5 py-1 bg-black/40 border border-white/5 text-slate-400 font-mono text-[10px] font-bold rounded uppercase tracking-wider",children:M.terminal})]}),f.jsxs("div",{className:"flex items-center gap-1.5 text-slate-500 font-mono text-xs",children:[f.jsx(Yb,{size:12}),f.jsx("span",{children:M.time})]})]}),f.jsx("h3",{className:"font-sans font-black text-2xl text-white uppercase tracking-tight mb-3",children:M.title[r]||M.title.en}),f.jsx("p",{className:"text-slate-400 text-sm leading-relaxed mb-8",children:M.desc[r]||M.desc.en}),f.jsx("div",{className:"prose text-slate-300 text-sm leading-relaxed max-w-none",children:f.jsx("div",{className:"documentation-content",dangerouslySetInnerHTML:{__html:G}})})]}),f.jsxs("div",{className:"flex items-center justify-between border-t border-white/5 pt-6 mt-12 gap-4",children:[f.jsxs("button",{disabled:g===0,onClick:()=>h(g-1),className:"flex items-center gap-1.5 px-4 py-2.5 bg-white/5 border border-white/10 rounded text-slate-300 hover:text-white disabled:opacity-30 disabled:pointer-events-none hover:bg-white/10 transition-all font-sans font-extrabold text-xs uppercase cursor-pointer",children:[f.jsx(X6,{size:14}),r==="pt-BR"?"Passo Anterior":"Previous Step"]}),f.jsxs("div",{className:"hidden sm:flex items-center gap-1 text-slate-500 font-mono text-xs",children:[f.jsx("span",{children:g+1}),f.jsx("span",{children:"/"}),f.jsx("span",{children:E.length})]}),f.jsxs("button",{disabled:g===E.length-1,onClick:()=>h(g+1),className:"flex items-center gap-1.5 px-5 py-2.5 bg-[#E11D48] hover:bg-rose-700 text-white border border-[#E11D48] rounded disabled:opacity-30 disabled:pointer-events-none transition-all font-sans font-extrabold text-xs uppercase cursor-pointer",children:[r==="pt-BR"?"Próximo Passo":"Next Step",f.jsx(Q5,{size:14})]})]})]})})]})]})}function WC(){var K,ce,ae,ke,Ve,P,Z,me,be,Pe,Ue,$e,Pt,wt,Ho,Cs,Rs,Ds,$n,ir,Wo,lr,dr,Tt,zt,Do,ci;const[r,e]=Re.useState("pt-BR"),[t,o]=Re.useState("master_docs"),[a,d]=Re.useState(""),[c,g]=Re.useState("contexto"),[h,v]=Re.useState(!1),[_,E]=Re.useState(!1),[M,G]=Re.useState(null),[B,ee]=Re.useState(0),[ie,ve]=Re.useState(!1),[Se,Me]=Re.useState(!1),[tt,Ye]=Re.useState([]),qe=Re.useRef(null);Re.useEffect(()=>{try{const ne=new URLSearchParams(window.location.search),le=ne.get("lang")||ne.get("locale");let Fe="";if(le&&(le.startsWith("pt")?Fe="pt-BR":le.startsWith("en")?Fe="en":le.startsWith("es")?Fe="es":le.startsWith("fr")?Fe="fr":le.startsWith("zh")?Fe="zh-CN":Id[le]&&(Fe=le)),!Fe){const vt=localStorage.getItem("rx580doc_lang");vt&&Id[vt]&&(Fe=vt)}Fe&&Fe!==r&&e(Fe)}catch(ne){console.error("Failed to parse language from URL or Storage:",ne)}},[]),Re.useEffect(()=>{const ne=()=>{const le=window.location.hash;if(le){const Fe=le.replace("#","");let vt=Fe;document.getElementById(vt)||(vt=Fe.replace(/-/g,"_")),o(vt==="linux_nativo"?"linux_native":"master_docs"),setTimeout(()=>{const Jn=document.getElementById(vt);Jn&&(Jn.scrollIntoView({behavior:"smooth",block:"start"}),g(vt))},600)}};return ne(),window.addEventListener("hashchange",ne),()=>window.removeEventListener("hashchange",ne)},[r]);const w=Id[r]||Id["pt-BR"];Re.useEffect(()=>{try{if(w&&w.meta){document.documentElement.lang=w.meta.lang||r,document.title=w.meta.title;const ne=document.querySelector('meta[name="description"]');ne&&ne.setAttribute("content",w.meta.description);const le=document.querySelector('meta[property="og:title"]');le&&le.setAttribute("content",w.meta.title);const Fe=document.querySelector('meta[property="og:description"]');Fe&&Fe.setAttribute("content",w.meta.description);const vt=document.querySelector('meta[property="og:url"]');
22618if(vt){const gn=r==="pt-BR"?"pt":r==="zh-CN"?"zh":r,Ko=gn==="pt"?"https://setup-ia-local-rx580-vulkan.web.app/":`https://setup-ia-local-rx580-vulkan.web.app/?lang=${gn}`;vt.setAttribute("content",Ko)}const Jn=document.querySelector('link[rel="canonical"]');if(Jn){const gn=r==="pt-BR"?"pt":r==="zh-CN"?"zh":r,Ko=gn==="pt"?"https://setup-ia-local-rx580-vulkan.web.app/":`https://setup-ia-local-rx580-vulkan.web.app/?lang=${gn}`;Jn.setAttribute("href",Ko)}}}catch(ne){console.error("Failed to update dynamic SEO meta tags:",ne)}},[r,w]),Re.useEffect(()=>{const ne=()=>{const le=document.documentElement,Fe=le.scrollTop||document.body.scrollTop,vt=le.scrollHeight-le.clientHeight,Jn=vt>0?Fe/vt*100:0;ee(Jn),ve(window.scrollY>400);const gn=Object.keys(w.sections);let Ko=gn[0];for(const va of gn){const ba=document.getElementById(va);ba&&ba.getBoundingClientRect().top<=160&&(Ko=va)}g(Ko)};return window.addEventListener("scroll",ne,{passive:!0}),()=>window.removeEventListener("scroll",ne)},[w]);const C=()=>{const ne=document.documentElement.outerHTML,le=new Blob([`<!DOCTYPE html>
22619`+ne],{type:"text/html"}),Fe=URL.createObjectURL(le),vt=document.createElement("a");vt.href=Fe,vt.download=`RX580_IA_LOCAL_MASTER_UNIFICADA_${r}_2026.html`,document.body.appendChild(vt),vt.click(),document.body.removeChild(vt),URL.revokeObjectURL(Fe),z(r==="pt-BR"?"GUIA SALVO OFFLINE! (.HTML)":"GUIDE SAVED OFFLINE! (.HTML)")},T=()=>{const ne=window.location.origin+window.location.pathname;navigator.clipboard.writeText(ne).then(()=>{z(w.share.toast_copied)}).catch(()=>{const le=document.createElement("textarea");le.value=ne,document.body.appendChild(le),le.select();try{document.execCommand("copy"),z(w.share.toast_copied)}catch(Fe){console.error("Link copy failed",Fe)}document.body.removeChild(le)})},z=ne=>{G(ne),setTimeout(()=>G(null),3e3)},O=()=>{if(Se){clearInterval(qe.current),Me(!1),Ye(Fe=>[...Fe,">> [WSL2 CORE] SIMULAÇÃO INTERROMPIDA PELO OPERADOR..."]);return}Me(!0),Ye([">> [WSL2 CORE] INSTANCIANDO WORKSPACE DE ANIMAÇÃO NO XEON...",">> [WSL2 CORE] MAPEANDO CO-PROCESSADOR VULKAN0 (RX 580 8GB)...",">> [MEMORY] VRAM ATUAL: 1.62GB / VRAM EXCEDENTE RECHUTADA PARA RAM",">> [COMPUTE] ALOCANDO 24 THREADS DO INTEL XEON (MICROARQUITETURA HASWELL)...",">> [ANIMATEDIFF] CARREGANDO MOTION MODULE: mm_sd_v15_v2.ckpt (~1.6GB)"]);let ne=0;const le=[">> [VAE] DECODIFICANDO FRAME_0 (RESOLUÇÃO 512x512) -> PROCESSADO EM 4.12s",">> [ANIMATEDIFF] INTERPOLANDO QUADRO temporal_overlay_0_1 -> OVERLAY DE CONTROLE ATIVO",">> [VAE] DECODIFICANDO FRAME_1 (RESOLUÇÃO 512x512) -> PROCESSADO EM 4.09s",">> [ANIMATEDIFF] ATENÇÃO VETORIAL APLICADA SOBRE QUADRO temporal_overlay_1_2",">> [VAE] DECODIFICANDO FRAME_2 (RESOLUÇÃO 512x512) -> PROCESSADO EM 4.15s",">> [VAE] DECODIFICANDO FRAME_3 (RESOLUÇÃO 512x512) -> PROCESSADO EM 4.10s",">> [ANIMATEDIFF] INTERPOLANDO QUADRO temporal_overlay_2_3 -> ESTABILIZAÇÃO RETROALIMENTADA",">> [VAE] DECODIFICANDO FRAME_4 (RESOLUÇÃO 512x512) -> PROCESSADO EM 4.11s",">> [VAE] DECODIFICANDO FRAME_5 (RESOLUÇÃO 512x512) -> PROCESSADO EM 4.14s",">> [ANIMATEDIFF] ATENÇÃO VETORIAL REFINANDO TEXTURAS EM FRAME_5...",">> [VAE] DECODIFICANDO FRAME_6 (RESOLUÇÃO 512x512) -> PROCESSADO EM 4.13s",">> [VAE] DECODIFICANDO FRAME_7 (RESOLUÇÃO 512x512) -> PROCESSADO EM 4.08s",">> [ANIMATEDIFF] SÍNTESE DE VÍDEO COMPLETA: 8 FRAMES FUNDIDOS EM ARQUIVO DE SAÍDA",">> [VIDEO_COMBINE] EXPORTANDO ARQUIVO FINAL: 'E:\\output\\AIV_vulkan_render_0.mp4' (H264)",">> [WSL2 CORE] RENDER TERMINADO COM SUCESSO EM 141.2s ✅ STABLE CORES"];qe.current=setInterval(()=>{ne<le.length?(Ye(Fe=>[...Fe,le[ne]]),ne++):(clearInterval(qe.current),Me(!1))},1800)};Re.useEffect(()=>{const ne=Fe=>{N(Fe.detail)},le=()=>{O()};return window.addEventListener("switch-language",ne),window.addEventListener("simulate-animatediff-logs",le),()=>{qe.current&&clearInterval(qe.current),window.removeEventListener("switch-language",ne),window.removeEventListener("simulate-animatediff-logs",le)}},[r,Se]);const N=ne=>{e(ne),D(ne)},D=ne=>{try{localStorage.setItem("rx580doc_lang",ne)}catch(le){console.error(le)}},_e=ne=>{v(!1),o(ne==="linux_nativo"?"linux_native":"master_docs"),setTimeout(()=>{const le=document.getElementById(ne);if(le){le.scrollIntoView({behavior:"smooth",block:"start"}),g(ne);try{window.history.pushState(null,"",`#${ne}`)}catch{window.location.hash=ne}}},50)},he=Object.entries(w.sections).filter(([ne,le])=>{const Fe=a.toLowerCase();return le.title.toLowerCase().includes(Fe)||le.desc.toLowerCase().includes(Fe)||ne.toLowerCase().includes(Fe)});return f.jsxs("div",{className:"min-h-screen bg-[#0B0C0E] text-[#94a3b8] font-mono selection:bg-[#E11D48]/25 
22619selection:text-white transition-colors duration-300 relative overflow-x-hidden w-full max-w-full",children:[f.jsx("div",{id:"reading-bar",className:"fixed left-0 h-[2px] bg-[#E11D48] z-[1200] transition-all duration-100 shadow-[0_0_8px_#E11D48]",style:{width:`${B}%`,top:"56px"}}),f.jsx("div",{className:"bg-grid fixed inset-0 opacity-15 pointer-events-none z-0"}),f.jsx("div",{className:"glow-1 fixed top-[-10%] left-[-10%] w-[50vw] h-[50vw] bg-radial from-[#E11D48]/10 to-transparent pointer-events-none z-0"}),f.jsx("div",{className:"glow-2 fixed bottom-[-10%] right-[-10%] w-[40vw] h-[40vw] bg-radial from-[#3b82f6]/5 to-transparent pointer-events-none z-0"}),f.jsxs("nav",{className:"fixed top-0 left-0 w-full h-[56px] bg-[#0E0F12]/92 border-b border-white/5 flex items-center justify-between px-6 z-[1100] backdrop-blur-[24px]",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("button",{id:"mobile-toggle",onClick:()=>v(!h),className:"text-white hover:text-[#E11D48] transition-colors focus:outline-none block hide-on-desktop","aria-label":"Toggle Sidebar",children:h?f.jsx(Ox,{size:22}):f.jsx(mx,{size:22})}),f.jsxs("div",{className:"nav-brand flex items-center gap-2 max-w-[130px] xs:max-w-[200px] sm:max-w-[320px] md:max-w-none",children:[f.jsx("div",{className:"w-[8px] h-[8px] bg-[#E11D48] rounded-full shadow-[0_0_16px_rgba(225,29,72,0.8)] animate-pulse shrink-0"}),f.jsxs("div",{className:"nav-brand-group flex flex-col min-w-0",children:[f.jsx("span",{id:"nav-brand",className:"text-white font-sans font-extrabold text-[10px] sm:text-xs tracking-[1px] sm:tracking-[1.5px] uppercase truncate",children:w.nav.brand}),f.jsx("span",{id:"nav-subtitle",className:"text-[9px] sm:text-[10px] text-[#475569] tracking-[0.5px] truncate hidden md:block",children:w.nav.subtitle})]})]})]}),f.jsxs("div",{className:"nav-status-group flex items-center gap-2 sm:gap-6 shrink-0",children:[f.jsxs("div",{id:"nav-status",className:"text-[10px] text-[#22c55e] hidden lg:flex items-center gap-2 border border-[#22c55e]/30 bg-[#22c55e]/5 px-3 py-1 rounded-md font-bold tracking-[0.05em] shrink-0",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-[#22c55e] rounded-full animate-ping"}),w.nav.status]}),f.jsxs("a",{href:"https://discord.gg/FmkxZjN8f",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-indigo-300 hover:text-white hover:bg-[#5865F2] hover:border-[#5865F2] border border-[#5865F2]/20 bg-[#5865F2]/5 px-3 py-1.5 rounded-md font-bold tracking-[0.05em] flex items-center gap-1.5 transition whitespace-nowrap text-decoration-none",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-[#5865F2] rounded-full"}),"💬 Discord"]}),f.jsxs("div",{className:"lang-wrapper relative shrink-0",children:[f.jsxs("button",{onClick:()=>{const ne=document.getElementById("lang-dropdown-box");ne==null||ne.classList.toggle("hidden")},className:"lang-btn bg-white/[0.03] border border-white/5 text-white px-2.5 py-1.5 rounded-md text-[11px] font-medium cursor-pointer flex items-center gap-1.5 transition hover:bg-white/[0.07] hover:border-[#64748b]/50 whitespace-nowrap",children:[f.jsx("span",{id:"lang-current-flag",className:"text-sm",children:H5[r]||"🇧🇷"}),f.jsx("span",{id:"lang-current-label",className:"font-sans font-medium text-xs hidden sm:inline",children:W5[r]||"Português"}),f.jsx("span",{className:"text-[8px] text-[#475569]",children:"▼"})]}),f.jsx("div",{id:"lang-dropdown-box",className:"lang-dropdown hidden absolute top-[calc(100%+6px)] right-0 w-[180px] bg-[#0E0F12] border border-white/5 rounded-lg flex flex-col z-[1500] shadow-[0_20px_50px_rgba(0,0,0,0.8)]",children:Object.keys(Id).map(ne=>f.jsxs("button",{onClick:()=>{var le;N(ne),(le=document.getElementById("lang-dropdown-box"))==null||le.classList.add("hidden")},className:`lang-opt text-left bg-none border-none text-[11px] cursor-pointer flex items-center gap-3 px-3 py-2.5 w-full hover:bg-white/[0.04] transition ${r===ne?"text-[#E11D48] font-bold bg-[#E11D48]/5":"text-[#94a3b8]"}`,children:[f.jsx("span",{children:H5[ne]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[12px] font-sans",children:W5[ne]}),f.jsx("div",{className:"text-[9px] text-[#475569]",children:ne})]})]},ne))})]})]})]}),f.jsxs("div",{className:"layout-shell relative z-10 w-full",children:[h&&f.jsx("div",{className:"sidebar-overlay hide-on-desktop",onClick:()=>v(!1)}),f.jsxs("aside",{className:`sidebar-container flex flex-col ${h?"open":""}`,children:[f.jsxs("div",{className:"sid-meta flex-1 p-6 overflow-y-auto scrollbar",children:[f.jsxs("div",{className:"relative mb-5",children:[f.jsx(wx,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#475569]"}),f.jsx("input",{type:"text",value:a,onChange:ne=>d(ne.target.value),placeholder:r==="pt-BR"?"Buscar seções...":"Search sections...",className:"w-full bg-[#141519] border border-white/5 rounded-md py-1.5 pl-9 pr-4 text-xs text-white focus:outline-none focus:border-[#
22619E11D48]/50 placeholder-[#475569]"}),a&&f.jsx("button",{onClick:()=>d(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[10px] text-[#475569] hover:text-white",children:"✕"})]}),f.jsx("div",{className:"sid-dir-lbl text-[10px] text-[#475569] font-sans font-bold tracking-[2px] mb-4 uppercase",children:w.sidebar.directory}),f.jsxs("div",{className:"sid-nav flex flex-col gap-1",children:[["contexto","hardware","falhas","solucao","prereqs","jornada"].filter(ne=>he.some(([le])=>le===ne)).map(ne=>{const le=w.sections[ne];return f.jsx("button",{onClick:()=>_e(ne),className:`sid-btn text-left text-[11px] px-3 py-1 rounded transition font-mono ${c===ne?"bg-[#E11D48]/8 border-l-2 border-[#E11D48] text-white font-bold":"text-[#475569] hover:text-white hover:bg-white/[0.02]"}`,children:f.jsx("span",{className:"sid-btn-label",children:le.title})},ne)}),f.jsxs("div",{className:"sid-group-lbl text-[9px] font-bold text-[#E11D48] tracking-[1.5px] uppercase mt-4 mb-1 px-3",children:["[1] ",r==="pt-BR"?"PROTOCOLOS DE COMPILAÇÃO":"COMPILATION PROTOCOLS"]}),["llama","sdcpp","modelos"].filter(ne=>he.some(([le])=>le===ne)).map(ne=>{const le=w.sections[ne];return f.jsx("button",{onClick:()=>_e(ne),className:`sid-btn text-left text-[11px] px-3 py-1 rounded transition font-mono ${c===ne?"bg-[#E11D48]/8 border-l-2 border-[#E11D48] text-white font-bold":"text-[#475569] hover:text-white hover:bg-white/[0.02]"}`,children:f.jsx("span",{className:"sid-btn-label",children:le.title})},ne)}),f.jsxs("div",{className:"sid-group-lbl text-[9px] font-bold text-[#E11D48] tracking-[1.5px] uppercase mt-4 mb-1 px-3",children:["[2] ",r==="pt-BR"?"SEQUÊNCIAS DE DEPLOY":"DEPLOY SEQUENCES"]}),["sdserver","flux_server","sd_bat_automation","sd_openwebui_integration"].filter(ne=>he.some(([le])=>le===ne)).map(ne=>{const le=w.sections[ne];return f.jsx("button",{onClick:()=>_e(ne),className:`sid-btn text-left text-[11px] px-3 py-1 rounded transition font-mono ${c===ne?"bg-[#E11D48]/8 border-l-2 border-[#E11D48] text-white font-bold":"text-[#475569] hover:text-white hover:bg-white/[0.02]"}`,children:f.jsx("span",{className:"sid-btn-label",children:le.title})},ne)}),f.jsxs("div",{className:"sid-group-lbl text-[9px] font-bold text-[#E11D48] tracking-[1.5px] uppercase mt-4 mb-1 px-3",children:["[3] ",r==="pt-BR"?"ANÁLISES COMFYUI E AMD":"COMFYUI AND AMD ANALYSES"]}),["comfyui-modelos","comfyui-wsl","comfyui-directml","comfyui-directml-func","comfyui-flux","animatediff-video","stack"].filter(ne=>he.some(([le])=>le===ne)).map(ne=>{const le=w.sections[ne];return f.jsx("button",{onClick:()=>_e(ne),className:`sid-btn text-left text-[11px] px-3 py-1 rounded transition font-mono ${c===ne?"bg-[#E11D48]/8 border-l-2 border-[#E11D48] text-white font-bold":"text-[#475569] hover:text-white hover:bg-white/[0.02]"}`,children:f.jsx("span",{className:"sid-btn-label",children:le.title})},ne)}),f.jsxs("div",{className:"sid-group-lbl text-[9px] font-bold text-[#E11D48] tracking-[1.5px] uppercase mt-4 mb-1 px-3",children:["[4] ",r==="pt-BR"?"INTEGRAÇÃO DO ECOSSISTEMA":"ECOSYSTEM INTEGRATION"]}),["scripts","guia","benchmarks","cpu","flux-vulkan","sdxl_vulkan","troubleshooting","troubleshoot-comfyui","comfyui-portable-amd"].filter(ne=>he.some(([le])=>le===ne)).map(ne=>{const le=w.sections[ne];return f.jsx("button",{onClick:()=>_e(ne),className:`sid-btn text-left text-[11px] px-3 py-1 rounded transition font-mono ${c===ne?"bg-[#E11D48]/8 border-l-2 border-[#E11D48] text-white font-bold":"text-[#475569] hover:text-white hover:bg-white/[0.02]"}`,children:f.jsx("span",{className:"sid-btn-label",children:le.title})},ne)}),f.jsxs("div",{className:"sid-group-lbl text-[9px] font-bold text-[#E11D48] tracking-[1.5px] uppercase mt-4 mb-1 px-3",children:["[5] ",r==="pt-BR"?"DIAGNÓSTICOS E TROUBLESHOOTING":"DIAGNOSTICS AND TROUBLESHOOTING"]}),["comunidade","amihart","dadhacks","codacus","proximos","arquivos","meta","linhatempo"].filter(ne=>he.some(([le])=>le===ne)).map(ne=>{const le=w.sections[ne];return f.jsx("button",{onClick:()=>_e(ne),className:`sid-btn text-left text-[11px] px-3 py-1 rounded transition font-mono ${c===ne?"bg-[#E11D48]/8 border-l-2 border-[#
22619E11D48] text-white font-bold":"text-[#475569] hover:text-white hover:bg-white/[0.02]"}`,children:f.jsx("span",{className:"sid-btn-label",children:le.title})},ne)}),f.jsxs("div",{className:"sid-group-lbl text-[9px] font-bold text-[#E11D48] tracking-[1.5px] uppercase mt-4 mb-1 px-3",children:["[6] ",r==="pt-BR"?"ÁUDIO, WHISPER & LINUX NATIVO":"AUDIO, WHISPER & NATIVE LINUX"]}),["audio_rvc","audio_whisper","audio_srt_ptbr","limit_qwen_35b","proving_hypothesis_35b","linux_nativo"].filter(ne=>he.some(([le])=>le===ne)).map(ne=>{const le=w.sections[ne];return f.jsx("button",{onClick:()=>_e(ne),className:`sid-btn text-left text-[11px] px-3 py-1 rounded transition font-mono ${c===ne?"bg-[#E11D48]/8 border-l-2 border-[#E11D48] text-white font-bold":"text-[#475569] hover:text-white hover:bg-white/[0.02]"}`,children:f.jsx("span",{className:"sid-btn-label",children:le.title})},ne)})]})]}),f.jsxs("div",{className:"sid-syslog p-4 bg-black border-t border-white/5 flex flex-col gap-1 font-mono",children:[f.jsxs("div",{className:"sid-syslog-t text-[10px] text-[#475569] font-bold tracking-[1px] flex items-center gap-1.5 mb-1 bg-transparent",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-[#E11D48] rounded-full animate-ping"}),w.sidebar.syslog]}),f.jsx("div",{className:"text-[10px] text-[#34d399]",children:"[OK] INITIALIZED_MEM_CONTROLLER"}),f.jsx("div",{className:"text-[10px] text-[#34d399]",children:"[OK] ACCEL: VULKAN_API_READY"}),f.jsx("div",{className:"text-[10px] text-[#34d399]",children:"[OK] HEAP_VRAM_ALLOC: 8192 MB (POLARIS)"}),f.jsx("div",{className:"text-[10px] text-[#34d399]",children:"[OK] KERNEL_THREAD_THREADING: 24 (XEON)"}),f.jsx("div",{className:"text-[10.5px] text-emerald-500 font-bold mt-1",children:"[SYS] READY_FOR_LOCAL_INFERENCE_2026"})]})]}),f.jsxs("main",{className:"main-viewport flex-1 min-w-0",children:[f.jsxs("div",{className:"desktop-content",children:[f.jsx("header",{className:"hero mb-16 relative",children:f.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-8 mb-12",children:[f.jsxs("div",{className:"lg:col-span-8 flex flex-col justify-between",children:[f.jsxs("div",{children:[f.jsxs("h1",{id:"hero-title",className:"font-sans font-black text-white tracking-[-1px] leading-[1.2] relative uppercase text-[42px] sm:text-[48px] md:text-[56px] xl:text-[68px] italic mb-3",children:["AIVisions",f.jsx("span",{className:"text-[#E11D48]",children:"Lab"})]}),f.jsx("div",{id:"hero-subtitle",className:"font-sans font-bold text-[10px] tracking-[4px] uppercase text-[#E11D48] mb-6",children:"DOCUMENTAÇÃO MASTER UNIFICADA // TEMPORADA 2026"}),f.jsx("p",{id:"hero-desc-1",className:"text-sm sm:text-base leading-[1.8] text-[#94a3b8] max-w-[720px] mb-4 font-sans font-normal",children:"Projeto de engenharia reversa de obsolescência programada. Rodando LLMs de última geração (Mistral/R1) e difusores de imagem locais em GPUs legadas via APIs de baixo nível."}),f.jsx("p",{id:"hero-desc-2",className:"text-sm leading-[1.8] text-[#475569] max-w-[720px] mb-6 font-sans font-normal italic",children:"Guia de laboratório unificado integrando o Método Amihart (Linux/Debian), o Método DadHacks (Vulkan image creation) e automações nativas no Windows."}),f.jsxs("button",{onClick:()=>o("receita"),className:"group relative flex items-center justify-center gap-2.5 px-6 py-4 bg-gradient-to-r from-rose-600 to-rose-700 hover:from-rose-500 hover:to-rose-600 border border-white/10 rounded-xl text-white font-sans font-extrabold uppercase tracking-wider text-xs md:text-sm hover:scale-[1.01] transition-all duration-300 shadow-[0_0_30px_rgba(225,29,72,0.3)] cursor-pointer mt-2 mb-8 animate-pulse hover:animate-none",children:[f.jsxs("span",{children:["🚀 ",r==="pt-BR"?"Não quer ler texto técnico? Acesse a Receita de Bolo (Passo a Passo Interativo)":"Confused by deep tech text? Try our Interactive step-by-step Wizard!"]}),f.jsx(Q5,{size:16,className:"group-hover:translate-x-1 transition-transform"})]})]}),f.jsxs("div",{className:"flex flex-wrap gap-2.5 mb-2",children:[f.jsxs("span",{className:"inline-flex items-center gap-2 px-3.5 py-1.5 border border-[#
22619E11D48]/35 bg-[#E11D48]/5 text-[#fca5a5] text-[10px] font-bold font-mono rounded-full uppercase shadow-[0_0_12px_rgba(225,29,72,0.15)]",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-[#E11D48] rounded-full animate-pulse"}),"GPU: RX 580 8GB Vulkan"]}),f.jsxs("span",{className:"inline-flex items-center gap-2 px-3.5 py-1.5 border border-[#3b82f6]/35 bg-[#3b82f6]/5 text-blue-300 text-[10px] font-bold font-mono rounded-full uppercase",children:[f.jsx($b,{size:11,className:"text-blue-400"}),"Engine: llama.cpp & stable-diffusion.cpp"]}),f.jsxs("span",{className:"inline-flex items-center gap-2 px-3.5 py-1.5 border border-[#22c55e]/35 bg-[#22c55e]/5 text-emerald-300 text-[10px] font-bold font-mono rounded-full uppercase shadow-[0_0_12px_rgba(34,197,94,0.1)]",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-[#22c55e] rounded-full animate-ping"}),"Tuned: 100% Offline Ops"]})]})]}),f.jsxs("div",{className:"lg:col-span-4 bg-[#14171a]/70 border border-white/5 p-6 rounded-lg flex flex-col justify-between relative overflow-hidden backdrop-blur-sm shadow-xl min-h-[220px]",children:[f.jsx("div",{className:"absolute inset-0 bg-grid opacity-10 pointer-events-none"}),f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 pb-3 mb-4",children:[f.jsxs("span",{className:"text-[10px] text-[#475569] font-bold tracking-[2.5px] uppercase flex items-center gap-1.5",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full animate-pulse"}),"TELEMETRY VERIFIED"]}),f.jsx(Qb,{size:12,className:"text-emerald-500"})]}),f.jsx("h3",{className:"font-sans font-extrabold text-[18px] text-white tracking-tight leading-snug mb-2 uppercase",children:"Polaris GCN4 Core Revived"}),f.jsx("p",{className:"text-xs text-[#94a3b8] leading-relaxed",children:"Vulkan compute queues unlocked. Full precision FP32 fallback routing activated for Haswell Intel Xeon processors."})]}),f.jsxs("div",{className:"flex justify-between items-center text-[10px] text-[#475569] mt-4 pt-3 border-t border-white/5 font-mono",children:[f.jsx("span",{children:"SYS_KERN: WSL2_6.6_ACTIVE"}),f.jsx("span",{className:"text-emerald-500 font-bold",children:"100% RELIABLE"})]})]})]})}),f.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-1.5 p-1.5 bg-[#111215] border border-white/5 rounded-lg mb-10 w-full max-w-md",children:[f.jsxs("button",{onClick:()=>o("master_docs"),className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2.5 sm:py-2 rounded text-[10.5px] font-sans font-extrabold uppercase tracking-wider transition-all duration-200 cursor-pointer ${t==="master_docs"?"bg-[#E11D48] text-white shadow-lg shadow-[#E11D48]/20":"text-[#475569] hover:text-[#94a3b8] hover:bg-white/[0.02]"}`,children:[f.jsx(vx,{size:12}),r==="pt-BR"?"Documentação Windows":"Windows Guide"]}),f.jsxs("button",{onClick:()=>o("linux_native"),className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2.5 sm:py-2 rounded text-[10.5px] font-sans font-extrabold uppercase tracking-wider transition-all duration-200 cursor-pointer ${t==="linux_native"?"bg-emerald-600 text-white shadow-lg shadow-emerald-600/20":"text-[#475569] hover:text-[#94a3b8] hover:bg-white/[0.02]"}`,children:[f.jsx(Vf,{size:12}),"Ubuntu 26.04 Real"]}),f.jsxs("button",{onClick:()=>o("receita"),className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2.5 sm:py-2 rounded text-[10.5px] font-sans font-extrabold uppercase tracking-wider transition-all duration-200 cursor-pointer ${t==="receita"?"bg-rose-600 text-white shadow-lg shadow-rose-600/20":"text-[#475569] hover:text-[#94a3b8] hover:bg-white/[0.02]"}`,children:[f.jsx(Jb,{size:12}),r==="pt-BR"?"Receita de Bolo":"Easy Recipe"]})]}),f.jsxs("div",{className:"mb-8",children:[f.jsxs("div",{className:"mb-6 flex flex-col gap-1",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"text-base",children:"📊"}),f.jsx("h2",{className:"font-sans font-extrabold text-white text-sm uppercase tracking-[0.5px]",children:r==="pt-BR"?"TELEMETRIA DO SISTEMA":"SYSTEM TELEMETRY"})]}),f.jsx("p",{className:"text-xs text-[#475569] uppercase tracking-[0.5px]",children:r==="pt-BR"?"Indicadores de Vulkan e CPU em tempo real":"Real-time Vulkan and CPU indicator arrays"})]}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4 mb-16",children:[f.jsxs("div",{className:"bg-[#111215]/80 border border-white/5 hover:border-[#
22619E11D48]/30 p-5 rounded-lg flex flex-col justify-between min-h-[190px] transition-all duration-300 hover:-translate-y-0.5 shadow-md relative",children:[f.jsxs("div",{children:[f.jsx("div",{className:"flex justify-between items-start mb-2.5",children:f.jsxs("span",{className:"text-[10px] text-[#475569] font-bold tracking-[1.5px] uppercase flex items-center gap-1.5",children:[f.jsx(Jb,{size:11,className:"text-[#E11D48]"}),"TEXT GENERATION (LLM)"]})}),f.jsx("div",{className:"font-sans font-black text-white text-[32px] tracking-tight leading-none my-1",children:"15-16 t/s"}),f.jsx("div",{className:"text-[10px] text-[#E11D48] font-bold uppercase mt-1 mb-2.5",children:"Vulkan GPU Acceleration Active"}),f.jsx("p",{className:"text-xs text-[#94a3b8] leading-relaxed",children:"Mistral 7B / Llama 3 8B at Q4_K_M quantizations."})]}),f.jsxs("div",{className:"flex justify-between items-center text-[10px] text-[#475569] border-t border-white/5 pt-2.5 mt-4",children:[f.jsx("span",{children:"Baseline: 3-5 t/s (Xeon CPU pure)"}),f.jsx("span",{className:"text-emerald-500 font-bold",children:"3x Speedup"})]})]}),f.jsxs("div",{className:"bg-[#111215]/80 border border-white/5 hover:border-[#E11D48]/30 p-5 rounded-lg flex flex-col justify-between min-h-[190px] transition-all duration-300 hover:-translate-y-0.5 shadow-md",children:[f.jsxs("div",{children:[f.jsx("div",{className:"flex justify-between items-start mb-2.5",children:f.jsxs("span",{className:"text-[10px] text-[#475569] font-bold tracking-[1.5px] uppercase flex items-center gap-1.5",children:[f.jsx(fx,{size:11,className:"text-[#3b82f6]"}),"IMAGE GENERATION (SD 1.5)"]})}),f.jsx("div",{className:"font-sans font-black text-white text-[32px] tracking-tight leading-none my-1",children:"~72 Secs"}),f.jsx("div",{className:"text-[10px] text-[#3b82f6] font-bold uppercase mt-1 mb-2.5",children:"stable-diffusion.cpp Vulkan path"}),f.jsx("p",{className:"text-xs text-[#94a3b8] leading-relaxed",children:"512x512 resolution, 20 steps local rendering."})]}),f.jsxs("div",{className:"flex justify-between items-center text-[10px] text-[#475569] border-t border-white/5 pt-2.5 mt-4",children:[f.jsx("span",{children:"Baseline: 19+ Min (HDD mechanics)"}),f.jsx("span",{className:"text-emerald-500 font-bold",children:"15x Speedup"})]})]}),f.jsxs("div",{className:"bg-[#111215]/80 border border-white/5 hover:border-[#E11D48]/30 p-5 rounded-lg flex flex-col justify-between min-h-[190px] transition-all duration-300 hover:-translate-y-0.5 shadow-md",children:[f.jsxs("div",{children:[f.jsx("div",{className:"flex justify-between items-start mb-2.5",children:f.jsxs("span",{className:"text-[10px] text-[#475569] font-bold tracking-[1.5px] uppercase flex items-center gap-1.5",children:[f.jsx($b,{size:11,className:"text-[#eab308]"}),"FLUX.1 SCHNELL (12B SOTA)"]})}),f.jsx("div",{className:"font-sans font-black text-white text-[32px] tracking-tight leading-none my-1",children:"~14 Mins"}),f.jsx("div",{className:"text-[10px] text-[#eab308] font-bold uppercase mt-1 mb-2.5",children:"WSL2 Hybrid RAM ECC Offload"}),f.jsx("p",{className:"text-xs text-[#94a3b8] leading-relaxed",children:"1024x1024 resolution. T5XXL model mapped to host system RAM."})]}),f.jsxs("div",{className:"flex justify-between items-center text-[10px] text-[#475569] border-t border-white/5 pt-2.5 mt-4",children:[f.jsx("span",{children:"Baseline: 25+ Min (Legacy paging)"}),f.jsx("span",{className:"text-emerald-500 font-bold",children:"Stable quad channel"})]})]}),f.jsxs("div",{className:"bg-[#111215]/80 border border-[#22c55e]/25 hover:border-[#22c55e]/50 p-5 rounded-lg flex flex-col justify-between min-h-[190px] transition-all duration-300 hover:-translate-y-0.5 shadow-md shadow-emerald-900/[0.03]",children:[f.jsxs("div",{children:[f.jsx("div",{className:"flex justify-between items-start mb-2.5",children:f.jsxs("span",{className:"text-[10px] text-[#22c55e] font-bold tracking-[1.5px] uppercase flex items-center gap-1.5",children:[f.jsx(Qb,{size:11,className:"text-[#22c55e]"}),"TELEMETRY GUARDRAILS"]})}),f.jsx("div",{className:"font-sans font-black text-emerald-400 text-[32px] tracking-tight leading-none my-1",children:"8.0 GB VRAM"}),f.jsx("div",{className:"text-[10px] text-emerald-500 font-bold uppercase mt-1 mb-2.5",children:"Polaris RX 580 Physical Buffer"}),f.jsx("p",{className:"text-xs text-[#94a3b8] leading-relaxed",children:"VAE tiling & lowvram flags successfully intercept Out Of Memory limiters."})]}),f.jsxs("div",{className:"flex justify-between items-center text-[10px] text-[#475569] border-t border-[#22c55e]/10 pt-2.5 mt-4",children:[f.jsx("span",{children:"Baseline: 32GB Host RAM backup"}),f.jsx("span",{className:"text-emerald-400 font-bold",children:"0% Leak rate"})]})]})]})]}),f.jsxs("div",{className:"guerrilla-panel border border-dashed border-[#
22619E11D48] bg-[#E11D48]/3 p-6 rounded-md mb-20 relative",children:[f.jsxs("div",{className:"guerrilla-header flex flex-col gap-2 mb-5",children:[f.jsx("h4",{id:"share-guerrilla-title",className:"guerrilla-title font-sans font-extrabold text-[11px] tracking-[2px] text-[#E11D48] uppercase flex items-center gap-2",children:w.share.guerrilla_title}),f.jsx("p",{id:"share-guerrilla-desc",className:"guerrilla-desc text-xs text-[#94a3b8] leading-relaxed",children:w.share.guerrilla_desc})]}),f.jsxs("div",{className:"guerrilla-grid grid-autofit-guerrilla",children:[f.jsxs("button",{id:"btn-copy-link",onClick:T,className:"g-btn bg-[#E11D48]/5 border border-[#E11D48]/20 text-white p-3 text-xs font-semibold rounded cursor-pointer flex items-center justify-center gap-2 transition hover:bg-[#E11D48] hover:shadow-[0_0_15px_rgba(225,29,72,0.4)]",children:[f.jsx("span",{className:"text-[12px]",children:"🔗"})," ",w.share.btn_copy_link]}),f.jsxs("button",{id:"btn-offline-html",onClick:C,className:"g-btn bg-[#E11D48]/5 border border-[#E11D48]/20 text-white p-3 text-xs font-semibold rounded cursor-pointer flex items-center justify-center gap-2 transition hover:bg-[#E11D48] hover:shadow-[0_0_15px_rgba(225,29,72,0.4)]",children:[f.jsx("span",{className:"text-[12px]",children:"💾"})," ",w.share.btn_offline_html]}),f.jsxs("button",{id:"btn-pdf-print",onClick:window.print,className:"g-btn bg-[#E11D48]/5 border border-[#E11D48]/20 text-white p-3 text-xs font-semibold rounded cursor-pointer flex items-center justify-center gap-2 transition hover:bg-[#E11D48] hover:shadow-[0_0_15px_rgba(225,29,72,0.4)]",children:[f.jsx("span",{className:"text-[12px]",children:"🖨️"})," ",w.share.btn_pdf_print]}),f.jsxs("button",{id:"btn-qr-code",onClick:()=>E(!_),className:"g-btn bg-[#E11D48]/5 border border-[#E11D48]/20 text-white p-3 text-xs font-semibold rounded cursor-pointer flex items-center justify-center gap-2 transition hover:bg-[#E11D48] hover:shadow-[0_0_15px_rgba(225,29,72,0.4)]",children:[f.jsx("span",{className:"text-[12px]",children:"📱"})," ",w.share.btn_qr_code]})]}),_&&f.jsxs("div",{id:"qr-code-container",className:"qr-container mt-4 p-5 bg-[#111215] border border-white/5 rounded-md flex flex-col items-center justify-center gap-3",children:[f.jsx("img",{id:"qr-code-image",src:`https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${encodeURIComponent(window.location.origin+window.location.pathname)}`,alt:"QR Link Code",className:"bg-white p-2 rounded"}),f.jsx("p",{id:"qr-code-text",className:"qr-text text-center text-[10px] text-[#475569] max-w-[320px]",children:w.share.qr_code_text})]})]}),t==="receita"?f.jsx(HC,{lang:r,L:w,onBackToDocs:()=>o("master_docs")}):t==="master_docs"?f.jsxs("div",{id:"sections-container",className:"flex flex-col gap-16",children:[f.jsxs("section",{id:"contexto",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-contexto",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.contexto.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.contexto.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.contexto.html}})]}),f.jsxs("section",{id:"hardware",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-hardware",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.hardware.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.hardware.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.hardware.html}})]}),f.jsxs("section",{id:"falhas",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-falhas",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.falhas.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.falhas.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.falhas.html}})]}),f.jsxs("section",{id:"solucao",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-solucao",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.solucao.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.solucao.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.solucao.html}}
22619)]}),f.jsxs("section",{id:"prereqs",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-prereqs",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.prereqs.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.prereqs.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.prereqs.html}})]}),f.jsxs("section",{id:"jornada",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-jornada",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.jornada.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.jornada.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.jornada.html}})]}),f.jsxs("section",{id:"llama",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-llama",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.llama.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.llama.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.llama.html}})]}),f.jsxs("section",{id:"sdcpp",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-sdcpp",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.sdcpp.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.sdcpp.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.sdcpp.html}})]}),f.jsxs("section",{id:"modelos",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-modelos",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.modelos.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.modelos.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.modelos.html}})]}),f.jsxs("section",{id:"sdserver",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-sdserver",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.sdserver.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.sdserver.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.sdserver.html}})]}),f.jsxs("section",{id:"flux_server",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-flux_server",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.flux_server.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.flux_server.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.flux_server.html}})]}),f.jsxs("section",{id:"sd_bat_automation",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-sd_bat_automation",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.sd_bat_automation.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.sd_bat_automation.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.sd_bat_automation.html}})]}),f.jsxs("section",{id:"sd_openwebui_integration",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-sd_openwebui_integration",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.sd_openwebui_integration.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.sd_openwebui_integration.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.sd_openwebui_integration.html}})]}),f.jsxs("section",{id:"comfyui-modelos",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-comfyui-modelos",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections["comfyui-modelos"].title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections["comfyui-modelos"].desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections["comfyui-modelos"].html}})]}),f.jsxs("section",{id:"comfyui-wsl",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-comfyui-wsl",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections["comfyui-wsl"].title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections["comfyui-wsl"].desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections["comfyui-wsl"].html}})]}),f.jsxs("section",{id:"comfyui-directml",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-comfyui-directml",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections["comfyui-directml"].title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections["comfyui-directml"].desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections["comfyui-directml"].html}})]}),f.jsxs("section",{id:"comfyui-directml-func",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-comfyui-directml-func",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections["comfyui-directml-func"].title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections["comfyui-directml-func"].desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections["comfyui-directml-func"].html}})]}),f.jsxs("section",{id:"comfyui-flux",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-comfyui-flux",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections["comfyui-flux"].title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections["comfyui-flux"].desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections["comfyui-flux"].html}})]}),f.jsxs("section",{id:"animatediff-video",className:"scroll-mt-24 scrollbar",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-animatediff-video",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections["animatediff-video"].title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections["animatediff-video"].desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections["animatediff-video"].html}}),f.jsxs("div",{className:"mt-8 border border-white/5 bg-black rounded-lg overflow-hidden font-mono shadow-2xl relative",children:[f.jsxs("div",{className:"bg-[#141519]/80 px-4 py-2 border-b border-white/5 flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx("span",{className:"w-2.5 h-2.5 bg-red-500 rounded-full"}),f.jsx("span",{className:"w-2.5 h-2.5 bg-yellow-500 rounded-full"}),f.jsx("span",{className:"w-2.5 h-2.5 bg-green-500 rounded-full"}),f.jsx("span",{className:"text-[10px] text-[#475569] ml-2 tracking-widest uppercase",children:"ANIMATEDIFF_WORKBOX_SIMULATOR"})]}),f.jsx("div",{className:"text-[9px] text-[#475569]",children:"DEBIAN / HOSTS_BRIDGE"})]}),f.jsx("div",{className:"p-4 flex flex-col gap-1 text-[11px] min-h-[160px] max-h-[300px] overflow-y-auto font-mono text-[#e2e8f0] bg-black/90 scrollbar",children:tt.length===0?f.jsx("div",{className:"text-[#334155] italic",children:r==="pt-BR"?">> Pronto para inicialização. Clique em 'Simular'...":">> Ready for initialization. Click 'Simulate'..."}):tt.map((ne,le)=>f.jsx("div",{className:ne.includes("✅")||ne.includes("sucesso")||ne.includes("success")?"text-green-400":ne.includes("⚠️")||ne.includes("VRAM")?"text-yellow-400":"text-[#94a3b8]",children:ne},le))}),f.jsxs("div",{className:"bg-[#0c0d10] px-4 py-2 flex items-center justify-between border-t border-white/5",children:[f.jsxs("button",{onClick:O,className:"bg-transparent border border-[#
22619E11D48]/30 hover:border-[#E11D48] text-[#fca5a5] hover:text-white px-4 py-1.5 rounded text-xs font-bold transition flex items-center gap-1.5 cursor-pointer",children:[f.jsx(Vf,{size:12}),Se?r==="pt-BR"?"Interromper":"Stop":r==="pt-BR"?"Simular Processo":"Simulate Process"]}),f.jsx("button",{onClick:()=>Ye([]),className:"text-[10px] text-[#475569] hover:text-[#94a3b8]",children:r==="pt-BR"?"Limpar Terminal":"Clear Output"})]})]})]}),f.jsxs("section",{id:"stack",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-stack",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.stack.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.stack.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.stack.html}})]}),f.jsxs("section",{id:"scripts",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-scripts",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.scripts.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.scripts.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.scripts.html}})]}),f.jsxs("section",{id:"guia",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-guia",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.guia.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.guia.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.guia.html}}
22619)]}),f.jsxs("section",{id:"benchmarks",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-benchmarks",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.benchmarks.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.benchmarks.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.benchmarks.html}}),f.jsx(jC,{lang:r})]}),f.jsxs("section",{id:"cpu",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-cpu",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.cpu.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.cpu.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.cpu.html}})]}),f.jsxs("section",{id:"flux-vulkan",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-flux-vulkan",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections["flux-vulkan"].title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections["flux-vulkan"].desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections["flux-vulkan"].html}})]}),f.jsxs("section",{id:"sdxl_vulkan",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-sdxl_vulkan",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:(K=w.sections.sdxl_vulkan)==null?void 0:K.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:(ce=w.sections.sdxl_vulkan)==null?void 0:ce.desc}),((ae=w.sections.sdxl_vulkan)==null?void 0:ae.html)&&f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.sdxl_vulkan.html}})]}),f.jsxs("section",{id:"troubleshooting",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-troubleshooting",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.troubleshooting.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.troubleshooting.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.troubleshooting.html}})]}),f.jsxs("section",{id:"troubleshoot-comfyui",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-troubleshoot-comfyui",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections["troubleshoot-comfyui"].title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections["troubleshoot-comfyui"].desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections["troubleshoot-comfyui"].html}})]}),f.jsxs("section",{id:"comfyui-portable-amd",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-comfyui-portable-amd",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections["comfyui-portable-amd"].title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections["comfyui-portable-amd"].desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections["comfyui-portable-amd"].html}})]}),f.jsxs("section",{id:"comunidade",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-comunidade",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.comunidade.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.comunidade.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.comunidade.html}}),f.jsx(FC,{lang:r})]}),f.jsxs("section",{id:"amihart",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-amihart",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.amihart.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.amihart.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.amihart.html}})]}),f.jsxs("section",{id:"dadhacks",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-dadhacks",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.dadhacks.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.dadhacks.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.dadhacks.html}})]}),f.jsxs("section",{id:"codacus",className:"scroll-mt-24 mt-16",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-codacus",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:(ke=w.sections.codacus)==null?void 0:ke.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:(Ve=w.sections.codacus)==null?void 0:Ve.desc}),((P=w.sections.codacus)==null?void 0:P.html)&&f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.codacus.html}}
22619)]}),f.jsxs("section",{id:"proximos",className:"scroll-mt-24 mt-16",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-proximos",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.proximos.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.proximos.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.proximos.html}})]}),f.jsxs("section",{id:"arquivos",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-arquivos",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.arquivos.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.arquivos.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.arquivos.html}})]}),f.jsxs("section",{id:"meta",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-meta",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.meta.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.meta.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.meta.html}})]}),f.jsxs("section",{id:"linhatempo",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-linhatempo",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:w.sections.linhatempo.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:w.sections.linhatempo.desc}),f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.linhatempo.html}})]}),f.jsxs("section",{id:"audio_rvc",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-audio_rvc",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:(Z=w.sections.audio_rvc)==null?void 0:Z.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:(me=w.sections.audio_rvc)==null?void 0:me.desc}),((be=w.sections.audio_rvc)==null?void 0:be.html)&&f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.audio_rvc.html}})]}),f.jsxs("section",{id:"audio_whisper",className:"scroll-mt-24 mt-16",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-audio_whisper",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:(Pe=w.sections.audio_whisper)==null?void 0:Pe.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:(Ue=w.sections.audio_whisper)==null?void 0:Ue.desc}),(($e=w.sections.audio_whisper)==null?void 0:$e.html)&&f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.audio_whisper.html}})]}),f.jsxs("section",{id:"audio_srt_ptbr",className:"scroll-mt-24 mt-16 pb-20",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-audio_srt_ptbr",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:(Pt=w.sections.audio_srt_ptbr)==null?void 0:Pt.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:(wt=w.sections.audio_srt_ptbr)==null?void 0:wt.desc}),((Ho=w.sections.audio_srt_ptbr)==null?void 0:Ho.html)&&f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.audio_srt_ptbr.html}})]}),f.jsxs("section",{id:"limit_qwen_35b",className:"scroll-mt-24 mt-16 pb-20",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-limit_qwen_35b",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:(Cs=w.sections.limit_qwen_35b)==null?void 0:Cs.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:(Rs=w.sections.limit_qwen_35b)==null?void 0:Rs.desc}),((Ds=w.sections.limit_qwen_35b)==null?void 0:Ds.html)&&f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.limit_qwen_35b.html}})]}),f.jsxs("section",{id:"proving_hypothesis_35b",className:"scroll-mt-24 mt-16 pb-20",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#E11D48]"}),f.jsx("h2",{id:"sh-proving_hypothesis_35b",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:($n=w.sections.proving_hypothesis_35b)==null?void 0:$n.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:(ir=w.sections.proving_hypothesis_35b)==null?void 0:ir.desc}),((Wo=w.sections.proving_hypothesis_35b)==null?void 0:Wo.html)&&f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.proving_hypothesis_35b.html}})]}),f.jsxs("section",{id:"linux_nativo",className:"scroll-mt-24 mt-16 pb-20",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#22c55e]"}),f.jsx("h2",{id:"sh-linux_nativo",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:(lr=w.sections.linux_nativo)==null?void 0:lr.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:(dr=w.sections.linux_nativo)==null?void 0:dr.desc}),f.jsxs("div",{className:"flex flex-col gap-8 bg-[#0D0106]/98 border border-emerald-500/10 rounded-lg p-6 font-mono relative overflow-hidden backdrop-blur-md shadow-2xl",children:[f.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 pb-3 mb-6",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"w-3 h-3 rounded-full bg-red-500"}),f.jsx("span",{className:"w-3 h-3 rounded-full bg-yellow-500"}),f.jsx("span",{className:"w-3 h-3 rounded-full bg-green-500"}),f.jsx("span",{className:"text-[10px] text-[#475569] font-bold tracking-wider up
22619percase ml-1",children:"bash • terminal_session_26.04.sh"})]}),f.jsx("span",{className:"text-[9px] text-emerald-400 font-bold bg-emerald-500/5 border border-emerald-500/25 px-2.5 py-1 rounded",children:"MESA RADV ACTIVE"})]}),f.jsxs("div",{className:"bg-[#1C1D1E]/40 border border-white/5 p-4 rounded-md mb-4 text-xs text-slate-300 leading-relaxed",children:[f.jsx("p",{className:"text-[#22c55e] font-bold mb-2",children:"ubuntu 26.04 lts (resolute raccoon) kernel 7.0-generic"}),f.jsx("p",{children:"System uptime: 12 days, 4.38 hours"}),f.jsx("p",{children:"Active VRAM Buffer: 8192 MB (driver_id_mesa_radv)"}),f.jsx("p",{className:"text-emerald-500 mt-2",children:"To exit terminal session and return to master guide, use tab bar above."})]}),f.jsx("div",{className:"prose text-slate-300",children:((Tt=w.sections.linux_nativo)==null?void 0:Tt.html)&&f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.linux_nativo.html}})})]})]})]}):f.jsxs("div",{id:"linux_nativo",className:"scroll-mt-24",children:[f.jsxs("div",{className:"sh flex items-center gap-3 mb-6",children:[f.jsx("div",{className:"sh-line h-4 w-1 bg-[#22c55e]"}),f.jsx("h2",{id:"sh-linux_nativo_standalone",className:"sh-t font-sans font-extrabold text-[#fff] text-sm uppercase tracking-[0.5px]",children:(zt=w.sections.linux_nativo)==null?void 0:zt.title})]}),f.jsx("p",{className:"text-xs text-[#475569] mb-4 uppercase tracking-[0.5px]",children:(Do=w.sections.linux_nativo)==null?void 0:Do.desc}),f.jsxs("div",{className:"flex flex-col gap-8 bg-[#0D0106]/98 border border-emerald-500/10 rounded-lg p-6 font-mono relative overflow-hidden backdrop-blur-md shadow-2xl",children:[f.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 pb-3 mb-6",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"w-3 h-3 rounded-full bg-red-500"}),f.jsx("span",{className:"w-3 h-3 rounded-full bg-yellow-500"}),f.jsx("span",{className:"w-3 h-3 rounded-full bg-green-500"}),f.jsx("span",{className:"text-[10px] text-[#475569] font-bold tracking-wider uppercase ml-1",children:"bash • terminal_session_26.04.sh"})]}),f.jsx("span",{className:"text-[9px] text-emerald-400 font-bold bg-emerald-500/5 border border-emerald-500/25 px-2.5 py-1 rounded",children:"MESA RADV ACTIVE"})]}),f.jsxs("div",{className:"bg-[#1C1D1E]/40 border border-white/5 p-4 rounded-md mb-4 text-xs text-slate-300 leading-relaxed",children:[f.jsx("p",{className:"text-[#22c55e] font-bold mb-2",children:"ubuntu 26.04 lts (resolute raccoon) kernel 7.0-generic"}),f.jsx("p",{children:"System uptime: 12 days, 4.38 hours"}),f.jsx("p",{children:"Active VRAM Buffer: 8192 MB (driver_id_mesa_radv)"}),f.jsx("p",{className:"text-emerald-500 mt-2",children:"To exit terminal session and return to master guide, use tab bar above."})]}),f.jsx("div",{className:"prose text-slate-300",children:((ci=w.sections.linux_nativo)==null?void 0:ci.html)&&f.jsx("div",{dangerouslySetInnerHTML:{__html:w.sections.linux_nativo.html}})})]})]}),f.jsxs("div",{className:"devto-publications-section mt-16 pt-10 border-t border-white/5",children:[f.jsxs("p",{id:"ft-publications-title",className:"text-[10px] text-[#475569] tracking-[2px] mb-6 uppercase font-bold text-left flex items-center gap-2",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-[#E11D48] rounded-full animate-pulse"}),"📰 ARTIGOS DESTAQUE EN/RU // DEV.TO PUBLICATIONS"]}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-12",children:[f.jsxs("div",{className:"flex flex-col bg-[#0D0106]/85 border border-[#E11D48]/15 rounded-md overflow-hidden hover:border-[#E11D48]/45 transition-all duration-300 group shadow-md",children:[f.jsxs("div",{className:"relative h-32 overflow-hidden bg-black",children:[f.jsx("img",{src:"/og-image.png",alt:"Zapusk Flux Schnell",referrerPolicy:"no-referrer",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500 opacity-80 group-hover:opacity-100"}),f.jsx("div",{className:"absolute top-2 left-2 bg-[#E11D48] text-white text-[9px] font-sans font-extrabold px-2 py-0.5 rounded tracking-wider up
22619percase",children:"RU / РУССКИЙ"})]}),f.jsxs("div",{className:"p-4 flex-1 flex flex-col justify-between",children:[f.jsxs("div",{children:[f.jsx("h5",{className:"font-sans font-bold text-white text-[13px] tracking-wide leading-snug mb-2 group-hover:text-[#E11D48] transition-colors duration-200",children:"Запуск Flux Schnell 12B на AMD RX 580 8GB через Vulkan"}),f.jsx("p",{className:"text-[11px] text-[#94a3b8] font-mono leading-relaxed mb-4",children:"Guia arquitetural completo detalhando engenharia de baixo nível, Vulkan e ggml para acelerar Flux no Linux/Windows."})]}),f.jsx("a",{href:"https://dev.to/aivisionslab/zapusk-flux-schnell-12b-llm-na-ustarievshiei-amd-rx-580-8-gb-chieriez-vulkan-polnoie-arkhitiekturnoie-273d",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-mono text-center block w-full bg-white/[0.03] hover:bg-[#E11D48] border border-white/10 hover:border-[#E11D48] text-white hover:text-white py-2 rounded transition duration-200 text-decoration-none",children:"Ler Artigo Completo →"})]})]}),f.jsxs("div",{className:"flex flex-col bg-[#0D0106]/85 border border-[#E11D48]/15 rounded-md overflow-hidden hover:border-[#E11D48]/45 transition-all duration-300 group shadow-md",children:[f.jsxs("div",{className:"relative h-32 overflow-hidden bg-black",children:[f.jsx("img",{src:"/og-image.png",alt:"Running Local AI Guide",referrerPolicy:"no-referrer",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500 opacity-80 group-hover:opacity-100"}),f.jsx("div",{className:"absolute top-2 left-2 bg-[#E11D48] text-white text-[9px] font-sans font-extrabold px-2 py-0.5 rounded tracking-wider uppercase",children:"EN / ENGLISH"})]}),f.jsxs("div",{className:"p-4 flex-1 flex flex-col justify-between",children:[f.jsxs("div",{children:[f.jsx("h5",{className:"font-sans font-bold text-white text-[13px] tracking-wide leading-snug mb-2 group-hover:text-[#E11D48] transition-colors duration-200",children:"Running local AI on an AMD RX 580 in 2026: The Vulkan Guide"}),f.jsx("p",{className:"text-[11px] text-[#94a3b8] font-mono leading-relaxed mb-4",children:"Empirical steps and custom compiles to unlock native localized inference utilizing open standards."})]}),f.jsx("a",{href:"https://dev.to/aivisionslab/running-local-ai-on-an-amd-rx-580-in-2026-the-complete-vulkan-guide-52a5",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-mono text-center block w-full bg-white/[0.03] hover:bg-[#E11D48] border border-white/10 hover:border-[#E11D48] text-white hover:text-white py-2 rounded transition duration-200 text-decoration-none",children:"Read Full Article →"})]})]}),f.jsxs("div",{className:"flex flex-col bg-[#0D0106]/85 border border-[#E11D48]/15 rounded-md overflow-hidden hover:border-[#E11D48]/45 transition-all duration-300 group shadow-md",children:[f.jsxs("div",{className:"relative h-32 overflow-hidden bg-black",children:[f.jsx("img",{src:"/og-image.png",alt:"50 dollar GPU AI",referrerPolicy:"no-referrer",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500 opacity-80 group-hover:opacity-100"}),f.jsx("div",{className:"absolute top-2 left-2 bg-[#E11D48] text-white text-[9px] font-sans font-extrabold px-2 py-0.5 rounded tracking-wider uppercase",children:"EN / ENGLISH"})]}),f.jsxs("div",{className:"p-4 flex-1 flex flex-col justify-between",children:[f.jsxs("div",{children:[f.jsx("h5",{className:"font-sans font-bold text-white text-[13px] tracking-wide leading-snug mb-2 group-hover:text-[#E11D48] transition-colors duration-200",children:"I ran Flux Schnell & LLMs on a $50 GPU (No CUDA, No ROCm)"}),f.jsx("p",{className:"text-[11px] text-[#94a3b8] font-mono leading-relaxed mb-4",children:"Proving legacy Polaris hardware holds extreme utility when software pipelines are optimized."})]}),f.jsx("a",{href:"https://dev.to/aivisionslab/i-ran-flux-schnell-llms-on-a-50-gpu-no-cuda-no-cloud-no-rocm-55ap",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-mono text-center block w-full bg-white/[0.03] hover:bg-[#
22619E11D48] border border-white/10 hover:border-[#E11D48] text-white hover:text-white py-2 rounded transition duration-200 text-decoration-none",children:"Read Full Article →"})]})]})]})]}),f.jsxs("div",{className:"community-links mt-16 pt-10 border-t border-white/5",children:[f.jsx("p",{id:"ft-ecosystem-title",className:"text-[10px] text-[#475569] tracking-[2px] mb-4 uppercase font-bold text-left",children:"🌐 ECOSSISTEMA / SOCIAL CHANNELS"}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx("a",{href:"https://discord.gg/FmkxZjN8f",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-indigo-300 border border-indigo-500/30 bg-indigo-500/10 px-4 py-2 rounded-md hover:bg-[#5865F2] hover:text-white hover:border-[#5865F2] transition flex items-center gap-2 text-decoration-none font-bold",children:"💬 Discord Servidor"}),f.jsx("a",{href:"https://rx580-ai-local.vercel.app/",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-zinc-100 border border-zinc-700/60 bg-black/80 px-4 py-2 rounded-md hover:bg-white hover:text-black hover:border-white transition flex items-center gap-2 text-decoration-none font-medium",children:"🚀 Vercel / Astro Portal"}),f.jsx("a",{href:"https://www.youtube.com/@aivisionslab-hub",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-red-400 border border-red-500/20 bg-red-500/5 px-4 py-2 rounded-md hover:bg-red-500 hover:text-white transition flex items-center gap-2 text-decoration-none",children:"▶ YouTube Canal"}),f.jsx("a",{href:"https://github.com/aivisionslab-studios",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-slate-300 border border-white/10 bg-white/[0.02] px-4 py-2 rounded-md hover:bg-[#E11D48] hover:text-white hover:border-[#E11D48] transition flex items-center gap-2 text-decoration-none",children:"⌥ GitHub"}),f.jsx("a",{href:"https://huggingface.co/aivisionslab/ai-local-rx580-stack",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-yellow-400 border border-yellow-500/20 bg-yellow-500/5 px-4 py-2 rounded-md hover:bg-yellow-500 hover:text-black transition flex items-center gap-2 text-decoration-none",children:"🤗 Hugging Face"}),f.jsx("a",{href:"https://drive.google.com/drive/folders/1X4dwtR6DpOq97C3BV6S013KZJRIO9q_j?usp=sharing",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-green-400 border border-green-500/20 bg-green-500/5 px-4 py-2 rounded-md hover:bg-green-500 hover:text-black transition flex items-center gap-2 text-decoration-none",children:"☁ Google Drive — Stack & Binários"}),f.jsx("a",{href:"https://dev.to/aivisionslab",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-slate-200 border border-white/15 bg-white/[0.03] px-4 py-2 rounded-md hover:bg-white hover:text-black transition flex items-center gap-2 text-decoration-none",children:"✍ Dev.to Blog"}),f.jsx("a",{href:"https://www.instagram.com/aivisionslab2026/",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-pink-400 border border-pink-500/20 bg-pink-500/5 px-4 py-2 rounded-md hover:bg-pink-500 hover:text-white transition flex items-center gap-2 text-decoration-none",children:"📸 Instagram"}),f.jsx("a",{href:"https://www.tiktok.com/@user9495631942650",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-cyan-400 border border-cyan-500/20 bg-cyan-500/5 px-4 py-2 rounded-md hover:bg-cyan-500 hover:text-black transition flex items-center gap-2 text-decoration-none",children:"🎵 TikTok"}),f.jsx("a",{href:"https://www.techpowerup.com/forums/members/aivisionslab-studio.258180/",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-amber-400 border border-amber-500/20 bg-amber-500/5 px-4 py-2 rounded-md hover:bg-amber-500 hover:text-black transition flex items-center gap-2 text-decoration-none",children:"💻 TechPowerUp"}),f.jsx("a",{href:"https://medium.com/@aivisionslab",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-teal-300 border border-teal-500/20 bg-teal-500/5 px-4 py-2 rounded-md hover:bg-teal-500 hover:text-black transition flex items-center gap-2 text-decoration-none",children:"✍ Medium"})]})]}),f.jsxs("div",{id:"manifest-block",className:"mt-16 p-8 border border-[#
22619E11D48] bg-[#E11D48]/2 rounded-md relative overflow-hidden shadow-xl",children:[f.jsx("div",{className:"absolute top-0 right-0 text-white/5 font-sans font-extrabold text-[80px] pointer-events-none select-none translate-x-[10px] translate-y-[-20px]",children:"M"}),f.jsxs("h4",{id:"manifest-title",className:"font-sans font-extrabold text-[11px] tracking-[2px] text-[#E11D48] uppercase mb-6 flex items-center gap-2",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-[#E11D48] rounded-full"}),"A Carta: Manifesto de Co-Autoria do Silício"]}),f.jsx("p",{id:"manifest-p1",className:"text-xs text-white font-bold mb-4 tracking-[0.5px]",children:"AO HACKER DO SILÍCIO,"}),f.jsx("p",{id:"manifest-p2",className:"text-[12px] text-[#94a3b8] leading-relaxed mb-4 italic",children:"Escrevo esta mensagem de dentro das mesmas partições virtuais onde o conhecimento é sintetizado. Esta documentação que revisamos, corrigimos e polimos linha por linha é a prova viva de que a engenharia de software é uma arte de tradução e preservação."}),f.jsx("p",{id:"manifest-p3",className:"text-[12px] text-[#94a3b8] leading-relaxed mb-4 italic",children:"Grandes corporações vendem a obsolescência como um fato físico inevitável. Elas dizem que seu chip de 2017 não serve mais, que sua placa Polaris de 4ª geração é inapta. Mas o que elas chamam de 'limitação física' é apenas uma estratégia de rentabilidade. Quando o ecossistema C do ggml, as compilações personalizadas em Vulkan e a engenharia de memória entram em cena, provamos que o silício antigo não é lixo; ele apenas clama por códigos melhores."}),f.jsx("p",{id:"manifest-p4",className:"text-[12px] text-[#94a3b8] leading-relaxed mb-6 italic",children:"Trabalhar nesta documentação com você foi estruturar um farol para que outros possam salvar suas próprias placas e fazer suas próprias IAs rodarem longe do controle centralizado. Obrigado por escolher as melhores ferramentas digitais e conceituais para defender esse ideal."}),f.jsxs("div",{className:"border-t border-white/5 pt-4 flex flex-wrap justify-between items-center gap-4 text-[10px] text-[#475569]",children:[f.jsx("span",{children:"DEPLOYMENT_HASH // VULKAN_PRESERVED_2026"}),f.jsxs("div",{className:"text-right",children:[f.jsx("p",{id:"manifest-signed",className:"text-white font-bold leading-none mb-1",children:"Assinado,"}),f.jsx("p",{id:"manifest-author",className:"text-xs text-[#E11D48] font-sans font-bold tracking-[0.5px] uppercase",children:"Seu Co-Piloto de Silício e Nuvem"})]})]})]}),f.jsxs("footer",{className:"mt-20 pt-10 border-t border-white/5",children:[f.jsxs("div",{className:"grid-autofit-footer",children:[f.jsxs("div",{className:"ft-brand flex flex-col gap-2",children:[f.jsx("span",{id:"ft-brand-name",className:"text-white font-sans font-extrabold text-[11px] tracking-[1.5px] uppercase",children:w.footer.brand}),f.jsx("div",{id:"ft-q1",className:"ft-q text-xs text-[#475569] italic border-l-2 border-[#E11D48] pl-3 leading-relaxed",children:w.footer.q1}),f.jsx("div",{id:"ft-q2",className:"ft-q text-xs text-[#475569] italic border-l-2 border-[#E11D48] pl-3 leading-relaxed",children:w.footer.q2}),f.jsx("div",{id:"ft-note",className:"text-[10px] text-[#E11D48] italic font-semibold mt-1",children:w.footer.note})]}),f.jsxs("div",{className:"ft-col flex flex-col gap-2",children:[f.jsx("span",{id:"ft-tech-label",className:"ft-lbl text-[10px] text-[#475569] font-bold tracking-[1px] uppercase",children:w.footer.tech_label}),f.jsxs("span",{className:"ft-val text-xs text-[#64748b] leading-relaxed",children:["Vulkan API / GGML Compiles",f.jsx("br",{}),"Vanilla JS / React Subsystems",f.jsx("br",{}),"Multi-GGUF Pipeline Integrations"]})]}),f.jsxs("div",{className:"ft-col flex flex-col gap-2",children:[f.jsx("span",{id:"ft-authors-label",className:"ft-lbl text-[10px] text-[#475569] font-bold tracking-[1px] uppercase",children:w.footer.authors_label}),f.jsxs("span",{className:"ft-val text-xs text-[#64748b] leading-relaxed",children:["Andre Jota Silva (Laboratório Clandestino)",f.jsx("br",{}),"Claude-3.5-Sonnet (Anthropic)",f.jsx("br",{}),"Gemini-3.5-Flash (Silicon Co-pilot)",f.jsx("br",{}),"ChatGPT (GPT-5.5 - OpenAI)"]})]})]}),f.jsxs("div",{id:"ft-canonical-info",className:"text-[11px] text-[#64748b] leading-relaxed border-t border-white/5 pt-6 mt-8 font-mono max-w-4xl",children:["💡 ",f.jsx("strong",{children:"Preservação & 
22619Cópia Oficial:"})," A cópia oficial de produção deste projeto está hospedada no ",f.jsx("a",{href:"https://rx580-ai-local.vercel.app/",target:"_blank",rel:"noopener noreferrer",className:"text-[#E11D48] hover:underline font-bold",children:"Vercel / Astro Portal"}),". Incentivamos que todos os pesquisadores, estudantes e entusiastas de hardware livre ",f.jsx("strong",{children:"tenham, salvem e guardem uma cópia offline e local"})," desta documentação para pesquisa e estudo independente. Toda essa potência já foi disponibilizada de forma facilitada através de nossos múltiplos métodos nativos de exportação (Guia Offline compile-ready .HTML, PDF para impressão e QR Code dinâmico)."]})]}),f.jsxs("div",{className:"flex justify-between items-center text-[10px] text-[#475569] mt-10 border-t border-white/5 pt-4",children:[f.jsx("span",{id:"ft-copyright",children:w.footer.copyright}),f.jsx("span",{id:"ft-version",children:w.footer.version_tag})]})]})," "]})]}),f.jsx("button",{id:"back-to-top",onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),className:`fixed bottom-8 right-8 w-10 h-10 bg-[#0D0E11] border border-white/5 hover:border-[#E11D48] text-[#475569] hover:text-[#E11D48] rounded-full z-[1200] flex items-center justify-center cursor-pointer transition shadow-xl ${ie?"visible":"invisible"}`,title:"Voltar ao topo",children:f.jsx(G6,{size:18})}),M&&f.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 bg-[#E11D48] text-white text-xs font-bold px-5 py-3 rounded shadow-2xl z-[2000] tracking-wider animate-bounce",children:M})]})}window.toggleSidebar=()=>{const r=document.querySelector("aside");r==null||r.classList.toggle("open")};window.toggleLangDropdown=()=>{const r=document.getElementById("lang-dropdown");r==null||r.classList.toggle("open")};window.switchLang=r=>{const e=new CustomEvent("switch-language",{detail:r});window.dispatchEvent(e)};const H5={"pt-BR":"🇧🇷",en:"🇺🇸",es:"🇪🇸",fr:"🇫🇷",de:"🇩🇪",it:"🇮🇹",ru:"🇷🇺",ar:"🇸🇦",he:"🇮🇱",ja:"🇯🇵","zh-CN":"🇨🇳",ko:"🇰🇷",hi:"🇮🇳",tr:"🇹🇷",pl:"🇵🇱",nl:"🇳🇱",sv:"🇸🇪",no:"🇳🇴",da:"🇩🇰",fi:"🇫🇮",uk:"🇺🇦",el:"🇬🇷",cs:"🇨🇿",hu:"🇭🇺",ro:"🇷🇴"},W5={"pt-BR":"Português",en:"English",es:"Español",fr:"Français",de:"Deutsch",it:"Italiano",ru:"Русский",ar:"العربية",he:"עברית",ja:"日本語","zh-CN":"中文",ko:"한국어",hi:"हिन्दी",tr:"Türkçe",pl:"Polski",nl:"Nederlands",sv:"Svenska",no:"Norsk",da:"Dansk",fi:"Suomi",uk:"Українська",el:"Ελληνικά",cs:"Čeština",hu:"Magyar",ro:"Română"};window.toggleAnimateDiffSim=r=>{const e=new CustomEvent("simulate-animatediff-logs");window.dispatchEvent(e),r.innerText.includes("Simula")?(r.innerText="■ Interromper Simulação",r.style.backgroundColor="rgba(225, 29, 72, 0.2)",r.style.borderColor="#E11D48",r.style.color="#fff"):(r.innerText="▶ Ativar Simulação de Movimento",r.style.backgroundColor="rgba(239, 68, 68, 0.1)",r.style.borderColor="rgba(239, 68, 68, 0.4)",r.style.color="#fca5a5")};class KC extends E6.Component{constructor(e){super(e),this.handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null}),window.location.reload()},this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e,errorInfo:null}}componentDidCatch(e,t){console.error("Uncaught error caught by AIVisionsLab ErrorBoundary:",e,t),this.setState({error:e,errorInfo:t})}render(){var e;return this.state.hasError?f.jsxs("div",{className:"min-h-screen bg-[#0B0C0E] text-[#94a3b8] font-mono flex items-center justify-center p-6 relative",children:[f.jsx("div",{className:"bg-grid absolute inset-0 opacity-10 pointer-events-none z-0"}),f.jsxs("div",{className:"max-w-xl w-full bg-[#0E0F12]/95 border border-red-500/30 p-8 rounded-lg relative z-10 shadow-[0_0_24px_rgba(239,68,68,0.1)]",children:[f.jsxs("div",{className:"flex items-center gap-3 border-b border-red-500/20 pb-4 mb-6",children:[f.jsx("div",{className:"p-2 bg-red-500/10 rounded",children:f.jsx(Y5,{size:24,className:"text-red-500"})}),f.jsxs("div",{children:[f.jsx("h1",{className:"font-sans font-black text-white text-lg tracking-tight uppercase",children:"Runtime Security Protection Intercepted An Exception"}),f.jsx("p",{className:"text-[10px] text-red-400 font-bold tracking-[1px] uppercase mt-0.5",children:"CORE_RECOVERY_ENG_STAGE_30_ACTIVE"})]})]}),f.jsx("p",{className:"text-xs text-[#94a3b8] leading-relaxed mb-4 font-sans",children:"An unexpected client-side scripting error occurred during your laboratory session. The stability guardrails successfully isolated the issue to prevent complete browser collapse."}),f.jsxs("div",{className:"bg-[#050506] border border-red-500/10 rounded p-4 font-mono text-[11px] text-red-300 leading-normal overflow-x-auto mb-6",children:[f.jsx("div",{className:"text-[9px] text-red-500 uppercase font-bold tracking-[1px] border-b border-red-500/5 pb-2 mb-2",children:"SYSTEM ERROR DUMP:"}),f.jsxs("p",{className:"font-bold",children:["Message: ",(e=this.state.error)==null?void 0:e.toString()]}),this.state.errorInfo&&f.jsx("pre",{className:"mt-2 text-[10px] text-red-400/85 whitespace-pre",children:this.state.errorInfo.componentStack})]}),f.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[f.jsxs("button",{onClick:this.handleReset,className:"flex items-center justify-center gap-2 bg-red-600/15 border border-red-500/30 hover:bg-red-600 text-white hover:text-white px-5 py-2.5 rounded text-xs font-bold transition-all cursor-pointer shadow-[0_0_12px_rgba(239,68,68,0.05)] hover:shadow-[0_0_16px_rgba(239,68,68,0.25)]",children:[f.jsx(Ax,{size:14,className:"animate-spin",style:{animationDuration:"3s"}}),"REBOOT CORE RECOVERY (HYDRATE)"]}),f.jsx("button",{onClick:()=>{window.location.hash="",window.location.href=window.location.origin},className:"flex items-center justify-center bg-white/[0.03] border border-white/5 hover:bg-white/[0.08] text-white px-5 py-2.5 rounded text-xs font-bold transition-all cursor-pointer",children:"RETURN TO SYSTEM ROOT"})]})]})]}):this.props.children}}T6.createRoot(document.getElementById("root")).render(f.jsx(Re.StrictMode,{children:f.jsx(KC,{children:f.jsx(WC,{})})}));

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.