handy-uploader 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vuetify.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("./language-fvWXvWRx.js"),I=e.defineComponent({__name:"SelectFileIconType",props:{fileFormat:{},size:{default:30}},setup(l){const r=l,o=e.computed(()=>{const t=`file.${r.fileFormat}`;return u.getDetailedFileIcon(t)});return(t,d)=>{const C=e.resolveComponent("v-icon");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(C,{size:r.size,color:o.value.color},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value.icon),1)]),_:1},8,["size","color"])])}}}),le={key:0,style:{height:"200px",display:"flex","align-items":"center","justify-content":"center","background-color":"#f5f5f5",overflow:"hidden"}},ne=["src","onError"],ae={key:1,style:{height:"200px","background-color":"#f5f5f5",position:"relative",overflow:"hidden",display:"flex","align-items":"center","justify-content":"center"}},re=["src","onError"],ie={key:1,style:{width:"100%",height:"100%",background:"#e0e0e0",display:"flex","align-items":"center","justify-content":"center"}},se={class:"d-flex justify-center align-center",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"rgba(0,0,0,0.7)","border-radius":"50%",width:"60px",height:"60px",cursor:"pointer"}},ce={key:2,class:"d-flex justify-center align-center",style:{height:"200px","background-color":"#f5f5f5"}},de={class:"BYekan"},ue={class:"BYekan"},me={key:0},R=e.defineComponent({__name:"ThumbnailUploader",props:{lang:{default:"en"},documentAttachment:{},thumb:{type:Boolean,default:!0},cols:{default:4},editPermission:{type:Boolean,default:!0},deletePermission:{type:Boolean,default:!0},selectedLang:{},cardType:{},outlined:{type:Boolean,default:!1},raised:{type:Boolean,default:!1},shaped:{type:Boolean,default:!1},tile:{type:Boolean,default:!1}},emits:["openDeleteDialog","openEditDocumentDialog"],setup(l,{emit:r}){const o=n=>{const a=u.isImageFile(n);return console.log("🔍 isImageFile check:",n,"→",a),a},t=l,d=r,C=n=>{const a=u.getFileType(n)==="video";return console.log("🎥 Checking if video file:",n,"result:",a,"fileType:",u.getFileType(n)),a},_=n=>{var i;if(!n.base64||!n.format)return console.error("❌ Missing base64 or format for:",n.name,{base64:!!n.base64,format:n.format}),"";const a=u.constructImageDataUrl(n.base64,n.format);return console.log("🖼️ Image source for:",n.name,{format:n.format,base64Length:((i=n.base64)==null?void 0:i.length)||0,srcLength:a.length,srcPreview:a.substring(0,100)+"..."}),a},x=n=>{var a;console.error("Image failed to load:",{name:n.name,format:n.format,base64Length:((a=n.base64)==null?void 0:a.length)||0})},k=e.ref(0),p=u.createVideoThumbnailCache(()=>k.value++),f=n=>(k.value,p.get(n)),B=n=>{console.error("Video thumbnail failed to load:",{name:n.name,format:n.format}),p.invalidate(n)},b=n=>({icon:u.getFileIconName(n),color:u.getFileIconColor(n)}),w=n=>n.tags.length>0||!!n.description,T=n=>{n.showDetailState=!n.showDetailState},F=(n,a)=>{d("openDeleteDialog",n,a)},E=(n,a)=>{d("openEditDocumentDialog",n,a)},s=()=>{if(p.retain(t.documentAttachment.map(a=>a.file)),!t.thumb)return;console.log("🎯 Generating thumbnails for videos, total attachments:",t.documentAttachment.length);const n=t.documentAttachment.filter(a=>C(a.file.name));console.log("📹 Found video attachments:",n.length,n.map(a=>a.file.name)),n.forEach(a=>{console.log("🎬 Processing video:",a.file.name),f(a.file)})};return e.watch(()=>t.documentAttachment,s,{immediate:!0}),e.onMounted(s),(n,a)=>{const i=e.resolveComponent("v-icon"),c=e.resolveComponent("v-card-subtitle"),h=e.resolveComponent("v-chip"),g=e.resolveComponent("v-divider"),V=e.resolveComponent("v-btn"),v=e.resolveComponent("v-tooltip"),S=e.resolveComponent("v-spacer"),U=e.resolveComponent("v-card-actions"),P=e.resolveComponent("v-chip-group"),L=e.resolveComponent("v-card-text"),j=e.resolveComponent("v-expand-transition"),M=e.resolveComponent("v-card"),H=e.resolveComponent("v-col"),O=e.resolveComponent("v-row");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(O,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.documentAttachment,(y,$)=>(e.openBlock(),e.createBlock(H,{key:`attachment-${$}`,cols:"12",md:l.cols,xs:"12"},{default:e.withCtx(()=>[e.createVNode(M,{shaped:l.shaped,outlined:l.outlined,raised:l.raised,tile:l.tile,class:"mx-auto","max-width":"344"},{default:e.withCtx(()=>[l.thumb&&o(y.file.name)?(e.openBlock(),e.createElementBlock("div",le,[e.createElementVNode("img",{src:_(y.file),style:{"max-width":"100%","max-height":"100%","object-fit":"contain"},onError:N=>x(y.file)},null,40,ne)])):l.thumb&&C(y.file.name)?(e.openBlock(),e.createElementBlock("div",ae,[f(y.file)?(e.openBlock(),e.createElementBlock("img",{key:0,src:f(y.file),style:{width:"100%",height:"100%","object-fit":"cover"},onError:N=>B(y.file)},null,40,re)):(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(i,{size:"60",color:"grey"},{default:e.withCtx(()=>[...a[0]||(a[0]=[e.createTextVNode("mdi-video",-1)])]),_:1})])),e.createElementVNode("div",se,[e.createVNode(i,{color:"white",size:"30"},{default:e.withCtx(()=>[...a[1]||(a[1]=[e.createTextVNode("mdi-play",-1)])]),_:1})])])):(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(i,{size:"120",color:b(y.file.name).color},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(b(y.file.name).icon),1)]),_:2},1032,["color"])])),e.createVNode(c,{class:"text-truncate py-2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.file.name),1)]),_:2},1024),e.createVNode(c,{class:"pt-2 pb-3"},{default:e.withCtx(()=>[e.createVNode(h,{color:e.unref(u.formatFileSize)(y.file.size).color,label:"","text-color":"white"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u.formatFileSize)(y.file.size).text)+" ",1),e.createVNode(i,{right:""},{default:e.withCtx(()=>[...a[2]||(a[2]=[e.createTextVNode("mdi-harddisk",-1)])]),_:1})]),_:2},1032,["color"])]),_:2},1024),e.createVNode(g,{class:"mx-4"}),e.createVNode(U,{style:{padding:"0"}},{default:e.withCtx(()=>[e.createVNode(v,{right:""},{activator:e.withCtx(({props:N})=>[l.deletePermission?(e.openBlock(),e.createBlock(V,e.mergeProps({key:0,text:"",fab:""},{ref_for:!0},N,{onClick:z=>F($,"")}),{default:e.withCtx(()=>[e.createVNode(i,{color:"red"},{default:e.withCtx(()=>[...a[3]||(a[3]=[e.createTextVNode("mdi-trash-can-outline",-1)])]),_:1})]),_:1},16,["onClick"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("span",de,e.toDisplayString(l.selectedLang[l.lang].delete),1)]),_:2},1024),e.createVNode(v,{right:""},{activator:e.withCtx(({props:N})=>[l.editPermission?(e.openBlock(),e.createBlock(V,e.mergeProps({key:0,text:"",fab:""},{ref_for:!0},N,{onClick:z=>E(y,$)}),{default:e.withCtx(()=>[e.createVNode(i,{color:"green"},{default:e.withCtx(()=>[...a[4]||(a[4]=[e.createTextVNode("mdi-pencil-outline",-1)])]),_:1})]),_:1},16,["onClick"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("span",ue,e.toDisplayString(l.selectedLang[l.lang].edit),1)]),_:2},1024),e.createVNode(S),w(y.file)?(e.openBlock(),e.createBlock(V,{key:0,icon:"",onClick:N=>T(y.file)},{default:e.withCtx(()=>[e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.file.showDetailState?"mdi-chevron-up":"mdi-chevron-down"),1)]),_:2},1024)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(j,null,{default:e.withCtx(()=>[w(y.file)?e.withDirectives((e.openBlock(),e.createElementBlock("div",me,[e.createVNode(g),y.file.tags.length?(e.openBlock(),e.createBlock(P,{key:0,multiple:"","active-class":"primary--text",class:"pa-2"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.file.tags,(N,z)=>(e.openBlock(),e.createBlock(h,{key:`tag-${z}`,class:"ma-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(N),1)]),_:2},1024))),128))]),_:2},1024)):e.createCommentVNode("",!0),y.file.description?(e.openBlock(),e.createBlock(L,{key:1,class:"text-justify"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.file.description),1)]),_:2},1024)):e.createCommentVNode("",!0)],512)),[[e.vShow,y.file.showDetailState]]):e.createCommentVNode("",!0)]),_:2},1024)]),_:2},1032,["shaped","outlined","raised","tile"])]),_:2},1032,["md"]))),128))]),_:1})])}}}),pe={class:"text-left",style:{width:"80px"}},fe={class:"text-center"},ge={class:"text-left",style:{width:"120px"}},he={class:"text-left",style:{width:"120px"}},ve={class:"text-center pa-3"},Ce={class:"text-left pa-3"},xe={class:"text-left pa-3"},ye={class:"text-center pa-2"},be={class:"d-flex justify-center ga-1"},_e=e.defineComponent({__name:"TableUploader",props:{documentAttachment:{},thumb:{type:Boolean,default:!0},lang:{default:"en"},cols:{default:4},editPermission:{type:Boolean,default:!0},deletePermission:{type:Boolean,default:!0},tableThumbColumn:{type:Boolean},tableFixedHeader:{type:Boolean,default:!0},tableHeight:{default:400},selectedLang:{}},emits:["openDeleteDialog","openEditDocumentDialog"],setup(l,{emit:r}){const o=l,t=r,d=p=>p?u.isImageFile(p):!1,C=p=>{const f=p/1e3,B=f/1024;return B>=1?`${B.toFixed(1)} MB`:`${f.toFixed(1)} KB`},_=p=>{const f=p/1024e3;return f<1?"success":f<5?"warning":"error"},x=(p,f)=>{t("openDeleteDialog",p,f)},k=(p,f)=>{t("openEditDocumentDialog",p,f)};return(p,f)=>{const B=e.resolveComponent("v-img"),b=e.resolveComponent("v-icon"),w=e.resolveComponent("v-tooltip"),T=e.resolveComponent("v-chip"),F=e.resolveComponent("v-btn"),E=e.resolveComponent("v-table"),s=e.resolveComponent("v-col"),n=e.resolveComponent("v-row");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(s,{cols:"12"},{default:e.withCtx(()=>[e.createVNode(E,{"fixed-header":o.tableFixedHeader,height:o.tableHeight+"px",class:"elevation-1"},{default:e.withCtx(()=>[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",pe,e.toDisplayString(o.selectedLang[l.lang].table.thumb),1),e.createElementVNode("th",fe,e.toDisplayString(o.selectedLang[l.lang].table.name),1),e.createElementVNode("th",ge,e.toDisplayString(o.selectedLang[l.lang].table.size),1),e.createElementVNode("th",he,e.toDisplayString(o.selectedLang[l.lang].table.action.action),1)])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.documentAttachment,(a,i)=>(e.openBlock(),e.createElementBlock("tr",{key:`attachment-${i}`,class:"table-row"},[e.createElementVNode("td",ve,[e.createVNode(w,{location:"top"},{activator:e.withCtx(({props:c})=>[e.createElementVNode("div",e.mergeProps({class:"d-flex justify-center align-center",style:{height:"60px",width:"60px"}},{ref_for:!0},c),[d(a.file.name)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.thumb&&a.file.base64?(e.openBlock(),e.createBlock(B,{key:0,style:{height:"40px",width:"40px"},src:"data:"+a.file.format+";base64,"+a.file.base64,height:"40",width:"40",class:"rounded",contain:""},null,8,["src"])):(e.openBlock(),e.createBlock(b,{key:1,size:"40",color:"deep-purple"},{default:e.withCtx(()=>[...f[0]||(f[0]=[e.createTextVNode(" mdi-file-image-outline ",-1)])]),_:1}))],64)):(e.openBlock(),e.createBlock(b,{key:1,icon:e.unref(u.getFileIconName)(a.file.name),color:e.unref(u.getFileIconColor)(a.file.name),size:"40"},null,8,["icon","color"]))],16)]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(a.file.name),1)]),_:2},1024)]),e.createElementVNode("td",Ce,[e.createVNode(w,{location:"top"},{activator:e.withCtx(({props:c})=>[e.createElementVNode("span",e.mergeProps({ref_for:!0},c),e.toDisplayString((()=>{const h=a.file.name.split(".").pop(),g=a.file.name.slice(0,a.file.name.lastIndexOf("."));return`${g.length>10?g.slice(0,10)+"...":g}.${h}`})()),17)]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(a.file.name),1)]),_:2},1024)]),e.createElementVNode("td",xe,[e.createVNode(T,{color:_(a.file.size),variant:"tonal",size:"small",class:"text-caption"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C(a.file.size)),1)]),_:2},1032,["color"])]),e.createElementVNode("td",ye,[e.createElementVNode("div",be,[l.editPermission?(e.openBlock(),e.createBlock(w,{key:0,location:"top"},{activator:e.withCtx(({props:c})=>[e.createVNode(F,e.mergeProps({icon:"",size:"small",color:"success",variant:"text"},{ref_for:!0},c,{onClick:h=>k(a,i)}),{default:e.withCtx(()=>[e.createVNode(b,{size:"18"},{default:e.withCtx(()=>[...f[1]||(f[1]=[e.createTextVNode("mdi-pencil-outline",-1)])]),_:1})]),_:1},16,["onClick"])]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(l.selectedLang[l.lang].edit),1)]),_:2},1024)):e.createCommentVNode("",!0),l.deletePermission?(e.openBlock(),e.createBlock(w,{key:1,location:"top"},{activator:e.withCtx(({props:c})=>[e.createVNode(F,e.mergeProps({icon:"",size:"small",color:"error",variant:"text"},{ref_for:!0},c,{onClick:h=>x(i,"")}),{default:e.withCtx(()=>[e.createVNode(b,{size:"18"},{default:e.withCtx(()=>[...f[2]||(f[2]=[e.createTextVNode("mdi-delete",-1)])]),_:1})]),_:1},16,["onClick"])]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(l.selectedLang[l.lang].table.action.deleteTooltip),1)]),_:2},1024)):e.createCommentVNode("",!0)])])]))),128))])]),_:1},8,["fixed-header","height"])]),_:1})]),_:1})])}}}),K=(l,r)=>{const o=l.__vccOpts||l;for(const[t,d]of r)o[t]=d;return o},W=K(_e,[["__scopeId","data-v-d05b814b"]]),Ve={class:"d-flex align-center pa-3",style:{height:"100%"}},ke={class:"flex-grow-1 pr-4",style:{"max-width":"60%"}},we={class:"text-subtitle-1 font-weight-medium mb-2",style:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","max-width":"100%"}},Be={class:"flex-shrink-0",style:{"min-width":"80px"}},Fe={key:0,class:"thumbnail-container"},Ne={key:1,class:"d-flex align-center justify-center"},De={class:"d-flex gap-2 pb-1"},Te=e.defineComponent({__name:"SimpleUploader",props:{documentAttachment:{},lang:{default:"en"},thumb:{type:Boolean,default:!0},cols:{default:4},editPermission:{type:Boolean,default:!0},cardType:{},outlined:{type:Boolean},raised:{type:Boolean},shaped:{type:Boolean},tile:{type:Boolean},deletePermission:{type:Boolean,default:!0},selectedLang:{}},emits:["setCardTheme","openDeleteDialog","openEditDocumentDialog"],setup(l,{emit:r}){const o=l,t=r,d=p=>{const f=p/1e3;return f<1024?`${f.toFixed(1)} ${o.selectedLang[o.lang].size.kb}`:`${(f/1024).toFixed(1)} ${o.selectedLang[o.lang].size.mb}`},C=p=>{var f;return["jpg","jpeg","png","tif","bmp"].includes(((f=p.split(".").pop())==null?void 0:f.toLowerCase())||"")},_=p=>p.base64?p.base64.startsWith("data:")?p.base64:`data:${p.format};base64,${p.base64}`:"",x=(p,f)=>t("openDeleteDialog",p,f),k=(p,f)=>t("openEditDocumentDialog",p,f);return(p,f)=>{const B=e.resolveComponent("v-icon"),b=e.resolveComponent("v-chip"),w=e.resolveComponent("v-img"),T=e.resolveComponent("v-divider"),F=e.resolveComponent("v-btn"),E=e.resolveComponent("v-tooltip"),s=e.resolveComponent("v-chip-group"),n=e.resolveComponent("v-card-text"),a=e.resolveComponent("v-expand-transition"),i=e.resolveComponent("v-card"),c=e.resolveComponent("v-col"),h=e.resolveComponent("v-row");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(h,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.documentAttachment,(g,V)=>(e.openBlock(),e.createBlock(c,{key:`attachment-${V}`,cols:"12",sm:"6",md:"4",lg:"3"},{default:e.withCtx(()=>[e.createVNode(i,{class:"file-card",shaped:o.shaped,outlined:o.outlined,raised:o.raised,tile:o.tile,height:"180"},{default:e.withCtx(()=>[e.createElementVNode("div",Ve,[e.createElementVNode("div",ke,[e.createElementVNode("div",we,e.toDisplayString(g.file.name),1),e.createVNode(b,{color:"teal",variant:"flat",size:"small",class:"text-white mb-2"},{default:e.withCtx(()=>[e.createVNode(B,{start:"",size:"16"},{default:e.withCtx(()=>[...f[0]||(f[0]=[e.createTextVNode("mdi-harddisk",-1)])]),_:1}),e.createTextVNode(" "+e.toDisplayString(d(g.file.size)),1)]),_:2},1024)]),e.createElementVNode("div",Be,[C(g.file.name)&&o.thumb?(e.openBlock(),e.createElementBlock("div",Fe,[e.createVNode(w,{src:_(g.file),height:"80",width:"80",cover:"",class:"rounded"},null,8,["src"])])):(e.openBlock(),e.createElementBlock("div",Ne,[e.createVNode(B,{color:e.unref(u.getFileIconColor)(g.file.name),size:"60"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u.getFileIconName)(g.file.name)),1)]),_:2},1032,["color"])]))])]),e.createVNode(T,{class:"my-2"}),e.createElementVNode("div",De,[e.createVNode(E,{bottom:""},{activator:e.withCtx(({props:v})=>[o.deletePermission?(e.openBlock(),e.createBlock(F,e.mergeProps({key:0,icon:"",variant:"text",size:"small"},{ref_for:!0},v,{onClick:S=>x(V,"")}),{default:e.withCtx(()=>[e.createVNode(B,{color:"red",size:"20"},{default:e.withCtx(()=>[...f[1]||(f[1]=[e.createTextVNode("mdi-delete-outline",-1)])]),_:1})]),_:1},16,["onClick"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(o.selectedLang[l.lang].delete),1)]),_:2},1024),e.createVNode(E,{bottom:""},{activator:e.withCtx(({props:v})=>[o.editPermission?(e.openBlock(),e.createBlock(F,e.mergeProps({key:0,icon:"",variant:"text",size:"small"},{ref_for:!0},v,{onClick:S=>k(g,V)}),{default:e.withCtx(()=>[e.createVNode(B,{color:"green",size:"20"},{default:e.withCtx(()=>[...f[2]||(f[2]=[e.createTextVNode("mdi-pencil-outline",-1)])]),_:1})]),_:1},16,["onClick"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(o.selectedLang[l.lang].edit),1)]),_:2},1024)]),e.createVNode(a,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",null,[e.createVNode(T),g.file.tags.length?(e.openBlock(),e.createBlock(s,{key:0,multiple:"","active-class":"primary--text",style:{padding:"8px"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.file.tags,(v,S)=>(e.openBlock(),e.createBlock(b,{key:`tag-${S}`,style:{margin:"5px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v),1)]),_:2},1024))),128))]),_:2},1024)):e.createCommentVNode("",!0),g.file.description?(e.openBlock(),e.createBlock(n,{key:1,style:{"text-align":"justify"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.file.description),1)]),_:2},1024)):e.createCommentVNode("",!0)],512),[[e.vShow,g.file.showDetailState]])]),_:2},1024)]),_:2},1032,["shaped","outlined","raised","tile"])]),_:2},1024))),128))]),_:1})])}}}),X=K(Te,[["__scopeId","data-v-f7000da4"]]),Y=e.defineComponent({__name:"InsertButton",props:{documentAttachment:{},badgeCounter:{type:Boolean},btnColor:{},lang:{},maxFileCount:{},selectedLang:{}},emits:["openInputDocumentModal"],setup(l,{emit:r}){const o=r,t=l,d=e.computed(()=>t.documentAttachment.length>=t.maxFileCount),C=()=>{o("openInputDocumentModal")};return(_,x)=>{const k=e.resolveComponent("v-btn"),p=e.resolveComponent("v-badge");return e.openBlock(),e.createElementBlock("div",null,[t.badgeCounter?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.documentAttachment.length>0?(e.openBlock(),e.createBlock(p,{key:0,bordered:"",color:d.value?"error":"success",overlap:"",content:l.documentAttachment.length},{default:e.withCtx(()=>[e.createVNode(k,{color:t.btnColor,disabled:d.value,onClick:C,class:"mb-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].insertFile),1)]),_:1},8,["color","disabled"])]),_:1},8,["color","content"])):(e.openBlock(),e.createBlock(k,{key:1,color:t.btnColor,disabled:d.value,onClick:C,class:"mb-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].insertFile),1)]),_:1},8,["color","disabled"]))],64)):e.createCommentVNode("",!0),t.badgeCounter?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(k,{key:1,color:l.btnColor,disabled:d.value,onClick:C,class:"mb-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].insertFile),1)]),_:1},8,["color","disabled"]))])}}});function Ee(l){const r=["simple","thumbnail","table"],o={isValid:!0,errors:[],warnings:[]};return typeof l!="string"?(o.isValid=!1,o.errors.push("File uploader type must be a string")):r.includes(l)||(o.isValid=!1,o.errors.push(`File uploader type must be one of: ${r.join(", ")}`)),o}function Se(l){const r=["default","outlined","shaped","raised","tile"],o={isValid:!0,errors:[],warnings:[]};return l!==void 0&&typeof l!="string"?(o.isValid=!1,o.errors.push("Card type must be a string")):l&&!r.includes(l)&&(o.isValid=!1,o.errors.push(`Card type must be one of: ${r.join(", ")}`)),o}function Ae(l){const r=["en","fa","fr","ch","ar"],o={isValid:!0,errors:[],warnings:[]};return typeof l!="string"?(o.isValid=!1,o.errors.push("Language code must be a string")):r.includes(l)||(o.isValid=!1,o.errors.push(`Language code must be one of: ${r.join(", ")}`)),o}function Le(l){const r={isValid:!0,errors:[],warnings:[]};return typeof l!="number"?(r.isValid=!1,r.errors.push("File size must be a number")):l<=0?(r.isValid=!1,r.errors.push("File size must be greater than 0")):l>100*1024*1024&&r.warnings.push("File size limit is very large (>100MB), consider reducing for better performance"),r}function $e(l){const r={isValid:!0,errors:[],warnings:[]};return typeof l!="number"?(r.isValid=!1,r.errors.push("File count must be a number")):l<0?(r.isValid=!1,r.errors.push("File count cannot be negative")):l>100&&r.warnings.push("File count limit is very high (>100), consider reducing for better performance"),r}function ze(l){const r={isValid:!0,errors:[],warnings:[]};return typeof l!="number"?(r.isValid=!1,r.errors.push("Compression level must be a number")):l<0||l>1?(r.isValid=!1,r.errors.push("Compression level must be between 0 and 1")):l<.1?r.warnings.push("Very low compression level may result in poor image quality"):l>.9&&r.warnings.push("Very high compression level may not reduce file size significantly"),r}function Ue(l){const r={isValid:!0,errors:[],warnings:[]};return l!==void 0&&typeof l!="string"?(r.isValid=!1,r.errors.push("File accept pattern must be a string")):l&&l.trim()===""&&r.warnings.push("Empty file accept pattern will accept all files"),r}function Ie(l){const r={isValid:!0,errors:[],warnings:[]};return typeof l!="number"?(r.isValid=!1,r.errors.push("Columns count must be a number")):(l<1||l>12)&&(r.isValid=!1,r.errors.push("Columns count must be between 1 and 12")),r}function Pe(l){const r={isValid:!0,errors:[],warnings:[]};return l!==void 0&&typeof l!="number"?(r.isValid=!1,r.errors.push("Table height must be a number")):l&&l<100?r.warnings.push("Table height is very small (<100px), content may not be visible"):l&&l>1e3&&r.warnings.push("Table height is very large (>1000px), consider reducing for better UX"),r}function je(l){const r={isValid:!0,errors:[],warnings:[]};return Array.isArray(l)?(l.forEach((o,t)=>{if(!o||typeof o!="object"){r.errors.push(`Attachment at index ${t} must be an object`);return}if(!o.file||typeof o.file!="object"){r.errors.push(`Attachment at index ${t} must have a file property`);return}const d=o.file;["name","format","base64","size"].forEach(_=>{_ in d||r.errors.push(`File at index ${t} is missing required field: ${_}`)}),d.name&&typeof d.name!="string"&&r.errors.push(`File name at index ${t} must be a string`),d.format&&typeof d.format!="string"&&r.errors.push(`File format at index ${t} must be a string`),d.base64&&typeof d.base64!="string"&&r.errors.push(`File base64 at index ${t} must be a string`),d.size&&typeof d.size!="number"&&r.errors.push(`File size at index ${t} must be a number`),d.tags&&!Array.isArray(d.tags)&&r.errors.push(`File tags at index ${t} must be an array`)}),r.errors.length>0&&(r.isValid=!1),r):(r.isValid=!1,r.errors.push("Document attachment must be an array"),r)}function Me(l){const r={isValid:!0,errors:[],warnings:[]};return[{key:"fileUploaderType",validator:Ee},{key:"cardType",validator:Se},{key:"lang",validator:Ae},{key:"maxFileSize",validator:Le},{key:"maxFileCount",validator:$e},{key:"imageCompressLevel",validator:ze},{key:"fileAccept",validator:Ue},{key:"cols",validator:Ie},{key:"tableHeight",validator:Pe},{key:"documentAttachment",validator:je}].forEach(({key:t,validator:d})=>{if(t in l){const C=d(l[t]);r.errors.push(...C.errors.map(_=>`${t}: ${_}`)),r.warnings.push(...C.warnings.map(_=>`${t}: ${_}`)),C.isValid||(r.isValid=!1)}}),r}const J=e.defineComponent({__name:"handyUploader",props:{documentAttachment:{},lang:{default:"en"},maxFileSize:{default:5242880},fileUploaderType:{default:"thumbnail"},maxFileCount:{default:10},badgeCounter:{type:Boolean,default:!0},btnColor:{default:"info"},imageCompressor:{type:Boolean},imageCompressLevel:{default:.8},fileAccept:{},thumb:{type:Boolean,default:!0},tableThumbColumn:{type:Boolean},tableFixedHeader:{type:Boolean,default:!0},tableHeight:{default:400},rtlSupport:{type:Boolean,default:!1},changeFileName:{type:Boolean,default:!1},addFileDescription:{type:Boolean,default:!1},addFileTag:{type:Boolean,default:!1},tags:{},customLang:{default:null},insertPermission:{type:Boolean,default:!0},cols:{default:3},editPermission:{type:Boolean,default:!0},deletePermission:{type:Boolean,default:!0},cardType:{default:"default"},outlined:{type:Boolean},raised:{type:Boolean},shaped:{type:Boolean},tile:{type:Boolean}},emits:["updateCardType","updateBadgeCounter","updateMaxFileCount","updateMaxFileSize","updateImageCompressor","updateImageCompressLevel","updateFileAccept","updateThumb","updateChangeFileName","updateAddFileDescription","updateTableThumbColumn","updateTableFixedHeader","updateTableHeight","updateLang","updateDocumentAttachment"],setup(l,{emit:r}){const o=l;if(process.env.NODE_ENV==="development"){const s=Me(o);s.isValid||console.error("HandyUploader prop validation failed:",s.errors),s.warnings.length>0&&console.warn("HandyUploader prop validation warnings:",s.warnings)}const t=e.reactive({insertDocumentDialog:!1,editDocumentDialog:!1,deleteDocumentDialog:!1,tempAttachment:[],tempAttachmentChanged:[],fileUploaderSnackBarAlert:!1,fileUploaderSnackText:"",fileUploaderSnackBarAlertColor:"green",readerFile:null,registryDocFile:[],documentAttachmentAPI:[],btnLoader:!1,showDetail:!1,showDetailState:[],selectedIndex:0,selectedId:"",returnedRecord:{},outlined:!1,raised:!1,shaped:!1,tile:!1,selectedLang:{},beforeInsertAttachments:{},attachmentIndex:0}),d=r;e.onBeforeMount(()=>{x(),t.registryDocFile=o.documentAttachment,o.rtlSupport&&k(),p()});let C=0;e.watch(()=>t.tempAttachment,async s=>{const n=++C;if(s&&s.length>0){t.btnLoader=!0;const a=await u.readFiles(s);if(n!==C||!t.insertDocumentDialog)return;t.tempAttachmentChanged=a,t.btnLoader=!1}else t.tempAttachmentChanged=[]}),e.watch(()=>o.cardType,s=>{d("updateCardType",s),p()}),e.watch(()=>o.badgeCounter,s=>{d("updateBadgeCounter",s)}),e.watch(()=>o.maxFileCount,s=>{d("updateMaxFileCount",s)}),e.watch(()=>o.maxFileSize,s=>{d("updateMaxFileSize",s)}),e.watch(()=>o.maxFileSize,s=>{d("updateMaxFileSize",s)}),e.watch(()=>o.imageCompressor,s=>{d("updateImageCompressor",s)}),e.watch(()=>o.imageCompressLevel,s=>{d("updateImageCompressLevel",s)}),e.watch(()=>o.fileAccept,s=>{d("updateFileAccept",s)}),e.watch(()=>o.thumb,s=>{d("updateThumb",s)}),e.watch(()=>o.changeFileName,s=>{d("updateChangeFileName",s)}),e.watch(()=>o.addFileDescription,s=>{d("updateAddFileDescription",s)}),e.watch(()=>o.addFileTag,s=>{d("updateAddFileDescription",s)}),e.watch(()=>o.tableThumbColumn,s=>{d("updateTableThumbColumn",s)}),e.watch(()=>o.tableFixedHeader,s=>{d("updateTableFixedHeader",s)}),e.watch(()=>o.tableHeight,s=>{d("updateTableHeight",s)}),e.watch(()=>o.lang,s=>{d("updateLang",s)}),e.onDeactivated(()=>{t.registryDocFile=[]});const _=()=>{t.btnLoader=!1,t.tempAttachment=[],t.insertDocumentDialog=!0},x=()=>{o.customLang!==null?t.selectedLang=o.customLang:t.selectedLang=u.languages},k=()=>{},p=()=>{const n={default:{outlined:!1,raised:!1,shaped:!1,tile:!1},outlined:{outlined:!0,raised:!1,shaped:!1,tile:!1},shaped:{outlined:!1,raised:!1,shaped:!0,tile:!1},raised:{outlined:!1,raised:!0,shaped:!1,tile:!1},tile:{outlined:!1,raised:!1,shaped:!1,tile:!0}}[o.cardType||"default"];t.outlined=n.outlined,t.raised=n.raised,t.shaped=n.shaped,t.tile=n.tile},f=(s,n)=>{t.fileUploaderSnackText=s,t.fileUploaderSnackBarAlertColor=n,t.fileUploaderSnackBarAlert=!0},B=s=>{const n=t.selectedLang[o.lang];switch(s.code){case"maxFileCount":return`${n.maxFileCountAlert} ${o.maxFileCount}`;case"maxFileSize":return`${n.maxFileSizeAlert} ${Number((o.maxFileSize/(1024*1024)).toFixed(1))} ${n.size.mb}`;default:return"File could not be processed due to an invalid format."}},b=async()=>{t.btnLoader=!0;const{accepted:s,errors:n}=await u.prepareAttachments(t.tempAttachmentChanged,{currentCount:o.documentAttachment.length,maxFileCount:o.maxFileCount,maxFileSize:o.maxFileSize,imageCompressor:o.imageCompressor,imageCompressLevel:o.imageCompressLevel});s.length>0&&(t.registryDocFile.push(...s),d("updateDocumentAttachment",t.registryDocFile));const a=n[n.length-1];a&&f(B(a),"red"),t.documentAttachmentAPI=[],t.tempAttachmentChanged=[],t.insertDocumentDialog=!1,t.btnLoader=!1},w=(s,n)=>{t.btnLoader=!1,t.selectedIndex=s,t.selectedId=n,t.deleteDocumentDialog=!0},T=()=>{t.registryDocFile.splice(t.selectedIndex,1),d("updateDocumentAttachment",t.registryDocFile),t.deleteDocumentDialog=!1},F=(s,n)=>{C++,t.btnLoader=!1,t.attachmentIndex=n,t.editDocumentDialog=!0,t.tempAttachmentChanged=[s]},E=()=>{const s=[...o.documentAttachment];s.splice(t.attachmentIndex,1,t.tempAttachmentChanged[0]),d("updateDocumentAttachment",s),t.editDocumentDialog=!1};return(s,n)=>{const a=e.resolveComponent("v-col"),i=e.resolveComponent("v-row"),c=e.resolveComponent("v-icon"),h=e.resolveComponent("v-card-title"),g=e.resolveComponent("v-file-input"),V=e.resolveComponent("v-expansion-panel-title"),v=e.resolveComponent("v-text-field"),S=e.resolveComponent("v-textarea"),U=e.resolveComponent("v-autocomplete"),P=e.resolveComponent("v-img"),L=e.resolveComponent("v-card"),j=e.resolveComponent("v-expansion-panel-text"),M=e.resolveComponent("v-expansion-panel"),H=e.resolveComponent("v-expansion-panels"),O=e.resolveComponent("v-list-item-title"),y=e.resolveComponent("v-list-item"),$=e.resolveComponent("v-card-text"),N=e.resolveComponent("v-btn"),z=e.resolveComponent("v-card-actions"),q=e.resolveComponent("v-dialog"),ee=e.resolveComponent("v-snackbar"),te=e.resolveComponent("v-spacer"),oe=e.resolveComponent("v-container");return e.openBlock(),e.createBlock(oe,null,{default:e.withCtx(()=>[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(a,{cols:"12",md:"12",xs:"12"},{default:e.withCtx(()=>[o.insertPermission?(e.openBlock(),e.createBlock(Y,{key:0,documentAttachment:o.documentAttachment,selectedLang:t.selectedLang,lang:o.lang,badgeCounter:o.badgeCounter,btnColor:o.btnColor,maxFileCount:o.maxFileCount,onOpenInputDocumentModal:_},null,8,["documentAttachment","selectedLang","lang","badgeCounter","btnColor","maxFileCount"])):e.createCommentVNode("",!0),o.fileUploaderType==="simple"?(e.openBlock(),e.createBlock(X,{key:1,documentAttachment:o.documentAttachment,cols:o.cols,thumb:o.thumb,outlined:t.outlined,raised:t.raised,shaped:t.shaped,tile:t.tile,lang:o.lang,cardType:o.cardType,deletePermission:o.deletePermission,editPermission:o.editPermission,selectedLang:t.selectedLang,onSetCardTheme:p,onOpenDeleteDialog:w,onOpenEditDocumentDialog:F},null,8,["documentAttachment","cols","thumb","outlined","raised","shaped","tile","lang","cardType","deletePermission","editPermission","selectedLang"])):e.createCommentVNode("",!0),o.fileUploaderType==="thumbnail"?(e.openBlock(),e.createBlock(R,{key:2,documentAttachment:o.documentAttachment,cols:o.cols,thumb:o.thumb,outlined:t.outlined,raised:t.raised,shaped:t.shaped,tile:t.tile,lang:o.lang,cardType:o.cardType,deletePermission:o.deletePermission,editPermission:o.editPermission,selectedLang:t.selectedLang,onSetCardTheme:p,onOpenDeleteDialog:n[0]||(n[0]=(m,A)=>w(m,A)),onOpenEditDocumentDialog:n[1]||(n[1]=(m,A)=>F(m,A))},null,8,["documentAttachment","cols","thumb","outlined","raised","shaped","tile","lang","cardType","deletePermission","editPermission","selectedLang"])):e.createCommentVNode("",!0),o.fileUploaderType==="table"?(e.openBlock(),e.createBlock(W,{key:3,documentAttachment:o.documentAttachment,cols:o.cols,thumb:o.thumb,outlined:t.outlined,raised:t.raised,shaped:t.shaped,tile:t.tile,lang:o.lang,tableThumbColumn:o.tableThumbColumn,tableFixedHeader:o.tableFixedHeader,tableHeight:o.tableHeight,cardType:o.cardType,deletePermission:o.deletePermission,editPermission:o.editPermission,selectedLang:t.selectedLang,onSetCardTheme:p,onOpenDeleteDialog:w,onOpenEditDocumentDialog:F},null,8,["documentAttachment","cols","thumb","outlined","raised","shaped","tile","lang","tableThumbColumn","tableFixedHeader","tableHeight","cardType","deletePermission","editPermission","selectedLang"])):e.createCommentVNode("",!0)]),_:1})]),_:1}),e.createVNode(i,{justify:"center"},{default:e.withCtx(()=>[e.createVNode(q,{modelValue:t.insertDocumentDialog,"onUpdate:modelValue":n[5]||(n[5]=m=>t.insertDocumentDialog=m),scrollable:!1,persistent:"",width:"50%"},{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(c,{onClick:n[2]||(n[2]=m=>t.insertDocumentDialog=!1)},{default:e.withCtx(()=>[...n[12]||(n[12]=[e.createTextVNode("mdi-close",-1)])]),_:1})]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[t.tempAttachment.length===0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.fileAccept!==""?(e.openBlock(),e.createBlock(g,{key:0,multiple:"",accept:o.fileAccept,chip:"",modelValue:t.tempAttachment,"onUpdate:modelValue":n[3]||(n[3]=m=>t.tempAttachment=m),label:t.selectedLang[l.lang].insertNewFile},null,8,["accept","modelValue","label"])):(e.openBlock(),e.createBlock(g,{key:1,multiple:"",modelValue:t.tempAttachment,"onUpdate:modelValue":n[4]||(n[4]=m=>t.tempAttachment=m),label:t.selectedLang[l.lang].insertNewFile},null,8,["modelValue","label"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[o.addFileTag||o.addFileDescription||o.changeFileName?(e.openBlock(),e.createBlock(H,{key:0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tempAttachmentChanged,(m,A)=>(e.openBlock(),e.createBlock(M,{key:`attachment-${A}`},{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.file.name),1)]),_:2},1024),e.createVNode(j,null,{default:e.withCtx(()=>[e.createVNode(i,{align:"center",justify:"center"},{default:e.withCtx(()=>[e.createVNode(a,{cols:"12",lg:"9",md:"9",xs:"12"},{default:e.withCtx(()=>[o.changeFileName?(e.openBlock(),e.createBlock(v,{key:0,label:t.selectedLang[l.lang].fileName,modelValue:m.file.name,"onUpdate:modelValue":D=>m.file.name=D},null,8,["label","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),o.addFileDescription?(e.openBlock(),e.createBlock(S,{key:1,label:t.selectedLang[l.lang].fileDescription,"auto-grow":"","row-height":"1",modelValue:m.file.description,"onUpdate:modelValue":D=>m.file.description=D},null,8,["label","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),o.addFileTag?(e.openBlock(),e.createBlock(U,{key:2,modelValue:m.file.tags,"onUpdate:modelValue":D=>m.file.tags=D,items:o.tags,dense:"",chips:"",label:t.selectedLang[l.lang].fileTags,multiple:""},null,8,["modelValue","onUpdate:modelValue","items","label"])):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(a,{align:"center",cols:"12",lg:"3",md:"3",xs:"12"},{default:e.withCtx(()=>[m.file.format==="jpg"||m.file.format==="jpeg"||m.file.format==="png"||m.file.format==="tif"||m.file.format==="bmp"?(e.openBlock(),e.createBlock(L,{key:0},{default:e.withCtx(()=>[e.createVNode(P,{src:"data:"+m.file.format+";base64,"+m.file.base64},null,8,["src"])]),_:2},1024)):(e.openBlock(),e.createBlock(I,{key:1,"file-format":m.file.format,size:60},null,8,["file-format"]))]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))]),_:1})):(e.openBlock(),e.createBlock(L,{key:1,class:"mx-auto",tile:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tempAttachmentChanged,(m,A)=>(e.openBlock(),e.createBlock(y,{key:`attachment-${A}`,style:{"border-bottom":"1px solid #E0E0E0"}},{default:e.withCtx(()=>[e.createVNode(O,null,{default:e.withCtx(()=>[e.createVNode(I,{"file-format":m.file.format,size:24},null,8,["file-format"]),e.createTextVNode(" "+e.toDisplayString(e.unref(u.joinFileName)(m.file.name,m.file.format)),1)]),_:2},1024)]),_:2},1024))),128))]),_:1}))],64))]),_:1}),e.createVNode(z,null,{default:e.withCtx(()=>[e.createVNode(N,{disabled:t.tempAttachment==null||t.btnLoader,loading:t.btnLoader,color:o.btnColor,onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].add),1)]),_:1},8,["disabled","loading","color"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),e.createVNode(i,{justify:"center"},{default:e.withCtx(()=>[e.createVNode(q,{modelValue:t.editDocumentDialog,"onUpdate:modelValue":n[7]||(n[7]=m=>t.editDocumentDialog=m),scrollable:!1,persistent:"",width:"50%"},{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(c,{onClick:n[6]||(n[6]=m=>t.editDocumentDialog=!1)},{default:e.withCtx(()=>[...n[13]||(n[13]=[e.createTextVNode("mdi-close",-1)])]),_:1})]),_:1}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tempAttachmentChanged,(m,A)=>(e.openBlock(),e.createBlock($,{key:`attachment-${A}`},{default:e.withCtx(()=>[e.createVNode(i,{align:"center",justify:"center"},{default:e.withCtx(()=>[e.createVNode(a,{cols:"12",lg:"9",md:"9",xs:"12"},{default:e.withCtx(()=>[o.changeFileName?(e.openBlock(),e.createBlock(v,{key:0,label:t.selectedLang[l.lang].fileName,modelValue:m.file.name,"onUpdate:modelValue":D=>m.file.name=D},null,8,["label","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),o.addFileDescription?(e.openBlock(),e.createBlock(S,{key:1,label:t.selectedLang[l.lang].fileDescription,"auto-grow":"","row-height":"1",modelValue:m.file.description,"onUpdate:modelValue":D=>m.file.description=D},null,8,["label","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),o.addFileTag?(e.openBlock(),e.createBlock(U,{key:2,modelValue:m.file.tags,"onUpdate:modelValue":D=>m.file.tags=D,items:o.tags,dense:"",chips:"",label:t.selectedLang[l.lang].fileTags,multiple:""},null,8,["modelValue","onUpdate:modelValue","items","label"])):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(a,{align:"center",cols:"12",lg:"3",md:"3",xs:"12"},{default:e.withCtx(()=>{var D;return[m.file.name&&["jpg","jpeg","png","tif","bmp"].includes(((D=m.file.name.split(".").pop())==null?void 0:D.toLowerCase())||"")?(e.openBlock(),e.createBlock(L,{key:0},{default:e.withCtx(()=>[e.createVNode(P,{src:"data:"+m.file.format+";base64,"+m.file.base64},null,8,["src"])]),_:2},1024)):(e.openBlock(),e.createBlock(I,{key:1,"file-format":m.file.format,size:60},null,8,["file-format"]))]}),_:2},1024)]),_:2},1024)]),_:2},1024))),128)),e.createVNode(z,null,{default:e.withCtx(()=>[e.createVNode(N,{disabled:t.tempAttachment===null||t.btnLoader,loading:t.btnLoader,color:o.btnColor,onClick:E},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].edit),1)]),_:1},8,["disabled","loading","color"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),e.createVNode(ee,{modelValue:t.fileUploaderSnackBarAlert,"onUpdate:modelValue":n[9]||(n[9]=m=>t.fileUploaderSnackBarAlert=m),right:"",bottom:"",color:t.fileUploaderSnackBarAlertColor,timeout:3e3},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.fileUploaderSnackText)+" ",1),e.createVNode(N,{color:"white",text:"",onClick:n[8]||(n[8]=m=>t.fileUploaderSnackBarAlert=!1)},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[...n[14]||(n[14]=[e.createTextVNode("mdi-close",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue","color"]),e.createVNode(i,{justify:"center"},{default:e.withCtx(()=>[e.createVNode(q,{modelValue:t.deleteDocumentDialog,"onUpdate:modelValue":n[11]||(n[11]=m=>t.deleteDocumentDialog=m),persistent:"",width:"30%"},{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(c,{color:"red"})]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].deleteDialog.message),1)]),_:1}),e.createVNode(z,null,{default:e.withCtx(()=>[e.createVNode(te),e.createVNode(N,{color:"green darken-1",text:"",onClick:n[10]||(n[10]=m=>t.deleteDocumentDialog=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].deleteDialog.cancel),1)]),_:1}),e.createVNode(N,{color:"primary",disabled:t.btnLoader,loading:t.btnLoader,onClick:T},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].delete),1)]),_:1},8,["disabled","loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})}}}),G=new Set;function Q(l,r){G.has(l)||(G.add(l),console.warn(`[handy-uploader] ${l}() is deprecated and will be removed in the next major version. Use ${r} instead.`))}function He(l,r={}){Q("useFileUpload","useUploader");const{maxFileSize:o=5*1024*1024,maxFileCount:t=10,imageCompressor:d=!1,imageCompressLevel:C=.8,fileAccept:_="*"}=r,x=e.ref(!1),k=e.ref({show:!1,text:"",color:"success"}),p=e.computed(()=>l.value.length),f=e.computed(()=>p.value<t),B=e.computed(()=>l.value.reduce((a,i)=>a+i.file.size,0));function b(a,i="success"){k.value={show:!0,text:a,color:i}}function w(a){var i;if(!u.validateFileSize(a.size,o))return{valid:!1,error:`File size exceeds maximum allowed size of ${(o/1048576).toFixed(1)}MB`};if(!u.validateFileCount(p.value,t))return{valid:!1,error:`Maximum file count of ${t} reached`};if(_!=="*"){const c=_.split(",").map(v=>v.trim()),h=`.${(i=a.name.split(".").pop())==null?void 0:i.toLowerCase()}`,g=a.type;if(!c.some(v=>v.startsWith(".")?v===h:v.includes("/*")?g.startsWith(v.replace("/*","")):v===g))return{valid:!1,error:`File type not accepted. Allowed types: ${_}`}}return{valid:!0}}async function T(a){let i;if(d&&u.isImageFile(a.name,a.type))try{i=(await u.compressImage(a,C)).split(",")[1]}catch(g){console.warn("Image compression failed, using original file:",g),i=await u.fileToBase64(a)}else i=await u.fileToBase64(a);const c=u.formatFileSize(a.size),h=u.getMimeTypeFromExtension(a.name);return{base64:i,size:c.text,name:a.name,tags:[],description:"",showDetailState:!1,format:h}}async function F(a){if(x.value)return!1;x.value=!0;const i=Array.from(a),c=[];for(const h of i){const g=w(h);g.valid?c.push(h):b(g.error,"error")}if(c.length===0)return x.value=!1,!1;try{const g=(await Promise.all(c.map(v=>T(v)))).map(v=>{var S;return{file:{name:v.name,format:v.format,base64:v.base64,size:((S=c.find(U=>U.name===v.name))==null?void 0:S.size)||0,tags:v.tags,description:v.description,showDetailState:v.showDetailState}}});l.value.push(...g);const V=c.length===1?`File "${c[0].name}" uploaded successfully`:`${c.length} files uploaded successfully`;return b(V,"success"),!0}catch(h){return console.error("File upload error:",h),b("Failed to upload files. Please try again.","error"),!1}finally{x.value=!1}}function E(a){if(a>=0&&a<l.value.length){const i=l.value[a];return l.value.splice(a,1),b(`File "${i.file.name}" removed`,"warning"),!0}return!1}function s(a,i){if(a>=0&&a<l.value.length){const c=l.value[a].file;return Object.assign(c,i),b("File updated successfully","success"),!0}return!1}function n(){const a=l.value.length;l.value.splice(0),b(`${a} files cleared`,"warning")}return{isUploading:x,snackbar:k,fileCount:p,canAddMoreFiles:f,totalSize:B,uploadFiles:F,removeFile:E,updateFileMetadata:s,clearAllFiles:n,validateFile:w,showSnackbar:b}}function Oe(l={}){Q("useErrorHandler","the errors from useUploader");const{maxErrors:r=10,autoRemoveTimeout:o=5e3,logToConsole:t=!0}=l,d=e.ref([]),C=e.ref(!1);function _(){return`error_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function x(i,c="error",h,g){const V={id:_(),message:i,type:c,timestamp:new Date,context:h,action:g};return t&&(c==="error"?console.error:c==="warning"?console.warn:c==="info"?console.info:console.log)(`[${c.toUpperCase()}] ${i}`,h||""),d.value.unshift(V),d.value.length>r&&(d.value=d.value.slice(0,r)),o>0&&setTimeout(()=>{k(V.id)},o),V.id}function k(i){const c=d.value.findIndex(h=>h.id===i);return c!==-1?(d.value.splice(c,1),!0):!1}function p(){d.value=[]}function f(i){d.value=d.value.filter(c=>c.type!==i)}async function B(i,c,h){C.value=!0;try{return await i()}catch(g){const V=c||(g instanceof Error?g.message:"An unexpected error occurred");return x(V,"error",{...h,originalError:g instanceof Error?g.message:String(g)}),null}finally{C.value=!1}}function b(i,c,h){return i||x(c,"error",h),i}function w(i,c){return x(i,"success",c)}function T(i,c){return x(i,"warning",c)}function F(i,c){return x(i,"info",c)}function E(i){return d.value.filter(c=>c.type===i)}function s(){return d.value[0]||null}function n(i){return i?d.value.some(c=>c.type===i):d.value.length>0}const a={fileSizeExceeded:(i,c)=>x(`File "${i}" exceeds maximum size of ${(c/(1024*1024)).toFixed(1)}MB`,"error",{fileName:i,maxSize:c,category:"file-upload"}),fileCountExceeded:i=>x(`Maximum file count of ${i} reached`,"error",{maxCount:i,category:"file-upload"}),invalidFileType:(i,c)=>x(`File "${i}" type not allowed. Accepted types: ${c}`,"error",{fileName:i,allowedTypes:c,category:"file-upload"}),uploadFailed:(i,c)=>x(`Failed to upload "${i}"${c?`: ${c}`:""}`,"error",{fileName:i,reason:c,category:"file-upload"}),compressionFailed:i=>x(`Image compression failed for "${i}", using original file`,"warning",{fileName:i,category:"file-upload"})};return{errors:d,isLoading:C,addError:x,removeError:k,clearErrors:p,clearErrorsByType:f,handleAsync:B,validate:b,showSuccess:w,showWarning:T,showInfo:F,getErrorsByType:E,getLatestError:s,hasErrors:n,fileUploadErrors:a}}const Z={ThumbnailUploader:R,TableUploader:W,SimpleUploader:X,HandyUploader:J,InsertButton:Y,SelectFileIconType:I};function qe(l){for(const[r,o]of Object.entries(Z))l.component(r,o)}exports.COMPRESSIBLE_EXTENSIONS=u.COMPRESSIBLE_EXTENSIONS;exports.base64ByteLength=u.base64ByteLength;exports.compressDataUrl=u.compressDataUrl;exports.compressImage=u.compressImage;exports.constructImageDataUrl=u.constructImageDataUrl;exports.createVideoThumbnailCache=u.createVideoThumbnailCache;exports.fileToBase64=u.fileToBase64;exports.filterByAccept=u.filterByAccept;exports.formatBytes=u.formatBytes;exports.formatFileSize=u.formatFileSize;exports.generateVideoThumbnail=u.generateVideoThumbnail;exports.getFileIcon=u.getFileIcon;exports.getFileType=u.getFileType;exports.getMimeTypeFromExtension=u.getMimeTypeFromExtension;exports.getVideoDataUrl=u.getVideoDataUrl;exports.isImageFile=u.isImageFile;exports.joinFileName=u.joinFileName;exports.languageData=u.languages;exports.matchesAccept=u.matchesAccept;exports.precheckFiles=u.precheckFiles;exports.prepareAttachments=u.prepareAttachments;exports.readFileAsDataUrl=u.readFileAsDataUrl;exports.readFiles=u.readFiles;exports.splitFileName=u.splitFileName;exports.validateFileCount=u.validateFileCount;exports.validateFileSize=u.validateFileSize;exports.HandyUploader=J;exports.InsertButton=Y;exports.SelectFileIconType=I;exports.SimpleUploader=X;exports.TableUploader=W;exports.ThumbnailUploader=R;exports.default=Z;exports.install=qe;exports.useErrorHandler=Oe;exports.useFileUpload=He;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("./language-fvWXvWRx.js"),I=e.defineComponent({__name:"SelectFileIconType",props:{fileFormat:{},size:{default:30}},setup(l){const r=l,o=e.computed(()=>{const t=`file.${r.fileFormat}`;return u.getDetailedFileIcon(t)});return(t,d)=>{const C=e.resolveComponent("v-icon");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(C,{size:r.size,color:o.value.color},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value.icon),1)]),_:1},8,["size","color"])])}}}),le={key:0,style:{height:"200px",display:"flex","align-items":"center","justify-content":"center","background-color":"#f5f5f5",overflow:"hidden"}},ne=["src","onError"],ae={key:1,style:{height:"200px","background-color":"#f5f5f5",position:"relative",overflow:"hidden",display:"flex","align-items":"center","justify-content":"center"}},re=["src","onError"],ie={key:1,style:{width:"100%",height:"100%",background:"#e0e0e0",display:"flex","align-items":"center","justify-content":"center"}},se={class:"d-flex justify-center align-center",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"rgba(0,0,0,0.7)","border-radius":"50%",width:"60px",height:"60px",cursor:"pointer"}},ce={key:2,class:"d-flex justify-center align-center",style:{height:"200px","background-color":"#f5f5f5"}},de={class:"BYekan"},ue={class:"BYekan"},me={key:0},R=e.defineComponent({__name:"ThumbnailUploader",props:{lang:{default:"en"},documentAttachment:{},thumb:{type:Boolean,default:!0},cols:{default:4},editPermission:{type:Boolean,default:!0},deletePermission:{type:Boolean,default:!0},selectedLang:{},cardType:{},outlined:{type:Boolean,default:!1},raised:{type:Boolean,default:!1},shaped:{type:Boolean,default:!1},tile:{type:Boolean,default:!1}},emits:["openDeleteDialog","openEditDocumentDialog"],setup(l,{emit:r}){const o=n=>{const a=u.isImageFile(n);return console.log("🔍 isImageFile check:",n,"→",a),a},t=l,d=r,C=n=>{const a=u.getFileType(n)==="video";return console.log("🎥 Checking if video file:",n,"result:",a,"fileType:",u.getFileType(n)),a},_=n=>{var i;if(!n.base64||!n.format)return console.error("❌ Missing base64 or format for:",n.name,{base64:!!n.base64,format:n.format}),"";const a=u.constructImageDataUrl(n.base64,n.format);return console.log("🖼️ Image source for:",n.name,{format:n.format,base64Length:((i=n.base64)==null?void 0:i.length)||0,srcLength:a.length,srcPreview:a.substring(0,100)+"..."}),a},x=n=>{var a;console.error("Image failed to load:",{name:n.name,format:n.format,base64Length:((a=n.base64)==null?void 0:a.length)||0})},k=e.ref(0),f=u.createVideoThumbnailCache(()=>k.value++),p=n=>(k.value,f.get(n)),w=n=>{console.error("Video thumbnail failed to load:",{name:n.name,format:n.format}),f.invalidate(n)},b=n=>({icon:u.getFileIconName(n),color:u.getFileIconColor(n)}),B=n=>n.tags.length>0||!!n.description,T=n=>{n.showDetailState=!n.showDetailState},F=(n,a)=>{d("openDeleteDialog",n,a)},E=(n,a)=>{d("openEditDocumentDialog",n,a)},c=()=>{if(f.retain(t.documentAttachment.map(a=>a.file)),!t.thumb)return;console.log("🎯 Generating thumbnails for videos, total attachments:",t.documentAttachment.length);const n=t.documentAttachment.filter(a=>C(a.file.name));console.log("📹 Found video attachments:",n.length,n.map(a=>a.file.name)),n.forEach(a=>{console.log("🎬 Processing video:",a.file.name),p(a.file)})};return e.watch(()=>t.documentAttachment,c,{immediate:!0}),e.onMounted(c),(n,a)=>{const i=e.resolveComponent("v-icon"),s=e.resolveComponent("v-card-subtitle"),h=e.resolveComponent("v-chip"),g=e.resolveComponent("v-divider"),V=e.resolveComponent("v-btn"),v=e.resolveComponent("v-tooltip"),S=e.resolveComponent("v-spacer"),U=e.resolveComponent("v-card-actions"),P=e.resolveComponent("v-chip-group"),L=e.resolveComponent("v-card-text"),j=e.resolveComponent("v-expand-transition"),M=e.resolveComponent("v-card"),H=e.resolveComponent("v-col"),O=e.resolveComponent("v-row");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(O,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.documentAttachment,(y,$)=>(e.openBlock(),e.createBlock(H,{key:`attachment-${$}`,cols:"12",md:l.cols,xs:"12"},{default:e.withCtx(()=>[e.createVNode(M,{shaped:l.shaped,outlined:l.outlined,raised:l.raised,tile:l.tile,class:"mx-auto","max-width":"344"},{default:e.withCtx(()=>[l.thumb&&o(y.file.name)?(e.openBlock(),e.createElementBlock("div",le,[e.createElementVNode("img",{src:_(y.file),style:{"max-width":"100%","max-height":"100%","object-fit":"contain"},onError:N=>x(y.file)},null,40,ne)])):l.thumb&&C(y.file.name)?(e.openBlock(),e.createElementBlock("div",ae,[p(y.file)?(e.openBlock(),e.createElementBlock("img",{key:0,src:p(y.file),style:{width:"100%",height:"100%","object-fit":"cover"},onError:N=>w(y.file)},null,40,re)):(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(i,{size:"60",color:"grey"},{default:e.withCtx(()=>[...a[0]||(a[0]=[e.createTextVNode("mdi-video",-1)])]),_:1})])),e.createElementVNode("div",se,[e.createVNode(i,{color:"white",size:"30"},{default:e.withCtx(()=>[...a[1]||(a[1]=[e.createTextVNode("mdi-play",-1)])]),_:1})])])):(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(i,{size:"120",color:b(y.file.name).color},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(b(y.file.name).icon),1)]),_:2},1032,["color"])])),e.createVNode(s,{class:"text-truncate py-2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.file.name),1)]),_:2},1024),e.createVNode(s,{class:"pt-2 pb-3"},{default:e.withCtx(()=>[e.createVNode(h,{color:e.unref(u.formatFileSize)(y.file.size).color,label:"","text-color":"white"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u.formatFileSize)(y.file.size).text)+" ",1),e.createVNode(i,{right:""},{default:e.withCtx(()=>[...a[2]||(a[2]=[e.createTextVNode("mdi-harddisk",-1)])]),_:1})]),_:2},1032,["color"])]),_:2},1024),e.createVNode(g,{class:"mx-4"}),e.createVNode(U,{style:{padding:"0"}},{default:e.withCtx(()=>[e.createVNode(v,{right:""},{activator:e.withCtx(({props:N})=>[l.deletePermission?(e.openBlock(),e.createBlock(V,e.mergeProps({key:0,text:"",fab:""},{ref_for:!0},N,{onClick:z=>F($,"")}),{default:e.withCtx(()=>[e.createVNode(i,{color:"red"},{default:e.withCtx(()=>[...a[3]||(a[3]=[e.createTextVNode("mdi-trash-can-outline",-1)])]),_:1})]),_:1},16,["onClick"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("span",de,e.toDisplayString(l.selectedLang[l.lang].delete),1)]),_:2},1024),e.createVNode(v,{right:""},{activator:e.withCtx(({props:N})=>[l.editPermission?(e.openBlock(),e.createBlock(V,e.mergeProps({key:0,text:"",fab:""},{ref_for:!0},N,{onClick:z=>E(y,$)}),{default:e.withCtx(()=>[e.createVNode(i,{color:"green"},{default:e.withCtx(()=>[...a[4]||(a[4]=[e.createTextVNode("mdi-pencil-outline",-1)])]),_:1})]),_:1},16,["onClick"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("span",ue,e.toDisplayString(l.selectedLang[l.lang].edit),1)]),_:2},1024),e.createVNode(S),B(y.file)?(e.openBlock(),e.createBlock(V,{key:0,icon:"",onClick:N=>T(y.file)},{default:e.withCtx(()=>[e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.file.showDetailState?"mdi-chevron-up":"mdi-chevron-down"),1)]),_:2},1024)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(j,null,{default:e.withCtx(()=>[B(y.file)?e.withDirectives((e.openBlock(),e.createElementBlock("div",me,[e.createVNode(g),y.file.tags.length?(e.openBlock(),e.createBlock(P,{key:0,multiple:"","active-class":"primary--text",class:"pa-2"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.file.tags,(N,z)=>(e.openBlock(),e.createBlock(h,{key:`tag-${z}`,class:"ma-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(N),1)]),_:2},1024))),128))]),_:2},1024)):e.createCommentVNode("",!0),y.file.description?(e.openBlock(),e.createBlock(L,{key:1,class:"text-justify"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.file.description),1)]),_:2},1024)):e.createCommentVNode("",!0)],512)),[[e.vShow,y.file.showDetailState]]):e.createCommentVNode("",!0)]),_:2},1024)]),_:2},1032,["shaped","outlined","raised","tile"])]),_:2},1032,["md"]))),128))]),_:1})])}}}),pe={class:"text-left",style:{width:"80px"}},fe={class:"text-center"},ge={class:"text-left",style:{width:"120px"}},he={class:"text-left",style:{width:"120px"}},ve={class:"text-center pa-3"},Ce={class:"text-left pa-3"},xe={class:"text-left pa-3"},ye={class:"text-center pa-2"},be={class:"d-flex justify-center ga-1"},_e=e.defineComponent({__name:"TableUploader",props:{documentAttachment:{},thumb:{type:Boolean,default:!0},lang:{default:"en"},cols:{default:4},editPermission:{type:Boolean,default:!0},deletePermission:{type:Boolean,default:!0},tableThumbColumn:{type:Boolean},tableFixedHeader:{type:Boolean,default:!0},tableHeight:{default:400},selectedLang:{}},emits:["openDeleteDialog","openEditDocumentDialog"],setup(l,{emit:r}){const o=l,t=r,d=f=>f?u.isImageFile(f):!1,C=f=>{const p=f/1e3,w=p/1024;return w>=1?`${w.toFixed(1)} MB`:`${p.toFixed(1)} KB`},_=f=>{const p=f/1024e3;return p<1?"success":p<5?"warning":"error"},x=(f,p)=>{t("openDeleteDialog",f,p)},k=(f,p)=>{t("openEditDocumentDialog",f,p)};return(f,p)=>{const w=e.resolveComponent("v-img"),b=e.resolveComponent("v-icon"),B=e.resolveComponent("v-tooltip"),T=e.resolveComponent("v-chip"),F=e.resolveComponent("v-btn"),E=e.resolveComponent("v-table"),c=e.resolveComponent("v-col"),n=e.resolveComponent("v-row");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(c,{cols:"12"},{default:e.withCtx(()=>[e.createVNode(E,{"fixed-header":o.tableFixedHeader,height:o.tableHeight+"px",class:"elevation-1"},{default:e.withCtx(()=>[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",pe,e.toDisplayString(o.selectedLang[l.lang].table.thumb),1),e.createElementVNode("th",fe,e.toDisplayString(o.selectedLang[l.lang].table.name),1),e.createElementVNode("th",ge,e.toDisplayString(o.selectedLang[l.lang].table.size),1),e.createElementVNode("th",he,e.toDisplayString(o.selectedLang[l.lang].table.action.action),1)])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.documentAttachment,(a,i)=>(e.openBlock(),e.createElementBlock("tr",{key:`attachment-${i}`,class:"table-row"},[e.createElementVNode("td",ve,[e.createVNode(B,{location:"top"},{activator:e.withCtx(({props:s})=>[e.createElementVNode("div",e.mergeProps({class:"d-flex justify-center align-center",style:{height:"60px",width:"60px"}},{ref_for:!0},s),[d(a.file.name)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.thumb&&a.file.base64?(e.openBlock(),e.createBlock(w,{key:0,style:{height:"40px",width:"40px"},src:"data:"+a.file.format+";base64,"+a.file.base64,height:"40",width:"40",class:"rounded",contain:""},null,8,["src"])):(e.openBlock(),e.createBlock(b,{key:1,size:"40",color:"deep-purple"},{default:e.withCtx(()=>[...p[0]||(p[0]=[e.createTextVNode(" mdi-file-image-outline ",-1)])]),_:1}))],64)):(e.openBlock(),e.createBlock(b,{key:1,icon:e.unref(u.getFileIconName)(a.file.name),color:e.unref(u.getFileIconColor)(a.file.name),size:"40"},null,8,["icon","color"]))],16)]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(a.file.name),1)]),_:2},1024)]),e.createElementVNode("td",Ce,[e.createVNode(B,{location:"top"},{activator:e.withCtx(({props:s})=>[e.createElementVNode("span",e.mergeProps({ref_for:!0},s),e.toDisplayString((()=>{const h=a.file.name.split(".").pop(),g=a.file.name.slice(0,a.file.name.lastIndexOf("."));return`${g.length>10?g.slice(0,10)+"...":g}.${h}`})()),17)]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(a.file.name),1)]),_:2},1024)]),e.createElementVNode("td",xe,[e.createVNode(T,{color:_(a.file.size),variant:"tonal",size:"small",class:"text-caption"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C(a.file.size)),1)]),_:2},1032,["color"])]),e.createElementVNode("td",ye,[e.createElementVNode("div",be,[l.editPermission?(e.openBlock(),e.createBlock(B,{key:0,location:"top"},{activator:e.withCtx(({props:s})=>[e.createVNode(F,e.mergeProps({icon:"",size:"small",color:"success",variant:"text"},{ref_for:!0},s,{onClick:h=>k(a,i)}),{default:e.withCtx(()=>[e.createVNode(b,{size:"18"},{default:e.withCtx(()=>[...p[1]||(p[1]=[e.createTextVNode("mdi-pencil-outline",-1)])]),_:1})]),_:1},16,["onClick"])]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(l.selectedLang[l.lang].edit),1)]),_:2},1024)):e.createCommentVNode("",!0),l.deletePermission?(e.openBlock(),e.createBlock(B,{key:1,location:"top"},{activator:e.withCtx(({props:s})=>[e.createVNode(F,e.mergeProps({icon:"",size:"small",color:"error",variant:"text"},{ref_for:!0},s,{onClick:h=>x(i,"")}),{default:e.withCtx(()=>[e.createVNode(b,{size:"18"},{default:e.withCtx(()=>[...p[2]||(p[2]=[e.createTextVNode("mdi-delete",-1)])]),_:1})]),_:1},16,["onClick"])]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(l.selectedLang[l.lang].table.action.deleteTooltip),1)]),_:2},1024)):e.createCommentVNode("",!0)])])]))),128))])]),_:1},8,["fixed-header","height"])]),_:1})]),_:1})])}}}),K=(l,r)=>{const o=l.__vccOpts||l;for(const[t,d]of r)o[t]=d;return o},W=K(_e,[["__scopeId","data-v-d05b814b"]]),Ve={class:"d-flex align-center pa-3",style:{height:"100%"}},ke={class:"flex-grow-1 pr-4",style:{"max-width":"60%"}},we={class:"text-subtitle-1 font-weight-medium mb-2",style:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","max-width":"100%"}},Be={class:"flex-shrink-0",style:{"min-width":"80px"}},Fe={key:0,class:"thumbnail-container"},Ne={key:1,class:"d-flex align-center justify-center"},De={class:"d-flex gap-2 pb-1"},Te=e.defineComponent({__name:"SimpleUploader",props:{documentAttachment:{},lang:{default:"en"},thumb:{type:Boolean,default:!0},cols:{default:4},editPermission:{type:Boolean,default:!0},cardType:{},outlined:{type:Boolean},raised:{type:Boolean},shaped:{type:Boolean},tile:{type:Boolean},deletePermission:{type:Boolean,default:!0},selectedLang:{}},emits:["setCardTheme","openDeleteDialog","openEditDocumentDialog"],setup(l,{emit:r}){const o=l,t=r,d=f=>{const p=f/1e3;return p<1024?`${p.toFixed(1)} ${o.selectedLang[o.lang].size.kb}`:`${(p/1024).toFixed(1)} ${o.selectedLang[o.lang].size.mb}`},C=f=>{var p;return["jpg","jpeg","png","tif","bmp"].includes(((p=f.split(".").pop())==null?void 0:p.toLowerCase())||"")},_=f=>f.base64?f.base64.startsWith("data:")?f.base64:`data:${f.format};base64,${f.base64}`:"",x=(f,p)=>t("openDeleteDialog",f,p),k=(f,p)=>t("openEditDocumentDialog",f,p);return(f,p)=>{const w=e.resolveComponent("v-icon"),b=e.resolveComponent("v-chip"),B=e.resolveComponent("v-img"),T=e.resolveComponent("v-divider"),F=e.resolveComponent("v-btn"),E=e.resolveComponent("v-tooltip"),c=e.resolveComponent("v-chip-group"),n=e.resolveComponent("v-card-text"),a=e.resolveComponent("v-expand-transition"),i=e.resolveComponent("v-card"),s=e.resolveComponent("v-col"),h=e.resolveComponent("v-row");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(h,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.documentAttachment,(g,V)=>(e.openBlock(),e.createBlock(s,{key:`attachment-${V}`,cols:"12",sm:"6",md:"4",lg:"3"},{default:e.withCtx(()=>[e.createVNode(i,{class:"file-card",shaped:o.shaped,outlined:o.outlined,raised:o.raised,tile:o.tile,height:"180"},{default:e.withCtx(()=>[e.createElementVNode("div",Ve,[e.createElementVNode("div",ke,[e.createElementVNode("div",we,e.toDisplayString(g.file.name),1),e.createVNode(b,{color:"teal",variant:"flat",size:"small",class:"text-white mb-2"},{default:e.withCtx(()=>[e.createVNode(w,{start:"",size:"16"},{default:e.withCtx(()=>[...p[0]||(p[0]=[e.createTextVNode("mdi-harddisk",-1)])]),_:1}),e.createTextVNode(" "+e.toDisplayString(d(g.file.size)),1)]),_:2},1024)]),e.createElementVNode("div",Be,[C(g.file.name)&&o.thumb?(e.openBlock(),e.createElementBlock("div",Fe,[e.createVNode(B,{src:_(g.file),height:"80",width:"80",cover:"",class:"rounded"},null,8,["src"])])):(e.openBlock(),e.createElementBlock("div",Ne,[e.createVNode(w,{color:e.unref(u.getFileIconColor)(g.file.name),size:"60"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u.getFileIconName)(g.file.name)),1)]),_:2},1032,["color"])]))])]),e.createVNode(T,{class:"my-2"}),e.createElementVNode("div",De,[e.createVNode(E,{bottom:""},{activator:e.withCtx(({props:v})=>[o.deletePermission?(e.openBlock(),e.createBlock(F,e.mergeProps({key:0,icon:"",variant:"text",size:"small"},{ref_for:!0},v,{onClick:S=>x(V,"")}),{default:e.withCtx(()=>[e.createVNode(w,{color:"red",size:"20"},{default:e.withCtx(()=>[...p[1]||(p[1]=[e.createTextVNode("mdi-delete-outline",-1)])]),_:1})]),_:1},16,["onClick"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(o.selectedLang[l.lang].delete),1)]),_:2},1024),e.createVNode(E,{bottom:""},{activator:e.withCtx(({props:v})=>[o.editPermission?(e.openBlock(),e.createBlock(F,e.mergeProps({key:0,icon:"",variant:"text",size:"small"},{ref_for:!0},v,{onClick:S=>k(g,V)}),{default:e.withCtx(()=>[e.createVNode(w,{color:"green",size:"20"},{default:e.withCtx(()=>[...p[2]||(p[2]=[e.createTextVNode("mdi-pencil-outline",-1)])]),_:1})]),_:1},16,["onClick"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(o.selectedLang[l.lang].edit),1)]),_:2},1024)]),e.createVNode(a,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",null,[e.createVNode(T),g.file.tags.length?(e.openBlock(),e.createBlock(c,{key:0,multiple:"","active-class":"primary--text",style:{padding:"8px"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.file.tags,(v,S)=>(e.openBlock(),e.createBlock(b,{key:`tag-${S}`,style:{margin:"5px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v),1)]),_:2},1024))),128))]),_:2},1024)):e.createCommentVNode("",!0),g.file.description?(e.openBlock(),e.createBlock(n,{key:1,style:{"text-align":"justify"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.file.description),1)]),_:2},1024)):e.createCommentVNode("",!0)],512),[[e.vShow,g.file.showDetailState]])]),_:2},1024)]),_:2},1032,["shaped","outlined","raised","tile"])]),_:2},1024))),128))]),_:1})])}}}),X=K(Te,[["__scopeId","data-v-f7000da4"]]),Y=e.defineComponent({__name:"InsertButton",props:{documentAttachment:{},badgeCounter:{type:Boolean},btnColor:{},lang:{},maxFileCount:{},selectedLang:{}},emits:["openInputDocumentModal"],setup(l,{emit:r}){const o=r,t=l,d=e.computed(()=>t.documentAttachment.length>=t.maxFileCount),C=()=>{o("openInputDocumentModal")};return(_,x)=>{const k=e.resolveComponent("v-btn"),f=e.resolveComponent("v-badge");return e.openBlock(),e.createElementBlock("div",null,[t.badgeCounter?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.documentAttachment.length>0?(e.openBlock(),e.createBlock(f,{key:0,bordered:"",color:d.value?"error":"success",overlap:"",content:l.documentAttachment.length},{default:e.withCtx(()=>[e.createVNode(k,{color:t.btnColor,disabled:d.value,onClick:C,class:"mb-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].insertFile),1)]),_:1},8,["color","disabled"])]),_:1},8,["color","content"])):(e.openBlock(),e.createBlock(k,{key:1,color:t.btnColor,disabled:d.value,onClick:C,class:"mb-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].insertFile),1)]),_:1},8,["color","disabled"]))],64)):e.createCommentVNode("",!0),t.badgeCounter?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(k,{key:1,color:l.btnColor,disabled:d.value,onClick:C,class:"mb-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].insertFile),1)]),_:1},8,["color","disabled"]))])}}});function Ee(l){const r=["simple","thumbnail","table"],o={isValid:!0,errors:[],warnings:[]};return typeof l!="string"?(o.isValid=!1,o.errors.push("File uploader type must be a string")):r.includes(l)||(o.isValid=!1,o.errors.push(`File uploader type must be one of: ${r.join(", ")}`)),o}function Se(l){const r=["default","outlined","shaped","raised","tile"],o={isValid:!0,errors:[],warnings:[]};return l!==void 0&&typeof l!="string"?(o.isValid=!1,o.errors.push("Card type must be a string")):l&&!r.includes(l)&&(o.isValid=!1,o.errors.push(`Card type must be one of: ${r.join(", ")}`)),o}function Ae(l){const r=["en","fa","fr","ch","ar"],o={isValid:!0,errors:[],warnings:[]};return typeof l!="string"?(o.isValid=!1,o.errors.push("Language code must be a string")):r.includes(l)||(o.isValid=!1,o.errors.push(`Language code must be one of: ${r.join(", ")}`)),o}function Le(l){const r={isValid:!0,errors:[],warnings:[]};return typeof l!="number"?(r.isValid=!1,r.errors.push("File size must be a number")):l<=0?(r.isValid=!1,r.errors.push("File size must be greater than 0")):l>100*1024*1024&&r.warnings.push("File size limit is very large (>100MB), consider reducing for better performance"),r}function $e(l){const r={isValid:!0,errors:[],warnings:[]};return typeof l!="number"?(r.isValid=!1,r.errors.push("File count must be a number")):l<0?(r.isValid=!1,r.errors.push("File count cannot be negative")):l>100&&r.warnings.push("File count limit is very high (>100), consider reducing for better performance"),r}function ze(l){const r={isValid:!0,errors:[],warnings:[]};return typeof l!="number"?(r.isValid=!1,r.errors.push("Compression level must be a number")):l<0||l>1?(r.isValid=!1,r.errors.push("Compression level must be between 0 and 1")):l<.1?r.warnings.push("Very low compression level may result in poor image quality"):l>.9&&r.warnings.push("Very high compression level may not reduce file size significantly"),r}function Ue(l){const r={isValid:!0,errors:[],warnings:[]};return l!==void 0&&typeof l!="string"?(r.isValid=!1,r.errors.push("File accept pattern must be a string")):l&&l.trim()===""&&r.warnings.push("Empty file accept pattern will accept all files"),r}function Ie(l){const r={isValid:!0,errors:[],warnings:[]};return typeof l!="number"?(r.isValid=!1,r.errors.push("Columns count must be a number")):(l<1||l>12)&&(r.isValid=!1,r.errors.push("Columns count must be between 1 and 12")),r}function Pe(l){const r={isValid:!0,errors:[],warnings:[]};return l!==void 0&&typeof l!="number"?(r.isValid=!1,r.errors.push("Table height must be a number")):l&&l<100?r.warnings.push("Table height is very small (<100px), content may not be visible"):l&&l>1e3&&r.warnings.push("Table height is very large (>1000px), consider reducing for better UX"),r}function je(l){const r={isValid:!0,errors:[],warnings:[]};return Array.isArray(l)?(l.forEach((o,t)=>{if(!o||typeof o!="object"){r.errors.push(`Attachment at index ${t} must be an object`);return}if(!o.file||typeof o.file!="object"){r.errors.push(`Attachment at index ${t} must have a file property`);return}const d=o.file;["name","format","base64","size"].forEach(_=>{_ in d||r.errors.push(`File at index ${t} is missing required field: ${_}`)}),d.name&&typeof d.name!="string"&&r.errors.push(`File name at index ${t} must be a string`),d.format&&typeof d.format!="string"&&r.errors.push(`File format at index ${t} must be a string`),d.base64&&typeof d.base64!="string"&&r.errors.push(`File base64 at index ${t} must be a string`),d.size&&typeof d.size!="number"&&r.errors.push(`File size at index ${t} must be a number`),d.tags&&!Array.isArray(d.tags)&&r.errors.push(`File tags at index ${t} must be an array`)}),r.errors.length>0&&(r.isValid=!1),r):(r.isValid=!1,r.errors.push("Document attachment must be an array"),r)}function Me(l){const r={isValid:!0,errors:[],warnings:[]};return[{key:"fileUploaderType",validator:Ee},{key:"cardType",validator:Se},{key:"lang",validator:Ae},{key:"maxFileSize",validator:Le},{key:"maxFileCount",validator:$e},{key:"imageCompressLevel",validator:ze},{key:"fileAccept",validator:Ue},{key:"cols",validator:Ie},{key:"tableHeight",validator:Pe},{key:"documentAttachment",validator:je}].forEach(({key:t,validator:d})=>{if(t in l){const C=d(l[t]);r.errors.push(...C.errors.map(_=>`${t}: ${_}`)),r.warnings.push(...C.warnings.map(_=>`${t}: ${_}`)),C.isValid||(r.isValid=!1)}}),r}const J=e.defineComponent({__name:"handyUploader",props:{documentAttachment:{},lang:{default:"en"},maxFileSize:{default:5242880},fileUploaderType:{default:"thumbnail"},maxFileCount:{default:10},badgeCounter:{type:Boolean,default:!0},btnColor:{default:"info"},imageCompressor:{type:Boolean},imageCompressLevel:{default:.8},fileAccept:{},thumb:{type:Boolean,default:!0},tableThumbColumn:{type:Boolean},tableFixedHeader:{type:Boolean,default:!0},tableHeight:{default:400},rtlSupport:{type:Boolean,default:!1},changeFileName:{type:Boolean,default:!1},addFileDescription:{type:Boolean,default:!1},addFileTag:{type:Boolean,default:!1},tags:{},customLang:{default:null},insertPermission:{type:Boolean,default:!0},cols:{default:3},editPermission:{type:Boolean,default:!0},deletePermission:{type:Boolean,default:!0},cardType:{default:"default"},outlined:{type:Boolean},raised:{type:Boolean},shaped:{type:Boolean},tile:{type:Boolean}},emits:["updateCardType","updateBadgeCounter","updateMaxFileCount","updateMaxFileSize","updateImageCompressor","updateImageCompressLevel","updateFileAccept","updateThumb","updateChangeFileName","updateAddFileDescription","updateTableThumbColumn","updateTableFixedHeader","updateTableHeight","updateLang","updateDocumentAttachment"],setup(l,{emit:r}){const o=l;if(process.env.NODE_ENV==="development"){const c=Me(o);c.isValid||console.error("HandyUploader prop validation failed:",c.errors),c.warnings.length>0&&console.warn("HandyUploader prop validation warnings:",c.warnings)}const t=e.reactive({insertDocumentDialog:!1,editDocumentDialog:!1,deleteDocumentDialog:!1,tempAttachment:[],tempAttachmentChanged:[],fileUploaderSnackBarAlert:!1,fileUploaderSnackText:"",fileUploaderSnackBarAlertColor:"green",readerFile:null,registryDocFile:[],documentAttachmentAPI:[],btnLoader:!1,showDetail:!1,showDetailState:[],selectedIndex:0,selectedId:"",returnedRecord:{},outlined:!1,raised:!1,shaped:!1,tile:!1,selectedLang:{},beforeInsertAttachments:{},attachmentIndex:0}),d=r;e.onBeforeMount(()=>{x(),t.registryDocFile=o.documentAttachment,o.rtlSupport&&k(),f()});let C=0;e.watch(()=>t.tempAttachment,async c=>{const n=++C;if(c&&c.length>0){const{accepted:a,errors:i}=u.filterByAccept(c,o.fileAccept),s=i[i.length-1];if(s&&p(w(s),"red"),a.length===0){t.tempAttachment=[];return}t.btnLoader=!0;const h=await u.readFiles(a);if(n!==C||!t.insertDocumentDialog)return;t.tempAttachmentChanged=h,t.btnLoader=!1}else t.tempAttachmentChanged=[]}),e.watch(()=>o.cardType,c=>{d("updateCardType",c),f()}),e.watch(()=>o.badgeCounter,c=>{d("updateBadgeCounter",c)}),e.watch(()=>o.maxFileCount,c=>{d("updateMaxFileCount",c)}),e.watch(()=>o.maxFileSize,c=>{d("updateMaxFileSize",c)}),e.watch(()=>o.maxFileSize,c=>{d("updateMaxFileSize",c)}),e.watch(()=>o.imageCompressor,c=>{d("updateImageCompressor",c)}),e.watch(()=>o.imageCompressLevel,c=>{d("updateImageCompressLevel",c)}),e.watch(()=>o.fileAccept,c=>{d("updateFileAccept",c)}),e.watch(()=>o.thumb,c=>{d("updateThumb",c)}),e.watch(()=>o.changeFileName,c=>{d("updateChangeFileName",c)}),e.watch(()=>o.addFileDescription,c=>{d("updateAddFileDescription",c)}),e.watch(()=>o.addFileTag,c=>{d("updateAddFileDescription",c)}),e.watch(()=>o.tableThumbColumn,c=>{d("updateTableThumbColumn",c)}),e.watch(()=>o.tableFixedHeader,c=>{d("updateTableFixedHeader",c)}),e.watch(()=>o.tableHeight,c=>{d("updateTableHeight",c)}),e.watch(()=>o.lang,c=>{d("updateLang",c)}),e.onDeactivated(()=>{t.registryDocFile=[]});const _=()=>{t.btnLoader=!1,t.tempAttachment=[],t.insertDocumentDialog=!0},x=()=>{o.customLang!==null?t.selectedLang=o.customLang:t.selectedLang=u.languages},k=()=>{},f=()=>{const n={default:{outlined:!1,raised:!1,shaped:!1,tile:!1},outlined:{outlined:!0,raised:!1,shaped:!1,tile:!1},shaped:{outlined:!1,raised:!1,shaped:!0,tile:!1},raised:{outlined:!1,raised:!0,shaped:!1,tile:!1},tile:{outlined:!1,raised:!1,shaped:!1,tile:!0}}[o.cardType||"default"];t.outlined=n.outlined,t.raised=n.raised,t.shaped=n.shaped,t.tile=n.tile},p=(c,n)=>{t.fileUploaderSnackText=c,t.fileUploaderSnackBarAlertColor=n,t.fileUploaderSnackBarAlert=!0},w=c=>{const n=t.selectedLang[o.lang];switch(c.code){case"maxFileCount":return`${n.maxFileCountAlert} ${o.maxFileCount}`;case"maxFileSize":return`${n.maxFileSizeAlert} ${Number((o.maxFileSize/(1024*1024)).toFixed(1))} ${n.size.mb}`;case"fileType":return`${c.fileName}: ${n.fileTypeAlert??"File type is not allowed"}`;default:return"File could not be processed due to an invalid format."}},b=async()=>{t.btnLoader=!0;const{accepted:c,errors:n}=await u.prepareAttachments(t.tempAttachmentChanged,{currentCount:o.documentAttachment.length,maxFileCount:o.maxFileCount,maxFileSize:o.maxFileSize,imageCompressor:o.imageCompressor,imageCompressLevel:o.imageCompressLevel});c.length>0&&(t.registryDocFile.push(...c),d("updateDocumentAttachment",t.registryDocFile));const a=n[n.length-1];a&&p(w(a),"red"),t.documentAttachmentAPI=[],t.tempAttachmentChanged=[],t.insertDocumentDialog=!1,t.btnLoader=!1},B=(c,n)=>{t.btnLoader=!1,t.selectedIndex=c,t.selectedId=n,t.deleteDocumentDialog=!0},T=()=>{t.registryDocFile.splice(t.selectedIndex,1),d("updateDocumentAttachment",t.registryDocFile),t.deleteDocumentDialog=!1},F=(c,n)=>{C++,t.btnLoader=!1,t.attachmentIndex=n,t.editDocumentDialog=!0,t.tempAttachmentChanged=[c]},E=()=>{const c=[...o.documentAttachment];c.splice(t.attachmentIndex,1,t.tempAttachmentChanged[0]),d("updateDocumentAttachment",c),t.editDocumentDialog=!1};return(c,n)=>{const a=e.resolveComponent("v-col"),i=e.resolveComponent("v-row"),s=e.resolveComponent("v-icon"),h=e.resolveComponent("v-card-title"),g=e.resolveComponent("v-file-input"),V=e.resolveComponent("v-expansion-panel-title"),v=e.resolveComponent("v-text-field"),S=e.resolveComponent("v-textarea"),U=e.resolveComponent("v-autocomplete"),P=e.resolveComponent("v-img"),L=e.resolveComponent("v-card"),j=e.resolveComponent("v-expansion-panel-text"),M=e.resolveComponent("v-expansion-panel"),H=e.resolveComponent("v-expansion-panels"),O=e.resolveComponent("v-list-item-title"),y=e.resolveComponent("v-list-item"),$=e.resolveComponent("v-card-text"),N=e.resolveComponent("v-btn"),z=e.resolveComponent("v-card-actions"),q=e.resolveComponent("v-dialog"),ee=e.resolveComponent("v-snackbar"),te=e.resolveComponent("v-spacer"),oe=e.resolveComponent("v-container");return e.openBlock(),e.createBlock(oe,null,{default:e.withCtx(()=>[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(a,{cols:"12",md:"12",xs:"12"},{default:e.withCtx(()=>[o.insertPermission?(e.openBlock(),e.createBlock(Y,{key:0,documentAttachment:o.documentAttachment,selectedLang:t.selectedLang,lang:o.lang,badgeCounter:o.badgeCounter,btnColor:o.btnColor,maxFileCount:o.maxFileCount,onOpenInputDocumentModal:_},null,8,["documentAttachment","selectedLang","lang","badgeCounter","btnColor","maxFileCount"])):e.createCommentVNode("",!0),o.fileUploaderType==="simple"?(e.openBlock(),e.createBlock(X,{key:1,documentAttachment:o.documentAttachment,cols:o.cols,thumb:o.thumb,outlined:t.outlined,raised:t.raised,shaped:t.shaped,tile:t.tile,lang:o.lang,cardType:o.cardType,deletePermission:o.deletePermission,editPermission:o.editPermission,selectedLang:t.selectedLang,onSetCardTheme:f,onOpenDeleteDialog:B,onOpenEditDocumentDialog:F},null,8,["documentAttachment","cols","thumb","outlined","raised","shaped","tile","lang","cardType","deletePermission","editPermission","selectedLang"])):e.createCommentVNode("",!0),o.fileUploaderType==="thumbnail"?(e.openBlock(),e.createBlock(R,{key:2,documentAttachment:o.documentAttachment,cols:o.cols,thumb:o.thumb,outlined:t.outlined,raised:t.raised,shaped:t.shaped,tile:t.tile,lang:o.lang,cardType:o.cardType,deletePermission:o.deletePermission,editPermission:o.editPermission,selectedLang:t.selectedLang,onSetCardTheme:f,onOpenDeleteDialog:n[0]||(n[0]=(m,A)=>B(m,A)),onOpenEditDocumentDialog:n[1]||(n[1]=(m,A)=>F(m,A))},null,8,["documentAttachment","cols","thumb","outlined","raised","shaped","tile","lang","cardType","deletePermission","editPermission","selectedLang"])):e.createCommentVNode("",!0),o.fileUploaderType==="table"?(e.openBlock(),e.createBlock(W,{key:3,documentAttachment:o.documentAttachment,cols:o.cols,thumb:o.thumb,outlined:t.outlined,raised:t.raised,shaped:t.shaped,tile:t.tile,lang:o.lang,tableThumbColumn:o.tableThumbColumn,tableFixedHeader:o.tableFixedHeader,tableHeight:o.tableHeight,cardType:o.cardType,deletePermission:o.deletePermission,editPermission:o.editPermission,selectedLang:t.selectedLang,onSetCardTheme:f,onOpenDeleteDialog:B,onOpenEditDocumentDialog:F},null,8,["documentAttachment","cols","thumb","outlined","raised","shaped","tile","lang","tableThumbColumn","tableFixedHeader","tableHeight","cardType","deletePermission","editPermission","selectedLang"])):e.createCommentVNode("",!0)]),_:1})]),_:1}),e.createVNode(i,{justify:"center"},{default:e.withCtx(()=>[e.createVNode(q,{modelValue:t.insertDocumentDialog,"onUpdate:modelValue":n[5]||(n[5]=m=>t.insertDocumentDialog=m),scrollable:!1,persistent:"",width:"50%"},{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(s,{onClick:n[2]||(n[2]=m=>t.insertDocumentDialog=!1)},{default:e.withCtx(()=>[...n[12]||(n[12]=[e.createTextVNode("mdi-close",-1)])]),_:1})]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[t.tempAttachment.length===0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.fileAccept!==""?(e.openBlock(),e.createBlock(g,{key:0,multiple:"",accept:o.fileAccept,chip:"",modelValue:t.tempAttachment,"onUpdate:modelValue":n[3]||(n[3]=m=>t.tempAttachment=m),label:t.selectedLang[l.lang].insertNewFile},null,8,["accept","modelValue","label"])):(e.openBlock(),e.createBlock(g,{key:1,multiple:"",modelValue:t.tempAttachment,"onUpdate:modelValue":n[4]||(n[4]=m=>t.tempAttachment=m),label:t.selectedLang[l.lang].insertNewFile},null,8,["modelValue","label"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[o.addFileTag||o.addFileDescription||o.changeFileName?(e.openBlock(),e.createBlock(H,{key:0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tempAttachmentChanged,(m,A)=>(e.openBlock(),e.createBlock(M,{key:`attachment-${A}`},{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.file.name),1)]),_:2},1024),e.createVNode(j,null,{default:e.withCtx(()=>[e.createVNode(i,{align:"center",justify:"center"},{default:e.withCtx(()=>[e.createVNode(a,{cols:"12",lg:"9",md:"9",xs:"12"},{default:e.withCtx(()=>[o.changeFileName?(e.openBlock(),e.createBlock(v,{key:0,label:t.selectedLang[l.lang].fileName,modelValue:m.file.name,"onUpdate:modelValue":D=>m.file.name=D},null,8,["label","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),o.addFileDescription?(e.openBlock(),e.createBlock(S,{key:1,label:t.selectedLang[l.lang].fileDescription,"auto-grow":"","row-height":"1",modelValue:m.file.description,"onUpdate:modelValue":D=>m.file.description=D},null,8,["label","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),o.addFileTag?(e.openBlock(),e.createBlock(U,{key:2,modelValue:m.file.tags,"onUpdate:modelValue":D=>m.file.tags=D,items:o.tags,dense:"",chips:"",label:t.selectedLang[l.lang].fileTags,multiple:""},null,8,["modelValue","onUpdate:modelValue","items","label"])):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(a,{align:"center",cols:"12",lg:"3",md:"3",xs:"12"},{default:e.withCtx(()=>[m.file.format==="jpg"||m.file.format==="jpeg"||m.file.format==="png"||m.file.format==="tif"||m.file.format==="bmp"?(e.openBlock(),e.createBlock(L,{key:0},{default:e.withCtx(()=>[e.createVNode(P,{src:"data:"+m.file.format+";base64,"+m.file.base64},null,8,["src"])]),_:2},1024)):(e.openBlock(),e.createBlock(I,{key:1,"file-format":m.file.format,size:60},null,8,["file-format"]))]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))]),_:1})):(e.openBlock(),e.createBlock(L,{key:1,class:"mx-auto",tile:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tempAttachmentChanged,(m,A)=>(e.openBlock(),e.createBlock(y,{key:`attachment-${A}`,style:{"border-bottom":"1px solid #E0E0E0"}},{default:e.withCtx(()=>[e.createVNode(O,null,{default:e.withCtx(()=>[e.createVNode(I,{"file-format":m.file.format,size:24},null,8,["file-format"]),e.createTextVNode(" "+e.toDisplayString(e.unref(u.joinFileName)(m.file.name,m.file.format)),1)]),_:2},1024)]),_:2},1024))),128))]),_:1}))],64))]),_:1}),e.createVNode(z,null,{default:e.withCtx(()=>[e.createVNode(N,{disabled:t.tempAttachment==null||t.btnLoader,loading:t.btnLoader,color:o.btnColor,onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].add),1)]),_:1},8,["disabled","loading","color"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),e.createVNode(i,{justify:"center"},{default:e.withCtx(()=>[e.createVNode(q,{modelValue:t.editDocumentDialog,"onUpdate:modelValue":n[7]||(n[7]=m=>t.editDocumentDialog=m),scrollable:!1,persistent:"",width:"50%"},{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(s,{onClick:n[6]||(n[6]=m=>t.editDocumentDialog=!1)},{default:e.withCtx(()=>[...n[13]||(n[13]=[e.createTextVNode("mdi-close",-1)])]),_:1})]),_:1}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tempAttachmentChanged,(m,A)=>(e.openBlock(),e.createBlock($,{key:`attachment-${A}`},{default:e.withCtx(()=>[e.createVNode(i,{align:"center",justify:"center"},{default:e.withCtx(()=>[e.createVNode(a,{cols:"12",lg:"9",md:"9",xs:"12"},{default:e.withCtx(()=>[o.changeFileName?(e.openBlock(),e.createBlock(v,{key:0,label:t.selectedLang[l.lang].fileName,modelValue:m.file.name,"onUpdate:modelValue":D=>m.file.name=D},null,8,["label","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),o.addFileDescription?(e.openBlock(),e.createBlock(S,{key:1,label:t.selectedLang[l.lang].fileDescription,"auto-grow":"","row-height":"1",modelValue:m.file.description,"onUpdate:modelValue":D=>m.file.description=D},null,8,["label","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),o.addFileTag?(e.openBlock(),e.createBlock(U,{key:2,modelValue:m.file.tags,"onUpdate:modelValue":D=>m.file.tags=D,items:o.tags,dense:"",chips:"",label:t.selectedLang[l.lang].fileTags,multiple:""},null,8,["modelValue","onUpdate:modelValue","items","label"])):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(a,{align:"center",cols:"12",lg:"3",md:"3",xs:"12"},{default:e.withCtx(()=>{var D;return[m.file.name&&["jpg","jpeg","png","tif","bmp"].includes(((D=m.file.name.split(".").pop())==null?void 0:D.toLowerCase())||"")?(e.openBlock(),e.createBlock(L,{key:0},{default:e.withCtx(()=>[e.createVNode(P,{src:"data:"+m.file.format+";base64,"+m.file.base64},null,8,["src"])]),_:2},1024)):(e.openBlock(),e.createBlock(I,{key:1,"file-format":m.file.format,size:60},null,8,["file-format"]))]}),_:2},1024)]),_:2},1024)]),_:2},1024))),128)),e.createVNode(z,null,{default:e.withCtx(()=>[e.createVNode(N,{disabled:t.tempAttachment===null||t.btnLoader,loading:t.btnLoader,color:o.btnColor,onClick:E},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].edit),1)]),_:1},8,["disabled","loading","color"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),e.createVNode(ee,{modelValue:t.fileUploaderSnackBarAlert,"onUpdate:modelValue":n[9]||(n[9]=m=>t.fileUploaderSnackBarAlert=m),right:"",bottom:"",color:t.fileUploaderSnackBarAlertColor,timeout:3e3},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.fileUploaderSnackText)+" ",1),e.createVNode(N,{color:"white",text:"",onClick:n[8]||(n[8]=m=>t.fileUploaderSnackBarAlert=!1)},{default:e.withCtx(()=>[e.createVNode(s,null,{default:e.withCtx(()=>[...n[14]||(n[14]=[e.createTextVNode("mdi-close",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue","color"]),e.createVNode(i,{justify:"center"},{default:e.withCtx(()=>[e.createVNode(q,{modelValue:t.deleteDocumentDialog,"onUpdate:modelValue":n[11]||(n[11]=m=>t.deleteDocumentDialog=m),persistent:"",width:"30%"},{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(s,{color:"red"})]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].deleteDialog.message),1)]),_:1}),e.createVNode(z,null,{default:e.withCtx(()=>[e.createVNode(te),e.createVNode(N,{color:"green darken-1",text:"",onClick:n[10]||(n[10]=m=>t.deleteDocumentDialog=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].deleteDialog.cancel),1)]),_:1}),e.createVNode(N,{color:"primary",disabled:t.btnLoader,loading:t.btnLoader,onClick:T},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].delete),1)]),_:1},8,["disabled","loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})}}}),G=new Set;function Q(l,r){G.has(l)||(G.add(l),console.warn(`[handy-uploader] ${l}() is deprecated and will be removed in the next major version. Use ${r} instead.`))}function He(l,r={}){Q("useFileUpload","useUploader");const{maxFileSize:o=5*1024*1024,maxFileCount:t=10,imageCompressor:d=!1,imageCompressLevel:C=.8,fileAccept:_="*"}=r,x=e.ref(!1),k=e.ref({show:!1,text:"",color:"success"}),f=e.computed(()=>l.value.length),p=e.computed(()=>f.value<t),w=e.computed(()=>l.value.reduce((a,i)=>a+i.file.size,0));function b(a,i="success"){k.value={show:!0,text:a,color:i}}function B(a){var i;if(!u.validateFileSize(a.size,o))return{valid:!1,error:`File size exceeds maximum allowed size of ${(o/1048576).toFixed(1)}MB`};if(!u.validateFileCount(f.value,t))return{valid:!1,error:`Maximum file count of ${t} reached`};if(_!=="*"){const s=_.split(",").map(v=>v.trim()),h=`.${(i=a.name.split(".").pop())==null?void 0:i.toLowerCase()}`,g=a.type;if(!s.some(v=>v.startsWith(".")?v===h:v.includes("/*")?g.startsWith(v.replace("/*","")):v===g))return{valid:!1,error:`File type not accepted. Allowed types: ${_}`}}return{valid:!0}}async function T(a){let i;if(d&&u.isImageFile(a.name,a.type))try{i=(await u.compressImage(a,C)).split(",")[1]}catch(g){console.warn("Image compression failed, using original file:",g),i=await u.fileToBase64(a)}else i=await u.fileToBase64(a);const s=u.formatFileSize(a.size),h=u.getMimeTypeFromExtension(a.name);return{base64:i,size:s.text,name:a.name,tags:[],description:"",showDetailState:!1,format:h}}async function F(a){if(x.value)return!1;x.value=!0;const i=Array.from(a),s=[];for(const h of i){const g=B(h);g.valid?s.push(h):b(g.error,"error")}if(s.length===0)return x.value=!1,!1;try{const g=(await Promise.all(s.map(v=>T(v)))).map(v=>{var S;return{file:{name:v.name,format:v.format,base64:v.base64,size:((S=s.find(U=>U.name===v.name))==null?void 0:S.size)||0,tags:v.tags,description:v.description,showDetailState:v.showDetailState}}});l.value.push(...g);const V=s.length===1?`File "${s[0].name}" uploaded successfully`:`${s.length} files uploaded successfully`;return b(V,"success"),!0}catch(h){return console.error("File upload error:",h),b("Failed to upload files. Please try again.","error"),!1}finally{x.value=!1}}function E(a){if(a>=0&&a<l.value.length){const i=l.value[a];return l.value.splice(a,1),b(`File "${i.file.name}" removed`,"warning"),!0}return!1}function c(a,i){if(a>=0&&a<l.value.length){const s=l.value[a].file;return Object.assign(s,i),b("File updated successfully","success"),!0}return!1}function n(){const a=l.value.length;l.value.splice(0),b(`${a} files cleared`,"warning")}return{isUploading:x,snackbar:k,fileCount:f,canAddMoreFiles:p,totalSize:w,uploadFiles:F,removeFile:E,updateFileMetadata:c,clearAllFiles:n,validateFile:B,showSnackbar:b}}function Oe(l={}){Q("useErrorHandler","the errors from useUploader");const{maxErrors:r=10,autoRemoveTimeout:o=5e3,logToConsole:t=!0}=l,d=e.ref([]),C=e.ref(!1);function _(){return`error_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function x(i,s="error",h,g){const V={id:_(),message:i,type:s,timestamp:new Date,context:h,action:g};return t&&(s==="error"?console.error:s==="warning"?console.warn:s==="info"?console.info:console.log)(`[${s.toUpperCase()}] ${i}`,h||""),d.value.unshift(V),d.value.length>r&&(d.value=d.value.slice(0,r)),o>0&&setTimeout(()=>{k(V.id)},o),V.id}function k(i){const s=d.value.findIndex(h=>h.id===i);return s!==-1?(d.value.splice(s,1),!0):!1}function f(){d.value=[]}function p(i){d.value=d.value.filter(s=>s.type!==i)}async function w(i,s,h){C.value=!0;try{return await i()}catch(g){const V=s||(g instanceof Error?g.message:"An unexpected error occurred");return x(V,"error",{...h,originalError:g instanceof Error?g.message:String(g)}),null}finally{C.value=!1}}function b(i,s,h){return i||x(s,"error",h),i}function B(i,s){return x(i,"success",s)}function T(i,s){return x(i,"warning",s)}function F(i,s){return x(i,"info",s)}function E(i){return d.value.filter(s=>s.type===i)}function c(){return d.value[0]||null}function n(i){return i?d.value.some(s=>s.type===i):d.value.length>0}const a={fileSizeExceeded:(i,s)=>x(`File "${i}" exceeds maximum size of ${(s/(1024*1024)).toFixed(1)}MB`,"error",{fileName:i,maxSize:s,category:"file-upload"}),fileCountExceeded:i=>x(`Maximum file count of ${i} reached`,"error",{maxCount:i,category:"file-upload"}),invalidFileType:(i,s)=>x(`File "${i}" type not allowed. Accepted types: ${s}`,"error",{fileName:i,allowedTypes:s,category:"file-upload"}),uploadFailed:(i,s)=>x(`Failed to upload "${i}"${s?`: ${s}`:""}`,"error",{fileName:i,reason:s,category:"file-upload"}),compressionFailed:i=>x(`Image compression failed for "${i}", using original file`,"warning",{fileName:i,category:"file-upload"})};return{errors:d,isLoading:C,addError:x,removeError:k,clearErrors:f,clearErrorsByType:p,handleAsync:w,validate:b,showSuccess:B,showWarning:T,showInfo:F,getErrorsByType:E,getLatestError:c,hasErrors:n,fileUploadErrors:a}}const Z={ThumbnailUploader:R,TableUploader:W,SimpleUploader:X,HandyUploader:J,InsertButton:Y,SelectFileIconType:I};function qe(l){for(const[r,o]of Object.entries(Z))l.component(r,o)}exports.COMPRESSIBLE_EXTENSIONS=u.COMPRESSIBLE_EXTENSIONS;exports.base64ByteLength=u.base64ByteLength;exports.compressDataUrl=u.compressDataUrl;exports.compressImage=u.compressImage;exports.constructImageDataUrl=u.constructImageDataUrl;exports.createVideoThumbnailCache=u.createVideoThumbnailCache;exports.fileToBase64=u.fileToBase64;exports.filterByAccept=u.filterByAccept;exports.formatBytes=u.formatBytes;exports.formatFileSize=u.formatFileSize;exports.generateVideoThumbnail=u.generateVideoThumbnail;exports.getFileIcon=u.getFileIcon;exports.getFileType=u.getFileType;exports.getMimeTypeFromExtension=u.getMimeTypeFromExtension;exports.getVideoDataUrl=u.getVideoDataUrl;exports.isImageFile=u.isImageFile;exports.joinFileName=u.joinFileName;exports.languageData=u.languages;exports.matchesAccept=u.matchesAccept;exports.precheckFiles=u.precheckFiles;exports.prepareAttachments=u.prepareAttachments;exports.readFileAsDataUrl=u.readFileAsDataUrl;exports.readFiles=u.readFiles;exports.splitFileName=u.splitFileName;exports.validateFileCount=u.validateFileCount;exports.validateFileSize=u.validateFileSize;exports.HandyUploader=J;exports.InsertButton=Y;exports.SelectFileIconType=I;exports.SimpleUploader=X;exports.TableUploader=W;exports.ThumbnailUploader=R;exports.default=Z;exports.install=qe;exports.useErrorHandler=Oe;exports.useFileUpload=He;