import{u as H}from"./useProject-CXVt1xnE.js";import{_ as A,ax as I,E as N,H as M,eO as W,X as _,bA as B,u as J,a6 as Z,bg as U,p as c,A as V,y as Q,d7 as X,a$ as K,ba as v,b5 as P,aS as Y,eP as E,b7 as u,n as w,dg as G,o as l,bv as tt,g as T,h as et,i as k,bf as C,eQ as j,aR as x,aB as st,aH as O,aN as nt,eR as at,aE as ot,eS as rt}from"./index-dP1W1_bd.js";import{a as D,l as it}from"./length-BzpOfCdE.js";var ct=A(function(e,s){return e||s}),R=A(function(e,s){return function(a){return function(o){return I(function(i){return s(i,o)},a(e(o)))}}}),g=N(function(e){return R(M(e),W(e))}),ft=N(function(e){return R(_(e),B(e))}),ut=function(t){return{value:t,"fantasy-land/map":function(){return this}}},p=A(function(e,s){return e(ut)(s).value});const qt=()=>{const{id:t}=J();return H(+t)};var L=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,b,lt={"\b":"\\b","	":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},d;function z(t){return L.lastIndex=0,L.test(t)?'"'+t.replace(L,function(e){var s=lt[e];return typeof s=="string"?s:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function y(t,e,s){var a,o,i,m,h=f,r,n=e[t];switch(n&&typeof n=="object"&&typeof n.toJSON=="function"&&(n=n.toJSON(t)),typeof d=="function"&&(n=d.call(e,t,n)),typeof n){case"string":return z(n);case"number":return isFinite(n)?String(n):"null";case"boolean":case"null":return String(n);case"object":if(!n)return"null";if(f+=b,r=[],Object.prototype.toString.apply(n)==="[object Array]"){for(m=n.length,a=0;a<m;a+=1)r[a]=y(a,n,s)||"null";return i=r.length===0?"[]":f?f.length+r.join(", ").length+4>s?`[
`+f+r.join(`,
`+f)+`
`+h+"]":"[ "+r.join(", ")+" ]":"["+r.join(",")+"]",f=h,i}if(d&&typeof d=="object")for(m=d.length,a=0;a<m;a+=1)typeof d[a]=="string"&&(o=d[a],i=y(o,n,s),i&&r.push(z(o)+(f?": ":":")+i));else for(o in n)Object.prototype.hasOwnProperty.call(n,o)&&(i=y(o,n,s),i&&r.push(z(o)+(f?": ":":")+i));return i=r.length===0?"{}":f?f.length+r.join(", ").length+4>s?`{
`+f+r.join(`,
`+f)+`
`+h+"}":"{ "+r.join(", ")+" }":"{"+r.join(",")+"}",f=h,i}}function pt(t,e,s,a){var o;if(f="",b="",a||(a=0),typeof a!="number")throw new Error("beaufifier: limit must be a number");if(typeof s=="number")for(o=0;o<s;o+=1)b+=" ";else typeof s=="string"&&(b=s);if(d=e,e&&typeof e!="function"&&(typeof e!="object"||typeof e.length!="number"))throw new Error("beautifier: wrong replacer parameter");return y("",{"":t},a)}var dt=pt;const gt=Z(dt),Ht=50,mt=g(["attributes","name"]),ht=g(["attributes","dir"]),bt=g(["attributes","id"]),yt=g(["attributes","modificationTime"]),jt=ft("name"),xt=g(["attributes","owner"]),vt=g(["attributes","path"]),Pt=g(["attributes","permission"]),Et=g(["attributes","size"]),Mt=p(ht),Wt=p(bt),Bt=p(yt),wt=p(mt),St=p(jt),Jt=U(ct,[St,wt]),Zt=p(xt),Ot=p(vt),Ut=p(Pt),Vt=p(Et),Lt=["csv","data","json","xml","parquet","pickle","tfrecord","orc","npy"],zt="db",At=["ipynb","LICENSE","log","md","sum","test"],It="folder",Nt=["gif","png","jpg","svg"],_t=["clj","cljs","dockerfile","go","jar","java","Makefile","hoodie_partition_metadata","properties","py","sh","sql","ts","tsx","yml","yaml"],Tt=["gz","tar","tgz","zip","xz","bz2"];var S=(t=>(t[t.data=0]="data",t[t.db=1]="db",t[t.file=2]="file",t[t.folder=3]="folder",t[t.image=4]="image",t[t.script=5]="script",t[t.zip=6]="zip",t))(S||{});const kt=[{fileGroup:0,extensions:Lt},{fileGroup:1,extensions:zt},{fileGroup:2,extensions:At},{fileGroup:3,extensions:It},{fileGroup:4,extensions:Nt},{fileGroup:5,extensions:_t},{fileGroup:6,extensions:Tt}],F=({isDir:t=!1,fileName:e})=>t?st(".db",e)?"db":"folder":c(u("."),x)(e),Ct=c(t=>Q(X(K(t),"extensions"),kt),V(S.file,"fileGroup")),$=c(F,Ct),Qt=c($,v(S.zip)),Xt=c(F,v("ipynb")),Kt=c($,v(S.image)),Dt={cljs:"clojure",clj:"clojure",csv:"excel",data:"excel",dockerfile:"dockerfile",go:"go",ipynb:"xml",java:"java",json:"json",log:"haskell",Makefile:"makefile",md:"markdown",properties:"properties",hoodie_partition_metadata:"properties",py:"python",sh:"shell",test:"excel",ts:"typescript",tsx:"typescript",yml:"yaml",yaml:"yaml"},Yt=t=>_(t,Dt)??"plaintext",Gt=(t,e=80)=>{try{return gt(JSON.parse(t),null,2,e)}catch{return t}},te=t=>{const e=t.split("/")[0];return e.includes(".db")?e.includes("featurestore.db")?O.FEATURESTORE:O.HIVE:O.DATASET},ee=c(w("/"),u("/"),Y((t,e)=>e===".."?E(t):e==="."?t:D(e,t),[]),P("/")),se=G(2,(t,e)=>c(u("/"),E,D(t),P("/"))(e)),ne=(t,e)=>{const s=c(u("/"),x)(e),a=s===""||!s.match(/^\w+\.\w+/),o=c(w("/"),u("/"),x)(t);return a?`${e}/${o}`:e},ae=c(l("/"),w("/"),u("/"),k(C(["Projects"]),j(2),j(3)),E,I(decodeURIComponent),tt(T,et(["root"])),P("/"),l("/")),oe=c(l("/"),w("/"),u("/"),E,P("/")),re=c(u("/"),x),ie=c(l("/"),u("/"),it,v(1)),ce=t=>t.slice(0,t.lastIndexOf(".")).replace(/\./g,"_").replace(/[^a-zA-Z0-9_]/g,""),fe=(t,e)=>l("/",t).split("/")[0].endsWith(".db")?`/apps/hive/warehouse/${l("/",t)}`:`/Projects/${e}/${l("/",t)}`,ue=(t,e)=>{const s=Ot(t),a=c(l("/"),u("/"),nt(T))(e);return c(l("/"),u("/"),k(C(["Projects"]),j(2),j(3)))(s).length===at(a.length)},le=()=>{const t=ot();return async(s,a,o)=>{var i,m,h,r;try{await rt.download(s,a,o)}catch(n){const q=((m=(i=n==null?void 0:n.response)==null?void 0:i.data)==null?void 0:m.usrMsg)||((r=(h=n==null?void 0:n.response)==null?void 0:h.data)==null?void 0:r.errorMsg);t.error({title:"Error",content:q})}}};export{ne as A,S as B,$ as C,ce as D,Kt as E,Ht as F,le as a,Yt as b,Ot as c,re as d,oe as e,Gt as f,F as g,Jt as h,ae as i,fe as j,Mt as k,te as l,ie as m,se as n,mt as o,vt as p,Qt as q,Xt as r,ue as s,Vt as t,qt as u,Bt as v,Ut as w,Wt as x,Zt as y,ee as z};
