import{_ as b,ei as A,dR as L,dT as U,as as q,D,ej as W,ek as J,U as N,b9 as H,u as Z,a1 as G,aK as V,f as c,B as X,z as K,cG as Q,bq as Y,aG as P,aA as E,dI as tt,el as w,aD as l,m as S,cR as et,n as p,b3 as nt,g as B,h as st,i as T,aJ as k,em as x,dD as v,aw as rt,en as O,aB as at,eo as ot,bd as it,ep as ct}from"./index-CK33qGU_.js";import{u as ft}from"./useProject-BzBQtp4J.js";import{a as C,l as ut}from"./length-fOfC3W0h.js";var lt=b(function(e,n){return e||n}),pt=function(){function t(e,n){this.xf=n,this.f=e,this.set=new A}return t.prototype["@@transducer/init"]=L.init,t.prototype["@@transducer/result"]=L.result,t.prototype["@@transducer/step"]=function(e,n){return this.set.add(this.f(n))?this.xf["@@transducer/step"](e,n):e},t}(),dt=b(function(e,n){return new pt(e,n)}),Jt=b(U([],dt,function(t,e){for(var n=new A,s=[],a=0,o,u;a<e.length;)u=e[a],o=t(u),n.add(o)&&s.push(u),a+=1;return s})),R=b(function(e,n){return function(s){return function(a){return q(function(o){return n(o,a)},s(e(a)))}}}),g=D(function(e){return R(W(e),J(e))}),ht=D(function(e){return R(N(e),H(e))}),gt=function(t){return{value:t,"fantasy-land/map":function(){return this}}},d=b(function(e,n){return e(gt)(n).value});const Ht=()=>{const{id:t}=Z();return ft(+t)};var _=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,y,mt={"\b":"\\b","	":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},h;function z(t){return _.lastIndex=0,_.test(t)?'"'+t.replace(_,function(e){var n=mt[e];return typeof n=="string"?n:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function j(t,e,n){var s,a,o,u,m=f,i,r=e[t];switch(r&&typeof r=="object"&&typeof r.toJSON=="function"&&(r=r.toJSON(t)),typeof h=="function"&&(r=h.call(e,t,r)),typeof r){case"string":return z(r);case"number":return isFinite(r)?String(r):"null";case"boolean":case"null":return String(r);case"object":if(!r)return"null";if(f+=y,i=[],Object.prototype.toString.apply(r)==="[object Array]"){for(u=r.length,s=0;s<u;s+=1)i[s]=j(s,r,n)||"null";return o=i.length===0?"[]":f?f.length+i.join(", ").length+4>n?`[
`+f+i.join(`,
`+f)+`
`+m+"]":"[ "+i.join(", ")+" ]":"["+i.join(",")+"]",f=m,o}if(h&&typeof h=="object")for(u=h.length,s=0;s<u;s+=1)typeof h[s]=="string"&&(a=h[s],o=j(a,r,n),o&&i.push(z(a)+(f?": ":":")+o));else for(a in r)Object.prototype.hasOwnProperty.call(r,a)&&(o=j(a,r,n),o&&i.push(z(a)+(f?": ":":")+o));return o=i.length===0?"{}":f?f.length+i.join(", ").length+4>n?`{
`+f+i.join(`,
`+f)+`
`+m+"}":"{ "+i.join(", ")+" }":"{"+i.join(",")+"}",f=m,o}}function bt(t,e,n,s){var a;if(f="",y="",s||(s=0),typeof s!="number")throw new Error("beaufifier: limit must be a number");if(typeof n=="number")for(a=0;a<n;a+=1)y+=" ";else typeof n=="string"&&(y=n);if(h=e,e&&typeof e!="function"&&(typeof e!="object"||typeof e.length!="number"))throw new Error("beautifier: wrong replacer parameter");return j("",{"":t},s)}var yt=bt;const jt=G(yt),Zt=50,xt=g(["attributes","name"]),vt=g(["attributes","dir"]),Pt=g(["attributes","id"]),Et=g(["attributes","modificationTime"]),wt=ht("name"),St=g(["attributes","owner"]),It=g(["attributes","path"]),Ot=g(["attributes","permission"]),_t=g(["attributes","size"]),Gt=d(vt),Vt=d(Pt),Xt=d(Et),zt=d(xt),Lt=d(wt),Kt=V(lt,[Lt,zt]),Qt=d(St),At=d(It),Yt=d(Ot),te=d(_t),qt=["csv","data","json","xml","parquet","pickle","tfrecord","orc","npy"],Dt="db",Nt=["ipynb","LICENSE","log","md","sum","test"],Bt="folder",Tt=["gif","png","jpg","svg"],kt=["clj","cljs","dockerfile","go","jar","java","Makefile","hoodie_partition_metadata","properties","py","sh","sql","ts","tsx","yml"],Ct=["gz","tar","tgz","zip","xz","bz2"];var I=(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))(I||{});const Rt=[{fileGroup:0,extensions:qt},{fileGroup:1,extensions:Dt},{fileGroup:2,extensions:Nt},{fileGroup:3,extensions:Bt},{fileGroup:4,extensions:Tt},{fileGroup:5,extensions:kt},{fileGroup:6,extensions:Ct}],F=({isDir:t=!1,fileName:e})=>t?rt(".db",e)?"db":"folder":c(l("."),v)(e),Ft=c(t=>K(Q(Y(t),"extensions"),Rt),X(I.file,"fileGroup")),$=c(F,Ft),ee=c($,P(I.zip)),ne=c(F,P("ipynb")),se=c($,P(I.image)),$t={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"},re=t=>N(t,$t)??"plaintext",ae=(t,e=80)=>{try{return jt(JSON.parse(t),null,2,e)}catch{return t}},oe=t=>{const e=t.split("/")[0];return e.includes(".db")?e.includes("featurestore.db")?O.FEATURESTORE:O.HIVE:O.DATASET},ie=c(S("/"),l("/"),tt((t,e)=>e===".."?w(t):e==="."?t:C(e,t),[]),E("/")),ce=et(2,(t,e)=>c(l("/"),w,C(t),E("/"))(e)),fe=(t,e)=>{const n=c(l("/"),v)(e),s=n===""||!n.match(/^\w+\.\w+/),a=c(S("/"),l("/"),v)(t);return s?`${e}/${a}`:e},ue=c(p("/"),S("/"),l("/"),T(k(["Projects"]),x(2),x(3)),w,q(decodeURIComponent),nt(B,st(["root"])),E("/"),p("/")),le=c(p("/"),S("/"),l("/"),w,E("/")),pe=c(l("/"),v),de=c(p("/"),l("/"),ut,P(1)),he=t=>t.slice(0,t.lastIndexOf(".")).replace(/\./g,"_").replace(/[^a-zA-Z0-9_]/g,""),ge=(t,e)=>p("/",t).split("/")[0].endsWith(".db")?`/apps/hive/warehouse/${p("/",t)}`:`/Projects/${e}/${p("/",t)}`,me=(t,e)=>{const n=At(t),s=c(p("/"),l("/"),at(B))(e);return c(p("/"),l("/"),T(k(["Projects"]),x(2),x(3)))(n).length===ot(s.length)},be=()=>{const t=it();return async(n,s,a)=>{var o,u,m,i;try{await ct.download(n,s,a)}catch(r){const M=((u=(o=r==null?void 0:r.response)==null?void 0:o.data)==null?void 0:u.usrMsg)||((i=(m=r==null?void 0:r.response)==null?void 0:m.data)==null?void 0:i.errorMsg);t.error({title:"Error",content:M})}}};export{ie as A,fe as B,I as C,$ as D,he as E,Zt as F,se as G,Jt as a,le as b,be as c,pe as d,F as e,ae as f,ue as g,re as h,At as i,Kt as j,ge as k,Gt as l,oe as m,de as n,ce as o,It as p,xt as q,ee as r,ne as s,me as t,Ht as u,te as v,Xt as w,Yt as x,Vt as y,Qt as z};
