ode-explorer 1.1.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Card.js CHANGED
@@ -1 +1 @@
1
- import{r as l,j as e,ah as P,i as c,I,a9 as S,ai as T,aj as k,v as z,ak as A,x as E,al as B,am as U}from"./index.js";import{T as w}from"./Tooltip.js";const $=l.createContext(null);$.displayName="CardContext";const y=()=>{const s=l.useContext($);if(!s)throw new Error("Cannot be rendered outside the Card component");return s},R=l.forwardRef(()=>{const{options:{name:s},isLoading:a,appCode:t,classesTitle:r}=y();return e.jsxs("div",{className:"card-body",children:[e.jsx(P,{width:"48",height:"48",className:c(`color-app-${t}`,{placeholder:a})}),e.jsx("div",{children:e.jsx("h3",{className:r,children:e.jsx("strong",{children:s})})})]})});R.displayName="Card.Folder";const G=R,F=l.forwardRef(()=>{const{options:s,isLoading:a,tooltips:t,classesTitle:r,app:o}=y(),{type:u,imageSrc:n,name:j,creatorName:d,userSrc:i,updatedAt:g,isShared:v,isPublic:N}=s,{messagePublic:C,messageShared:x}=t||{},h=c("d-inline-flex align-items-center gap-8 text-truncate",{placeholder:a}),f=c("card-text small",{placeholder:a}),m=c("small text-truncate",{placeholder:a}),b=i?e.jsx(z,{alt:d||"",size:"xs",src:i,variant:"circle",width:"24",height:"24"}):e.jsx(A,{});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"card-body",children:[n?e.jsx("div",{className:"card-image",children:e.jsx(I,{alt:"",src:n,width:"80",height:"80",objectFit:"cover",className:c("h-full",{placeholder:a})})}):e.jsx(S,{app:o,iconFit:"ratio",size:"80",variant:"rounded"}),e.jsxs("div",{children:[e.jsx("h3",{className:r,children:e.jsx("strong",{children:j})}),e.jsx("p",{className:"card-text small",children:e.jsx("em",{className:f,children:g})})]})]}),u==="resource"?e.jsxs("div",{className:"card-footer gap-16",children:[e.jsxs("div",{className:h,children:[b,e.jsx("p",{className:m,children:d})]}),e.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[N&&e.jsx(w,{message:C,placement:"top",children:e.jsx(T,{width:16,height:16})}),v&&e.jsx(w,{message:x,placement:"top",children:e.jsx(k,{width:16,height:16})})]})]}):null]})});F.displayName="Card.Resource";const M=F,O=l.forwardRef(({options:s,tooltips:a,isLoading:t,app:r,onSelect:o,onOpen:u,isSelected:n,isAnimated:j,className:d,...i},g)=>{const{getIconCode:v}=U();function N(b){b.stopPropagation(),o==null||o()}const{type:C}=s,x=r?v(r):"placeholder",h=c("card-title body text-break text-truncate text-truncate-2 pe-32",{placeholder:t}),f=l.useMemo(()=>({options:s,isLoading:t,classesTitle:h,app:r,appCode:x,tooltips:a}),[r,x,h,t,s,a]),m={folder:e.jsx(p.Folder,{}),resource:e.jsx(p.Resource,{}),undefined:e.jsx(p.Resource,{}),default:null};return e.jsx($.Provider,{value:f,children:e.jsxs("div",{ref:g,className:c("card",{"placeholder-glow":t,"is-selected":n,"is-animated":j},d),...i,children:[e.jsxs("div",{className:"card-header",children:[!t&&e.jsx(E,{"aria-label":"Open Action Bar",className:"z-3",color:"secondary",icon:e.jsx(B,{}),onClick:N,variant:"ghost"}),e.jsx("button",{onClick:u,className:"position-absolute bottom-0 end-0 top-0 start-0 opacity-0 z-1 w-100","aria-label":"Open resource"})]}),m[C]||m.default]})})});O.displayName="Card";const p=Object.assign(O,{Resource:M,Folder:G}),H=p;export{H as C};
1
+ import{a5 as o,j as e,r as d,y as w,al as T,I as B,a8 as F,w as O,af as H,am as z}from"./index.js";const u=({children:t,space:a=null,flexDirection:s="row"})=>{const r=o("card-body",{"p-8":a==="8","gap-8":a==="8","align-items-start":s==="column","flex-column":s==="column"});return e.jsx("div",{className:r,children:t})};u.displayName="Card.Body";const U=u,i=d.createContext(null);i.displayName="CardContext";const m=()=>{const t=d.useContext(i);if(!t)throw new Error("Cannot be rendered outside the Card component");return t},C=({children:t})=>e.jsx("div",{className:"card-footer gap-16",children:t});C.displayName="Card.Footer";const k=C,p=()=>{const{isSelectable:t,isClickable:a,onClick:s,onSelect:r}=m();return e.jsxs("div",{className:"card-header",children:[t?e.jsx(w,{"aria-label":"Open Action Bar",className:"z-3 bg-white",color:"secondary",icon:e.jsx(T,{}),onClick:r,variant:"ghost"}):null,a?e.jsx("button",{onClick:s,className:"position-absolute bottom-0 end-0 top-0 start-0 opacity-0 z-1 w-100","aria-label":"Open resource"}):null]})};p.displayName="Card.Header";const A=p,j=({imageSrc:t,className:a,variant:s="medium"})=>{const{app:r}=m(),n=s==="landscape"?{width:"100%",height:"auto"}:null;return e.jsx("div",{className:o("card-image",s),children:t?e.jsx(B,{alt:"",src:t,objectFit:"cover",className:o("h-full",a)}):e.jsx(F,{app:r,iconFit:"ratio",size:"80",variant:"rounded",...n})})};j.displayName="Card.Image";const E=j,y=({children:t,className:a})=>{const s=o("card-text small text-break text-truncate text-truncate-1",a);return e.jsx("p",{className:s,children:t})};y.displayName="Card.Text";const R=y,N=({children:t,className:a})=>{const s=o("card-title body text-break text-truncate text-truncate-1",a);return e.jsx("h3",{className:s,children:e.jsx("strong",{children:t})})};N.displayName="Card.Title";const P=N,g=({userSrc:t,creatorName:a})=>t?e.jsx(O,{alt:a||"",size:"xs",src:t,variant:"circle",width:"24",height:"24"}):e.jsx(H,{});g.displayName="Card.User";const M=g,h=d.forwardRef(({app:t,isSelectable:a=!0,isClickable:s=!0,isSelected:r=!1,onClick:n,onSelect:x,children:c,className:v},$)=>{const{getIconCode:f}=z(),l=t?f(t):"placeholder",I=d.useMemo(()=>({app:t,appCode:l,isSelectable:a,isClickable:s,onClick:n,onSelect:x}),[t,l,a,s,n,x]);return e.jsx(i.Provider,{value:I,children:e.jsxs("div",{ref:$,className:o("card",{"is-selected":r},v),children:[e.jsx(b.Header,{}),typeof c=="function"?c(l):c]})})});h.displayName="Card";const b=Object.assign(h,{Title:P,Text:R,Image:E,Body:U,User:M,Footer:k,Header:A}),G=b;export{G as C};
@@ -1 +1 @@
1
- import{u as d,J as u,K as x,N as p,s as m,A as j,a as f,j as e,M as n,B as i}from"./index.js";import"/assets/js/edifice-ts-client/index.js";function y({onSuccess:o}){const{t:l}=d(),s=u(),t=x(),r=p(),{hotToast:a}=m(j);async function c(){try{r?(await s.mutate(),a.success(l("explorer.removed.from.trash"))):(await t.mutate(),a.success(l("explorer.trash.title"))),o==null||o()}catch(h){console.error(h)}}return{isTrashFolder:r,onDelete:c}}function D({isOpen:o,onSuccess:l=()=>({}),onCancel:s=()=>({})}){const{t}=d(),{isTrashFolder:r,onDelete:a}=y({onSuccess:l});return f.createPortal(e.jsxs(n,{isOpen:o,onModalClose:s,id:"deleteModal",children:[e.jsx(n.Header,{onModalClose:s,children:t(r?"explorer.delete.title":"explorer.trash.title")}),e.jsx(n.Body,{children:e.jsx("p",{className:"body",children:t(r?"explorer.delete.subtitle":"explorer.trash.subtitle")})}),e.jsxs(n.Footer,{children:[e.jsx(i,{color:"tertiary",onClick:s,type:"button",variant:"ghost",children:t("explorer.cancel")}),e.jsx(i,{color:"danger",onClick:a,type:"button",variant:"filled",children:t(r?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}export{D as default};
1
+ import{u as d,J as u,K as x,N as p,t as m,A as j,a as f,j as e,M as n,B as i}from"./index.js";import"/assets/js/edifice-ts-client/index.js";function y({onSuccess:o}){const{t:l}=d(),s=u(),t=x(),r=p(),{hotToast:a}=m(j);async function c(){try{r?(await s.mutate(),a.success(l("explorer.removed.from.trash"))):(await t.mutate(),a.success(l("explorer.trash.title"))),o==null||o()}catch(h){console.error(h)}}return{isTrashFolder:r,onDelete:c}}function D({isOpen:o,onSuccess:l=()=>({}),onCancel:s=()=>({})}){const{t}=d(),{isTrashFolder:r,onDelete:a}=y({onSuccess:l});return f.createPortal(e.jsxs(n,{isOpen:o,onModalClose:s,id:"deleteModal",children:[e.jsx(n.Header,{onModalClose:s,children:t(r?"explorer.delete.title":"explorer.trash.title")}),e.jsx(n.Body,{children:e.jsx("p",{className:"body",children:t(r?"explorer.delete.subtitle":"explorer.trash.subtitle")})}),e.jsxs(n.Footer,{children:[e.jsx(i,{color:"tertiary",onClick:s,type:"button",variant:"ghost",children:t("explorer.cancel")}),e.jsx(i,{color:"danger",onClick:a,type:"button",variant:"filled",children:t(r?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}export{D as default};
@@ -1 +1 @@
1
- import{P as D,W as B,X as q,Y as L,r as C,u as R,a as w,j as r,M as s,F as P,Z as T,E as U,B as y}from"./index.js";import{FOLDER as V}from"/assets/js/edifice-ts-client/index.js";import{u as _}from"./index.esm.js";function k({edit:a,onSuccess:e,onClose:i}){var F;const l=D(),t=B(),m=q(),c=L(),u=a?(F=l[0])==null?void 0:F.name:void 0,{reset:o,register:f,handleSubmit:n,setFocus:p,formState:{errors:x,isSubmitting:h,isDirty:E,isValid:I}}=_({mode:"onChange",values:{name:u||""}}),g=C.useId(),M=async function({name:j}){var b;try{if(a){const d=(b=l[0])==null?void 0:b.parentId,$=l[0].id;await c.mutate({folderId:$,parentId:d,name:j}),o(),e==null||e()}else{const d=(t==null?void 0:t.id)||V.DEFAULT;await m.mutate({name:j,parentId:d}),o(),e==null||e()}}catch(d){console.error(d)}};function v(){o(),i()}return{formId:`createModal_${g}`,errors:x,isSubmitting:h,isDirty:E,isValid:I,register:f,setFocus:p,handleSubmit:n,onCancel:v,onSubmit:M}}function Y({isOpen:a,edit:e,onSuccess:i,onCancel:l}){const{t}=R(),{isDirty:m,isValid:c,isSubmitting:u,formId:o,onSubmit:f,onCancel:n,handleSubmit:p,register:x,setFocus:h}=k({edit:e,onSuccess:i,onClose:l});return C.useEffect(()=>{a&&h("name")},[a]),w.createPortal(r.jsxs(s,{isOpen:a,onModalClose:n,id:"modal_"+o,children:[r.jsx(s.Header,{onModalClose:n,children:t(e?"explorer.rename.folder":"explorer.create.folder")}),r.jsx(s.Body,{children:r.jsx("form",{id:o,onSubmit:p(f),children:r.jsxs(P,{id:"nameFolder",isRequired:!0,children:[r.jsx(T,{children:t("explorer.create.folder.name")}),r.jsx(U,{type:"text",...x("name",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:t("explorer.create.folder.name"),size:"md","aria-required":!0})]})})}),r.jsxs(s.Footer,{children:[r.jsx(y,{color:"tertiary",onClick:n,type:"button",variant:"ghost",children:t("explorer.cancel")}),r.jsx(y,{form:o,type:"submit",color:"primary",variant:"filled",disabled:!m||!c||u,children:t(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal"))}export{Y as default};
1
+ import{P as D,W as B,X as q,Y as L,r as C,u as R,a as k,j as r,M as i,F as w,Z as P,k as T,B as y}from"./index.js";import{FOLDER as U}from"/assets/js/edifice-ts-client/index.js";import{u as V}from"./index.esm.js";function _({edit:a,onSuccess:e,onClose:m}){var F;const l=D(),t=B(),c=q(),u=L(),f=a?(F=l[0])==null?void 0:F.name:void 0,{reset:o,register:p,handleSubmit:n,setFocus:x,formState:{errors:h,isSubmitting:s,isDirty:I,isValid:E}}=V({mode:"onChange",values:{name:f||""}}),g=C.useId(),M=async function({name:j}){var b;try{if(a){const d=(b=l[0])==null?void 0:b.parentId,$=l[0].id;await u.mutate({folderId:$,parentId:d,name:j}),o(),e==null||e()}else{const d=(t==null?void 0:t.id)||U.DEFAULT;await c.mutate({name:j,parentId:d}),o(),e==null||e()}}catch(d){console.error(d)}};function v(){o(),m()}return{formId:`createModal_${g}`,errors:h,isSubmitting:s,isDirty:I,isValid:E,register:p,setFocus:x,handleSubmit:n,onCancel:v,onSubmit:M}}function Y({isOpen:a,edit:e,onSuccess:m,onCancel:l}){const{t}=R(),{isDirty:c,isValid:u,isSubmitting:f,formId:o,onSubmit:p,onCancel:n,handleSubmit:x,register:h,setFocus:s}=_({edit:e,onSuccess:m,onClose:l});return C.useEffect(()=>{a&&s("name")},[a,s]),k.createPortal(r.jsxs(i,{isOpen:a,onModalClose:n,id:"modal_"+o,children:[r.jsx(i.Header,{onModalClose:n,children:t(e?"explorer.rename.folder":"explorer.create.folder")}),r.jsx(i.Body,{children:r.jsx("form",{id:o,onSubmit:x(p),children:r.jsxs(w,{id:"nameFolder",isRequired:!0,children:[r.jsx(P,{children:t("explorer.create.folder.name")}),r.jsx(T,{type:"text",...h("name",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:t("explorer.create.folder.name"),size:"md","aria-required":!0})]})})}),r.jsxs(i.Footer,{children:[r.jsx(y,{color:"tertiary",onClick:n,type:"button",variant:"ghost",children:t("explorer.cancel")}),r.jsx(y,{form:o,type:"submit",color:"primary",variant:"filled",disabled:!c||!u||f,children:t(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal"))}export{Y as default};
@@ -1,3 +1,3 @@
1
- import{u as E,j as a,H as Y,A as X,F as A,B as O,$ as me,d as ee,p as xe,a0 as be,o as te,l as we,r as S,W as Se,s as Be,Q as je,f as _e,a as ke,M as P,Z as q,E as Ce,a1 as $e}from"./index.js";import{APP as se}from"/assets/js/edifice-ts-client/index.js";import{u as ve}from"./index.esm.js";import{I as Ie,T as Ae}from"./TextArea.js";const ze=({appCode:s,isPublic:r,onCopyToClipBoard:i,onPublicChange:e,register:t,resource:n,slug:l,resourceName:c})=>{const{t:o}=E();return a.jsxs(a.Fragment,{children:[a.jsxs(Y,{headingStyle:"h4",level:"h3",className:"mb-16",children:[o("explorer.resource.editModal.heading.access"),s]}),a.jsx(X,{type:"info",children:o("explorer.resource.editModal.access.alert")}),a.jsxs(A,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[a.jsx(A.Input,{type:"checkbox",role:"switch",...t("enablePublic",{disabled:!r&&!c,value:n&&n.public,onChange:d=>{e(d.target.checked)}}),className:"form-check-input mt-0",size:"md"}),a.jsx(A.Label,{className:"form-check-label mb-0",children:o("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),r&&a.jsxs("div",{className:"d-flex flex-wrap align-items-center gap-4",children:[a.jsxs("p",{className:"text-break",children:[window.location.origin,window.location.pathname,"/pub/",l]}),a.jsx(O,{color:"primary",disabled:!r,onClick:()=>i(),type:"button",leftIcon:a.jsx(me,{}),variant:"ghost",className:"text-nowrap",children:o("explorer.resource.editModal.access.url.button")})]})]})},W=Object.freeze({ignoreUnknown:!1,respectType:!1,respectFunctionNames:!1,respectFunctionProperties:!1,unorderedObjects:!0,unorderedArrays:!1,unorderedSets:!1,excludeKeys:void 0,excludeValues:void 0,replacer:void 0});function Ne(s,r){r?r={...W,...r}:r=W;const i=re(r);return i.dispatch(s),i.toString()}const Pe=Object.freeze(["prototype","__proto__","constructor"]);function re(s){let r="",i=new Map;const e=t=>{r+=t};return{toString(){return r},getContext(){return i},dispatch(t){return s.replacer&&(t=s.replacer(t)),this[t===null?"null":typeof t](t)},object(t){if(t&&typeof t.toJSON=="function")return this.object(t.toJSON());const n=Object.prototype.toString.call(t);let l="";const c=n.length;c<10?l="unknown:["+n+"]":l=n.slice(8,c-1),l=l.toLowerCase();let o=null;if((o=i.get(t))===void 0)i.set(t,i.size);else return this.dispatch("[CIRCULAR:"+o+"]");if(typeof Buffer<"u"&&Buffer.isBuffer&&Buffer.isBuffer(t))return e("buffer:"),e(t.toString("utf8"));if(l!=="object"&&l!=="function"&&l!=="asyncfunction")this[l]?this[l](t):s.ignoreUnknown||this.unkown(t,l);else{let d=Object.keys(t);s.unorderedObjects&&(d=d.sort());let p=[];s.respectType!==!1&&!Z(t)&&(p=Pe),s.excludeKeys&&(d=d.filter(u=>!s.excludeKeys(u)),p=p.filter(u=>!s.excludeKeys(u))),e("object:"+(d.length+p.length)+":");const g=u=>{this.dispatch(u),e(":"),s.excludeValues||this.dispatch(t[u]),e(",")};for(const u of d)g(u);for(const u of p)g(u)}},array(t,n){if(n=n===void 0?s.unorderedArrays!==!1:n,e("array:"+t.length+":"),!n||t.length<=1){for(const o of t)this.dispatch(o);return}const l=new Map,c=t.map(o=>{const d=re(s);d.dispatch(o);for(const[p,g]of d.getContext())l.set(p,g);return d.toString()});return i=l,c.sort(),this.array(c,!1)},date(t){return e("date:"+t.toJSON())},symbol(t){return e("symbol:"+t.toString())},unkown(t,n){if(e(n),!!t&&(e(":"),t&&typeof t.entries=="function"))return this.array(Array.from(t.entries()),!0)},error(t){return e("error:"+t.toString())},boolean(t){return e("bool:"+t)},string(t){e("string:"+t.length+":"),e(t)},function(t){e("fn:"),Z(t)?this.dispatch("[native]"):this.dispatch(t.toString()),s.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(t.name)),s.respectFunctionProperties&&this.object(t)},number(t){return e("number:"+t)},xml(t){return e("xml:"+t.toString())},null(){return e("Null")},undefined(){return e("Undefined")},regexp(t){return e("regex:"+t.toString())},uint8array(t){return e("uint8array:"),this.dispatch(Array.prototype.slice.call(t))},uint8clampedarray(t){return e("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(t))},int8array(t){return e("int8array:"),this.dispatch(Array.prototype.slice.call(t))},uint16array(t){return e("uint16array:"),this.dispatch(Array.prototype.slice.call(t))},int16array(t){return e("int16array:"),this.dispatch(Array.prototype.slice.call(t))},uint32array(t){return e("uint32array:"),this.dispatch(Array.prototype.slice.call(t))},int32array(t){return e("int32array:"),this.dispatch(Array.prototype.slice.call(t))},float32array(t){return e("float32array:"),this.dispatch(Array.prototype.slice.call(t))},float64array(t){return e("float64array:"),this.dispatch(Array.prototype.slice.call(t))},arraybuffer(t){return e("arraybuffer:"),this.dispatch(new Uint8Array(t))},url(t){return e("url:"+t.toString())},map(t){e("map:");const n=[...t];return this.array(n,s.unorderedSets!==!1)},set(t){e("set:");const n=[...t];return this.array(n,s.unorderedSets!==!1)},file(t){return e("file:"),this.dispatch([t.name,t.size,t.type,t.lastModfied])},blob(){if(s.ignoreUnknown)return e("[blob]");throw new Error(`Hashing Blob objects is currently not supported
1
+ import{u as E,j as a,H as Y,A as X,F as v,B as O,$ as me,d as ee,q as xe,a0 as be,p as te,n as we,r as S,W as Se,t as Be,Q as je,f as _e,a as ke,M as P,Z as q,k as Ce,a1 as $e}from"./index.js";import{APP as se}from"/assets/js/edifice-ts-client/index.js";import{u as Ie}from"./index.esm.js";import{I as Ae,T as ve}from"./TextArea.js";const ze=({appCode:s,isPublic:r,onCopyToClipBoard:i,onPublicChange:e,register:t,slug:n,resourceName:o})=>{const{t:c}=E();return a.jsxs(a.Fragment,{children:[a.jsxs(Y,{headingStyle:"h4",level:"h3",className:"mb-16",children:[c("explorer.resource.editModal.heading.access"),s]}),a.jsx(X,{type:"info",children:c("explorer.resource.editModal.access.alert")}),a.jsxs(v,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[a.jsx(v.Input,{type:"checkbox",role:"switch",...t("enablePublic",{disabled:!r&&!o,onChange:l=>{e(l.target.checked)}}),className:"form-check-input mt-0",size:"md"}),a.jsx(v.Label,{className:"form-check-label mb-0",children:c("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),r&&a.jsxs("div",{className:"d-flex flex-wrap align-items-center gap-4",children:[a.jsxs("p",{className:"text-break",children:[window.location.origin,window.location.pathname,"/pub/",n]}),a.jsx(O,{color:"primary",disabled:!r,onClick:()=>i(),type:"button",leftIcon:a.jsx(me,{}),variant:"ghost",className:"text-nowrap",children:c("explorer.resource.editModal.access.url.button")})]})]})},W=Object.freeze({ignoreUnknown:!1,respectType:!1,respectFunctionNames:!1,respectFunctionProperties:!1,unorderedObjects:!0,unorderedArrays:!1,unorderedSets:!1,excludeKeys:void 0,excludeValues:void 0,replacer:void 0});function Ne(s,r){r?r={...W,...r}:r=W;const i=re(r);return i.dispatch(s),i.toString()}const Pe=Object.freeze(["prototype","__proto__","constructor"]);function re(s){let r="",i=new Map;const e=t=>{r+=t};return{toString(){return r},getContext(){return i},dispatch(t){return s.replacer&&(t=s.replacer(t)),this[t===null?"null":typeof t](t)},object(t){if(t&&typeof t.toJSON=="function")return this.object(t.toJSON());const n=Object.prototype.toString.call(t);let o="";const c=n.length;c<10?o="unknown:["+n+"]":o=n.slice(8,c-1),o=o.toLowerCase();let l=null;if((l=i.get(t))===void 0)i.set(t,i.size);else return this.dispatch("[CIRCULAR:"+l+"]");if(typeof Buffer<"u"&&Buffer.isBuffer&&Buffer.isBuffer(t))return e("buffer:"),e(t.toString("utf8"));if(o!=="object"&&o!=="function"&&o!=="asyncfunction")this[o]?this[o](t):s.ignoreUnknown||this.unkown(t,o);else{let d=Object.keys(t);s.unorderedObjects&&(d=d.sort());let p=[];s.respectType!==!1&&!G(t)&&(p=Pe),s.excludeKeys&&(d=d.filter(u=>!s.excludeKeys(u)),p=p.filter(u=>!s.excludeKeys(u))),e("object:"+(d.length+p.length)+":");const g=u=>{this.dispatch(u),e(":"),s.excludeValues||this.dispatch(t[u]),e(",")};for(const u of d)g(u);for(const u of p)g(u)}},array(t,n){if(n=n===void 0?s.unorderedArrays!==!1:n,e("array:"+t.length+":"),!n||t.length<=1){for(const l of t)this.dispatch(l);return}const o=new Map,c=t.map(l=>{const d=re(s);d.dispatch(l);for(const[p,g]of d.getContext())o.set(p,g);return d.toString()});return i=o,c.sort(),this.array(c,!1)},date(t){return e("date:"+t.toJSON())},symbol(t){return e("symbol:"+t.toString())},unkown(t,n){if(e(n),!!t&&(e(":"),t&&typeof t.entries=="function"))return this.array(Array.from(t.entries()),!0)},error(t){return e("error:"+t.toString())},boolean(t){return e("bool:"+t)},string(t){e("string:"+t.length+":"),e(t)},function(t){e("fn:"),G(t)?this.dispatch("[native]"):this.dispatch(t.toString()),s.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(t.name)),s.respectFunctionProperties&&this.object(t)},number(t){return e("number:"+t)},xml(t){return e("xml:"+t.toString())},null(){return e("Null")},undefined(){return e("Undefined")},regexp(t){return e("regex:"+t.toString())},uint8array(t){return e("uint8array:"),this.dispatch(Array.prototype.slice.call(t))},uint8clampedarray(t){return e("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(t))},int8array(t){return e("int8array:"),this.dispatch(Array.prototype.slice.call(t))},uint16array(t){return e("uint16array:"),this.dispatch(Array.prototype.slice.call(t))},int16array(t){return e("int16array:"),this.dispatch(Array.prototype.slice.call(t))},uint32array(t){return e("uint32array:"),this.dispatch(Array.prototype.slice.call(t))},int32array(t){return e("int32array:"),this.dispatch(Array.prototype.slice.call(t))},float32array(t){return e("float32array:"),this.dispatch(Array.prototype.slice.call(t))},float64array(t){return e("float64array:"),this.dispatch(Array.prototype.slice.call(t))},arraybuffer(t){return e("arraybuffer:"),this.dispatch(new Uint8Array(t))},url(t){return e("url:"+t.toString())},map(t){e("map:");const n=[...t];return this.array(n,s.unorderedSets!==!1)},set(t){e("set:");const n=[...t];return this.array(n,s.unorderedSets!==!1)},file(t){return e("file:"),this.dispatch([t.name,t.size,t.type,t.lastModfied])},blob(){if(s.ignoreUnknown)return e("[blob]");throw new Error(`Hashing Blob objects is currently not supported
2
2
  Use "options.replacer" or "options.ignoreUnknown"
3
- `)},domwindow(){return e("domwindow")},bigint(t){return e("bigint:"+t.toString())},process(){return e("process")},timer(){return e("timer")},pipe(){return e("pipe")},tcp(){return e("tcp")},udp(){return e("udp")},tty(){return e("tty")},statwatcher(){return e("statwatcher")},securecontext(){return e("securecontext")},connection(){return e("connection")},zlib(){return e("zlib")},context(){return e("context")},nodescript(){return e("nodescript")},httpparser(){return e("httpparser")},dataview(){return e("dataview")},signal(){return e("signal")},fsevent(){return e("fsevent")},tlswrap(){return e("tlswrap")}}}const ie="[native code] }",Me=ie.length;function Z(s){return typeof s!="function"?!1:Function.prototype.toString.call(s).slice(-Me)===ie}class b{constructor(r,i){r=this.words=r||[],this.sigBytes=i===void 0?r.length*4:i}toString(r){return(r||Re).stringify(this)}concat(r){if(this.clamp(),this.sigBytes%4)for(let i=0;i<r.sigBytes;i++){const e=r.words[i>>>2]>>>24-i%4*8&255;this.words[this.sigBytes+i>>>2]|=e<<24-(this.sigBytes+i)%4*8}else for(let i=0;i<r.sigBytes;i+=4)this.words[this.sigBytes+i>>>2]=r.words[i>>>2];return this.sigBytes+=r.sigBytes,this}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new b([...this.words])}}const Re={stringify(s){const r=[];for(let i=0;i<s.sigBytes;i++){const e=s.words[i>>>2]>>>24-i%4*8&255;r.push((e>>>4).toString(16),(e&15).toString(16))}return r.join("")}},Oe={stringify(s){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=[];for(let e=0;e<s.sigBytes;e+=3){const t=s.words[e>>>2]>>>24-e%4*8&255,n=s.words[e+1>>>2]>>>24-(e+1)%4*8&255,l=s.words[e+2>>>2]>>>24-(e+2)%4*8&255,c=t<<16|n<<8|l;for(let o=0;o<4&&e*8+o*6<s.sigBytes*8;o++)i.push(r.charAt(c>>>6*(3-o)&63))}return i.join("")}},Ee={parse(s){const r=s.length,i=[];for(let e=0;e<r;e++)i[e>>>2]|=(s.charCodeAt(e)&255)<<24-e%4*8;return new b(i,r)}},Le={parse(s){return Ee.parse(unescape(encodeURIComponent(s)))}};class Ue{constructor(){this._data=new b,this._nDataBytes=0,this._minBufferSize=0,this.blockSize=512/32}reset(){this._data=new b,this._nDataBytes=0}_append(r){typeof r=="string"&&(r=Le.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes}_doProcessBlock(r,i){}_process(r){let i,e=this._data.sigBytes/(this.blockSize*4);r?e=Math.ceil(e):e=Math.max((e|0)-this._minBufferSize,0);const t=e*this.blockSize,n=Math.min(t*4,this._data.sigBytes);if(t){for(let l=0;l<t;l+=this.blockSize)this._doProcessBlock(this._data.words,l);i=this._data.words.splice(0,t),this._data.sigBytes-=n}return new b(i,n)}}class Fe extends Ue{update(r){return this._append(r),this._process(),this}finalize(r){r&&this._append(r)}}const G=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],Te=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],B=[];class He extends Fe{constructor(){super(...arguments),this._hash=new b([...G])}reset(){super.reset(),this._hash=new b([...G])}_doProcessBlock(r,i){const e=this._hash.words;let t=e[0],n=e[1],l=e[2],c=e[3],o=e[4],d=e[5],p=e[6],g=e[7];for(let u=0;u<64;u++){if(u<16)B[u]=r[i+u]|0;else{const x=B[u-15],y=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,m=B[u-2],_=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;B[u]=y+B[u-7]+_+B[u-16]}const k=o&d^~o&p,C=t&n^t&l^n&l,w=(t<<30|t>>>2)^(t<<19|t>>>13)^(t<<10|t>>>22),$=(o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25),j=g+$+k+Te[u]+B[u],v=w+C;g=p,p=d,d=o,o=c+j|0,c=l,l=n,n=t,t=j+v|0}e[0]=e[0]+t|0,e[1]=e[1]+n|0,e[2]=e[2]+l|0,e[3]=e[3]+c|0,e[4]=e[4]+o|0,e[5]=e[5]+d|0,e[6]=e[6]+p|0,e[7]=e[7]+g|0}finalize(r){super.finalize(r);const i=this._nDataBytes*8,e=this._data.sigBytes*8;return this._data.words[e>>>5]|=128<<24-e%32,this._data.words[(e+64>>>9<<4)+14]=Math.floor(i/4294967296),this._data.words[(e+64>>>9<<4)+15]=i,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}}function Ke(s){return new He().finalize(s).toString(Oe)}function J(s,r={}){const i=typeof s=="string"?s:Ne(s,r);return Ke(i).slice(0,10)}var ne={};Object.defineProperty(ne,"__esModule",{value:!0});const Ve=s=>{const r="ÀÁÂÃÄÅĄàáâãäåąÒÓÔÕÕÖØòóôõöøÈÉÊËĘèéêëðęÇĆçćÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠŚšśŸÿýŽŹŻžźżŁłŃńàáãảạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệđùúủũụưừứửữựòóỏõọôồốổỗộơờớởỡợìíỉĩịäëïîüûñçýỳỹỵỷğışĞİŞ",i="AAAAAAAaaaaaaaOOOOOOOooooooEEEEEeeeeeeCCccDIIIIiiiiUUUUuuuuNnSSssYyyZZZzzzLlNnaaaaaaaaaaaaaaaaaeeeeeeeeeeeduuuuuuuuuuuoooooooooooooooooiiiiiaeiiuuncyyyyygisGIS",e=r.split("").join("|"),t=new RegExp(`(${e})`,"g");function n(l){return i[r.indexOf(l)]||""}return s.replace(t,n)},qe=s=>s.split("").map(r=>`\\${r}`).join(""),Q=(s,r,i=!1)=>{const e=Ve(s).trim().toLowerCase(),t=qe(r);return i?e.replace(/\s+/g,r):e.replace(new RegExp(`[^a-z0-9${t}]+`,"g"),r).replace(new RegExp(`${t}+`,"g"),r).replace(new RegExp(`^${t}`,"g"),"").replace(new RegExp(`${t}$`,"g"),"")},I=(s,r={delimiter:"-",prefix:""})=>{if(r.delimiter||(r.delimiter="-"),r.prefix||(r.prefix=""),!s||typeof s=="boolean")return"";const{delimiter:i,prefix:e}=r;if(typeof s=="boolean")return"";if(typeof s=="string"||typeof s=="number"){const t=Q(e,i,!0),n=Q(String(s),i);return t?`${t}${i}${n}`:n}return"children"in s?I(s.children):"type"in s?I(s.props.children,r):Symbol.iterator in s?I(Array.from(s).map(t=>I(t,{delimiter:i})).join(i),r):""};var D=ne.default=I;function We({resource:s,edit:r,onSuccess:i,onCancel:e}){var H;const{appCode:t}=ee(),{t:n}=E(),l=xe(),c=be(),o=te(),d=we(),{watch:p,reset:g,register:u,handleSubmit:k,setFocus:C,setValue:w,formState:{errors:$,isSubmitting:j,isValid:v}}=ve({mode:"onChange"}),x=S.useId(),y=Se(),{hotToast:m}=Be(X),[_,M]=S.useState((s==null?void 0:s.slug)||""),[f,ae]=S.useState(!!(s!=null&&s.public)),[L,U]=S.useState(((H=o[0])==null?void 0:H.thumbnail)||""),[oe,F]=S.useState(!1),z=p("title"),R=S.useId(),le=h=>{U(h)},ce=()=>{U("")};S.useEffect(()=>{if(f){let h="";s&&s.slug?h=s.slug:h=`${J({foo:`${z}${R}`})}-${D(z)}`,M(h)}},[f,s,z,R]);function ue(h){ae(h)}const de=je(),{filters:T,trashed:he}=d,pe=["context",{folderId:T.folder,filters:T,trashed:he}],fe=async function(h){var K,V;try{F(!0);const N=h.enablePublic?s&&s.slug?s.slug:`${J({foo:`${h.title}${R}`})}-${D(h.title)}`:"";r?await l.mutateAsync({description:h.description||"",entId:(K=o[0])==null?void 0:K.assetId,name:h.title,public:h.enablePublic,slug:N,trashed:(V=o[0])==null?void 0:V.trashed,thumbnail:L}):(de.invalidateQueries(pe),await c.mutateAsync({name:h.title,description:h.description||"",thumbnail:L,folder:(y==null?void 0:y.id)==="default"?void 0:parseInt((y==null?void 0:y.id)||""),public:h.enablePublic,slug:N,app:t})),m.success(a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:n(r?"explorer.resource.updated":"explorer.resource.created")}),a.jsxs("p",{children:["Titre: ",h.title]}),a.jsxs("p",{children:["Description: ",h.description]}),r&&t===se.BLOG&&a.jsxs("p",{children:["Public:",h.enablePublic?n("explorer.enable.public.yes"):n("explorer.enable.public.no")]})]})),i==null||i()}catch(N){console.error(N)}finally{F(!1)}};function ge(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${_}`),m.success(n("explorer.copy.clipboard"))}function ye(){g(),e()}return{slug:_,isPublic:f,formId:x,errors:$,isSubmitting:j,isValid:v,resourceName:z,isLoading:oe,onPublicChange:ue,register:u,setFocus:C,setValue:w,handleSubmit:k,onFormCancel:ye,onSubmit:fe,handleUploadImage:le,handleDeleteImage:ce,onCopyToClipBoard:ge}}function De({isOpen:s,edit:r,onSuccess:i,onCancel:e}){const{appCode:t,currentApp:n}=ee(),c=te()[0],{slug:o,formId:d,isValid:p,isSubmitting:g,isPublic:u,resourceName:k,isLoading:C,register:w,handleSubmit:$,onSubmit:j,handleUploadImage:v,handleDeleteImage:x,onCopyToClipBoard:y,onPublicChange:m,setValue:_}=We({resource:c,edit:r,onSuccess:i,onCancel:e}),{data:M}=_e(),{t:f}=E();return ke.createPortal(a.jsxs(P,{id:"resource_edit_modal",size:"lg",isOpen:s,onModalClose:e,children:[a.jsx(P.Header,{onModalClose:e,children:f(r?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),a.jsxs(P.Body,{children:[a.jsx(Y,{headingStyle:"h4",level:"h3",className:"mb-16",children:f("explorer.resource.editModal.heading.general")}),a.jsxs("form",{id:d,onSubmit:$(j),children:[a.jsxs("div",{className:"d-block d-md-flex gap-16 mb-24",children:[a.jsx("div",{children:a.jsx(Ie,{app:n,src:c==null?void 0:c.thumbnail,label:f("explorer.imagepicker.label"),addButtonLabel:f("explorer.imagepicker.button.add"),deleteButtonLabel:f("explorer.imagepicker.button.delete"),onUploadImage:v,onDeleteImage:x,className:"align-self-center mt-8"})}),a.jsxs("div",{className:"col",children:[a.jsxs(A,{id:"title",className:"mb-16",isRequired:!0,children:[a.jsx(q,{children:f("title")}),a.jsx(Ce,{type:"text",defaultValue:r?c==null?void 0:c.name:"",...w("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:f("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),a.jsxs(A,{id:"description",isOptional:!0,children:[a.jsx(q,{children:f("description")}),a.jsx(Ae,{defaultValue:r?c==null?void 0:c.description:"",...w("description"),placeholder:f("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),t===se.BLOG&&$e({workflow:"createPublic",actions:M})&&a.jsx(ze,{appCode:t,isPublic:u,onCopyToClipBoard:y,onPublicChange:m,resource:c,resourceName:k,slug:o,setValue:_,register:w})]})]}),a.jsxs(P.Footer,{children:[a.jsx(O,{color:"tertiary",onClick:e,type:"button",variant:"ghost",children:f("explorer.cancel")}),a.jsx(O,{form:d,type:"submit",color:"primary",isLoading:C,variant:"filled",disabled:!p||g,children:f(r?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{De as default};
3
+ `)},domwindow(){return e("domwindow")},bigint(t){return e("bigint:"+t.toString())},process(){return e("process")},timer(){return e("timer")},pipe(){return e("pipe")},tcp(){return e("tcp")},udp(){return e("udp")},tty(){return e("tty")},statwatcher(){return e("statwatcher")},securecontext(){return e("securecontext")},connection(){return e("connection")},zlib(){return e("zlib")},context(){return e("context")},nodescript(){return e("nodescript")},httpparser(){return e("httpparser")},dataview(){return e("dataview")},signal(){return e("signal")},fsevent(){return e("fsevent")},tlswrap(){return e("tlswrap")}}}const ie="[native code] }",Me=ie.length;function G(s){return typeof s!="function"?!1:Function.prototype.toString.call(s).slice(-Me)===ie}class b{constructor(r,i){r=this.words=r||[],this.sigBytes=i===void 0?r.length*4:i}toString(r){return(r||Re).stringify(this)}concat(r){if(this.clamp(),this.sigBytes%4)for(let i=0;i<r.sigBytes;i++){const e=r.words[i>>>2]>>>24-i%4*8&255;this.words[this.sigBytes+i>>>2]|=e<<24-(this.sigBytes+i)%4*8}else for(let i=0;i<r.sigBytes;i+=4)this.words[this.sigBytes+i>>>2]=r.words[i>>>2];return this.sigBytes+=r.sigBytes,this}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new b([...this.words])}}const Re={stringify(s){const r=[];for(let i=0;i<s.sigBytes;i++){const e=s.words[i>>>2]>>>24-i%4*8&255;r.push((e>>>4).toString(16),(e&15).toString(16))}return r.join("")}},Oe={stringify(s){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=[];for(let e=0;e<s.sigBytes;e+=3){const t=s.words[e>>>2]>>>24-e%4*8&255,n=s.words[e+1>>>2]>>>24-(e+1)%4*8&255,o=s.words[e+2>>>2]>>>24-(e+2)%4*8&255,c=t<<16|n<<8|o;for(let l=0;l<4&&e*8+l*6<s.sigBytes*8;l++)i.push(r.charAt(c>>>6*(3-l)&63))}return i.join("")}},Ee={parse(s){const r=s.length,i=[];for(let e=0;e<r;e++)i[e>>>2]|=(s.charCodeAt(e)&255)<<24-e%4*8;return new b(i,r)}},Le={parse(s){return Ee.parse(unescape(encodeURIComponent(s)))}};class Ue{constructor(){this._data=new b,this._nDataBytes=0,this._minBufferSize=0,this.blockSize=512/32}reset(){this._data=new b,this._nDataBytes=0}_append(r){typeof r=="string"&&(r=Le.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes}_doProcessBlock(r,i){}_process(r){let i,e=this._data.sigBytes/(this.blockSize*4);r?e=Math.ceil(e):e=Math.max((e|0)-this._minBufferSize,0);const t=e*this.blockSize,n=Math.min(t*4,this._data.sigBytes);if(t){for(let o=0;o<t;o+=this.blockSize)this._doProcessBlock(this._data.words,o);i=this._data.words.splice(0,t),this._data.sigBytes-=n}return new b(i,n)}}class Fe extends Ue{update(r){return this._append(r),this._process(),this}finalize(r){r&&this._append(r)}}const Z=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],Te=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],B=[];class He extends Fe{constructor(){super(...arguments),this._hash=new b([...Z])}reset(){super.reset(),this._hash=new b([...Z])}_doProcessBlock(r,i){const e=this._hash.words;let t=e[0],n=e[1],o=e[2],c=e[3],l=e[4],d=e[5],p=e[6],g=e[7];for(let u=0;u<64;u++){if(u<16)B[u]=r[i+u]|0;else{const x=B[u-15],y=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,m=B[u-2],_=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;B[u]=y+B[u-7]+_+B[u-16]}const k=l&d^~l&p,C=t&n^t&o^n&o,w=(t<<30|t>>>2)^(t<<19|t>>>13)^(t<<10|t>>>22),$=(l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25),j=g+$+k+Te[u]+B[u],I=w+C;g=p,p=d,d=l,l=c+j|0,c=o,o=n,n=t,t=j+I|0}e[0]=e[0]+t|0,e[1]=e[1]+n|0,e[2]=e[2]+o|0,e[3]=e[3]+c|0,e[4]=e[4]+l|0,e[5]=e[5]+d|0,e[6]=e[6]+p|0,e[7]=e[7]+g|0}finalize(r){super.finalize(r);const i=this._nDataBytes*8,e=this._data.sigBytes*8;return this._data.words[e>>>5]|=128<<24-e%32,this._data.words[(e+64>>>9<<4)+14]=Math.floor(i/4294967296),this._data.words[(e+64>>>9<<4)+15]=i,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}}function Ke(s){return new He().finalize(s).toString(Oe)}function J(s,r={}){const i=typeof s=="string"?s:Ne(s,r);return Ke(i).slice(0,10)}var ne={};Object.defineProperty(ne,"__esModule",{value:!0});const Ve=s=>{const r="ÀÁÂÃÄÅĄĀàáâãäåąāÒÓÔÕÕÖØòóôõöøÈÉÊËĘĒèéêëðęēÇĆČçćčÐÌÍÎÏĪìíîïīÙÚÛÜŪùúûüūÑŅñņŠŚšśŸÿýŽŹŻžźżŁĻłļŃŅńņàáãảạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệđùúủũụưừứửữựòóỏõọôồốổỗộơờớởỡợìíỉĩịäëïîüûñçýỳỹỵỷğışĞİŞĢģĶķ",i="AAAAAAAAaaaaaaaaOOOOOOOooooooEEEEEEeeeeeeeCCCcccDIIIIIiiiiiUUUUUuuuuuNNnnSSssYyyZZZzzzLLllNNnnaaaaaaaaaaaaaaaaaeeeeeeeeeeeduuuuuuuuuuuoooooooooooooooooiiiiiaeiiuuncyyyyygisGISGgKk",e=r.split("").join("|"),t=new RegExp(`(${e})`,"g");function n(o){return i[r.indexOf(o)]||""}return s.replace(t,n)},qe=s=>s.split("").map(r=>`\\${r}`).join(""),Q=(s,r,i=!1)=>{const e=Ve(s).trim().toLowerCase(),t=qe(r);return i?e.replace(/\s+/g,r):e.replace(new RegExp(`[^a-z0-9${t}]+`,"g"),r).replace(new RegExp(`${t}+`,"g"),r).replace(new RegExp(`^${t}`,"g"),"").replace(new RegExp(`${t}$`,"g"),"")},A=(s,r={delimiter:"-",prefix:""})=>{if(r.delimiter||(r.delimiter="-"),r.prefix||(r.prefix=""),!s||typeof s=="boolean")return"";const{delimiter:i,prefix:e}=r;if(typeof s=="boolean")return"";if(typeof s=="string"||typeof s=="number"){const t=Q(e,i,!0),n=Q(String(s),i);return t?`${t}${i}${n}`:n}return"children"in s?A(s.children):"type"in s?A(s.props.children,r):Symbol.iterator in s?A(Array.from(s).map(t=>A(t,{delimiter:i})).join(i),r):""};var D=ne.default=A;function We({resource:s,edit:r,onSuccess:i,onCancel:e}){var H;const{appCode:t}=ee(),{t:n}=E(),o=xe(),c=be(),l=te(),d=we(),{watch:p,reset:g,register:u,handleSubmit:k,setFocus:C,setValue:w,formState:{errors:$,isSubmitting:j,isValid:I}}=Ie({mode:"onChange",defaultValues:{description:s==null?void 0:s.description,enablePublic:s==null?void 0:s.public,title:s==null?void 0:s.name}}),x=S.useId(),y=Se(),{hotToast:m}=Be(X),[_,M]=S.useState((s==null?void 0:s.slug)||""),[f,ae]=S.useState(!!(s!=null&&s.public)),[L,U]=S.useState(((H=l[0])==null?void 0:H.thumbnail)||""),[oe,F]=S.useState(!1),z=p("title"),R=S.useId(),le=h=>{U(h)},ce=()=>{U("")};S.useEffect(()=>{if(f){let h="";s&&s.slug?h=s.slug:h=`${J({foo:`${z}${R}`})}-${D(z)}`,M(h)}},[f,s,z,R]);function ue(h){ae(h)}const de=je(),{filters:T,trashed:he}=d,pe=["context",{folderId:T.folder,filters:T,trashed:he}],fe=async function(h){var K,V;try{F(!0);const N=h.enablePublic?s&&s.slug?s.slug:`${J({foo:`${h.title}${R}`})}-${D(h.title)}`:"";r?await o.mutateAsync({description:h.description||"",entId:(K=l[0])==null?void 0:K.assetId,name:h.title,public:h.enablePublic,slug:N,trashed:(V=l[0])==null?void 0:V.trashed,thumbnail:L}):(de.invalidateQueries(pe),await c.mutateAsync({name:h.title,description:h.description||"",thumbnail:L,folder:(y==null?void 0:y.id)==="default"?void 0:parseInt((y==null?void 0:y.id)||""),public:h.enablePublic,slug:N,app:t})),m.success(a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:n(r?"explorer.resource.updated":"explorer.resource.created")}),a.jsxs("p",{children:["Titre: ",h.title]}),a.jsxs("p",{children:["Description: ",h.description]}),r&&t===se.BLOG&&a.jsxs("p",{children:["Public:",h.enablePublic?n("explorer.enable.public.yes"):n("explorer.enable.public.no")]})]})),i==null||i()}catch(N){console.error(N)}finally{F(!1)}};function ge(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${_}`),m.success(n("explorer.copy.clipboard"))}function ye(){g(),e()}return{slug:_,isPublic:f,formId:x,errors:$,isSubmitting:j,isValid:I,resourceName:z,isLoading:oe,onPublicChange:ue,register:u,setFocus:C,setValue:w,handleSubmit:k,onFormCancel:ye,onSubmit:fe,handleUploadImage:le,handleDeleteImage:ce,onCopyToClipBoard:ge}}function De({isOpen:s,edit:r,onSuccess:i,onCancel:e}){const{appCode:t,currentApp:n}=ee(),c=te()[0],{slug:l,formId:d,isValid:p,isSubmitting:g,isPublic:u,resourceName:k,isLoading:C,register:w,handleSubmit:$,onSubmit:j,handleUploadImage:I,handleDeleteImage:x,onCopyToClipBoard:y,onPublicChange:m,setValue:_}=We({resource:c,edit:r,onSuccess:i,onCancel:e}),{data:M}=_e(),{t:f}=E();return ke.createPortal(a.jsxs(P,{id:"resource_edit_modal",size:"lg",isOpen:s,onModalClose:e,children:[a.jsx(P.Header,{onModalClose:e,children:f(r?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),a.jsxs(P.Body,{children:[a.jsx(Y,{headingStyle:"h4",level:"h3",className:"mb-16",children:f("explorer.resource.editModal.heading.general")}),a.jsxs("form",{id:d,onSubmit:$(j),children:[a.jsxs("div",{className:"d-block d-md-flex gap-16 mb-24",children:[a.jsx("div",{children:a.jsx(Ae,{app:n,src:c==null?void 0:c.thumbnail,label:f("explorer.imagepicker.label"),addButtonLabel:f("explorer.imagepicker.button.add"),deleteButtonLabel:f("explorer.imagepicker.button.delete"),onUploadImage:I,onDeleteImage:x,className:"align-self-center mt-8"})}),a.jsxs("div",{className:"col",children:[a.jsxs(v,{id:"title",className:"mb-16",isRequired:!0,children:[a.jsx(q,{children:f("title")}),a.jsx(Ce,{type:"text",defaultValue:r?c==null?void 0:c.name:"",...w("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:f("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),a.jsxs(v,{id:"description",isOptional:!0,children:[a.jsx(q,{children:f("description")}),a.jsx(ve,{defaultValue:r?c==null?void 0:c.description:"",...w("description"),placeholder:f("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),t===se.BLOG&&$e({workflow:"createPublic",actions:M})&&a.jsx(ze,{appCode:t,isPublic:u,onCopyToClipBoard:y,onPublicChange:m,resource:c,resourceName:k,slug:l,setValue:_,register:w})]})]}),a.jsxs(P.Footer,{children:[a.jsx(O,{color:"tertiary",onClick:e,type:"button",variant:"ghost",children:f("explorer.cancel")}),a.jsx(O,{form:d,type:"submit",color:"primary",isLoading:C,variant:"filled",disabled:!p||g,children:f(r?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{De as default};
@@ -1 +1 @@
1
- import{d as f,P as j,aa as y,e as I,ab as T,ac as h,j as t,ad as d}from"./index.js";import{C}from"./Card.js";import"/assets/js/edifice-ts-client/index.js";import"./Tooltip.js";const O=({data:e,isFetching:u})=>{var c,p;const{currentApp:a}=f(),l=j(),i=y(),{setSelectedFolders:n,setFolderIds:r,openFolder:m}=I();function g(s){i.includes(s.id)?(r(i.filter(o=>o!==s.id)),n(l.filter(o=>o.id!==s.id))):(r([...i,s.id]),n([...l,s]))}const S=T({from:{opacity:0},to:{opacity:1}}),F=h();return(c=e==null?void 0:e.pages[0])!=null&&c.folders.length?t.jsx(d.ul,{className:"grid ps-0 list-unstyled mb-24",children:(p=e==null?void 0:e.pages[0])==null?void 0:p.folders.map(s=>{const{id:o,name:x}=s;return t.jsx(d.li,{className:"g-col-4 z-1",style:{position:"relative",...S},children:t.jsx(C,{app:a,options:{type:"folder",name:x},isLoading:u,isSelected:i.includes(s.id),onOpen:()=>{F(),m({folder:s,folderId:s.id})},onSelect:()=>g(s)})},o)})}):null};export{O as default};
1
+ import{j as l,aa as S,d as C,P as y,ab as f,e as T,ac as I,ad as N,ae as m}from"./index.js";import{C as a}from"./Card.js";import"/assets/js/edifice-ts-client/index.js";const g=({app:e,name:n,isSelected:r=!1,isSelectable:o=!0,onClick:t,onSelect:c})=>l.jsx(a,{app:e,isSelectable:o,isSelected:r,onClick:t,onSelect:c,children:d=>l.jsxs(a.Body,{children:[l.jsx(S,{width:"48",height:"48",className:`color-app-${d}`}),l.jsx(a.Title,{children:n})]})});g.displayName="FolderCard";const $=g,k=({data:e})=>{var p,u;const{currentApp:n}=C(),r=y(),o=f(),{setSelectedFolders:t,setFolderIds:c,openFolder:d}=T();function F(s){o.includes(s.id)?(c(o.filter(i=>i!==s.id)),t(r.filter(i=>i.id!==s.id))):(c([...o,s.id]),t([...r,s]))}const x=I({from:{opacity:0},to:{opacity:1}}),h=N();return(p=e==null?void 0:e.pages[0])!=null&&p.folders.length?l.jsx(m.ul,{className:"grid ps-0 list-unstyled mb-24",children:(u=e==null?void 0:e.pages[0])==null?void 0:u.folders.map(s=>{const{id:i,name:j}=s;return l.jsx(m.li,{className:"g-col-4 z-1",style:{position:"relative",...x},children:l.jsx($,{name:j,app:n,isSelected:o.includes(s.id),onClick:()=>{h(),d({folder:s,folderId:s.id})},onSelect:()=>F(s)})},i)})}):null};export{k as default};
package/dist/MoveModal.js CHANGED
@@ -1 +1 @@
1
- import{r as I,O as v,P as T,o as M,e as y,Q as j,u as b,T as F,a as S,j as o,M as n,U as w,B as h}from"./index.js";import"/assets/js/edifice-ts-client/index.js";function E({onSuccess:a}){const[s,r]=I.useState(),l=v(),d=T(),i=M(),{foldTreeItem:c,unfoldTreeItem:m}=y(),u=j();async function f(){try{if(!s)throw new Error("explorer.move.selection.empty");await l.mutate(s),await(a==null?void 0:a())}catch(e){console.error(e)}}const p=e=>{var x;for(const t of d)if(e===t.id||e===t.parentId)return!1;for(const t of i)if(e===((t==null?void 0:t.folderIds)&&t.folderIds[0])||((x=t==null?void 0:t.folderIds)==null?void 0:x.length)===0&&e==="default")return!1;return!0};return{disableSubmit:!s,handleTreeItemSelect:e=>{p(e)?r(e):r(void 0)},handleTreeItemFold:c,handleTreeItemUnfold:async e=>await m(e,u),onMove:()=>{f()}}}function g({isOpen:a,onSuccess:s,onCancel:r}){const{t:l}=b(),{handleTreeItemFold:d,handleTreeItemSelect:i,handleTreeItemUnfold:c,onMove:m,disableSubmit:u}=E({onSuccess:s}),f=F();return S.createPortal(o.jsxs(n,{isOpen:a,onModalClose:r,id:"moveModal",children:[o.jsx(n.Header,{onModalClose:r,children:l("explorer.move.title")}),o.jsx(n.Subtitle,{children:l("explorer.move.subtitle")}),o.jsx(n.Body,{children:o.jsx(w,{data:f,onTreeItemSelect:i,onTreeItemFold:d,onTreeItemUnfold:c})}),o.jsxs(n.Footer,{children:[o.jsx(h,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),o.jsx(h,{color:"primary",onClick:m,type:"button",variant:"filled",disabled:u,children:l("explorer.move")})]})]}),document.getElementById("portal"))}export{g as default};
1
+ import{r as I,O as v,P as T,p as M,e as y,Q as j,u as b,T as F,a as S,j as o,M as n,U as w,B as x}from"./index.js";import"/assets/js/edifice-ts-client/index.js";function E({onSuccess:a}){const[s,r]=I.useState(),l=v(),d=T(),i=M(),{foldTreeItem:c,unfoldTreeItem:m}=y(),u=j();async function f(){try{if(!s)throw new Error("explorer.move.selection.empty");await l.mutate(s),await(a==null?void 0:a())}catch(e){console.error(e)}}const h=e=>{var p;for(const t of d)if(e===t.id||e===t.parentId)return!1;for(const t of i)if(e===((t==null?void 0:t.folderIds)&&t.folderIds[0])||((p=t==null?void 0:t.folderIds)==null?void 0:p.length)===0&&e==="default")return!1;return!0};return{disableSubmit:!s,handleTreeItemSelect:e=>{h(e)?r(e):r(void 0)},handleTreeItemFold:c,handleTreeItemUnfold:async e=>await m(e,u),onMove:()=>{f()}}}function g({isOpen:a,onSuccess:s,onCancel:r}){const{t:l}=b(),{handleTreeItemFold:d,handleTreeItemSelect:i,handleTreeItemUnfold:c,onMove:m,disableSubmit:u}=E({onSuccess:s}),f=F();return S.createPortal(o.jsxs(n,{isOpen:a,onModalClose:r,id:"moveModal",children:[o.jsx(n.Header,{onModalClose:r,children:l("explorer.move.title")}),o.jsx(n.Subtitle,{children:l("explorer.move.subtitle")}),o.jsx(n.Body,{children:o.jsx(w,{data:f,onTreeItemSelect:i,onTreeItemFold:d,onTreeItemUnfold:c})}),o.jsxs(n.Footer,{children:[o.jsx(x,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),o.jsx(x,{color:"primary",onClick:m,type:"button",variant:"filled",disabled:u,children:l("explorer.move")})]})]}),document.getElementById("portal"))}export{g as default};