import{aj as e,ak as a,al as t,am as s,an as n,ao as r,ap as o,aq as u,ar as i,as as c,at as l,au as g,P as m,ai as f,av as p,aw as d,ax as P}from"./index-3714412c.js";function h(a,t){return e(a)?t:a}const w=e=>(s,n=t())=>{!c&&a(e,s,n)},T=w(s),x=w(n),y=w(r),b=w(o),j=w(u),C=w(i),k=()=>{function e(e,a=0){return v(e),new Promise(((t,s)=>{const n=()=>m({...e,success:()=>{t(!0)},fail:e=>{s(e)}});0!==a?setTimeout((()=>{n()}),a):n()}))}function a(){return g()}return{push:function(e={},a={}){a={type:"navigateTo",data:{},timeout:0,...a},v(e),L(e,a.data);const t={navigateTo:p,redirectTo:d,reLaunch:P};return new Promise(((s,n)=>{const r=()=>t[a.type]({...e,success:()=>{s(!0)},fail:e=>{n(e)}});0!==a.timeout?setTimeout((()=>{r()}),a.timeout):r()}))},pushToTab:e,goBack:function(t,s=0){return new Promise(((n,r)=>{const o=()=>{1!==a().length?f({...t,success:()=>{n(!0)},fail:e=>{r(e)}}):e({url:"/pages/index/index"})};0!==s?setTimeout((()=>{o()}),s):o()}))},getParams:function(e){return"object"!=typeof e?{}:e.details?JSON.parse(decodeURIComponent(e.details)):{}},preLoad:function(e){return new Promise(((a,t)=>{l({url:e,success:()=>{a(!0)},fail:a=>{t({message:`${e}预加载失败，请检查路径`,error:a})}})}))},getCurrentPage:function(){const e=g();return{currentPages:e,prePage:e.length-2>=0?e[e.length-2]:null,nowPage:e.length-1>=0?e[e.length-1]:null}},getCurrentPageList:a}},v=e=>{if(!e.url)throw new Error("options 必须携带url参数")},L=(e,a)=>(Object.keys(a).length>0&&(e.url=`${e.url}?details=${encodeURIComponent(JSON.stringify(a))}`),e);export{C as a,T as b,x as c,j as d,b as e,y as o,h as r,k as u};
