')},onLoadSuccess:el=>{el&&$(el).find('.loading-wrap').remove()},onLoadFailure:el=>{el&&($(el).find('.loading-wrap svg').remove(),$(el).find('.loading-wrap').append(''),$(el).find('.loading-wrap').addClass('error'))},request:(el,url,callback,onFailure)=>{let retryCount=0;return new Promise((resolve,reject)=>{let load=()=>{utils.onLoading?.(el);let timedOut=!1,timeout=setTimeout(()=>{timedOut=!0,console.warn('[request] 超时:',url),3<=++retryCount?(utils.onLoadFailure?.(el),onFailure?.(),reject('请求超时')):setTimeout(load,1e3)},5e3);fetch(url).then(resp=>{if(!timedOut){if(clearTimeout(timeout),resp.ok)return resp;throw new Error('响应失败')}}).then(data=>{timedOut||(utils.onLoadSuccess?.(el),callback(data),resolve(data))}).catch(err=>{clearTimeout(timeout),console.warn('[request] 错误:',err),3<=++retryCount?(utils.onLoadFailure?.(el),onFailure?.(),reject(err)):setTimeout(load,1e3)})};load()})},requestWithoutLoading:(url,options={},maxRetry=2,timeout=5e3)=>new Promise((resolve,reject)=>{let retryCount=0,tryRequest=()=>{let timer=setTimeout(()=>{++retryCount>maxRetry?reject('timeout'):tryRequest()},timeout);fetch(url,options).then(resp=>{if(clearTimeout(timer),!resp.ok)throw new Error('bad response');resolve(resp)}).catch(err=>{clearTimeout(timer),++retryCount>maxRetry?reject(err):setTimeout(tryRequest,500)})};tryRequest()}),requestAnimationFrame:fn=>{window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame),window.requestAnimationFrame(fn)},dark:{}};utils.dark.method={toggle:new RunItem},utils.dark=Object.assign(utils.dark,{push:utils.dark.method.toggle.push});