ode-explorer 1.0.0-dev.202306141853 → 1.0.0-dev.202306191042

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.
@@ -1,2 +1,2 @@
1
- import{r as g,Z as Q,R as X,c as l,_ as ee,e as D,$ as re,a0 as ae,a1 as te,u as M,n as se,k as W,a2 as le,b as ie,a3 as ce,j as r,q as P,f as oe,a as ne,M as w,H as C,F as A,W as F,z as $,B}from"./index.js";import{u as ue}from"./usePopper.js";import{S as U}from"./SelectList.js";import{I as be}from"./ImagePicker.js";import{u as pe}from"./index.esm.js";const Z=({trigger:e,content:t})=>{const[s,a]=g.useState(null),[c,i]=g.useState(null),{styles:n,attributes:m}=ue(s,c,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,12]}}]}),[h,j]=g.useState(!1),u=Q(h,{from:{opacity:0,y:10},enter:{opacity:1,y:0},leave:{opacity:0,y:10}}),b=()=>{j(o=>!o)},y=X.cloneElement(e,{ref:a,onClick:b,state:h?"selected":"default"});return g.useEffect(()=>{const o=v=>{c&&!c.contains(v.target)&&s&&!s.contains(v.target)&&j(!1)};return document.addEventListener("mousedown",o,!0),document.addEventListener("touchstart",o,!0),()=>{document.removeEventListener("mousedown",o,!0),document.removeEventListener("touchstart",o,!0)}},[c,s]),l.jsxs(l.Fragment,{children:[y,u((o,v)=>l.jsx(l.Fragment,{children:v&&l.jsx(ee.div,{className:D("bg-white shadow rounded-4 d-block show py-12 px-8","bs-tooltip-auto"),ref:i,style:{...n.popper,...o},...m.popper,children:t})}))]})};Z.displayName="Dropdown";const V=Z,J=g.forwardRef(({title:e="",state:t,variant:s,icon:a,size:c="lg",grow:i=!1,badgeContent:n,...m},h)=>{const j=D("dropdown-trigger",t,c,s,i&&"flex-grow-1 justify-content-between");return l.jsxs("button",{ref:h,className:j,...m,type:"button",children:[a&&l.jsx("div",{className:"dropdown-trigger-icon",children:a}),l.jsx("div",{children:e}),n?l.jsx("div",{children:l.jsx("span",{className:"badge text-bg-secondary rounded-pill",children:n})}):l.jsx("div",{className:"dropdown-trigger-carret-icon",children:l.jsx(re,{width:16,height:16})})]})});J.displayName="DropdownTrigger";const H=J,Y=g.forwardRef(({options:e,model:t,disabled:s=!1,placeholderOption:a=!1,...c},i)=>{const{isRequired:n,status:m}=ae(),h=g.useId(),j={...c,id:h,disabled:s,ref:i,className:D(c.className,"form-select c-pointer",{"is-invalid":m==="invalid","is-valid":m==="valid"})};return l.jsx(l.Fragment,{children:l.jsxs("select",{...j,required:n,children:[a&&l.jsx("option",{disabled:!0,selected:t===void 0,children:a}),e==null?void 0:e.map(u=>{const b=typeof u=="object"?u.value:u,y=typeof u=="object"?u.label:u;return l.jsx("option",{value:b,selected:t===b,children:y},b)})]})})});Y.displayName="Select";const L=Y,{http:_}=te.instance();function de({onSuccess:e}){const{user:t,currentApp:s}=M(),[a,c]=g.useState({name:"",image:""}),{hotToast:i}=se(P),n=W(),m=le(),{publishApi:h}=ie(),{register:j,handleSubmit:u,formState:{errors:b,isSubmitting:y,isDirty:o,isValid:v}}=pe({mode:"onChange"}),[S,T]=g.useState([]),[E,q]=g.useState([]);function O(p){c(p)}const f=t?t==null?void 0:t.userId:"";return{selectedResources:n,register:j,handleSubmit:u,formState:{errors:b,isSubmitting:y,isDirty:o,isValid:v},publish:async p=>{try{let x=new Blob;a.image?x=await _.get(a.image,{responseType:"blob"}):n[0].thumbnail&&(x=await _.get(n[0].thumbnail,{responseType:"blob"}));const R=await _.get(`/userbook/avatar/${f}?thumbnail=48x48`,{responseType:"blob"}),d=await _.get(`/directory/user/${f}/attachment-school`,{responseType:"json"}),N={activityType:S,age:[p.ageMin,p.ageMax],application:(s==null?void 0:s.displayName)||"",cover:x,description:p.description,keyWords:p.keyWords,language:p.language,licence:"CC-BY",resourceId:m[0],subjectArea:E,teacherAvatar:R,title:p.title,userId:f,userStructureName:d.name||(t==null?void 0:t.structureNames[0])},K=[ce.BLOG][0],z=await h(K,N);z.success?i.success(r.jsx(he,{result:z}),{duration:1/0}):i.error(r.jsx(G,{}),{duration:1/0}),e==null||e()}catch{i.error(r.jsx(G,{}),{duration:1/0})}},handleDeleteImage:()=>{c({name:"",image:""})},handleUploadImage:O,selectedActivities:S,setSelectedActivities:T,selectedSubjectAreas:E,setSelectedSubjectAreas:q}}function me(){const{i18n:e}=oe(),t=[{value:"bpr.activityType.classroomActivity",label:e("bpr.activityType.classroomActivity")},{value:"bpr.activityType.groupActivity",label:e("bpr.activityType.groupActivity")},{value:"bpr.activityType.personalActivity",label:e("bpr.activityType.personalActivity")},{value:"bpr.activityType.homework",label:e("bpr.activityType.homework")},{value:"bpr.activityType.exercize",label:e("bpr.activityType.exercize")},{value:"bpr.activityType.learningPath",label:e("bpr.activityType.learningPath")},{value:"bpr.activityType.courseElement",label:e("bpr.activityType.courseElement")},{value:"bpr.other",label:e("bpr.other")}],s=[{value:"bpr.subjectArea.artActivity",label:e("bpr.subjectArea.artActivity")},{value:"bpr.subjectArea.readLearning",label:e("bpr.subjectArea.readLearning")},{value:"bpr.subjectArea.chemistry",label:e("bpr.subjectArea.chemistry")},{value:"bpr.subjectArea.law",label:e("bpr.subjectArea.law")},{value:"bpr.subjectArea.worldDiscovery",label:e("bpr.subjectArea.worldDiscovery")},{value:"bpr.subjectArea.economy",label:e("bpr.subjectArea.economy")},{value:"bpr.subjectArea.mediaEducation",label:e("bpr.subjectArea.mediaEducation")},{value:"bpr.subjectArea.musicEducation",label:e("bpr.subjectArea.musicEducation")},{value:"bpr.subjectArea.sportEducation",label:e("bpr.subjectArea.sportEducation")},{value:"bpr.subjectArea.citizenshipEducation",label:e("bpr.subjectArea.citizenshipEducation")},{value:"bpr.subjectArea.geography",label:e("bpr.subjectArea.geography")},{value:"bpr.subjectArea.history",label:e("bpr.subjectArea.history")},{value:"bpr.subjectArea.artHistory",label:e("bpr.subjectArea.artHistory")},{value:"bpr.subjectArea.ComputerScience",label:e("bpr.subjectArea.ComputerScience")},{value:"bpr.subjectArea.languages",label:e("bpr.subjectArea.languages")},{value:"bpr.subjectArea.italian",label:e("bpr.subjectArea.italian")},{value:"bpr.subjectArea.spanish",label:e("bpr.subjectArea.spanish")},{value:"bpr.subjectArea.french",label:e("bpr.subjectArea.french")},{value:"bpr.subjectArea.german",label:e("bpr.subjectArea.german")},{value:"bpr.subjectArea.english",label:e("bpr.subjectArea.english")},{value:"bpr.subjectArea.ancientLanguages",label:e("bpr.subjectArea.ancientLanguages")},{value:"bpr.subjectArea.literature",label:e("bpr.subjectArea.literature")},{value:"bpr.subjectArea.mathematics",label:e("bpr.subjectArea.mathematics")},{value:"bpr.subjectArea.vocationalGuidance",label:e("bpr.subjectArea.vocationalGuidance")},{value:"bpr.subjectArea.philosohppy",label:e("bpr.subjectArea.philosohppy")},{value:"bpr.subjectArea.physics",label:e("bpr.subjectArea.physics")},{value:"bpr.subjectArea.politicalSscience",label:e("bpr.subjectArea.politicalSscience")},{value:"bpr.subjectArea.sociology",label:e("bpr.subjectArea.sociology")},{value:"bpr.subjectArea.biology",label:e("bpr.subjectArea.biology")},{value:"bpr.subjectArea.geology",label:e("bpr.subjectArea.geology")},{value:"bpr.subjectArea.technology",label:e("bpr.subjectArea.technology")},{value:"bpr.other",label:e("bpr.other")}],a=[{value:"de_DE",label:e("de_DE")},{value:"en_EN",label:e("en_EN")},{value:"ar_DZ",label:e("ar_DZ")},{value:"es_ES",label:e("es_ES")},{value:"fr_FR",label:e("fr_FR")},{value:"it_IT",label:e("it_IT")},{value:"ja_JP",label:e("ja_JP")},{value:"zh_CN",label:e("zh_CN")},{value:"pt_PT",label:e("pt_PT")},{value:"ru_RU",label:e("ru_RU")},{value:"bpr.other",label:e("bpr.other")}];return{activityTypeOptions:t,subjectAreaOptions:s,languageOptions:a,ageOptions:["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"]}}function fe({isOpen:e,onSuccess:t,onCancel:s}){var x,R;const{i18n:a,currentApp:c}=M(),{register:i,handleSubmit:n,publish:m,formState:{isDirty:h,isValid:j},handleUploadImage:u,selectedActivities:b,setSelectedActivities:y,selectedSubjectAreas:o,setSelectedSubjectAreas:v,handleDeleteImage:S}=de({onSuccess:t}),T=W(),{activityTypeOptions:E,subjectAreaOptions:q,languageOptions:O,ageOptions:f}=me(),I=a("bpr.form.publication.language"),k=a("bpr.form.publication.age.min"),p=a("bpr.form.publication.age.max");return ne.createPortal(r.jsxs(w,{isOpen:e,onModalClose:s,id:"libraryModal",size:"lg",children:[r.jsx(w.Header,{onModalClose:s,children:a("bpr.publish")}),r.jsx(w.Subtitle,{children:a("bpr.form.tip")}),r.jsxs(w.Body,{children:[r.jsx(C,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("bpr.form.publication.heading.general")}),r.jsxs("form",{id:"libraryModalForm",onSubmit:n(m),children:[r.jsxs(A,{id:"title",className:"mb-16",isRequired:!0,children:[r.jsx(F,{requiredText:"",children:a("bpr.form.publication.title")}),r.jsx($,{type:"text",defaultValue:(x=T[0])==null?void 0:x.name,...i("title",{required:!0}),placeholder:a("bpr.form.publication.title.placeholder"),size:"md","aria-required":!0})]}),r.jsxs("div",{className:"mb-24",children:[r.jsx("div",{className:"form-label",children:a("bpr.form.publication.cover.title")}),r.jsx(be,{app:c,src:(R=T[0])==null?void 0:R.thumbnail,label:a("bpr.form.publication.cover.upload.label"),addButtonLabel:a("bpr.form.publication.cover.upload.add"),deleteButtonLabel:a("bpr.form.publication.cover.upload.remove"),onUploadImage:u,onDeleteImage:S,className:"align-self-center"})]}),r.jsxs(A,{id:"description",isRequired:!0,children:[r.jsx(F,{requiredText:"",children:a("bpr.form.publication.description")}),r.jsx($,{type:"text",...i("description",{required:!0}),placeholder:a("bpr.form.publication.description.placeholder"),size:"md","aria-required":!0})]}),r.jsx("hr",{}),r.jsx(C,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("bpr.form.publication.heading.infos")}),r.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 row mb-24",children:[r.jsx("div",{className:"col d-flex",children:r.jsx(V,{trigger:r.jsx(H,{title:a("bpr.form.publication.type"),size:"md",grow:!0}),content:r.jsx(U,{options:E,model:b,onChange:d=>y(d)})})}),r.jsx("div",{className:"col d-flex",children:r.jsx(V,{trigger:r.jsx(H,{title:a("bpr.form.publication.discipline"),size:"md",grow:!0}),content:r.jsx(U,{options:q,model:o,onChange:d=>v(d)})})}),r.jsx("div",{className:"col",children:r.jsx(A,{id:"language",isRequired:!0,children:r.jsx(L,{...i("language",{required:!0,validate:d=>d!==I}),options:O,placeholderOption:I,defaultValue:I,"aria-required":!0})})})]}),r.jsxs("div",{className:"mb-24",children:[r.jsx("label",{htmlFor:"",className:"form-label",children:a("bpr.form.publication.age")}),r.jsxs("div",{className:"d-flex",children:[r.jsx("div",{className:"me-16",children:r.jsx(A,{id:"ageMin",isRequired:!0,children:r.jsx(L,{...i("ageMin",{required:!0,validate:(d,N)=>parseInt(d)<=parseInt(N.ageMax)}),options:f,placeholderOption:k,defaultValue:k,"aria-required":!0})})}),r.jsx("div",{children:r.jsx(A,{id:"ageMax",isRequired:!0,children:r.jsx(L,{...i("ageMax",{required:!0,validate:(d,N)=>parseInt(d)>=parseInt(N.ageMin)}),options:f,placeholderOption:p,defaultValue:p,"aria-required":!0})})})]})]}),r.jsx("div",{className:"mb-24",children:r.jsxs(A,{id:"keywords",isOptional:!0,children:[r.jsx(F,{children:a("bpr.form.publication.keywords")}),r.jsx($,{type:"text",...i("keyWords"),size:"md",placeholder:a("bpr.form.publication.keywords.placeholder")})]})}),r.jsx("hr",{}),r.jsx(C,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("bpr.form.publication.licence.text")}),r.jsxs("ul",{className:"mb-12",children:[r.jsxs("li",{children:[a("bpr.form.publication.licence.text.1"),r.jsx("img",{className:"ms-8 d-inline-block",src:"/assets/themes/entcore-css-lib/images/cc-by-nc-sa.svg",alt:`Icone licence Creative
1
+ import{r as g,Z as Q,R as X,c as l,_ as ee,e as D,$ as re,a0 as ae,a1 as te,u as M,n as se,k as W,a2 as le,b as ie,a3 as ce,j as r,q as P,f as oe,a as ne,M as w,H as C,F as A,W as F,z as $,B}from"./index.js";import{u as ue}from"./usePopper.js";import{S as U}from"./SelectList.js";import{I as be}from"./ImagePicker.js";import{u as pe}from"./index.esm.js";const Z=({trigger:e,content:t})=>{const[s,a]=g.useState(null),[c,i]=g.useState(null),{styles:n,attributes:m}=ue(s,c,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,12]}}]}),[h,j]=g.useState(!1),u=Q(h,{from:{opacity:0,y:10},enter:{opacity:1,y:0},leave:{opacity:0,y:10}}),b=()=>{j(o=>!o)},y=X.cloneElement(e,{ref:a,onClick:b,state:h?"selected":"default"});return g.useEffect(()=>{const o=v=>{c&&!c.contains(v.target)&&s&&!s.contains(v.target)&&j(!1)};return document.addEventListener("mousedown",o,!0),document.addEventListener("touchstart",o,!0),()=>{document.removeEventListener("mousedown",o,!0),document.removeEventListener("touchstart",o,!0)}},[c,s]),l.jsxs(l.Fragment,{children:[y,u((o,v)=>l.jsx(l.Fragment,{children:v&&l.jsx(ee.div,{className:D("bg-white shadow rounded-4 d-block show py-12 px-8","bs-tooltip-auto"),ref:i,style:{...n.popper,...o},...m.popper,children:t})}))]})};Z.displayName="Dropdown";const V=Z,J=g.forwardRef(({title:e="",state:t,variant:s,icon:a,size:c="lg",grow:i=!1,badgeContent:n,...m},h)=>{const j=D("dropdown-trigger",t,c,s,i&&"flex-grow-1 justify-content-between");return l.jsxs("button",{ref:h,className:j,...m,type:"button",children:[a&&l.jsx("div",{className:"dropdown-trigger-icon",children:a}),l.jsx("div",{children:e}),n?l.jsx("div",{children:l.jsx("span",{className:"badge text-bg-secondary rounded-pill",children:n})}):l.jsx("div",{className:"dropdown-trigger-carret-icon",children:l.jsx(re,{width:16,height:16})})]})});J.displayName="DropdownTrigger";const H=J,Y=g.forwardRef(({options:e,model:t,disabled:s=!1,placeholderOption:a=!1,...c},i)=>{const{isRequired:n,status:m}=ae(),h=g.useId(),j={...c,id:h,disabled:s,ref:i,className:D(c.className,"form-select c-pointer",{"is-invalid":m==="invalid","is-valid":m==="valid"})};return l.jsx(l.Fragment,{children:l.jsxs("select",{...j,required:n,children:[a&&l.jsx("option",{disabled:!0,selected:t===void 0,children:a}),e==null?void 0:e.map(u=>{const b=typeof u=="object"?u.value:u,y=typeof u=="object"?u.label:u;return l.jsx("option",{value:b,selected:t===b,children:y},b)})]})})});Y.displayName="Select";const L=Y,{http:_}=te.instance();function de({onSuccess:e}){const{user:t,currentApp:s}=M(),[a,c]=g.useState({name:"",image:""}),{hotToast:i}=se(P),n=W(),m=le(),{publishApi:h}=ie(),{register:j,handleSubmit:u,formState:{errors:b,isSubmitting:y,isDirty:o,isValid:v}}=pe({mode:"onChange"}),[S,E]=g.useState([]),[T,q]=g.useState([]);function O(p){c(p)}const f=t?t==null?void 0:t.userId:"";return{selectedResources:n,register:j,handleSubmit:u,formState:{errors:b,isSubmitting:y,isDirty:o,isValid:v},publish:async p=>{try{let x=new Blob;a.image?x=await _.get(a.image,{responseType:"blob"}):n[0].thumbnail&&(x=await _.get(n[0].thumbnail,{responseType:"blob"}));const R=await _.get(`/userbook/avatar/${f}?thumbnail=48x48`,{responseType:"blob"}),d=await _.get(`/directory/user/${f}/attachment-school`,{responseType:"json"}),N={activityType:S,age:[p.ageMin,p.ageMax],application:(s==null?void 0:s.displayName)||"",cover:x,description:p.description,keyWords:p.keyWords,language:p.language,licence:"CC-BY",resourceId:m[0],resourceEntId:n[0].assetId,subjectArea:T,teacherAvatar:R,title:p.title,userId:f,userStructureName:d.name||(t==null?void 0:t.structureNames[0])},K=[ce.BLOG][0],z=await h(K,N);z.success?i.success(r.jsx(he,{result:z}),{duration:1/0}):i.error(r.jsx(G,{}),{duration:1/0}),e==null||e()}catch{i.error(r.jsx(G,{}),{duration:1/0})}},handleDeleteImage:()=>{c({name:"",image:""})},handleUploadImage:O,selectedActivities:S,setSelectedActivities:E,selectedSubjectAreas:T,setSelectedSubjectAreas:q}}function me(){const{i18n:e}=oe(),t=[{value:"bpr.activityType.classroomActivity",label:e("bpr.activityType.classroomActivity")},{value:"bpr.activityType.groupActivity",label:e("bpr.activityType.groupActivity")},{value:"bpr.activityType.personalActivity",label:e("bpr.activityType.personalActivity")},{value:"bpr.activityType.homework",label:e("bpr.activityType.homework")},{value:"bpr.activityType.exercize",label:e("bpr.activityType.exercize")},{value:"bpr.activityType.learningPath",label:e("bpr.activityType.learningPath")},{value:"bpr.activityType.courseElement",label:e("bpr.activityType.courseElement")},{value:"bpr.other",label:e("bpr.other")}],s=[{value:"bpr.subjectArea.artActivity",label:e("bpr.subjectArea.artActivity")},{value:"bpr.subjectArea.readLearning",label:e("bpr.subjectArea.readLearning")},{value:"bpr.subjectArea.chemistry",label:e("bpr.subjectArea.chemistry")},{value:"bpr.subjectArea.law",label:e("bpr.subjectArea.law")},{value:"bpr.subjectArea.worldDiscovery",label:e("bpr.subjectArea.worldDiscovery")},{value:"bpr.subjectArea.economy",label:e("bpr.subjectArea.economy")},{value:"bpr.subjectArea.mediaEducation",label:e("bpr.subjectArea.mediaEducation")},{value:"bpr.subjectArea.musicEducation",label:e("bpr.subjectArea.musicEducation")},{value:"bpr.subjectArea.sportEducation",label:e("bpr.subjectArea.sportEducation")},{value:"bpr.subjectArea.citizenshipEducation",label:e("bpr.subjectArea.citizenshipEducation")},{value:"bpr.subjectArea.geography",label:e("bpr.subjectArea.geography")},{value:"bpr.subjectArea.history",label:e("bpr.subjectArea.history")},{value:"bpr.subjectArea.artHistory",label:e("bpr.subjectArea.artHistory")},{value:"bpr.subjectArea.ComputerScience",label:e("bpr.subjectArea.ComputerScience")},{value:"bpr.subjectArea.languages",label:e("bpr.subjectArea.languages")},{value:"bpr.subjectArea.italian",label:e("bpr.subjectArea.italian")},{value:"bpr.subjectArea.spanish",label:e("bpr.subjectArea.spanish")},{value:"bpr.subjectArea.french",label:e("bpr.subjectArea.french")},{value:"bpr.subjectArea.german",label:e("bpr.subjectArea.german")},{value:"bpr.subjectArea.english",label:e("bpr.subjectArea.english")},{value:"bpr.subjectArea.ancientLanguages",label:e("bpr.subjectArea.ancientLanguages")},{value:"bpr.subjectArea.literature",label:e("bpr.subjectArea.literature")},{value:"bpr.subjectArea.mathematics",label:e("bpr.subjectArea.mathematics")},{value:"bpr.subjectArea.vocationalGuidance",label:e("bpr.subjectArea.vocationalGuidance")},{value:"bpr.subjectArea.philosohppy",label:e("bpr.subjectArea.philosohppy")},{value:"bpr.subjectArea.physics",label:e("bpr.subjectArea.physics")},{value:"bpr.subjectArea.politicalSscience",label:e("bpr.subjectArea.politicalSscience")},{value:"bpr.subjectArea.sociology",label:e("bpr.subjectArea.sociology")},{value:"bpr.subjectArea.biology",label:e("bpr.subjectArea.biology")},{value:"bpr.subjectArea.geology",label:e("bpr.subjectArea.geology")},{value:"bpr.subjectArea.technology",label:e("bpr.subjectArea.technology")},{value:"bpr.other",label:e("bpr.other")}],a=[{value:"de_DE",label:e("de_DE")},{value:"en_EN",label:e("en_EN")},{value:"ar_DZ",label:e("ar_DZ")},{value:"es_ES",label:e("es_ES")},{value:"fr_FR",label:e("fr_FR")},{value:"it_IT",label:e("it_IT")},{value:"ja_JP",label:e("ja_JP")},{value:"zh_CN",label:e("zh_CN")},{value:"pt_PT",label:e("pt_PT")},{value:"ru_RU",label:e("ru_RU")},{value:"bpr.other",label:e("bpr.other")}];return{activityTypeOptions:t,subjectAreaOptions:s,languageOptions:a,ageOptions:["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"]}}function fe({isOpen:e,onSuccess:t,onCancel:s}){var x,R;const{i18n:a,currentApp:c}=M(),{register:i,handleSubmit:n,publish:m,formState:{isDirty:h,isValid:j},handleUploadImage:u,selectedActivities:b,setSelectedActivities:y,selectedSubjectAreas:o,setSelectedSubjectAreas:v,handleDeleteImage:S}=de({onSuccess:t}),E=W(),{activityTypeOptions:T,subjectAreaOptions:q,languageOptions:O,ageOptions:f}=me(),I=a("bpr.form.publication.language"),k=a("bpr.form.publication.age.min"),p=a("bpr.form.publication.age.max");return ne.createPortal(r.jsxs(w,{isOpen:e,onModalClose:s,id:"libraryModal",size:"lg",children:[r.jsx(w.Header,{onModalClose:s,children:a("bpr.publish")}),r.jsx(w.Subtitle,{children:a("bpr.form.tip")}),r.jsxs(w.Body,{children:[r.jsx(C,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("bpr.form.publication.heading.general")}),r.jsxs("form",{id:"libraryModalForm",onSubmit:n(m),children:[r.jsxs(A,{id:"title",className:"mb-16",isRequired:!0,children:[r.jsx(F,{requiredText:"",children:a("bpr.form.publication.title")}),r.jsx($,{type:"text",defaultValue:(x=E[0])==null?void 0:x.name,...i("title",{required:!0}),placeholder:a("bpr.form.publication.title.placeholder"),size:"md","aria-required":!0})]}),r.jsxs("div",{className:"mb-24",children:[r.jsx("div",{className:"form-label",children:a("bpr.form.publication.cover.title")}),r.jsx(be,{app:c,src:(R=E[0])==null?void 0:R.thumbnail,label:a("bpr.form.publication.cover.upload.label"),addButtonLabel:a("bpr.form.publication.cover.upload.add"),deleteButtonLabel:a("bpr.form.publication.cover.upload.remove"),onUploadImage:u,onDeleteImage:S,className:"align-self-center"})]}),r.jsxs(A,{id:"description",isRequired:!0,children:[r.jsx(F,{requiredText:"",children:a("bpr.form.publication.description")}),r.jsx($,{type:"text",...i("description",{required:!0}),placeholder:a("bpr.form.publication.description.placeholder"),size:"md","aria-required":!0})]}),r.jsx("hr",{}),r.jsx(C,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("bpr.form.publication.heading.infos")}),r.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 row mb-24",children:[r.jsx("div",{className:"col d-flex",children:r.jsx(V,{trigger:r.jsx(H,{title:a("bpr.form.publication.type"),size:"md",grow:!0}),content:r.jsx(U,{options:T,model:b,onChange:d=>y(d)})})}),r.jsx("div",{className:"col d-flex",children:r.jsx(V,{trigger:r.jsx(H,{title:a("bpr.form.publication.discipline"),size:"md",grow:!0}),content:r.jsx(U,{options:q,model:o,onChange:d=>v(d)})})}),r.jsx("div",{className:"col",children:r.jsx(A,{id:"language",isRequired:!0,children:r.jsx(L,{...i("language",{required:!0,validate:d=>d!==I}),options:O,placeholderOption:I,defaultValue:I,"aria-required":!0})})})]}),r.jsxs("div",{className:"mb-24",children:[r.jsx("label",{htmlFor:"",className:"form-label",children:a("bpr.form.publication.age")}),r.jsxs("div",{className:"d-flex",children:[r.jsx("div",{className:"me-16",children:r.jsx(A,{id:"ageMin",isRequired:!0,children:r.jsx(L,{...i("ageMin",{required:!0,validate:(d,N)=>parseInt(d)<=parseInt(N.ageMax)}),options:f,placeholderOption:k,defaultValue:k,"aria-required":!0})})}),r.jsx("div",{children:r.jsx(A,{id:"ageMax",isRequired:!0,children:r.jsx(L,{...i("ageMax",{required:!0,validate:(d,N)=>parseInt(d)>=parseInt(N.ageMin)}),options:f,placeholderOption:p,defaultValue:p,"aria-required":!0})})})]})]}),r.jsx("div",{className:"mb-24",children:r.jsxs(A,{id:"keywords",isOptional:!0,children:[r.jsx(F,{children:a("bpr.form.publication.keywords")}),r.jsx($,{type:"text",...i("keyWords"),size:"md",placeholder:a("bpr.form.publication.keywords.placeholder")})]})}),r.jsx("hr",{}),r.jsx(C,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("bpr.form.publication.licence.text")}),r.jsxs("ul",{className:"mb-12",children:[r.jsxs("li",{children:[a("bpr.form.publication.licence.text.1"),r.jsx("img",{className:"ms-8 d-inline-block",src:"/assets/themes/entcore-css-lib/images/cc-by-nc-sa.svg",alt:`Icone licence Creative
2
2
  Commons`})]}),r.jsx("li",{children:a("bpr.form.publication.licence.text.2")})]}),r.jsx(P,{type:"info",className:"mb-12",children:a("bpr.form.publication.licence.text.3")}),r.jsx(P,{type:"warning",children:a("bpr.form.publication.licence.text.4")})]})]}),r.jsxs(w.Footer,{children:[r.jsx(B,{color:"tertiary",onClick:s,type:"button",variant:"ghost",children:a("cancel")}),r.jsx(B,{form:"libraryModalForm",type:"submit",color:"primary",variant:"filled",disabled:!h||!j||(b==null?void 0:b.length)===0||(o==null?void 0:o.length)===0,children:a("bpr.form.submit")})]})]}),document.getElementById("portal"))}function he({result:e}){const{i18n:t}=M();return r.jsxs(r.Fragment,{children:[r.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.success.title")}),r.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.1")}),r.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.2")}),e.details.front_url&&r.jsx("p",{className:"pt-24 pb-24",children:r.jsx("a",{className:"button right-magnet",href:e.details.front_url,target:"_blank",rel:"noreferrer",children:t("bpr.form.publication.response.success.button")})})]})}function G(){const{i18n:e}=M();return r.jsxs(r.Fragment,{children:[r.jsx("h3",{className:"pt-24",children:e("bpr.form.publication.response.error.title")}),r.jsx("p",{className:"pt-24 pb-24",children:r.jsx("strong",{children:e("bpr.form.publication.response.error.content")})})]})}export{G as PublishModalError,he as PublishModalSuccess,fe as default};
@@ -1 +1 @@
1
- import{u as O,i as T,a8 as B,h as $,a2 as w,k as z,b as J,E as U,aa as _,r as q,e as D,j as e,R as g,_ as h,ab as G,B as H}from"./index.js";import{C as K}from"./Card.js";import"./Tooltip.js";import"./usePopper.js";function Q(r){const{rights:o,creatorId:a}=r;return o.filter(c=>!c.includes(a)).length>=1}const ss=()=>{const{currentApp:r,currentLanguage:o,i18n:a}=O(),{avatar:p}=T(),{data:c,isFetching:x,fetchNextPage:f}=B(),l=$(),n=w(),m=z(),{setSelectedResources:d,setResourceIds:u,openResource:R,setResourceIsTrash:S}=J(),j=U(),I=_({from:{opacity:0},to:{opacity:1}}),b=l.pagination.startIdx+l.pagination.pageSize-1<(l.pagination.maxIdx||0),y=q.useCallback(()=>{f()},[]),N=s=>{j?(S(!0),u([s.id]),d([s])):R(s)};function C(s){n.includes(s.id)?(u(n.filter(i=>i!==s.id)),d(m.filter(i=>i.id!==s.id))):(u([...n,s.id]),d([...m,s]))}const P=D("grid ps-0 list-unstyled");return e.jsxs(g.Fragment,{children:[e.jsx(h.ul,{className:P,children:c==null?void 0:c.pages.map((s,i)=>e.jsx(g.Fragment,{children:s.resources.map(t=>{const{id:k,creatorName:A,name:F,thumbnail:v,updatedAt:E}=t,L=Q(t),M=G(E).locale(o).fromNow();return e.jsx(h.li,{className:"g-col-4",style:{...I},children:e.jsx(K,{app:r,className:"c-pointer",creatorName:A,isPublic:t.public,isSelected:n.includes(t.id),isLoading:x,isShared:L,messagePublic:a("tooltip.public"),messageShared:a("tooltip.shared"),name:F,onOpen:()=>N(t),onSelect:()=>C(t),resourceSrc:v,updatedAt:M,userSrc:p})},k)})},i))}),b&&e.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:e.jsx(H,{type:"button",color:"secondary",variant:"filled",onClick:y,children:a("explorer.see.more")})})]})};export{ss as default};
1
+ import{u as O,a8 as T,h as $,a2 as B,k as w,b as z,E as J,aa as _,r as q,e as D,j as s,R as g,_ as h,ab as G,B as H}from"./index.js";import{C as K}from"./Card.js";import"./Tooltip.js";import"./usePopper.js";function Q(o){const{rights:n,creatorId:a}=o;return n.filter(l=>!l.includes(a)).length>=1}const Z=()=>{const{currentApp:o,currentLanguage:n,i18n:a}=O(),{data:i,isFetching:l,fetchNextPage:x}=T(),d=$(),r=B(),m=w(),{setSelectedResources:u,setResourceIds:p,openResource:f,setResourceIsTrash:R}=z(),S=J(),I=_({from:{opacity:0},to:{opacity:1}}),b=d.pagination.startIdx+d.pagination.pageSize-1<(d.pagination.maxIdx||0),j=q.useCallback(()=>{x()},[]),y=e=>{S?(R(!0),p([e.id]),u([e])):f(e)};function N(e){r.includes(e.id)?(p(r.filter(c=>c!==e.id)),u(m.filter(c=>c.id!==e.id))):(p([...r,e.id]),u([...m,e]))}const C=D("grid ps-0 list-unstyled");return s.jsxs(g.Fragment,{children:[s.jsx(h.ul,{className:C,children:i==null?void 0:i.pages.map((e,c)=>s.jsx(g.Fragment,{children:e.resources.map(t=>{const{id:P,creatorName:k,creatorId:A,name:F,thumbnail:v,updatedAt:E}=t,L=Q(t),M=G(E).locale(n).fromNow();return s.jsx(h.li,{className:"g-col-4",style:{...I},children:s.jsx(K,{app:o,className:"c-pointer",creatorName:k,isPublic:t.public,isSelected:r.includes(t.id),isLoading:l,isShared:L,messagePublic:a("tooltip.public"),messageShared:a("tooltip.shared"),name:F,onOpen:()=>y(t),onSelect:()=>N(t),resourceSrc:v,updatedAt:M,userSrc:`/userbook/avatar/${A}`})},P)})},c))}),b&&s.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:s.jsx(H,{type:"button",color:"secondary",variant:"filled",onClick:j,children:a("explorer.see.more")})})]})};export{Z as default};
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ PERFORMANCE OF THIS SOFTWARE.
38
38
  ***************************************************************************** */var extendStatics=function(lt,dt){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ft,vt){ft.__proto__=vt}||function(ft,vt){for(var Et in vt)Object.prototype.hasOwnProperty.call(vt,Et)&&(ft[Et]=vt[Et])},extendStatics(lt,dt)};function __extends$1(lt,dt){if(typeof dt!="function"&&dt!==null)throw new TypeError("Class extends value "+String(dt)+" is not a constructor or null");extendStatics(lt,dt);function ft(){this.constructor=lt}lt.prototype=dt===null?Object.create(dt):(ft.prototype=dt.prototype,new ft)}function __values(lt){var dt=typeof Symbol=="function"&&Symbol.iterator,ft=dt&&lt[dt],vt=0;if(ft)return ft.call(lt);if(lt&&typeof lt.length=="number")return{next:function(){return lt&&vt>=lt.length&&(lt=void 0),{value:lt&&lt[vt++],done:!lt}}};throw new TypeError(dt?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(lt,dt){var ft=typeof Symbol=="function"&&lt[Symbol.iterator];if(!ft)return lt;var vt=ft.call(lt),Et,Rt=[],St;try{for(;(dt===void 0||dt-- >0)&&!(Et=vt.next()).done;)Rt.push(Et.value)}catch(At){St={error:At}}finally{try{Et&&!Et.done&&(ft=vt.return)&&ft.call(vt)}finally{if(St)throw St.error}}return Rt}function __spreadArray(lt,dt){for(var ft=0,vt=dt.length,Et=lt.length;ft<vt;ft++,Et++)lt[Et]=dt[ft];return lt}function isFunction$1(lt){return typeof lt=="function"}function createErrorClass(lt){var dt=function(vt){Error.call(vt),vt.stack=new Error().stack},ft=lt(dt);return ft.prototype=Object.create(Error.prototype),ft.prototype.constructor=ft,ft}var UnsubscriptionError=createErrorClass(function(lt){return function(dt){lt(this),this.message=dt?dt.length+` errors occurred during unsubscription:
39
39
  `+dt.map(function(ft,vt){return vt+1+") "+ft.toString()}).join(`
40
40
  `):"",this.name="UnsubscriptionError",this.errors=dt}});function arrRemove(lt,dt){if(lt){var ft=lt.indexOf(dt);0<=ft&&lt.splice(ft,1)}}var Subscription=function(){function lt(dt){this.initialTeardown=dt,this.closed=!1,this._parentage=null,this._teardowns=null}return lt.prototype.unsubscribe=function(){var dt,ft,vt,Et,Rt;if(!this.closed){this.closed=!0;var St=this._parentage;if(St)if(this._parentage=null,Array.isArray(St))try{for(var At=__values(St),Ct=At.next();!Ct.done;Ct=At.next()){var kt=Ct.value;kt.remove(this)}}catch(zt){dt={error:zt}}finally{try{Ct&&!Ct.done&&(ft=At.return)&&ft.call(At)}finally{if(dt)throw dt.error}}else St.remove(this);var Tt=this.initialTeardown;if(isFunction$1(Tt))try{Tt()}catch(zt){Rt=zt instanceof UnsubscriptionError?zt.errors:[zt]}var Nt=this._teardowns;if(Nt){this._teardowns=null;try{for(var Ft=__values(Nt),Dt=Ft.next();!Dt.done;Dt=Ft.next()){var Ut=Dt.value;try{execTeardown(Ut)}catch(zt){Rt=Rt??[],zt instanceof UnsubscriptionError?Rt=__spreadArray(__spreadArray([],__read(Rt)),__read(zt.errors)):Rt.push(zt)}}}catch(zt){vt={error:zt}}finally{try{Dt&&!Dt.done&&(Et=Ft.return)&&Et.call(Ft)}finally{if(vt)throw vt.error}}}if(Rt)throw new UnsubscriptionError(Rt)}},lt.prototype.add=function(dt){var ft;if(dt&&dt!==this)if(this.closed)execTeardown(dt);else{if(dt instanceof lt){if(dt.closed||dt._hasParent(this))return;dt._addParent(this)}(this._teardowns=(ft=this._teardowns)!==null&&ft!==void 0?ft:[]).push(dt)}},lt.prototype._hasParent=function(dt){var ft=this._parentage;return ft===dt||Array.isArray(ft)&&ft.includes(dt)},lt.prototype._addParent=function(dt){var ft=this._parentage;this._parentage=Array.isArray(ft)?(ft.push(dt),ft):ft?[ft,dt]:dt},lt.prototype._removeParent=function(dt){var ft=this._parentage;ft===dt?this._parentage=null:Array.isArray(ft)&&arrRemove(ft,dt)},lt.prototype.remove=function(dt){var ft=this._teardowns;ft&&arrRemove(ft,dt),dt instanceof lt&&dt._removeParent(this)},lt.EMPTY=function(){var dt=new lt;return dt.closed=!0,dt}(),lt}(),EMPTY_SUBSCRIPTION=Subscription.EMPTY;function isSubscription(lt){return lt instanceof Subscription||lt&&"closed"in lt&&isFunction$1(lt.remove)&&isFunction$1(lt.add)&&isFunction$1(lt.unsubscribe)}function execTeardown(lt){isFunction$1(lt)?lt():lt.unsubscribe()}var config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},timeoutProvider={setTimeout:function(){for(var lt=[],dt=0;dt<arguments.length;dt++)lt[dt]=arguments[dt];return setTimeout.apply(void 0,__spreadArray([],__read(lt)))},clearTimeout:function(lt){return clearTimeout(lt)},delegate:void 0};function reportUnhandledError(lt){timeoutProvider.setTimeout(function(){var dt=config.onUnhandledError;if(dt)dt(lt);else throw lt})}function noop$2(){}var COMPLETE_NOTIFICATION=function(){return createNotification("C",void 0,void 0)}();function errorNotification(lt){return createNotification("E",void 0,lt)}function nextNotification(lt){return createNotification("N",lt,void 0)}function createNotification(lt,dt,ft){return{kind:lt,value:dt,error:ft}}var context=null;function errorContext(lt){if(config.useDeprecatedSynchronousErrorHandling){var dt=!context;if(dt&&(context={errorThrown:!1,error:null}),lt(),dt){var ft=context,vt=ft.errorThrown,Et=ft.error;if(context=null,vt)throw Et}}else lt()}function captureError(lt){config.useDeprecatedSynchronousErrorHandling&&context&&(context.errorThrown=!0,context.error=lt)}var Subscriber=function(lt){__extends$1(dt,lt);function dt(ft){var vt=lt.call(this)||this;return vt.isStopped=!1,ft?(vt.destination=ft,isSubscription(ft)&&ft.add(vt)):vt.destination=EMPTY_OBSERVER,vt}return dt.create=function(ft,vt,Et){return new SafeSubscriber(ft,vt,Et)},dt.prototype.next=function(ft){this.isStopped?handleStoppedNotification(nextNotification(ft),this):this._next(ft)},dt.prototype.error=function(ft){this.isStopped?handleStoppedNotification(errorNotification(ft),this):(this.isStopped=!0,this._error(ft))},dt.prototype.complete=function(){this.isStopped?handleStoppedNotification(COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},dt.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,lt.prototype.unsubscribe.call(this),this.destination=null)},dt.prototype._next=function(ft){this.destination.next(ft)},dt.prototype._error=function(ft){try{this.destination.error(ft)}finally{this.unsubscribe()}},dt.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},dt}(Subscription),SafeSubscriber=function(lt){__extends$1(dt,lt);function dt(ft,vt,Et){var Rt=lt.call(this)||this,St;if(isFunction$1(ft))St=ft;else if(ft){St=ft.next,vt=ft.error,Et=ft.complete;var At;Rt&&config.useDeprecatedNextContext?(At=Object.create(ft),At.unsubscribe=function(){return Rt.unsubscribe()}):At=ft,St=St==null?void 0:St.bind(At),vt=vt==null?void 0:vt.bind(At),Et=Et==null?void 0:Et.bind(At)}return Rt.destination={next:St?wrapForErrorHandling(St):noop$2,error:wrapForErrorHandling(vt??defaultErrorHandler),complete:Et?wrapForErrorHandling(Et):noop$2},Rt}return dt}(Subscriber);function wrapForErrorHandling(lt,dt){return function(){for(var ft=[],vt=0;vt<arguments.length;vt++)ft[vt]=arguments[vt];try{lt.apply(void 0,__spreadArray([],__read(ft)))}catch(Et){config.useDeprecatedSynchronousErrorHandling?captureError(Et):reportUnhandledError(Et)}}}function defaultErrorHandler(lt){throw lt}function handleStoppedNotification(lt,dt){var ft=config.onStoppedNotification;ft&&timeoutProvider.setTimeout(function(){return ft(lt,dt)})}var EMPTY_OBSERVER={closed:!0,next:noop$2,error:defaultErrorHandler,complete:noop$2},observable=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function identity(lt){return lt}function pipeFromArray(lt){return lt.length===0?identity:lt.length===1?lt[0]:function(dt){return lt.reduce(function(ft,vt){return vt(ft)},dt)}}var Observable=function(){function lt(dt){dt&&(this._subscribe=dt)}return lt.prototype.lift=function(dt){var ft=new lt;return ft.source=this,ft.operator=dt,ft},lt.prototype.subscribe=function(dt,ft,vt){var Et=this,Rt=isSubscriber(dt)?dt:new SafeSubscriber(dt,ft,vt);return errorContext(function(){var St=Et,At=St.operator,Ct=St.source;Rt.add(At?At.call(Rt,Ct):Ct?Et._subscribe(Rt):Et._trySubscribe(Rt))}),Rt},lt.prototype._trySubscribe=function(dt){try{return this._subscribe(dt)}catch(ft){dt.error(ft)}},lt.prototype.forEach=function(dt,ft){var vt=this;return ft=getPromiseCtor(ft),new ft(function(Et,Rt){var St;St=vt.subscribe(function(At){try{dt(At)}catch(Ct){Rt(Ct),St==null||St.unsubscribe()}},Rt,Et)})},lt.prototype._subscribe=function(dt){var ft;return(ft=this.source)===null||ft===void 0?void 0:ft.subscribe(dt)},lt.prototype[observable]=function(){return this},lt.prototype.pipe=function(){for(var dt=[],ft=0;ft<arguments.length;ft++)dt[ft]=arguments[ft];return pipeFromArray(dt)(this)},lt.prototype.toPromise=function(dt){var ft=this;return dt=getPromiseCtor(dt),new dt(function(vt,Et){var Rt;ft.subscribe(function(St){return Rt=St},function(St){return Et(St)},function(){return vt(Rt)})})},lt.create=function(dt){return new lt(dt)},lt}();function getPromiseCtor(lt){var dt;return(dt=lt??config.Promise)!==null&&dt!==void 0?dt:Promise}function isObserver(lt){return lt&&isFunction$1(lt.next)&&isFunction$1(lt.error)&&isFunction$1(lt.complete)}function isSubscriber(lt){return lt&&lt instanceof Subscriber||isObserver(lt)&&isSubscription(lt)}function hasLift(lt){return isFunction$1(lt==null?void 0:lt.lift)}function operate(lt){return function(dt){if(hasLift(dt))return dt.lift(function(ft){try{return lt(ft,this)}catch(vt){this.error(vt)}});throw new TypeError("Unable to lift unknown Observable type")}}var OperatorSubscriber=function(lt){__extends$1(dt,lt);function dt(ft,vt,Et,Rt,St){var At=lt.call(this,ft)||this;return At.onFinalize=St,At._next=vt?function(Ct){try{vt(Ct)}catch(kt){ft.error(kt)}}:lt.prototype._next,At._error=Rt?function(Ct){try{Rt(Ct)}catch(kt){ft.error(kt)}finally{this.unsubscribe()}}:lt.prototype._error,At._complete=Et?function(){try{Et()}catch(Ct){ft.error(Ct)}finally{this.unsubscribe()}}:lt.prototype._complete,At}return dt.prototype.unsubscribe=function(){var ft,vt=this.closed;lt.prototype.unsubscribe.call(this),!vt&&((ft=this.onFinalize)===null||ft===void 0||ft.call(this))},dt}(Subscriber);function refCount(){return operate(function(lt,dt){var ft=null;lt._refCount++;var vt=new OperatorSubscriber(dt,void 0,void 0,void 0,function(){if(!lt||lt._refCount<=0||0<--lt._refCount){ft=null;return}var Et=lt._connection,Rt=ft;ft=null,Et&&(!Rt||Et===Rt)&&Et.unsubscribe(),dt.unsubscribe()});lt.subscribe(vt),vt.closed||(ft=lt.connect())})}(function(lt){__extends$1(dt,lt);function dt(ft,vt){var Et=lt.call(this)||this;return Et.source=ft,Et.subjectFactory=vt,Et._subject=null,Et._refCount=0,Et._connection=null,hasLift(ft)&&(Et.lift=ft.lift),Et}return dt.prototype._subscribe=function(ft){return this.getSubject().subscribe(ft)},dt.prototype.getSubject=function(){var ft=this._subject;return(!ft||ft.isStopped)&&(this._subject=this.subjectFactory()),this._subject},dt.prototype._teardown=function(){this._refCount=0;var ft=this._connection;this._subject=this._connection=null,ft==null||ft.unsubscribe()},dt.prototype.connect=function(){var ft=this,vt=this._connection;if(!vt){vt=this._connection=new Subscription;var Et=this.getSubject();vt.add(this.source.subscribe(new OperatorSubscriber(Et,void 0,function(){ft._teardown(),Et.complete()},function(Rt){ft._teardown(),Et.error(Rt)},function(){return ft._teardown()}))),vt.closed&&(this._connection=null,vt=Subscription.EMPTY)}return vt},dt.prototype.refCount=function(){return refCount()(this)},dt})(Observable);var animationFrameProvider={schedule:function(lt){var dt=requestAnimationFrame,ft=cancelAnimationFrame,vt=dt(function(Et){ft=void 0,lt(Et)});return new Subscription(function(){return ft==null?void 0:ft(vt)})},requestAnimationFrame:function(){for(var lt=[],dt=0;dt<arguments.length;dt++)lt[dt]=arguments[dt];var ft=animationFrameProvider.delegate;return((ft==null?void 0:ft.requestAnimationFrame)||requestAnimationFrame).apply(void 0,__spreadArray([],__read(lt)))},cancelAnimationFrame:function(){for(var lt=[],dt=0;dt<arguments.length;dt++)lt[dt]=arguments[dt];return cancelAnimationFrame.apply(void 0,__spreadArray([],__read(lt)))},delegate:void 0},ObjectUnsubscribedError=createErrorClass(function(lt){return function(){lt(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Subject=function(lt){__extends$1(dt,lt);function dt(){var ft=lt.call(this)||this;return ft.closed=!1,ft.observers=[],ft.isStopped=!1,ft.hasError=!1,ft.thrownError=null,ft}return dt.prototype.lift=function(ft){var vt=new AnonymousSubject(this,this);return vt.operator=ft,vt},dt.prototype._throwIfClosed=function(){if(this.closed)throw new ObjectUnsubscribedError},dt.prototype.next=function(ft){var vt=this;errorContext(function(){var Et,Rt;if(vt._throwIfClosed(),!vt.isStopped){var St=vt.observers.slice();try{for(var At=__values(St),Ct=At.next();!Ct.done;Ct=At.next()){var kt=Ct.value;kt.next(ft)}}catch(Tt){Et={error:Tt}}finally{try{Ct&&!Ct.done&&(Rt=At.return)&&Rt.call(At)}finally{if(Et)throw Et.error}}}})},dt.prototype.error=function(ft){var vt=this;errorContext(function(){if(vt._throwIfClosed(),!vt.isStopped){vt.hasError=vt.isStopped=!0,vt.thrownError=ft;for(var Et=vt.observers;Et.length;)Et.shift().error(ft)}})},dt.prototype.complete=function(){var ft=this;errorContext(function(){if(ft._throwIfClosed(),!ft.isStopped){ft.isStopped=!0;for(var vt=ft.observers;vt.length;)vt.shift().complete()}})},dt.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Object.defineProperty(dt.prototype,"observed",{get:function(){var ft;return((ft=this.observers)===null||ft===void 0?void 0:ft.length)>0},enumerable:!1,configurable:!0}),dt.prototype._trySubscribe=function(ft){return this._throwIfClosed(),lt.prototype._trySubscribe.call(this,ft)},dt.prototype._subscribe=function(ft){return this._throwIfClosed(),this._checkFinalizedStatuses(ft),this._innerSubscribe(ft)},dt.prototype._innerSubscribe=function(ft){var vt=this,Et=vt.hasError,Rt=vt.isStopped,St=vt.observers;return Et||Rt?EMPTY_SUBSCRIPTION:(St.push(ft),new Subscription(function(){return arrRemove(St,ft)}))},dt.prototype._checkFinalizedStatuses=function(ft){var vt=this,Et=vt.hasError,Rt=vt.thrownError,St=vt.isStopped;Et?ft.error(Rt):St&&ft.complete()},dt.prototype.asObservable=function(){var ft=new Observable;return ft.source=this,ft},dt.create=function(ft,vt){return new AnonymousSubject(ft,vt)},dt}(Observable),AnonymousSubject=function(lt){__extends$1(dt,lt);function dt(ft,vt){var Et=lt.call(this)||this;return Et.destination=ft,Et.source=vt,Et}return dt.prototype.next=function(ft){var vt,Et;(Et=(vt=this.destination)===null||vt===void 0?void 0:vt.next)===null||Et===void 0||Et.call(vt,ft)},dt.prototype.error=function(ft){var vt,Et;(Et=(vt=this.destination)===null||vt===void 0?void 0:vt.error)===null||Et===void 0||Et.call(vt,ft)},dt.prototype.complete=function(){var ft,vt;(vt=(ft=this.destination)===null||ft===void 0?void 0:ft.complete)===null||vt===void 0||vt.call(ft)},dt.prototype._subscribe=function(ft){var vt,Et;return(Et=(vt=this.source)===null||vt===void 0?void 0:vt.subscribe(ft))!==null&&Et!==void 0?Et:EMPTY_SUBSCRIPTION},dt}(Subject);(function(lt){__extends$1(dt,lt);function dt(ft){var vt=lt.call(this)||this;return vt._value=ft,vt}return Object.defineProperty(dt.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),dt.prototype._subscribe=function(ft){var vt=lt.prototype._subscribe.call(this,ft);return!vt.closed&&ft.next(this._value),vt},dt.prototype.getValue=function(){var ft=this,vt=ft.hasError,Et=ft.thrownError,Rt=ft._value;if(vt)throw Et;return this._throwIfClosed(),Rt},dt.prototype.next=function(ft){lt.prototype.next.call(this,this._value=ft)},dt})(Subject);var dateTimestampProvider={now:function(){return(dateTimestampProvider.delegate||Date).now()},delegate:void 0};(function(lt){__extends$1(dt,lt);function dt(ft,vt,Et){ft===void 0&&(ft=1/0),vt===void 0&&(vt=1/0),Et===void 0&&(Et=dateTimestampProvider);var Rt=lt.call(this)||this;return Rt._bufferSize=ft,Rt._windowTime=vt,Rt._timestampProvider=Et,Rt._buffer=[],Rt._infiniteTimeWindow=!0,Rt._infiniteTimeWindow=vt===1/0,Rt._bufferSize=Math.max(1,ft),Rt._windowTime=Math.max(1,vt),Rt}return dt.prototype.next=function(ft){var vt=this,Et=vt.isStopped,Rt=vt._buffer,St=vt._infiniteTimeWindow,At=vt._timestampProvider,Ct=vt._windowTime;Et||(Rt.push(ft),!St&&Rt.push(At.now()+Ct)),this._trimBuffer(),lt.prototype.next.call(this,ft)},dt.prototype._subscribe=function(ft){this._throwIfClosed(),this._trimBuffer();for(var vt=this._innerSubscribe(ft),Et=this,Rt=Et._infiniteTimeWindow,St=Et._buffer,At=St.slice(),Ct=0;Ct<At.length&&!ft.closed;Ct+=Rt?1:2)ft.next(At[Ct]);return this._checkFinalizedStatuses(ft),vt},dt.prototype._trimBuffer=function(){var ft=this,vt=ft._bufferSize,Et=ft._timestampProvider,Rt=ft._buffer,St=ft._infiniteTimeWindow,At=(St?1:2)*vt;if(vt<1/0&&At<Rt.length&&Rt.splice(0,Rt.length-At),!St){for(var Ct=Et.now(),kt=0,Tt=1;Tt<Rt.length&&Rt[Tt]<=Ct;Tt+=2)kt=Tt;kt&&Rt.splice(0,kt+1)}},dt})(Subject);(function(lt){__extends$1(dt,lt);function dt(){var ft=lt!==null&&lt.apply(this,arguments)||this;return ft._value=null,ft._hasValue=!1,ft._isComplete=!1,ft}return dt.prototype._checkFinalizedStatuses=function(ft){var vt=this,Et=vt.hasError,Rt=vt._hasValue,St=vt._value,At=vt.thrownError,Ct=vt.isStopped,kt=vt._isComplete;Et?ft.error(At):(Ct||kt)&&(Rt&&ft.next(St),ft.complete())},dt.prototype.next=function(ft){this.isStopped||(this._value=ft,this._hasValue=!0)},dt.prototype.complete=function(){var ft=this,vt=ft._hasValue,Et=ft._value,Rt=ft._isComplete;Rt||(this._isComplete=!0,vt&&lt.prototype.next.call(this,Et),lt.prototype.complete.call(this))},dt})(Subject);var Action=function(lt){__extends$1(dt,lt);function dt(ft,vt){return lt.call(this)||this}return dt.prototype.schedule=function(ft,vt){return this},dt}(Subscription),intervalProvider={setInterval:function(){for(var lt=[],dt=0;dt<arguments.length;dt++)lt[dt]=arguments[dt];var ft=intervalProvider.delegate;return((ft==null?void 0:ft.setInterval)||setInterval).apply(void 0,__spreadArray([],__read(lt)))},clearInterval:function(lt){return clearInterval(lt)},delegate:void 0},AsyncAction=function(lt){__extends$1(dt,lt);function dt(ft,vt){var Et=lt.call(this,ft,vt)||this;return Et.scheduler=ft,Et.work=vt,Et.pending=!1,Et}return dt.prototype.schedule=function(ft,vt){if(vt===void 0&&(vt=0),this.closed)return this;this.state=ft;var Et=this.id,Rt=this.scheduler;return Et!=null&&(this.id=this.recycleAsyncId(Rt,Et,vt)),this.pending=!0,this.delay=vt,this.id=this.id||this.requestAsyncId(Rt,this.id,vt),this},dt.prototype.requestAsyncId=function(ft,vt,Et){return Et===void 0&&(Et=0),intervalProvider.setInterval(ft.flush.bind(ft,this),Et)},dt.prototype.recycleAsyncId=function(ft,vt,Et){if(Et===void 0&&(Et=0),Et!=null&&this.delay===Et&&this.pending===!1)return vt;intervalProvider.clearInterval(vt)},dt.prototype.execute=function(ft,vt){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var Et=this._execute(ft,vt);if(Et)return Et;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},dt.prototype._execute=function(ft,vt){var Et=!1,Rt;try{this.work(ft)}catch(St){Et=!0,Rt=!!St&&St||new Error(St)}if(Et)return this.unsubscribe(),Rt},dt.prototype.unsubscribe=function(){if(!this.closed){var ft=this,vt=ft.id,Et=ft.scheduler,Rt=Et.actions;this.work=this.state=this.scheduler=null,this.pending=!1,arrRemove(Rt,this),vt!=null&&(this.id=this.recycleAsyncId(Et,vt,null)),this.delay=null,lt.prototype.unsubscribe.call(this)}},dt}(Action),nextHandle=1,resolved,activeHandles={};function findAndClearHandle(lt){return lt in activeHandles?(delete activeHandles[lt],!0):!1}var Immediate={setImmediate:function(lt){var dt=nextHandle++;return activeHandles[dt]=!0,resolved||(resolved=Promise.resolve()),resolved.then(function(){return findAndClearHandle(dt)&&lt()}),dt},clearImmediate:function(lt){findAndClearHandle(lt)}},setImmediate$1=Immediate.setImmediate,clearImmediate=Immediate.clearImmediate,immediateProvider={setImmediate:function(){for(var lt=[],dt=0;dt<arguments.length;dt++)lt[dt]=arguments[dt];var ft=immediateProvider.delegate;return((ft==null?void 0:ft.setImmediate)||setImmediate$1).apply(void 0,__spreadArray([],__read(lt)))},clearImmediate:function(lt){return clearImmediate(lt)},delegate:void 0},AsapAction=function(lt){__extends$1(dt,lt);function dt(ft,vt){var Et=lt.call(this,ft,vt)||this;return Et.scheduler=ft,Et.work=vt,Et}return dt.prototype.requestAsyncId=function(ft,vt,Et){return Et===void 0&&(Et=0),Et!==null&&Et>0?lt.prototype.requestAsyncId.call(this,ft,vt,Et):(ft.actions.push(this),ft._scheduled||(ft._scheduled=immediateProvider.setImmediate(ft.flush.bind(ft,void 0))))},dt.prototype.recycleAsyncId=function(ft,vt,Et){if(Et===void 0&&(Et=0),Et!=null&&Et>0||Et==null&&this.delay>0)return lt.prototype.recycleAsyncId.call(this,ft,vt,Et);ft.actions.length===0&&(immediateProvider.clearImmediate(vt),ft._scheduled=void 0)},dt}(AsyncAction),Scheduler=function(){function lt(dt,ft){ft===void 0&&(ft=lt.now),this.schedulerActionCtor=dt,this.now=ft}return lt.prototype.schedule=function(dt,ft,vt){return ft===void 0&&(ft=0),new this.schedulerActionCtor(this,dt).schedule(vt,ft)},lt.now=dateTimestampProvider.now,lt}(),AsyncScheduler=function(lt){__extends$1(dt,lt);function dt(ft,vt){vt===void 0&&(vt=Scheduler.now);var Et=lt.call(this,ft,vt)||this;return Et.actions=[],Et._active=!1,Et._scheduled=void 0,Et}return dt.prototype.flush=function(ft){var vt=this.actions;if(this._active){vt.push(ft);return}var Et;this._active=!0;do if(Et=ft.execute(ft.state,ft.delay))break;while(ft=vt.shift());if(this._active=!1,Et){for(;ft=vt.shift();)ft.unsubscribe();throw Et}},dt}(Scheduler),AsapScheduler=function(lt){__extends$1(dt,lt);function dt(){return lt!==null&&lt.apply(this,arguments)||this}return dt.prototype.flush=function(ft){this._active=!0,this._scheduled=void 0;var vt=this.actions,Et,Rt=-1;ft=ft||vt.shift();var St=vt.length;do if(Et=ft.execute(ft.state,ft.delay))break;while(++Rt<St&&(ft=vt.shift()));if(this._active=!1,Et){for(;++Rt<St&&(ft=vt.shift());)ft.unsubscribe();throw Et}},dt}(AsyncScheduler);new AsapScheduler(AsapAction);new AsyncScheduler(AsyncAction);var QueueAction=function(lt){__extends$1(dt,lt);function dt(ft,vt){var Et=lt.call(this,ft,vt)||this;return Et.scheduler=ft,Et.work=vt,Et}return dt.prototype.schedule=function(ft,vt){return vt===void 0&&(vt=0),vt>0?lt.prototype.schedule.call(this,ft,vt):(this.delay=vt,this.state=ft,this.scheduler.flush(this),this)},dt.prototype.execute=function(ft,vt){return vt>0||this.closed?lt.prototype.execute.call(this,ft,vt):this._execute(ft,vt)},dt.prototype.requestAsyncId=function(ft,vt,Et){return Et===void 0&&(Et=0),Et!=null&&Et>0||Et==null&&this.delay>0?lt.prototype.requestAsyncId.call(this,ft,vt,Et):ft.flush(this)},dt}(AsyncAction),QueueScheduler=function(lt){__extends$1(dt,lt);function dt(){return lt!==null&&lt.apply(this,arguments)||this}return dt}(AsyncScheduler);new QueueScheduler(QueueAction);var AnimationFrameAction=function(lt){__extends$1(dt,lt);function dt(ft,vt){var Et=lt.call(this,ft,vt)||this;return Et.scheduler=ft,Et.work=vt,Et}return dt.prototype.requestAsyncId=function(ft,vt,Et){return Et===void 0&&(Et=0),Et!==null&&Et>0?lt.prototype.requestAsyncId.call(this,ft,vt,Et):(ft.actions.push(this),ft._scheduled||(ft._scheduled=animationFrameProvider.requestAnimationFrame(function(){return ft.flush(void 0)})))},dt.prototype.recycleAsyncId=function(ft,vt,Et){if(Et===void 0&&(Et=0),Et!=null&&Et>0||Et==null&&this.delay>0)return lt.prototype.recycleAsyncId.call(this,ft,vt,Et);ft.actions.length===0&&(animationFrameProvider.cancelAnimationFrame(vt),ft._scheduled=void 0)},dt}(AsyncAction),AnimationFrameScheduler=function(lt){__extends$1(dt,lt);function dt(){return lt!==null&&lt.apply(this,arguments)||this}return dt.prototype.flush=function(ft){this._active=!0,this._scheduled=void 0;var vt=this.actions,Et,Rt=-1;ft=ft||vt.shift();var St=vt.length;do if(Et=ft.execute(ft.state,ft.delay))break;while(++Rt<St&&(ft=vt.shift()));if(this._active=!1,Et){for(;++Rt<St&&(ft=vt.shift());)ft.unsubscribe();throw Et}},dt}(AsyncScheduler);new AnimationFrameScheduler(AnimationFrameAction);(function(lt){__extends$1(dt,lt);function dt(ft,vt){ft===void 0&&(ft=VirtualAction),vt===void 0&&(vt=1/0);var Et=lt.call(this,ft,function(){return Et.frame})||this;return Et.maxFrames=vt,Et.frame=0,Et.index=-1,Et}return dt.prototype.flush=function(){for(var ft=this,vt=ft.actions,Et=ft.maxFrames,Rt,St;(St=vt[0])&&St.delay<=Et&&(vt.shift(),this.frame=St.delay,!(Rt=St.execute(St.state,St.delay))););if(Rt){for(;St=vt.shift();)St.unsubscribe();throw Rt}},dt.frameTimeFactor=10,dt})(AsyncScheduler);var VirtualAction=function(lt){__extends$1(dt,lt);function dt(ft,vt,Et){Et===void 0&&(Et=ft.index+=1);var Rt=lt.call(this,ft,vt)||this;return Rt.scheduler=ft,Rt.work=vt,Rt.index=Et,Rt.active=!0,Rt.index=ft.index=Et,Rt}return dt.prototype.schedule=function(ft,vt){if(vt===void 0&&(vt=0),Number.isFinite(vt)){if(!this.id)return lt.prototype.schedule.call(this,ft,vt);this.active=!1;var Et=new dt(this.scheduler,this.work);return this.add(Et),Et.schedule(ft,vt)}else return Subscription.EMPTY},dt.prototype.requestAsyncId=function(ft,vt,Et){Et===void 0&&(Et=0),this.delay=ft.frame+Et;var Rt=ft.actions;return Rt.push(this),Rt.sort(dt.sortActions),!0},dt.prototype.recycleAsyncId=function(ft,vt,Et){},dt.prototype._execute=function(ft,vt){if(this.active===!0)return lt.prototype._execute.call(this,ft,vt)},dt.sortActions=function(ft,vt){return ft.delay===vt.delay?ft.index===vt.index?0:ft.index>vt.index?1:-1:ft.delay>vt.delay?1:-1},dt}(AsyncAction),EMPTY=new Observable(function(lt){return lt.complete()});function scheduleArray(lt,dt){return new Observable(function(ft){var vt=0;return dt.schedule(function(){vt===lt.length?ft.complete():(ft.next(lt[vt++]),ft.closed||this.schedule())})})}function fromArrayLike(lt){return new Observable(function(dt){for(var ft=0;ft<lt.length&&!dt.closed;ft++)dt.next(lt[ft]);dt.complete()})}function internalFromArray(lt,dt){return dt?scheduleArray(lt,dt):fromArrayLike(lt)}function isScheduler(lt){return lt&&isFunction$1(lt.schedule)}function last$1(lt){return lt[lt.length-1]}function popScheduler(lt){return isScheduler(last$1(lt))?lt.pop():void 0}function of$1(){for(var lt=[],dt=0;dt<arguments.length;dt++)lt[dt]=arguments[dt];var ft=popScheduler(lt);return ft?scheduleArray(lt,ft):internalFromArray(lt)}function throwError(lt,dt){var ft=isFunction$1(lt)?lt:function(){return lt},vt=function(Et){return Et.error(ft())};return new Observable(dt?function(Et){return dt.schedule(vt,0,Et)}:vt)}var NotificationKind;(function(lt){lt.NEXT="N",lt.ERROR="E",lt.COMPLETE="C"})(NotificationKind||(NotificationKind={}));(function(){function lt(dt,ft,vt){this.kind=dt,this.value=ft,this.error=vt,this.hasValue=dt==="N"}return lt.prototype.observe=function(dt){return observeNotification(this,dt)},lt.prototype.do=function(dt,ft,vt){var Et=this,Rt=Et.kind,St=Et.value,At=Et.error;return Rt==="N"?dt==null?void 0:dt(St):Rt==="E"?ft==null?void 0:ft(At):vt==null?void 0:vt()},lt.prototype.accept=function(dt,ft,vt){var Et;return isFunction$1((Et=dt)===null||Et===void 0?void 0:Et.next)?this.observe(dt):this.do(dt,ft,vt)},lt.prototype.toObservable=function(){var dt=this,ft=dt.kind,vt=dt.value,Et=dt.error,Rt=ft==="N"?of$1(vt):ft==="E"?throwError(function(){return Et}):ft==="C"?EMPTY:0;if(!Rt)throw new TypeError("Unexpected notification kind "+ft);return Rt},lt.createNext=function(dt){return new lt("N",dt)},lt.createError=function(dt){return new lt("E",void 0,dt)},lt.createComplete=function(){return lt.completeNotification},lt.completeNotification=new lt("C"),lt})();function observeNotification(lt,dt){var ft,vt,Et,Rt=lt,St=Rt.kind,At=Rt.value,Ct=Rt.error;if(typeof St!="string")throw new TypeError('Invalid notification, missing "kind"');St==="N"?(ft=dt.next)===null||ft===void 0||ft.call(dt,At):St==="E"?(vt=dt.error)===null||vt===void 0||vt.call(dt,Ct):(Et=dt.complete)===null||Et===void 0||Et.call(dt)}createErrorClass(function(lt){return function(){lt(this),this.name="EmptyError",this.message="no elements in sequence"}});createErrorClass(function(lt){return function(){lt(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}});createErrorClass(function(lt){return function(dt){lt(this),this.name="NotFoundError",this.message=dt}});createErrorClass(function(lt){return function(dt){lt(this),this.name="SequenceError",this.message=dt}});createErrorClass(function(lt){return function(dt){dt===void 0&&(dt=null),lt(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=dt}});function filter(lt,dt){return operate(function(ft,vt){var Et=0;ft.subscribe(new OperatorSubscriber(vt,function(Rt){return lt.call(dt,Rt,Et++)&&vt.next(Rt)}))})}(function(lt){__extends$1(dt,lt);function dt(){var ft=lt!==null&&lt.apply(this,arguments)||this;return ft.activeGroups=0,ft.teardownAttempted=!1,ft}return dt.prototype.unsubscribe=function(){this.teardownAttempted=!0,this.activeGroups===0&&lt.prototype.unsubscribe.call(this)},dt})(OperatorSubscriber);class Bus{constructor(){m$5(this,"agents",{}),m$5(this,"comm",new Subject)}setAgentFor(dt,ft,vt){let Et=this.getActionMapping(dt);Et[ft]=vt}getAgentFor(dt,ft){return this.getActionMapping(dt)[ft]}publish(dt,ft,vt){return Promise.resolve().then(()=>{var Et;return(Et=this.getAgentFor(dt,ft))!=null?Et:explorer.requestAgentFor(dt,ft)}).then(Et=>{const Rt=Et.activate(dt,ft,vt);return this.comm.next({res:dt,action:ft,input:vt,output:Rt}),Rt})}subscribe(dt,ft){return this.comm.asObservable().pipe(filter(vt=>vt.res===dt&&vt.action===ft))}getActionMapping(dt){let ft=this.agents[dt];if(typeof ft>"u"){ft={};for(let vt of Object.values(ACTION))ft[vt]=null;this.agents[dt]=ft}return ft}}class BusFactory{static get instance(){return this._instance=this._instance||new Bus}}m$5(BusFactory,"_instance");const y$4=class{constructor(dt){m$5(this,"managedResource"),m$5(this,"handlerFor",{comment:y$4.defaultHandler,copy:y$4.defaultHandler,create:y$4.defaultHandler,delete:y$4.defaultHandler,export:y$4.defaultHandler,initialize:y$4.defaultHandler,manage:y$4.defaultHandler,properties:y$4.defaultHandler,move:y$4.defaultHandler,open:y$4.defaultHandler,print:y$4.defaultHandler,publish:y$4.defaultHandler,search:y$4.defaultHandler,share:y$4.defaultHandler,distribute:y$4.defaultHandler,pages_list:y$4.defaultHandler,register:y$4.defaultHandler,trash:y$4.defaultHandler,publish_moodle:y$4.defaultHandler,restore:y$4.defaultHandler}),this.managedResource=dt,this.initialize()}initialize(){for(let dt in Object.values(ACTION))this.handlerFor[dt]=y$4.defaultHandler;this.registerHandlers()}setHandler(dt,ft){BusFactory.instance.setAgentFor(this.managedResource,dt,this),this.handlerFor[dt]=ft}getHandler(dt){return this.handlerFor[dt]}activate(dt,ft,vt){return Promise.resolve().then(()=>this.getHandler(ft).bind(this)(vt))}};let AbstractBusAgent=y$4;m$5(AbstractBusAgent,"defaultHandler",function(lt){throw new Error(ERROR_CODE.NOT_SUPPORTED)});console.log("Blog agent loading....");class BlogAgent extends AbstractBusAgent{constructor(){super(RESOURCE.BLOG),m$5(this,"ctx",null),m$5(this,"http",TransportFrameworkFactory.instance().newHttpInstance()),m$5(this,"checkHttpResponse",dt=>{if(this.http.latestResponse.status>=300)throw this.http.latestResponse.statusText;return dt}),this.registerHandlers(),console.log("Blog agent initialized!")}registerHandlers(){this.setHandler(ACTION.OPEN,this.openBlog),this.setHandler(ACTION.CREATE,this.createBlog),this.setHandler(ACTION.MANAGE,this.onManage),this.setHandler(ACTION.UPD_PROPS,this.onUpdateProps),this.setHandler(ACTION.PRINT,this.onPrint),this.setHandler(ACTION.PUBLISH,this.onPublish)}onPrint(dt){window.open(`/blog/print/blog#/print/${dt.resourceId}?comments=${dt.withComments||!0}`,"_blank")}openBlog(dt){window.open(`/blog#/view/${dt.resourceId}`,"_self")}createBlog(dt){window.open("/blog#/edit/new","_self")}onManage(dt){const ft={genericProps:[{key:PROP_KEY.TITLE},{key:PROP_KEY.IMAGE},{key:PROP_KEY.URL}]};return Promise.resolve().then(()=>ft)}onUpdateProps(dt){const ft={resources:dt.resources};return alert("TODO: update properties"),Promise.resolve().then(()=>ft)}async onPublish(dt){const ft=new FormData;return ft.append("title",dt.title),ft.append("cover",dt.cover),ft.append("coverName",dt.cover.name),ft.append("coverType",dt.cover.type),ft.append("teacherAvatar",dt.teacherAvatar),ft.append("teacherAvatarName",dt.teacherAvatar.name||`teacherAvatar_${dt.userId}`),ft.append("teacherAvatarType",dt.teacherAvatar.type),ft.append("language",dt.language),dt.activityType.forEach(vt=>{ft.append("activityType[]",vt)}),dt.subjectArea.forEach(vt=>{ft.append("subjectArea[]",vt)}),dt.age.forEach(vt=>{ft.append("age[]",vt.toString())}),ft.append("description",dt.description),dt.keyWords.split(",").forEach(vt=>{ft.append("keyWords[]",vt.trim())}),ft.append("licence",dt.licence),ft.append("pdfUri",`${window.location.origin}/blog/print/blog#/print/${dt.resourceId}`),ft.append("application",dt.application?dt.application:""),ft.append("resourceId",dt.resourceId),ft.append("teacherSchool",dt.userStructureName),this.http.post("/appregistry/library/resource",ft,{headers:{"Content-Type":"multipart/form-data"}}).then(this.checkHttpResponse)}}const factory$1=()=>new BlogAgent;class FolderAgent extends AbstractBusAgent{constructor(){super(RESOURCE.FOLDER),m$5(this,"ctx",null),m$5(this,"http",TransportFrameworkFactory.instance().newHttpInstance({paramsSerializer:function(dt){return Object.entries(dt).map(ft=>ft[1]instanceof Array?ft[1].map(vt=>`${ft[0]}=${encodeURIComponent(vt)}`).join("&"):["string","number","boolean"].indexOf(typeof ft[1])>=0?`${ft[0]}=${encodeURIComponent(ft[1])}`:"").join("&")}})),m$5(this,"checkHttpResponse",dt=>{if(this.http.latestResponse.status>=300)throw this.http.latestResponse.statusText;return dt}),this.registerHandlers()}registerHandlers(){this.setHandler(ACTION.INITIALIZE,this.createContext),this.setHandler(ACTION.SEARCH,this.searchContext),this.setHandler(ACTION.CREATE,this.createFolder),this.setHandler(ACTION.OPEN,this.listSubfolders),this.setHandler(ACTION.MOVE,this.moveToFolder),this.setHandler(ACTION.DELETE,this.deleteFolders),this.setHandler(ACTION.TRASH,this.trashFolders),this.setHandler(ACTION.MANAGE,this.onManage),this.setHandler(ACTION.UPD_PROPS,this.updateFolder)}createContext(dt){return this.http.get("/explorer/context",{queryParams:this.toQueryParams(dt)}).then(this.checkHttpResponse)}searchContext(dt){return this.http.get("/explorer/resources",{queryParams:this.toQueryParams(dt)}).then(this.checkHttpResponse)}createFolder(dt){return this.http.post("/explorer/folders",this.createFolderToBodyParams(dt)).then(this.checkHttpResponse)}updateFolder(dt){return this.http.put(`/explorer/folders/${dt.folderId}`,this.createFolderToBodyParams(dt)).then(this.checkHttpResponse)}moveToFolder(dt){return this.http.post(`/explorer/folders/${dt.folderId}/move`,this.moveToBodyParams(dt)).then(this.checkHttpResponse)}listSubfolders(dt){return this.http.get(`/explorer/folders/${dt}/move`).then(this.checkHttpResponse)}deleteFolders(dt){return this.http.deleteJson("/explorer",dt).then(this.checkHttpResponse)}trashFolders({trash:dt,resourceType:ft,...vt}){return this.http.putJson(`/explorer/${dt?"trash":"restore"}`,vt).then(this.checkHttpResponse)}onManage(dt){const ft={genericProps:[{key:PROP_KEY.TITLE},{key:PROP_KEY.IMAGE},{key:PROP_KEY.URL}]};return Promise.resolve().then(()=>ft)}toQueryParams(dt){let ft={application:dt.app,start_idx:dt.pagination.startIdx,page_size:dt.pagination.pageSize,resource_type:dt.types};return dt.orders&&(ft.order_by=Object.entries(dt.orders).map(vt=>`${vt[0]}:${vt[1]}`)),dt.filters&&Object.assign(ft,dt.filters),typeof dt.search=="string"&&(ft.search=dt.search),ft}createFolderToBodyParams(dt){return{application:dt.app,resourceType:dt.type,parentId:dt.parentId,name:dt.name}}moveToBodyParams(dt){return{application:dt.application,resourceType:this.managedResource,resourceIds:dt.resourceIds,folderIds:dt.folderIds}}}const factory=()=>new FolderAgent;class AgentLoader{load(dt){let ft=appNameForResource[dt];if(typeof ft!="string")throw new Error(`The resource type ${dt} is not supported yet.`);switch(ft){case APP.EXPLORER:factory();break;case APP.BLOG:factory$1();break;default:throw new Error(`The resource type ${dt} is not supported yet.`)}return Promise.resolve()}}class ExplorerContext{constructor(dt,ft){m$5(this,"searchParameters"),m$5(this,"context"),m$5(this,"bus"),m$5(this,"latestResults",new Subject),this.context=null,this.bus=ExplorerFrameworkFactory.instance().getBus(),this.searchParameters={types:dt,app:ft,filters:{},pagination:{startIdx:0,pageSize:20}}}clear(){this.searchParameters.filters={owner:!0,shared:!0,public:!0},this.searchParameters.pagination.startIdx=0,this.searchParameters.pagination.pageSize=20,this.context=null}isInitialized(){return this.context!==null}getContext(){if(this.context!==null)return this.context}getSearchParameters(){return this.searchParameters}duplicateSearchParameters(){return JSON.parse(JSON.stringify(this.searchParameters))}latestResources(){return this.latestResults.asObservable()}initialize(){const dt=this.duplicateSearchParameters();return Promise.resolve().then(()=>this.bus.publish(RESOURCE.FOLDER,ACTION.INITIALIZE,dt)).then(ft=>{if(this.context=ft,!this.context)throw new Error(ERROR_CODE.UNKNOWN);return this.latestResults.next({input:dt,output:this.context}),this.context})}getResources(){const dt=this.duplicateSearchParameters();return this.bus.publish(RESOURCE.FOLDER,ACTION.SEARCH,dt).then(ft=>{let vt=ft;if(!vt)throw new Error(ERROR_CODE.UNKNOWN);return this.latestResults.next({input:dt,output:vt}),vt})}getSubFolders(dt){throw new Error("Method not implemented.")}createFolder(dt,ft,vt){const Et={app:this.searchParameters.app,name:vt,parentId:ft,type:dt};return this.bus.publish(RESOURCE.FOLDER,ACTION.CREATE,Et).then(Rt=>{let St=Rt;if(!St)throw new Error(ERROR_CODE.UNKNOWN);return St})}updateFolder(dt,ft,vt,Et){const Rt={folderId:dt,app:this.searchParameters.app,name:Et,parentId:vt,type:ft};return this.bus.publish(RESOURCE.FOLDER,ACTION.UPD_PROPS,Rt).then(St=>{let At=St;if(!At)throw new Error(ERROR_CODE.UNKNOWN);return At})}copy(dt,ft,vt){const Et={application:this.searchParameters.app,folderId:dt,resourceIds:ft,folderIds:vt};return this.bus.publish(RESOURCE.FOLDER,ACTION.COPY,Et).then(Rt=>{})}move(dt,ft,vt){const Et={application:this.searchParameters.app,folderId:dt,resourceIds:ft,folderIds:vt};return this.bus.publish(RESOURCE.FOLDER,ACTION.MOVE,Et).then(Rt=>{})}delete(dt,ft){const vt={application:this.searchParameters.app,resourceType:this.searchParameters.types[0],resourceIds:dt,folderIds:ft};return this.bus.publish(RESOURCE.FOLDER,ACTION.DELETE,vt).then(Et=>{})}trash(dt,ft,vt){const Et={trash:dt,application:this.searchParameters.app,resourceType:this.searchParameters.types[0],resourceIds:ft,folderIds:vt};return this.bus.publish(RESOURCE.FOLDER,ACTION.TRASH,Et).then(Rt=>{})}manageProperties(dt,ft){const vt={resources:ft};return this.bus.publish(dt,ACTION.MANAGE,vt).then(Et=>{let Rt=Et;if(!Rt)throw new Error(ERROR_CODE.UNKNOWN);return Rt})}updateProperties(dt,ft,vt){const Et={resources:ft,props:vt};return this.bus.publish(dt,ACTION.UPD_PROPS,Et).then(Rt=>{let St=Rt;if(!St)throw new Error(ERROR_CODE.UNKNOWN);return St})}publish(dt,ft){return this.bus.publish(dt,ACTION.PUBLISH,ft).then(vt=>{let Et=vt;if(!Et)throw new Error(ERROR_CODE.UNKNOWN);return Et})}}class ExplorerFramework{constructor(){m$5(this,"_agentLoader")}get agentLoader(){return this._agentLoader||(this._agentLoader=new AgentLoader),this._agentLoader}setAgentLoader(dt){dt&&(this._agentLoader=dt)}requestAgentFor(dt,ft){return this.agentLoader.load(dt).then(()=>{let vt=this.getBus().getAgentFor(dt,ft);if(!vt)throw new Error(ERROR_CODE.AGENT_NOT_FOUND);return vt})}createContext(dt,ft){return new ExplorerContext(dt,ft)}getBus(){return BusFactory.instance}}const explorer=new ExplorerFramework;class ExplorerFrameworkFactory{static instance(){return explorer}}const RESOURCE={FOLDER:"folder",BLOG:"blog",EXERCISE:"exercise"},appNameForResource={folder:APP.EXPLORER,blog:APP.BLOG,exercise:APP.EXERCIZER},ACTION={INITIALIZE:"initialize",SEARCH:"search",CREATE:"create",OPEN:"open",MANAGE:"manage",UPD_PROPS:"properties",COMMENT:"comment",DELETE:"delete",TRASH:"trash",RESTORE:"restore",MOVE:"move",COPY:"copy",EXPORT:"export",SHARE:"share",PRINT:"print",PAGES_LIST:"pages_list",DISTRIBUTE:"distribute",REGISTER:"register",PUBLISH:"publish",PUBLISH_MOODLE:"publish_moodle"},FOLDER={BIN:"bin",DEFAULT:"default"},PROP_KEY={TITLE:"title",IMAGE:"image",COLOR:"color",DESCRIPTION:"description",URL:"url"},ASYNC_DATA_NAME={SESSION_READY:"sessionReady",LANG_READY:"langReady",SKIN_READY:"skinReady",OVERRIDE_READY:"overrideReady"};class Promisified{constructor(){m$5(this,"_resolution"),m$5(this,"_rejection"),m$5(this,"_promise",new Promise((dt,ft)=>{this._resolution=dt,this._rejection=ft}))}get promise(){return this._promise}resolve(dt){this._resolution&&this._resolution(dt)}reject(dt){this._rejection&&this._rejection(dt)}}class NotifyFramework{constructor(){m$5(this,"promises",{}),m$5(this,"subject",new Subject)}asyncData(dt){return typeof this.promises[dt]>"u"&&(this.promises[dt]=new Promisified),this.promises[dt]}onSessionReady(){return this.asyncData(ASYNC_DATA_NAME.SESSION_READY)}onLangReady(){return this.asyncData(ASYNC_DATA_NAME.LANG_READY)}onSkinReady(){return this.asyncData(ASYNC_DATA_NAME.SKIN_READY)}onOverridesReady(){return this.asyncData(ASYNC_DATA_NAME.OVERRIDE_READY)}promisify(){return new Promisified}events(){return this.subject}}const notify=new NotifyFramework,LAYER_NAME={WIDGETS:"widgets",EXPLORER:"explorer"},EVENT_NAME={USERPREF_CHANGED:"userprefChanged",SEARCH_RESULTED:"searchResulted"};function getDefaultExportFromCjs(lt){return lt&&lt.__esModule&&Object.prototype.hasOwnProperty.call(lt,"default")?lt.default:lt}var axios$3={exports:{}},axios$2={exports:{}},bind$2=function(lt,dt){return function(){for(var ft=new Array(arguments.length),vt=0;vt<ft.length;vt++)ft[vt]=arguments[vt];return lt.apply(dt,ft)}},bind$1=bind$2,toString=Object.prototype.toString;function isArray(lt){return toString.call(lt)==="[object Array]"}function isUndefined(lt){return typeof lt>"u"}function isBuffer(lt){return lt!==null&&!isUndefined(lt)&&lt.constructor!==null&&!isUndefined(lt.constructor)&&typeof lt.constructor.isBuffer=="function"&&lt.constructor.isBuffer(lt)}function isArrayBuffer(lt){return toString.call(lt)==="[object ArrayBuffer]"}function isFormData(lt){return typeof FormData<"u"&&lt instanceof FormData}function isArrayBufferView(lt){var dt;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?dt=ArrayBuffer.isView(lt):dt=lt&&lt.buffer&&lt.buffer instanceof ArrayBuffer,dt}function isString(lt){return typeof lt=="string"}function isNumber(lt){return typeof lt=="number"}function isObject(lt){return lt!==null&&typeof lt=="object"}function isPlainObject$1(lt){if(toString.call(lt)!=="[object Object]")return!1;var dt=Object.getPrototypeOf(lt);return dt===null||dt===Object.prototype}function isDate(lt){return toString.call(lt)==="[object Date]"}function isFile(lt){return toString.call(lt)==="[object File]"}function isBlob(lt){return toString.call(lt)==="[object Blob]"}function isFunction(lt){return toString.call(lt)==="[object Function]"}function isStream(lt){return isObject(lt)&&isFunction(lt.pipe)}function isURLSearchParams(lt){return typeof URLSearchParams<"u"&&lt instanceof URLSearchParams}function trim$1(lt){return lt.replace(/^\s*/,"").replace(/\s*$/,"")}function isStandardBrowserEnv(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function forEach(lt,dt){if(!(lt===null||typeof lt>"u"))if(typeof lt!="object"&&(lt=[lt]),isArray(lt))for(var ft=0,vt=lt.length;ft<vt;ft++)dt.call(null,lt[ft],ft,lt);else for(var Et in lt)Object.prototype.hasOwnProperty.call(lt,Et)&&dt.call(null,lt[Et],Et,lt)}function merge(){var lt={};function dt(Et,Rt){isPlainObject$1(lt[Rt])&&isPlainObject$1(Et)?lt[Rt]=merge(lt[Rt],Et):isPlainObject$1(Et)?lt[Rt]=merge({},Et):isArray(Et)?lt[Rt]=Et.slice():lt[Rt]=Et}for(var ft=0,vt=arguments.length;ft<vt;ft++)forEach(arguments[ft],dt);return lt}function extend(lt,dt,ft){return forEach(dt,function(vt,Et){ft&&typeof vt=="function"?lt[Et]=bind$1(vt,ft):lt[Et]=vt}),lt}function stripBOM(lt){return lt.charCodeAt(0)===65279&&(lt=lt.slice(1)),lt}var utils$9={isArray,isArrayBuffer,isBuffer,isFormData,isArrayBufferView,isString,isNumber,isObject,isPlainObject:isPlainObject$1,isUndefined,isDate,isFile,isBlob,isFunction,isStream,isURLSearchParams,isStandardBrowserEnv,forEach,merge,extend,trim:trim$1,stripBOM},utils$8=utils$9;function encode(lt){return encodeURIComponent(lt).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var buildURL$1=function(lt,dt,ft){if(!dt)return lt;var vt;if(ft)vt=ft(dt);else if(utils$8.isURLSearchParams(dt))vt=dt.toString();else{var Et=[];utils$8.forEach(dt,function(St,At){St===null||typeof St>"u"||(utils$8.isArray(St)?At=At+"[]":St=[St],utils$8.forEach(St,function(Ct){utils$8.isDate(Ct)?Ct=Ct.toISOString():utils$8.isObject(Ct)&&(Ct=JSON.stringify(Ct)),Et.push(encode(At)+"="+encode(Ct))}))}),vt=Et.join("&")}if(vt){var Rt=lt.indexOf("#");Rt!==-1&&(lt=lt.slice(0,Rt)),lt+=(lt.indexOf("?")===-1?"?":"&")+vt}return lt},utils$7=utils$9;function InterceptorManager$1(){this.handlers=[]}InterceptorManager$1.prototype.use=function(lt,dt){return this.handlers.push({fulfilled:lt,rejected:dt}),this.handlers.length-1};InterceptorManager$1.prototype.eject=function(lt){this.handlers[lt]&&(this.handlers[lt]=null)};InterceptorManager$1.prototype.forEach=function(lt){utils$7.forEach(this.handlers,function(dt){dt!==null&&lt(dt)})};var InterceptorManager_1=InterceptorManager$1,utils$6=utils$9,transformData$1=function(lt,dt,ft){return utils$6.forEach(ft,function(vt){lt=vt(lt,dt)}),lt},isCancel$1,hasRequiredIsCancel;function requireIsCancel(){return hasRequiredIsCancel||(hasRequiredIsCancel=1,isCancel$1=function(lt){return!!(lt&&lt.__CANCEL__)}),isCancel$1}var utils$5=utils$9,normalizeHeaderName$1=function(lt,dt){utils$5.forEach(lt,function(ft,vt){vt!==dt&&vt.toUpperCase()===dt.toUpperCase()&&(lt[dt]=ft,delete lt[vt])})},enhanceError,hasRequiredEnhanceError;function requireEnhanceError(){return hasRequiredEnhanceError||(hasRequiredEnhanceError=1,enhanceError=function(lt,dt,ft,vt,Et){return lt.config=dt,ft&&(lt.code=ft),lt.request=vt,lt.response=Et,lt.isAxiosError=!0,lt.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},lt}),enhanceError}var createError,hasRequiredCreateError;function requireCreateError(){if(hasRequiredCreateError)return createError;hasRequiredCreateError=1;var lt=requireEnhanceError();return createError=function(dt,ft,vt,Et,Rt){var St=new Error(dt);return lt(St,ft,vt,Et,Rt)},createError}var settle,hasRequiredSettle;function requireSettle(){if(hasRequiredSettle)return settle;hasRequiredSettle=1;var lt=requireCreateError();return settle=function(dt,ft,vt){var Et=vt.config.validateStatus;!vt.status||!Et||Et(vt.status)?dt(vt):ft(lt("Request failed with status code "+vt.status,vt.config,null,vt.request,vt))},settle}var cookies,hasRequiredCookies;function requireCookies(){if(hasRequiredCookies)return cookies;hasRequiredCookies=1;var lt=utils$9;return cookies=lt.isStandardBrowserEnv()?function(){return{write:function(dt,ft,vt,Et,Rt,St){var At=[];At.push(dt+"="+encodeURIComponent(ft)),lt.isNumber(vt)&&At.push("expires="+new Date(vt).toGMTString()),lt.isString(Et)&&At.push("path="+Et),lt.isString(Rt)&&At.push("domain="+Rt),St===!0&&At.push("secure"),document.cookie=At.join("; ")},read:function(dt){var ft=document.cookie.match(new RegExp("(^|;\\s*)("+dt+")=([^;]*)"));return ft?decodeURIComponent(ft[3]):null},remove:function(dt){this.write(dt,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),cookies}var isAbsoluteURL,hasRequiredIsAbsoluteURL;function requireIsAbsoluteURL(){return hasRequiredIsAbsoluteURL||(hasRequiredIsAbsoluteURL=1,isAbsoluteURL=function(lt){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(lt)}),isAbsoluteURL}var combineURLs,hasRequiredCombineURLs;function requireCombineURLs(){return hasRequiredCombineURLs||(hasRequiredCombineURLs=1,combineURLs=function(lt,dt){return dt?lt.replace(/\/+$/,"")+"/"+dt.replace(/^\/+/,""):lt}),combineURLs}var buildFullPath,hasRequiredBuildFullPath;function requireBuildFullPath(){if(hasRequiredBuildFullPath)return buildFullPath;hasRequiredBuildFullPath=1;var lt=requireIsAbsoluteURL(),dt=requireCombineURLs();return buildFullPath=function(ft,vt){return ft&&!lt(vt)?dt(ft,vt):vt},buildFullPath}var parseHeaders,hasRequiredParseHeaders;function requireParseHeaders(){if(hasRequiredParseHeaders)return parseHeaders;hasRequiredParseHeaders=1;var lt=utils$9,dt=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return parseHeaders=function(ft){var vt={},Et,Rt,St;return ft&&lt.forEach(ft.split(`
41
- `),function(At){if(St=At.indexOf(":"),Et=lt.trim(At.substr(0,St)).toLowerCase(),Rt=lt.trim(At.substr(St+1)),Et){if(vt[Et]&&dt.indexOf(Et)>=0)return;Et==="set-cookie"?vt[Et]=(vt[Et]?vt[Et]:[]).concat([Rt]):vt[Et]=vt[Et]?vt[Et]+", "+Rt:Rt}}),vt},parseHeaders}var isURLSameOrigin,hasRequiredIsURLSameOrigin;function requireIsURLSameOrigin(){if(hasRequiredIsURLSameOrigin)return isURLSameOrigin;hasRequiredIsURLSameOrigin=1;var lt=utils$9;return isURLSameOrigin=lt.isStandardBrowserEnv()?function(){var dt=/(msie|trident)/i.test(navigator.userAgent),ft=document.createElement("a"),vt;function Et(Rt){var St=Rt;return dt&&(ft.setAttribute("href",St),St=ft.href),ft.setAttribute("href",St),{href:ft.href,protocol:ft.protocol?ft.protocol.replace(/:$/,""):"",host:ft.host,search:ft.search?ft.search.replace(/^\?/,""):"",hash:ft.hash?ft.hash.replace(/^#/,""):"",hostname:ft.hostname,port:ft.port,pathname:ft.pathname.charAt(0)==="/"?ft.pathname:"/"+ft.pathname}}return vt=Et(window.location.href),function(Rt){var St=lt.isString(Rt)?Et(Rt):Rt;return St.protocol===vt.protocol&&St.host===vt.host}}():function(){return function(){return!0}}(),isURLSameOrigin}var xhr,hasRequiredXhr;function requireXhr(){if(hasRequiredXhr)return xhr;hasRequiredXhr=1;var lt=utils$9,dt=requireSettle(),ft=requireCookies(),vt=buildURL$1,Et=requireBuildFullPath(),Rt=requireParseHeaders(),St=requireIsURLSameOrigin(),At=requireCreateError();return xhr=function(Ct){return new Promise(function(kt,Tt){var Nt=Ct.data,Ft=Ct.headers;lt.isFormData(Nt)&&delete Ft["Content-Type"];var Dt=new XMLHttpRequest;if(Ct.auth){var Ut=Ct.auth.username||"",zt=Ct.auth.password?unescape(encodeURIComponent(Ct.auth.password)):"";Ft.Authorization="Basic "+btoa(Ut+":"+zt)}var Zt=Et(Ct.baseURL,Ct.url);if(Dt.open(Ct.method.toUpperCase(),vt(Zt,Ct.params,Ct.paramsSerializer),!0),Dt.timeout=Ct.timeout,Dt.onreadystatechange=function(){if(!(!Dt||Dt.readyState!==4)&&!(Dt.status===0&&!(Dt.responseURL&&Dt.responseURL.indexOf("file:")===0))){var Bt="getAllResponseHeaders"in Dt?Rt(Dt.getAllResponseHeaders()):null,Wt=!Ct.responseType||Ct.responseType==="text"?Dt.responseText:Dt.response,Kt={data:Wt,status:Dt.status,statusText:Dt.statusText,headers:Bt,config:Ct,request:Dt};dt(kt,Tt,Kt),Dt=null}},Dt.onabort=function(){!Dt||(Tt(At("Request aborted",Ct,"ECONNABORTED",Dt)),Dt=null)},Dt.onerror=function(){Tt(At("Network Error",Ct,null,Dt)),Dt=null},Dt.ontimeout=function(){var Bt="timeout of "+Ct.timeout+"ms exceeded";Ct.timeoutErrorMessage&&(Bt=Ct.timeoutErrorMessage),Tt(At(Bt,Ct,"ECONNABORTED",Dt)),Dt=null},lt.isStandardBrowserEnv()){var Ht=(Ct.withCredentials||St(Zt))&&Ct.xsrfCookieName?ft.read(Ct.xsrfCookieName):void 0;Ht&&(Ft[Ct.xsrfHeaderName]=Ht)}if("setRequestHeader"in Dt&&lt.forEach(Ft,function(Bt,Wt){typeof Nt>"u"&&Wt.toLowerCase()==="content-type"?delete Ft[Wt]:Dt.setRequestHeader(Wt,Bt)}),lt.isUndefined(Ct.withCredentials)||(Dt.withCredentials=!!Ct.withCredentials),Ct.responseType)try{Dt.responseType=Ct.responseType}catch(Bt){if(Ct.responseType!=="json")throw Bt}typeof Ct.onDownloadProgress=="function"&&Dt.addEventListener("progress",Ct.onDownloadProgress),typeof Ct.onUploadProgress=="function"&&Dt.upload&&Dt.upload.addEventListener("progress",Ct.onUploadProgress),Ct.cancelToken&&Ct.cancelToken.promise.then(function(Bt){!Dt||(Dt.abort(),Tt(Bt),Dt=null)}),Nt||(Nt=null),Dt.send(Nt)})},xhr}var utils$4=utils$9,normalizeHeaderName=normalizeHeaderName$1,DEFAULT_CONTENT_TYPE={"Content-Type":"application/x-www-form-urlencoded"};function setContentTypeIfUnset(lt,dt){!utils$4.isUndefined(lt)&&utils$4.isUndefined(lt["Content-Type"])&&(lt["Content-Type"]=dt)}function getDefaultAdapter(){var lt;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(lt=requireXhr()),lt}var defaults$2={adapter:getDefaultAdapter(),transformRequest:[function(lt,dt){return normalizeHeaderName(dt,"Accept"),normalizeHeaderName(dt,"Content-Type"),utils$4.isFormData(lt)||utils$4.isArrayBuffer(lt)||utils$4.isBuffer(lt)||utils$4.isStream(lt)||utils$4.isFile(lt)||utils$4.isBlob(lt)?lt:utils$4.isArrayBufferView(lt)?lt.buffer:utils$4.isURLSearchParams(lt)?(setContentTypeIfUnset(dt,"application/x-www-form-urlencoded;charset=utf-8"),lt.toString()):utils$4.isObject(lt)?(setContentTypeIfUnset(dt,"application/json;charset=utf-8"),JSON.stringify(lt)):lt}],transformResponse:[function(lt){if(typeof lt=="string")try{lt=JSON.parse(lt)}catch{}return lt}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(lt){return lt>=200&&lt<300}};defaults$2.headers={common:{Accept:"application/json, text/plain, */*"}};utils$4.forEach(["delete","get","head"],function(lt){defaults$2.headers[lt]={}});utils$4.forEach(["post","put","patch"],function(lt){defaults$2.headers[lt]=utils$4.merge(DEFAULT_CONTENT_TYPE)});var defaults_1=defaults$2,utils$3=utils$9,transformData=transformData$1,isCancel=requireIsCancel(),defaults$1=defaults_1;function throwIfCancellationRequested(lt){lt.cancelToken&&lt.cancelToken.throwIfRequested()}var dispatchRequest$1=function(lt){throwIfCancellationRequested(lt),lt.headers=lt.headers||{},lt.data=transformData(lt.data,lt.headers,lt.transformRequest),lt.headers=utils$3.merge(lt.headers.common||{},lt.headers[lt.method]||{},lt.headers),utils$3.forEach(["delete","get","head","post","put","patch","common"],function(ft){delete lt.headers[ft]});var dt=lt.adapter||defaults$1.adapter;return dt(lt).then(function(ft){return throwIfCancellationRequested(lt),ft.data=transformData(ft.data,ft.headers,lt.transformResponse),ft},function(ft){return isCancel(ft)||(throwIfCancellationRequested(lt),ft&&ft.response&&(ft.response.data=transformData(ft.response.data,ft.response.headers,lt.transformResponse))),Promise.reject(ft)})},utils$2=utils$9,mergeConfig$2=function(lt,dt){dt=dt||{};var ft={},vt=["url","method","data"],Et=["headers","auth","proxy","params"],Rt=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],St=["validateStatus"];function At(Nt,Ft){return utils$2.isPlainObject(Nt)&&utils$2.isPlainObject(Ft)?utils$2.merge(Nt,Ft):utils$2.isPlainObject(Ft)?utils$2.merge({},Ft):utils$2.isArray(Ft)?Ft.slice():Ft}function Ct(Nt){utils$2.isUndefined(dt[Nt])?utils$2.isUndefined(lt[Nt])||(ft[Nt]=At(void 0,lt[Nt])):ft[Nt]=At(lt[Nt],dt[Nt])}utils$2.forEach(vt,function(Nt){utils$2.isUndefined(dt[Nt])||(ft[Nt]=At(void 0,dt[Nt]))}),utils$2.forEach(Et,Ct),utils$2.forEach(Rt,function(Nt){utils$2.isUndefined(dt[Nt])?utils$2.isUndefined(lt[Nt])||(ft[Nt]=At(void 0,lt[Nt])):ft[Nt]=At(void 0,dt[Nt])}),utils$2.forEach(St,function(Nt){Nt in dt?ft[Nt]=At(lt[Nt],dt[Nt]):Nt in lt&&(ft[Nt]=At(void 0,lt[Nt]))});var kt=vt.concat(Et).concat(Rt).concat(St),Tt=Object.keys(lt).concat(Object.keys(dt)).filter(function(Nt){return kt.indexOf(Nt)===-1});return utils$2.forEach(Tt,Ct),ft},utils$1=utils$9,buildURL=buildURL$1,InterceptorManager=InterceptorManager_1,dispatchRequest=dispatchRequest$1,mergeConfig$1=mergeConfig$2;function Axios$1(lt){this.defaults=lt,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}Axios$1.prototype.request=function(lt){typeof lt=="string"?(lt=arguments[1]||{},lt.url=arguments[0]):lt=lt||{},lt=mergeConfig$1(this.defaults,lt),lt.method?lt.method=lt.method.toLowerCase():this.defaults.method?lt.method=this.defaults.method.toLowerCase():lt.method="get";var dt=[dispatchRequest,void 0],ft=Promise.resolve(lt);for(this.interceptors.request.forEach(function(vt){dt.unshift(vt.fulfilled,vt.rejected)}),this.interceptors.response.forEach(function(vt){dt.push(vt.fulfilled,vt.rejected)});dt.length;)ft=ft.then(dt.shift(),dt.shift());return ft};Axios$1.prototype.getUri=function(lt){return lt=mergeConfig$1(this.defaults,lt),buildURL(lt.url,lt.params,lt.paramsSerializer).replace(/^\?/,"")};utils$1.forEach(["delete","get","head","options"],function(lt){Axios$1.prototype[lt]=function(dt,ft){return this.request(mergeConfig$1(ft||{},{method:lt,url:dt,data:(ft||{}).data}))}});utils$1.forEach(["post","put","patch"],function(lt){Axios$1.prototype[lt]=function(dt,ft,vt){return this.request(mergeConfig$1(vt||{},{method:lt,url:dt,data:ft}))}});var Axios_1=Axios$1,Cancel_1,hasRequiredCancel;function requireCancel(){if(hasRequiredCancel)return Cancel_1;hasRequiredCancel=1;function lt(dt){this.message=dt}return lt.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},lt.prototype.__CANCEL__=!0,Cancel_1=lt,Cancel_1}var CancelToken_1,hasRequiredCancelToken;function requireCancelToken(){if(hasRequiredCancelToken)return CancelToken_1;hasRequiredCancelToken=1;var lt=requireCancel();function dt(ft){if(typeof ft!="function")throw new TypeError("executor must be a function.");var vt;this.promise=new Promise(function(Rt){vt=Rt});var Et=this;ft(function(Rt){Et.reason||(Et.reason=new lt(Rt),vt(Et.reason))})}return dt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},dt.source=function(){var ft,vt=new dt(function(Et){ft=Et});return{token:vt,cancel:ft}},CancelToken_1=dt,CancelToken_1}var spread,hasRequiredSpread;function requireSpread(){return hasRequiredSpread||(hasRequiredSpread=1,spread=function(lt){return function(dt){return lt.apply(null,dt)}}),spread}var isAxiosError,hasRequiredIsAxiosError;function requireIsAxiosError(){return hasRequiredIsAxiosError||(hasRequiredIsAxiosError=1,isAxiosError=function(lt){return typeof lt=="object"&&lt.isAxiosError===!0}),isAxiosError}var utils=utils$9,bind=bind$2,Axios=Axios_1,mergeConfig=mergeConfig$2,defaults=defaults_1;function createInstance(lt){var dt=new Axios(lt),ft=bind(Axios.prototype.request,dt);return utils.extend(ft,Axios.prototype,dt),utils.extend(ft,dt),ft}var axios$1=createInstance(defaults);axios$1.Axios=Axios;axios$1.create=function(lt){return createInstance(mergeConfig(axios$1.defaults,lt))};axios$1.Cancel=requireCancel();axios$1.CancelToken=requireCancelToken();axios$1.isCancel=requireIsCancel();axios$1.all=function(lt){return Promise.all(lt)};axios$1.spread=requireSpread();axios$1.isAxiosError=requireIsAxiosError();axios$2.exports=axios$1;axios$2.exports.default=axios$1;(function(lt){lt.exports=axios$2.exports})(axios$3);const axios=getDefaultExportFromCjs(axios$3.exports),loadedScripts$1={};class Http{constructor(dt){m$5(this,"axios"),m$5(this,"_latestResponse"),this.axios=axios.create(dt)}setCdn(dt){dt&&XMLHttpRequest&&!XMLHttpRequest.prototype.cdnUrl&&(XMLHttpRequest.prototype.cdnUrl=dt,XMLHttpRequest.prototype.baseOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){const ft=arguments[1];return ft.startsWith("/infra/public")&&(arguments[1]=dt+ft),/^\/([^\/]*)\/public/.test(ft)&&(arguments[1]=dt+ft),ft.startsWith("/assets")&&(arguments[1]=dt+ft),ft=="/conf/public"&&(arguments[1]=ft),ft.startsWith("http")&&(arguments[1]=ft),this.baseOpen.apply(this,arguments)})}toAxiosConfig(dt){if(dt){const ft=Object.assign({},this.axios.defaults);return dt.headers&&(ft.headers&&(ft.headers=Object.assign({},this.axios.defaults.headers)),Object.assign(ft.headers,dt.headers)),dt.responseType&&(ft.responseType=dt.responseType),dt.queryParams&&(ft.params=Object.assign({},dt.queryParams)),ft}else return this.axios.defaults}toCdnUrl(dt){const ft=ConfigurationFrameworkFactory.instance().Platform.cdnDomain;if((ft==null?void 0:ft.length)>0&&dt!=="/conf/public"){const vt=""+dt;(vt.startsWith("/infra/public")||vt.startsWith("/assets")||/^\/([^\/]*)\/public/.test(vt))&&(dt=ft+vt)}return dt}mapAxiosError(dt,ft){return dt.response?this._latestResponse=dt.response:dt.request?this._latestResponse={status:408,statusText:ERROR_CODE.TIME_OUT}:this._latestResponse={status:500,statusText:ERROR_CODE.UNKNOWN},!ft||ft.disableNotifications,this._latestResponse}mapAxiosResponse(dt,ft){return this._latestResponse=dt,dt.data}get latestResponse(){return this._latestResponse}get(dt,ft){return this.axios.get(this.toCdnUrl(dt),this.toAxiosConfig(ft)).then(vt=>this.mapAxiosResponse(vt,ft)).catch(vt=>this.mapAxiosError(vt,ft))}post(dt,ft,vt){return this.axios.post(dt,ft,this.toAxiosConfig(vt)).then(Et=>this.mapAxiosResponse(Et,vt)).catch(Et=>this.mapAxiosError(Et,vt))}postFile(dt,ft,vt){const Et=this.toAxiosConfig(vt);return Et.headers&&Et.headers["Content-Type"]&&delete Et.headers["Content-Type"],this.axios.post(dt,ft,Et).then(Rt=>this.mapAxiosResponse(Rt,vt)).catch(Rt=>this.mapAxiosError(Rt,vt))}postJson(dt,ft,vt){const Et=this.toAxiosConfig();return Et.headers&&(Et.headers["Content-Type"]="application/json"),this.axios.post(dt,ft,this.toAxiosConfig(vt)).then(Rt=>this.mapAxiosResponse(Rt,vt)).catch(Rt=>this.mapAxiosError(Rt,vt))}put(dt,ft,vt){return this.axios.put(dt,ft,this.toAxiosConfig(vt)).then(Et=>this.mapAxiosResponse(Et,vt)).catch(Et=>this.mapAxiosError(Et,vt))}putJson(dt,ft,vt){const Et=this.toAxiosConfig(vt);return Et.headers&&(Et.headers["Content-Type"]="application/json"),this.axios.put(dt,ft,Et).then(Rt=>this.mapAxiosResponse(Rt,vt)).catch(Rt=>this.mapAxiosError(Rt,vt))}delete(dt,ft){return this.axios.delete(dt,this.toAxiosConfig(ft)).then(vt=>this.mapAxiosResponse(vt,ft)).catch(vt=>this.mapAxiosError(vt,ft))}deleteJson(dt,ft){return this.axios.delete(dt,{data:ft}).then(vt=>this.mapAxiosResponse(vt)).catch(vt=>this.mapAxiosError(vt))}getScript(dt,ft,vt){const Et=vt??"exports",Rt=this.toAxiosConfig(ft);return Rt.headers&&(Rt.headers.Accept="application/javascript"),this.axios.get(this.toCdnUrl(dt),Rt).then(St=>this.mapAxiosResponse(St,ft)).then(St=>{try{const At=`"use strict";var ${Et.split(".")[0]}={};${St};return ${Et};`;return Function(At)()}catch{return St}}).catch(St=>{throw this.mapAxiosError(St,ft),St})}loadScript(dt,ft){return loadedScripts$1[dt]?Promise.resolve():this.getScript(dt,ft).then(vt=>{loadedScripts$1[dt]=!0})}}class TransportFramework{constructor(){m$5(this,"_http",new Http)}get http(){return this._http}newHttpInstance(dt){return new Http(dt)}}const transport=new TransportFramework;class TransportFrameworkFactory{static instance(){return transport}}const http$2=transport.http;class Session{constructor(){m$5(this,"_me",null),m$5(this,"_currentLanguage",""),m$5(this,"_notLoggedIn",!0),m$5(this,"_description"),m$5(this,"_profile")}get currentLanguage(){return this._currentLanguage}get notLoggedIn(){return this._notLoggedIn}get description(){return this._description}get avatarUrl(){let dt=this.description.photo;return(!dt||dt==="no-avatar.jpg"||dt==="no-avatar.svg")&&(dt=ConfigurationFrameworkFactory.instance().Platform.theme.basePath+"/img/illustrations/no-avatar.svg"),dt}get user(){return this._me}get currentApp(){return configure.Platform.apps.currentApp}async initialize(){return http$2.get("/auth/oauth2/userinfo").then(dt=>{if(http$2.latestResponse.status<200||http$2.latestResponse.status>=300)throw ERROR_CODE.NOT_LOGGED_IN;return this.setCurrentModel(dt),this._notLoggedIn?this.loadDefaultLanguage():this.loadUserLanguage()}).then(dt=>(this.setCurrentLanguage(dt),this.loadDescription())).then(()=>this.getUserProfile()).then(()=>{notify.onSessionReady().resolve(this._me)}).catch(dt=>{if(dt===ERROR_CODE.NOT_LOGGED_IN)return Promise.resolve();notify.onSessionReady().reject(dt)})}setCurrentModel(dt){this._me=dt,this._notLoggedIn=!(dt&&dt.sessionMetadata&&dt.sessionMetadata.userId)}hasWorkflow(dt){var ft;return dt===void 0||((ft=this._me)==null?void 0:ft.authorizedActions.findIndex(vt=>vt.name===dt))!==-1}hasRight(dt,ft){if(ft==="owner")return dt.owner&&dt.owner.userId===this._me.userId;const vt=ft.right||ft,Et=dt.shared.filter(St=>(this._me.groupsIds||[]).indexOf(St.groupId)!==-1||St.userId===this._me.userId).find(St=>St[vt]||St.manager)!==void 0,Rt=ft.workflow?this.hasWorkflow(ft.workflow):!0;return Et&&Rt}get latestQuotaAndUsage(){return http$2.get(`/workspace/quota/user/${this._me.userId}`).then(dt=>(this._description&&(this._description.quota=dt.quota,this._description.storage=dt.storage),dt)).catch(()=>({quota:0,storage:0}))}setCurrentLanguage(dt){this._currentLanguage=dt,notify.onLangReady().resolve(dt)}loadDefaultLanguage(){return http$2.get("/locale").then(dt=>dt.locale).catch(()=>this._currentLanguage)}loadDescription(){return Promise.all([http$2.get("/userbook/api/person",{requestName:"refreshAvatar"}),http$2.get("/directory/userbook/"+this._me.userId)]).then(dt=>(dt[0].status==="ok"&&dt[0].result&&dt[0].result.length>0?this._description=dt[0].result[0]:this._description={},this._description.type&&!this._description.profiles&&(this._description.profiles=this._description.type),Object.assign(this._description,dt[1]),this._description))}get profile(){return this._profile}getUserProfile(){return http$2.get("/userbook/api/person").then(dt=>dt.result).then(dt=>this._profile=dt[0].type)}loadUserLanguage(){return http$2.get("/userbook/preference/language").then(dt=>{try{return JSON.parse(dt.preference)["default-domain"]}catch{return this.loadDefaultLanguage()}}).catch(()=>this.loadDefaultLanguage())}getEmailValidationInfos(){return http$2.get("/directory/user/mailstate")}checkEmail(dt){return http$2.put("/directory/user/mailstate",{email:dt})}tryEmailValidation(dt){return http$2.post("/directory/user/mailstate",{key:dt})}getMobileValidationInfos(){return http$2.get("/directory/user/mobilestate")}checkMobile(dt){return http$2.put("/directory/user/mobilestate",{mobile:dt})}tryMobileValidation(dt){return http$2.post("/directory/user/mobilestate",{key:dt})}getMfaInfos(){return http$2.get("/auth/user/mfa/code")}tryMfaCode(dt){return http$2.post("/auth/user/mfa/code",{key:dt})}}class SessionFramework{constructor(){m$5(this,"session",new Session)}initialize(){return this.session.initialize()}login(dt,ft,vt,Et){const Rt=new FormData;return Rt.append("email",dt),Rt.append("password",ft),typeof vt<"u"&&Rt.append("rememberMe",""+vt),typeof Et<"u"&&Rt.append("secureLocation",""+Et),transport.http.post("/auth/login",Rt,{headers:{"content-type":"application/x-www-form-urlencoded"}}).finally(()=>{switch(transport.http.latestResponse.status){case 200:throw ERROR_CODE.MALFORMED_DATA}})}logout(){return transport.http.get("/auth/logout").finally(()=>{})}}const session=new SessionFramework;class Theme{constructor(){m$5(this,"_conf"),m$5(this,"_loaded"),m$5(this,"skinName",""),m$5(this,"themeName",""),m$5(this,"skin","raw"),m$5(this,"themeUrl","/assets/themes/raw/default/"),m$5(this,"templateOverrides",{}),m$5(this,"portalTemplate","/assets/themes/raw/portal.html"),m$5(this,"basePath",""),m$5(this,"logoutCallback","/"),m$5(this,"skins",[]),m$5(this,"is1D",!1),m$5(this,"is2D",!1),m$5(this,"_onSkinReady",notify.onSkinReady()),m$5(this,"_onOverrideReady",notify.onOverridesReady())}initialize(dt){return notify.onSessionReady().promise.then(()=>this.load(dt))}get version(){return configure.Platform.deploymentTag}get cdnDomain(){return configure.Platform.cdnDomain}async onFullyReady(){return await this._loaded,this}onSkinReady(){return this._onSkinReady.promise}onOverrideReady(){return this._onOverrideReady.promise}async getConf(dt){var ft;return this._conf=(ft=this._conf)!=null?ft:await transport.http.getScript("/assets/theme-conf.js",{queryParams:{v:dt??this.version}},"exports.conf"),this._conf}load(dt){return dt=dt??this.version,this._loaded||(this._loaded=(session.session.notLoggedIn?this.loadDisconnected(dt):this.loadConnected(dt)).then(async()=>{var ft,vt;const Et=await this.listSkins();this.is1D=((ft=Et.find(Rt=>Rt.child===this.skin))==null?void 0:ft.parent)==="panda",this.is2D=((vt=Et.find(Rt=>Rt.child===this.skin))==null?void 0:vt.parent)==="theme-open-ent"})),this._loaded}loadDisconnected(dt){return new Promise((ft,vt)=>{transport.http.get("/skin",{queryParams:{v:this.version}}).then(Et=>{this.skin=Et.skin,this.themeUrl=`${this.cdnDomain}/assets/themes/${Et.skin}/skins/default/`,this.basePath=this.themeUrl+"../../",this._onSkinReady.resolve(this),transport.http.get(`/assets/themes/${Et.skin}/template/override.json`,{disableNotifications:!0,queryParams:{v:dt}}).then(Rt=>{this.templateOverrides=Rt,this._onOverrideReady.resolve(Rt),ft()}).catch(Rt=>{if(transport.http.latestResponse.status===404)ft();else throw Rt})}).catch(Et=>{this._onSkinReady.reject(Et),this._onOverrideReady.reject(Et),vt()})})}loadConnected(dt){return new Promise((ft,vt)=>{this.loadDefaultTheme(dt).then(()=>{this._onSkinReady.resolve(this),transport.http.get(`/assets/themes/${this.skin}/template/override.json`,{disableNotifications:!0,queryParams:{v:dt}}).then(Et=>{this.templateOverrides=Et,this._onOverrideReady.resolve(Et),ft()}).catch(Et=>{if(transport.http.latestResponse.status===404)ft(),this._onSkinReady.reject(Et),this._onOverrideReady.reject(Et);else throw Et})})})}async loadDefaultTheme(dt){return session.session.notLoggedIn?Promise.reject():transport.http.get("/theme",{queryParams:{_:dt}}).then(ft=>{this.skinName=ft.skinName,this.themeName=ft.themeName,this.themeUrl=ft.skin,this.basePath=`${this.cdnDomain}${this.themeUrl}../../`,this.skin=this.themeUrl.split("/assets/themes/")[1].split("/")[0],this.portalTemplate=`${this.cdnDomain}/assets/themes/${this.skin}/portal.html`,this.logoutCallback=ft.logoutCallback})}listThemes(){return transport.http.get("/themes")}async setDefaultTheme(dt){await transport.http.get("/userbook/api/edit-userbook-info?prop=theme-"+this.skin+"&value="+dt._id),await this.loadDefaultTheme(this.version)}listSkins(){return this.skins.length>0?Promise.resolve(this.skins):this.getConf().then(dt=>{const ft=dt.overriding.find(vt=>vt.child===this.skin);return ft!=null&&ft.group?this.skins=this.skins.concat(dt.overriding.filter(vt=>vt.group===ft.group)):this.skins=this.skins.concat(dt.overriding),this.skins})}async getHelpPath(){var dt;const ft=(await this.listSkins()).find(vt=>vt.child===this.skin);return(dt=ft==null?void 0:ft.help)!=null?dt:"/help"}}const bundle$1={},promises$1={},defaultDiacriticsRemovalMap$1=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];class Idiom{translate(dt,ft){dt=dt??"";let vt=bundle$1[dt]===void 0?dt:bundle$1[dt];if(ft&&typeof ft=="object")for(let Et in ft)typeof ft[Et]<"u"&&(vt=vt.replace(new RegExp("\\${"+Et+"}","g"),""+ft[Et]));return vt}addBundlePromise(dt){return this.loadBundlePromise(session.session.currentLanguage,dt)}addBundle(dt,ft){this.loadBundle(session.session.currentLanguage,dt,ft)}loadBundlePromise(dt,ft){return this.loadBundle(dt,ft),promises$1[ft]}loadBundle(dt,ft,vt){const Et=promises$1[ft];if(Et)vt&&Et.then(vt).catch(vt);else{const Rt=new Promisified;promises$1[ft]=Rt.promise;const St={};dt&&(St["Accept-Language"]=dt),transport.http.get(ft,{headers:St}).then(At=>{Object.assign(bundle$1,At),typeof vt=="function"&&vt(),Rt.resolve()}).catch(At=>{typeof vt=="function"&&vt(),Rt.reject()})}}addTranslations(dt,ft){notify.onLangReady().promise.then(vt=>{this.loadBundle(vt,dt+"/"+vt+".json",ft)})}addAllTranslations(dt){return dt&&dt.length>0?notify.onLangReady().promise.then(ft=>Promise.all(dt.map(vt=>this.loadBundlePromise(ft,vt+"/"+ft+".json")))).then(()=>{}):Promise.reject()}addKeys(dt){for(var ft in dt)typeof bundle$1[ft]!="string"&&(bundle$1[ft]=dt[ft])}removeAccents(dt){for(var ft=0;ft<defaultDiacriticsRemovalMap$1.length;ft++)dt=dt.replace(defaultDiacriticsRemovalMap$1[ft].letters,defaultDiacriticsRemovalMap$1[ft].base);return dt}}class UserPreferences{constructor(){m$5(this,"data",{})}get(dt){return this.data[dt]}load(dt,ft){return transport.http.get("/userbook/preference/"+dt).then(vt=>{try{return JSON.parse(vt.preference)}catch{return ft??{}}}).then(vt=>(this.data[dt]=vt??{},vt))}update(dt,ft){return ft!==void 0&&(this.data[dt]=ft),this}save(dt){return transport.http.putJson("/userbook/preference/"+dt,this.data[dt])}}class User{constructor(){m$5(this,"_me",null),m$5(this,"_keepOpenOnLogout",!1),m$5(this,"_preferences",new UserPreferences),m$5(this,"_bookmarkedApps",[])}get keepOpenOnLogout(){return this._keepOpenOnLogout}get preferences(){return this._preferences}get bookmarkedApps(){return this._bookmarkedApps}initialize(dt){return this.loadPublicConf(),notify.onSessionReady().promise.then(ft=>{ft&&this.setCurrentModel(ft)})}setCurrentModel(dt){this._me=dt,this._preferences=new UserPreferences,this.loadBookmarks()}loadPublicConf(){return transport.http.get("/conf/public").then(dt=>(this._keepOpenOnLogout=(dt==null?void 0:dt.keepOpenOnLogout)||!1,dt))}async loadBookmarks(){await transport.http.get("/userbook/preference/apps").then(dt=>{dt.preference||(dt.preference=null);const ft=JSON.parse(dt.preference);let vt;if(ft&&ft.length&&typeof ft.concat=="function"){this._bookmarkedApps=ft,vt={bookmarks:ft.map(St=>St.name),applications:[]},transport.http.putJson("/userbook/preference/apps",vt);return}else vt=ft;vt||(vt={bookmarks:[],applications:[]});let Et=!0;const Rt=[];vt.bookmarks.forEach((St,At)=>{const Ct=this._me.apps.find(kt=>kt.name===St);if(Ct){let kt=Object.assign({},Ct);this._bookmarkedApps.push(kt)}else Rt.push(St),Et=!1}),Rt.forEach(St=>{let At=vt.bookmarks.indexOf(St);At!==-1&&vt.bookmarks.splice(At,1)}),Et||transport.http.putJson("/userbook/preference/apps",vt)})}loadAppPrefs(dt){return this.preferences.load(dt,{})}saveAppPrefs(dt){return this.preferences.save(dt)}loadLanguage(){return this.preferences.load("language",{"default-domain":session.session.currentLanguage}).then(dt=>dt["default-domain"])}saveLanguage(dt){return this.preferences.update("language",{"default-domain":dt}).save("language")}}const http$1=transport==null?void 0:transport.http;class AppConf{constructor(){m$5(this,"_publicConf",{}),m$5(this,"_currentApp"),m$5(this,"_appConf",{})}get currentApp(){var dt;return(dt=this._currentApp)!=null?dt:null}setCurrentApp(dt){return this._currentApp=dt,this}async initialize(dt,ft=!1){ft||this.setCurrentApp(dt),await Promise.all([this.getPublicConf(dt),this.loadI18n(dt)])}async getPublicConf(dt){return this._publicConf[dt]||(this._publicConf[dt]=await http$1.get(`/${dt}/conf/public`,{queryParams:{_:configure.Platform.deploymentTag}})),this._publicConf[dt]}async getWebAppConf(dt){var ft;let vt;return this._appConf[dt]||(await http$1.get("/applications-list")).apps.forEach(Et=>{if(Et!=null&&Et.prefix){const Rt=Et.prefix.replace("/","");this._appConf[Rt]=Et}else Et!=null&&Et.name&&Et.name.toLowerCase()==dt&&(vt=Et)}),(ft=this._appConf[dt])!=null?ft:vt}async loadI18n(dt){return await notify.onLangReady().promise,configure.Platform.idiom.addBundlePromise(`/${dt}/i18n`)}}class Analytics{constructor(){m$5(this,"_status","void"),m$5(this,"_params")}get status(){return this._status}xiti(){return this.parametersWithCheck("xiti",!1)}parameters(dt){return this.parametersWithCheck(dt,!0)}async parametersWithCheck(dt,ft){return this.initialize().promise.then(vt=>!ft||vt.type===dt||vt.type==="multiple"?vt[dt]:void 0)}initialize(){return this._params||(this._params=notify.promisify(),this._status="pending",Promise.all([transport.http.get("/analyticsConf"),transport.http.get("/xiti/config")]).then(async dt=>{var ft;if(!dt||!dt[0]||!dt[0].type)throw ERROR_CODE.MALFORMED_DATA;dt[1]&&dt[1].active&&(dt[0].xiti=await this.initializeXiti(dt[1])),(ft=this._params)==null||ft.resolve(dt[0]),this._status="ready"}).catch(dt=>{var ft;throw this._status="failed",(ft=this._params)==null||ft.reject(),dt})),this._params}async initializeXiti(dt){var ft;if(!dt.structureMap||!configure.Platform.apps.currentApp)return;const vt=await notify.onSessionReady().promise,Et=session.session.description;let Rt;for(let Tt of vt.structures){const Nt=dt.structureMap[Tt];if(Nt&&Nt.collectiviteId&&Nt.UAI){Rt=Nt;break}}if(!Rt||!Rt.active)return;const St=await configure.Platform.apps.getPublicConf(configure.Platform.apps.currentApp);if(!St)return;const At=St.xiti;if(!At||!At.LIBELLE_SERVICE||!Rt.UAI)return;function Ct(Tt){let Nt="";for(let Ft=0;Ft<Tt.length;Ft++)Nt+=Tt.charCodeAt(Ft);return Nt}const kt={Student:"ELEVE",Teacher:"ENSEIGNANT",Relative:"PARENT",Personnel:"ADMIN_VIE_SCOL_TECH",Guest:"AUTRE"};return{LIBELLE_SERVICE:At.LIBELLE_SERVICE,TYPE:At.OUTIL?"TIERS":"NATIF",OUTIL:At.OUTIL?At.OUTIL:"",STRUCT_ID:Rt.collectiviteId,STRUCT_UAI:Rt.UAI,PROJET:Rt.projetId?Rt.projetId:dt.ID_PROJET,EXPLOITANT:dt.ID_EXPLOITANT,PLATFORME:Rt.plateformeId?Rt.plateformeId:dt.ID_PLATEFORME,ID_PERSO:Ct(vt.userId),PROFILE:Et.profiles&&Et.profiles.length>0&&(ft=kt[Et.profiles[0]])!=null?ft:""}}}class ConfigurationFramework{constructor(){m$5(this,"Platform",{deploymentTag:"",cdnDomain:"",apps:new AppConf,theme:new Theme,analytics:new Analytics,idiom:new Idiom,listLanguages:()=>transport.http.get("/languages")}),m$5(this,"School",{}),m$5(this,"User",new User)}async initialize(dt,ft){if(!dt){const Et=kt=>(kt<10?"0":"")+kt.toFixed(0),Rt=new Date,St=Rt.getFullYear(),At=Rt.getMonth()+1,Ct=Rt.getDate();dt=`${St}${Et(At)}${Et(Ct)}`}const vt=dt;this.Platform.deploymentTag=dt,typeof ft=="string"&&ft.length>0&&(this.Platform.cdnDomain=ft),transport.http.setCdn(this.Platform.cdnDomain),await Promise.all([this.Platform.theme.initialize(vt),notify.onSessionReady().promise.then(Et=>this.Platform.idiom.addBundlePromise("/i18n")),this.User.initialize(vt)])}}const configure=new ConfigurationFramework;class ConfigurationFrameworkFactory{static instance(){return configure}}const WIDGET_POSITION={LEFT:"left",RIGHT:"right"},firstLevelWidgets=["birthday","mood","calendar-widget","notes"],secondLevelWidgets=["agenda-widget","carnet-de-bord","my-apps","rss-widget","bookmark-widget","cursus-widget","maxicours-widget","school-widget"],defaultWidgetPosition={"last-infos-widget":WIDGET_POSITION.LEFT,birthday:WIDGET_POSITION.LEFT,"calendar-widget":WIDGET_POSITION.RIGHT,"carnet-de-bord":WIDGET_POSITION.LEFT,"record-me":WIDGET_POSITION.RIGHT,mood:WIDGET_POSITION.LEFT,"my-apps":WIDGET_POSITION.RIGHT,notes:WIDGET_POSITION.RIGHT,"rss-widget":WIDGET_POSITION.LEFT,"bookmark-widget":WIDGET_POSITION.RIGHT,qwant:WIDGET_POSITION.RIGHT,"qwant-junior":WIDGET_POSITION.LEFT,"agenda-widget":WIDGET_POSITION.LEFT,"cursus-widget":WIDGET_POSITION.LEFT,"maxicours-widget":WIDGET_POSITION.RIGHT,"universalis-widget":WIDGET_POSITION.RIGHT,"briefme-widget":WIDGET_POSITION.LEFT,"school-widget":WIDGET_POSITION.LEFT},defaultWidgetOrder={"school-widget":0,"my-apps":10,"record-me":15,"last-infos-widget":20,qwant:30,"qwant-junior":30,"universalis-widget":35,"agenda-widget":40,"bookmark-widget":50,"carnet-de-bord":60,"maxicours-widget":70,"cursus-widget":80,"briefme-widget":90,"rss-widget":100,mood:110,birthday:120,"calendar-widget":130,notes:140};class WidgetFramework{constructor(){m$5(this,"_initialized"),m$5(this,"_widgets",[]),m$5(this,"_userPrefs",{})}initialize(dt,ft){return this._initialized||(this._initialized=new Promisified,notify.onSessionReady().promise.then(vt=>{var Et;vt&&vt.widgets?(vt.widgets.forEach(Rt=>{this._widgets.push(new Widget(Rt))}),this.loadUserPrefs().then(()=>{var Rt;(Rt=this._initialized)==null||Rt.resolve()}).catch(Rt=>{var St;(St=this._initialized)==null||St.reject()})):(Et=this._initialized)==null||Et.reject()})),this._initialized.promise}get list(){return this._widgets}lookup(dt){return this._widgets.find(ft=>ft.platformConf.name===dt)}lookupDefaultPosition(dt){return defaultWidgetPosition[dt]}get userPrefs(){return this._userPrefs}async loadUserPrefs(){await configure.User.preferences.load("widgets",{}).then(dt=>this.applyUserPrefs(dt))}saveUserPrefs(){return configure.User.preferences.update("widgets",this._userPrefs).save("widgets").then(()=>{notify.events().next({name:EVENT_NAME.USERPREF_CHANGED,layer:LAYER_NAME.WIDGETS})})}async applyUserPrefs(dt){this._userPrefs=dt??this._userPrefs;const ft=configure.Platform.theme,vt=[];ft.listSkins().then(Et=>{var Rt;const St=((Rt=Et.find(Ct=>Ct.child===ft.skin))==null?void 0:Rt.parent)==="panda"?secondLevelWidgets:firstLevelWidgets;this._widgets=this._widgets.filter((Ct,kt)=>{var Tt,Nt;const Ft=Ct.platformConf.name;return St.indexOf(Ft)!==-1?!1:(this._userPrefs[Ft]||(this._userPrefs[Ft]={index:(Tt=defaultWidgetOrder[Ft])!=null?Tt:999,show:!0,position:Ct.platformConf.position}),Ct.platformConf.mandatory&&(this._userPrefs[Ft].show=!0,this._userPrefs[Ft].index=(Nt=defaultWidgetOrder[Ft])!=null?Nt:999),Ct.platformConf.i18n&&vt.push(Ct.platformConf.i18n),Ct.applyUserPref(this._userPrefs[Ft]),!0)});const At=new Idiom;this._widgets=this._widgets.sort((Ct,kt)=>{const Tt=At.translate(`timeline.settings.${Ct.platformConf.name}`).toLowerCase(),Nt=At.translate(`timeline.settings.${kt.platformConf.name}`).toLowerCase();return Tt<Nt?-1:Tt>Nt?1:0})})}}class Widget{constructor(dt){m$5(this,"_schoolConf",{}),m$5(this,"_userPref"),this._platformConf=dt,this._userPref=null}get platformConf(){return this._platformConf}get schoolConf(){return this._schoolConf}get userPref(){return this._userPref}applyUserPref(dt){var ft,vt;this._userPref=dt,this._userPref.position=(vt=(ft=this._userPref.position)!=null?ft:widgets.lookupDefaultPosition(this._platformConf.name))!=null?vt:"left"}}const widgets=new WidgetFramework;transport==null||transport.http;var O$3;(O$3=session==null?void 0:session.session)==null||O$3.user;const x$3=class{constructor(dt){m$5(this,"checkHttpResponse",ft=>{if(this.http.latestResponse.status>=300)throw this.http.latestResponse.statusText;return ft}),this.context=dt}static register({application:dt,resourceType:ft},vt){x$3.registry.set(`${dt}:main`,vt),x$3.registry.set(`${dt}:${ft}`,vt)}static findService({application:dt,resourceType:ft},vt){const Et=x$3.registry.get(`${dt}:${ft}`);if(Et===void 0)throw`Service not found: ${dt}:${ft}`;return Et(vt)}static findMainService({application:dt},ft){const vt=x$3.registry.get(`${dt}:main`);if(vt===void 0)throw`Service not found: ${dt}`;return vt(ft)}get http(){return this.context.http()}getShareReadUrl(dt){return`/${this.getApplication()}/share/json/${dt}?search=`}getSaveShareUrl(dt){return`/${this.getApplication()}/share/resource/${dt}`}gotoPrint(dt,ft){window.open(this.getPrintUrl(dt,ft),"_blank")}gotoView(dt){window.open(this.getViewUrl(dt),"_self")}gotoForm(dt){window.open(this.getFormUrl(dt),"_self")}async publish(dt){const ft=new FormData;ft.append("title",dt.title),ft.append("cover",dt.cover),ft.append("coverName",dt.cover.name),ft.append("coverType",dt.cover.type),ft.append("teacherAvatar",dt.teacherAvatar),ft.append("teacherAvatarName",dt.teacherAvatar.name||`teacherAvatar_${dt.userId}`),ft.append("teacherAvatarType",dt.teacherAvatar.type),ft.append("language",dt.language),dt.activityType.forEach(Et=>{ft.append("activityType[]",Et)}),dt.subjectArea.forEach(Et=>{ft.append("subjectArea[]",Et)}),dt.age.forEach(Et=>{ft.append("age[]",Et.toString())}),ft.append("description",dt.description),dt.keyWords.split(",").forEach(Et=>{ft.append("keyWords[]",Et.trim())}),ft.append("licence",dt.licence),ft.append("pdfUri",`${window.location.origin}${this.getPrintUrl(dt.resourceId)}`),ft.append("application",dt.application?dt.application:""),ft.append("resourceId",dt.resourceId),ft.append("teacherSchool",dt.userStructureName);const vt=await this.http.post("/appregistry/library/resource",ft,{headers:{"Content-Type":"multipart/form-data"}});return this.checkHttpResponse(vt)}async createContext(dt){const ft=await this.http.get("/explorer/context",{queryParams:this.toQueryParams(dt)});return this.checkHttpResponse(ft)}async searchContext(dt){const ft=await this.http.get("/explorer/resources",{queryParams:this.toQueryParams(dt)});return this.checkHttpResponse(ft)}async createFolder(dt){const ft=await this.http.post("/explorer/folders",this.createFolderToBodyParams(dt));return this.checkHttpResponse(ft)}async updateFolder(dt){const ft=await this.http.put(`/explorer/folders/${dt.folderId}`,this.createFolderToBodyParams(dt));return this.checkHttpResponse(ft)}async moveToFolder(dt){const ft=await this.http.post(`/explorer/folders/${dt.folderId}/move`,this.moveToBodyParams(dt));return this.checkHttpResponse(ft)}async listSubfolders(dt){const ft=await this.http.get(`/explorer/folders/${dt}`);return this.checkHttpResponse(ft)}async deleteAll(dt){const ft=await this.http.deleteJson("/explorer",dt);return this.checkHttpResponse(ft)}async trashAll({resourceType:dt,...ft}){const vt=await this.http.putJson("/explorer/trash",ft);return this.checkHttpResponse(vt)}async restoreAll({resourceType:dt,...ft}){const vt=await this.http.putJson("/explorer/restore",ft);return this.checkHttpResponse(vt)}async getThumbnailPath(dt){if(typeof dt>"u")return dt;if(typeof dt=="string")if(dt.startsWith("blob:")){const ft=await fetch(dt).then(vt=>vt.blob());return`/workspace/document/${(await this.context.workspace().saveFile(ft,{visibility:"protected",application:this.getApplication()}))._id}`}else return dt;else return`/workspace/document/${(await this.context.workspace().saveFile(dt,{visibility:"protected",application:this.getApplication()}))._id}`}toQueryParams(dt){let ft={application:dt.app,start_idx:dt.pagination.startIdx,page_size:dt.pagination.pageSize,resource_type:dt.types[0],trashed:dt.trashed};if(dt.orders&&Object.entries(dt.orders).length){const[[vt,Et]]=Object.entries(dt.orders);ft.order_by=`${vt}:${Et}`}return dt.filters&&Object.assign(ft,dt.filters),typeof dt.search=="string"&&(ft.search=dt.search),ft}createFolderToBodyParams(dt){return{application:dt.app,resourceType:dt.type,parentId:dt.parentId,name:dt.name}}moveToBodyParams(dt){return{application:dt.application,resourceType:this.getResourceType(),resourceIds:dt.resourceIds,folderIds:dt.folderIds}}};let ResourceService=x$3;m$5(ResourceService,"registry",new Map);class BlogResourceService extends ResourceService{async update(dt){const ft=await this.getThumbnailPath(dt.thumbnail),vt=await this.http.put(`/blog/${dt.entId}`,{trashed:dt.trashed,_id:dt.entId,title:dt.name,thumbnail:ft,description:dt.description,visibility:dt.public?"PUBLIC":"OWNER",slug:dt.public?dt.slug:"","publish-type":dt["publish-type"]||"RESTRAINT","comment-type":"IMMEDIATE"});return this.checkHttpResponse(vt),{thumbnail:ft,entId:dt.entId}}getResourceType(){return RESOURCE.BLOG}getApplication(){return APP.BLOG}getFormUrl(dt){return dt?`/blog?folderid=${dt}#/edit/new`:"/blog#/edit/new"}getViewUrl(dt){return`/blog#/view/${dt}`}getPrintUrl(dt,ft){return`/blog/print/blog#/print/${dt}?comments=${ft||!0}`}}ResourceService.register({application:RESOURCE.BLOG,resourceType:RESOURCE.BLOG},lt=>new BlogResourceService(lt));const globalCache={},mutexPromise={};class CacheService{constructor(dt){this.context=dt}get http(){return this.context.http()}async fromCacheIfPossible(dt,ft,vt){if(mutexPromise[dt]&&await mutexPromise[dt],globalCache[dt])return globalCache[dt];try{const Et=ft();mutexPromise[dt]=Et;const Rt=await Et;return vt(Rt)&&(globalCache[dt]=Rt),Rt}catch(Et){throw console.error(`Failed to retrieve value for: ${dt}`,Et),Et}}clearCache(dt){if(dt)delete globalCache[dt];else for(const ft in globalCache)globalCache.hasOwnProperty(ft)&&delete globalCache[ft]}async httpGet(dt,ft){return this.fromCacheIfPossible(dt,async()=>{const vt=await this.http.get(dt,ft),Et={...this.http.latestResponse};return{value:vt,response:Et}},({response:vt})=>!(vt.status<200||vt.status>=300))}async httpGetJson(dt,ft){const{response:vt,value:Et}=await this.httpGet(dt,ft);if(vt.status<200||vt.status>=300)throw`Bad http status (${vt.status}) for url: ${dt}`;return Et}}class ConfService{constructor(dt){this.context=dt}get http(){return this.context.http()}get cdnDomain(){return configure.Platform.cdnDomain}async getConf(dt){const[ft,vt]=await Promise.all([this.getThemeConf(),this.getApplicationsList()]),[Et,Rt]=await Promise.all([this.getTheme({conf:ft}),this.getWebAppConf({app:dt,applications:vt})]);return{applications:vt,conf:ft,currentApp:Rt,theme:Et}}getCdnUrl(){console.warn("[getCdnUrl] Not implemented yet")}async savePreference(dt,ft){this.http.putJson(`/userbook/preference/${dt}`,ft)}async getPreference(dt){const ft=await this.http.get(`/userbook/preference/${dt}`);return JSON.parse(ft.preference)}async getThemeConf(dt){return await this.http.getScript("/assets/theme-conf.js",{queryParams:{v:dt}},"exports.conf")}async getApplicationsList(){return(await this.http.get("/applications-list")).apps}async getWebAppConf({app:dt,applications:ft}){return ft.find(vt=>{if(vt!=null&&vt.prefix)return(vt==null?void 0:vt.prefix.replace("/",""))===dt})}async getTheme({version:dt,conf:ft}){const vt=await this.http.get("/theme",{queryParams:{_:dt}}),Et=vt.themeName,Rt=ft==null?void 0:ft.overriding.find(Nt=>Nt.child===Et).skins,St="/assets/themes/ode-bootstrap",At=ft==null?void 0:ft.overriding.find(Nt=>Nt.child===Et).bootstrapVersion,Ct=`${this.cdnDomain}/assets/themes/${At}`,kt=`${Ct}/skins/${vt.skinName}`,Tt=(ft==null?void 0:ft.overriding.find(Nt=>Nt.child===Et).parent)==="panda";return{basePath:`${this.cdnDomain}${vt.skin}../../`,bootstrap:St,bootstrapPath:Ct,bootstrapUrl:kt,bootstrapVersion:At,is1d:Tt,logoutCallback:vt.logoutCallback,skin:vt.skin.split("/assets/themes/")[1].split("/")[0],skinName:vt.skinName,skins:Rt,themeName:vt.themeName,themeUrl:vt.skin}}}class DirectoryService{constructor(dt){this.odeServices=dt}get http(){return this.odeServices.http()}get cache(){return this.odeServices.cache()}getAvatarUrl(dt,ft,vt="100x100"){return ft==="user"?`/userbook/avatar/${dt}?thumbnail=${vt}`:"/assets/img/illustrations/group-avatar.svg"}getDirectoryUrl(dt,ft){return ft==="user"?`/userbook/annuaire#/${dt}`:`/userbook/annuaire#/group-view/${dt}`}async getBookMarks(){return(await this.cache.httpGetJson("/directory/sharebookmark/all")).map(({id:dt,name:ft})=>({id:dt,displayName:ft,members:[]}))}async getBookMarkById(dt){const{groups:ft,id:vt,name:Et,users:Rt}=await this.http.get(`/directory/sharebookmark/${dt}`);return{id:vt,displayName:Et,groups:ft.map(({name:St,id:At})=>({displayName:St,id:At})),users:Rt.map(({displayName:St,id:At,profile:Ct})=>({profile:Ct,displayName:St,firstName:"",lastName:"",login:"",id:At}))}}async saveBookmarks(dt,{bookmarks:ft,groups:vt,users:Et}){this.cache.clearCache("/directory/sharebookmark/all");const Rt=Et.map(Nt=>typeof Nt=="string"?Nt:Nt.id),St=vt.map(Nt=>typeof Nt=="string"?Nt:Nt.id),At=ft.map(async Nt=>{if(typeof Nt=="string"){const{displayName:Ft,groups:Dt,id:Ut,users:zt}=await this.getBookMarkById(Nt),Zt=zt.map(Bt=>Bt.id),Ht=Dt.map(Bt=>Bt.id);return{displayName:Ft,id:Ut,members:[...Ht,...Zt]}}else return Promise.resolve(Nt)}),Ct=(await Promise.all(At)).map(Nt=>Nt.members).reduce((Nt,Ft)=>[...Nt,...Ft],[]),kt={name:dt,members:[...Rt,...St,...Ct]},{id:Tt}=await this.http.postJson("/directory/sharebookmark",kt);return{id:Tt,displayName:dt,members:kt.members}}}const loadedScripts={};class HttpService{constructor(dt,ft){m$5(this,"axios"),m$5(this,"_latestResponse"),this.context=dt,this.axios=axios.create(ft)}setCdn(dt){dt&&XMLHttpRequest&&!XMLHttpRequest.prototype.cdnUrl&&(XMLHttpRequest.prototype.cdnUrl=dt,XMLHttpRequest.prototype.baseOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){const ft=arguments[1];return ft.startsWith("/infra/public")&&(arguments[1]=dt+ft),/^\/([^\/]*)\/public/.test(ft)&&(arguments[1]=dt+ft),ft.startsWith("/assets")&&(arguments[1]=dt+ft),ft=="/conf/public"&&(arguments[1]=ft),ft.startsWith("http")&&(arguments[1]=ft),this.baseOpen.apply(this,arguments)})}toAxiosConfig(dt){if(dt){const ft=Object.assign({},this.axios.defaults);return dt.headers&&(ft.headers=Object.assign({},this.axios.defaults.headers),Object.assign(ft.headers,dt.headers)),dt.responseType&&(ft.responseType=dt.responseType),dt.queryParams&&(ft.params=Object.assign({},dt.queryParams)),ft}else return this.axios.defaults}toCdnUrl(dt){const ft=this.context.conf().getCdnUrl()||"";if(ft.length>0&&dt!=="/conf/public"){const vt=""+dt;(vt.startsWith("/infra/public")||vt.startsWith("/assets")||/^\/([^\/]*)\/public/.test(vt))&&(dt=ft+vt)}return dt}mapAxiosError(dt,ft){return console.error("[HttpService]",dt),dt.response?this._latestResponse=dt.response:dt.request?this._latestResponse={status:408,statusText:ERROR_CODE.TIME_OUT}:this._latestResponse={status:500,statusText:ERROR_CODE.UNKNOWN},!ft||ft.disableNotifications,this._latestResponse}mapAxiosResponse(dt,ft){return this._latestResponse=dt,dt.data}get latestResponse(){return this._latestResponse}async get(dt,ft){try{const vt=await this.axios.get(this.toCdnUrl(dt),this.toAxiosConfig(ft));return this.mapAxiosResponse(vt,ft)}catch(vt){return this.mapAxiosError(vt,ft)}}async post(dt,ft,vt){try{const Et=await this.axios.post(dt,ft,this.toAxiosConfig(vt));return this.mapAxiosResponse(Et,vt)}catch(Et){return this.mapAxiosError(Et,vt)}}async postFile(dt,ft,vt){const Et=this.toAxiosConfig(vt);Et.headers&&Et.headers["Content-Type"]&&delete Et.headers["Content-Type"];try{const Rt=await this.axios.post(dt,ft,{...Et,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(Rt,vt)}catch(Rt){return this.mapAxiosError(Rt,vt)}}async postJson(dt,ft,vt){const Et=this.toAxiosConfig();Et.headers&&(Et.headers["Content-Type"]="application/json");try{const Rt=await this.axios.post(dt,ft,this.toAxiosConfig(vt));return this.mapAxiosResponse(Rt,vt)}catch(Rt){return this.mapAxiosError(Rt,vt)}}async put(dt,ft,vt){try{const Et=await this.axios.put(dt,ft,this.toAxiosConfig(vt));return this.mapAxiosResponse(Et,vt)}catch(Et){return this.mapAxiosError(Et,vt)}}async putFile(dt,ft,vt){try{const Et=this.toAxiosConfig(vt);Et.headers&&Et.headers["Content-Type"]&&delete Et.headers["Content-Type"];const Rt=await this.axios.put(dt,ft,{...Et,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(Rt,vt)}catch(Et){return this.mapAxiosError(Et,vt)}}async putJson(dt,ft,vt){const Et=this.toAxiosConfig(vt);Et.headers&&(Et.headers["Content-Type"]="application/json");try{const Rt=await this.axios.put(dt,ft,Et);return this.mapAxiosResponse(Rt,vt)}catch(Rt){return this.mapAxiosError(Rt,vt)}}async delete(dt,ft){try{const vt=await this.axios.delete(dt,this.toAxiosConfig(ft));return this.mapAxiosResponse(vt,ft)}catch(vt){return this.mapAxiosError(vt,ft)}}async deleteJson(dt,ft){try{const vt=await this.axios.delete(dt,{data:ft});return this.mapAxiosResponse(vt)}catch(vt){return this.mapAxiosError(vt)}}getScript(dt,ft,vt){const Et=vt??"exports",Rt=this.toAxiosConfig(ft);return Rt.headers&&(Rt.headers.Accept="application/javascript"),this.axios.get(this.toCdnUrl(dt),Rt).then(St=>this.mapAxiosResponse(St,ft)).then(St=>{try{const At=`"use strict";var ${Et.split(".")[0]}={};${St};return ${Et};`;return Function(At)()}catch{return St}}).catch(St=>{throw this.mapAxiosError(St,ft),St})}loadScript(dt,ft){return loadedScripts[dt]?Promise.resolve():this.getScript(dt,ft).then(vt=>{loadedScripts[dt]=!0})}}class RightService{constructor(dt){this.context=dt}get session(){return this.context.session()}parseResourceRight(dt){const ft=dt.split(":");if(ft.length===2){if(ft[0]==="creator")return{id:ft[1],right:"creator",type:"creator"}}else return ft.length===3?{id:ft[1],right:ft[2],type:ft[0]}:void 0}parseResourceRights(dt){return dt.map(ft=>this.parseResourceRight(ft)).filter(ft=>ft!==void 0)}hasResourceRight({id:dt,groupIds:ft},vt,Et){const Rt=Et.map(St=>typeof St=="string"?this.parseResourceRight(St):St).filter(St=>St!==void 0);for(const St of Rt)if(St.id===dt&&St.type==="creator"||St.id===dt&&St.type==="user"&&St.right===vt||ft.includes(St.id)&&St.type==="group"&&St.right===vt)return!0;return!1}async sessionHasResourceRight(dt,ft){try{const vt=await this.session.getUser();return!!vt&&this.hasResourceRight({groupIds:vt.groupsIds,id:vt.userId},dt,ft)}catch(vt){return console.error(vt),!1}}async sessionHasAtLeastOneResourceRight(dt,ft){for(const vt of dt)if(await this.sessionHasResourceRight(vt,ft))return!0;return!1}async sessionHasResourceRightForEachList(dt,ft){let vt=0;for(const Et of ft)await this.sessionHasResourceRight(dt,Et)&&vt++;return vt===ft.length}async sessionHasAtLeastOneResourceRightForEachList(dt,ft){for(const vt of dt){let Et=0;for(const Rt of ft)await this.sessionHasResourceRight(vt,Rt)&&Et++;if(Et===ft.length)return!0}return!1}hasWorkflowRight(dt,ft){return ft.findIndex(vt=>vt===dt)!==-1}async sessionHasWorkflowRight(dt){try{const ft=await this.session.getUser();return!!ft&&this.hasWorkflowRight(dt,ft.authorizedActions.map(vt=>vt.name))}catch(ft){return console.error(ft),!1}}async sessionHasWorkflowRights(dt){const ft={};try{const vt=await this.session.getUser();for(const Et of dt)ft[Et]=!!vt&&this.hasWorkflowRight(Et,vt.authorizedActions.map(Rt=>Rt.name))}catch(vt){console.error(vt);for(const Et of dt)ft[Et]=!1}return ft}}class SessionService{constructor(dt){this.context=dt}get http(){return this.context.http()}get cache(){return this.context.cache()}onLogout(){this.cache.clearCache()}onRefreshSession(){this.cache.clearCache()}async getSession(){const dt=await this.getUser(),[ft,vt,Et,Rt,St]=await Promise.all([this.getCurrentLanguage(dt),this.latestQuotaAndUsage(dt),this.loadDescription(dt),this.getUserProfile(),this.getBookmarks(dt)]);return{user:dt,quotaAndUsage:vt,currentLanguage:ft,userDescription:Et,userProfile:Rt,bookmarkedApps:St}}login(dt,ft,vt,Et){const Rt=new FormData;return Rt.append("email",dt),Rt.append("password",ft),typeof vt<"u"&&Rt.append("rememberMe",""+vt),typeof Et<"u"&&Rt.append("secureLocation",""+Et),this.http.post("/auth/login",Rt,{headers:{"content-type":"application/x-www-form-urlencoded"}}).finally(()=>{switch(this.http.latestResponse.status){case 200:throw ERROR_CODE.MALFORMED_DATA}})}logout(){return this.http.get("/auth/logout").finally(()=>{})}async latestQuotaAndUsage(dt){try{return await this.http.get(`/workspace/quota/user/${dt==null?void 0:dt.userId}`)}catch(ft){return console.error(ft),{quota:0,storage:0}}}async getCurrentLanguage(dt){const ft=(dt==null?void 0:dt.sessionMetadata)&&(dt==null?void 0:dt.sessionMetadata.userId);try{let vt;return ft?vt=await this.loadUserLanguage():vt=await this.loadDefaultLanguage(),vt}catch(vt){console.error(vt)}}async loadUserLanguage(){try{const dt=await this.http.get("/userbook/preference/language");return JSON.parse(dt.preference)["default-domain"]}catch{return await this.loadDefaultLanguage()}}async loadDefaultLanguage(){return(await this.cache.httpGetJson("/locale")).locale}async getUser(){const{response:dt,value:ft}=await this.cache.httpGet("/auth/oauth2/userinfo");if(dt.status<200||dt.status>=300)throw ERROR_CODE.NOT_LOGGED_IN;return ft}hasWorkflow({workflowName:dt,user:ft}){return dt===void 0||(ft==null?void 0:ft.authorizedActions.findIndex(vt=>vt.name===dt))!==-1}async loadDescription(dt){try{const[ft,vt]=await Promise.all([this.getUserProfile({requestName:"refreshAvatar"}),this.http.get("/directory/userbook/"+(dt==null?void 0:dt.userId))]);return{...ft,...vt}}catch(ft){return console.error(ft),{}}}async getBookmarks(dt){const ft=await this.http.get("/userbook/preference/apps");ft.preference||(ft.preference=null);const vt=JSON.parse(ft.preference);let Et;Et=vt,Et||(Et={bookmarks:[],applications:[]});let Rt=[];return Et.bookmarks.forEach((St,At)=>{const Ct=dt==null?void 0:dt.apps.find(kt=>kt.name===St);if(Ct){let kt=Object.assign({},Ct);Rt.push(kt)}}),Rt}async getUserProfile(dt){const{response:ft,value:vt}=await this.cache.httpGet("/userbook/api/person",dt);if(ft.status<200||ft.status>=300)throw ERROR_CODE.NOT_LOGGED_IN;return vt.result[0].type}async isAdml(){const dt=await this.getUser();return(dt==null?void 0:dt.functions.ADMIN_LOCAL)!==void 0}}class StringUtils{static removeAccents(dt){for(var ft=0;ft<defaultDiacriticsRemovalMap$1.length;ft++)dt=dt.replace(defaultDiacriticsRemovalMap$1[ft].letters,defaultDiacriticsRemovalMap$1[ft].base);return dt}}class ShareService{constructor(dt){this.context=dt}get directory(){return this.context.directory()}get http(){return this.context.http()}get cache(){return this.context.cache()}async searchShareSubjects(dt,ft,vt){const Et=StringUtils.removeAccents(vt).toLowerCase(),Rt=await this.cache.httpGetJson(`/${dt}/share/json/${ft}?search=${vt}`),St=Rt.users.visibles.filter(({username:Ct,firstName:kt,lastName:Tt,login:Nt})=>{const Ft=StringUtils.removeAccents(Tt||"").toLowerCase(),Dt=StringUtils.removeAccents(kt||"").toLowerCase(),Ut=StringUtils.removeAccents(Ct||"").toLowerCase(),zt=StringUtils.removeAccents(Nt||"").toLowerCase();return Ut.includes(Et)||Dt.includes(Et)||Ft.includes(Et)||zt.includes(Et)}).map(Ct=>({avatarUrl:this.directory.getAvatarUrl(Ct.id,"user"),directoryUrl:this.directory.getDirectoryUrl(Ct.id,"user"),displayName:Ct.username,id:Ct.id,profile:Ct.profile,type:"user"})),At=Rt.groups.visibles.filter(({name:Ct})=>StringUtils.removeAccents(Ct||"").toLowerCase().includes(Et)).map(Ct=>({avatarUrl:this.directory.getAvatarUrl(Ct.id,"group"),directoryUrl:this.directory.getDirectoryUrl(Ct.id,"group"),displayName:Ct.name,id:Ct.id,type:"group"}));return[...(await this.directory.getBookMarks()).filter(({displayName:Ct})=>StringUtils.removeAccents(Ct||"").toLowerCase().includes(Et)).map(Ct=>({avatarUrl:"",directoryUrl:"",profile:"",displayName:Ct.displayName,id:Ct.id,type:"sharebookmark"})),...St,...At]}async getShareMapping(dt){const ft=await this.cache.httpGetJson(`/${dt}/rights/sharing`);for(const vt of Object.keys(ft))if(vt.includes(".")){const Et=vt.split(".")[1],Rt=ft[vt];delete ft[vt],ft[Et]=Rt}return ft}getActionsAvailableFor({id:dt,type:ft},vt,Et){const Rt=(ft==="user"?vt.users.checked[dt]:vt.groups.checked[dt])||[],St=Object.keys(Et),At=[];for(const Ct of St)Et[Ct].filter(kt=>Rt.includes(kt)).length>0&&At.push(Ct);return At}async getRightsForResource(dt,ft){const vt=await this.directory.getBookMarks(),Et=this.context.resource(dt,dt).getShareReadUrl(ft),Rt=await this.cache.httpGetJson(Et),St=await this.getShareMapping(dt),At=await this.cache.httpGetJson("/infra/public/json/sharing-rights.json"),Ct=Object.keys(Rt.users.checked).map(Dt=>Rt.users.visibles.find(Ut=>Ut.id===Dt)).filter(Dt=>Dt!==void 0).map(Dt=>{const Ut=this.getActionsAvailableFor({id:Dt.id,type:"user"},Rt,St);return{id:Dt.id,type:"user",displayName:Dt.username,profile:Dt.profile,avatarUrl:this.directory.getAvatarUrl(Dt.id,"user"),directoryUrl:this.directory.getDirectoryUrl(Dt.id,"user"),actions:Ut.map(zt=>{const Zt=At[zt];return{displayName:zt,id:zt,priority:Zt.priority}})}}).sort((Dt,Ut)=>(Dt.displayName||"").localeCompare(Ut.displayName)),kt=Object.keys(Rt.groups.checked).map(Dt=>Rt.groups.visibles.find(Ut=>Ut.id===Dt)).filter(Dt=>Dt!==void 0).map(Dt=>{const Ut=this.getActionsAvailableFor({id:Dt.id,type:"group"},Rt,St);return{id:Dt.id,type:"group",displayName:Dt.name,profile:void 0,avatarUrl:this.directory.getAvatarUrl(Dt.id,"group"),directoryUrl:this.directory.getDirectoryUrl(Dt.id,"group"),actions:Ut.map(zt=>{const Zt=At[zt];return{displayName:zt,id:zt,priority:Zt.priority}})}}).sort((Dt,Ut)=>(Dt.displayName||"").localeCompare(Ut.displayName)),Tt=[...Ct,...kt],Nt=Rt.groups.visibles.map(({groupDisplayName:Dt,id:Ut,name:zt})=>({displayName:Dt||zt,id:Ut})),Ft=Rt.users.visibles.map(({id:Dt,profile:Ut,username:zt,firstName:Zt,lastName:Ht,login:Bt})=>({displayName:zt,firstName:Zt,lastName:Ht,login:Bt,profile:Ut,id:Dt}));return{rights:Tt,visibleBookmarks:vt,visibleGroups:Nt,visibleUsers:Ft}}async saveRights(dt,ft,vt){const Et=await this.getShareMapping(dt),Rt={bookmarks:{},groups:{},users:{}};for(const Ct of vt){const kt=Ct.actions.map(Nt=>Et[Nt.id]).reduce((Nt,Ft)=>[...Nt,...Ft],[]),Tt=[...new Set(kt)];Tt.length>0&&(Ct.type==="user"?Rt.users[Ct.id]=Tt:Ct.type==="group"?Rt.groups[Ct.id]=Tt:Rt.bookmarks[Ct.id]=Tt)}const St=this.context.resource(dt,dt),At=St.getSaveShareUrl(ft);return this.cache.clearCache(St.getShareReadUrl(ft)),await this.http.putJson(At,Rt)}async getActionsForApp(dt){const ft=await this.cache.httpGetJson("/infra/public/json/sharing-rights.json"),vt=await this.getShareMapping(dt);return Object.keys(ft).map(Et=>{const Rt=ft[Et];return{displayName:Et,id:Et,priority:Rt.priority,requires:Rt.requires}}).filter(Et=>{var Rt;return((Rt=vt[Et.id])==null?void 0:Rt.length)>0}).sort((Et,Rt)=>Et.priority-Rt.priority)}}const S$3=class{constructor(){m$5(this,"wordExtensions",new Set),m$5(this,"excelExtensions",new Set),m$5(this,"pptExtensions",new Set),m$5(this,"fileExtensionMap",new Map),m$5(this,"csvContentType",new Set),m$5(this,"csvExtensions",new Set),m$5(this,"txtExtensions",new Set),m$5(this,"PDF","application/pdf"),m$5(this,"OCTET_STREAM","application/octet-stream"),this.txtExtensions.add("txt"),this.wordExtensions.add("doc"),this.wordExtensions.add("dot"),this.wordExtensions.add("docx"),this.wordExtensions.add("dotx"),this.wordExtensions.add("docm"),this.wordExtensions.add("dotm"),this.wordExtensions.add("odt"),this.wordExtensions.add("ott"),this.wordExtensions.add("oth"),this.wordExtensions.add("odm"),this.excelExtensions.add("xls"),this.excelExtensions.add("xlt"),this.excelExtensions.add("xla"),this.excelExtensions.add("xlsx"),this.excelExtensions.add("xltx"),this.excelExtensions.add("xlsm"),this.excelExtensions.add("xltm"),this.excelExtensions.add("xlam"),this.excelExtensions.add("xlsb"),this.excelExtensions.add("ods"),this.excelExtensions.add("ots"),this.pptExtensions.add("ppt"),this.pptExtensions.add("pot"),this.pptExtensions.add("pps"),this.pptExtensions.add("ppa"),this.pptExtensions.add("pptx"),this.pptExtensions.add("potx"),this.pptExtensions.add("ppsx"),this.pptExtensions.add("ppam"),this.pptExtensions.add("pptm"),this.pptExtensions.add("potm"),this.pptExtensions.add("ppsm"),this.pptExtensions.add("odp"),this.pptExtensions.add("otp"),this.csvExtensions.add("csv"),this.fileExtensionMap.set("doc","application/msword"),this.fileExtensionMap.set("dot","application/msword"),this.fileExtensionMap.set("docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"),this.fileExtensionMap.set("dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"),this.fileExtensionMap.set("docm","application/vnd.ms-word.document.macroEnabled.12"),this.fileExtensionMap.set("dotm","application/vnd.ms-word.template.macroEnabled.12"),this.fileExtensionMap.set("xls","application/vnd.ms-excel"),this.fileExtensionMap.set("xlt","application/vnd.ms-excel"),this.fileExtensionMap.set("xla","application/vnd.ms-excel"),this.fileExtensionMap.set("xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),this.fileExtensionMap.set("xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"),this.fileExtensionMap.set("xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"),this.fileExtensionMap.set("xltm","application/vnd.ms-excel.template.macroEnabled.12"),this.fileExtensionMap.set("xlam","application/vnd.ms-excel.addin.macroEnabled.12"),this.fileExtensionMap.set("xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"),this.fileExtensionMap.set("ppt","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pot","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pps","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("ppa","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"),this.fileExtensionMap.set("potx","application/vnd.openxmlformats-officedocument.presentationml.template"),this.fileExtensionMap.set("ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"),this.fileExtensionMap.set("ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"),this.fileExtensionMap.set("pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"),this.fileExtensionMap.set("potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"),this.fileExtensionMap.set("ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"),this.fileExtensionMap.set("odt","application/vnd.oasis.opendocument.text"),this.fileExtensionMap.set("ott","application/vnd.oasis.opendocument.text-template"),this.fileExtensionMap.set("oth","application/vnd.oasis.opendocument.text-web"),this.fileExtensionMap.set("odm","application/vnd.oasis.opendocument.text-master"),this.fileExtensionMap.set("odg","application/vnd.oasis.opendocument.graphics"),this.fileExtensionMap.set("otg","application/vnd.oasis.opendocument.graphics-template"),this.fileExtensionMap.set("odp","application/vnd.oasis.opendocument.presentation"),this.fileExtensionMap.set("otp","application/vnd.oasis.opendocument.presentation-template"),this.fileExtensionMap.set("ods","application/vnd.oasis.opendocument.spreadsheet"),this.fileExtensionMap.set("ots","application/vnd.oasis.opendocument.spreadsheet-template"),this.fileExtensionMap.set("odc","application/vnd.oasis.opendocument.chart"),this.fileExtensionMap.set("odf","application/vnd.oasis.opendocument.formula"),this.fileExtensionMap.set("odb","application/vnd.oasis.opendocument.database"),this.fileExtensionMap.set("odi","application/vnd.oasis.opendocument.image"),this.fileExtensionMap.set("oxt","application/vnd.openofficeorg.extension"),this.fileExtensionMap.set("txt","text/plain"),this.csvContentType.add("text/comma-separated-values"),this.csvContentType.add("text/csv"),this.csvContentType.add("application/csv")}getContentTypeForExtension(dt){if(this.fileExtensionMap.has(dt))return this.fileExtensionMap.get(dt)}getExtensionForContentType(dt){for(const ft of Array.from(this.fileExtensionMap.keys()))if((this.fileExtensionMap.get(ft)||"").toLowerCase()==(dt||"").toLowerCase())return ft;return null}isWordLike(dt,ft){const vt=this.getExtensionForContentType(dt);return vt?this.wordExtensions.has(vt):dt==this.OCTET_STREAM&&ft?this.wordExtensions.has(ft):!1}isExcelLike(dt,ft){const vt=this.getExtensionForContentType(dt);return vt?this.excelExtensions.has(vt):dt==this.OCTET_STREAM&&ft?this.excelExtensions.has(ft):!1}isCsvLike(dt,ft){return this.csvContentType.has(dt)?!0:dt==this.OCTET_STREAM&&ft?this.csvExtensions.has(ft):!1}isPowerpointLike(dt,ft){const vt=this.getExtensionForContentType(dt);return vt?this.pptExtensions.has(vt):dt==this.OCTET_STREAM&&ft?this.pptExtensions.has(ft):!1}isTxtLike(dt,ft){const vt=this.getExtensionForContentType(dt);return vt?this.txtExtensions.has(vt):dt==this.OCTET_STREAM&&ft?this.txtExtensions.has(ft):!1}};let MimeTypeUtils=S$3;m$5(MimeTypeUtils,"INSTANCE",new S$3);class FileTypeUtils{static registerContentTypeToFileType(dt){this.fileTypes.push(dt)}static getFileType(dt,ft=!1,vt){if(vt&&(vt=vt.trim()),!dt)return"unknown";this.fileTypes||console.warn("[Element.role] should not have emptyRoles",this);for(let Rt of this.fileTypes||[]){const St=Rt(dt,ft);if(St)return St}const Et={csv:function(Rt){return!!MimeTypeUtils.INSTANCE.isCsvLike(Rt,vt)},doc:function(Rt){return MimeTypeUtils.INSTANCE.isWordLike(Rt,vt)?!0:Rt.indexOf("document")!==-1&&Rt.indexOf("wordprocessing")!==-1},xls:function(Rt){return MimeTypeUtils.INSTANCE.isExcelLike(Rt,vt)?!0:Rt.indexOf("document")!==-1&&Rt.indexOf("spreadsheet")!==-1||Rt.indexOf("ms-excel")!==-1},img:function(Rt){return Rt.indexOf("image")!==-1},pdf:function(Rt){return Rt.indexOf("pdf")!==-1||Rt==="application/x-download"},ppt:function(Rt){return MimeTypeUtils.INSTANCE.isPowerpointLike(Rt,vt)?!0:Rt.indexOf("document")!==-1&&Rt.indexOf("presentation")!==-1||Rt.indexOf("powerpoint")!==-1},txt:function(Rt){return MimeTypeUtils.INSTANCE.isTxtLike(Rt,vt)},video:function(Rt){return Rt.indexOf("video")!==-1},audio:function(Rt){return Rt.indexOf("audio")!==-1},zip:function(Rt){return Rt.indexOf("zip")!==-1||Rt.indexOf("rar")!==-1||Rt.indexOf("tar")!==-1||Rt.indexOf("7z")!==-1}};for(let Rt in Et)if(Et[Rt](dt))return Rt;return"unknown"}}m$5(FileTypeUtils,"fileTypes",[]);class WorkspaceService{constructor(dt){this.context=dt}get http(){return this.context.http()}async saveFile(dt,ft){const vt=dt.name||"",Et=vt.split("."),Rt=dt.type||"application/octet-stream",St=Et.length>1?Et[Et.length-1]:"",At={"content-type":Rt,filename:vt,size:dt.size,extension:St,role:FileTypeUtils.getFileType(Rt,!1,St)},Ct=vt.replace("."+At.extension,""),kt=At.extension?Ct+"."+At.extension:Ct,Tt=new FormData;Tt.append("file",dt,kt);const Nt=[];return((ft==null?void 0:ft.visibility)==="public"||(ft==null?void 0:ft.visibility)==="protected")&&Nt.push(`${ft.visibility}=true`),ft!=null&&ft.application&&Nt.push(`application=${ft.application}`),At.role==="img"&&Nt.push("quality=1"),ft!=null&&ft.parentId&&Nt.push(`parentId=${ft.parentId}`),await this.http.postFile(`/workspace/document?${Nt.join("&")}`,Tt)}}const bundle={},promises={},defaultDiacriticsRemovalMap=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];class IdiomService{constructor(dt){this.context=dt}get http(){return this.context.http()}async getIdiom(dt,ft){await Promise.all([this.addBundlePromise(dt,"/i18n"),this.addBundlePromise(dt,`/${ft}/i18n`)])}translate(dt,ft){dt=dt??"";let vt=bundle[dt]===void 0?dt:bundle[dt];if(ft&&typeof ft=="object")for(let Et in ft)typeof ft[Et]<"u"&&(vt=vt.replace(new RegExp("\\${"+Et+"}","g"),""+ft[Et]));return vt}addBundlePromise(dt,ft){return this.loadBundlePromise(dt,ft)}addBundle(dt,ft,vt){this.loadBundle(dt,ft,vt)}loadBundlePromise(dt,ft){return this.loadBundle(dt,ft),promises[ft]}loadBundle(dt,ft,vt){const Et=promises[ft];if(Et)vt&&Et.then(vt).catch(vt);else{const Rt=new Promisified;promises[ft]=Rt.promise;const St={};dt&&(St["Accept-Language"]=dt),this.http.get(ft,{headers:St}).then(At=>{Object.assign(bundle,At),typeof vt=="function"&&vt(),Rt.resolve()}).catch(At=>{typeof vt=="function"&&vt(),Rt.reject()})}}addTranslations(dt,ft){notify.onLangReady().promise.then(vt=>{this.loadBundle(vt,dt+"/"+vt+".json",ft)})}addAllTranslations(dt){return dt&&dt.length>0?notify.onLangReady().promise.then(ft=>Promise.all(dt.map(vt=>this.loadBundlePromise(ft,vt+"/"+ft+".json")))).then(()=>{}):Promise.reject()}addKeys(dt){for(var ft in dt)typeof bundle[ft]!="string"&&(bundle[ft]=dt[ft])}removeAccents(dt){for(var ft=0;ft<defaultDiacriticsRemovalMap.length;ft++)dt=dt.replace(defaultDiacriticsRemovalMap[ft].letters,defaultDiacriticsRemovalMap[ft].base);return dt}}let ATTag;class AnalyticsService{constructor(lt){this.context=lt}get http(){return this.context.http()}get session(){return this.context.session()}async trackPageLoad(lt,dt){const[ft]=await Promise.all([this.getXitiConfig(dt.name.toLowerCase()),this.loadXitiScript()]);if(!ft||!ATInternet)return;let vt=ft.LIBELLE_SERVICE.default||null;for(let Et in ft.LIBELLE_SERVICE)if(Et!=="default"&&lt.indexOf(Et)>=0){vt=ft.LIBELLE_SERVICE[Et];break}ATTag=new ATInternet.Tracker.Tag({site:ft.STRUCT_ID}),ATTag.setProps({SERVICE:vt,TYPE:ft.TYPE,OUTIL:ft.OUTIL,UAI:ft.STRUCT_UAI,PROJET:ft.PROJET,EXPLOITANT:ft.EXPLOITANT,PLATEFORME:ft.PLATFORME,PROFIL:ft.PROFILE},!0),ATTag.identifiedVisitor.set({id:ft.ID_PERSO,category:ft.PROFILE}),ATTag.page.set({name:(dt==null?void 0:dt.prefix)==="userbook"?"directory":dt==null?void 0:dt.prefix,chapter1:"",chapter2:"",chapter3:"",level2:ft.STRUCT_UAI}),ATTag.dispatch()}async getXitiConfig(lt){const[dt,ft]=await Promise.all([this.http.get("/analyticsConf"),this.http.get("/xiti/config")]);if(!(dt!=null&&dt.type))throw ERROR_CODE.MALFORMED_DATA;return ft!=null&&ft.active&&(dt.xiti=await this.getXitiTrackingParams(ft,lt)),dt.xiti}async loadXitiScript(){if(typeof ATInternet>"u"){const scriptPath="/xiti/public/js/lib/smarttag_ENT.js",response=await this.http.get(scriptPath,{headers:{Accept:"application/javascript"}});if(this.http.latestResponse.status!=200)throw"Error while loading XiTi script";eval(response)}}async getXitiTrackingParams(lt,dt){var ft;if(!lt.structureMap||!dt)return;const vt=await this.session.getUser(),Et=await this.session.getUserProfile();let Rt;if(!(vt!=null&&vt.structures))return;for(let Tt of vt.structures){const Nt=lt.structureMap[Tt];if(Nt&&Nt.collectiviteId&&Nt.UAI){Rt=Nt;break}}if(!Rt||!Rt.active)return;const St=await configure.Platform.apps.getPublicConf(dt);if(!St)return;const At=St.xiti;if(!At||!At.LIBELLE_SERVICE||!Rt.UAI)return;function Ct(Tt){let Nt="";for(let Ft=0;Ft<Tt.length;Ft++)Nt+=Tt.charCodeAt(Ft);return Nt}const kt={Student:"ELEVE",Teacher:"ENSEIGNANT",Relative:"PARENT",Personnel:"ADMIN_VIE_SCOL_TECH",Guest:"AUTRE"};return{LIBELLE_SERVICE:At.LIBELLE_SERVICE,TYPE:At.OUTIL?"TIERS":"NATIF",OUTIL:At.OUTIL?At.OUTIL:"",STRUCT_ID:Rt.collectiviteId,STRUCT_UAI:Rt.UAI,PROJET:Rt.projetId?Rt.projetId:lt.ID_PROJET,EXPLOITANT:lt.ID_EXPLOITANT,PLATFORME:Rt.plateformeId?Rt.plateformeId:lt.ID_PLATEFORME,ID_PERSO:Ct(vt.userId),PROFILE:Et&&Et.length>0&&(ft=kt[Et[0]])!=null?ft:""}}}class OdeServices{constructor(){m$5(this,"_analytics"),m$5(this,"_cache"),m$5(this,"_conf"),m$5(this,"_directory"),m$5(this,"_http"),m$5(this,"_idiom"),m$5(this,"_rights"),m$5(this,"_session"),m$5(this,"_share"),m$5(this,"_workspace"),this._analytics=new AnalyticsService(this),this._cache=new CacheService(this),this._conf=new ConfService(this),this._directory=new DirectoryService(this),this._http=new HttpService(this),this._idiom=new IdiomService(this),this._rights=new RightService(this),this._session=new SessionService(this),this._share=new ShareService(this),this._workspace=new WorkspaceService(this)}analytics(){return this._analytics}cache(){return this._cache}conf(){return this._conf}directory(){return this._directory}http(){return this._http}idiom(){return this._idiom}resource(dt,ft){return ft?ResourceService.findService({application:dt,resourceType:ft},this):ResourceService.findMainService({application:dt},this)}rights(){return this._rights}session(){return this._session}share(){return this._share}workspace(){return this._workspace}}const odeServices=new OdeServices;class Subscribable{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(dt){const ft={listener:dt};return this.listeners.add(ft),this.onSubscribe(),()=>{this.listeners.delete(ft),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}const isServer=typeof window>"u"||"Deno"in window;function noop$1(){}function functionalUpdate(lt,dt){return typeof lt=="function"?lt(dt):lt}function isValidTimeout(lt){return typeof lt=="number"&&lt>=0&&lt!==1/0}function timeUntilStale(lt,dt){return Math.max(lt+(dt||0)-Date.now(),0)}function parseQueryArgs(lt,dt,ft){return isQueryKey(lt)?typeof dt=="function"?{...ft,queryKey:lt,queryFn:dt}:{...dt,queryKey:lt}:lt}function parseMutationArgs(lt,dt,ft){return isQueryKey(lt)?typeof dt=="function"?{...ft,mutationKey:lt,mutationFn:dt}:{...dt,mutationKey:lt}:typeof lt=="function"?{...dt,mutationFn:lt}:{...lt}}function parseFilterArgs(lt,dt,ft){return isQueryKey(lt)?[{...dt,queryKey:lt},ft]:[lt||{},dt]}function matchQuery(lt,dt){const{type:ft="all",exact:vt,fetchStatus:Et,predicate:Rt,queryKey:St,stale:At}=lt;if(isQueryKey(St)){if(vt){if(dt.queryHash!==hashQueryKeyByOptions(St,dt.options))return!1}else if(!partialMatchKey(dt.queryKey,St))return!1}if(ft!=="all"){const Ct=dt.isActive();if(ft==="active"&&!Ct||ft==="inactive"&&Ct)return!1}return!(typeof At=="boolean"&&dt.isStale()!==At||typeof Et<"u"&&Et!==dt.state.fetchStatus||Rt&&!Rt(dt))}function matchMutation(lt,dt){const{exact:ft,fetching:vt,predicate:Et,mutationKey:Rt}=lt;if(isQueryKey(Rt)){if(!dt.options.mutationKey)return!1;if(ft){if(hashQueryKey(dt.options.mutationKey)!==hashQueryKey(Rt))return!1}else if(!partialMatchKey(dt.options.mutationKey,Rt))return!1}return!(typeof vt=="boolean"&&dt.state.status==="loading"!==vt||Et&&!Et(dt))}function hashQueryKeyByOptions(lt,dt){return((dt==null?void 0:dt.queryKeyHashFn)||hashQueryKey)(lt)}function hashQueryKey(lt){return JSON.stringify(lt,(dt,ft)=>isPlainObject(ft)?Object.keys(ft).sort().reduce((vt,Et)=>(vt[Et]=ft[Et],vt),{}):ft)}function partialMatchKey(lt,dt){return partialDeepEqual(lt,dt)}function partialDeepEqual(lt,dt){return lt===dt?!0:typeof lt!=typeof dt?!1:lt&&dt&&typeof lt=="object"&&typeof dt=="object"?!Object.keys(dt).some(ft=>!partialDeepEqual(lt[ft],dt[ft])):!1}function replaceEqualDeep(lt,dt){if(lt===dt)return lt;const ft=isPlainArray(lt)&&isPlainArray(dt);if(ft||isPlainObject(lt)&&isPlainObject(dt)){const vt=ft?lt.length:Object.keys(lt).length,Et=ft?dt:Object.keys(dt),Rt=Et.length,St=ft?[]:{};let At=0;for(let Ct=0;Ct<Rt;Ct++){const kt=ft?Ct:Et[Ct];St[kt]=replaceEqualDeep(lt[kt],dt[kt]),St[kt]===lt[kt]&&At++}return vt===Rt&&At===vt?lt:St}return dt}function shallowEqualObjects(lt,dt){if(lt&&!dt||dt&&!lt)return!1;for(const ft in lt)if(lt[ft]!==dt[ft])return!1;return!0}function isPlainArray(lt){return Array.isArray(lt)&&lt.length===Object.keys(lt).length}function isPlainObject(lt){if(!hasObjectPrototype(lt))return!1;const dt=lt.constructor;if(typeof dt>"u")return!0;const ft=dt.prototype;return!(!hasObjectPrototype(ft)||!ft.hasOwnProperty("isPrototypeOf"))}function hasObjectPrototype(lt){return Object.prototype.toString.call(lt)==="[object Object]"}function isQueryKey(lt){return Array.isArray(lt)}function sleep(lt){return new Promise(dt=>{setTimeout(dt,lt)})}function scheduleMicrotask(lt){sleep(0).then(lt)}function getAbortController(){if(typeof AbortController=="function")return new AbortController}function replaceData(lt,dt,ft){return ft.isDataEqual!=null&&ft.isDataEqual(lt,dt)?lt:typeof ft.structuralSharing=="function"?ft.structuralSharing(lt,dt):ft.structuralSharing!==!1?replaceEqualDeep(lt,dt):dt}class FocusManager extends Subscribable{constructor(){super(),this.setup=dt=>{if(!isServer&&window.addEventListener){const ft=()=>dt();return window.addEventListener("visibilitychange",ft,!1),window.addEventListener("focus",ft,!1),()=>{window.removeEventListener("visibilitychange",ft),window.removeEventListener("focus",ft)}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var dt;(dt=this.cleanup)==null||dt.call(this),this.cleanup=void 0}}setEventListener(dt){var ft;this.setup=dt,(ft=this.cleanup)==null||ft.call(this),this.cleanup=dt(vt=>{typeof vt=="boolean"?this.setFocused(vt):this.onFocus()})}setFocused(dt){this.focused=dt,dt&&this.onFocus()}onFocus(){this.listeners.forEach(({listener:dt})=>{dt()})}isFocused(){return typeof this.focused=="boolean"?this.focused:typeof document>"u"?!0:[void 0,"visible","prerender"].includes(document.visibilityState)}}const focusManager=new FocusManager,onlineEvents=["online","offline"];class OnlineManager extends Subscribable{constructor(){super(),this.setup=dt=>{if(!isServer&&window.addEventListener){const ft=()=>dt();return onlineEvents.forEach(vt=>{window.addEventListener(vt,ft,!1)}),()=>{onlineEvents.forEach(vt=>{window.removeEventListener(vt,ft)})}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var dt;(dt=this.cleanup)==null||dt.call(this),this.cleanup=void 0}}setEventListener(dt){var ft;this.setup=dt,(ft=this.cleanup)==null||ft.call(this),this.cleanup=dt(vt=>{typeof vt=="boolean"?this.setOnline(vt):this.onOnline()})}setOnline(dt){this.online=dt,dt&&this.onOnline()}onOnline(){this.listeners.forEach(({listener:dt})=>{dt()})}isOnline(){return typeof this.online=="boolean"?this.online:typeof navigator>"u"||typeof navigator.onLine>"u"?!0:navigator.onLine}}const onlineManager=new OnlineManager;function defaultRetryDelay(lt){return Math.min(1e3*2**lt,3e4)}function canFetch(lt){return(lt??"online")==="online"?onlineManager.isOnline():!0}class CancelledError{constructor(dt){this.revert=dt==null?void 0:dt.revert,this.silent=dt==null?void 0:dt.silent}}function isCancelledError(lt){return lt instanceof CancelledError}function createRetryer(lt){let dt=!1,ft=0,vt=!1,Et,Rt,St;const At=new Promise((Zt,Ht)=>{Rt=Zt,St=Ht}),Ct=Zt=>{vt||(Dt(new CancelledError(Zt)),lt.abort==null||lt.abort())},kt=()=>{dt=!0},Tt=()=>{dt=!1},Nt=()=>!focusManager.isFocused()||lt.networkMode!=="always"&&!onlineManager.isOnline(),Ft=Zt=>{vt||(vt=!0,lt.onSuccess==null||lt.onSuccess(Zt),Et==null||Et(),Rt(Zt))},Dt=Zt=>{vt||(vt=!0,lt.onError==null||lt.onError(Zt),Et==null||Et(),St(Zt))},Ut=()=>new Promise(Zt=>{Et=Ht=>{const Bt=vt||!Nt();return Bt&&Zt(Ht),Bt},lt.onPause==null||lt.onPause()}).then(()=>{Et=void 0,vt||lt.onContinue==null||lt.onContinue()}),zt=()=>{if(vt)return;let Zt;try{Zt=lt.fn()}catch(Ht){Zt=Promise.reject(Ht)}Promise.resolve(Zt).then(Ft).catch(Ht=>{var Bt,Wt;if(vt)return;const Kt=(Bt=lt.retry)!=null?Bt:3,ar=(Wt=lt.retryDelay)!=null?Wt:defaultRetryDelay,rr=typeof ar=="function"?ar(ft,Ht):ar,ur=Kt===!0||typeof Kt=="number"&&ft<Kt||typeof Kt=="function"&&Kt(ft,Ht);if(dt||!ur){Dt(Ht);return}ft++,lt.onFail==null||lt.onFail(ft,Ht),sleep(rr).then(()=>{if(Nt())return Ut()}).then(()=>{dt?Dt(Ht):zt()})})};return canFetch(lt.networkMode)?zt():Ut().then(zt),{promise:At,cancel:Ct,continue:()=>(Et==null?void 0:Et())?At:Promise.resolve(),cancelRetry:kt,continueRetry:Tt}}const defaultLogger=console;function createNotifyManager(){let lt=[],dt=0,ft=Tt=>{Tt()},vt=Tt=>{Tt()};const Et=Tt=>{let Nt;dt++;try{Nt=Tt()}finally{dt--,dt||At()}return Nt},Rt=Tt=>{dt?lt.push(Tt):scheduleMicrotask(()=>{ft(Tt)})},St=Tt=>(...Nt)=>{Rt(()=>{Tt(...Nt)})},At=()=>{const Tt=lt;lt=[],Tt.length&&scheduleMicrotask(()=>{vt(()=>{Tt.forEach(Nt=>{ft(Nt)})})})};return{batch:Et,batchCalls:St,schedule:Rt,setNotifyFunction:Tt=>{ft=Tt},setBatchNotifyFunction:Tt=>{vt=Tt}}}const notifyManager=createNotifyManager();class Removable{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.cacheTime)&&(this.gcTimeout=setTimeout(()=>{this.optionalRemove()},this.cacheTime))}updateCacheTime(dt){this.cacheTime=Math.max(this.cacheTime||0,dt??(isServer?1/0:5*60*1e3))}clearGcTimeout(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)}}class Query extends Removable{constructor(dt){super(),this.abortSignalConsumed=!1,this.defaultOptions=dt.defaultOptions,this.setOptions(dt.options),this.observers=[],this.cache=dt.cache,this.logger=dt.logger||defaultLogger,this.queryKey=dt.queryKey,this.queryHash=dt.queryHash,this.initialState=dt.state||getDefaultState$1(this.options),this.state=this.initialState,this.scheduleGc()}get meta(){return this.options.meta}setOptions(dt){this.options={...this.defaultOptions,...dt},this.updateCacheTime(this.options.cacheTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.cache.remove(this)}setData(dt,ft){const vt=replaceData(this.state.data,dt,this.options);return this.dispatch({data:vt,type:"success",dataUpdatedAt:ft==null?void 0:ft.updatedAt,manual:ft==null?void 0:ft.manual}),vt}setState(dt,ft){this.dispatch({type:"setState",state:dt,setStateOptions:ft})}cancel(dt){var ft;const vt=this.promise;return(ft=this.retryer)==null||ft.cancel(dt),vt?vt.then(noop$1).catch(noop$1):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.initialState)}isActive(){return this.observers.some(dt=>dt.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||this.observers.some(dt=>dt.getCurrentResult().isStale)}isStaleByTime(dt=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!timeUntilStale(this.state.dataUpdatedAt,dt)}onFocus(){var dt;const ft=this.observers.find(vt=>vt.shouldFetchOnWindowFocus());ft&&ft.refetch({cancelRefetch:!1}),(dt=this.retryer)==null||dt.continue()}onOnline(){var dt;const ft=this.observers.find(vt=>vt.shouldFetchOnReconnect());ft&&ft.refetch({cancelRefetch:!1}),(dt=this.retryer)==null||dt.continue()}addObserver(dt){this.observers.includes(dt)||(this.observers.push(dt),this.clearGcTimeout(),this.cache.notify({type:"observerAdded",query:this,observer:dt}))}removeObserver(dt){this.observers.includes(dt)&&(this.observers=this.observers.filter(ft=>ft!==dt),this.observers.length||(this.retryer&&(this.abortSignalConsumed?this.retryer.cancel({revert:!0}):this.retryer.cancelRetry()),this.scheduleGc()),this.cache.notify({type:"observerRemoved",query:this,observer:dt}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.dispatch({type:"invalidate"})}fetch(dt,ft){var vt,Et;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&ft!=null&&ft.cancelRefetch)this.cancel({silent:!0});else if(this.promise){var Rt;return(Rt=this.retryer)==null||Rt.continueRetry(),this.promise}}if(dt&&this.setOptions(dt),!this.options.queryFn){const Dt=this.observers.find(Ut=>Ut.options.queryFn);Dt&&this.setOptions(Dt.options)}Array.isArray(this.options.queryKey);const St=getAbortController(),At={queryKey:this.queryKey,pageParam:void 0,meta:this.meta},Ct=Dt=>{Object.defineProperty(Dt,"signal",{enumerable:!0,get:()=>{if(St)return this.abortSignalConsumed=!0,St.signal}})};Ct(At);const kt=()=>this.options.queryFn?(this.abortSignalConsumed=!1,this.options.queryFn(At)):Promise.reject("Missing queryFn"),Tt={fetchOptions:ft,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:kt};if(Ct(Tt),(vt=this.options.behavior)==null||vt.onFetch(Tt),this.revertState=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==((Et=Tt.fetchOptions)==null?void 0:Et.meta)){var Nt;this.dispatch({type:"fetch",meta:(Nt=Tt.fetchOptions)==null?void 0:Nt.meta})}const Ft=Dt=>{if(isCancelledError(Dt)&&Dt.silent||this.dispatch({type:"error",error:Dt}),!isCancelledError(Dt)){var Ut,zt,Zt,Ht;(Ut=(zt=this.cache.config).onError)==null||Ut.call(zt,Dt,this),(Zt=(Ht=this.cache.config).onSettled)==null||Zt.call(Ht,this.state.data,Dt,this)}this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.retryer=createRetryer({fn:Tt.fetchFn,abort:St==null?void 0:St.abort.bind(St),onSuccess:Dt=>{var Ut,zt,Zt,Ht;if(typeof Dt>"u"){Ft(new Error(this.queryHash+" data is undefined"));return}this.setData(Dt),(Ut=(zt=this.cache.config).onSuccess)==null||Ut.call(zt,Dt,this),(Zt=(Ht=this.cache.config).onSettled)==null||Zt.call(Ht,Dt,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:Ft,onFail:(Dt,Ut)=>{this.dispatch({type:"failed",failureCount:Dt,error:Ut})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:Tt.options.retry,retryDelay:Tt.options.retryDelay,networkMode:Tt.options.networkMode}),this.promise=this.retryer.promise,this.promise}dispatch(dt){const ft=vt=>{var Et,Rt;switch(dt.type){case"failed":return{...vt,fetchFailureCount:dt.failureCount,fetchFailureReason:dt.error};case"pause":return{...vt,fetchStatus:"paused"};case"continue":return{...vt,fetchStatus:"fetching"};case"fetch":return{...vt,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:(Et=dt.meta)!=null?Et:null,fetchStatus:canFetch(this.options.networkMode)?"fetching":"paused",...!vt.dataUpdatedAt&&{error:null,status:"loading"}};case"success":return{...vt,data:dt.data,dataUpdateCount:vt.dataUpdateCount+1,dataUpdatedAt:(Rt=dt.dataUpdatedAt)!=null?Rt:Date.now(),error:null,isInvalidated:!1,status:"success",...!dt.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const St=dt.error;return isCancelledError(St)&&St.revert&&this.revertState?{...this.revertState}:{...vt,error:St,errorUpdateCount:vt.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:vt.fetchFailureCount+1,fetchFailureReason:St,fetchStatus:"idle",status:"error"};case"invalidate":return{...vt,isInvalidated:!0};case"setState":return{...vt,...dt.state}}};this.state=ft(this.state),notifyManager.batch(()=>{this.observers.forEach(vt=>{vt.onQueryUpdate(dt)}),this.cache.notify({query:this,type:"updated",action:dt})})}}function getDefaultState$1(lt){const dt=typeof lt.initialData=="function"?lt.initialData():lt.initialData,ft=typeof dt<"u",vt=ft?typeof lt.initialDataUpdatedAt=="function"?lt.initialDataUpdatedAt():lt.initialDataUpdatedAt:0;return{data:dt,dataUpdateCount:0,dataUpdatedAt:ft?vt??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:ft?"success":"loading",fetchStatus:"idle"}}class QueryCache extends Subscribable{constructor(dt){super(),this.config=dt||{},this.queries=[],this.queriesMap={}}build(dt,ft,vt){var Et;const Rt=ft.queryKey,St=(Et=ft.queryHash)!=null?Et:hashQueryKeyByOptions(Rt,ft);let At=this.get(St);return At||(At=new Query({cache:this,logger:dt.getLogger(),queryKey:Rt,queryHash:St,options:dt.defaultQueryOptions(ft),state:vt,defaultOptions:dt.getQueryDefaults(Rt)}),this.add(At)),At}add(dt){this.queriesMap[dt.queryHash]||(this.queriesMap[dt.queryHash]=dt,this.queries.push(dt),this.notify({type:"added",query:dt}))}remove(dt){const ft=this.queriesMap[dt.queryHash];ft&&(dt.destroy(),this.queries=this.queries.filter(vt=>vt!==dt),ft===dt&&delete this.queriesMap[dt.queryHash],this.notify({type:"removed",query:dt}))}clear(){notifyManager.batch(()=>{this.queries.forEach(dt=>{this.remove(dt)})})}get(dt){return this.queriesMap[dt]}getAll(){return this.queries}find(dt,ft){const[vt]=parseFilterArgs(dt,ft);return typeof vt.exact>"u"&&(vt.exact=!0),this.queries.find(Et=>matchQuery(vt,Et))}findAll(dt,ft){const[vt]=parseFilterArgs(dt,ft);return Object.keys(vt).length>0?this.queries.filter(Et=>matchQuery(vt,Et)):this.queries}notify(dt){notifyManager.batch(()=>{this.listeners.forEach(({listener:ft})=>{ft(dt)})})}onFocus(){notifyManager.batch(()=>{this.queries.forEach(dt=>{dt.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.queries.forEach(dt=>{dt.onOnline()})})}}class Mutation extends Removable{constructor(dt){super(),this.defaultOptions=dt.defaultOptions,this.mutationId=dt.mutationId,this.mutationCache=dt.mutationCache,this.logger=dt.logger||defaultLogger,this.observers=[],this.state=dt.state||getDefaultState(),this.setOptions(dt.options),this.scheduleGc()}setOptions(dt){this.options={...this.defaultOptions,...dt},this.updateCacheTime(this.options.cacheTime)}get meta(){return this.options.meta}setState(dt){this.dispatch({type:"setState",state:dt})}addObserver(dt){this.observers.includes(dt)||(this.observers.push(dt),this.clearGcTimeout(),this.mutationCache.notify({type:"observerAdded",mutation:this,observer:dt}))}removeObserver(dt){this.observers=this.observers.filter(ft=>ft!==dt),this.scheduleGc(),this.mutationCache.notify({type:"observerRemoved",mutation:this,observer:dt})}optionalRemove(){this.observers.length||(this.state.status==="loading"?this.scheduleGc():this.mutationCache.remove(this))}continue(){var dt,ft;return(dt=(ft=this.retryer)==null?void 0:ft.continue())!=null?dt:this.execute()}async execute(){const dt=()=>{var ur;return this.retryer=createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(this.state.variables):Promise.reject("No mutationFn found"),onFail:(sr,mr)=>{this.dispatch({type:"failed",failureCount:sr,error:mr})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:(ur=this.options.retry)!=null?ur:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.retryer.promise},ft=this.state.status==="loading";try{var vt,Et,Rt,St,At,Ct,kt,Tt;if(!ft){var Nt,Ft,Dt,Ut;this.dispatch({type:"loading",variables:this.options.variables}),await((Nt=(Ft=this.mutationCache.config).onMutate)==null?void 0:Nt.call(Ft,this.state.variables,this));const sr=await((Dt=(Ut=this.options).onMutate)==null?void 0:Dt.call(Ut,this.state.variables));sr!==this.state.context&&this.dispatch({type:"loading",context:sr,variables:this.state.variables})}const ur=await dt();return await((vt=(Et=this.mutationCache.config).onSuccess)==null?void 0:vt.call(Et,ur,this.state.variables,this.state.context,this)),await((Rt=(St=this.options).onSuccess)==null?void 0:Rt.call(St,ur,this.state.variables,this.state.context)),await((At=(Ct=this.mutationCache.config).onSettled)==null?void 0:At.call(Ct,ur,null,this.state.variables,this.state.context,this)),await((kt=(Tt=this.options).onSettled)==null?void 0:kt.call(Tt,ur,null,this.state.variables,this.state.context)),this.dispatch({type:"success",data:ur}),ur}catch(ur){try{var zt,Zt,Ht,Bt,Wt,Kt,ar,rr;throw await((zt=(Zt=this.mutationCache.config).onError)==null?void 0:zt.call(Zt,ur,this.state.variables,this.state.context,this)),await((Ht=(Bt=this.options).onError)==null?void 0:Ht.call(Bt,ur,this.state.variables,this.state.context)),await((Wt=(Kt=this.mutationCache.config).onSettled)==null?void 0:Wt.call(Kt,void 0,ur,this.state.variables,this.state.context,this)),await((ar=(rr=this.options).onSettled)==null?void 0:ar.call(rr,void 0,ur,this.state.variables,this.state.context)),ur}finally{this.dispatch({type:"error",error:ur})}}}dispatch(dt){const ft=vt=>{switch(dt.type){case"failed":return{...vt,failureCount:dt.failureCount,failureReason:dt.error};case"pause":return{...vt,isPaused:!0};case"continue":return{...vt,isPaused:!1};case"loading":return{...vt,context:dt.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!canFetch(this.options.networkMode),status:"loading",variables:dt.variables};case"success":return{...vt,data:dt.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...vt,data:void 0,error:dt.error,failureCount:vt.failureCount+1,failureReason:dt.error,isPaused:!1,status:"error"};case"setState":return{...vt,...dt.state}}};this.state=ft(this.state),notifyManager.batch(()=>{this.observers.forEach(vt=>{vt.onMutationUpdate(dt)}),this.mutationCache.notify({mutation:this,type:"updated",action:dt})})}}function getDefaultState(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0}}class MutationCache extends Subscribable{constructor(dt){super(),this.config=dt||{},this.mutations=[],this.mutationId=0}build(dt,ft,vt){const Et=new Mutation({mutationCache:this,logger:dt.getLogger(),mutationId:++this.mutationId,options:dt.defaultMutationOptions(ft),state:vt,defaultOptions:ft.mutationKey?dt.getMutationDefaults(ft.mutationKey):void 0});return this.add(Et),Et}add(dt){this.mutations.push(dt),this.notify({type:"added",mutation:dt})}remove(dt){this.mutations=this.mutations.filter(ft=>ft!==dt),this.notify({type:"removed",mutation:dt})}clear(){notifyManager.batch(()=>{this.mutations.forEach(dt=>{this.remove(dt)})})}getAll(){return this.mutations}find(dt){return typeof dt.exact>"u"&&(dt.exact=!0),this.mutations.find(ft=>matchMutation(dt,ft))}findAll(dt){return this.mutations.filter(ft=>matchMutation(dt,ft))}notify(dt){notifyManager.batch(()=>{this.listeners.forEach(({listener:ft})=>{ft(dt)})})}resumePausedMutations(){var dt;return this.resuming=((dt=this.resuming)!=null?dt:Promise.resolve()).then(()=>{const ft=this.mutations.filter(vt=>vt.state.isPaused);return notifyManager.batch(()=>ft.reduce((vt,Et)=>vt.then(()=>Et.continue().catch(noop$1)),Promise.resolve()))}).then(()=>{this.resuming=void 0}),this.resuming}}function infiniteQueryBehavior(){return{onFetch:lt=>{lt.fetchFn=()=>{var dt,ft,vt,Et,Rt,St;const At=(dt=lt.fetchOptions)==null||(ft=dt.meta)==null?void 0:ft.refetchPage,Ct=(vt=lt.fetchOptions)==null||(Et=vt.meta)==null?void 0:Et.fetchMore,kt=Ct==null?void 0:Ct.pageParam,Tt=(Ct==null?void 0:Ct.direction)==="forward",Nt=(Ct==null?void 0:Ct.direction)==="backward",Ft=((Rt=lt.state.data)==null?void 0:Rt.pages)||[],Dt=((St=lt.state.data)==null?void 0:St.pageParams)||[];let Ut=Dt,zt=!1;const Zt=rr=>{Object.defineProperty(rr,"signal",{enumerable:!0,get:()=>{var ur;if((ur=lt.signal)!=null&&ur.aborted)zt=!0;else{var sr;(sr=lt.signal)==null||sr.addEventListener("abort",()=>{zt=!0})}return lt.signal}})},Ht=lt.options.queryFn||(()=>Promise.reject("Missing queryFn")),Bt=(rr,ur,sr,mr)=>(Ut=mr?[ur,...Ut]:[...Ut,ur],mr?[sr,...rr]:[...rr,sr]),Wt=(rr,ur,sr,mr)=>{if(zt)return Promise.reject("Cancelled");if(typeof sr>"u"&&!ur&&rr.length)return Promise.resolve(rr);const dr={queryKey:lt.queryKey,pageParam:sr,meta:lt.options.meta};Zt(dr);const Sr=Ht(dr);return Promise.resolve(Sr).then(xr=>Bt(rr,sr,xr,mr))};let Kt;if(!Ft.length)Kt=Wt([]);else if(Tt){const rr=typeof kt<"u",ur=rr?kt:getNextPageParam(lt.options,Ft);Kt=Wt(Ft,rr,ur)}else if(Nt){const rr=typeof kt<"u",ur=rr?kt:getPreviousPageParam(lt.options,Ft);Kt=Wt(Ft,rr,ur,!0)}else{Ut=[];const rr=typeof lt.options.getNextPageParam>"u";Kt=(At&&Ft[0]?At(Ft[0],0,Ft):!0)?Wt([],rr,Dt[0]):Promise.resolve(Bt([],Dt[0],Ft[0]));for(let sr=1;sr<Ft.length;sr++)Kt=Kt.then(mr=>{if(At&&Ft[sr]?At(Ft[sr],sr,Ft):!0){const Sr=rr?Dt[sr]:getNextPageParam(lt.options,mr);return Wt(mr,rr,Sr)}return Promise.resolve(Bt(mr,Dt[sr],Ft[sr]))})}return Kt.then(rr=>({pages:rr,pageParams:Ut}))}}}}function getNextPageParam(lt,dt){return lt.getNextPageParam==null?void 0:lt.getNextPageParam(dt[dt.length-1],dt)}function getPreviousPageParam(lt,dt){return lt.getPreviousPageParam==null?void 0:lt.getPreviousPageParam(dt[0],dt)}function hasNextPage(lt,dt){if(lt.getNextPageParam&&Array.isArray(dt)){const ft=getNextPageParam(lt,dt);return typeof ft<"u"&&ft!==null&&ft!==!1}}function hasPreviousPage(lt,dt){if(lt.getPreviousPageParam&&Array.isArray(dt)){const ft=getPreviousPageParam(lt,dt);return typeof ft<"u"&&ft!==null&&ft!==!1}}class QueryClient{constructor(dt={}){this.queryCache=dt.queryCache||new QueryCache,this.mutationCache=dt.mutationCache||new MutationCache,this.logger=dt.logger||defaultLogger,this.defaultOptions=dt.defaultOptions||{},this.queryDefaults=[],this.mutationDefaults=[],this.mountCount=0}mount(){this.mountCount++,this.mountCount===1&&(this.unsubscribeFocus=focusManager.subscribe(()=>{focusManager.isFocused()&&(this.resumePausedMutations(),this.queryCache.onFocus())}),this.unsubscribeOnline=onlineManager.subscribe(()=>{onlineManager.isOnline()&&(this.resumePausedMutations(),this.queryCache.onOnline())}))}unmount(){var dt,ft;this.mountCount--,this.mountCount===0&&((dt=this.unsubscribeFocus)==null||dt.call(this),this.unsubscribeFocus=void 0,(ft=this.unsubscribeOnline)==null||ft.call(this),this.unsubscribeOnline=void 0)}isFetching(dt,ft){const[vt]=parseFilterArgs(dt,ft);return vt.fetchStatus="fetching",this.queryCache.findAll(vt).length}isMutating(dt){return this.mutationCache.findAll({...dt,fetching:!0}).length}getQueryData(dt,ft){var vt;return(vt=this.queryCache.find(dt,ft))==null?void 0:vt.state.data}ensureQueryData(dt,ft,vt){const Et=parseQueryArgs(dt,ft,vt),Rt=this.getQueryData(Et.queryKey);return Rt?Promise.resolve(Rt):this.fetchQuery(Et)}getQueriesData(dt){return this.getQueryCache().findAll(dt).map(({queryKey:ft,state:vt})=>{const Et=vt.data;return[ft,Et]})}setQueryData(dt,ft,vt){const Et=this.queryCache.find(dt),Rt=Et==null?void 0:Et.state.data,St=functionalUpdate(ft,Rt);if(typeof St>"u")return;const At=parseQueryArgs(dt),Ct=this.defaultQueryOptions(At);return this.queryCache.build(this,Ct).setData(St,{...vt,manual:!0})}setQueriesData(dt,ft,vt){return notifyManager.batch(()=>this.getQueryCache().findAll(dt).map(({queryKey:Et})=>[Et,this.setQueryData(Et,ft,vt)]))}getQueryState(dt,ft){var vt;return(vt=this.queryCache.find(dt,ft))==null?void 0:vt.state}removeQueries(dt,ft){const[vt]=parseFilterArgs(dt,ft),Et=this.queryCache;notifyManager.batch(()=>{Et.findAll(vt).forEach(Rt=>{Et.remove(Rt)})})}resetQueries(dt,ft,vt){const[Et,Rt]=parseFilterArgs(dt,ft,vt),St=this.queryCache,At={type:"active",...Et};return notifyManager.batch(()=>(St.findAll(Et).forEach(Ct=>{Ct.reset()}),this.refetchQueries(At,Rt)))}cancelQueries(dt,ft,vt){const[Et,Rt={}]=parseFilterArgs(dt,ft,vt);typeof Rt.revert>"u"&&(Rt.revert=!0);const St=notifyManager.batch(()=>this.queryCache.findAll(Et).map(At=>At.cancel(Rt)));return Promise.all(St).then(noop$1).catch(noop$1)}invalidateQueries(dt,ft,vt){const[Et,Rt]=parseFilterArgs(dt,ft,vt);return notifyManager.batch(()=>{var St,At;if(this.queryCache.findAll(Et).forEach(kt=>{kt.invalidate()}),Et.refetchType==="none")return Promise.resolve();const Ct={...Et,type:(St=(At=Et.refetchType)!=null?At:Et.type)!=null?St:"active"};return this.refetchQueries(Ct,Rt)})}refetchQueries(dt,ft,vt){const[Et,Rt]=parseFilterArgs(dt,ft,vt),St=notifyManager.batch(()=>this.queryCache.findAll(Et).filter(Ct=>!Ct.isDisabled()).map(Ct=>{var kt;return Ct.fetch(void 0,{...Rt,cancelRefetch:(kt=Rt==null?void 0:Rt.cancelRefetch)!=null?kt:!0,meta:{refetchPage:Et.refetchPage}})}));let At=Promise.all(St).then(noop$1);return Rt!=null&&Rt.throwOnError||(At=At.catch(noop$1)),At}fetchQuery(dt,ft,vt){const Et=parseQueryArgs(dt,ft,vt),Rt=this.defaultQueryOptions(Et);typeof Rt.retry>"u"&&(Rt.retry=!1);const St=this.queryCache.build(this,Rt);return St.isStaleByTime(Rt.staleTime)?St.fetch(Rt):Promise.resolve(St.state.data)}prefetchQuery(dt,ft,vt){return this.fetchQuery(dt,ft,vt).then(noop$1).catch(noop$1)}fetchInfiniteQuery(dt,ft,vt){const Et=parseQueryArgs(dt,ft,vt);return Et.behavior=infiniteQueryBehavior(),this.fetchQuery(Et)}prefetchInfiniteQuery(dt,ft,vt){return this.fetchInfiniteQuery(dt,ft,vt).then(noop$1).catch(noop$1)}resumePausedMutations(){return this.mutationCache.resumePausedMutations()}getQueryCache(){return this.queryCache}getMutationCache(){return this.mutationCache}getLogger(){return this.logger}getDefaultOptions(){return this.defaultOptions}setDefaultOptions(dt){this.defaultOptions=dt}setQueryDefaults(dt,ft){const vt=this.queryDefaults.find(Et=>hashQueryKey(dt)===hashQueryKey(Et.queryKey));vt?vt.defaultOptions=ft:this.queryDefaults.push({queryKey:dt,defaultOptions:ft})}getQueryDefaults(dt){if(!dt)return;const ft=this.queryDefaults.find(vt=>partialMatchKey(dt,vt.queryKey));return ft==null?void 0:ft.defaultOptions}setMutationDefaults(dt,ft){const vt=this.mutationDefaults.find(Et=>hashQueryKey(dt)===hashQueryKey(Et.mutationKey));vt?vt.defaultOptions=ft:this.mutationDefaults.push({mutationKey:dt,defaultOptions:ft})}getMutationDefaults(dt){if(!dt)return;const ft=this.mutationDefaults.find(vt=>partialMatchKey(dt,vt.mutationKey));return ft==null?void 0:ft.defaultOptions}defaultQueryOptions(dt){if(dt!=null&&dt._defaulted)return dt;const ft={...this.defaultOptions.queries,...this.getQueryDefaults(dt==null?void 0:dt.queryKey),...dt,_defaulted:!0};return!ft.queryHash&&ft.queryKey&&(ft.queryHash=hashQueryKeyByOptions(ft.queryKey,ft)),typeof ft.refetchOnReconnect>"u"&&(ft.refetchOnReconnect=ft.networkMode!=="always"),typeof ft.useErrorBoundary>"u"&&(ft.useErrorBoundary=!!ft.suspense),ft}defaultMutationOptions(dt){return dt!=null&&dt._defaulted?dt:{...this.defaultOptions.mutations,...this.getMutationDefaults(dt==null?void 0:dt.mutationKey),...dt,_defaulted:!0}}clear(){this.queryCache.clear(),this.mutationCache.clear()}}class QueryObserver extends Subscribable{constructor(dt,ft){super(),this.client=dt,this.options=ft,this.trackedProps=new Set,this.selectError=null,this.bindMethods(),this.setOptions(ft)}bindMethods(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.currentQuery.addObserver(this),shouldFetchOnMount(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(this.currentQuery,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(this.currentQuery,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.clearStaleTimeout(),this.clearRefetchInterval(),this.currentQuery.removeObserver(this)}setOptions(dt,ft){const vt=this.options,Et=this.currentQuery;if(this.options=this.client.defaultQueryOptions(dt),shallowEqualObjects(vt,this.options)||this.client.getQueryCache().notify({type:"observerOptionsUpdated",query:this.currentQuery,observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=vt.queryKey),this.updateQuery();const Rt=this.hasListeners();Rt&&shouldFetchOptionally(this.currentQuery,Et,this.options,vt)&&this.executeFetch(),this.updateResult(ft),Rt&&(this.currentQuery!==Et||this.options.enabled!==vt.enabled||this.options.staleTime!==vt.staleTime)&&this.updateStaleTimeout();const St=this.computeRefetchInterval();Rt&&(this.currentQuery!==Et||this.options.enabled!==vt.enabled||St!==this.currentRefetchInterval)&&this.updateRefetchInterval(St)}getOptimisticResult(dt){const ft=this.client.getQueryCache().build(this.client,dt);return this.createResult(ft,dt)}getCurrentResult(){return this.currentResult}trackResult(dt){const ft={};return Object.keys(dt).forEach(vt=>{Object.defineProperty(ft,vt,{configurable:!1,enumerable:!0,get:()=>(this.trackedProps.add(vt),dt[vt])})}),ft}getCurrentQuery(){return this.currentQuery}remove(){this.client.getQueryCache().remove(this.currentQuery)}refetch({refetchPage:dt,...ft}={}){return this.fetch({...ft,meta:{refetchPage:dt}})}fetchOptimistic(dt){const ft=this.client.defaultQueryOptions(dt),vt=this.client.getQueryCache().build(this.client,ft);return vt.isFetchingOptimistic=!0,vt.fetch().then(()=>this.createResult(vt,ft))}fetch(dt){var ft;return this.executeFetch({...dt,cancelRefetch:(ft=dt.cancelRefetch)!=null?ft:!0}).then(()=>(this.updateResult(),this.currentResult))}executeFetch(dt){this.updateQuery();let ft=this.currentQuery.fetch(this.options,dt);return dt!=null&&dt.throwOnError||(ft=ft.catch(noop$1)),ft}updateStaleTimeout(){if(this.clearStaleTimeout(),isServer||this.currentResult.isStale||!isValidTimeout(this.options.staleTime))return;const ft=timeUntilStale(this.currentResult.dataUpdatedAt,this.options.staleTime)+1;this.staleTimeoutId=setTimeout(()=>{this.currentResult.isStale||this.updateResult()},ft)}computeRefetchInterval(){var dt;return typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.currentResult.data,this.currentQuery):(dt=this.options.refetchInterval)!=null?dt:!1}updateRefetchInterval(dt){this.clearRefetchInterval(),this.currentRefetchInterval=dt,!(isServer||this.options.enabled===!1||!isValidTimeout(this.currentRefetchInterval)||this.currentRefetchInterval===0)&&(this.refetchIntervalId=setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&this.executeFetch()},this.currentRefetchInterval))}updateTimers(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())}clearStaleTimeout(){this.staleTimeoutId&&(clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0)}clearRefetchInterval(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)}createResult(dt,ft){const vt=this.currentQuery,Et=this.options,Rt=this.currentResult,St=this.currentResultState,At=this.currentResultOptions,Ct=dt!==vt,kt=Ct?dt.state:this.currentQueryInitialState,Tt=Ct?this.currentResult:this.previousQueryResult,{state:Nt}=dt;let{dataUpdatedAt:Ft,error:Dt,errorUpdatedAt:Ut,fetchStatus:zt,status:Zt}=Nt,Ht=!1,Bt=!1,Wt;if(ft._optimisticResults){const sr=this.hasListeners(),mr=!sr&&shouldFetchOnMount(dt,ft),dr=sr&&shouldFetchOptionally(dt,vt,ft,Et);(mr||dr)&&(zt=canFetch(dt.options.networkMode)?"fetching":"paused",Ft||(Zt="loading")),ft._optimisticResults==="isRestoring"&&(zt="idle")}if(ft.keepPreviousData&&!Nt.dataUpdatedAt&&Tt!=null&&Tt.isSuccess&&Zt!=="error")Wt=Tt.data,Ft=Tt.dataUpdatedAt,Zt=Tt.status,Ht=!0;else if(ft.select&&typeof Nt.data<"u")if(Rt&&Nt.data===(St==null?void 0:St.data)&&ft.select===this.selectFn)Wt=this.selectResult;else try{this.selectFn=ft.select,Wt=ft.select(Nt.data),Wt=replaceData(Rt==null?void 0:Rt.data,Wt,ft),this.selectResult=Wt,this.selectError=null}catch(sr){this.selectError=sr}else Wt=Nt.data;if(typeof ft.placeholderData<"u"&&typeof Wt>"u"&&Zt==="loading"){let sr;if(Rt!=null&&Rt.isPlaceholderData&&ft.placeholderData===(At==null?void 0:At.placeholderData))sr=Rt.data;else if(sr=typeof ft.placeholderData=="function"?ft.placeholderData():ft.placeholderData,ft.select&&typeof sr<"u")try{sr=ft.select(sr),this.selectError=null}catch(mr){this.selectError=mr}typeof sr<"u"&&(Zt="success",Wt=replaceData(Rt==null?void 0:Rt.data,sr,ft),Bt=!0)}this.selectError&&(Dt=this.selectError,Wt=this.selectResult,Ut=Date.now(),Zt="error");const Kt=zt==="fetching",ar=Zt==="loading",rr=Zt==="error";return{status:Zt,fetchStatus:zt,isLoading:ar,isSuccess:Zt==="success",isError:rr,isInitialLoading:ar&&Kt,data:Wt,dataUpdatedAt:Ft,error:Dt,errorUpdatedAt:Ut,failureCount:Nt.fetchFailureCount,failureReason:Nt.fetchFailureReason,errorUpdateCount:Nt.errorUpdateCount,isFetched:Nt.dataUpdateCount>0||Nt.errorUpdateCount>0,isFetchedAfterMount:Nt.dataUpdateCount>kt.dataUpdateCount||Nt.errorUpdateCount>kt.errorUpdateCount,isFetching:Kt,isRefetching:Kt&&!ar,isLoadingError:rr&&Nt.dataUpdatedAt===0,isPaused:zt==="paused",isPlaceholderData:Bt,isPreviousData:Ht,isRefetchError:rr&&Nt.dataUpdatedAt!==0,isStale:isStale(dt,ft),refetch:this.refetch,remove:this.remove}}updateResult(dt){const ft=this.currentResult,vt=this.createResult(this.currentQuery,this.options);if(this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,shallowEqualObjects(vt,ft))return;this.currentResult=vt;const Et={cache:!0},Rt=()=>{if(!ft)return!0;const{notifyOnChangeProps:St}=this.options;if(St==="all"||!St&&!this.trackedProps.size)return!0;const At=new Set(St??this.trackedProps);return this.options.useErrorBoundary&&At.add("error"),Object.keys(this.currentResult).some(Ct=>{const kt=Ct;return this.currentResult[kt]!==ft[kt]&&At.has(kt)})};(dt==null?void 0:dt.listeners)!==!1&&Rt()&&(Et.listeners=!0),this.notify({...Et,...dt})}updateQuery(){const dt=this.client.getQueryCache().build(this.client,this.options);if(dt===this.currentQuery)return;const ft=this.currentQuery;this.currentQuery=dt,this.currentQueryInitialState=dt.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(ft==null||ft.removeObserver(this),dt.addObserver(this))}onQueryUpdate(dt){const ft={};dt.type==="success"?ft.onSuccess=!dt.manual:dt.type==="error"&&!isCancelledError(dt.error)&&(ft.onError=!0),this.updateResult(ft),this.hasListeners()&&this.updateTimers()}notify(dt){notifyManager.batch(()=>{if(dt.onSuccess){var ft,vt,Et,Rt;(ft=(vt=this.options).onSuccess)==null||ft.call(vt,this.currentResult.data),(Et=(Rt=this.options).onSettled)==null||Et.call(Rt,this.currentResult.data,null)}else if(dt.onError){var St,At,Ct,kt;(St=(At=this.options).onError)==null||St.call(At,this.currentResult.error),(Ct=(kt=this.options).onSettled)==null||Ct.call(kt,void 0,this.currentResult.error)}dt.listeners&&this.listeners.forEach(({listener:Tt})=>{Tt(this.currentResult)}),dt.cache&&this.client.getQueryCache().notify({query:this.currentQuery,type:"observerResultsUpdated"})})}}function shouldLoadOnMount(lt,dt){return dt.enabled!==!1&&!lt.state.dataUpdatedAt&&!(lt.state.status==="error"&&dt.retryOnMount===!1)}function shouldFetchOnMount(lt,dt){return shouldLoadOnMount(lt,dt)||lt.state.dataUpdatedAt>0&&shouldFetchOn(lt,dt,dt.refetchOnMount)}function shouldFetchOn(lt,dt,ft){if(dt.enabled!==!1){const vt=typeof ft=="function"?ft(lt):ft;return vt==="always"||vt!==!1&&isStale(lt,dt)}return!1}function shouldFetchOptionally(lt,dt,ft,vt){return ft.enabled!==!1&&(lt!==dt||vt.enabled===!1)&&(!ft.suspense||lt.state.status!=="error")&&isStale(lt,ft)}function isStale(lt,dt){return lt.isStaleByTime(dt.staleTime)}class InfiniteQueryObserver extends QueryObserver{constructor(dt,ft){super(dt,ft)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(dt,ft){super.setOptions({...dt,behavior:infiniteQueryBehavior()},ft)}getOptimisticResult(dt){return dt.behavior=infiniteQueryBehavior(),super.getOptimisticResult(dt)}fetchNextPage({pageParam:dt,...ft}={}){return this.fetch({...ft,meta:{fetchMore:{direction:"forward",pageParam:dt}}})}fetchPreviousPage({pageParam:dt,...ft}={}){return this.fetch({...ft,meta:{fetchMore:{direction:"backward",pageParam:dt}}})}createResult(dt,ft){var vt,Et,Rt,St,At,Ct;const{state:kt}=dt,Tt=super.createResult(dt,ft),{isFetching:Nt,isRefetching:Ft}=Tt,Dt=Nt&&((vt=kt.fetchMeta)==null||(Et=vt.fetchMore)==null?void 0:Et.direction)==="forward",Ut=Nt&&((Rt=kt.fetchMeta)==null||(St=Rt.fetchMore)==null?void 0:St.direction)==="backward";return{...Tt,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:hasNextPage(ft,(At=kt.data)==null?void 0:At.pages),hasPreviousPage:hasPreviousPage(ft,(Ct=kt.data)==null?void 0:Ct.pages),isFetchingNextPage:Dt,isFetchingPreviousPage:Ut,isRefetching:Ft&&!Dt&&!Ut}}}let MutationObserver$1=class extends Subscribable{constructor(dt,ft){super(),this.client=dt,this.setOptions(ft),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(dt){var ft;const vt=this.options;this.options=this.client.defaultMutationOptions(dt),shallowEqualObjects(vt,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),(ft=this.currentMutation)==null||ft.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners()){var dt;(dt=this.currentMutation)==null||dt.removeObserver(this)}}onMutationUpdate(dt){this.updateResult();const ft={listeners:!0};dt.type==="success"?ft.onSuccess=!0:dt.type==="error"&&(ft.onError=!0),this.notify(ft)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(dt,ft){return this.mutateOptions=ft,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,{...this.options,variables:typeof dt<"u"?dt:this.options.variables}),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){const dt=this.currentMutation?this.currentMutation.state:getDefaultState(),ft={...dt,isLoading:dt.status==="loading",isSuccess:dt.status==="success",isError:dt.status==="error",isIdle:dt.status==="idle",mutate:this.mutate,reset:this.reset};this.currentResult=ft}notify(dt){notifyManager.batch(()=>{if(this.mutateOptions&&this.hasListeners()){if(dt.onSuccess){var ft,vt,Et,Rt;(ft=(vt=this.mutateOptions).onSuccess)==null||ft.call(vt,this.currentResult.data,this.currentResult.variables,this.currentResult.context),(Et=(Rt=this.mutateOptions).onSettled)==null||Et.call(Rt,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)}else if(dt.onError){var St,At,Ct,kt;(St=(At=this.mutateOptions).onError)==null||St.call(At,this.currentResult.error,this.currentResult.variables,this.currentResult.context),(Ct=(kt=this.mutateOptions).onSettled)==null||Ct.call(kt,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context)}}dt.listeners&&this.listeners.forEach(({listener:Tt})=>{Tt(this.currentResult)})})}};var reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/**
41
+ `),function(At){if(St=At.indexOf(":"),Et=lt.trim(At.substr(0,St)).toLowerCase(),Rt=lt.trim(At.substr(St+1)),Et){if(vt[Et]&&dt.indexOf(Et)>=0)return;Et==="set-cookie"?vt[Et]=(vt[Et]?vt[Et]:[]).concat([Rt]):vt[Et]=vt[Et]?vt[Et]+", "+Rt:Rt}}),vt},parseHeaders}var isURLSameOrigin,hasRequiredIsURLSameOrigin;function requireIsURLSameOrigin(){if(hasRequiredIsURLSameOrigin)return isURLSameOrigin;hasRequiredIsURLSameOrigin=1;var lt=utils$9;return isURLSameOrigin=lt.isStandardBrowserEnv()?function(){var dt=/(msie|trident)/i.test(navigator.userAgent),ft=document.createElement("a"),vt;function Et(Rt){var St=Rt;return dt&&(ft.setAttribute("href",St),St=ft.href),ft.setAttribute("href",St),{href:ft.href,protocol:ft.protocol?ft.protocol.replace(/:$/,""):"",host:ft.host,search:ft.search?ft.search.replace(/^\?/,""):"",hash:ft.hash?ft.hash.replace(/^#/,""):"",hostname:ft.hostname,port:ft.port,pathname:ft.pathname.charAt(0)==="/"?ft.pathname:"/"+ft.pathname}}return vt=Et(window.location.href),function(Rt){var St=lt.isString(Rt)?Et(Rt):Rt;return St.protocol===vt.protocol&&St.host===vt.host}}():function(){return function(){return!0}}(),isURLSameOrigin}var xhr,hasRequiredXhr;function requireXhr(){if(hasRequiredXhr)return xhr;hasRequiredXhr=1;var lt=utils$9,dt=requireSettle(),ft=requireCookies(),vt=buildURL$1,Et=requireBuildFullPath(),Rt=requireParseHeaders(),St=requireIsURLSameOrigin(),At=requireCreateError();return xhr=function(Ct){return new Promise(function(kt,Tt){var Nt=Ct.data,Ft=Ct.headers;lt.isFormData(Nt)&&delete Ft["Content-Type"];var Dt=new XMLHttpRequest;if(Ct.auth){var Ut=Ct.auth.username||"",zt=Ct.auth.password?unescape(encodeURIComponent(Ct.auth.password)):"";Ft.Authorization="Basic "+btoa(Ut+":"+zt)}var Zt=Et(Ct.baseURL,Ct.url);if(Dt.open(Ct.method.toUpperCase(),vt(Zt,Ct.params,Ct.paramsSerializer),!0),Dt.timeout=Ct.timeout,Dt.onreadystatechange=function(){if(!(!Dt||Dt.readyState!==4)&&!(Dt.status===0&&!(Dt.responseURL&&Dt.responseURL.indexOf("file:")===0))){var Bt="getAllResponseHeaders"in Dt?Rt(Dt.getAllResponseHeaders()):null,Wt=!Ct.responseType||Ct.responseType==="text"?Dt.responseText:Dt.response,Kt={data:Wt,status:Dt.status,statusText:Dt.statusText,headers:Bt,config:Ct,request:Dt};dt(kt,Tt,Kt),Dt=null}},Dt.onabort=function(){!Dt||(Tt(At("Request aborted",Ct,"ECONNABORTED",Dt)),Dt=null)},Dt.onerror=function(){Tt(At("Network Error",Ct,null,Dt)),Dt=null},Dt.ontimeout=function(){var Bt="timeout of "+Ct.timeout+"ms exceeded";Ct.timeoutErrorMessage&&(Bt=Ct.timeoutErrorMessage),Tt(At(Bt,Ct,"ECONNABORTED",Dt)),Dt=null},lt.isStandardBrowserEnv()){var Ht=(Ct.withCredentials||St(Zt))&&Ct.xsrfCookieName?ft.read(Ct.xsrfCookieName):void 0;Ht&&(Ft[Ct.xsrfHeaderName]=Ht)}if("setRequestHeader"in Dt&&lt.forEach(Ft,function(Bt,Wt){typeof Nt>"u"&&Wt.toLowerCase()==="content-type"?delete Ft[Wt]:Dt.setRequestHeader(Wt,Bt)}),lt.isUndefined(Ct.withCredentials)||(Dt.withCredentials=!!Ct.withCredentials),Ct.responseType)try{Dt.responseType=Ct.responseType}catch(Bt){if(Ct.responseType!=="json")throw Bt}typeof Ct.onDownloadProgress=="function"&&Dt.addEventListener("progress",Ct.onDownloadProgress),typeof Ct.onUploadProgress=="function"&&Dt.upload&&Dt.upload.addEventListener("progress",Ct.onUploadProgress),Ct.cancelToken&&Ct.cancelToken.promise.then(function(Bt){!Dt||(Dt.abort(),Tt(Bt),Dt=null)}),Nt||(Nt=null),Dt.send(Nt)})},xhr}var utils$4=utils$9,normalizeHeaderName=normalizeHeaderName$1,DEFAULT_CONTENT_TYPE={"Content-Type":"application/x-www-form-urlencoded"};function setContentTypeIfUnset(lt,dt){!utils$4.isUndefined(lt)&&utils$4.isUndefined(lt["Content-Type"])&&(lt["Content-Type"]=dt)}function getDefaultAdapter(){var lt;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(lt=requireXhr()),lt}var defaults$2={adapter:getDefaultAdapter(),transformRequest:[function(lt,dt){return normalizeHeaderName(dt,"Accept"),normalizeHeaderName(dt,"Content-Type"),utils$4.isFormData(lt)||utils$4.isArrayBuffer(lt)||utils$4.isBuffer(lt)||utils$4.isStream(lt)||utils$4.isFile(lt)||utils$4.isBlob(lt)?lt:utils$4.isArrayBufferView(lt)?lt.buffer:utils$4.isURLSearchParams(lt)?(setContentTypeIfUnset(dt,"application/x-www-form-urlencoded;charset=utf-8"),lt.toString()):utils$4.isObject(lt)?(setContentTypeIfUnset(dt,"application/json;charset=utf-8"),JSON.stringify(lt)):lt}],transformResponse:[function(lt){if(typeof lt=="string")try{lt=JSON.parse(lt)}catch{}return lt}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(lt){return lt>=200&&lt<300}};defaults$2.headers={common:{Accept:"application/json, text/plain, */*"}};utils$4.forEach(["delete","get","head"],function(lt){defaults$2.headers[lt]={}});utils$4.forEach(["post","put","patch"],function(lt){defaults$2.headers[lt]=utils$4.merge(DEFAULT_CONTENT_TYPE)});var defaults_1=defaults$2,utils$3=utils$9,transformData=transformData$1,isCancel=requireIsCancel(),defaults$1=defaults_1;function throwIfCancellationRequested(lt){lt.cancelToken&&lt.cancelToken.throwIfRequested()}var dispatchRequest$1=function(lt){throwIfCancellationRequested(lt),lt.headers=lt.headers||{},lt.data=transformData(lt.data,lt.headers,lt.transformRequest),lt.headers=utils$3.merge(lt.headers.common||{},lt.headers[lt.method]||{},lt.headers),utils$3.forEach(["delete","get","head","post","put","patch","common"],function(ft){delete lt.headers[ft]});var dt=lt.adapter||defaults$1.adapter;return dt(lt).then(function(ft){return throwIfCancellationRequested(lt),ft.data=transformData(ft.data,ft.headers,lt.transformResponse),ft},function(ft){return isCancel(ft)||(throwIfCancellationRequested(lt),ft&&ft.response&&(ft.response.data=transformData(ft.response.data,ft.response.headers,lt.transformResponse))),Promise.reject(ft)})},utils$2=utils$9,mergeConfig$2=function(lt,dt){dt=dt||{};var ft={},vt=["url","method","data"],Et=["headers","auth","proxy","params"],Rt=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],St=["validateStatus"];function At(Nt,Ft){return utils$2.isPlainObject(Nt)&&utils$2.isPlainObject(Ft)?utils$2.merge(Nt,Ft):utils$2.isPlainObject(Ft)?utils$2.merge({},Ft):utils$2.isArray(Ft)?Ft.slice():Ft}function Ct(Nt){utils$2.isUndefined(dt[Nt])?utils$2.isUndefined(lt[Nt])||(ft[Nt]=At(void 0,lt[Nt])):ft[Nt]=At(lt[Nt],dt[Nt])}utils$2.forEach(vt,function(Nt){utils$2.isUndefined(dt[Nt])||(ft[Nt]=At(void 0,dt[Nt]))}),utils$2.forEach(Et,Ct),utils$2.forEach(Rt,function(Nt){utils$2.isUndefined(dt[Nt])?utils$2.isUndefined(lt[Nt])||(ft[Nt]=At(void 0,lt[Nt])):ft[Nt]=At(void 0,dt[Nt])}),utils$2.forEach(St,function(Nt){Nt in dt?ft[Nt]=At(lt[Nt],dt[Nt]):Nt in lt&&(ft[Nt]=At(void 0,lt[Nt]))});var kt=vt.concat(Et).concat(Rt).concat(St),Tt=Object.keys(lt).concat(Object.keys(dt)).filter(function(Nt){return kt.indexOf(Nt)===-1});return utils$2.forEach(Tt,Ct),ft},utils$1=utils$9,buildURL=buildURL$1,InterceptorManager=InterceptorManager_1,dispatchRequest=dispatchRequest$1,mergeConfig$1=mergeConfig$2;function Axios$1(lt){this.defaults=lt,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}Axios$1.prototype.request=function(lt){typeof lt=="string"?(lt=arguments[1]||{},lt.url=arguments[0]):lt=lt||{},lt=mergeConfig$1(this.defaults,lt),lt.method?lt.method=lt.method.toLowerCase():this.defaults.method?lt.method=this.defaults.method.toLowerCase():lt.method="get";var dt=[dispatchRequest,void 0],ft=Promise.resolve(lt);for(this.interceptors.request.forEach(function(vt){dt.unshift(vt.fulfilled,vt.rejected)}),this.interceptors.response.forEach(function(vt){dt.push(vt.fulfilled,vt.rejected)});dt.length;)ft=ft.then(dt.shift(),dt.shift());return ft};Axios$1.prototype.getUri=function(lt){return lt=mergeConfig$1(this.defaults,lt),buildURL(lt.url,lt.params,lt.paramsSerializer).replace(/^\?/,"")};utils$1.forEach(["delete","get","head","options"],function(lt){Axios$1.prototype[lt]=function(dt,ft){return this.request(mergeConfig$1(ft||{},{method:lt,url:dt,data:(ft||{}).data}))}});utils$1.forEach(["post","put","patch"],function(lt){Axios$1.prototype[lt]=function(dt,ft,vt){return this.request(mergeConfig$1(vt||{},{method:lt,url:dt,data:ft}))}});var Axios_1=Axios$1,Cancel_1,hasRequiredCancel;function requireCancel(){if(hasRequiredCancel)return Cancel_1;hasRequiredCancel=1;function lt(dt){this.message=dt}return lt.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},lt.prototype.__CANCEL__=!0,Cancel_1=lt,Cancel_1}var CancelToken_1,hasRequiredCancelToken;function requireCancelToken(){if(hasRequiredCancelToken)return CancelToken_1;hasRequiredCancelToken=1;var lt=requireCancel();function dt(ft){if(typeof ft!="function")throw new TypeError("executor must be a function.");var vt;this.promise=new Promise(function(Rt){vt=Rt});var Et=this;ft(function(Rt){Et.reason||(Et.reason=new lt(Rt),vt(Et.reason))})}return dt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},dt.source=function(){var ft,vt=new dt(function(Et){ft=Et});return{token:vt,cancel:ft}},CancelToken_1=dt,CancelToken_1}var spread,hasRequiredSpread;function requireSpread(){return hasRequiredSpread||(hasRequiredSpread=1,spread=function(lt){return function(dt){return lt.apply(null,dt)}}),spread}var isAxiosError,hasRequiredIsAxiosError;function requireIsAxiosError(){return hasRequiredIsAxiosError||(hasRequiredIsAxiosError=1,isAxiosError=function(lt){return typeof lt=="object"&&lt.isAxiosError===!0}),isAxiosError}var utils=utils$9,bind=bind$2,Axios=Axios_1,mergeConfig=mergeConfig$2,defaults=defaults_1;function createInstance(lt){var dt=new Axios(lt),ft=bind(Axios.prototype.request,dt);return utils.extend(ft,Axios.prototype,dt),utils.extend(ft,dt),ft}var axios$1=createInstance(defaults);axios$1.Axios=Axios;axios$1.create=function(lt){return createInstance(mergeConfig(axios$1.defaults,lt))};axios$1.Cancel=requireCancel();axios$1.CancelToken=requireCancelToken();axios$1.isCancel=requireIsCancel();axios$1.all=function(lt){return Promise.all(lt)};axios$1.spread=requireSpread();axios$1.isAxiosError=requireIsAxiosError();axios$2.exports=axios$1;axios$2.exports.default=axios$1;(function(lt){lt.exports=axios$2.exports})(axios$3);const axios=getDefaultExportFromCjs(axios$3.exports),loadedScripts$1={};class Http{constructor(dt){m$5(this,"axios"),m$5(this,"_latestResponse"),this.axios=axios.create(dt)}setCdn(dt){dt&&XMLHttpRequest&&!XMLHttpRequest.prototype.cdnUrl&&(XMLHttpRequest.prototype.cdnUrl=dt,XMLHttpRequest.prototype.baseOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){const ft=arguments[1];return ft.startsWith("/infra/public")&&(arguments[1]=dt+ft),/^\/([^\/]*)\/public/.test(ft)&&(arguments[1]=dt+ft),ft.startsWith("/assets")&&(arguments[1]=dt+ft),ft=="/conf/public"&&(arguments[1]=ft),ft.startsWith("http")&&(arguments[1]=ft),this.baseOpen.apply(this,arguments)})}toAxiosConfig(dt){if(dt){const ft=Object.assign({},this.axios.defaults);return dt.headers&&(ft.headers&&(ft.headers=Object.assign({},this.axios.defaults.headers)),Object.assign(ft.headers,dt.headers)),dt.responseType&&(ft.responseType=dt.responseType),dt.queryParams&&(ft.params=Object.assign({},dt.queryParams)),ft}else return this.axios.defaults}toCdnUrl(dt){const ft=ConfigurationFrameworkFactory.instance().Platform.cdnDomain;if((ft==null?void 0:ft.length)>0&&dt!=="/conf/public"){const vt=""+dt;(vt.startsWith("/infra/public")||vt.startsWith("/assets")||/^\/([^\/]*)\/public/.test(vt))&&(dt=ft+vt)}return dt}mapAxiosError(dt,ft){return dt.response?this._latestResponse=dt.response:dt.request?this._latestResponse={status:408,statusText:ERROR_CODE.TIME_OUT}:this._latestResponse={status:500,statusText:ERROR_CODE.UNKNOWN},!ft||ft.disableNotifications,this._latestResponse}mapAxiosResponse(dt,ft){return this._latestResponse=dt,dt.data}get latestResponse(){return this._latestResponse}get(dt,ft){return this.axios.get(this.toCdnUrl(dt),this.toAxiosConfig(ft)).then(vt=>this.mapAxiosResponse(vt,ft)).catch(vt=>this.mapAxiosError(vt,ft))}post(dt,ft,vt){return this.axios.post(dt,ft,this.toAxiosConfig(vt)).then(Et=>this.mapAxiosResponse(Et,vt)).catch(Et=>this.mapAxiosError(Et,vt))}postFile(dt,ft,vt){const Et=this.toAxiosConfig(vt);return Et.headers&&Et.headers["Content-Type"]&&delete Et.headers["Content-Type"],this.axios.post(dt,ft,Et).then(Rt=>this.mapAxiosResponse(Rt,vt)).catch(Rt=>this.mapAxiosError(Rt,vt))}postJson(dt,ft,vt){const Et=this.toAxiosConfig();return Et.headers&&(Et.headers["Content-Type"]="application/json"),this.axios.post(dt,ft,this.toAxiosConfig(vt)).then(Rt=>this.mapAxiosResponse(Rt,vt)).catch(Rt=>this.mapAxiosError(Rt,vt))}put(dt,ft,vt){return this.axios.put(dt,ft,this.toAxiosConfig(vt)).then(Et=>this.mapAxiosResponse(Et,vt)).catch(Et=>this.mapAxiosError(Et,vt))}putJson(dt,ft,vt){const Et=this.toAxiosConfig(vt);return Et.headers&&(Et.headers["Content-Type"]="application/json"),this.axios.put(dt,ft,Et).then(Rt=>this.mapAxiosResponse(Rt,vt)).catch(Rt=>this.mapAxiosError(Rt,vt))}delete(dt,ft){return this.axios.delete(dt,this.toAxiosConfig(ft)).then(vt=>this.mapAxiosResponse(vt,ft)).catch(vt=>this.mapAxiosError(vt,ft))}deleteJson(dt,ft){return this.axios.delete(dt,{data:ft}).then(vt=>this.mapAxiosResponse(vt)).catch(vt=>this.mapAxiosError(vt))}getScript(dt,ft,vt){const Et=vt??"exports",Rt=this.toAxiosConfig(ft);return Rt.headers&&(Rt.headers.Accept="application/javascript"),this.axios.get(this.toCdnUrl(dt),Rt).then(St=>this.mapAxiosResponse(St,ft)).then(St=>{try{const At=`"use strict";var ${Et.split(".")[0]}={};${St};return ${Et};`;return Function(At)()}catch{return St}}).catch(St=>{throw this.mapAxiosError(St,ft),St})}loadScript(dt,ft){return loadedScripts$1[dt]?Promise.resolve():this.getScript(dt,ft).then(vt=>{loadedScripts$1[dt]=!0})}}class TransportFramework{constructor(){m$5(this,"_http",new Http)}get http(){return this._http}newHttpInstance(dt){return new Http(dt)}}const transport=new TransportFramework;class TransportFrameworkFactory{static instance(){return transport}}const http$2=transport.http;class Session{constructor(){m$5(this,"_me",null),m$5(this,"_currentLanguage",""),m$5(this,"_notLoggedIn",!0),m$5(this,"_description"),m$5(this,"_profile")}get currentLanguage(){return this._currentLanguage}get notLoggedIn(){return this._notLoggedIn}get description(){return this._description}get avatarUrl(){let dt=this.description.photo;return(!dt||dt==="no-avatar.jpg"||dt==="no-avatar.svg")&&(dt=ConfigurationFrameworkFactory.instance().Platform.theme.basePath+"/img/illustrations/no-avatar.svg"),dt}get user(){return this._me}get currentApp(){return configure.Platform.apps.currentApp}async initialize(){return http$2.get("/auth/oauth2/userinfo").then(dt=>{if(http$2.latestResponse.status<200||http$2.latestResponse.status>=300)throw ERROR_CODE.NOT_LOGGED_IN;return this.setCurrentModel(dt),this._notLoggedIn?this.loadDefaultLanguage():this.loadUserLanguage()}).then(dt=>(this.setCurrentLanguage(dt),this.loadDescription())).then(()=>this.getUserProfile()).then(()=>{notify.onSessionReady().resolve(this._me)}).catch(dt=>{if(dt===ERROR_CODE.NOT_LOGGED_IN)return Promise.resolve();notify.onSessionReady().reject(dt)})}setCurrentModel(dt){this._me=dt,this._notLoggedIn=!(dt&&dt.sessionMetadata&&dt.sessionMetadata.userId)}hasWorkflow(dt){var ft;return dt===void 0||((ft=this._me)==null?void 0:ft.authorizedActions.findIndex(vt=>vt.name===dt))!==-1}hasRight(dt,ft){if(ft==="owner")return dt.owner&&dt.owner.userId===this._me.userId;const vt=ft.right||ft,Et=dt.shared.filter(St=>(this._me.groupsIds||[]).indexOf(St.groupId)!==-1||St.userId===this._me.userId).find(St=>St[vt]||St.manager)!==void 0,Rt=ft.workflow?this.hasWorkflow(ft.workflow):!0;return Et&&Rt}get latestQuotaAndUsage(){return http$2.get(`/workspace/quota/user/${this._me.userId}`).then(dt=>(this._description&&(this._description.quota=dt.quota,this._description.storage=dt.storage),dt)).catch(()=>({quota:0,storage:0}))}setCurrentLanguage(dt){this._currentLanguage=dt,notify.onLangReady().resolve(dt)}loadDefaultLanguage(){return http$2.get("/locale").then(dt=>dt.locale).catch(()=>this._currentLanguage)}loadDescription(){return Promise.all([http$2.get("/userbook/api/person",{requestName:"refreshAvatar"}),http$2.get("/directory/userbook/"+this._me.userId)]).then(dt=>(dt[0].status==="ok"&&dt[0].result&&dt[0].result.length>0?this._description=dt[0].result[0]:this._description={},this._description.type&&!this._description.profiles&&(this._description.profiles=this._description.type),Object.assign(this._description,dt[1]),this._description))}get profile(){return this._profile}getUserProfile(){return http$2.get("/userbook/api/person").then(dt=>dt.result).then(dt=>this._profile=dt[0].type)}loadUserLanguage(){return http$2.get("/userbook/preference/language").then(dt=>{try{return JSON.parse(dt.preference)["default-domain"]}catch{return this.loadDefaultLanguage()}}).catch(()=>this.loadDefaultLanguage())}getEmailValidationInfos(){return http$2.get("/directory/user/mailstate")}checkEmail(dt){return http$2.put("/directory/user/mailstate",{email:dt})}tryEmailValidation(dt){return http$2.post("/directory/user/mailstate",{key:dt})}getMobileValidationInfos(){return http$2.get("/directory/user/mobilestate")}checkMobile(dt){return http$2.put("/directory/user/mobilestate",{mobile:dt})}tryMobileValidation(dt){return http$2.post("/directory/user/mobilestate",{key:dt})}getMfaInfos(){return http$2.get("/auth/user/mfa/code")}tryMfaCode(dt){return http$2.post("/auth/user/mfa/code",{key:dt})}}class SessionFramework{constructor(){m$5(this,"session",new Session)}initialize(){return this.session.initialize()}login(dt,ft,vt,Et){const Rt=new FormData;return Rt.append("email",dt),Rt.append("password",ft),typeof vt<"u"&&Rt.append("rememberMe",""+vt),typeof Et<"u"&&Rt.append("secureLocation",""+Et),transport.http.post("/auth/login",Rt,{headers:{"content-type":"application/x-www-form-urlencoded"}}).finally(()=>{switch(transport.http.latestResponse.status){case 200:throw ERROR_CODE.MALFORMED_DATA}})}logout(){return transport.http.get("/auth/logout").finally(()=>{})}}const session=new SessionFramework;class Theme{constructor(){m$5(this,"_conf"),m$5(this,"_loaded"),m$5(this,"skinName",""),m$5(this,"themeName",""),m$5(this,"skin","raw"),m$5(this,"themeUrl","/assets/themes/raw/default/"),m$5(this,"templateOverrides",{}),m$5(this,"portalTemplate","/assets/themes/raw/portal.html"),m$5(this,"basePath",""),m$5(this,"logoutCallback","/"),m$5(this,"skins",[]),m$5(this,"is1D",!1),m$5(this,"is2D",!1),m$5(this,"_onSkinReady",notify.onSkinReady()),m$5(this,"_onOverrideReady",notify.onOverridesReady())}initialize(dt){return notify.onSessionReady().promise.then(()=>this.load(dt))}get version(){return configure.Platform.deploymentTag}get cdnDomain(){return configure.Platform.cdnDomain}async onFullyReady(){return await this._loaded,this}onSkinReady(){return this._onSkinReady.promise}onOverrideReady(){return this._onOverrideReady.promise}async getConf(dt){var ft;return this._conf=(ft=this._conf)!=null?ft:await transport.http.getScript("/assets/theme-conf.js",{queryParams:{v:dt??this.version}},"exports.conf"),this._conf}load(dt){return dt=dt??this.version,this._loaded||(this._loaded=(session.session.notLoggedIn?this.loadDisconnected(dt):this.loadConnected(dt)).then(async()=>{var ft,vt;const Et=await this.listSkins();this.is1D=((ft=Et.find(Rt=>Rt.child===this.skin))==null?void 0:ft.parent)==="panda",this.is2D=((vt=Et.find(Rt=>Rt.child===this.skin))==null?void 0:vt.parent)==="theme-open-ent"})),this._loaded}loadDisconnected(dt){return new Promise((ft,vt)=>{transport.http.get("/skin",{queryParams:{v:this.version}}).then(Et=>{this.skin=Et.skin,this.themeUrl=`${this.cdnDomain}/assets/themes/${Et.skin}/skins/default/`,this.basePath=this.themeUrl+"../../",this._onSkinReady.resolve(this),transport.http.get(`/assets/themes/${Et.skin}/template/override.json`,{disableNotifications:!0,queryParams:{v:dt}}).then(Rt=>{this.templateOverrides=Rt,this._onOverrideReady.resolve(Rt),ft()}).catch(Rt=>{if(transport.http.latestResponse.status===404)ft();else throw Rt})}).catch(Et=>{this._onSkinReady.reject(Et),this._onOverrideReady.reject(Et),vt()})})}loadConnected(dt){return new Promise((ft,vt)=>{this.loadDefaultTheme(dt).then(()=>{this._onSkinReady.resolve(this),transport.http.get(`/assets/themes/${this.skin}/template/override.json`,{disableNotifications:!0,queryParams:{v:dt}}).then(Et=>{this.templateOverrides=Et,this._onOverrideReady.resolve(Et),ft()}).catch(Et=>{if(transport.http.latestResponse.status===404)ft(),this._onSkinReady.reject(Et),this._onOverrideReady.reject(Et);else throw Et})})})}async loadDefaultTheme(dt){return session.session.notLoggedIn?Promise.reject():transport.http.get("/theme",{queryParams:{_:dt}}).then(ft=>{this.skinName=ft.skinName,this.themeName=ft.themeName,this.themeUrl=ft.skin,this.basePath=`${this.cdnDomain}${this.themeUrl}../../`,this.skin=this.themeUrl.split("/assets/themes/")[1].split("/")[0],this.portalTemplate=`${this.cdnDomain}/assets/themes/${this.skin}/portal.html`,this.logoutCallback=ft.logoutCallback})}listThemes(){return transport.http.get("/themes")}async setDefaultTheme(dt){await transport.http.get("/userbook/api/edit-userbook-info?prop=theme-"+this.skin+"&value="+dt._id),await this.loadDefaultTheme(this.version)}listSkins(){return this.skins.length>0?Promise.resolve(this.skins):this.getConf().then(dt=>{const ft=dt.overriding.find(vt=>vt.child===this.skin);return ft!=null&&ft.group?this.skins=this.skins.concat(dt.overriding.filter(vt=>vt.group===ft.group)):this.skins=this.skins.concat(dt.overriding),this.skins})}async getHelpPath(){var dt;const ft=(await this.listSkins()).find(vt=>vt.child===this.skin);return(dt=ft==null?void 0:ft.help)!=null?dt:"/help"}}const bundle$1={},promises$1={},defaultDiacriticsRemovalMap$1=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];class Idiom{translate(dt,ft){dt=dt??"";let vt=bundle$1[dt]===void 0?dt:bundle$1[dt];if(ft&&typeof ft=="object")for(let Et in ft)typeof ft[Et]<"u"&&(vt=vt.replace(new RegExp("\\${"+Et+"}","g"),""+ft[Et]));return vt}addBundlePromise(dt){return this.loadBundlePromise(session.session.currentLanguage,dt)}addBundle(dt,ft){this.loadBundle(session.session.currentLanguage,dt,ft)}loadBundlePromise(dt,ft){return this.loadBundle(dt,ft),promises$1[ft]}loadBundle(dt,ft,vt){const Et=promises$1[ft];if(Et)vt&&Et.then(vt).catch(vt);else{const Rt=new Promisified;promises$1[ft]=Rt.promise;const St={};dt&&(St["Accept-Language"]=dt),transport.http.get(ft,{headers:St}).then(At=>{Object.assign(bundle$1,At),typeof vt=="function"&&vt(),Rt.resolve()}).catch(At=>{typeof vt=="function"&&vt(),Rt.reject()})}}addTranslations(dt,ft){notify.onLangReady().promise.then(vt=>{this.loadBundle(vt,dt+"/"+vt+".json",ft)})}addAllTranslations(dt){return dt&&dt.length>0?notify.onLangReady().promise.then(ft=>Promise.all(dt.map(vt=>this.loadBundlePromise(ft,vt+"/"+ft+".json")))).then(()=>{}):Promise.reject()}addKeys(dt){for(var ft in dt)typeof bundle$1[ft]!="string"&&(bundle$1[ft]=dt[ft])}removeAccents(dt){for(var ft=0;ft<defaultDiacriticsRemovalMap$1.length;ft++)dt=dt.replace(defaultDiacriticsRemovalMap$1[ft].letters,defaultDiacriticsRemovalMap$1[ft].base);return dt}}class UserPreferences{constructor(){m$5(this,"data",{})}get(dt){return this.data[dt]}load(dt,ft){return transport.http.get("/userbook/preference/"+dt).then(vt=>{try{return JSON.parse(vt.preference)}catch{return ft??{}}}).then(vt=>(this.data[dt]=vt??{},vt))}update(dt,ft){return ft!==void 0&&(this.data[dt]=ft),this}save(dt){return transport.http.putJson("/userbook/preference/"+dt,this.data[dt])}}class User{constructor(){m$5(this,"_me",null),m$5(this,"_keepOpenOnLogout",!1),m$5(this,"_preferences",new UserPreferences),m$5(this,"_bookmarkedApps",[])}get keepOpenOnLogout(){return this._keepOpenOnLogout}get preferences(){return this._preferences}get bookmarkedApps(){return this._bookmarkedApps}initialize(dt){return this.loadPublicConf(),notify.onSessionReady().promise.then(ft=>{ft&&this.setCurrentModel(ft)})}setCurrentModel(dt){this._me=dt,this._preferences=new UserPreferences,this.loadBookmarks()}loadPublicConf(){return transport.http.get("/conf/public").then(dt=>(this._keepOpenOnLogout=(dt==null?void 0:dt.keepOpenOnLogout)||!1,dt))}async loadBookmarks(){await transport.http.get("/userbook/preference/apps").then(dt=>{dt.preference||(dt.preference=null);const ft=JSON.parse(dt.preference);let vt;if(ft&&ft.length&&typeof ft.concat=="function"){this._bookmarkedApps=ft,vt={bookmarks:ft.map(St=>St.name),applications:[]},transport.http.putJson("/userbook/preference/apps",vt);return}else vt=ft;vt||(vt={bookmarks:[],applications:[]});let Et=!0;const Rt=[];vt.bookmarks.forEach((St,At)=>{const Ct=this._me.apps.find(kt=>kt.name===St);if(Ct){let kt=Object.assign({},Ct);this._bookmarkedApps.push(kt)}else Rt.push(St),Et=!1}),Rt.forEach(St=>{let At=vt.bookmarks.indexOf(St);At!==-1&&vt.bookmarks.splice(At,1)}),Et||transport.http.putJson("/userbook/preference/apps",vt)})}loadAppPrefs(dt){return this.preferences.load(dt,{})}saveAppPrefs(dt){return this.preferences.save(dt)}loadLanguage(){return this.preferences.load("language",{"default-domain":session.session.currentLanguage}).then(dt=>dt["default-domain"])}saveLanguage(dt){return this.preferences.update("language",{"default-domain":dt}).save("language")}}const http$1=transport==null?void 0:transport.http;class AppConf{constructor(){m$5(this,"_publicConf",{}),m$5(this,"_currentApp"),m$5(this,"_appConf",{})}get currentApp(){var dt;return(dt=this._currentApp)!=null?dt:null}setCurrentApp(dt){return this._currentApp=dt,this}async initialize(dt,ft=!1){ft||this.setCurrentApp(dt),await Promise.all([this.getPublicConf(dt),this.loadI18n(dt)])}async getPublicConf(dt){return this._publicConf[dt]||(this._publicConf[dt]=await http$1.get(`/${dt}/conf/public`,{queryParams:{_:configure.Platform.deploymentTag}})),this._publicConf[dt]}async getWebAppConf(dt){var ft;let vt;return this._appConf[dt]||(await http$1.get("/applications-list")).apps.forEach(Et=>{if(Et!=null&&Et.prefix){const Rt=Et.prefix.replace("/","");this._appConf[Rt]=Et}else Et!=null&&Et.name&&Et.name.toLowerCase()==dt&&(vt=Et)}),(ft=this._appConf[dt])!=null?ft:vt}async loadI18n(dt){return await notify.onLangReady().promise,configure.Platform.idiom.addBundlePromise(`/${dt}/i18n`)}}class Analytics{constructor(){m$5(this,"_status","void"),m$5(this,"_params")}get status(){return this._status}xiti(){return this.parametersWithCheck("xiti",!1)}parameters(dt){return this.parametersWithCheck(dt,!0)}async parametersWithCheck(dt,ft){return this.initialize().promise.then(vt=>!ft||vt.type===dt||vt.type==="multiple"?vt[dt]:void 0)}initialize(){return this._params||(this._params=notify.promisify(),this._status="pending",Promise.all([transport.http.get("/analyticsConf"),transport.http.get("/xiti/config")]).then(async dt=>{var ft;if(!dt||!dt[0]||!dt[0].type)throw ERROR_CODE.MALFORMED_DATA;dt[1]&&dt[1].active&&(dt[0].xiti=await this.initializeXiti(dt[1])),(ft=this._params)==null||ft.resolve(dt[0]),this._status="ready"}).catch(dt=>{var ft;throw this._status="failed",(ft=this._params)==null||ft.reject(),dt})),this._params}async initializeXiti(dt){var ft;if(!dt.structureMap||!configure.Platform.apps.currentApp)return;const vt=await notify.onSessionReady().promise,Et=session.session.description;let Rt;for(let Tt of vt.structures){const Nt=dt.structureMap[Tt];if(Nt&&Nt.collectiviteId&&Nt.UAI){Rt=Nt;break}}if(!Rt||!Rt.active)return;const St=await configure.Platform.apps.getPublicConf(configure.Platform.apps.currentApp);if(!St)return;const At=St.xiti;if(!At||!At.LIBELLE_SERVICE||!Rt.UAI)return;function Ct(Tt){let Nt="";for(let Ft=0;Ft<Tt.length;Ft++)Nt+=Tt.charCodeAt(Ft);return Nt}const kt={Student:"ELEVE",Teacher:"ENSEIGNANT",Relative:"PARENT",Personnel:"ADMIN_VIE_SCOL_TECH",Guest:"AUTRE"};return{LIBELLE_SERVICE:At.LIBELLE_SERVICE,TYPE:At.OUTIL?"TIERS":"NATIF",OUTIL:At.OUTIL?At.OUTIL:"",STRUCT_ID:Rt.collectiviteId,STRUCT_UAI:Rt.UAI,PROJET:Rt.projetId?Rt.projetId:dt.ID_PROJET,EXPLOITANT:dt.ID_EXPLOITANT,PLATFORME:Rt.plateformeId?Rt.plateformeId:dt.ID_PLATEFORME,ID_PERSO:Ct(vt.userId),PROFILE:Et.profiles&&Et.profiles.length>0&&(ft=kt[Et.profiles[0]])!=null?ft:""}}}class ConfigurationFramework{constructor(){m$5(this,"Platform",{deploymentTag:"",cdnDomain:"",apps:new AppConf,theme:new Theme,analytics:new Analytics,idiom:new Idiom,listLanguages:()=>transport.http.get("/languages")}),m$5(this,"School",{}),m$5(this,"User",new User)}async initialize(dt,ft){if(!dt){const Et=kt=>(kt<10?"0":"")+kt.toFixed(0),Rt=new Date,St=Rt.getFullYear(),At=Rt.getMonth()+1,Ct=Rt.getDate();dt=`${St}${Et(At)}${Et(Ct)}`}const vt=dt;this.Platform.deploymentTag=dt,typeof ft=="string"&&ft.length>0&&(this.Platform.cdnDomain=ft),transport.http.setCdn(this.Platform.cdnDomain),await Promise.all([this.Platform.theme.initialize(vt),notify.onSessionReady().promise.then(Et=>this.Platform.idiom.addBundlePromise("/i18n")),this.User.initialize(vt)])}}const configure=new ConfigurationFramework;class ConfigurationFrameworkFactory{static instance(){return configure}}const WIDGET_POSITION={LEFT:"left",RIGHT:"right"},firstLevelWidgets=["birthday","mood","calendar-widget","notes"],secondLevelWidgets=["agenda-widget","carnet-de-bord","my-apps","rss-widget","bookmark-widget","cursus-widget","maxicours-widget","school-widget"],defaultWidgetPosition={"last-infos-widget":WIDGET_POSITION.LEFT,birthday:WIDGET_POSITION.LEFT,"calendar-widget":WIDGET_POSITION.RIGHT,"carnet-de-bord":WIDGET_POSITION.LEFT,"record-me":WIDGET_POSITION.RIGHT,mood:WIDGET_POSITION.LEFT,"my-apps":WIDGET_POSITION.RIGHT,notes:WIDGET_POSITION.RIGHT,"rss-widget":WIDGET_POSITION.LEFT,"bookmark-widget":WIDGET_POSITION.RIGHT,qwant:WIDGET_POSITION.RIGHT,"qwant-junior":WIDGET_POSITION.LEFT,"agenda-widget":WIDGET_POSITION.LEFT,"cursus-widget":WIDGET_POSITION.LEFT,"maxicours-widget":WIDGET_POSITION.RIGHT,"universalis-widget":WIDGET_POSITION.RIGHT,"briefme-widget":WIDGET_POSITION.LEFT,"school-widget":WIDGET_POSITION.LEFT},defaultWidgetOrder={"school-widget":0,"my-apps":10,"record-me":15,"last-infos-widget":20,qwant:30,"qwant-junior":30,"universalis-widget":35,"agenda-widget":40,"bookmark-widget":50,"carnet-de-bord":60,"maxicours-widget":70,"cursus-widget":80,"briefme-widget":90,"rss-widget":100,mood:110,birthday:120,"calendar-widget":130,notes:140};class WidgetFramework{constructor(){m$5(this,"_initialized"),m$5(this,"_widgets",[]),m$5(this,"_userPrefs",{})}initialize(dt,ft){return this._initialized||(this._initialized=new Promisified,notify.onSessionReady().promise.then(vt=>{var Et;vt&&vt.widgets?(vt.widgets.forEach(Rt=>{this._widgets.push(new Widget(Rt))}),this.loadUserPrefs().then(()=>{var Rt;(Rt=this._initialized)==null||Rt.resolve()}).catch(Rt=>{var St;(St=this._initialized)==null||St.reject()})):(Et=this._initialized)==null||Et.reject()})),this._initialized.promise}get list(){return this._widgets}lookup(dt){return this._widgets.find(ft=>ft.platformConf.name===dt)}lookupDefaultPosition(dt){return defaultWidgetPosition[dt]}get userPrefs(){return this._userPrefs}async loadUserPrefs(){await configure.User.preferences.load("widgets",{}).then(dt=>this.applyUserPrefs(dt))}saveUserPrefs(){return configure.User.preferences.update("widgets",this._userPrefs).save("widgets").then(()=>{notify.events().next({name:EVENT_NAME.USERPREF_CHANGED,layer:LAYER_NAME.WIDGETS})})}async applyUserPrefs(dt){this._userPrefs=dt??this._userPrefs;const ft=configure.Platform.theme,vt=[];ft.listSkins().then(Et=>{var Rt;const St=((Rt=Et.find(Ct=>Ct.child===ft.skin))==null?void 0:Rt.parent)==="panda"?secondLevelWidgets:firstLevelWidgets;this._widgets=this._widgets.filter((Ct,kt)=>{var Tt,Nt;const Ft=Ct.platformConf.name;return St.indexOf(Ft)!==-1?!1:(this._userPrefs[Ft]||(this._userPrefs[Ft]={index:(Tt=defaultWidgetOrder[Ft])!=null?Tt:999,show:!0,position:Ct.platformConf.position}),Ct.platformConf.mandatory&&(this._userPrefs[Ft].show=!0,this._userPrefs[Ft].index=(Nt=defaultWidgetOrder[Ft])!=null?Nt:999),Ct.platformConf.i18n&&vt.push(Ct.platformConf.i18n),Ct.applyUserPref(this._userPrefs[Ft]),!0)});const At=new Idiom;this._widgets=this._widgets.sort((Ct,kt)=>{const Tt=At.translate(`timeline.settings.${Ct.platformConf.name}`).toLowerCase(),Nt=At.translate(`timeline.settings.${kt.platformConf.name}`).toLowerCase();return Tt<Nt?-1:Tt>Nt?1:0})})}}class Widget{constructor(dt){m$5(this,"_schoolConf",{}),m$5(this,"_userPref"),this._platformConf=dt,this._userPref=null}get platformConf(){return this._platformConf}get schoolConf(){return this._schoolConf}get userPref(){return this._userPref}applyUserPref(dt){var ft,vt;this._userPref=dt,this._userPref.position=(vt=(ft=this._userPref.position)!=null?ft:widgets.lookupDefaultPosition(this._platformConf.name))!=null?vt:"left"}}const widgets=new WidgetFramework;transport==null||transport.http;var O$3;(O$3=session==null?void 0:session.session)==null||O$3.user;const x$3=class{constructor(dt){m$5(this,"checkHttpResponse",ft=>{if(this.http.latestResponse.status>=300)throw this.http.latestResponse.statusText;return ft}),this.context=dt}static register({application:dt,resourceType:ft},vt){x$3.registry.set(`${dt}:main`,vt),x$3.registry.set(`${dt}:${ft}`,vt)}static findService({application:dt,resourceType:ft},vt){const Et=x$3.registry.get(`${dt}:${ft}`);if(Et===void 0)throw`Service not found: ${dt}:${ft}`;return Et(vt)}static findMainService({application:dt},ft){const vt=x$3.registry.get(`${dt}:main`);if(vt===void 0)throw`Service not found: ${dt}`;return vt(ft)}get http(){return this.context.http()}getShareReadUrl(dt){return`/${this.getApplication()}/share/json/${dt}?search=`}getSaveShareUrl(dt){return`/${this.getApplication()}/share/resource/${dt}`}gotoPrint(dt,ft){window.open(this.getPrintUrl(dt,ft),"_blank")}gotoView(dt){window.open(this.getViewUrl(dt),"_self")}gotoForm(dt){window.open(this.getFormUrl(dt),"_self")}async publish(dt){const ft=new FormData;ft.append("title",dt.title),ft.append("cover",dt.cover),ft.append("coverName",dt.cover.name),ft.append("coverType",dt.cover.type),ft.append("teacherAvatar",dt.teacherAvatar),ft.append("teacherAvatarName",dt.teacherAvatar.name||`teacherAvatar_${dt.userId}`),ft.append("teacherAvatarType",dt.teacherAvatar.type),ft.append("language",dt.language),dt.activityType.forEach(Et=>{ft.append("activityType[]",Et)}),dt.subjectArea.forEach(Et=>{ft.append("subjectArea[]",Et)}),dt.age.forEach(Et=>{ft.append("age[]",Et.toString())}),ft.append("description",dt.description),dt.keyWords.split(",").forEach(Et=>{ft.append("keyWords[]",Et.trim())}),ft.append("licence",dt.licence),ft.append("pdfUri",`${window.location.origin}${this.getPrintUrl(dt.resourceEntId)}`),ft.append("application",dt.application?dt.application:""),ft.append("resourceId",dt.resourceId),ft.append("teacherSchool",dt.userStructureName);const vt=await this.http.post("/appregistry/library/resource",ft,{headers:{"Content-Type":"multipart/form-data"}});return this.checkHttpResponse(vt)}async createContext(dt){const ft=await this.http.get("/explorer/context",{queryParams:this.toQueryParams(dt)});return this.checkHttpResponse(ft)}async searchContext(dt){const ft=await this.http.get("/explorer/resources",{queryParams:this.toQueryParams(dt)});return this.checkHttpResponse(ft)}async createFolder(dt){const ft=await this.http.post("/explorer/folders",this.createFolderToBodyParams(dt));return this.checkHttpResponse(ft)}async updateFolder(dt){const ft=await this.http.put(`/explorer/folders/${dt.folderId}`,this.createFolderToBodyParams(dt));return this.checkHttpResponse(ft)}async moveToFolder(dt){const ft=await this.http.post(`/explorer/folders/${dt.folderId}/move`,this.moveToBodyParams(dt));return this.checkHttpResponse(ft)}async listSubfolders(dt){const ft=await this.http.get(`/explorer/folders/${dt}`);return this.checkHttpResponse(ft)}async deleteAll(dt){const ft=await this.http.deleteJson("/explorer",dt);return this.checkHttpResponse(ft)}async trashAll({resourceType:dt,...ft}){const vt=await this.http.putJson("/explorer/trash",ft);return this.checkHttpResponse(vt)}async restoreAll({resourceType:dt,...ft}){const vt=await this.http.putJson("/explorer/restore",ft);return this.checkHttpResponse(vt)}async getThumbnailPath(dt){if(typeof dt>"u")return dt;if(typeof dt=="string")if(dt.startsWith("blob:")){const ft=await fetch(dt).then(vt=>vt.blob());return`/workspace/document/${(await this.context.workspace().saveFile(ft,{visibility:"protected",application:this.getApplication()}))._id}`}else return dt;else return`/workspace/document/${(await this.context.workspace().saveFile(dt,{visibility:"protected",application:this.getApplication()}))._id}`}toQueryParams(dt){let ft={application:dt.app,start_idx:dt.pagination.startIdx,page_size:dt.pagination.pageSize,resource_type:dt.types[0],trashed:dt.trashed};if(dt.orders&&Object.entries(dt.orders).length){const[[vt,Et]]=Object.entries(dt.orders);ft.order_by=`${vt}:${Et}`}return dt.filters&&Object.assign(ft,dt.filters),typeof dt.search=="string"&&(ft.search=dt.search),ft}createFolderToBodyParams(dt){return{application:dt.app,resourceType:dt.type,parentId:dt.parentId,name:dt.name}}moveToBodyParams(dt){return{application:dt.application,resourceType:this.getResourceType(),resourceIds:dt.resourceIds,folderIds:dt.folderIds}}};let ResourceService=x$3;m$5(ResourceService,"registry",new Map);class BlogResourceService extends ResourceService{async update(dt){const ft=await this.getThumbnailPath(dt.thumbnail),vt=await this.http.put(`/blog/${dt.entId}`,{trashed:dt.trashed,_id:dt.entId,title:dt.name,thumbnail:ft,description:dt.description,visibility:dt.public?"PUBLIC":"OWNER",slug:dt.public?dt.slug:"","publish-type":dt["publish-type"]||"RESTRAINT","comment-type":"IMMEDIATE"});return this.checkHttpResponse(vt),{thumbnail:ft,entId:dt.entId}}getResourceType(){return RESOURCE.BLOG}getApplication(){return APP.BLOG}getFormUrl(dt){return dt?`/blog?folderid=${dt}#/edit/new`:"/blog#/edit/new"}getViewUrl(dt){return`/blog#/view/${dt}`}getPrintUrl(dt,ft){return`/blog/print/blog#/print/${dt}?comments=${ft||!0}`}}ResourceService.register({application:RESOURCE.BLOG,resourceType:RESOURCE.BLOG},lt=>new BlogResourceService(lt));const globalCache={},mutexPromise={};class CacheService{constructor(dt){this.context=dt}get http(){return this.context.http()}async fromCacheIfPossible(dt,ft,vt){if(mutexPromise[dt]&&await mutexPromise[dt],globalCache[dt])return globalCache[dt];try{const Et=ft();mutexPromise[dt]=Et;const Rt=await Et;return vt(Rt)&&(globalCache[dt]=Rt),Rt}catch(Et){throw console.error(`Failed to retrieve value for: ${dt}`,Et),Et}}clearCache(dt){if(dt)delete globalCache[dt];else for(const ft in globalCache)globalCache.hasOwnProperty(ft)&&delete globalCache[ft]}async httpGet(dt,ft){return this.fromCacheIfPossible(dt,async()=>{const vt=await this.http.get(dt,ft),Et={...this.http.latestResponse};return{value:vt,response:Et}},({response:vt})=>!(vt.status<200||vt.status>=300))}async httpGetJson(dt,ft){const{response:vt,value:Et}=await this.httpGet(dt,ft);if(vt.status<200||vt.status>=300)throw`Bad http status (${vt.status}) for url: ${dt}`;return Et}}class ConfService{constructor(dt){this.context=dt}get http(){return this.context.http()}get cdnDomain(){return configure.Platform.cdnDomain}async getConf(dt){const[ft,vt]=await Promise.all([this.getThemeConf(),this.getApplicationsList()]),[Et,Rt]=await Promise.all([this.getTheme({conf:ft}),this.getWebAppConf({app:dt,applications:vt})]);return{applications:vt,conf:ft,currentApp:Rt,theme:Et}}getCdnUrl(){console.warn("[getCdnUrl] Not implemented yet")}async savePreference(dt,ft){this.http.putJson(`/userbook/preference/${dt}`,ft)}async getPreference(dt){const ft=await this.http.get(`/userbook/preference/${dt}`);return JSON.parse(ft.preference)}async getThemeConf(dt){return await this.http.getScript("/assets/theme-conf.js",{queryParams:{v:dt}},"exports.conf")}async getApplicationsList(){return(await this.http.get("/applications-list")).apps}async getWebAppConf({app:dt,applications:ft}){return ft.find(vt=>{if(vt!=null&&vt.prefix)return(vt==null?void 0:vt.prefix.replace("/",""))===dt})}async getTheme({version:dt,conf:ft}){const vt=await this.http.get("/theme",{queryParams:{_:dt}}),Et=vt.themeName,Rt=ft==null?void 0:ft.overriding.find(Nt=>Nt.child===Et).skins,St="/assets/themes/ode-bootstrap",At=ft==null?void 0:ft.overriding.find(Nt=>Nt.child===Et).bootstrapVersion,Ct=`${this.cdnDomain}/assets/themes/${At}`,kt=`${Ct}/skins/${vt.skinName}`,Tt=(ft==null?void 0:ft.overriding.find(Nt=>Nt.child===Et).parent)==="panda";return{basePath:`${this.cdnDomain}${vt.skin}../../`,bootstrap:St,bootstrapPath:Ct,bootstrapUrl:kt,bootstrapVersion:At,is1d:Tt,logoutCallback:vt.logoutCallback,skin:vt.skin.split("/assets/themes/")[1].split("/")[0],skinName:vt.skinName,skins:Rt,themeName:vt.themeName,themeUrl:vt.skin}}}class DirectoryService{constructor(dt){this.odeServices=dt}get http(){return this.odeServices.http()}get cache(){return this.odeServices.cache()}getAvatarUrl(dt,ft,vt="100x100"){return ft==="user"?`/userbook/avatar/${dt}?thumbnail=${vt}`:"/assets/img/illustrations/group-avatar.svg"}getDirectoryUrl(dt,ft){return ft==="user"?`/userbook/annuaire#/${dt}`:`/userbook/annuaire#/group-view/${dt}`}async getBookMarks(){return(await this.cache.httpGetJson("/directory/sharebookmark/all")).map(({id:dt,name:ft})=>({id:dt,displayName:ft,members:[]}))}async getBookMarkById(dt){const{groups:ft,id:vt,name:Et,users:Rt}=await this.http.get(`/directory/sharebookmark/${dt}`);return{id:vt,displayName:Et,groups:ft.map(({name:St,id:At})=>({displayName:St,id:At})),users:Rt.map(({displayName:St,id:At,profile:Ct})=>({profile:Ct,displayName:St,firstName:"",lastName:"",login:"",id:At}))}}async saveBookmarks(dt,{bookmarks:ft,groups:vt,users:Et}){this.cache.clearCache("/directory/sharebookmark/all");const Rt=Et.map(Nt=>typeof Nt=="string"?Nt:Nt.id),St=vt.map(Nt=>typeof Nt=="string"?Nt:Nt.id),At=ft.map(async Nt=>{if(typeof Nt=="string"){const{displayName:Ft,groups:Dt,id:Ut,users:zt}=await this.getBookMarkById(Nt),Zt=zt.map(Bt=>Bt.id),Ht=Dt.map(Bt=>Bt.id);return{displayName:Ft,id:Ut,members:[...Ht,...Zt]}}else return Promise.resolve(Nt)}),Ct=(await Promise.all(At)).map(Nt=>Nt.members).reduce((Nt,Ft)=>[...Nt,...Ft],[]),kt={name:dt,members:[...Rt,...St,...Ct]},{id:Tt}=await this.http.postJson("/directory/sharebookmark",kt);return{id:Tt,displayName:dt,members:kt.members}}}const loadedScripts={};class HttpService{constructor(dt,ft){m$5(this,"axios"),m$5(this,"_latestResponse"),this.context=dt,this.axios=axios.create(ft)}setCdn(dt){dt&&XMLHttpRequest&&!XMLHttpRequest.prototype.cdnUrl&&(XMLHttpRequest.prototype.cdnUrl=dt,XMLHttpRequest.prototype.baseOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){const ft=arguments[1];return ft.startsWith("/infra/public")&&(arguments[1]=dt+ft),/^\/([^\/]*)\/public/.test(ft)&&(arguments[1]=dt+ft),ft.startsWith("/assets")&&(arguments[1]=dt+ft),ft=="/conf/public"&&(arguments[1]=ft),ft.startsWith("http")&&(arguments[1]=ft),this.baseOpen.apply(this,arguments)})}toAxiosConfig(dt){if(dt){const ft=Object.assign({},this.axios.defaults);return dt.headers&&(ft.headers=Object.assign({},this.axios.defaults.headers),Object.assign(ft.headers,dt.headers)),dt.responseType&&(ft.responseType=dt.responseType),dt.queryParams&&(ft.params=Object.assign({},dt.queryParams)),ft}else return this.axios.defaults}toCdnUrl(dt){const ft=this.context.conf().getCdnUrl()||"";if(ft.length>0&&dt!=="/conf/public"){const vt=""+dt;(vt.startsWith("/infra/public")||vt.startsWith("/assets")||/^\/([^\/]*)\/public/.test(vt))&&(dt=ft+vt)}return dt}mapAxiosError(dt,ft){return console.error("[HttpService]",dt),dt.response?this._latestResponse=dt.response:dt.request?this._latestResponse={status:408,statusText:ERROR_CODE.TIME_OUT}:this._latestResponse={status:500,statusText:ERROR_CODE.UNKNOWN},!ft||ft.disableNotifications,this._latestResponse}mapAxiosResponse(dt,ft){return this._latestResponse=dt,dt.data}get latestResponse(){return this._latestResponse}async get(dt,ft){try{const vt=await this.axios.get(this.toCdnUrl(dt),this.toAxiosConfig(ft));return this.mapAxiosResponse(vt,ft)}catch(vt){return this.mapAxiosError(vt,ft)}}async post(dt,ft,vt){try{const Et=await this.axios.post(dt,ft,this.toAxiosConfig(vt));return this.mapAxiosResponse(Et,vt)}catch(Et){return this.mapAxiosError(Et,vt)}}async postFile(dt,ft,vt){const Et=this.toAxiosConfig(vt);Et.headers&&Et.headers["Content-Type"]&&delete Et.headers["Content-Type"];try{const Rt=await this.axios.post(dt,ft,{...Et,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(Rt,vt)}catch(Rt){return this.mapAxiosError(Rt,vt)}}async postJson(dt,ft,vt){const Et=this.toAxiosConfig();Et.headers&&(Et.headers["Content-Type"]="application/json");try{const Rt=await this.axios.post(dt,ft,this.toAxiosConfig(vt));return this.mapAxiosResponse(Rt,vt)}catch(Rt){return this.mapAxiosError(Rt,vt)}}async put(dt,ft,vt){try{const Et=await this.axios.put(dt,ft,this.toAxiosConfig(vt));return this.mapAxiosResponse(Et,vt)}catch(Et){return this.mapAxiosError(Et,vt)}}async putFile(dt,ft,vt){try{const Et=this.toAxiosConfig(vt);Et.headers&&Et.headers["Content-Type"]&&delete Et.headers["Content-Type"];const Rt=await this.axios.put(dt,ft,{...Et,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(Rt,vt)}catch(Et){return this.mapAxiosError(Et,vt)}}async putJson(dt,ft,vt){const Et=this.toAxiosConfig(vt);Et.headers&&(Et.headers["Content-Type"]="application/json");try{const Rt=await this.axios.put(dt,ft,Et);return this.mapAxiosResponse(Rt,vt)}catch(Rt){return this.mapAxiosError(Rt,vt)}}async delete(dt,ft){try{const vt=await this.axios.delete(dt,this.toAxiosConfig(ft));return this.mapAxiosResponse(vt,ft)}catch(vt){return this.mapAxiosError(vt,ft)}}async deleteJson(dt,ft){try{const vt=await this.axios.delete(dt,{data:ft});return this.mapAxiosResponse(vt)}catch(vt){return this.mapAxiosError(vt)}}getScript(dt,ft,vt){const Et=vt??"exports",Rt=this.toAxiosConfig(ft);return Rt.headers&&(Rt.headers.Accept="application/javascript"),this.axios.get(this.toCdnUrl(dt),Rt).then(St=>this.mapAxiosResponse(St,ft)).then(St=>{try{const At=`"use strict";var ${Et.split(".")[0]}={};${St};return ${Et};`;return Function(At)()}catch{return St}}).catch(St=>{throw this.mapAxiosError(St,ft),St})}loadScript(dt,ft){return loadedScripts[dt]?Promise.resolve():this.getScript(dt,ft).then(vt=>{loadedScripts[dt]=!0})}}class RightService{constructor(dt){this.context=dt}get session(){return this.context.session()}parseResourceRight(dt){const ft=dt.split(":");if(ft.length===2){if(ft[0]==="creator")return{id:ft[1],right:"creator",type:"creator"}}else return ft.length===3?{id:ft[1],right:ft[2],type:ft[0]}:void 0}parseResourceRights(dt){return dt.map(ft=>this.parseResourceRight(ft)).filter(ft=>ft!==void 0)}hasResourceRight({id:dt,groupIds:ft},vt,Et){const Rt=Et.map(St=>typeof St=="string"?this.parseResourceRight(St):St).filter(St=>St!==void 0);for(const St of Rt)if(St.id===dt&&St.type==="creator"||St.id===dt&&St.type==="user"&&St.right===vt||ft.includes(St.id)&&St.type==="group"&&St.right===vt)return!0;return!1}async sessionHasResourceRight(dt,ft){try{const vt=await this.session.getUser();return!!vt&&this.hasResourceRight({groupIds:vt.groupsIds,id:vt.userId},dt,ft)}catch(vt){return console.error(vt),!1}}async sessionHasAtLeastOneResourceRight(dt,ft){for(const vt of dt)if(await this.sessionHasResourceRight(vt,ft))return!0;return!1}async sessionHasResourceRightForEachList(dt,ft){let vt=0;for(const Et of ft)await this.sessionHasResourceRight(dt,Et)&&vt++;return vt===ft.length}async sessionHasAtLeastOneResourceRightForEachList(dt,ft){for(const vt of dt){let Et=0;for(const Rt of ft)await this.sessionHasResourceRight(vt,Rt)&&Et++;if(Et===ft.length)return!0}return!1}hasWorkflowRight(dt,ft){return ft.findIndex(vt=>vt===dt)!==-1}async sessionHasWorkflowRight(dt){try{const ft=await this.session.getUser();return!!ft&&this.hasWorkflowRight(dt,ft.authorizedActions.map(vt=>vt.name))}catch(ft){return console.error(ft),!1}}async sessionHasWorkflowRights(dt){const ft={};try{const vt=await this.session.getUser();for(const Et of dt)ft[Et]=!!vt&&this.hasWorkflowRight(Et,vt.authorizedActions.map(Rt=>Rt.name))}catch(vt){console.error(vt);for(const Et of dt)ft[Et]=!1}return ft}}class SessionService{constructor(dt){this.context=dt}get http(){return this.context.http()}get cache(){return this.context.cache()}onLogout(){this.cache.clearCache()}onRefreshSession(){this.cache.clearCache()}async getSession(){const dt=await this.getUser(),[ft,vt,Et,Rt,St]=await Promise.all([this.getCurrentLanguage(dt),this.latestQuotaAndUsage(dt),this.loadDescription(dt),this.getUserProfile(),this.getBookmarks(dt)]);return{user:dt,quotaAndUsage:vt,currentLanguage:ft,userDescription:Et,userProfile:Rt,bookmarkedApps:St}}login(dt,ft,vt,Et){const Rt=new FormData;return Rt.append("email",dt),Rt.append("password",ft),typeof vt<"u"&&Rt.append("rememberMe",""+vt),typeof Et<"u"&&Rt.append("secureLocation",""+Et),this.http.post("/auth/login",Rt,{headers:{"content-type":"application/x-www-form-urlencoded"}}).finally(()=>{switch(this.http.latestResponse.status){case 200:throw ERROR_CODE.MALFORMED_DATA}})}logout(){return this.http.get("/auth/logout").finally(()=>{})}async latestQuotaAndUsage(dt){try{return await this.http.get(`/workspace/quota/user/${dt==null?void 0:dt.userId}`)}catch(ft){return console.error(ft),{quota:0,storage:0}}}async getCurrentLanguage(dt){const ft=(dt==null?void 0:dt.sessionMetadata)&&(dt==null?void 0:dt.sessionMetadata.userId);try{let vt;return ft?vt=await this.loadUserLanguage():vt=await this.loadDefaultLanguage(),vt}catch(vt){console.error(vt)}}async loadUserLanguage(){try{const dt=await this.http.get("/userbook/preference/language");return JSON.parse(dt.preference)["default-domain"]}catch{return await this.loadDefaultLanguage()}}async loadDefaultLanguage(){return(await this.cache.httpGetJson("/locale")).locale}async getUser(){const{response:dt,value:ft}=await this.cache.httpGet("/auth/oauth2/userinfo");if(dt.status<200||dt.status>=300)throw ERROR_CODE.NOT_LOGGED_IN;return ft}hasWorkflow({workflowName:dt,user:ft}){return dt===void 0||(ft==null?void 0:ft.authorizedActions.findIndex(vt=>vt.name===dt))!==-1}async loadDescription(dt){try{const[ft,vt]=await Promise.all([this.getUserProfile({requestName:"refreshAvatar"}),this.http.get("/directory/userbook/"+(dt==null?void 0:dt.userId))]);return{...ft,...vt}}catch(ft){return console.error(ft),{}}}async getBookmarks(dt){const ft=await this.http.get("/userbook/preference/apps");ft.preference||(ft.preference=null);const vt=JSON.parse(ft.preference);let Et;Et=vt,Et||(Et={bookmarks:[],applications:[]});let Rt=[];return Et.bookmarks.forEach((St,At)=>{const Ct=dt==null?void 0:dt.apps.find(kt=>kt.name===St);if(Ct){let kt=Object.assign({},Ct);Rt.push(kt)}}),Rt}async getUserProfile(dt){const{response:ft,value:vt}=await this.cache.httpGet("/userbook/api/person",dt);if(ft.status<200||ft.status>=300)throw ERROR_CODE.NOT_LOGGED_IN;return vt.result[0].type}async isAdml(){const dt=await this.getUser();return(dt==null?void 0:dt.functions.ADMIN_LOCAL)!==void 0}}class StringUtils{static removeAccents(dt){for(var ft=0;ft<defaultDiacriticsRemovalMap$1.length;ft++)dt=dt.replace(defaultDiacriticsRemovalMap$1[ft].letters,defaultDiacriticsRemovalMap$1[ft].base);return dt}}class ShareService{constructor(dt){this.context=dt}get directory(){return this.context.directory()}get http(){return this.context.http()}get cache(){return this.context.cache()}async searchShareSubjects(dt,ft,vt){const Et=StringUtils.removeAccents(vt).toLowerCase(),Rt=await this.cache.httpGetJson(`/${dt}/share/json/${ft}?search=${vt}`),St=Rt.users.visibles.filter(({username:Ct,firstName:kt,lastName:Tt,login:Nt})=>{const Ft=StringUtils.removeAccents(Tt||"").toLowerCase(),Dt=StringUtils.removeAccents(kt||"").toLowerCase(),Ut=StringUtils.removeAccents(Ct||"").toLowerCase(),zt=StringUtils.removeAccents(Nt||"").toLowerCase();return Ut.includes(Et)||Dt.includes(Et)||Ft.includes(Et)||zt.includes(Et)}).map(Ct=>({avatarUrl:this.directory.getAvatarUrl(Ct.id,"user"),directoryUrl:this.directory.getDirectoryUrl(Ct.id,"user"),displayName:Ct.username,id:Ct.id,profile:Ct.profile,type:"user"})),At=Rt.groups.visibles.filter(({name:Ct})=>StringUtils.removeAccents(Ct||"").toLowerCase().includes(Et)).map(Ct=>({avatarUrl:this.directory.getAvatarUrl(Ct.id,"group"),directoryUrl:this.directory.getDirectoryUrl(Ct.id,"group"),displayName:Ct.name,id:Ct.id,type:"group"}));return[...(await this.directory.getBookMarks()).filter(({displayName:Ct})=>StringUtils.removeAccents(Ct||"").toLowerCase().includes(Et)).map(Ct=>({avatarUrl:"",directoryUrl:"",profile:"",displayName:Ct.displayName,id:Ct.id,type:"sharebookmark"})),...St,...At]}async getShareMapping(dt){const ft=await this.cache.httpGetJson(`/${dt}/rights/sharing`);for(const vt of Object.keys(ft))if(vt.includes(".")){const Et=vt.split(".")[1],Rt=ft[vt];delete ft[vt],ft[Et]=Rt}return ft}getActionsAvailableFor({id:dt,type:ft},vt,Et){const Rt=(ft==="user"?vt.users.checked[dt]:vt.groups.checked[dt])||[],St=Object.keys(Et),At=[];for(const Ct of St)Et[Ct].filter(kt=>Rt.includes(kt)).length>0&&At.push(Ct);return At}async getRightsForResource(dt,ft){const vt=await this.directory.getBookMarks(),Et=this.context.resource(dt,dt).getShareReadUrl(ft),Rt=await this.cache.httpGetJson(Et),St=await this.getShareMapping(dt),At=await this.cache.httpGetJson("/infra/public/json/sharing-rights.json"),Ct=Object.keys(Rt.users.checked).map(Dt=>Rt.users.visibles.find(Ut=>Ut.id===Dt)).filter(Dt=>Dt!==void 0).map(Dt=>{const Ut=this.getActionsAvailableFor({id:Dt.id,type:"user"},Rt,St);return{id:Dt.id,type:"user",displayName:Dt.username,profile:Dt.profile,avatarUrl:this.directory.getAvatarUrl(Dt.id,"user"),directoryUrl:this.directory.getDirectoryUrl(Dt.id,"user"),actions:Ut.map(zt=>{const Zt=At[zt];return{displayName:zt,id:zt,priority:Zt.priority}})}}).sort((Dt,Ut)=>(Dt.displayName||"").localeCompare(Ut.displayName)),kt=Object.keys(Rt.groups.checked).map(Dt=>Rt.groups.visibles.find(Ut=>Ut.id===Dt)).filter(Dt=>Dt!==void 0).map(Dt=>{const Ut=this.getActionsAvailableFor({id:Dt.id,type:"group"},Rt,St);return{id:Dt.id,type:"group",displayName:Dt.name,profile:void 0,avatarUrl:this.directory.getAvatarUrl(Dt.id,"group"),directoryUrl:this.directory.getDirectoryUrl(Dt.id,"group"),actions:Ut.map(zt=>{const Zt=At[zt];return{displayName:zt,id:zt,priority:Zt.priority}})}}).sort((Dt,Ut)=>(Dt.displayName||"").localeCompare(Ut.displayName)),Tt=[...Ct,...kt],Nt=Rt.groups.visibles.map(({groupDisplayName:Dt,id:Ut,name:zt})=>({displayName:Dt||zt,id:Ut})),Ft=Rt.users.visibles.map(({id:Dt,profile:Ut,username:zt,firstName:Zt,lastName:Ht,login:Bt})=>({displayName:zt,firstName:Zt,lastName:Ht,login:Bt,profile:Ut,id:Dt}));return{rights:Tt,visibleBookmarks:vt,visibleGroups:Nt,visibleUsers:Ft}}async saveRights(dt,ft,vt){const Et=await this.getShareMapping(dt),Rt={bookmarks:{},groups:{},users:{}};for(const Ct of vt){const kt=Ct.actions.map(Nt=>Et[Nt.id]).reduce((Nt,Ft)=>[...Nt,...Ft],[]),Tt=[...new Set(kt)];Tt.length>0&&(Ct.type==="user"?Rt.users[Ct.id]=Tt:Ct.type==="group"?Rt.groups[Ct.id]=Tt:Rt.bookmarks[Ct.id]=Tt)}const St=this.context.resource(dt,dt),At=St.getSaveShareUrl(ft);return this.cache.clearCache(St.getShareReadUrl(ft)),await this.http.putJson(At,Rt)}async getActionsForApp(dt){const ft=await this.cache.httpGetJson("/infra/public/json/sharing-rights.json"),vt=await this.getShareMapping(dt);return Object.keys(ft).map(Et=>{const Rt=ft[Et];return{displayName:Et,id:Et,priority:Rt.priority,requires:Rt.requires}}).filter(Et=>{var Rt;return((Rt=vt[Et.id])==null?void 0:Rt.length)>0}).sort((Et,Rt)=>Et.priority-Rt.priority)}}const S$3=class{constructor(){m$5(this,"wordExtensions",new Set),m$5(this,"excelExtensions",new Set),m$5(this,"pptExtensions",new Set),m$5(this,"fileExtensionMap",new Map),m$5(this,"csvContentType",new Set),m$5(this,"csvExtensions",new Set),m$5(this,"txtExtensions",new Set),m$5(this,"PDF","application/pdf"),m$5(this,"OCTET_STREAM","application/octet-stream"),this.txtExtensions.add("txt"),this.wordExtensions.add("doc"),this.wordExtensions.add("dot"),this.wordExtensions.add("docx"),this.wordExtensions.add("dotx"),this.wordExtensions.add("docm"),this.wordExtensions.add("dotm"),this.wordExtensions.add("odt"),this.wordExtensions.add("ott"),this.wordExtensions.add("oth"),this.wordExtensions.add("odm"),this.excelExtensions.add("xls"),this.excelExtensions.add("xlt"),this.excelExtensions.add("xla"),this.excelExtensions.add("xlsx"),this.excelExtensions.add("xltx"),this.excelExtensions.add("xlsm"),this.excelExtensions.add("xltm"),this.excelExtensions.add("xlam"),this.excelExtensions.add("xlsb"),this.excelExtensions.add("ods"),this.excelExtensions.add("ots"),this.pptExtensions.add("ppt"),this.pptExtensions.add("pot"),this.pptExtensions.add("pps"),this.pptExtensions.add("ppa"),this.pptExtensions.add("pptx"),this.pptExtensions.add("potx"),this.pptExtensions.add("ppsx"),this.pptExtensions.add("ppam"),this.pptExtensions.add("pptm"),this.pptExtensions.add("potm"),this.pptExtensions.add("ppsm"),this.pptExtensions.add("odp"),this.pptExtensions.add("otp"),this.csvExtensions.add("csv"),this.fileExtensionMap.set("doc","application/msword"),this.fileExtensionMap.set("dot","application/msword"),this.fileExtensionMap.set("docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"),this.fileExtensionMap.set("dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"),this.fileExtensionMap.set("docm","application/vnd.ms-word.document.macroEnabled.12"),this.fileExtensionMap.set("dotm","application/vnd.ms-word.template.macroEnabled.12"),this.fileExtensionMap.set("xls","application/vnd.ms-excel"),this.fileExtensionMap.set("xlt","application/vnd.ms-excel"),this.fileExtensionMap.set("xla","application/vnd.ms-excel"),this.fileExtensionMap.set("xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),this.fileExtensionMap.set("xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"),this.fileExtensionMap.set("xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"),this.fileExtensionMap.set("xltm","application/vnd.ms-excel.template.macroEnabled.12"),this.fileExtensionMap.set("xlam","application/vnd.ms-excel.addin.macroEnabled.12"),this.fileExtensionMap.set("xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"),this.fileExtensionMap.set("ppt","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pot","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pps","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("ppa","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"),this.fileExtensionMap.set("potx","application/vnd.openxmlformats-officedocument.presentationml.template"),this.fileExtensionMap.set("ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"),this.fileExtensionMap.set("ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"),this.fileExtensionMap.set("pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"),this.fileExtensionMap.set("potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"),this.fileExtensionMap.set("ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"),this.fileExtensionMap.set("odt","application/vnd.oasis.opendocument.text"),this.fileExtensionMap.set("ott","application/vnd.oasis.opendocument.text-template"),this.fileExtensionMap.set("oth","application/vnd.oasis.opendocument.text-web"),this.fileExtensionMap.set("odm","application/vnd.oasis.opendocument.text-master"),this.fileExtensionMap.set("odg","application/vnd.oasis.opendocument.graphics"),this.fileExtensionMap.set("otg","application/vnd.oasis.opendocument.graphics-template"),this.fileExtensionMap.set("odp","application/vnd.oasis.opendocument.presentation"),this.fileExtensionMap.set("otp","application/vnd.oasis.opendocument.presentation-template"),this.fileExtensionMap.set("ods","application/vnd.oasis.opendocument.spreadsheet"),this.fileExtensionMap.set("ots","application/vnd.oasis.opendocument.spreadsheet-template"),this.fileExtensionMap.set("odc","application/vnd.oasis.opendocument.chart"),this.fileExtensionMap.set("odf","application/vnd.oasis.opendocument.formula"),this.fileExtensionMap.set("odb","application/vnd.oasis.opendocument.database"),this.fileExtensionMap.set("odi","application/vnd.oasis.opendocument.image"),this.fileExtensionMap.set("oxt","application/vnd.openofficeorg.extension"),this.fileExtensionMap.set("txt","text/plain"),this.csvContentType.add("text/comma-separated-values"),this.csvContentType.add("text/csv"),this.csvContentType.add("application/csv")}getContentTypeForExtension(dt){if(this.fileExtensionMap.has(dt))return this.fileExtensionMap.get(dt)}getExtensionForContentType(dt){for(const ft of Array.from(this.fileExtensionMap.keys()))if((this.fileExtensionMap.get(ft)||"").toLowerCase()==(dt||"").toLowerCase())return ft;return null}isWordLike(dt,ft){const vt=this.getExtensionForContentType(dt);return vt?this.wordExtensions.has(vt):dt==this.OCTET_STREAM&&ft?this.wordExtensions.has(ft):!1}isExcelLike(dt,ft){const vt=this.getExtensionForContentType(dt);return vt?this.excelExtensions.has(vt):dt==this.OCTET_STREAM&&ft?this.excelExtensions.has(ft):!1}isCsvLike(dt,ft){return this.csvContentType.has(dt)?!0:dt==this.OCTET_STREAM&&ft?this.csvExtensions.has(ft):!1}isPowerpointLike(dt,ft){const vt=this.getExtensionForContentType(dt);return vt?this.pptExtensions.has(vt):dt==this.OCTET_STREAM&&ft?this.pptExtensions.has(ft):!1}isTxtLike(dt,ft){const vt=this.getExtensionForContentType(dt);return vt?this.txtExtensions.has(vt):dt==this.OCTET_STREAM&&ft?this.txtExtensions.has(ft):!1}};let MimeTypeUtils=S$3;m$5(MimeTypeUtils,"INSTANCE",new S$3);class FileTypeUtils{static registerContentTypeToFileType(dt){this.fileTypes.push(dt)}static getFileType(dt,ft=!1,vt){if(vt&&(vt=vt.trim()),!dt)return"unknown";this.fileTypes||console.warn("[Element.role] should not have emptyRoles",this);for(let Rt of this.fileTypes||[]){const St=Rt(dt,ft);if(St)return St}const Et={csv:function(Rt){return!!MimeTypeUtils.INSTANCE.isCsvLike(Rt,vt)},doc:function(Rt){return MimeTypeUtils.INSTANCE.isWordLike(Rt,vt)?!0:Rt.indexOf("document")!==-1&&Rt.indexOf("wordprocessing")!==-1},xls:function(Rt){return MimeTypeUtils.INSTANCE.isExcelLike(Rt,vt)?!0:Rt.indexOf("document")!==-1&&Rt.indexOf("spreadsheet")!==-1||Rt.indexOf("ms-excel")!==-1},img:function(Rt){return Rt.indexOf("image")!==-1},pdf:function(Rt){return Rt.indexOf("pdf")!==-1||Rt==="application/x-download"},ppt:function(Rt){return MimeTypeUtils.INSTANCE.isPowerpointLike(Rt,vt)?!0:Rt.indexOf("document")!==-1&&Rt.indexOf("presentation")!==-1||Rt.indexOf("powerpoint")!==-1},txt:function(Rt){return MimeTypeUtils.INSTANCE.isTxtLike(Rt,vt)},video:function(Rt){return Rt.indexOf("video")!==-1},audio:function(Rt){return Rt.indexOf("audio")!==-1},zip:function(Rt){return Rt.indexOf("zip")!==-1||Rt.indexOf("rar")!==-1||Rt.indexOf("tar")!==-1||Rt.indexOf("7z")!==-1}};for(let Rt in Et)if(Et[Rt](dt))return Rt;return"unknown"}}m$5(FileTypeUtils,"fileTypes",[]);class WorkspaceService{constructor(dt){this.context=dt}get http(){return this.context.http()}async saveFile(dt,ft){const vt=dt.name||"",Et=vt.split("."),Rt=dt.type||"application/octet-stream",St=Et.length>1?Et[Et.length-1]:"",At={"content-type":Rt,filename:vt,size:dt.size,extension:St,role:FileTypeUtils.getFileType(Rt,!1,St)},Ct=vt.replace("."+At.extension,""),kt=At.extension?Ct+"."+At.extension:Ct,Tt=new FormData;Tt.append("file",dt,kt);const Nt=[];return((ft==null?void 0:ft.visibility)==="public"||(ft==null?void 0:ft.visibility)==="protected")&&Nt.push(`${ft.visibility}=true`),ft!=null&&ft.application&&Nt.push(`application=${ft.application}`),At.role==="img"&&Nt.push("quality=1"),ft!=null&&ft.parentId&&Nt.push(`parentId=${ft.parentId}`),await this.http.postFile(`/workspace/document?${Nt.join("&")}`,Tt)}}const bundle={},promises={},defaultDiacriticsRemovalMap=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];class IdiomService{constructor(dt){this.context=dt}get http(){return this.context.http()}async getIdiom(dt,ft){await Promise.all([this.addBundlePromise(dt,"/i18n"),this.addBundlePromise(dt,`/${ft}/i18n`)])}translate(dt,ft){dt=dt??"";let vt=bundle[dt]===void 0?dt:bundle[dt];if(ft&&typeof ft=="object")for(let Et in ft)typeof ft[Et]<"u"&&(vt=vt.replace(new RegExp("\\${"+Et+"}","g"),""+ft[Et]));return vt}addBundlePromise(dt,ft){return this.loadBundlePromise(dt,ft)}addBundle(dt,ft,vt){this.loadBundle(dt,ft,vt)}loadBundlePromise(dt,ft){return this.loadBundle(dt,ft),promises[ft]}loadBundle(dt,ft,vt){const Et=promises[ft];if(Et)vt&&Et.then(vt).catch(vt);else{const Rt=new Promisified;promises[ft]=Rt.promise;const St={};dt&&(St["Accept-Language"]=dt),this.http.get(ft,{headers:St}).then(At=>{Object.assign(bundle,At),typeof vt=="function"&&vt(),Rt.resolve()}).catch(At=>{typeof vt=="function"&&vt(),Rt.reject()})}}addTranslations(dt,ft){notify.onLangReady().promise.then(vt=>{this.loadBundle(vt,dt+"/"+vt+".json",ft)})}addAllTranslations(dt){return dt&&dt.length>0?notify.onLangReady().promise.then(ft=>Promise.all(dt.map(vt=>this.loadBundlePromise(ft,vt+"/"+ft+".json")))).then(()=>{}):Promise.reject()}addKeys(dt){for(var ft in dt)typeof bundle[ft]!="string"&&(bundle[ft]=dt[ft])}removeAccents(dt){for(var ft=0;ft<defaultDiacriticsRemovalMap.length;ft++)dt=dt.replace(defaultDiacriticsRemovalMap[ft].letters,defaultDiacriticsRemovalMap[ft].base);return dt}}let ATTag;class AnalyticsService{constructor(lt){this.context=lt}get http(){return this.context.http()}get session(){return this.context.session()}async trackPageLoad(lt,dt){const[ft]=await Promise.all([this.getXitiConfig(dt.name.toLowerCase()),this.loadXitiScript()]);if(!ft||!ATInternet)return;let vt=ft.LIBELLE_SERVICE.default||null;for(let Et in ft.LIBELLE_SERVICE)if(Et!=="default"&&lt.indexOf(Et)>=0){vt=ft.LIBELLE_SERVICE[Et];break}ATTag=new ATInternet.Tracker.Tag({site:ft.STRUCT_ID}),ATTag.setProps({SERVICE:vt,TYPE:ft.TYPE,OUTIL:ft.OUTIL,UAI:ft.STRUCT_UAI,PROJET:ft.PROJET,EXPLOITANT:ft.EXPLOITANT,PLATEFORME:ft.PLATFORME,PROFIL:ft.PROFILE},!0),ATTag.identifiedVisitor.set({id:ft.ID_PERSO,category:ft.PROFILE}),ATTag.page.set({name:(dt==null?void 0:dt.prefix)==="userbook"?"directory":dt==null?void 0:dt.prefix,chapter1:"",chapter2:"",chapter3:"",level2:ft.STRUCT_UAI}),ATTag.dispatch()}async getXitiConfig(lt){const[dt,ft]=await Promise.all([this.http.get("/analyticsConf"),this.http.get("/xiti/config")]);if(!(dt!=null&&dt.type))throw ERROR_CODE.MALFORMED_DATA;return ft!=null&&ft.active&&(dt.xiti=await this.getXitiTrackingParams(ft,lt)),dt.xiti}async loadXitiScript(){if(typeof ATInternet>"u"){const scriptPath="/xiti/public/js/lib/smarttag_ENT.js",response=await this.http.get(scriptPath,{headers:{Accept:"application/javascript"}});if(this.http.latestResponse.status!=200)throw"Error while loading XiTi script";eval(response)}}async getXitiTrackingParams(lt,dt){var ft;if(!lt.structureMap||!dt)return;const vt=await this.session.getUser(),Et=await this.session.getUserProfile();let Rt;if(!(vt!=null&&vt.structures))return;for(let Tt of vt.structures){const Nt=lt.structureMap[Tt];if(Nt&&Nt.collectiviteId&&Nt.UAI){Rt=Nt;break}}if(!Rt||!Rt.active)return;const St=await configure.Platform.apps.getPublicConf(dt);if(!St)return;const At=St.xiti;if(!At||!At.LIBELLE_SERVICE||!Rt.UAI)return;function Ct(Tt){let Nt="";for(let Ft=0;Ft<Tt.length;Ft++)Nt+=Tt.charCodeAt(Ft);return Nt}const kt={Student:"ELEVE",Teacher:"ENSEIGNANT",Relative:"PARENT",Personnel:"ADMIN_VIE_SCOL_TECH",Guest:"AUTRE"};return{LIBELLE_SERVICE:At.LIBELLE_SERVICE,TYPE:At.OUTIL?"TIERS":"NATIF",OUTIL:At.OUTIL?At.OUTIL:"",STRUCT_ID:Rt.collectiviteId,STRUCT_UAI:Rt.UAI,PROJET:Rt.projetId?Rt.projetId:lt.ID_PROJET,EXPLOITANT:lt.ID_EXPLOITANT,PLATFORME:Rt.plateformeId?Rt.plateformeId:lt.ID_PLATEFORME,ID_PERSO:Ct(vt.userId),PROFILE:Et&&Et.length>0&&(ft=kt[Et[0]])!=null?ft:""}}}class OdeServices{constructor(){m$5(this,"_analytics"),m$5(this,"_cache"),m$5(this,"_conf"),m$5(this,"_directory"),m$5(this,"_http"),m$5(this,"_idiom"),m$5(this,"_rights"),m$5(this,"_session"),m$5(this,"_share"),m$5(this,"_workspace"),this._analytics=new AnalyticsService(this),this._cache=new CacheService(this),this._conf=new ConfService(this),this._directory=new DirectoryService(this),this._http=new HttpService(this),this._idiom=new IdiomService(this),this._rights=new RightService(this),this._session=new SessionService(this),this._share=new ShareService(this),this._workspace=new WorkspaceService(this)}analytics(){return this._analytics}cache(){return this._cache}conf(){return this._conf}directory(){return this._directory}http(){return this._http}idiom(){return this._idiom}resource(dt,ft){return ft?ResourceService.findService({application:dt,resourceType:ft},this):ResourceService.findMainService({application:dt},this)}rights(){return this._rights}session(){return this._session}share(){return this._share}workspace(){return this._workspace}}const odeServices=new OdeServices;class Subscribable{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(dt){const ft={listener:dt};return this.listeners.add(ft),this.onSubscribe(),()=>{this.listeners.delete(ft),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}const isServer=typeof window>"u"||"Deno"in window;function noop$1(){}function functionalUpdate(lt,dt){return typeof lt=="function"?lt(dt):lt}function isValidTimeout(lt){return typeof lt=="number"&&lt>=0&&lt!==1/0}function timeUntilStale(lt,dt){return Math.max(lt+(dt||0)-Date.now(),0)}function parseQueryArgs(lt,dt,ft){return isQueryKey(lt)?typeof dt=="function"?{...ft,queryKey:lt,queryFn:dt}:{...dt,queryKey:lt}:lt}function parseMutationArgs(lt,dt,ft){return isQueryKey(lt)?typeof dt=="function"?{...ft,mutationKey:lt,mutationFn:dt}:{...dt,mutationKey:lt}:typeof lt=="function"?{...dt,mutationFn:lt}:{...lt}}function parseFilterArgs(lt,dt,ft){return isQueryKey(lt)?[{...dt,queryKey:lt},ft]:[lt||{},dt]}function matchQuery(lt,dt){const{type:ft="all",exact:vt,fetchStatus:Et,predicate:Rt,queryKey:St,stale:At}=lt;if(isQueryKey(St)){if(vt){if(dt.queryHash!==hashQueryKeyByOptions(St,dt.options))return!1}else if(!partialMatchKey(dt.queryKey,St))return!1}if(ft!=="all"){const Ct=dt.isActive();if(ft==="active"&&!Ct||ft==="inactive"&&Ct)return!1}return!(typeof At=="boolean"&&dt.isStale()!==At||typeof Et<"u"&&Et!==dt.state.fetchStatus||Rt&&!Rt(dt))}function matchMutation(lt,dt){const{exact:ft,fetching:vt,predicate:Et,mutationKey:Rt}=lt;if(isQueryKey(Rt)){if(!dt.options.mutationKey)return!1;if(ft){if(hashQueryKey(dt.options.mutationKey)!==hashQueryKey(Rt))return!1}else if(!partialMatchKey(dt.options.mutationKey,Rt))return!1}return!(typeof vt=="boolean"&&dt.state.status==="loading"!==vt||Et&&!Et(dt))}function hashQueryKeyByOptions(lt,dt){return((dt==null?void 0:dt.queryKeyHashFn)||hashQueryKey)(lt)}function hashQueryKey(lt){return JSON.stringify(lt,(dt,ft)=>isPlainObject(ft)?Object.keys(ft).sort().reduce((vt,Et)=>(vt[Et]=ft[Et],vt),{}):ft)}function partialMatchKey(lt,dt){return partialDeepEqual(lt,dt)}function partialDeepEqual(lt,dt){return lt===dt?!0:typeof lt!=typeof dt?!1:lt&&dt&&typeof lt=="object"&&typeof dt=="object"?!Object.keys(dt).some(ft=>!partialDeepEqual(lt[ft],dt[ft])):!1}function replaceEqualDeep(lt,dt){if(lt===dt)return lt;const ft=isPlainArray(lt)&&isPlainArray(dt);if(ft||isPlainObject(lt)&&isPlainObject(dt)){const vt=ft?lt.length:Object.keys(lt).length,Et=ft?dt:Object.keys(dt),Rt=Et.length,St=ft?[]:{};let At=0;for(let Ct=0;Ct<Rt;Ct++){const kt=ft?Ct:Et[Ct];St[kt]=replaceEqualDeep(lt[kt],dt[kt]),St[kt]===lt[kt]&&At++}return vt===Rt&&At===vt?lt:St}return dt}function shallowEqualObjects(lt,dt){if(lt&&!dt||dt&&!lt)return!1;for(const ft in lt)if(lt[ft]!==dt[ft])return!1;return!0}function isPlainArray(lt){return Array.isArray(lt)&&lt.length===Object.keys(lt).length}function isPlainObject(lt){if(!hasObjectPrototype(lt))return!1;const dt=lt.constructor;if(typeof dt>"u")return!0;const ft=dt.prototype;return!(!hasObjectPrototype(ft)||!ft.hasOwnProperty("isPrototypeOf"))}function hasObjectPrototype(lt){return Object.prototype.toString.call(lt)==="[object Object]"}function isQueryKey(lt){return Array.isArray(lt)}function sleep(lt){return new Promise(dt=>{setTimeout(dt,lt)})}function scheduleMicrotask(lt){sleep(0).then(lt)}function getAbortController(){if(typeof AbortController=="function")return new AbortController}function replaceData(lt,dt,ft){return ft.isDataEqual!=null&&ft.isDataEqual(lt,dt)?lt:typeof ft.structuralSharing=="function"?ft.structuralSharing(lt,dt):ft.structuralSharing!==!1?replaceEqualDeep(lt,dt):dt}class FocusManager extends Subscribable{constructor(){super(),this.setup=dt=>{if(!isServer&&window.addEventListener){const ft=()=>dt();return window.addEventListener("visibilitychange",ft,!1),window.addEventListener("focus",ft,!1),()=>{window.removeEventListener("visibilitychange",ft),window.removeEventListener("focus",ft)}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var dt;(dt=this.cleanup)==null||dt.call(this),this.cleanup=void 0}}setEventListener(dt){var ft;this.setup=dt,(ft=this.cleanup)==null||ft.call(this),this.cleanup=dt(vt=>{typeof vt=="boolean"?this.setFocused(vt):this.onFocus()})}setFocused(dt){this.focused=dt,dt&&this.onFocus()}onFocus(){this.listeners.forEach(({listener:dt})=>{dt()})}isFocused(){return typeof this.focused=="boolean"?this.focused:typeof document>"u"?!0:[void 0,"visible","prerender"].includes(document.visibilityState)}}const focusManager=new FocusManager,onlineEvents=["online","offline"];class OnlineManager extends Subscribable{constructor(){super(),this.setup=dt=>{if(!isServer&&window.addEventListener){const ft=()=>dt();return onlineEvents.forEach(vt=>{window.addEventListener(vt,ft,!1)}),()=>{onlineEvents.forEach(vt=>{window.removeEventListener(vt,ft)})}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var dt;(dt=this.cleanup)==null||dt.call(this),this.cleanup=void 0}}setEventListener(dt){var ft;this.setup=dt,(ft=this.cleanup)==null||ft.call(this),this.cleanup=dt(vt=>{typeof vt=="boolean"?this.setOnline(vt):this.onOnline()})}setOnline(dt){this.online=dt,dt&&this.onOnline()}onOnline(){this.listeners.forEach(({listener:dt})=>{dt()})}isOnline(){return typeof this.online=="boolean"?this.online:typeof navigator>"u"||typeof navigator.onLine>"u"?!0:navigator.onLine}}const onlineManager=new OnlineManager;function defaultRetryDelay(lt){return Math.min(1e3*2**lt,3e4)}function canFetch(lt){return(lt??"online")==="online"?onlineManager.isOnline():!0}class CancelledError{constructor(dt){this.revert=dt==null?void 0:dt.revert,this.silent=dt==null?void 0:dt.silent}}function isCancelledError(lt){return lt instanceof CancelledError}function createRetryer(lt){let dt=!1,ft=0,vt=!1,Et,Rt,St;const At=new Promise((Zt,Ht)=>{Rt=Zt,St=Ht}),Ct=Zt=>{vt||(Dt(new CancelledError(Zt)),lt.abort==null||lt.abort())},kt=()=>{dt=!0},Tt=()=>{dt=!1},Nt=()=>!focusManager.isFocused()||lt.networkMode!=="always"&&!onlineManager.isOnline(),Ft=Zt=>{vt||(vt=!0,lt.onSuccess==null||lt.onSuccess(Zt),Et==null||Et(),Rt(Zt))},Dt=Zt=>{vt||(vt=!0,lt.onError==null||lt.onError(Zt),Et==null||Et(),St(Zt))},Ut=()=>new Promise(Zt=>{Et=Ht=>{const Bt=vt||!Nt();return Bt&&Zt(Ht),Bt},lt.onPause==null||lt.onPause()}).then(()=>{Et=void 0,vt||lt.onContinue==null||lt.onContinue()}),zt=()=>{if(vt)return;let Zt;try{Zt=lt.fn()}catch(Ht){Zt=Promise.reject(Ht)}Promise.resolve(Zt).then(Ft).catch(Ht=>{var Bt,Wt;if(vt)return;const Kt=(Bt=lt.retry)!=null?Bt:3,ar=(Wt=lt.retryDelay)!=null?Wt:defaultRetryDelay,rr=typeof ar=="function"?ar(ft,Ht):ar,ur=Kt===!0||typeof Kt=="number"&&ft<Kt||typeof Kt=="function"&&Kt(ft,Ht);if(dt||!ur){Dt(Ht);return}ft++,lt.onFail==null||lt.onFail(ft,Ht),sleep(rr).then(()=>{if(Nt())return Ut()}).then(()=>{dt?Dt(Ht):zt()})})};return canFetch(lt.networkMode)?zt():Ut().then(zt),{promise:At,cancel:Ct,continue:()=>(Et==null?void 0:Et())?At:Promise.resolve(),cancelRetry:kt,continueRetry:Tt}}const defaultLogger=console;function createNotifyManager(){let lt=[],dt=0,ft=Tt=>{Tt()},vt=Tt=>{Tt()};const Et=Tt=>{let Nt;dt++;try{Nt=Tt()}finally{dt--,dt||At()}return Nt},Rt=Tt=>{dt?lt.push(Tt):scheduleMicrotask(()=>{ft(Tt)})},St=Tt=>(...Nt)=>{Rt(()=>{Tt(...Nt)})},At=()=>{const Tt=lt;lt=[],Tt.length&&scheduleMicrotask(()=>{vt(()=>{Tt.forEach(Nt=>{ft(Nt)})})})};return{batch:Et,batchCalls:St,schedule:Rt,setNotifyFunction:Tt=>{ft=Tt},setBatchNotifyFunction:Tt=>{vt=Tt}}}const notifyManager=createNotifyManager();class Removable{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.cacheTime)&&(this.gcTimeout=setTimeout(()=>{this.optionalRemove()},this.cacheTime))}updateCacheTime(dt){this.cacheTime=Math.max(this.cacheTime||0,dt??(isServer?1/0:5*60*1e3))}clearGcTimeout(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)}}class Query extends Removable{constructor(dt){super(),this.abortSignalConsumed=!1,this.defaultOptions=dt.defaultOptions,this.setOptions(dt.options),this.observers=[],this.cache=dt.cache,this.logger=dt.logger||defaultLogger,this.queryKey=dt.queryKey,this.queryHash=dt.queryHash,this.initialState=dt.state||getDefaultState$1(this.options),this.state=this.initialState,this.scheduleGc()}get meta(){return this.options.meta}setOptions(dt){this.options={...this.defaultOptions,...dt},this.updateCacheTime(this.options.cacheTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.cache.remove(this)}setData(dt,ft){const vt=replaceData(this.state.data,dt,this.options);return this.dispatch({data:vt,type:"success",dataUpdatedAt:ft==null?void 0:ft.updatedAt,manual:ft==null?void 0:ft.manual}),vt}setState(dt,ft){this.dispatch({type:"setState",state:dt,setStateOptions:ft})}cancel(dt){var ft;const vt=this.promise;return(ft=this.retryer)==null||ft.cancel(dt),vt?vt.then(noop$1).catch(noop$1):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.initialState)}isActive(){return this.observers.some(dt=>dt.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||this.observers.some(dt=>dt.getCurrentResult().isStale)}isStaleByTime(dt=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!timeUntilStale(this.state.dataUpdatedAt,dt)}onFocus(){var dt;const ft=this.observers.find(vt=>vt.shouldFetchOnWindowFocus());ft&&ft.refetch({cancelRefetch:!1}),(dt=this.retryer)==null||dt.continue()}onOnline(){var dt;const ft=this.observers.find(vt=>vt.shouldFetchOnReconnect());ft&&ft.refetch({cancelRefetch:!1}),(dt=this.retryer)==null||dt.continue()}addObserver(dt){this.observers.includes(dt)||(this.observers.push(dt),this.clearGcTimeout(),this.cache.notify({type:"observerAdded",query:this,observer:dt}))}removeObserver(dt){this.observers.includes(dt)&&(this.observers=this.observers.filter(ft=>ft!==dt),this.observers.length||(this.retryer&&(this.abortSignalConsumed?this.retryer.cancel({revert:!0}):this.retryer.cancelRetry()),this.scheduleGc()),this.cache.notify({type:"observerRemoved",query:this,observer:dt}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.dispatch({type:"invalidate"})}fetch(dt,ft){var vt,Et;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&ft!=null&&ft.cancelRefetch)this.cancel({silent:!0});else if(this.promise){var Rt;return(Rt=this.retryer)==null||Rt.continueRetry(),this.promise}}if(dt&&this.setOptions(dt),!this.options.queryFn){const Dt=this.observers.find(Ut=>Ut.options.queryFn);Dt&&this.setOptions(Dt.options)}Array.isArray(this.options.queryKey);const St=getAbortController(),At={queryKey:this.queryKey,pageParam:void 0,meta:this.meta},Ct=Dt=>{Object.defineProperty(Dt,"signal",{enumerable:!0,get:()=>{if(St)return this.abortSignalConsumed=!0,St.signal}})};Ct(At);const kt=()=>this.options.queryFn?(this.abortSignalConsumed=!1,this.options.queryFn(At)):Promise.reject("Missing queryFn"),Tt={fetchOptions:ft,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:kt};if(Ct(Tt),(vt=this.options.behavior)==null||vt.onFetch(Tt),this.revertState=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==((Et=Tt.fetchOptions)==null?void 0:Et.meta)){var Nt;this.dispatch({type:"fetch",meta:(Nt=Tt.fetchOptions)==null?void 0:Nt.meta})}const Ft=Dt=>{if(isCancelledError(Dt)&&Dt.silent||this.dispatch({type:"error",error:Dt}),!isCancelledError(Dt)){var Ut,zt,Zt,Ht;(Ut=(zt=this.cache.config).onError)==null||Ut.call(zt,Dt,this),(Zt=(Ht=this.cache.config).onSettled)==null||Zt.call(Ht,this.state.data,Dt,this)}this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.retryer=createRetryer({fn:Tt.fetchFn,abort:St==null?void 0:St.abort.bind(St),onSuccess:Dt=>{var Ut,zt,Zt,Ht;if(typeof Dt>"u"){Ft(new Error(this.queryHash+" data is undefined"));return}this.setData(Dt),(Ut=(zt=this.cache.config).onSuccess)==null||Ut.call(zt,Dt,this),(Zt=(Ht=this.cache.config).onSettled)==null||Zt.call(Ht,Dt,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:Ft,onFail:(Dt,Ut)=>{this.dispatch({type:"failed",failureCount:Dt,error:Ut})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:Tt.options.retry,retryDelay:Tt.options.retryDelay,networkMode:Tt.options.networkMode}),this.promise=this.retryer.promise,this.promise}dispatch(dt){const ft=vt=>{var Et,Rt;switch(dt.type){case"failed":return{...vt,fetchFailureCount:dt.failureCount,fetchFailureReason:dt.error};case"pause":return{...vt,fetchStatus:"paused"};case"continue":return{...vt,fetchStatus:"fetching"};case"fetch":return{...vt,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:(Et=dt.meta)!=null?Et:null,fetchStatus:canFetch(this.options.networkMode)?"fetching":"paused",...!vt.dataUpdatedAt&&{error:null,status:"loading"}};case"success":return{...vt,data:dt.data,dataUpdateCount:vt.dataUpdateCount+1,dataUpdatedAt:(Rt=dt.dataUpdatedAt)!=null?Rt:Date.now(),error:null,isInvalidated:!1,status:"success",...!dt.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const St=dt.error;return isCancelledError(St)&&St.revert&&this.revertState?{...this.revertState}:{...vt,error:St,errorUpdateCount:vt.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:vt.fetchFailureCount+1,fetchFailureReason:St,fetchStatus:"idle",status:"error"};case"invalidate":return{...vt,isInvalidated:!0};case"setState":return{...vt,...dt.state}}};this.state=ft(this.state),notifyManager.batch(()=>{this.observers.forEach(vt=>{vt.onQueryUpdate(dt)}),this.cache.notify({query:this,type:"updated",action:dt})})}}function getDefaultState$1(lt){const dt=typeof lt.initialData=="function"?lt.initialData():lt.initialData,ft=typeof dt<"u",vt=ft?typeof lt.initialDataUpdatedAt=="function"?lt.initialDataUpdatedAt():lt.initialDataUpdatedAt:0;return{data:dt,dataUpdateCount:0,dataUpdatedAt:ft?vt??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:ft?"success":"loading",fetchStatus:"idle"}}class QueryCache extends Subscribable{constructor(dt){super(),this.config=dt||{},this.queries=[],this.queriesMap={}}build(dt,ft,vt){var Et;const Rt=ft.queryKey,St=(Et=ft.queryHash)!=null?Et:hashQueryKeyByOptions(Rt,ft);let At=this.get(St);return At||(At=new Query({cache:this,logger:dt.getLogger(),queryKey:Rt,queryHash:St,options:dt.defaultQueryOptions(ft),state:vt,defaultOptions:dt.getQueryDefaults(Rt)}),this.add(At)),At}add(dt){this.queriesMap[dt.queryHash]||(this.queriesMap[dt.queryHash]=dt,this.queries.push(dt),this.notify({type:"added",query:dt}))}remove(dt){const ft=this.queriesMap[dt.queryHash];ft&&(dt.destroy(),this.queries=this.queries.filter(vt=>vt!==dt),ft===dt&&delete this.queriesMap[dt.queryHash],this.notify({type:"removed",query:dt}))}clear(){notifyManager.batch(()=>{this.queries.forEach(dt=>{this.remove(dt)})})}get(dt){return this.queriesMap[dt]}getAll(){return this.queries}find(dt,ft){const[vt]=parseFilterArgs(dt,ft);return typeof vt.exact>"u"&&(vt.exact=!0),this.queries.find(Et=>matchQuery(vt,Et))}findAll(dt,ft){const[vt]=parseFilterArgs(dt,ft);return Object.keys(vt).length>0?this.queries.filter(Et=>matchQuery(vt,Et)):this.queries}notify(dt){notifyManager.batch(()=>{this.listeners.forEach(({listener:ft})=>{ft(dt)})})}onFocus(){notifyManager.batch(()=>{this.queries.forEach(dt=>{dt.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.queries.forEach(dt=>{dt.onOnline()})})}}class Mutation extends Removable{constructor(dt){super(),this.defaultOptions=dt.defaultOptions,this.mutationId=dt.mutationId,this.mutationCache=dt.mutationCache,this.logger=dt.logger||defaultLogger,this.observers=[],this.state=dt.state||getDefaultState(),this.setOptions(dt.options),this.scheduleGc()}setOptions(dt){this.options={...this.defaultOptions,...dt},this.updateCacheTime(this.options.cacheTime)}get meta(){return this.options.meta}setState(dt){this.dispatch({type:"setState",state:dt})}addObserver(dt){this.observers.includes(dt)||(this.observers.push(dt),this.clearGcTimeout(),this.mutationCache.notify({type:"observerAdded",mutation:this,observer:dt}))}removeObserver(dt){this.observers=this.observers.filter(ft=>ft!==dt),this.scheduleGc(),this.mutationCache.notify({type:"observerRemoved",mutation:this,observer:dt})}optionalRemove(){this.observers.length||(this.state.status==="loading"?this.scheduleGc():this.mutationCache.remove(this))}continue(){var dt,ft;return(dt=(ft=this.retryer)==null?void 0:ft.continue())!=null?dt:this.execute()}async execute(){const dt=()=>{var ur;return this.retryer=createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(this.state.variables):Promise.reject("No mutationFn found"),onFail:(sr,mr)=>{this.dispatch({type:"failed",failureCount:sr,error:mr})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:(ur=this.options.retry)!=null?ur:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.retryer.promise},ft=this.state.status==="loading";try{var vt,Et,Rt,St,At,Ct,kt,Tt;if(!ft){var Nt,Ft,Dt,Ut;this.dispatch({type:"loading",variables:this.options.variables}),await((Nt=(Ft=this.mutationCache.config).onMutate)==null?void 0:Nt.call(Ft,this.state.variables,this));const sr=await((Dt=(Ut=this.options).onMutate)==null?void 0:Dt.call(Ut,this.state.variables));sr!==this.state.context&&this.dispatch({type:"loading",context:sr,variables:this.state.variables})}const ur=await dt();return await((vt=(Et=this.mutationCache.config).onSuccess)==null?void 0:vt.call(Et,ur,this.state.variables,this.state.context,this)),await((Rt=(St=this.options).onSuccess)==null?void 0:Rt.call(St,ur,this.state.variables,this.state.context)),await((At=(Ct=this.mutationCache.config).onSettled)==null?void 0:At.call(Ct,ur,null,this.state.variables,this.state.context,this)),await((kt=(Tt=this.options).onSettled)==null?void 0:kt.call(Tt,ur,null,this.state.variables,this.state.context)),this.dispatch({type:"success",data:ur}),ur}catch(ur){try{var zt,Zt,Ht,Bt,Wt,Kt,ar,rr;throw await((zt=(Zt=this.mutationCache.config).onError)==null?void 0:zt.call(Zt,ur,this.state.variables,this.state.context,this)),await((Ht=(Bt=this.options).onError)==null?void 0:Ht.call(Bt,ur,this.state.variables,this.state.context)),await((Wt=(Kt=this.mutationCache.config).onSettled)==null?void 0:Wt.call(Kt,void 0,ur,this.state.variables,this.state.context,this)),await((ar=(rr=this.options).onSettled)==null?void 0:ar.call(rr,void 0,ur,this.state.variables,this.state.context)),ur}finally{this.dispatch({type:"error",error:ur})}}}dispatch(dt){const ft=vt=>{switch(dt.type){case"failed":return{...vt,failureCount:dt.failureCount,failureReason:dt.error};case"pause":return{...vt,isPaused:!0};case"continue":return{...vt,isPaused:!1};case"loading":return{...vt,context:dt.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!canFetch(this.options.networkMode),status:"loading",variables:dt.variables};case"success":return{...vt,data:dt.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...vt,data:void 0,error:dt.error,failureCount:vt.failureCount+1,failureReason:dt.error,isPaused:!1,status:"error"};case"setState":return{...vt,...dt.state}}};this.state=ft(this.state),notifyManager.batch(()=>{this.observers.forEach(vt=>{vt.onMutationUpdate(dt)}),this.mutationCache.notify({mutation:this,type:"updated",action:dt})})}}function getDefaultState(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0}}class MutationCache extends Subscribable{constructor(dt){super(),this.config=dt||{},this.mutations=[],this.mutationId=0}build(dt,ft,vt){const Et=new Mutation({mutationCache:this,logger:dt.getLogger(),mutationId:++this.mutationId,options:dt.defaultMutationOptions(ft),state:vt,defaultOptions:ft.mutationKey?dt.getMutationDefaults(ft.mutationKey):void 0});return this.add(Et),Et}add(dt){this.mutations.push(dt),this.notify({type:"added",mutation:dt})}remove(dt){this.mutations=this.mutations.filter(ft=>ft!==dt),this.notify({type:"removed",mutation:dt})}clear(){notifyManager.batch(()=>{this.mutations.forEach(dt=>{this.remove(dt)})})}getAll(){return this.mutations}find(dt){return typeof dt.exact>"u"&&(dt.exact=!0),this.mutations.find(ft=>matchMutation(dt,ft))}findAll(dt){return this.mutations.filter(ft=>matchMutation(dt,ft))}notify(dt){notifyManager.batch(()=>{this.listeners.forEach(({listener:ft})=>{ft(dt)})})}resumePausedMutations(){var dt;return this.resuming=((dt=this.resuming)!=null?dt:Promise.resolve()).then(()=>{const ft=this.mutations.filter(vt=>vt.state.isPaused);return notifyManager.batch(()=>ft.reduce((vt,Et)=>vt.then(()=>Et.continue().catch(noop$1)),Promise.resolve()))}).then(()=>{this.resuming=void 0}),this.resuming}}function infiniteQueryBehavior(){return{onFetch:lt=>{lt.fetchFn=()=>{var dt,ft,vt,Et,Rt,St;const At=(dt=lt.fetchOptions)==null||(ft=dt.meta)==null?void 0:ft.refetchPage,Ct=(vt=lt.fetchOptions)==null||(Et=vt.meta)==null?void 0:Et.fetchMore,kt=Ct==null?void 0:Ct.pageParam,Tt=(Ct==null?void 0:Ct.direction)==="forward",Nt=(Ct==null?void 0:Ct.direction)==="backward",Ft=((Rt=lt.state.data)==null?void 0:Rt.pages)||[],Dt=((St=lt.state.data)==null?void 0:St.pageParams)||[];let Ut=Dt,zt=!1;const Zt=rr=>{Object.defineProperty(rr,"signal",{enumerable:!0,get:()=>{var ur;if((ur=lt.signal)!=null&&ur.aborted)zt=!0;else{var sr;(sr=lt.signal)==null||sr.addEventListener("abort",()=>{zt=!0})}return lt.signal}})},Ht=lt.options.queryFn||(()=>Promise.reject("Missing queryFn")),Bt=(rr,ur,sr,mr)=>(Ut=mr?[ur,...Ut]:[...Ut,ur],mr?[sr,...rr]:[...rr,sr]),Wt=(rr,ur,sr,mr)=>{if(zt)return Promise.reject("Cancelled");if(typeof sr>"u"&&!ur&&rr.length)return Promise.resolve(rr);const dr={queryKey:lt.queryKey,pageParam:sr,meta:lt.options.meta};Zt(dr);const Sr=Ht(dr);return Promise.resolve(Sr).then(xr=>Bt(rr,sr,xr,mr))};let Kt;if(!Ft.length)Kt=Wt([]);else if(Tt){const rr=typeof kt<"u",ur=rr?kt:getNextPageParam(lt.options,Ft);Kt=Wt(Ft,rr,ur)}else if(Nt){const rr=typeof kt<"u",ur=rr?kt:getPreviousPageParam(lt.options,Ft);Kt=Wt(Ft,rr,ur,!0)}else{Ut=[];const rr=typeof lt.options.getNextPageParam>"u";Kt=(At&&Ft[0]?At(Ft[0],0,Ft):!0)?Wt([],rr,Dt[0]):Promise.resolve(Bt([],Dt[0],Ft[0]));for(let sr=1;sr<Ft.length;sr++)Kt=Kt.then(mr=>{if(At&&Ft[sr]?At(Ft[sr],sr,Ft):!0){const Sr=rr?Dt[sr]:getNextPageParam(lt.options,mr);return Wt(mr,rr,Sr)}return Promise.resolve(Bt(mr,Dt[sr],Ft[sr]))})}return Kt.then(rr=>({pages:rr,pageParams:Ut}))}}}}function getNextPageParam(lt,dt){return lt.getNextPageParam==null?void 0:lt.getNextPageParam(dt[dt.length-1],dt)}function getPreviousPageParam(lt,dt){return lt.getPreviousPageParam==null?void 0:lt.getPreviousPageParam(dt[0],dt)}function hasNextPage(lt,dt){if(lt.getNextPageParam&&Array.isArray(dt)){const ft=getNextPageParam(lt,dt);return typeof ft<"u"&&ft!==null&&ft!==!1}}function hasPreviousPage(lt,dt){if(lt.getPreviousPageParam&&Array.isArray(dt)){const ft=getPreviousPageParam(lt,dt);return typeof ft<"u"&&ft!==null&&ft!==!1}}class QueryClient{constructor(dt={}){this.queryCache=dt.queryCache||new QueryCache,this.mutationCache=dt.mutationCache||new MutationCache,this.logger=dt.logger||defaultLogger,this.defaultOptions=dt.defaultOptions||{},this.queryDefaults=[],this.mutationDefaults=[],this.mountCount=0}mount(){this.mountCount++,this.mountCount===1&&(this.unsubscribeFocus=focusManager.subscribe(()=>{focusManager.isFocused()&&(this.resumePausedMutations(),this.queryCache.onFocus())}),this.unsubscribeOnline=onlineManager.subscribe(()=>{onlineManager.isOnline()&&(this.resumePausedMutations(),this.queryCache.onOnline())}))}unmount(){var dt,ft;this.mountCount--,this.mountCount===0&&((dt=this.unsubscribeFocus)==null||dt.call(this),this.unsubscribeFocus=void 0,(ft=this.unsubscribeOnline)==null||ft.call(this),this.unsubscribeOnline=void 0)}isFetching(dt,ft){const[vt]=parseFilterArgs(dt,ft);return vt.fetchStatus="fetching",this.queryCache.findAll(vt).length}isMutating(dt){return this.mutationCache.findAll({...dt,fetching:!0}).length}getQueryData(dt,ft){var vt;return(vt=this.queryCache.find(dt,ft))==null?void 0:vt.state.data}ensureQueryData(dt,ft,vt){const Et=parseQueryArgs(dt,ft,vt),Rt=this.getQueryData(Et.queryKey);return Rt?Promise.resolve(Rt):this.fetchQuery(Et)}getQueriesData(dt){return this.getQueryCache().findAll(dt).map(({queryKey:ft,state:vt})=>{const Et=vt.data;return[ft,Et]})}setQueryData(dt,ft,vt){const Et=this.queryCache.find(dt),Rt=Et==null?void 0:Et.state.data,St=functionalUpdate(ft,Rt);if(typeof St>"u")return;const At=parseQueryArgs(dt),Ct=this.defaultQueryOptions(At);return this.queryCache.build(this,Ct).setData(St,{...vt,manual:!0})}setQueriesData(dt,ft,vt){return notifyManager.batch(()=>this.getQueryCache().findAll(dt).map(({queryKey:Et})=>[Et,this.setQueryData(Et,ft,vt)]))}getQueryState(dt,ft){var vt;return(vt=this.queryCache.find(dt,ft))==null?void 0:vt.state}removeQueries(dt,ft){const[vt]=parseFilterArgs(dt,ft),Et=this.queryCache;notifyManager.batch(()=>{Et.findAll(vt).forEach(Rt=>{Et.remove(Rt)})})}resetQueries(dt,ft,vt){const[Et,Rt]=parseFilterArgs(dt,ft,vt),St=this.queryCache,At={type:"active",...Et};return notifyManager.batch(()=>(St.findAll(Et).forEach(Ct=>{Ct.reset()}),this.refetchQueries(At,Rt)))}cancelQueries(dt,ft,vt){const[Et,Rt={}]=parseFilterArgs(dt,ft,vt);typeof Rt.revert>"u"&&(Rt.revert=!0);const St=notifyManager.batch(()=>this.queryCache.findAll(Et).map(At=>At.cancel(Rt)));return Promise.all(St).then(noop$1).catch(noop$1)}invalidateQueries(dt,ft,vt){const[Et,Rt]=parseFilterArgs(dt,ft,vt);return notifyManager.batch(()=>{var St,At;if(this.queryCache.findAll(Et).forEach(kt=>{kt.invalidate()}),Et.refetchType==="none")return Promise.resolve();const Ct={...Et,type:(St=(At=Et.refetchType)!=null?At:Et.type)!=null?St:"active"};return this.refetchQueries(Ct,Rt)})}refetchQueries(dt,ft,vt){const[Et,Rt]=parseFilterArgs(dt,ft,vt),St=notifyManager.batch(()=>this.queryCache.findAll(Et).filter(Ct=>!Ct.isDisabled()).map(Ct=>{var kt;return Ct.fetch(void 0,{...Rt,cancelRefetch:(kt=Rt==null?void 0:Rt.cancelRefetch)!=null?kt:!0,meta:{refetchPage:Et.refetchPage}})}));let At=Promise.all(St).then(noop$1);return Rt!=null&&Rt.throwOnError||(At=At.catch(noop$1)),At}fetchQuery(dt,ft,vt){const Et=parseQueryArgs(dt,ft,vt),Rt=this.defaultQueryOptions(Et);typeof Rt.retry>"u"&&(Rt.retry=!1);const St=this.queryCache.build(this,Rt);return St.isStaleByTime(Rt.staleTime)?St.fetch(Rt):Promise.resolve(St.state.data)}prefetchQuery(dt,ft,vt){return this.fetchQuery(dt,ft,vt).then(noop$1).catch(noop$1)}fetchInfiniteQuery(dt,ft,vt){const Et=parseQueryArgs(dt,ft,vt);return Et.behavior=infiniteQueryBehavior(),this.fetchQuery(Et)}prefetchInfiniteQuery(dt,ft,vt){return this.fetchInfiniteQuery(dt,ft,vt).then(noop$1).catch(noop$1)}resumePausedMutations(){return this.mutationCache.resumePausedMutations()}getQueryCache(){return this.queryCache}getMutationCache(){return this.mutationCache}getLogger(){return this.logger}getDefaultOptions(){return this.defaultOptions}setDefaultOptions(dt){this.defaultOptions=dt}setQueryDefaults(dt,ft){const vt=this.queryDefaults.find(Et=>hashQueryKey(dt)===hashQueryKey(Et.queryKey));vt?vt.defaultOptions=ft:this.queryDefaults.push({queryKey:dt,defaultOptions:ft})}getQueryDefaults(dt){if(!dt)return;const ft=this.queryDefaults.find(vt=>partialMatchKey(dt,vt.queryKey));return ft==null?void 0:ft.defaultOptions}setMutationDefaults(dt,ft){const vt=this.mutationDefaults.find(Et=>hashQueryKey(dt)===hashQueryKey(Et.mutationKey));vt?vt.defaultOptions=ft:this.mutationDefaults.push({mutationKey:dt,defaultOptions:ft})}getMutationDefaults(dt){if(!dt)return;const ft=this.mutationDefaults.find(vt=>partialMatchKey(dt,vt.mutationKey));return ft==null?void 0:ft.defaultOptions}defaultQueryOptions(dt){if(dt!=null&&dt._defaulted)return dt;const ft={...this.defaultOptions.queries,...this.getQueryDefaults(dt==null?void 0:dt.queryKey),...dt,_defaulted:!0};return!ft.queryHash&&ft.queryKey&&(ft.queryHash=hashQueryKeyByOptions(ft.queryKey,ft)),typeof ft.refetchOnReconnect>"u"&&(ft.refetchOnReconnect=ft.networkMode!=="always"),typeof ft.useErrorBoundary>"u"&&(ft.useErrorBoundary=!!ft.suspense),ft}defaultMutationOptions(dt){return dt!=null&&dt._defaulted?dt:{...this.defaultOptions.mutations,...this.getMutationDefaults(dt==null?void 0:dt.mutationKey),...dt,_defaulted:!0}}clear(){this.queryCache.clear(),this.mutationCache.clear()}}class QueryObserver extends Subscribable{constructor(dt,ft){super(),this.client=dt,this.options=ft,this.trackedProps=new Set,this.selectError=null,this.bindMethods(),this.setOptions(ft)}bindMethods(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.currentQuery.addObserver(this),shouldFetchOnMount(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(this.currentQuery,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(this.currentQuery,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.clearStaleTimeout(),this.clearRefetchInterval(),this.currentQuery.removeObserver(this)}setOptions(dt,ft){const vt=this.options,Et=this.currentQuery;if(this.options=this.client.defaultQueryOptions(dt),shallowEqualObjects(vt,this.options)||this.client.getQueryCache().notify({type:"observerOptionsUpdated",query:this.currentQuery,observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=vt.queryKey),this.updateQuery();const Rt=this.hasListeners();Rt&&shouldFetchOptionally(this.currentQuery,Et,this.options,vt)&&this.executeFetch(),this.updateResult(ft),Rt&&(this.currentQuery!==Et||this.options.enabled!==vt.enabled||this.options.staleTime!==vt.staleTime)&&this.updateStaleTimeout();const St=this.computeRefetchInterval();Rt&&(this.currentQuery!==Et||this.options.enabled!==vt.enabled||St!==this.currentRefetchInterval)&&this.updateRefetchInterval(St)}getOptimisticResult(dt){const ft=this.client.getQueryCache().build(this.client,dt);return this.createResult(ft,dt)}getCurrentResult(){return this.currentResult}trackResult(dt){const ft={};return Object.keys(dt).forEach(vt=>{Object.defineProperty(ft,vt,{configurable:!1,enumerable:!0,get:()=>(this.trackedProps.add(vt),dt[vt])})}),ft}getCurrentQuery(){return this.currentQuery}remove(){this.client.getQueryCache().remove(this.currentQuery)}refetch({refetchPage:dt,...ft}={}){return this.fetch({...ft,meta:{refetchPage:dt}})}fetchOptimistic(dt){const ft=this.client.defaultQueryOptions(dt),vt=this.client.getQueryCache().build(this.client,ft);return vt.isFetchingOptimistic=!0,vt.fetch().then(()=>this.createResult(vt,ft))}fetch(dt){var ft;return this.executeFetch({...dt,cancelRefetch:(ft=dt.cancelRefetch)!=null?ft:!0}).then(()=>(this.updateResult(),this.currentResult))}executeFetch(dt){this.updateQuery();let ft=this.currentQuery.fetch(this.options,dt);return dt!=null&&dt.throwOnError||(ft=ft.catch(noop$1)),ft}updateStaleTimeout(){if(this.clearStaleTimeout(),isServer||this.currentResult.isStale||!isValidTimeout(this.options.staleTime))return;const ft=timeUntilStale(this.currentResult.dataUpdatedAt,this.options.staleTime)+1;this.staleTimeoutId=setTimeout(()=>{this.currentResult.isStale||this.updateResult()},ft)}computeRefetchInterval(){var dt;return typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.currentResult.data,this.currentQuery):(dt=this.options.refetchInterval)!=null?dt:!1}updateRefetchInterval(dt){this.clearRefetchInterval(),this.currentRefetchInterval=dt,!(isServer||this.options.enabled===!1||!isValidTimeout(this.currentRefetchInterval)||this.currentRefetchInterval===0)&&(this.refetchIntervalId=setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&this.executeFetch()},this.currentRefetchInterval))}updateTimers(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())}clearStaleTimeout(){this.staleTimeoutId&&(clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0)}clearRefetchInterval(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)}createResult(dt,ft){const vt=this.currentQuery,Et=this.options,Rt=this.currentResult,St=this.currentResultState,At=this.currentResultOptions,Ct=dt!==vt,kt=Ct?dt.state:this.currentQueryInitialState,Tt=Ct?this.currentResult:this.previousQueryResult,{state:Nt}=dt;let{dataUpdatedAt:Ft,error:Dt,errorUpdatedAt:Ut,fetchStatus:zt,status:Zt}=Nt,Ht=!1,Bt=!1,Wt;if(ft._optimisticResults){const sr=this.hasListeners(),mr=!sr&&shouldFetchOnMount(dt,ft),dr=sr&&shouldFetchOptionally(dt,vt,ft,Et);(mr||dr)&&(zt=canFetch(dt.options.networkMode)?"fetching":"paused",Ft||(Zt="loading")),ft._optimisticResults==="isRestoring"&&(zt="idle")}if(ft.keepPreviousData&&!Nt.dataUpdatedAt&&Tt!=null&&Tt.isSuccess&&Zt!=="error")Wt=Tt.data,Ft=Tt.dataUpdatedAt,Zt=Tt.status,Ht=!0;else if(ft.select&&typeof Nt.data<"u")if(Rt&&Nt.data===(St==null?void 0:St.data)&&ft.select===this.selectFn)Wt=this.selectResult;else try{this.selectFn=ft.select,Wt=ft.select(Nt.data),Wt=replaceData(Rt==null?void 0:Rt.data,Wt,ft),this.selectResult=Wt,this.selectError=null}catch(sr){this.selectError=sr}else Wt=Nt.data;if(typeof ft.placeholderData<"u"&&typeof Wt>"u"&&Zt==="loading"){let sr;if(Rt!=null&&Rt.isPlaceholderData&&ft.placeholderData===(At==null?void 0:At.placeholderData))sr=Rt.data;else if(sr=typeof ft.placeholderData=="function"?ft.placeholderData():ft.placeholderData,ft.select&&typeof sr<"u")try{sr=ft.select(sr),this.selectError=null}catch(mr){this.selectError=mr}typeof sr<"u"&&(Zt="success",Wt=replaceData(Rt==null?void 0:Rt.data,sr,ft),Bt=!0)}this.selectError&&(Dt=this.selectError,Wt=this.selectResult,Ut=Date.now(),Zt="error");const Kt=zt==="fetching",ar=Zt==="loading",rr=Zt==="error";return{status:Zt,fetchStatus:zt,isLoading:ar,isSuccess:Zt==="success",isError:rr,isInitialLoading:ar&&Kt,data:Wt,dataUpdatedAt:Ft,error:Dt,errorUpdatedAt:Ut,failureCount:Nt.fetchFailureCount,failureReason:Nt.fetchFailureReason,errorUpdateCount:Nt.errorUpdateCount,isFetched:Nt.dataUpdateCount>0||Nt.errorUpdateCount>0,isFetchedAfterMount:Nt.dataUpdateCount>kt.dataUpdateCount||Nt.errorUpdateCount>kt.errorUpdateCount,isFetching:Kt,isRefetching:Kt&&!ar,isLoadingError:rr&&Nt.dataUpdatedAt===0,isPaused:zt==="paused",isPlaceholderData:Bt,isPreviousData:Ht,isRefetchError:rr&&Nt.dataUpdatedAt!==0,isStale:isStale(dt,ft),refetch:this.refetch,remove:this.remove}}updateResult(dt){const ft=this.currentResult,vt=this.createResult(this.currentQuery,this.options);if(this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,shallowEqualObjects(vt,ft))return;this.currentResult=vt;const Et={cache:!0},Rt=()=>{if(!ft)return!0;const{notifyOnChangeProps:St}=this.options;if(St==="all"||!St&&!this.trackedProps.size)return!0;const At=new Set(St??this.trackedProps);return this.options.useErrorBoundary&&At.add("error"),Object.keys(this.currentResult).some(Ct=>{const kt=Ct;return this.currentResult[kt]!==ft[kt]&&At.has(kt)})};(dt==null?void 0:dt.listeners)!==!1&&Rt()&&(Et.listeners=!0),this.notify({...Et,...dt})}updateQuery(){const dt=this.client.getQueryCache().build(this.client,this.options);if(dt===this.currentQuery)return;const ft=this.currentQuery;this.currentQuery=dt,this.currentQueryInitialState=dt.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(ft==null||ft.removeObserver(this),dt.addObserver(this))}onQueryUpdate(dt){const ft={};dt.type==="success"?ft.onSuccess=!dt.manual:dt.type==="error"&&!isCancelledError(dt.error)&&(ft.onError=!0),this.updateResult(ft),this.hasListeners()&&this.updateTimers()}notify(dt){notifyManager.batch(()=>{if(dt.onSuccess){var ft,vt,Et,Rt;(ft=(vt=this.options).onSuccess)==null||ft.call(vt,this.currentResult.data),(Et=(Rt=this.options).onSettled)==null||Et.call(Rt,this.currentResult.data,null)}else if(dt.onError){var St,At,Ct,kt;(St=(At=this.options).onError)==null||St.call(At,this.currentResult.error),(Ct=(kt=this.options).onSettled)==null||Ct.call(kt,void 0,this.currentResult.error)}dt.listeners&&this.listeners.forEach(({listener:Tt})=>{Tt(this.currentResult)}),dt.cache&&this.client.getQueryCache().notify({query:this.currentQuery,type:"observerResultsUpdated"})})}}function shouldLoadOnMount(lt,dt){return dt.enabled!==!1&&!lt.state.dataUpdatedAt&&!(lt.state.status==="error"&&dt.retryOnMount===!1)}function shouldFetchOnMount(lt,dt){return shouldLoadOnMount(lt,dt)||lt.state.dataUpdatedAt>0&&shouldFetchOn(lt,dt,dt.refetchOnMount)}function shouldFetchOn(lt,dt,ft){if(dt.enabled!==!1){const vt=typeof ft=="function"?ft(lt):ft;return vt==="always"||vt!==!1&&isStale(lt,dt)}return!1}function shouldFetchOptionally(lt,dt,ft,vt){return ft.enabled!==!1&&(lt!==dt||vt.enabled===!1)&&(!ft.suspense||lt.state.status!=="error")&&isStale(lt,ft)}function isStale(lt,dt){return lt.isStaleByTime(dt.staleTime)}class InfiniteQueryObserver extends QueryObserver{constructor(dt,ft){super(dt,ft)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(dt,ft){super.setOptions({...dt,behavior:infiniteQueryBehavior()},ft)}getOptimisticResult(dt){return dt.behavior=infiniteQueryBehavior(),super.getOptimisticResult(dt)}fetchNextPage({pageParam:dt,...ft}={}){return this.fetch({...ft,meta:{fetchMore:{direction:"forward",pageParam:dt}}})}fetchPreviousPage({pageParam:dt,...ft}={}){return this.fetch({...ft,meta:{fetchMore:{direction:"backward",pageParam:dt}}})}createResult(dt,ft){var vt,Et,Rt,St,At,Ct;const{state:kt}=dt,Tt=super.createResult(dt,ft),{isFetching:Nt,isRefetching:Ft}=Tt,Dt=Nt&&((vt=kt.fetchMeta)==null||(Et=vt.fetchMore)==null?void 0:Et.direction)==="forward",Ut=Nt&&((Rt=kt.fetchMeta)==null||(St=Rt.fetchMore)==null?void 0:St.direction)==="backward";return{...Tt,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:hasNextPage(ft,(At=kt.data)==null?void 0:At.pages),hasPreviousPage:hasPreviousPage(ft,(Ct=kt.data)==null?void 0:Ct.pages),isFetchingNextPage:Dt,isFetchingPreviousPage:Ut,isRefetching:Ft&&!Dt&&!Ut}}}let MutationObserver$1=class extends Subscribable{constructor(dt,ft){super(),this.client=dt,this.setOptions(ft),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(dt){var ft;const vt=this.options;this.options=this.client.defaultMutationOptions(dt),shallowEqualObjects(vt,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),(ft=this.currentMutation)==null||ft.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners()){var dt;(dt=this.currentMutation)==null||dt.removeObserver(this)}}onMutationUpdate(dt){this.updateResult();const ft={listeners:!0};dt.type==="success"?ft.onSuccess=!0:dt.type==="error"&&(ft.onError=!0),this.notify(ft)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(dt,ft){return this.mutateOptions=ft,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,{...this.options,variables:typeof dt<"u"?dt:this.options.variables}),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){const dt=this.currentMutation?this.currentMutation.state:getDefaultState(),ft={...dt,isLoading:dt.status==="loading",isSuccess:dt.status==="success",isError:dt.status==="error",isIdle:dt.status==="idle",mutate:this.mutate,reset:this.reset};this.currentResult=ft}notify(dt){notifyManager.batch(()=>{if(this.mutateOptions&&this.hasListeners()){if(dt.onSuccess){var ft,vt,Et,Rt;(ft=(vt=this.mutateOptions).onSuccess)==null||ft.call(vt,this.currentResult.data,this.currentResult.variables,this.currentResult.context),(Et=(Rt=this.mutateOptions).onSettled)==null||Et.call(Rt,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)}else if(dt.onError){var St,At,Ct,kt;(St=(At=this.mutateOptions).onError)==null||St.call(At,this.currentResult.error,this.currentResult.variables,this.currentResult.context),(Ct=(kt=this.mutateOptions).onSettled)==null||Ct.call(kt,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context)}}dt.listeners&&this.listeners.forEach(({listener:Tt})=>{Tt(this.currentResult)})})}};var reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/**
42
42
  * @license React
43
43
  * scheduler.production.min.js
44
44
  *
@@ -279,4 +279,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
279
279
  *
280
280
  * This source code is licensed under the MIT license found in the
281
281
  * LICENSE file in the root directory of this source tree.
282
- */var h=reactExports,n=shimExports;function p(lt,dt){return lt===dt&&(lt!==0||1/lt===1/dt)||lt!==lt&&dt!==dt}var q=typeof Object.is=="function"?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;withSelector_production_min.useSyncExternalStoreWithSelector=function(lt,dt,ft,vt,Et){var Rt=t(null);if(Rt.current===null){var St={hasValue:!1,value:null};Rt.current=St}else St=Rt.current;Rt=v(function(){function Ct(Dt){if(!kt){if(kt=!0,Tt=Dt,Dt=vt(Dt),Et!==void 0&&St.hasValue){var Ut=St.value;if(Et(Ut,Dt))return Nt=Ut}return Nt=Dt}if(Ut=Nt,q(Tt,Dt))return Ut;var zt=vt(Dt);return Et!==void 0&&Et(Ut,zt)?Ut:(Tt=Dt,Nt=zt)}var kt=!1,Tt,Nt,Ft=ft===void 0?null:ft;return[function(){return Ct(dt())},Ft===null?void 0:function(){return Ct(Ft())}]},[dt,ft,vt,Et]);var At=r(lt,Rt[0],Rt[1]);return u(function(){St.hasValue=!0,St.value=At},[At]),w(At),At};withSelector.exports=withSelector_production_min;var withSelectorExports=withSelector.exports;const useSyncExternalStoreExports=getDefaultExportFromCjs$1(withSelectorExports),{useSyncExternalStoreWithSelector}=useSyncExternalStoreExports;function useStore(lt,dt=lt.getState,ft){const vt=useSyncExternalStoreWithSelector(lt.subscribe,lt.getState,lt.getServerState||lt.getState,dt,ft);return reactExports.useDebugValue(vt),vt}const createImpl=lt=>{({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&typeof lt!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const dt=typeof lt=="function"?createStore(lt):lt,ft=(vt,Et)=>useStore(dt,vt,Et);return Object.assign(ft,dt),ft},create=lt=>lt?createImpl(lt):createImpl;function getAncestors(lt,dt){var vt;const ft=findNodeById(lt,dt);return(vt=ft==null?void 0:ft.folder)!=null&&vt.ancestors?[...(ft==null?void 0:ft.folder.ancestors)||[],lt]:lt===FOLDER.BIN?[FOLDER.BIN]:[FOLDER.DEFAULT]}function hasChildren(lt,dt){return dt.id===lt&&dt.children?dt.children.length>0:dt.children?dt.children.some(ft=>hasChildren(dt.id,ft)):!1}const{app,types,filters,orders}=getAppParams(),useStoreContext=create()((lt,dt)=>({filters,orders,searchParams:{app,types,filters:{folder:"default"},orders:{updatedAt:"desc"},pagination:{startIdx:0,pageSize:48,maxIdx:0},trashed:!1},treeData:{id:FOLDER.DEFAULT,name:"Mes blogs",section:!0,children:[]},selectedNodesIds:["default"],currentFolder:{id:"default"},selectedFolders:[],selectedResources:[],folderIds:[],resourceIds:[],resourceIsTrash:!1,updaters:{setTreeData:ft=>lt(()=>({treeData:ft})),setSearchParams:ft=>lt(()=>({searchParams:ft})),setSelectedFolders:ft=>lt(()=>({selectedFolders:ft})),setSelectedResources:ft=>lt(()=>({selectedResources:ft})),setFolderIds:ft=>lt(()=>({folderIds:ft})),setResourceIds:ft=>lt(()=>({resourceIds:ft})),setResourceIsTrash:ft=>lt(()=>({resourceIsTrash:ft})),setCurrentFolder:ft=>lt(()=>({currentFolder:ft})),clearSelectedItems:()=>lt(()=>({selectedFolders:[],selectedResources:[]})),clearSelectedIds:()=>lt(()=>({resourceIds:[],folderIds:[]})),openResource:ft=>{try{const{searchParams:vt}=dt();goToResource({searchParams:vt,assetId:ft.assetId})}catch(vt){console.error("explorer open failed: ",vt)}},createResource:()=>{try{const{searchParams:ft,currentFolder:vt}=dt(),Et=parseInt((vt==null?void 0:vt.id)||"default"),Rt=isNaN(Et)?void 0:Et;createResource({searchParams:ft,safeFolderId:Rt})}catch(ft){console.error("explorer create failed: ",ft)}},printSelectedResource:()=>{try{const{searchParams:ft,selectedResources:vt,resourceIds:Et}=dt();if(vt.length!==1)throw new Error("Cannot open more than 1 resource");const Rt=vt.find(St=>St.id===Et[0]);printResource({searchParams:ft,assetId:Rt.assetId})}catch(ft){console.error("explorer print failed: ",ft)}},publishApi:async(ft,vt)=>{const{searchParams:Et}=dt();return await publishResource({searchParams:Et,params:vt})},openFolder:({folderId:ft,folder:vt})=>{const{searchParams:Et,treeData:Rt}=dt(),St=Et.filters.folder,At=getAncestors(ft,Rt),Ct=arrayUnique([...At,ft]);St!==ft&&lt(kt=>({...kt,folderIds:[],resourceIds:[],selectedNodesIds:Ct,currentFolder:vt||{id:ft},searchParams:{...Et,filters:{...Et.filters,folder:ft},trashed:ft===FOLDER.BIN}}))},foldTreeItem:()=>lt(ft=>({...ft,status:"fold"})),unfoldTreeItem:async(ft,vt)=>{const{treeData:Et,searchParams:Rt}=dt();if(lt(St=>({...St,status:"unfold"})),!hasChildren(ft,Et)){await vt.prefetchInfiniteQuery({queryKey:["prefetchContext",{folderId:ft,trashed:!1}],queryFn:async()=>await searchContext({...Rt,filters:{...Rt.filters,folder:ft}})});const St=vt.getQueryData(["prefetchContext",{folderId:ft,trashed:!1}]);lt(At=>{var Ct;return{...At,treeData:wrapTreeNode(Et,(Ct=St==null?void 0:St.pages[0])==null?void 0:Ct.folders,ft||FOLDER.DEFAULT)}})}},selectTreeItem:ft=>{const{treeData:vt}=dt(),{openFolder:Et}=dt().updaters,Rt=findNodeById(ft,vt);Et({folder:Rt,folderId:ft})},gotoPreviousFolder:()=>{const{selectedNodesIds:ft,treeData:vt}=dt(),{openFolder:Et}=dt().updaters,Rt=ft.length;if(Rt<2)return;const St=findNodeById(ft[Rt-2],vt);Et({folder:St,folderId:(St==null?void 0:St.id)||FOLDER.DEFAULT})},goToTrash:()=>lt(ft=>({...ft,selectedNodesIds:[],resourceIds:[],folderIds:[],searchParams:{...ft.searchParams,filters:{folder:FOLDER.BIN},trashed:!0},currentFolder:{id:FOLDER.BIN}}))}})),useSearchParams=()=>useStoreContext(lt=>lt.searchParams),useSelectedNodesIds=()=>useStoreContext(lt=>lt.selectedNodesIds),useTreeData=()=>useStoreContext(lt=>lt.treeData),useSelectedFolders=()=>useStoreContext(lt=>lt.selectedFolders),useSelectedResources=()=>useStoreContext(lt=>lt.selectedResources),useFolderIds=()=>useStoreContext(lt=>lt.folderIds),useResourceIds=()=>useStoreContext(lt=>lt.resourceIds),useCurrentFolder=()=>useStoreContext(lt=>lt.currentFolder),useStoreActions=()=>useStoreContext(lt=>lt.updaters),useIsTrash=()=>{const lt=useCurrentFolder();return(lt==null?void 0:lt.id)===FOLDER.BIN},useResourceIsTrash=()=>useStoreContext(lt=>lt.resourceIsTrash),useIsRoot=()=>{const lt=useCurrentFolder();return(lt==null?void 0:lt.id)==="default"},useHasSelectedNodes=()=>useSelectedNodesIds().length>1,{actions}=getAppParams(),useActions=()=>useQuery({queryKey:["actions"],queryFn:async()=>{const lt=actions.map(ft=>ft.workflow);return await sessionHasWorkflowRights(lt)},select:lt=>actions.map(dt=>({...dt,available:lt[dt.workflow]}))}),useSearchContext=()=>{const{i18n:lt}=useOdeClient(),dt=useQueryClient(),ft=useSearchParams(),vt=useCurrentFolder(),Et=useTreeData(),{setTreeData:Rt,setSearchParams:St}=useStoreActions(),At=["context",{folderId:ft.filters.folder,trashed:ft.trashed}];return useInfiniteQuery({queryKey:At,queryFn:async({pageParam:Ct=0})=>await searchContext({...ft,pagination:{...ft.pagination,startIdx:Ct}}),onSuccess:async Ct=>{var Tt,Nt;await dt.cancelQueries({queryKey:At});const kt=(Tt=Ct==null?void 0:Ct.pages[0])==null?void 0:Tt.folders;(vt==null?void 0:vt.id)==="default"?Rt({id:FOLDER.DEFAULT,section:!0,children:kt.map(Ft=>new TreeNodeFolderWrapper(Ft)),name:lt("explorer.filters.mine")}):Rt(wrapTreeNode(Et,kt,ft.filters.folder||FOLDER.DEFAULT)),St({...ft,pagination:(Nt=Ct==null?void 0:Ct.pages[(Ct==null?void 0:Ct.pages.length)-1])==null?void 0:Nt.pagination})},getNextPageParam:Ct=>Ct.pagination.startIdx+Ct.pagination.pageSize})},useTrash=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=useTreeData(),vt=useFolderIds(),Et=useResourceIds(),{clearSelectedItems:Rt,clearSelectedIds:St,setTreeData:At}=useStoreActions(),Ct=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async()=>await trashAll({searchParams:dt,folderIds:vt,resourceIds:Et}),onSuccess:async()=>{if(await lt.cancelQueries({queryKey:Ct}),lt.getQueryData(Ct))return lt.setQueryData(Ct,Tt=>{if(Tt){const Nt={...Tt,pages:Tt==null?void 0:Tt.pages.map(Dt=>({...Dt,folders:Dt.folders.filter(Ut=>!vt.includes(Ut.id)),resources:Dt.resources.filter(Ut=>!Et.includes(Ut.id))}))},Ft=deleteNode(ft,{folders:vt});return At(Ft),Nt}})},onSettled:()=>{Rt(),St()}})},useRestore=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=useFolderIds(),vt=useResourceIds(),{setFolderIds:Et,setResourceIds:Rt,setSelectedResources:St,setSelectedFolders:At}=useStoreActions(),Ct=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async()=>await restoreAll({searchParams:dt,folderIds:ft,resourceIds:vt}),onSuccess:async()=>{if(await lt.cancelQueries({queryKey:Ct}),lt.getQueryData(Ct))return lt.setQueryData(Ct,Tt=>{if(Tt)return{...Tt,pages:Tt==null?void 0:Tt.pages.map(Nt=>({...Nt,folders:Nt.folders.filter(Ft=>!ft.includes(Ft.id)),resources:Nt.resources.filter(Ft=>!vt.includes(Ft.id))}))}})},onSettled:()=>{Rt([]),St([]),Et([]),At([])}})},useDelete=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=useFolderIds(),vt=useResourceIds(),{clearSelectedItems:Et,clearSelectedIds:Rt}=useStoreActions(),St=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async()=>await deleteAll({searchParams:dt,folderIds:ft,resourceIds:vt}),onSuccess:async()=>{if(await lt.cancelQueries({queryKey:St}),lt.getQueryData(St))return lt.setQueryData(St,Ct=>{if(Ct)return{...Ct,pages:Ct==null?void 0:Ct.pages.map(Tt=>({...Tt,folders:Tt.folders.filter(Nt=>!ft.includes(Nt.id)),resources:Tt.resources.filter(Nt=>!vt.includes(Nt.id))}))}})},onSettled:()=>{Et(),Rt()}})},useMoveItem=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=useTreeData(),vt=useFolderIds(),Et=useResourceIds(),{clearSelectedIds:Rt,clearSelectedItems:St,setTreeData:At}=useStoreActions(),Ct=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async kt=>await moveToFolder({searchParams:dt,folderId:kt,folderIds:vt,resourceIds:Et}),onSuccess:async(kt,Tt)=>{if(lt.getQueryData(Ct))return lt.setQueryData(Ct,Ft=>{if(Ft){const Dt=moveNode(ft,{destinationId:Tt,folders:vt});return At(Dt),{...Ft,pages:Ft==null?void 0:Ft.pages.map(Ut=>({...Ut,folders:Ut.folders.filter(zt=>!vt.includes(zt.id)),resources:Ut.resources.filter(zt=>!Et.includes(zt.id))}))}}})},onSettled:()=>{St(),Rt()}})},useCreateFolder=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=useTreeData(),{setTreeData:vt}=useStoreActions(),Et=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async({name:Rt,parentId:St})=>await createFolder({searchParams:dt,name:Rt,parentId:St}),onSuccess:async(Rt,St)=>{await lt.cancelQueries({queryKey:Et});const At=lt.getQueryData(Et),Ct={...Rt,parentId:St.parentId,children:[],rights:[`creator:${Rt==null?void 0:Rt.creator_id}`]};if(At)return lt.setQueryData(Et,kt=>{if(kt){const Tt={...kt,pages:kt==null?void 0:kt.pages.map(Ft=>({...Ft,folders:[...Ft.folders,Ct]}))},Nt=addNode(ft,{parentId:St.parentId,newFolder:Ct});return vt(Nt),Tt}})},onSettled:async()=>await lt.cancelQueries({queryKey:Et})})},useUpdatefolder=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=useTreeData(),{setFolderIds:vt,setSelectedFolders:Et,setTreeData:Rt}=useStoreActions(),St=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async({folderId:At,name:Ct,parentId:kt})=>await updateFolder({searchParams:dt,folderId:At,parentId:kt,name:Ct}),onSuccess:async(At,Ct)=>{if(await lt.cancelQueries({queryKey:St}),lt.getQueryData(St))return lt.setQueryData(St,Tt=>{if(Tt){const Nt={...Tt,pages:Tt==null?void 0:Tt.pages.map(Dt=>({...Dt,folders:Dt.folders.map(Ut=>Ut.id===At.id?{...At,parentId:Ct.parentId,rights:Ut.rights}:Ut)}))},Ft=updateNode(ft,{folderId:Ct.folderId,newFolder:At});return Rt(Ft),Nt}})},onSettled:()=>{vt([]),Et([])}})},useShareResource=()=>{const lt=useQueryClient(),dt=useSearchParams(),{setResourceIds:ft,setSelectedResources:vt}=useStoreActions(),Et=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async({entId:Rt,shares:St})=>await shareResource({searchParams:dt,entId:Rt,shares:St}),onSuccess:async(Rt,St)=>{if(await lt.cancelQueries({queryKey:Et}),lt.getQueryData(Et))return lt.setQueryData(Et,Ct=>{if(Ct)return{...Ct,pages:Ct==null?void 0:Ct.pages.map(kt=>({...kt,resources:kt.resources.map(Tt=>{if(Tt.assetId===(St==null?void 0:St.entId)){let Nt=[`creator:${Tt.creatorId}`];return(St==null?void 0:St.shares.length)>=1&&(Nt=[...Nt,...St.shares.flatMap(Ft=>Ft.actions.map(Dt=>`${Ft.type}:${Ft.id}:${Dt.id}`))]),{...Tt,rights:Nt}}else return Tt})}))}})},onSettled:()=>{ft([]),vt([])}})},useUpdateResource=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async vt=>await updateResource({searchParams:dt,params:vt}),onSuccess:async(vt,Et)=>{if(await lt.cancelQueries({queryKey:ft}),lt.getQueryData(ft))return lt.setQueryData(ft,St=>{if(St)return{...St,pages:St==null?void 0:St.pages.map(At=>({...At,resources:At.resources.map(Ct=>{if(Ct.assetId===(Et==null?void 0:Et.entId)){const{name:kt,thumbnail:Tt,public:Nt,description:Ft,slug:Dt,...Ut}=Et;return{...Ct,...Ut,name:kt,thumbnail:Tt,public:Nt,description:Ft,slug:Dt}}else return Ct})}))}})}})},{trashActions}=getAppParams();function useActionBar(){const[lt,dt]=reactExports.useState(!1),[ft,vt]=reactExports.useState("void"),[Et,Rt]=reactExports.useState(),{i18n:St}=useI18n(),{hotToast:At}=useHotToast(Alert$1),Ct=useCurrentFolder(),kt=useResourceIds(),Tt=useSelectedResources(),Nt=useSelectedFolders(),Ft=useFolderIds(),Dt=useIsTrash(),Ut=useRestore(),zt=useResourceIsTrash(),{openResource:Zt,createResource:Ht,printSelectedResource:Bt,openFolder:Wt,clearSelectedItems:Kt,clearSelectedIds:ar}=useStoreActions(),{data:rr}=useActions();reactExports.useEffect(()=>{if(kt.length===0&&Ft.length===0){dt(!1);return}if(zt){dt(!1);return}dt(!0)},[kt,Ft]);async function ur(_r){var Tr;switch((Tr=document.getElementById("root"))==null||Tr.setAttribute("aria-hidden","true"),Rt(_r),_r.id){case ACTION.OPEN:return kt.length>0?Zt(Tt[0]):Wt({folder:Nt[0],folderId:Nt[0].id});case ACTION.CREATE:return Ht();case ACTION.MOVE:return vt("move");case ACTION.PRINT:return Bt();case ACTION.DELETE:return vt("delete");case ACTION.RESTORE:return await dr();case ACTION.PUBLISH:return vt("publish");case ACTION.UPD_PROPS:case"edit":return br();case ACTION.SHARE:return vt("share");default:throw Error(`Unknown action: ${_r.id}`)}}function sr(_r){const Tr=kt.length+Ft.length,Cr=kt.length===1||Ft.length===1,Or=Tr===1,Pr=Ft.length===0;switch(_r.id){case ACTION.OPEN:return Or;case ACTION.MANAGE:return Cr;case ACTION.PUBLISH:return Cr&&Pr;case ACTION.UPD_PROPS:return Cr&&Pr;case ACTION.SHARE:return Pr&&Cr;case ACTION.PRINT:return Cr&&Pr;case"edit":return Or;default:return!0}}function mr(){return!0}async function dr(){try{if(Dt)await Ut.mutate(),At.success(St("explorer.trash.toast"));else throw new Error("Cannot restore untrashed resources");Sr()}catch(_r){console.error(_r)}}function Sr(){var _r;vt("void"),Et!=null&&Et.id&&((_r=document.getElementById(Et==null?void 0:Et.id))==null||_r.focus())}const Er=_r=>()=>{ft===_r&&(Sr(),Kt(),ar())},xr=Er("move"),ir=Er("move"),lr=Er("delete"),yr=Er("delete"),pr=Er("publish"),nr=Er("publish"),cr=Er("edit_folder"),hr=Er("edit_folder"),Rr=Er("edit_resource"),wr=Er("edit_resource"),Ar=Er("share"),jr=Er("share");function br(){kt&&kt.length>0?vt("edit_resource"):vt("edit_folder")}function kr(_r){return _r.id==="edit"&&Ft.length>0?"explorer.rename":`explorer.actions.${_r.id}`}return{onRestore:dr,actions:Dt?trashActions:rr,selectedElement:[...Tt,...Nt],currentFolderId:Ct==null?void 0:Ct.id,overrideLabel:kr,handleClick:ur,isActivable:Dt?mr:sr,isActionBarOpen:lt,isMoveModalOpen:ft==="move",onMoveCancel:xr,onMoveSuccess:ir,isDeleteModalOpen:ft==="delete",onDeleteCancel:yr,onDeleteSuccess:lr,isPublishModalOpen:ft==="publish",onPublishCancel:nr,onPublishSuccess:pr,isEditFolderOpen:ft==="edit_folder",onEditFolderCancel:hr,onEditFolderSuccess:cr,isEditResourceOpen:ft==="edit_resource",onEditResourceCancel:wr,onEditResourceSuccess:Rr,isShareResourceOpen:ft==="share",onShareResourceCancel:jr,onShareResourceSuccess:Ar,onClearActionBar:Sr}}function useAccessControl({roles:lt,rights:dt,action:ft}){const[vt,Et]=reactExports.useState(!1),{user:Rt}=useUser(),St=useIsTrash();reactExports.useEffect(()=>{kt()},[lt,dt]);const At=async function(Tt){const Nt=Tt instanceof Array?Tt:[Tt];if(lt instanceof Array){const Ft=await odeServices.rights().sessionHasAtLeastOneResourceRight(lt,Nt);Et(Ft)}else{const Ft=await odeServices.rights().sessionHasResourceRight(lt,Nt);Et(Ft)}},Ct=async function(Tt){if(lt instanceof Array){const Nt=await odeServices.rights().sessionHasAtLeastOneResourceRightForEachList(lt,Tt);Et(Nt)}else{const Nt=await odeServices.rights().sessionHasResourceRightForEachList(lt,Tt);Et(Nt)}},kt=async function(){var Tt,Nt;if(lt===void 0){Et(!0);return}if(St&&((Nt=(Tt=dt[0])==null?void 0:Tt.trashedBy)!=null&&Nt.includes(Rt==null?void 0:Rt.userId))&&ft==="restore"){Et(!0);return}if(dt instanceof Array)if(dt.length>0)if(typeof dt[0]=="string")await At(dt);else{const Ft=dt.map(Dt=>Dt.rights);await Ct(Ft)}else Et(!1);else typeof dt=="string"?await At(dt):await At(dt.rights)};return{visible:vt,refreshState:kt}}function AccessControl({resourceRights:lt,roleExpected:dt,children:ft,renderWhenForbidden:vt,actionId:Et}){const{visible:Rt}=useAccessControl({roles:dt,rights:lt,action:Et});return Rt?jsxRuntimeExports$4.jsx(jsxRuntimeExports$4.Fragment,{children:ft}):vt?vt():jsxRuntimeExports$4.jsx(jsxRuntimeExports$4.Fragment,{})}const ShareResourceModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./ShareResourceModal.js"),["ShareResourceModal.js","SelectList.js","Tooltip.js","usePopper.js"])),DeleteModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./DeleteModal.js"),[])),MoveModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./MoveModal.js"),[])),EditFolderModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./EditFolderModal.js"),["EditFolderModal.js","index.esm.js"])),EditResourceModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./EditResourceModal.js"),["EditResourceModal.js","ImagePicker.js","index.esm.js"])),PublishModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./PublishModal.js"),["PublishModal.js","usePopper.js","SelectList.js","ImagePicker.js","index.esm.js"]));function ActionBarContainer(){const{i18n:lt}=useI18n(),{actions:dt,selectedElement:ft,isMoveModalOpen:vt,isDeleteModalOpen:Et,isPublishModalOpen:Rt,isActionBarOpen:St,isEditFolderOpen:At,overrideLabel:Ct,onEditFolderCancel:kt,onEditFolderSuccess:Tt,isEditResourceOpen:Nt,onEditResourceCancel:Ft,onEditResourceSuccess:Dt,isShareResourceOpen:Ut,onShareResourceCancel:zt,onShareResourceSuccess:Zt,onMoveCancel:Ht,onMoveSuccess:Bt,onDeleteCancel:Wt,onDeleteSuccess:Kt,onPublishCancel:ar,onPublishSuccess:rr,isActivable:ur,handleClick:sr}=useActionBar(),mr=Gt(St,{from:{opacity:0,transform:"translateY(100%)"},enter:{opacity:1,transform:"translateY(0)"},leave:{opacity:0,transform:"translateY(100%)"}});return jsxRuntimeExports$4.jsxs(jsxRuntimeExports$4.Fragment,{children:[mr((dr,Sr)=>Sr&&jsxRuntimeExports$4.jsx(it$1.div,{className:"position-fixed bottom-0 start-0 end-0 z-3",style:dr,children:jsxRuntimeExports$4.jsx(ActionBar$1,{children:dt==null?void 0:dt.filter(Er=>Er.available&&Er.target==="actionbar").map(Er=>ur(Er)&&jsxRuntimeExports$4.jsx(AccessControl,{resourceRights:ft,roleExpected:Er.right,actionId:Er.id,children:jsxRuntimeExports$4.jsx(Button$1,{id:Er.id,type:"button",color:"primary",variant:"filled",onClick:()=>{sr(Er)},children:lt(Ct(Er))},Er.id)},Er.id))})})),jsxRuntimeExports$4.jsxs(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:[vt&&jsxRuntimeExports$4.jsx(MoveModal,{isOpen:vt,onCancel:Ht,onSuccess:Bt}),Et&&jsxRuntimeExports$4.jsx(DeleteModal,{isOpen:Et,onCancel:Wt,onSuccess:Kt}),Rt&&jsxRuntimeExports$4.jsx(PublishModal,{isOpen:Rt,onCancel:ar,onSuccess:rr}),At&&jsxRuntimeExports$4.jsx(EditFolderModal,{edit:!0,isOpen:At,onCancel:kt,onSuccess:Tt}),Nt&&jsxRuntimeExports$4.jsx(EditResourceModal,{edit:!0,isOpen:Nt,onCancel:Ft,onSuccess:Dt}),Ut&&jsxRuntimeExports$4.jsx(ShareResourceModal,{isOpen:Ut,onCancel:zt,onSuccess:Zt})]})]})}const AppHeader=({children:lt})=>jsxRuntimeExports$4.jsx("div",{className:"d-flex justify-content-between p-16 mx-n16 border-bottom",children:lt}),EmptyScreenApp=reactExports.lazy(async()=>await __vitePreload(()=>import("./EmptyScreenApp.js"),["EmptyScreenApp.js","EmptyScreen.js"])),EmptyScreenNoContentInFolder=reactExports.lazy(async()=>await __vitePreload(()=>import("./EmptyScreenNoContentInFolder.js"),["EmptyScreenNoContentInFolder.js","EmptyScreen.js"])),EmptyScreenTrash=reactExports.lazy(async()=>await __vitePreload(()=>import("./EmptyScreenTrash.js"),["EmptyScreenTrash.js","EmptyScreen.js"])),FoldersList=reactExports.lazy(async()=>await __vitePreload(()=>import("./FoldersList.js"),["FoldersList.js","Card.js","Tooltip.js","usePopper.js"])),ResourcesList=reactExports.lazy(async()=>await __vitePreload(()=>import("./ResourcesList.js"),["ResourcesList.js","Card.js","Tooltip.js","usePopper.js"])),List=()=>{const lt=useIsRoot(),dt=useIsTrash(),ft=useHasSelectedNodes(),{data:vt,isLoading:Et}=useSearchContext(),Rt=(vt==null?void 0:vt.pages[0].folders.length)===0,St=(vt==null?void 0:vt.pages[0].resources.length)===0,At=Rt&&St;return jsxRuntimeExports$4.jsxs(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:[!At&&!Et&&jsxRuntimeExports$4.jsxs(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:[jsxRuntimeExports$4.jsx(FoldersList,{}),jsxRuntimeExports$4.jsx(ResourcesList,{})]}),lt&&At&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(EmptyScreenApp,{})}),ft&&At&&!dt&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(EmptyScreenNoContentInFolder,{})}),dt&&(vt==null?void 0:vt.pages[0].resources.length)===0&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(EmptyScreenTrash,{})})]})};var dayjs_min={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt()})(commonjsGlobal,function(){var ft=1e3,vt=6e4,Et=36e5,Rt="millisecond",St="second",At="minute",Ct="hour",kt="day",Tt="week",Nt="month",Ft="quarter",Dt="year",Ut="date",zt="Invalid Date",Zt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Ht=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Bt={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(xr){var ir=["th","st","nd","rd"],lr=xr%100;return"["+xr+(ir[(lr-20)%10]||ir[lr]||ir[0])+"]"}},Wt=function(xr,ir,lr){var yr=String(xr);return!yr||yr.length>=ir?xr:""+Array(ir+1-yr.length).join(lr)+xr},Kt={s:Wt,z:function(xr){var ir=-xr.utcOffset(),lr=Math.abs(ir),yr=Math.floor(lr/60),pr=lr%60;return(ir<=0?"+":"-")+Wt(yr,2,"0")+":"+Wt(pr,2,"0")},m:function xr(ir,lr){if(ir.date()<lr.date())return-xr(lr,ir);var yr=12*(lr.year()-ir.year())+(lr.month()-ir.month()),pr=ir.clone().add(yr,Nt),nr=lr-pr<0,cr=ir.clone().add(yr+(nr?-1:1),Nt);return+(-(yr+(lr-pr)/(nr?pr-cr:cr-pr))||0)},a:function(xr){return xr<0?Math.ceil(xr)||0:Math.floor(xr)},p:function(xr){return{M:Nt,y:Dt,w:Tt,d:kt,D:Ut,h:Ct,m:At,s:St,ms:Rt,Q:Ft}[xr]||String(xr||"").toLowerCase().replace(/s$/,"")},u:function(xr){return xr===void 0}},ar="en",rr={};rr[ar]=Bt;var ur=function(xr){return xr instanceof Sr},sr=function xr(ir,lr,yr){var pr;if(!ir)return ar;if(typeof ir=="string"){var nr=ir.toLowerCase();rr[nr]&&(pr=nr),lr&&(rr[nr]=lr,pr=nr);var cr=ir.split("-");if(!pr&&cr.length>1)return xr(cr[0])}else{var hr=ir.name;rr[hr]=ir,pr=hr}return!yr&&pr&&(ar=pr),pr||!yr&&ar},mr=function(xr,ir){if(ur(xr))return xr.clone();var lr=typeof ir=="object"?ir:{};return lr.date=xr,lr.args=arguments,new Sr(lr)},dr=Kt;dr.l=sr,dr.i=ur,dr.w=function(xr,ir){return mr(xr,{locale:ir.$L,utc:ir.$u,x:ir.$x,$offset:ir.$offset})};var Sr=function(){function xr(lr){this.$L=sr(lr.locale,null,!0),this.parse(lr)}var ir=xr.prototype;return ir.parse=function(lr){this.$d=function(yr){var pr=yr.date,nr=yr.utc;if(pr===null)return new Date(NaN);if(dr.u(pr))return new Date;if(pr instanceof Date)return new Date(pr);if(typeof pr=="string"&&!/Z$/i.test(pr)){var cr=pr.match(Zt);if(cr){var hr=cr[2]-1||0,Rr=(cr[7]||"0").substring(0,3);return nr?new Date(Date.UTC(cr[1],hr,cr[3]||1,cr[4]||0,cr[5]||0,cr[6]||0,Rr)):new Date(cr[1],hr,cr[3]||1,cr[4]||0,cr[5]||0,cr[6]||0,Rr)}}return new Date(pr)}(lr),this.$x=lr.x||{},this.init()},ir.init=function(){var lr=this.$d;this.$y=lr.getFullYear(),this.$M=lr.getMonth(),this.$D=lr.getDate(),this.$W=lr.getDay(),this.$H=lr.getHours(),this.$m=lr.getMinutes(),this.$s=lr.getSeconds(),this.$ms=lr.getMilliseconds()},ir.$utils=function(){return dr},ir.isValid=function(){return this.$d.toString()!==zt},ir.isSame=function(lr,yr){var pr=mr(lr);return this.startOf(yr)<=pr&&pr<=this.endOf(yr)},ir.isAfter=function(lr,yr){return mr(lr)<this.startOf(yr)},ir.isBefore=function(lr,yr){return this.endOf(yr)<mr(lr)},ir.$g=function(lr,yr,pr){return dr.u(lr)?this[yr]:this.set(pr,lr)},ir.unix=function(){return Math.floor(this.valueOf()/1e3)},ir.valueOf=function(){return this.$d.getTime()},ir.startOf=function(lr,yr){var pr=this,nr=!!dr.u(yr)||yr,cr=dr.p(lr),hr=function(Tr,Cr){var Or=dr.w(pr.$u?Date.UTC(pr.$y,Cr,Tr):new Date(pr.$y,Cr,Tr),pr);return nr?Or:Or.endOf(kt)},Rr=function(Tr,Cr){return dr.w(pr.toDate()[Tr].apply(pr.toDate("s"),(nr?[0,0,0,0]:[23,59,59,999]).slice(Cr)),pr)},wr=this.$W,Ar=this.$M,jr=this.$D,br="set"+(this.$u?"UTC":"");switch(cr){case Dt:return nr?hr(1,0):hr(31,11);case Nt:return nr?hr(1,Ar):hr(0,Ar+1);case Tt:var kr=this.$locale().weekStart||0,_r=(wr<kr?wr+7:wr)-kr;return hr(nr?jr-_r:jr+(6-_r),Ar);case kt:case Ut:return Rr(br+"Hours",0);case Ct:return Rr(br+"Minutes",1);case At:return Rr(br+"Seconds",2);case St:return Rr(br+"Milliseconds",3);default:return this.clone()}},ir.endOf=function(lr){return this.startOf(lr,!1)},ir.$set=function(lr,yr){var pr,nr=dr.p(lr),cr="set"+(this.$u?"UTC":""),hr=(pr={},pr[kt]=cr+"Date",pr[Ut]=cr+"Date",pr[Nt]=cr+"Month",pr[Dt]=cr+"FullYear",pr[Ct]=cr+"Hours",pr[At]=cr+"Minutes",pr[St]=cr+"Seconds",pr[Rt]=cr+"Milliseconds",pr)[nr],Rr=nr===kt?this.$D+(yr-this.$W):yr;if(nr===Nt||nr===Dt){var wr=this.clone().set(Ut,1);wr.$d[hr](Rr),wr.init(),this.$d=wr.set(Ut,Math.min(this.$D,wr.daysInMonth())).$d}else hr&&this.$d[hr](Rr);return this.init(),this},ir.set=function(lr,yr){return this.clone().$set(lr,yr)},ir.get=function(lr){return this[dr.p(lr)]()},ir.add=function(lr,yr){var pr,nr=this;lr=Number(lr);var cr=dr.p(yr),hr=function(Ar){var jr=mr(nr);return dr.w(jr.date(jr.date()+Math.round(Ar*lr)),nr)};if(cr===Nt)return this.set(Nt,this.$M+lr);if(cr===Dt)return this.set(Dt,this.$y+lr);if(cr===kt)return hr(1);if(cr===Tt)return hr(7);var Rr=(pr={},pr[At]=vt,pr[Ct]=Et,pr[St]=ft,pr)[cr]||1,wr=this.$d.getTime()+lr*Rr;return dr.w(wr,this)},ir.subtract=function(lr,yr){return this.add(-1*lr,yr)},ir.format=function(lr){var yr=this,pr=this.$locale();if(!this.isValid())return pr.invalidDate||zt;var nr=lr||"YYYY-MM-DDTHH:mm:ssZ",cr=dr.z(this),hr=this.$H,Rr=this.$m,wr=this.$M,Ar=pr.weekdays,jr=pr.months,br=function(Cr,Or,Pr,Ir){return Cr&&(Cr[Or]||Cr(yr,nr))||Pr[Or].slice(0,Ir)},kr=function(Cr){return dr.s(hr%12||12,Cr,"0")},_r=pr.meridiem||function(Cr,Or,Pr){var Ir=Cr<12?"AM":"PM";return Pr?Ir.toLowerCase():Ir},Tr={YY:String(this.$y).slice(-2),YYYY:dr.s(this.$y,4,"0"),M:wr+1,MM:dr.s(wr+1,2,"0"),MMM:br(pr.monthsShort,wr,jr,3),MMMM:br(jr,wr),D:this.$D,DD:dr.s(this.$D,2,"0"),d:String(this.$W),dd:br(pr.weekdaysMin,this.$W,Ar,2),ddd:br(pr.weekdaysShort,this.$W,Ar,3),dddd:Ar[this.$W],H:String(hr),HH:dr.s(hr,2,"0"),h:kr(1),hh:kr(2),a:_r(hr,Rr,!0),A:_r(hr,Rr,!1),m:String(Rr),mm:dr.s(Rr,2,"0"),s:String(this.$s),ss:dr.s(this.$s,2,"0"),SSS:dr.s(this.$ms,3,"0"),Z:cr};return nr.replace(Ht,function(Cr,Or){return Or||Tr[Cr]||cr.replace(":","")})},ir.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},ir.diff=function(lr,yr,pr){var nr,cr=dr.p(yr),hr=mr(lr),Rr=(hr.utcOffset()-this.utcOffset())*vt,wr=this-hr,Ar=dr.m(this,hr);return Ar=(nr={},nr[Dt]=Ar/12,nr[Nt]=Ar,nr[Ft]=Ar/3,nr[Tt]=(wr-Rr)/6048e5,nr[kt]=(wr-Rr)/864e5,nr[Ct]=wr/Et,nr[At]=wr/vt,nr[St]=wr/ft,nr)[cr]||wr,pr?Ar:dr.a(Ar)},ir.daysInMonth=function(){return this.endOf(Nt).$D},ir.$locale=function(){return rr[this.$L]},ir.locale=function(lr,yr){if(!lr)return this.$L;var pr=this.clone(),nr=sr(lr,yr,!0);return nr&&(pr.$L=nr),pr},ir.clone=function(){return dr.w(this.$d,this)},ir.toDate=function(){return new Date(this.valueOf())},ir.toJSON=function(){return this.isValid()?this.toISOString():null},ir.toISOString=function(){return this.$d.toISOString()},ir.toString=function(){return this.$d.toUTCString()},xr}(),Er=Sr.prototype;return mr.prototype=Er,[["$ms",Rt],["$s",St],["$m",At],["$H",Ct],["$W",kt],["$M",Nt],["$y",Dt],["$D",Ut]].forEach(function(xr){Er[xr[1]]=function(ir){return this.$g(ir,xr[0],xr[1])}}),mr.extend=function(xr,ir){return xr.$i||(xr(ir,Sr,mr),xr.$i=!0),mr},mr.locale=sr,mr.isDayjs=ur,mr.unix=function(xr){return mr(1e3*xr)},mr.en=rr[ar],mr.Ls=rr,mr.p={},mr})})(dayjs_min);var dayjs_minExports=dayjs_min.exports;const dayjs=getDefaultExportFromCjs$1(dayjs_minExports);var relativeTime$1={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt()})(commonjsGlobal,function(){return function(ft,vt,Et){ft=ft||{};var Rt=vt.prototype,St={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function At(kt,Tt,Nt,Ft){return Rt.fromToBase(kt,Tt,Nt,Ft)}Et.en.relativeTime=St,Rt.fromToBase=function(kt,Tt,Nt,Ft,Dt){for(var Ut,zt,Zt,Ht=Nt.$locale().relativeTime||St,Bt=ft.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],Wt=Bt.length,Kt=0;Kt<Wt;Kt+=1){var ar=Bt[Kt];ar.d&&(Ut=Ft?Et(kt).diff(Nt,ar.d,!0):Nt.diff(kt,ar.d,!0));var rr=(ft.rounding||Math.round)(Math.abs(Ut));if(Zt=Ut>0,rr<=ar.r||!ar.r){rr<=1&&Kt>0&&(ar=Bt[Kt-1]);var ur=Ht[ar.l];Dt&&(rr=Dt(""+rr)),zt=typeof ur=="string"?ur.replace("%d",rr):ur(rr,Tt,ar.l,Zt);break}}if(Tt)return zt;var sr=Zt?Ht.future:Ht.past;return typeof sr=="function"?sr(zt):sr.replace("%s",zt)},Rt.to=function(kt,Tt){return At(kt,Tt,this,!0)},Rt.from=function(kt,Tt){return At(kt,Tt,this)};var Ct=function(kt){return kt.$u?Et.utc():Et()};Rt.toNow=function(kt){return this.to(Ct(this),kt)},Rt.fromNow=function(kt){return this.from(Ct(this),kt)}}})})(relativeTime$1);var relativeTimeExports=relativeTime$1.exports;const relativeTime=getDefaultExportFromCjs$1(relativeTimeExports);var de={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt(dayjs_minExports)})(commonjsGlobal,function(ft){function vt(Ct){return Ct&&typeof Ct=="object"&&"default"in Ct?Ct:{default:Ct}}var Et=vt(ft),Rt={s:"ein paar Sekunden",m:["eine Minute","einer Minute"],mm:"%d Minuten",h:["eine Stunde","einer Stunde"],hh:"%d Stunden",d:["ein Tag","einem Tag"],dd:["%d Tage","%d Tagen"],M:["ein Monat","einem Monat"],MM:["%d Monate","%d Monaten"],y:["ein Jahr","einem Jahr"],yy:["%d Jahre","%d Jahren"]};function St(Ct,kt,Tt){var Nt=Rt[Tt];return Array.isArray(Nt)&&(Nt=Nt[kt?0:1]),Nt.replace("%d",Ct)}var At={name:"de",weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sept._Okt._Nov._Dez.".split("_"),ordinal:function(Ct){return Ct+"."},weekStart:1,yearStart:4,formats:{LTS:"HH:mm:ss",LT:"HH:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},relativeTime:{future:"in %s",past:"vor %s",s:St,m:St,mm:St,h:St,hh:St,d:St,dd:St,M:St,MM:St,y:St,yy:St}};return Et.default.locale(At,null,!0),At})})(de);var es={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt(dayjs_minExports)})(commonjsGlobal,function(ft){function vt(St){return St&&typeof St=="object"&&"default"in St?St:{default:St}}var Et=vt(ft),Rt={name:"es",monthsShort:"ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),weekStart:1,formats:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinal:function(St){return St+"º"}};return Et.default.locale(Rt,null,!0),Rt})})(es);var pt={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt(dayjs_minExports)})(commonjsGlobal,function(ft){function vt(St){return St&&typeof St=="object"&&"default"in St?St:{default:St}}var Et=vt(ft),Rt={name:"pt",weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sab".split("_"),weekdaysMin:"Do_2ª_3ª_4ª_5ª_6ª_Sa".split("_"),months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),ordinal:function(St){return St+"º"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},relativeTime:{future:"em %s",past:"há %s",s:"alguns segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"}};return Et.default.locale(Rt,null,!0),Rt})})(pt);var fr={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt(dayjs_minExports)})(commonjsGlobal,function(ft){function vt(St){return St&&typeof St=="object"&&"default"in St?St:{default:St}}var Et=vt(ft),Rt={name:"fr",weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(St){return""+St+(St===1?"er":"")}};return Et.default.locale(Rt,null,!0),Rt})})(fr);var it={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt(dayjs_minExports)})(commonjsGlobal,function(ft){function vt(St){return St&&typeof St=="object"&&"default"in St?St:{default:St}}var Et=vt(ft),Rt={name:"it",weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),weekStart:1,monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"tra %s",past:"%s fa",s:"qualche secondo",m:"un minuto",mm:"%d minuti",h:"un' ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinal:function(St){return St+"º"}};return Et.default.locale(Rt,null,!0),Rt})})(it);dayjs.extend(relativeTime);const TrashButton=({id:lt,selected:dt,onSelect:ft})=>{const{i18n:vt}=useI18n();return jsxRuntimeExports$4.jsx("div",{className:"treeview",children:jsxRuntimeExports$4.jsx("ul",{role:"tree",className:"m-0 p-0",children:jsxRuntimeExports$4.jsx("li",{id:lt,role:"treeitem","aria-selected":dt,children:jsxRuntimeExports$4.jsx("div",{children:jsxRuntimeExports$4.jsx("div",{className:"action-container",children:jsxRuntimeExports$4.jsx("div",{onClick:ft,role:"button",tabIndex:0,children:jsxRuntimeExports$4.jsxs("div",{className:"d-flex align-items-center gap-8 py-8 ps-24",children:[jsxRuntimeExports$4.jsx(SvgDelete$1,{width:"20",height:"20"}),jsxRuntimeExports$4.jsx("span",{children:vt("explorer.tree.trash")})]})})})})})})})},CreateModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./EditFolderModal.js"),["EditFolderModal.js","index.esm.js"])),TreeViewContainer=()=>{const lt=useQueryClient(),{i18n:dt}=useI18n(),[ft,vt]=useToggle(),Et=useTreeData(),Rt=useIsTrash(),St=useSelectedNodesIds(),{goToTrash:At,selectTreeItem:Ct,unfoldTreeItem:kt,foldTreeItem:Tt}=useStoreActions(),Nt=async Ft=>{await kt(Ft,lt)};return Et?jsxRuntimeExports$4.jsxs(jsxRuntimeExports$4.Fragment,{children:[jsxRuntimeExports$4.jsx(TreeView$1,{data:Et,selectedNodesIds:St,onTreeItemSelect:Ct,onTreeItemFold:Tt,onTreeItemUnfold:Nt}),jsxRuntimeExports$4.jsx(TrashButton,{id:FOLDER.BIN,selected:Rt,onSelect:At}),jsxRuntimeExports$4.jsx("div",{className:"d-grid my-16",children:jsxRuntimeExports$4.jsx(Button$1,{disabled:Rt,type:"button",color:"primary",variant:"outline",leftIcon:jsxRuntimeExports$4.jsx(SvgPlus$1,{}),onClick:vt,children:dt("explorer.folder.new")})}),jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:ft&&jsxRuntimeExports$4.jsx(CreateModal,{edit:!1,isOpen:ft,onSuccess:vt,onCancel:vt})})]}):null};function Breadcrumb(){const{i18n:lt}=useOdeClient(),dt=useSelectedNodesIds(),ft=useIsTrash(),vt=useCurrentFolder(),{gotoPreviousFolder:Et}=useStoreActions(),Rt=lt("explorer.tree.trash"),St=lt("explorer.filters.mine"),At=(vt==null?void 0:vt.name)||St;return jsxRuntimeExports$4.jsx("div",{className:"py-16",children:dt.length>1&&!ft?jsxRuntimeExports$4.jsxs("div",{className:"d-flex align-items-center gap-8",children:[jsxRuntimeExports$4.jsx(IconButton$1,{icon:jsxRuntimeExports$4.jsx(SvgArrowLeft$1,{}),variant:"ghost",color:"tertiary","aria-label":lt("back"),className:"ms-n16",onClick:Et}),jsxRuntimeExports$4.jsx("p",{className:"body py-8 text-truncate",children:jsxRuntimeExports$4.jsx("strong",{children:At})})]}):jsxRuntimeExports$4.jsx("h2",{className:"body py-8 fw-bold",children:ft?Rt:St})})}const useOnboardingModal=()=>{const[lt,dt]=reactExports.useState(!1),[ft,vt]=reactExports.useState(!0);return reactExports.useEffect(()=>{(async()=>{const Rt=await getOnboardingTrash();if(Rt){dt(JSON.parse(Rt==null?void 0:Rt.showOnboardingTrash));return}dt(!0)})()},[]),{isOnboardingTrash:lt,isOpen:ft,handleSavePreference:async()=>{await saveOnboardingTrash({onSuccess:()=>vt(!1)})},setIsOpen:vt}},useTrashModal=()=>{const lt=useResourceIsTrash(),{clearSelectedIds:dt,setResourceIsTrash:ft,clearSelectedItems:vt}=useStoreActions();return{isTrashedModalOpen:lt,onTrashedCancel:()=>{dt(),vt(),ft(!1)}}},OnboardingTrash=reactExports.lazy(async()=>await __vitePreload(()=>import("./OnboardingTrash.js"),[])),AppAction=reactExports.lazy(async()=>await __vitePreload(()=>import("./AppAction.js"),[])),Library=reactExports.lazy(async()=>await __vitePreload(()=>import("./Library.js"),[])),TrashedResourceModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./TrashedResourceModal.js"),[]));function Explorer(){const{currentApp:lt}=useOdeClient(),{isOnboardingTrash:dt,isOpen:ft,setIsOpen:vt,handleSavePreference:Et}=useOnboardingModal(),{data:Rt}=useActions(),{isTrashedModalOpen:St,onTrashedCancel:At}=useTrashModal();useXitiTrackPageLoad();const Ct=Rt==null?void 0:Rt.find(Tt=>Tt.id==="publish"),kt=Tt=>{const Nt=Rt==null?void 0:Rt.filter(Ft=>Ft.id===Tt&&Ft.available);return Nt&&Nt.length>0};return jsxRuntimeExports$4.jsxs(jsxRuntimeExports$4.Fragment,{children:[jsxRuntimeExports$4.jsxs(AppHeader,{children:[jsxRuntimeExports$4.jsxs(AppCard$1,{app:lt,isHeading:!0,headingStyle:"h3",level:"h1",children:[jsxRuntimeExports$4.jsx(AppIcon$1,{app:lt,size:"40"}),jsxRuntimeExports$4.jsx(AppCard$1.Name,{})]}),kt("create")&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(AppAction,{})})]}),jsxRuntimeExports$4.jsxs(Grid,{className:"flex-grow-1",children:[jsxRuntimeExports$4.jsxs(Grid.Col,{sm:"3",className:"border-end pt-16 pe-16 d-none d-lg-block",as:"aside",children:[jsxRuntimeExports$4.jsx(TreeViewContainer,{}),(Ct==null?void 0:Ct.available)&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(Library,{})})]}),jsxRuntimeExports$4.jsxs(Grid.Col,{sm:"4",md:"8",lg:"9",children:[jsxRuntimeExports$4.jsx(Breadcrumb,{}),jsxRuntimeExports$4.jsx(List,{})]}),jsxRuntimeExports$4.jsx(ActionBarContainer,{}),dt&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(OnboardingTrash,{isOpen:ft,setIsOpen:vt,handleSavePreference:Et})}),St&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(TrashedResourceModal,{isOpen:St,onCancel:At})})]})]})}function Root(){const{init:lt}=useOdeClient();return lt?lt?jsxRuntimeExports$4.jsx(Layout$1,{children:jsxRuntimeExports$4.jsx(Explorer,{})}):null:jsxRuntimeExports$4.jsx(LoadingScreen$1,{position:!1})}const root=document.getElementById("root"),queryClient=new QueryClient({queryCache:new QueryCache({onError:lt=>{lt==="0090"&&window.location.replace("/auth/login")}}),defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});createRoot(root).render(jsxRuntimeExports$4.jsx(reactExports.StrictMode,{children:jsxRuntimeExports$4.jsxs(QueryClientProvider,{client:queryClient,children:[jsxRuntimeExports$4.jsx(OdeClientProvider,{params:getAppParams(),children:jsxRuntimeExports$4.jsx(Root,{})}),jsxRuntimeExports$4.jsx(ReactQueryDevtools,{initialIsOpen:!1})]})}));export{SvgRafterUp$1 as $,APP as A,Button$1 as B,useDelete as C,useTrash as D,useIsTrash as E,FormControl$1 as F,useMoveItem as G,Heading$1 as H,Image$1 as I,useSelectedFolders as J,useQueryClient as K,Loading$1 as L,Modal$1 as M,useTreeData as N,useCurrentFolder as O,useCreateFolder as P,useUpdatefolder as Q,React$2 as R,SvgPlus$1 as S,TreeView$1 as T,FOLDER as U,VisuallyHidden$1 as V,Label$1 as W,FormText$1 as X,SvgCopy$1 as Y,Gt as Z,it$1 as _,reactDomExports as a,useFormControl as a0,TransportFrameworkFactory as a1,useResourceIds as a2,RESOURCE as a3,SvgEdit$1 as a4,SvgDelete$1 as a5,AppIcon$1 as a6,useActions as a7,useSearchContext as a8,useFolderIds as a9,J as aa,dayjs as ab,SvgOptions$1 as ac,SvgGlobe$1 as ad,SvgUsers$1 as ae,useOdeIcons as af,SvgFiles$1 as ag,SvgOneProfile$1 as ah,getDefaultExportFromCjs$1 as ai,useStoreActions as b,jsxRuntimeExports$1 as c,SvgArrowRight$1 as d,clsx as e,useI18n as f,getAppParams as g,useSearchParams as h,useUser as i,jsxRuntimeExports$4 as j,useSelectedResources as k,useUpdateResource as l,useShareResource as m,useHotToast as n,odeServices as o,SvgBookmark$1 as p,Alert$1 as q,reactExports as r,Avatar$1 as s,SvgRafterDown$1 as t,useOdeClient as u,IconButton$1 as v,SvgClose$1 as w,SvgSave$1 as x,SvgInfoCircle$1 as y,Input$1 as z};
282
+ */var h=reactExports,n=shimExports;function p(lt,dt){return lt===dt&&(lt!==0||1/lt===1/dt)||lt!==lt&&dt!==dt}var q=typeof Object.is=="function"?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;withSelector_production_min.useSyncExternalStoreWithSelector=function(lt,dt,ft,vt,Et){var Rt=t(null);if(Rt.current===null){var St={hasValue:!1,value:null};Rt.current=St}else St=Rt.current;Rt=v(function(){function Ct(Dt){if(!kt){if(kt=!0,Tt=Dt,Dt=vt(Dt),Et!==void 0&&St.hasValue){var Ut=St.value;if(Et(Ut,Dt))return Nt=Ut}return Nt=Dt}if(Ut=Nt,q(Tt,Dt))return Ut;var zt=vt(Dt);return Et!==void 0&&Et(Ut,zt)?Ut:(Tt=Dt,Nt=zt)}var kt=!1,Tt,Nt,Ft=ft===void 0?null:ft;return[function(){return Ct(dt())},Ft===null?void 0:function(){return Ct(Ft())}]},[dt,ft,vt,Et]);var At=r(lt,Rt[0],Rt[1]);return u(function(){St.hasValue=!0,St.value=At},[At]),w(At),At};withSelector.exports=withSelector_production_min;var withSelectorExports=withSelector.exports;const useSyncExternalStoreExports=getDefaultExportFromCjs$1(withSelectorExports),{useSyncExternalStoreWithSelector}=useSyncExternalStoreExports;function useStore(lt,dt=lt.getState,ft){const vt=useSyncExternalStoreWithSelector(lt.subscribe,lt.getState,lt.getServerState||lt.getState,dt,ft);return reactExports.useDebugValue(vt),vt}const createImpl=lt=>{({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&typeof lt!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const dt=typeof lt=="function"?createStore(lt):lt,ft=(vt,Et)=>useStore(dt,vt,Et);return Object.assign(ft,dt),ft},create=lt=>lt?createImpl(lt):createImpl;function getAncestors(lt,dt){var vt;const ft=findNodeById(lt,dt);return(vt=ft==null?void 0:ft.folder)!=null&&vt.ancestors?[...(ft==null?void 0:ft.folder.ancestors)||[],lt]:lt===FOLDER.BIN?[FOLDER.BIN]:[FOLDER.DEFAULT]}function hasChildren(lt,dt){return dt.id===lt&&dt.children?dt.children.length>0:dt.children?dt.children.some(ft=>hasChildren(dt.id,ft)):!1}const{app,types,filters,orders}=getAppParams(),useStoreContext=create()((lt,dt)=>({filters,orders,searchParams:{app,types,filters:{folder:"default"},orders:{updatedAt:"desc"},pagination:{startIdx:0,pageSize:48,maxIdx:0},trashed:!1},treeData:{id:FOLDER.DEFAULT,name:"Mes blogs",section:!0,children:[]},selectedNodesIds:["default"],currentFolder:{id:"default"},selectedFolders:[],selectedResources:[],folderIds:[],resourceIds:[],resourceIsTrash:!1,updaters:{setTreeData:ft=>lt(()=>({treeData:ft})),setSearchParams:ft=>lt(()=>({searchParams:ft})),setSelectedFolders:ft=>lt(()=>({selectedFolders:ft})),setSelectedResources:ft=>lt(()=>({selectedResources:ft})),setFolderIds:ft=>lt(()=>({folderIds:ft})),setResourceIds:ft=>lt(()=>({resourceIds:ft})),setResourceIsTrash:ft=>lt(()=>({resourceIsTrash:ft})),setCurrentFolder:ft=>lt(()=>({currentFolder:ft})),clearSelectedItems:()=>lt(()=>({selectedFolders:[],selectedResources:[]})),clearSelectedIds:()=>lt(()=>({resourceIds:[],folderIds:[]})),openResource:ft=>{try{const{searchParams:vt}=dt();goToResource({searchParams:vt,assetId:ft.assetId})}catch(vt){console.error("explorer open failed: ",vt)}},createResource:()=>{try{const{searchParams:ft,currentFolder:vt}=dt(),Et=parseInt((vt==null?void 0:vt.id)||"default"),Rt=isNaN(Et)?void 0:Et;createResource({searchParams:ft,safeFolderId:Rt})}catch(ft){console.error("explorer create failed: ",ft)}},printSelectedResource:()=>{try{const{searchParams:ft,selectedResources:vt,resourceIds:Et}=dt();if(vt.length!==1)throw new Error("Cannot open more than 1 resource");const Rt=vt.find(St=>St.id===Et[0]);printResource({searchParams:ft,assetId:Rt.assetId})}catch(ft){console.error("explorer print failed: ",ft)}},publishApi:async(ft,vt)=>{const{searchParams:Et}=dt();return await publishResource({searchParams:Et,params:vt})},openFolder:({folderId:ft,folder:vt})=>{const{searchParams:Et,treeData:Rt}=dt(),St=Et.filters.folder,At=getAncestors(ft,Rt),Ct=arrayUnique([...At,ft]);St!==ft&&lt(kt=>({...kt,folderIds:[],resourceIds:[],selectedNodesIds:Ct,currentFolder:vt||{id:ft},searchParams:{...Et,filters:{...Et.filters,folder:ft},trashed:ft===FOLDER.BIN}}))},foldTreeItem:()=>lt(ft=>({...ft,status:"fold"})),unfoldTreeItem:async(ft,vt)=>{const{treeData:Et,searchParams:Rt}=dt();if(lt(St=>({...St,status:"unfold"})),!hasChildren(ft,Et)){await vt.prefetchInfiniteQuery({queryKey:["prefetchContext",{folderId:ft,trashed:!1}],queryFn:async()=>await searchContext({...Rt,filters:{...Rt.filters,folder:ft}})});const St=vt.getQueryData(["prefetchContext",{folderId:ft,trashed:!1}]);lt(At=>{var Ct;return{...At,treeData:wrapTreeNode(Et,(Ct=St==null?void 0:St.pages[0])==null?void 0:Ct.folders,ft||FOLDER.DEFAULT)}})}},selectTreeItem:ft=>{const{treeData:vt}=dt(),{openFolder:Et}=dt().updaters,Rt=findNodeById(ft,vt);Et({folder:Rt,folderId:ft})},gotoPreviousFolder:()=>{const{selectedNodesIds:ft,treeData:vt}=dt(),{openFolder:Et}=dt().updaters,Rt=ft.length;if(Rt<2)return;const St=findNodeById(ft[Rt-2],vt);Et({folder:St,folderId:(St==null?void 0:St.id)||FOLDER.DEFAULT})},goToTrash:()=>lt(ft=>({...ft,selectedNodesIds:[],resourceIds:[],folderIds:[],searchParams:{...ft.searchParams,filters:{folder:FOLDER.BIN},trashed:!0},currentFolder:{id:FOLDER.BIN}}))}})),useSearchParams=()=>useStoreContext(lt=>lt.searchParams),useSelectedNodesIds=()=>useStoreContext(lt=>lt.selectedNodesIds),useTreeData=()=>useStoreContext(lt=>lt.treeData),useSelectedFolders=()=>useStoreContext(lt=>lt.selectedFolders),useSelectedResources=()=>useStoreContext(lt=>lt.selectedResources),useFolderIds=()=>useStoreContext(lt=>lt.folderIds),useResourceIds=()=>useStoreContext(lt=>lt.resourceIds),useCurrentFolder=()=>useStoreContext(lt=>lt.currentFolder),useStoreActions=()=>useStoreContext(lt=>lt.updaters),useIsTrash=()=>{const lt=useCurrentFolder();return(lt==null?void 0:lt.id)===FOLDER.BIN},useResourceIsTrash=()=>useStoreContext(lt=>lt.resourceIsTrash),useIsRoot=()=>{const lt=useCurrentFolder();return(lt==null?void 0:lt.id)==="default"},useHasSelectedNodes=()=>useSelectedNodesIds().length>1,{actions}=getAppParams(),useActions=()=>useQuery({queryKey:["actions"],queryFn:async()=>{const lt=actions.map(ft=>ft.workflow);return await sessionHasWorkflowRights(lt)},select:lt=>actions.map(dt=>({...dt,available:lt[dt.workflow]}))}),useSearchContext=()=>{const{i18n:lt}=useOdeClient(),dt=useQueryClient(),ft=useSearchParams(),vt=useCurrentFolder(),Et=useTreeData(),{setTreeData:Rt,setSearchParams:St}=useStoreActions(),At=["context",{folderId:ft.filters.folder,trashed:ft.trashed}];return useInfiniteQuery({queryKey:At,queryFn:async({pageParam:Ct=0})=>await searchContext({...ft,pagination:{...ft.pagination,startIdx:Ct}}),onSuccess:async Ct=>{var Tt,Nt;await dt.cancelQueries({queryKey:At});const kt=(Tt=Ct==null?void 0:Ct.pages[0])==null?void 0:Tt.folders;(vt==null?void 0:vt.id)==="default"?Rt({id:FOLDER.DEFAULT,section:!0,children:kt.map(Ft=>new TreeNodeFolderWrapper(Ft)),name:lt("explorer.filters.mine")}):Rt(wrapTreeNode(Et,kt,ft.filters.folder||FOLDER.DEFAULT)),St({...ft,pagination:(Nt=Ct==null?void 0:Ct.pages[(Ct==null?void 0:Ct.pages.length)-1])==null?void 0:Nt.pagination})},getNextPageParam:Ct=>Ct.pagination.startIdx+Ct.pagination.pageSize})},useTrash=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=useTreeData(),vt=useFolderIds(),Et=useResourceIds(),{clearSelectedItems:Rt,clearSelectedIds:St,setTreeData:At}=useStoreActions(),Ct=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async()=>await trashAll({searchParams:dt,folderIds:vt,resourceIds:Et}),onSuccess:async()=>{if(await lt.cancelQueries({queryKey:Ct}),lt.getQueryData(Ct))return lt.setQueryData(Ct,Tt=>{if(Tt){const Nt={...Tt,pages:Tt==null?void 0:Tt.pages.map(Dt=>({...Dt,folders:Dt.folders.filter(Ut=>!vt.includes(Ut.id)),resources:Dt.resources.filter(Ut=>!Et.includes(Ut.id))}))},Ft=deleteNode(ft,{folders:vt});return At(Ft),Nt}})},onSettled:()=>{Rt(),St()}})},useRestore=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=useFolderIds(),vt=useResourceIds(),{setFolderIds:Et,setResourceIds:Rt,setSelectedResources:St,setSelectedFolders:At}=useStoreActions(),Ct=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async()=>await restoreAll({searchParams:dt,folderIds:ft,resourceIds:vt}),onSuccess:async()=>{if(await lt.cancelQueries({queryKey:Ct}),lt.getQueryData(Ct))return lt.setQueryData(Ct,Tt=>{if(Tt)return{...Tt,pages:Tt==null?void 0:Tt.pages.map(Nt=>({...Nt,folders:Nt.folders.filter(Ft=>!ft.includes(Ft.id)),resources:Nt.resources.filter(Ft=>!vt.includes(Ft.id))}))}})},onSettled:()=>{Rt([]),St([]),Et([]),At([])}})},useDelete=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=useFolderIds(),vt=useResourceIds(),{clearSelectedItems:Et,clearSelectedIds:Rt}=useStoreActions(),St=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async()=>await deleteAll({searchParams:dt,folderIds:ft,resourceIds:vt}),onSuccess:async()=>{if(await lt.cancelQueries({queryKey:St}),lt.getQueryData(St))return lt.setQueryData(St,Ct=>{if(Ct)return{...Ct,pages:Ct==null?void 0:Ct.pages.map(Tt=>({...Tt,folders:Tt.folders.filter(Nt=>!ft.includes(Nt.id)),resources:Tt.resources.filter(Nt=>!vt.includes(Nt.id))}))}})},onSettled:()=>{Et(),Rt()}})},useMoveItem=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=useTreeData(),vt=useFolderIds(),Et=useResourceIds(),{clearSelectedIds:Rt,clearSelectedItems:St,setTreeData:At}=useStoreActions(),Ct=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async kt=>await moveToFolder({searchParams:dt,folderId:kt,folderIds:vt,resourceIds:Et}),onSuccess:async(kt,Tt)=>{if(lt.getQueryData(Ct))return lt.setQueryData(Ct,Ft=>{if(Ft){const Dt=moveNode(ft,{destinationId:Tt,folders:vt});return At(Dt),{...Ft,pages:Ft==null?void 0:Ft.pages.map(Ut=>({...Ut,folders:Ut.folders.filter(zt=>!vt.includes(zt.id)),resources:Ut.resources.filter(zt=>!Et.includes(zt.id))}))}}})},onSettled:()=>{St(),Rt()}})},useCreateFolder=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=useTreeData(),{setTreeData:vt}=useStoreActions(),Et=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async({name:Rt,parentId:St})=>await createFolder({searchParams:dt,name:Rt,parentId:St}),onSuccess:async(Rt,St)=>{await lt.cancelQueries({queryKey:Et});const At=lt.getQueryData(Et),Ct={...Rt,parentId:St.parentId,children:[],rights:[`creator:${Rt==null?void 0:Rt.creator_id}`]};if(At)return lt.setQueryData(Et,kt=>{if(kt){const Tt={...kt,pages:kt==null?void 0:kt.pages.map(Ft=>({...Ft,folders:[...Ft.folders,Ct]}))},Nt=addNode(ft,{parentId:St.parentId,newFolder:Ct});return vt(Nt),Tt}})},onSettled:async()=>await lt.cancelQueries({queryKey:Et})})},useUpdatefolder=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=useTreeData(),{setFolderIds:vt,setSelectedFolders:Et,setTreeData:Rt}=useStoreActions(),St=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async({folderId:At,name:Ct,parentId:kt})=>await updateFolder({searchParams:dt,folderId:At,parentId:kt,name:Ct}),onSuccess:async(At,Ct)=>{if(await lt.cancelQueries({queryKey:St}),lt.getQueryData(St))return lt.setQueryData(St,Tt=>{if(Tt){const Nt={...Tt,pages:Tt==null?void 0:Tt.pages.map(Dt=>({...Dt,folders:Dt.folders.map(Ut=>Ut.id===At.id?{...At,parentId:Ct.parentId,rights:Ut.rights}:Ut)}))},Ft=updateNode(ft,{folderId:Ct.folderId,newFolder:At});return Rt(Ft),Nt}})},onSettled:()=>{vt([]),Et([])}})},useShareResource=()=>{const lt=useQueryClient(),dt=useSearchParams(),{setResourceIds:ft,setSelectedResources:vt}=useStoreActions(),Et=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async({entId:Rt,shares:St})=>await shareResource({searchParams:dt,entId:Rt,shares:St}),onSuccess:async(Rt,St)=>{if(await lt.cancelQueries({queryKey:Et}),lt.getQueryData(Et))return lt.setQueryData(Et,Ct=>{if(Ct)return{...Ct,pages:Ct==null?void 0:Ct.pages.map(kt=>({...kt,resources:kt.resources.map(Tt=>{if(Tt.assetId===(St==null?void 0:St.entId)){let Nt=[`creator:${Tt.creatorId}`];return(St==null?void 0:St.shares.length)>=1&&(Nt=[...Nt,...St.shares.flatMap(Ft=>Ft.actions.map(Dt=>`${Ft.type}:${Ft.id}:${Dt.id}`))]),{...Tt,rights:Nt}}else return Tt})}))}})},onSettled:()=>{ft([]),vt([])}})},useUpdateResource=()=>{const lt=useQueryClient(),dt=useSearchParams(),ft=["context",{folderId:dt.filters.folder,trashed:dt.trashed}];return useMutation({mutationFn:async vt=>await updateResource({searchParams:dt,params:vt}),onSuccess:async(vt,Et)=>{if(await lt.cancelQueries({queryKey:ft}),lt.getQueryData(ft))return lt.setQueryData(ft,St=>{if(St)return{...St,pages:St==null?void 0:St.pages.map(At=>({...At,resources:At.resources.map(Ct=>{if(Ct.assetId===(Et==null?void 0:Et.entId)){const{name:kt,thumbnail:Tt,public:Nt,description:Ft,slug:Dt,...Ut}=Et;return{...Ct,...Ut,name:kt,thumbnail:Tt,public:Nt,description:Ft,slug:Dt}}else return Ct})}))}})}})},{trashActions}=getAppParams();function useActionBar(){const[lt,dt]=reactExports.useState(!1),[ft,vt]=reactExports.useState("void"),[Et,Rt]=reactExports.useState(),{i18n:St}=useI18n(),{hotToast:At}=useHotToast(Alert$1),Ct=useCurrentFolder(),kt=useResourceIds(),Tt=useSelectedResources(),Nt=useSelectedFolders(),Ft=useFolderIds(),Dt=useIsTrash(),Ut=useRestore(),zt=useResourceIsTrash(),{openResource:Zt,createResource:Ht,printSelectedResource:Bt,openFolder:Wt,clearSelectedItems:Kt,clearSelectedIds:ar}=useStoreActions(),{data:rr}=useActions();reactExports.useEffect(()=>{if(kt.length===0&&Ft.length===0){dt(!1);return}if(zt){dt(!1);return}dt(!0)},[kt,Ft]);async function ur(_r){var Tr;switch((Tr=document.getElementById("root"))==null||Tr.setAttribute("aria-hidden","true"),Rt(_r),_r.id){case ACTION.OPEN:return kt.length>0?Zt(Tt[0]):Wt({folder:Nt[0],folderId:Nt[0].id});case ACTION.CREATE:return Ht();case ACTION.MOVE:return vt("move");case ACTION.PRINT:return Bt();case ACTION.DELETE:return vt("delete");case ACTION.RESTORE:return await dr();case ACTION.PUBLISH:return vt("publish");case ACTION.UPD_PROPS:case"edit":return br();case ACTION.SHARE:return vt("share");default:throw Error(`Unknown action: ${_r.id}`)}}function sr(_r){const Tr=kt.length+Ft.length,Cr=kt.length===1||Ft.length===1,Or=Tr===1,Pr=Ft.length===0;switch(_r.id){case ACTION.OPEN:return Or;case ACTION.MANAGE:return Cr;case ACTION.PUBLISH:return Cr&&Pr;case ACTION.UPD_PROPS:return Cr&&Pr;case ACTION.SHARE:return Pr&&Cr;case ACTION.PRINT:return Cr&&Pr;case"edit":return Or;default:return!0}}function mr(){return!0}async function dr(){try{if(Dt)await Ut.mutate(),At.success(St("explorer.trash.toast"));else throw new Error("Cannot restore untrashed resources");Sr()}catch(_r){console.error(_r)}}function Sr(){var _r;vt("void"),Et!=null&&Et.id&&((_r=document.getElementById(Et==null?void 0:Et.id))==null||_r.focus())}const Er=_r=>()=>{ft===_r&&(Sr(),Kt(),ar())},xr=Er("move"),ir=Er("move"),lr=Er("delete"),yr=Er("delete"),pr=Er("publish"),nr=Er("publish"),cr=Er("edit_folder"),hr=Er("edit_folder"),Rr=Er("edit_resource"),wr=Er("edit_resource"),Ar=Er("share"),jr=Er("share");function br(){kt&&kt.length>0?vt("edit_resource"):vt("edit_folder")}function kr(_r){return _r.id==="edit"&&Ft.length>0?"explorer.rename":`explorer.actions.${_r.id}`}return{onRestore:dr,actions:Dt?trashActions:rr,selectedElement:[...Tt,...Nt],currentFolderId:Ct==null?void 0:Ct.id,overrideLabel:kr,handleClick:ur,isActivable:Dt?mr:sr,isActionBarOpen:lt,isMoveModalOpen:ft==="move",onMoveCancel:xr,onMoveSuccess:ir,isDeleteModalOpen:ft==="delete",onDeleteCancel:yr,onDeleteSuccess:lr,isPublishModalOpen:ft==="publish",onPublishCancel:nr,onPublishSuccess:pr,isEditFolderOpen:ft==="edit_folder",onEditFolderCancel:hr,onEditFolderSuccess:cr,isEditResourceOpen:ft==="edit_resource",onEditResourceCancel:wr,onEditResourceSuccess:Rr,isShareResourceOpen:ft==="share",onShareResourceCancel:jr,onShareResourceSuccess:Ar,onClearActionBar:Sr}}function useAccessControl({roles:lt,rights:dt,action:ft}){const[vt,Et]=reactExports.useState(!1),{user:Rt}=useUser(),St=useIsTrash();reactExports.useEffect(()=>{kt()},[lt,dt]);const At=async function(Tt){const Nt=Tt instanceof Array?Tt:[Tt];if(lt instanceof Array){const Ft=await odeServices.rights().sessionHasAtLeastOneResourceRight(lt,Nt);Et(Ft)}else{const Ft=await odeServices.rights().sessionHasResourceRight(lt,Nt);Et(Ft)}},Ct=async function(Tt){if(lt instanceof Array){const Nt=await odeServices.rights().sessionHasAtLeastOneResourceRightForEachList(lt,Tt);Et(Nt)}else{const Nt=await odeServices.rights().sessionHasResourceRightForEachList(lt,Tt);Et(Nt)}},kt=async function(){var Tt,Nt;if(lt===void 0){Et(!0);return}if(St&&((Nt=(Tt=dt[0])==null?void 0:Tt.trashedBy)!=null&&Nt.includes(Rt==null?void 0:Rt.userId))&&ft==="restore"){Et(!0);return}if(dt instanceof Array)if(dt.length>0)if(typeof dt[0]=="string")await At(dt);else{const Ft=dt.map(Dt=>Dt.rights);await Ct(Ft)}else Et(!1);else typeof dt=="string"?await At(dt):await At(dt.rights)};return{visible:vt,refreshState:kt}}function AccessControl({resourceRights:lt,roleExpected:dt,children:ft,renderWhenForbidden:vt,actionId:Et}){const{visible:Rt}=useAccessControl({roles:dt,rights:lt,action:Et});return Rt?jsxRuntimeExports$4.jsx(jsxRuntimeExports$4.Fragment,{children:ft}):vt?vt():jsxRuntimeExports$4.jsx(jsxRuntimeExports$4.Fragment,{})}const ShareResourceModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./ShareResourceModal.js"),["ShareResourceModal.js","SelectList.js","Tooltip.js","usePopper.js"])),DeleteModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./DeleteModal.js"),[])),MoveModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./MoveModal.js"),[])),EditFolderModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./EditFolderModal.js"),["EditFolderModal.js","index.esm.js"])),EditResourceModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./EditResourceModal.js"),["EditResourceModal.js","ImagePicker.js","index.esm.js"])),PublishModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./PublishModal.js"),["PublishModal.js","usePopper.js","SelectList.js","ImagePicker.js","index.esm.js"]));function ActionBarContainer(){const{i18n:lt}=useI18n(),{actions:dt,selectedElement:ft,isMoveModalOpen:vt,isDeleteModalOpen:Et,isPublishModalOpen:Rt,isActionBarOpen:St,isEditFolderOpen:At,overrideLabel:Ct,onEditFolderCancel:kt,onEditFolderSuccess:Tt,isEditResourceOpen:Nt,onEditResourceCancel:Ft,onEditResourceSuccess:Dt,isShareResourceOpen:Ut,onShareResourceCancel:zt,onShareResourceSuccess:Zt,onMoveCancel:Ht,onMoveSuccess:Bt,onDeleteCancel:Wt,onDeleteSuccess:Kt,onPublishCancel:ar,onPublishSuccess:rr,isActivable:ur,handleClick:sr}=useActionBar(),mr=Gt(St,{from:{opacity:0,transform:"translateY(100%)"},enter:{opacity:1,transform:"translateY(0)"},leave:{opacity:0,transform:"translateY(100%)"}});return jsxRuntimeExports$4.jsxs(jsxRuntimeExports$4.Fragment,{children:[mr((dr,Sr)=>Sr&&jsxRuntimeExports$4.jsx(it$1.div,{className:"position-fixed bottom-0 start-0 end-0 z-3",style:dr,children:jsxRuntimeExports$4.jsx(ActionBar$1,{children:dt==null?void 0:dt.filter(Er=>Er.available&&Er.target==="actionbar").map(Er=>ur(Er)&&jsxRuntimeExports$4.jsx(AccessControl,{resourceRights:ft,roleExpected:Er.right,actionId:Er.id,children:jsxRuntimeExports$4.jsx(Button$1,{id:Er.id,type:"button",color:"primary",variant:"filled",onClick:()=>{sr(Er)},children:lt(Ct(Er))},Er.id)},Er.id))})})),jsxRuntimeExports$4.jsxs(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:[vt&&jsxRuntimeExports$4.jsx(MoveModal,{isOpen:vt,onCancel:Ht,onSuccess:Bt}),Et&&jsxRuntimeExports$4.jsx(DeleteModal,{isOpen:Et,onCancel:Wt,onSuccess:Kt}),Rt&&jsxRuntimeExports$4.jsx(PublishModal,{isOpen:Rt,onCancel:ar,onSuccess:rr}),At&&jsxRuntimeExports$4.jsx(EditFolderModal,{edit:!0,isOpen:At,onCancel:kt,onSuccess:Tt}),Nt&&jsxRuntimeExports$4.jsx(EditResourceModal,{edit:!0,isOpen:Nt,onCancel:Ft,onSuccess:Dt}),Ut&&jsxRuntimeExports$4.jsx(ShareResourceModal,{isOpen:Ut,onCancel:zt,onSuccess:Zt})]})]})}const AppHeader=({children:lt})=>jsxRuntimeExports$4.jsx("div",{className:"d-flex justify-content-between p-16 mx-n16 border-bottom",children:lt}),EmptyScreenApp=reactExports.lazy(async()=>await __vitePreload(()=>import("./EmptyScreenApp.js"),["EmptyScreenApp.js","EmptyScreen.js"])),EmptyScreenNoContentInFolder=reactExports.lazy(async()=>await __vitePreload(()=>import("./EmptyScreenNoContentInFolder.js"),["EmptyScreenNoContentInFolder.js","EmptyScreen.js"])),EmptyScreenTrash=reactExports.lazy(async()=>await __vitePreload(()=>import("./EmptyScreenTrash.js"),["EmptyScreenTrash.js","EmptyScreen.js"])),FoldersList=reactExports.lazy(async()=>await __vitePreload(()=>import("./FoldersList.js"),["FoldersList.js","Card.js","Tooltip.js","usePopper.js"])),ResourcesList=reactExports.lazy(async()=>await __vitePreload(()=>import("./ResourcesList.js"),["ResourcesList.js","Card.js","Tooltip.js","usePopper.js"])),List=()=>{const lt=useIsRoot(),dt=useIsTrash(),ft=useHasSelectedNodes(),{data:vt,isLoading:Et}=useSearchContext(),Rt=(vt==null?void 0:vt.pages[0].folders.length)===0,St=(vt==null?void 0:vt.pages[0].resources.length)===0,At=Rt&&St;return jsxRuntimeExports$4.jsxs(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:[!At&&!Et&&jsxRuntimeExports$4.jsxs(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:[jsxRuntimeExports$4.jsx(FoldersList,{}),jsxRuntimeExports$4.jsx(ResourcesList,{})]}),lt&&At&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(EmptyScreenApp,{})}),ft&&At&&!dt&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(EmptyScreenNoContentInFolder,{})}),dt&&(vt==null?void 0:vt.pages[0].resources.length)===0&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(EmptyScreenTrash,{})})]})};var dayjs_min={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt()})(commonjsGlobal,function(){var ft=1e3,vt=6e4,Et=36e5,Rt="millisecond",St="second",At="minute",Ct="hour",kt="day",Tt="week",Nt="month",Ft="quarter",Dt="year",Ut="date",zt="Invalid Date",Zt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Ht=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Bt={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(xr){var ir=["th","st","nd","rd"],lr=xr%100;return"["+xr+(ir[(lr-20)%10]||ir[lr]||ir[0])+"]"}},Wt=function(xr,ir,lr){var yr=String(xr);return!yr||yr.length>=ir?xr:""+Array(ir+1-yr.length).join(lr)+xr},Kt={s:Wt,z:function(xr){var ir=-xr.utcOffset(),lr=Math.abs(ir),yr=Math.floor(lr/60),pr=lr%60;return(ir<=0?"+":"-")+Wt(yr,2,"0")+":"+Wt(pr,2,"0")},m:function xr(ir,lr){if(ir.date()<lr.date())return-xr(lr,ir);var yr=12*(lr.year()-ir.year())+(lr.month()-ir.month()),pr=ir.clone().add(yr,Nt),nr=lr-pr<0,cr=ir.clone().add(yr+(nr?-1:1),Nt);return+(-(yr+(lr-pr)/(nr?pr-cr:cr-pr))||0)},a:function(xr){return xr<0?Math.ceil(xr)||0:Math.floor(xr)},p:function(xr){return{M:Nt,y:Dt,w:Tt,d:kt,D:Ut,h:Ct,m:At,s:St,ms:Rt,Q:Ft}[xr]||String(xr||"").toLowerCase().replace(/s$/,"")},u:function(xr){return xr===void 0}},ar="en",rr={};rr[ar]=Bt;var ur=function(xr){return xr instanceof Sr},sr=function xr(ir,lr,yr){var pr;if(!ir)return ar;if(typeof ir=="string"){var nr=ir.toLowerCase();rr[nr]&&(pr=nr),lr&&(rr[nr]=lr,pr=nr);var cr=ir.split("-");if(!pr&&cr.length>1)return xr(cr[0])}else{var hr=ir.name;rr[hr]=ir,pr=hr}return!yr&&pr&&(ar=pr),pr||!yr&&ar},mr=function(xr,ir){if(ur(xr))return xr.clone();var lr=typeof ir=="object"?ir:{};return lr.date=xr,lr.args=arguments,new Sr(lr)},dr=Kt;dr.l=sr,dr.i=ur,dr.w=function(xr,ir){return mr(xr,{locale:ir.$L,utc:ir.$u,x:ir.$x,$offset:ir.$offset})};var Sr=function(){function xr(lr){this.$L=sr(lr.locale,null,!0),this.parse(lr)}var ir=xr.prototype;return ir.parse=function(lr){this.$d=function(yr){var pr=yr.date,nr=yr.utc;if(pr===null)return new Date(NaN);if(dr.u(pr))return new Date;if(pr instanceof Date)return new Date(pr);if(typeof pr=="string"&&!/Z$/i.test(pr)){var cr=pr.match(Zt);if(cr){var hr=cr[2]-1||0,Rr=(cr[7]||"0").substring(0,3);return nr?new Date(Date.UTC(cr[1],hr,cr[3]||1,cr[4]||0,cr[5]||0,cr[6]||0,Rr)):new Date(cr[1],hr,cr[3]||1,cr[4]||0,cr[5]||0,cr[6]||0,Rr)}}return new Date(pr)}(lr),this.$x=lr.x||{},this.init()},ir.init=function(){var lr=this.$d;this.$y=lr.getFullYear(),this.$M=lr.getMonth(),this.$D=lr.getDate(),this.$W=lr.getDay(),this.$H=lr.getHours(),this.$m=lr.getMinutes(),this.$s=lr.getSeconds(),this.$ms=lr.getMilliseconds()},ir.$utils=function(){return dr},ir.isValid=function(){return this.$d.toString()!==zt},ir.isSame=function(lr,yr){var pr=mr(lr);return this.startOf(yr)<=pr&&pr<=this.endOf(yr)},ir.isAfter=function(lr,yr){return mr(lr)<this.startOf(yr)},ir.isBefore=function(lr,yr){return this.endOf(yr)<mr(lr)},ir.$g=function(lr,yr,pr){return dr.u(lr)?this[yr]:this.set(pr,lr)},ir.unix=function(){return Math.floor(this.valueOf()/1e3)},ir.valueOf=function(){return this.$d.getTime()},ir.startOf=function(lr,yr){var pr=this,nr=!!dr.u(yr)||yr,cr=dr.p(lr),hr=function(Tr,Cr){var Or=dr.w(pr.$u?Date.UTC(pr.$y,Cr,Tr):new Date(pr.$y,Cr,Tr),pr);return nr?Or:Or.endOf(kt)},Rr=function(Tr,Cr){return dr.w(pr.toDate()[Tr].apply(pr.toDate("s"),(nr?[0,0,0,0]:[23,59,59,999]).slice(Cr)),pr)},wr=this.$W,Ar=this.$M,jr=this.$D,br="set"+(this.$u?"UTC":"");switch(cr){case Dt:return nr?hr(1,0):hr(31,11);case Nt:return nr?hr(1,Ar):hr(0,Ar+1);case Tt:var kr=this.$locale().weekStart||0,_r=(wr<kr?wr+7:wr)-kr;return hr(nr?jr-_r:jr+(6-_r),Ar);case kt:case Ut:return Rr(br+"Hours",0);case Ct:return Rr(br+"Minutes",1);case At:return Rr(br+"Seconds",2);case St:return Rr(br+"Milliseconds",3);default:return this.clone()}},ir.endOf=function(lr){return this.startOf(lr,!1)},ir.$set=function(lr,yr){var pr,nr=dr.p(lr),cr="set"+(this.$u?"UTC":""),hr=(pr={},pr[kt]=cr+"Date",pr[Ut]=cr+"Date",pr[Nt]=cr+"Month",pr[Dt]=cr+"FullYear",pr[Ct]=cr+"Hours",pr[At]=cr+"Minutes",pr[St]=cr+"Seconds",pr[Rt]=cr+"Milliseconds",pr)[nr],Rr=nr===kt?this.$D+(yr-this.$W):yr;if(nr===Nt||nr===Dt){var wr=this.clone().set(Ut,1);wr.$d[hr](Rr),wr.init(),this.$d=wr.set(Ut,Math.min(this.$D,wr.daysInMonth())).$d}else hr&&this.$d[hr](Rr);return this.init(),this},ir.set=function(lr,yr){return this.clone().$set(lr,yr)},ir.get=function(lr){return this[dr.p(lr)]()},ir.add=function(lr,yr){var pr,nr=this;lr=Number(lr);var cr=dr.p(yr),hr=function(Ar){var jr=mr(nr);return dr.w(jr.date(jr.date()+Math.round(Ar*lr)),nr)};if(cr===Nt)return this.set(Nt,this.$M+lr);if(cr===Dt)return this.set(Dt,this.$y+lr);if(cr===kt)return hr(1);if(cr===Tt)return hr(7);var Rr=(pr={},pr[At]=vt,pr[Ct]=Et,pr[St]=ft,pr)[cr]||1,wr=this.$d.getTime()+lr*Rr;return dr.w(wr,this)},ir.subtract=function(lr,yr){return this.add(-1*lr,yr)},ir.format=function(lr){var yr=this,pr=this.$locale();if(!this.isValid())return pr.invalidDate||zt;var nr=lr||"YYYY-MM-DDTHH:mm:ssZ",cr=dr.z(this),hr=this.$H,Rr=this.$m,wr=this.$M,Ar=pr.weekdays,jr=pr.months,br=function(Cr,Or,Pr,Ir){return Cr&&(Cr[Or]||Cr(yr,nr))||Pr[Or].slice(0,Ir)},kr=function(Cr){return dr.s(hr%12||12,Cr,"0")},_r=pr.meridiem||function(Cr,Or,Pr){var Ir=Cr<12?"AM":"PM";return Pr?Ir.toLowerCase():Ir},Tr={YY:String(this.$y).slice(-2),YYYY:dr.s(this.$y,4,"0"),M:wr+1,MM:dr.s(wr+1,2,"0"),MMM:br(pr.monthsShort,wr,jr,3),MMMM:br(jr,wr),D:this.$D,DD:dr.s(this.$D,2,"0"),d:String(this.$W),dd:br(pr.weekdaysMin,this.$W,Ar,2),ddd:br(pr.weekdaysShort,this.$W,Ar,3),dddd:Ar[this.$W],H:String(hr),HH:dr.s(hr,2,"0"),h:kr(1),hh:kr(2),a:_r(hr,Rr,!0),A:_r(hr,Rr,!1),m:String(Rr),mm:dr.s(Rr,2,"0"),s:String(this.$s),ss:dr.s(this.$s,2,"0"),SSS:dr.s(this.$ms,3,"0"),Z:cr};return nr.replace(Ht,function(Cr,Or){return Or||Tr[Cr]||cr.replace(":","")})},ir.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},ir.diff=function(lr,yr,pr){var nr,cr=dr.p(yr),hr=mr(lr),Rr=(hr.utcOffset()-this.utcOffset())*vt,wr=this-hr,Ar=dr.m(this,hr);return Ar=(nr={},nr[Dt]=Ar/12,nr[Nt]=Ar,nr[Ft]=Ar/3,nr[Tt]=(wr-Rr)/6048e5,nr[kt]=(wr-Rr)/864e5,nr[Ct]=wr/Et,nr[At]=wr/vt,nr[St]=wr/ft,nr)[cr]||wr,pr?Ar:dr.a(Ar)},ir.daysInMonth=function(){return this.endOf(Nt).$D},ir.$locale=function(){return rr[this.$L]},ir.locale=function(lr,yr){if(!lr)return this.$L;var pr=this.clone(),nr=sr(lr,yr,!0);return nr&&(pr.$L=nr),pr},ir.clone=function(){return dr.w(this.$d,this)},ir.toDate=function(){return new Date(this.valueOf())},ir.toJSON=function(){return this.isValid()?this.toISOString():null},ir.toISOString=function(){return this.$d.toISOString()},ir.toString=function(){return this.$d.toUTCString()},xr}(),Er=Sr.prototype;return mr.prototype=Er,[["$ms",Rt],["$s",St],["$m",At],["$H",Ct],["$W",kt],["$M",Nt],["$y",Dt],["$D",Ut]].forEach(function(xr){Er[xr[1]]=function(ir){return this.$g(ir,xr[0],xr[1])}}),mr.extend=function(xr,ir){return xr.$i||(xr(ir,Sr,mr),xr.$i=!0),mr},mr.locale=sr,mr.isDayjs=ur,mr.unix=function(xr){return mr(1e3*xr)},mr.en=rr[ar],mr.Ls=rr,mr.p={},mr})})(dayjs_min);var dayjs_minExports=dayjs_min.exports;const dayjs=getDefaultExportFromCjs$1(dayjs_minExports);var relativeTime$1={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt()})(commonjsGlobal,function(){return function(ft,vt,Et){ft=ft||{};var Rt=vt.prototype,St={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function At(kt,Tt,Nt,Ft){return Rt.fromToBase(kt,Tt,Nt,Ft)}Et.en.relativeTime=St,Rt.fromToBase=function(kt,Tt,Nt,Ft,Dt){for(var Ut,zt,Zt,Ht=Nt.$locale().relativeTime||St,Bt=ft.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],Wt=Bt.length,Kt=0;Kt<Wt;Kt+=1){var ar=Bt[Kt];ar.d&&(Ut=Ft?Et(kt).diff(Nt,ar.d,!0):Nt.diff(kt,ar.d,!0));var rr=(ft.rounding||Math.round)(Math.abs(Ut));if(Zt=Ut>0,rr<=ar.r||!ar.r){rr<=1&&Kt>0&&(ar=Bt[Kt-1]);var ur=Ht[ar.l];Dt&&(rr=Dt(""+rr)),zt=typeof ur=="string"?ur.replace("%d",rr):ur(rr,Tt,ar.l,Zt);break}}if(Tt)return zt;var sr=Zt?Ht.future:Ht.past;return typeof sr=="function"?sr(zt):sr.replace("%s",zt)},Rt.to=function(kt,Tt){return At(kt,Tt,this,!0)},Rt.from=function(kt,Tt){return At(kt,Tt,this)};var Ct=function(kt){return kt.$u?Et.utc():Et()};Rt.toNow=function(kt){return this.to(Ct(this),kt)},Rt.fromNow=function(kt){return this.from(Ct(this),kt)}}})})(relativeTime$1);var relativeTimeExports=relativeTime$1.exports;const relativeTime=getDefaultExportFromCjs$1(relativeTimeExports);var de={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt(dayjs_minExports)})(commonjsGlobal,function(ft){function vt(Ct){return Ct&&typeof Ct=="object"&&"default"in Ct?Ct:{default:Ct}}var Et=vt(ft),Rt={s:"ein paar Sekunden",m:["eine Minute","einer Minute"],mm:"%d Minuten",h:["eine Stunde","einer Stunde"],hh:"%d Stunden",d:["ein Tag","einem Tag"],dd:["%d Tage","%d Tagen"],M:["ein Monat","einem Monat"],MM:["%d Monate","%d Monaten"],y:["ein Jahr","einem Jahr"],yy:["%d Jahre","%d Jahren"]};function St(Ct,kt,Tt){var Nt=Rt[Tt];return Array.isArray(Nt)&&(Nt=Nt[kt?0:1]),Nt.replace("%d",Ct)}var At={name:"de",weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sept._Okt._Nov._Dez.".split("_"),ordinal:function(Ct){return Ct+"."},weekStart:1,yearStart:4,formats:{LTS:"HH:mm:ss",LT:"HH:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},relativeTime:{future:"in %s",past:"vor %s",s:St,m:St,mm:St,h:St,hh:St,d:St,dd:St,M:St,MM:St,y:St,yy:St}};return Et.default.locale(At,null,!0),At})})(de);var es={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt(dayjs_minExports)})(commonjsGlobal,function(ft){function vt(St){return St&&typeof St=="object"&&"default"in St?St:{default:St}}var Et=vt(ft),Rt={name:"es",monthsShort:"ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),weekStart:1,formats:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinal:function(St){return St+"º"}};return Et.default.locale(Rt,null,!0),Rt})})(es);var pt={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt(dayjs_minExports)})(commonjsGlobal,function(ft){function vt(St){return St&&typeof St=="object"&&"default"in St?St:{default:St}}var Et=vt(ft),Rt={name:"pt",weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sab".split("_"),weekdaysMin:"Do_2ª_3ª_4ª_5ª_6ª_Sa".split("_"),months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),ordinal:function(St){return St+"º"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},relativeTime:{future:"em %s",past:"há %s",s:"alguns segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"}};return Et.default.locale(Rt,null,!0),Rt})})(pt);var fr={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt(dayjs_minExports)})(commonjsGlobal,function(ft){function vt(St){return St&&typeof St=="object"&&"default"in St?St:{default:St}}var Et=vt(ft),Rt={name:"fr",weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(St){return""+St+(St===1?"er":"")}};return Et.default.locale(Rt,null,!0),Rt})})(fr);var it={exports:{}};(function(lt,dt){(function(ft,vt){lt.exports=vt(dayjs_minExports)})(commonjsGlobal,function(ft){function vt(St){return St&&typeof St=="object"&&"default"in St?St:{default:St}}var Et=vt(ft),Rt={name:"it",weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),weekStart:1,monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"tra %s",past:"%s fa",s:"qualche secondo",m:"un minuto",mm:"%d minuti",h:"un' ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinal:function(St){return St+"º"}};return Et.default.locale(Rt,null,!0),Rt})})(it);dayjs.extend(relativeTime);const TrashButton=({id:lt,selected:dt,onSelect:ft})=>{const{i18n:vt}=useI18n();return jsxRuntimeExports$4.jsx("div",{className:"treeview",children:jsxRuntimeExports$4.jsx("ul",{role:"tree",className:"m-0 p-0",children:jsxRuntimeExports$4.jsx("li",{id:lt,role:"treeitem","aria-selected":dt,children:jsxRuntimeExports$4.jsx("div",{children:jsxRuntimeExports$4.jsx("div",{className:"action-container",children:jsxRuntimeExports$4.jsx("div",{onClick:ft,role:"button",tabIndex:0,children:jsxRuntimeExports$4.jsxs("div",{className:"d-flex align-items-center gap-8 py-8 ps-24",children:[jsxRuntimeExports$4.jsx(SvgDelete$1,{width:"20",height:"20"}),jsxRuntimeExports$4.jsx("span",{children:vt("explorer.tree.trash")})]})})})})})})})},CreateModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./EditFolderModal.js"),["EditFolderModal.js","index.esm.js"])),TreeViewContainer=()=>{const lt=useQueryClient(),{i18n:dt}=useI18n(),[ft,vt]=useToggle(),Et=useTreeData(),Rt=useIsTrash(),St=useSelectedNodesIds(),{goToTrash:At,selectTreeItem:Ct,unfoldTreeItem:kt,foldTreeItem:Tt}=useStoreActions(),Nt=async Ft=>{await kt(Ft,lt)};return Et?jsxRuntimeExports$4.jsxs(jsxRuntimeExports$4.Fragment,{children:[jsxRuntimeExports$4.jsx(TreeView$1,{data:Et,selectedNodesIds:St,onTreeItemSelect:Ct,onTreeItemFold:Tt,onTreeItemUnfold:Nt}),jsxRuntimeExports$4.jsx(TrashButton,{id:FOLDER.BIN,selected:Rt,onSelect:At}),jsxRuntimeExports$4.jsx("div",{className:"d-grid my-16",children:jsxRuntimeExports$4.jsx(Button$1,{disabled:Rt,type:"button",color:"primary",variant:"outline",leftIcon:jsxRuntimeExports$4.jsx(SvgPlus$1,{}),onClick:vt,children:dt("explorer.folder.new")})}),jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:ft&&jsxRuntimeExports$4.jsx(CreateModal,{edit:!1,isOpen:ft,onSuccess:vt,onCancel:vt})})]}):null};function Breadcrumb(){const{i18n:lt}=useOdeClient(),dt=useSelectedNodesIds(),ft=useIsTrash(),vt=useCurrentFolder(),{gotoPreviousFolder:Et}=useStoreActions(),Rt=lt("explorer.tree.trash"),St=lt("explorer.filters.mine"),At=(vt==null?void 0:vt.name)||St;return jsxRuntimeExports$4.jsx("div",{className:"py-16",children:dt.length>1&&!ft?jsxRuntimeExports$4.jsxs("div",{className:"d-flex align-items-center gap-8",children:[jsxRuntimeExports$4.jsx(IconButton$1,{icon:jsxRuntimeExports$4.jsx(SvgArrowLeft$1,{}),variant:"ghost",color:"tertiary","aria-label":lt("back"),className:"ms-n16",onClick:Et}),jsxRuntimeExports$4.jsx("p",{className:"body py-8 text-truncate",children:jsxRuntimeExports$4.jsx("strong",{children:At})})]}):jsxRuntimeExports$4.jsx("h2",{className:"body py-8 fw-bold",children:ft?Rt:St})})}const useOnboardingModal=()=>{const[lt,dt]=reactExports.useState(!1),[ft,vt]=reactExports.useState(!0);return reactExports.useEffect(()=>{(async()=>{const Rt=await getOnboardingTrash();if(Rt){dt(JSON.parse(Rt==null?void 0:Rt.showOnboardingTrash));return}dt(!0)})()},[]),{isOnboardingTrash:lt,isOpen:ft,handleSavePreference:async()=>{await saveOnboardingTrash({onSuccess:()=>vt(!1)})},setIsOpen:vt}},useTrashModal=()=>{const lt=useResourceIsTrash(),{clearSelectedIds:dt,setResourceIsTrash:ft,clearSelectedItems:vt}=useStoreActions();return{isTrashedModalOpen:lt,onTrashedCancel:()=>{dt(),vt(),ft(!1)}}},OnboardingTrash=reactExports.lazy(async()=>await __vitePreload(()=>import("./OnboardingTrash.js"),[])),AppAction=reactExports.lazy(async()=>await __vitePreload(()=>import("./AppAction.js"),[])),Library=reactExports.lazy(async()=>await __vitePreload(()=>import("./Library.js"),[])),TrashedResourceModal=reactExports.lazy(async()=>await __vitePreload(()=>import("./TrashedResourceModal.js"),[]));function Explorer(){const{currentApp:lt}=useOdeClient(),{isOnboardingTrash:dt,isOpen:ft,setIsOpen:vt,handleSavePreference:Et}=useOnboardingModal(),{data:Rt}=useActions(),{isTrashedModalOpen:St,onTrashedCancel:At}=useTrashModal();useXitiTrackPageLoad();const Ct=Rt==null?void 0:Rt.find(Tt=>Tt.id==="publish"),kt=Tt=>{const Nt=Rt==null?void 0:Rt.filter(Ft=>Ft.id===Tt&&Ft.available);return Nt&&Nt.length>0};return jsxRuntimeExports$4.jsxs(jsxRuntimeExports$4.Fragment,{children:[jsxRuntimeExports$4.jsxs(AppHeader,{children:[jsxRuntimeExports$4.jsxs(AppCard$1,{app:lt,isHeading:!0,headingStyle:"h3",level:"h1",children:[jsxRuntimeExports$4.jsx(AppIcon$1,{app:lt,size:"40"}),jsxRuntimeExports$4.jsx(AppCard$1.Name,{})]}),kt("create")&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(AppAction,{})})]}),jsxRuntimeExports$4.jsxs(Grid,{className:"flex-grow-1",children:[jsxRuntimeExports$4.jsxs(Grid.Col,{sm:"3",className:"border-end pt-16 pe-16 d-none d-lg-block",as:"aside",children:[jsxRuntimeExports$4.jsx(TreeViewContainer,{}),(Ct==null?void 0:Ct.available)&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(Library,{})})]}),jsxRuntimeExports$4.jsxs(Grid.Col,{sm:"4",md:"8",lg:"9",children:[jsxRuntimeExports$4.jsx(Breadcrumb,{}),jsxRuntimeExports$4.jsx(List,{})]}),jsxRuntimeExports$4.jsx(ActionBarContainer,{}),dt&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(OnboardingTrash,{isOpen:ft,setIsOpen:vt,handleSavePreference:Et})}),St&&jsxRuntimeExports$4.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports$4.jsx(LoadingScreen$1,{}),children:jsxRuntimeExports$4.jsx(TrashedResourceModal,{isOpen:St,onCancel:At})})]})]})}function Root(){const{init:lt}=useOdeClient();return lt?lt?jsxRuntimeExports$4.jsx(Layout$1,{children:jsxRuntimeExports$4.jsx(Explorer,{})}):null:jsxRuntimeExports$4.jsx(LoadingScreen$1,{position:!1})}const root=document.getElementById("root"),queryClient=new QueryClient({queryCache:new QueryCache({onError:lt=>{lt==="0090"&&window.location.replace("/auth/login")}}),defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});createRoot(root).render(jsxRuntimeExports$4.jsxs(reactExports.StrictMode,{children:[jsxRuntimeExports$4.jsxs(QueryClientProvider,{client:queryClient,children:[jsxRuntimeExports$4.jsx(OdeClientProvider,{params:getAppParams(),children:jsxRuntimeExports$4.jsx(Root,{})}),jsxRuntimeExports$4.jsx(ReactQueryDevtools,{initialIsOpen:!1})]}),","]}));export{SvgRafterUp$1 as $,APP as A,Button$1 as B,useDelete as C,useTrash as D,useIsTrash as E,FormControl$1 as F,useMoveItem as G,Heading$1 as H,Image$1 as I,useSelectedFolders as J,useQueryClient as K,Loading$1 as L,Modal$1 as M,useTreeData as N,useCurrentFolder as O,useCreateFolder as P,useUpdatefolder as Q,React$2 as R,SvgPlus$1 as S,TreeView$1 as T,FOLDER as U,VisuallyHidden$1 as V,Label$1 as W,FormText$1 as X,SvgCopy$1 as Y,Gt as Z,it$1 as _,reactDomExports as a,useFormControl as a0,TransportFrameworkFactory as a1,useResourceIds as a2,RESOURCE as a3,SvgEdit$1 as a4,SvgDelete$1 as a5,AppIcon$1 as a6,useActions as a7,useSearchContext as a8,useFolderIds as a9,J as aa,dayjs as ab,SvgOptions$1 as ac,SvgGlobe$1 as ad,SvgUsers$1 as ae,useOdeIcons as af,SvgFiles$1 as ag,SvgOneProfile$1 as ah,getDefaultExportFromCjs$1 as ai,useStoreActions as b,jsxRuntimeExports$1 as c,SvgArrowRight$1 as d,clsx as e,useI18n as f,getAppParams as g,useSearchParams as h,useUser as i,jsxRuntimeExports$4 as j,useSelectedResources as k,useUpdateResource as l,useShareResource as m,useHotToast as n,odeServices as o,SvgBookmark$1 as p,Alert$1 as q,reactExports as r,Avatar$1 as s,SvgRafterDown$1 as t,useOdeClient as u,IconButton$1 as v,SvgClose$1 as w,SvgSave$1 as x,SvgInfoCircle$1 as y,Input$1 as z};
package/dist/version.txt CHANGED
@@ -1 +1 @@
1
- ode-explorer=1.0-feat-explorer-SNAPSHOT 14/06/2023 18:54:14
1
+ ode-explorer=1.0-feat-explorer-SNAPSHOT 19/06/2023 10:43:00
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ode-explorer",
3
- "version": "1.0.0-dev.202306141853",
3
+ "version": "1.0.0-dev.202306191042",
4
4
  "description": "Open Digital Education Explorer",
5
5
  "homepage": "https://github.com/opendigitaleducation/explorer#readme",
6
6
  "bugs": {
@@ -71,9 +71,9 @@
71
71
  "@types/node": "20.2.5",
72
72
  "@types/react": "18.2.8",
73
73
  "@types/react-dom": "18.2.4",
74
- "@typescript-eslint/eslint-plugin": "^5.59.0",
75
- "@typescript-eslint/parser": "^5.59.0",
76
- "@vitejs/plugin-react": "^4.0.0",
74
+ "@typescript-eslint/eslint-plugin": "5.59.11",
75
+ "@typescript-eslint/parser": "5.59.11",
76
+ "@vitejs/plugin-react": "4.0.0",
77
77
  "clsx": "1.2.1",
78
78
  "concurrently": "8.1.0",
79
79
  "csstype": "3.1.2",