@bobbykim/manguito-cms-admin 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/assets/{ChangePasswordView-RhnQhTpj.js → ChangePasswordView-D-B7xv5c.js} +1 -1
  2. package/dist/assets/ContentFormView-Bfee-uVL.js +1 -0
  3. package/dist/assets/{ContentListView-52Vdrqg6.js → ContentListView-BpgXHLa6.js} +1 -1
  4. package/dist/assets/{ContentSettingsView-vDV6xaxT.js → ContentSettingsView-CuuxtUQh.js} +1 -1
  5. package/dist/assets/{LoginView-y0TQTfvj.js → LoginView-BdqDyYJ6.js} +1 -1
  6. package/dist/assets/{MediaDetailView-CFGRX94J.js → MediaDetailView-DmKNv8bW.js} +1 -1
  7. package/dist/assets/MediaLibraryView-OGPHji7F.js +1 -0
  8. package/dist/assets/MediaThumbnail-q7pxungQ.js +1 -0
  9. package/dist/assets/{TaxonomyFormView-B2__-WRX.js → TaxonomyFormView-Dzaz47pa.js} +1 -1
  10. package/dist/assets/{TaxonomyListView-COqfCnDR.js → TaxonomyListView-kaf2LX5v.js} +1 -1
  11. package/dist/assets/{UserFormView-G2pzRNAl.js → UserFormView-KlTIvn2s.js} +1 -1
  12. package/dist/assets/{UserListView-BlP10YCt.js → UserListView-_HSsX1vW.js} +1 -1
  13. package/dist/assets/{field-defaults-BTA4TEHe.js → field-defaults-m6kJphku.js} +1 -1
  14. package/dist/assets/{index-ivedPYqQ.css → index-C4qBpxpk.css} +1 -1
  15. package/dist/assets/{index-GvXDeXi5.js → index-DHBhcS6-.js} +2 -2
  16. package/dist/assets/{useNotification-DXsAIQaa.js → useNotification-B8AtuEWL.js} +1 -1
  17. package/dist/index.html +2 -2
  18. package/package.json +1 -1
  19. package/src/components/fields/MediaUpload.vue +5 -19
  20. package/src/components/shared/MediaSelectModal.vue +4 -21
  21. package/src/components/shared/MediaThumbnail.vue +108 -0
  22. package/src/components/shared/__tests__/MediaThumbnail.test.ts +118 -0
  23. package/src/utils/__tests__/file-kind.test.ts +102 -0
  24. package/src/utils/file-kind.ts +83 -0
  25. package/src/views/media/MediaLibraryView.vue +7 -22
  26. package/dist/assets/ContentFormView-Ch9JVUWn.js +0 -1
  27. package/dist/assets/MediaLibraryView-WCKhSv_6.js +0 -1
  28. package/dist/assets/useTabIndicator-CvEsGBJh.js +0 -1
@@ -1 +1 @@
1
- import{B as e,E as t,P as n,c as r,d as i,g as a,u as o,ut as s}from"./schema-B-RKX_ep.js";import{c,d as l,o as u,t as d,u as f}from"./index-GvXDeXi5.js";var p={class:`flex min-h-screen items-center justify-center bg-gray-50 px-4`},m={class:`w-full max-w-sm`},h=[`disabled`],g=[`disabled`],_=[`disabled`],v={key:0,class:`text-sm text-red-600`,role:`alert`},y=[`disabled`],b=a({__name:`ChangePasswordView`,setup(a){let b=c(),x=d(),S=u(),C=e(``),w=e(``),T=e(``),E=e(!1),D=e(``);async function O(){if(D.value=``,w.value!==T.value){D.value=`Passwords do not match.`;return}E.value=!0;let e=await x.post(`/users/change-password`,{current_password:C.value,new_password:w.value});if(E.value=!1,!e.ok){e.error.code===`INVALID_CREDENTIALS`?D.value=`Current password is incorrect.`:D.value=`Something went wrong. Please try again.`;return}S.setUser({id:S.id,email:S.email,role:S.role,mustChangePassword:!1}),b.push(`/admin/media`)}return(e,a)=>(t(),i(`div`,p,[r(`div`,m,[a[6]||=r(`h1`,{class:`mb-2 text-center text-2xl font-bold text-gray-900`},`Change password`,-1),a[7]||=r(`p`,{class:`mb-8 text-center text-sm text-gray-500`},` You must set a new password before continuing. `,-1),r(`form`,{class:`space-y-5`,novalidate:``,onSubmit:l(O,[`prevent`])},[r(`div`,null,[a[3]||=r(`label`,{for:`current-password`,class:`block text-[13px] font-semibold text-[#3D3D52]`},` Current password `,-1),n(r(`input`,{id:`current-password`,"onUpdate:modelValue":a[0]||=e=>C.value=e,type:`password`,required:``,autocomplete:`current-password`,disabled:E.value,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},null,8,h),[[f,C.value]])]),r(`div`,null,[a[4]||=r(`label`,{for:`new-password`,class:`block text-[13px] font-semibold text-[#3D3D52]`},` New password `,-1),n(r(`input`,{id:`new-password`,"onUpdate:modelValue":a[1]||=e=>w.value=e,type:`password`,required:``,autocomplete:`new-password`,disabled:E.value,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},null,8,g),[[f,w.value]])]),r(`div`,null,[a[5]||=r(`label`,{for:`confirm-password`,class:`block text-[13px] font-semibold text-[#3D3D52]`},` Confirm new password `,-1),n(r(`input`,{id:`confirm-password`,"onUpdate:modelValue":a[2]||=e=>T.value=e,type:`password`,required:``,autocomplete:`new-password`,disabled:E.value,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},null,8,_),[[f,T.value]])]),D.value?(t(),i(`p`,v,s(D.value),1)):o(``,!0),r(`button`,{type:`submit`,disabled:E.value,class:`w-full rounded-md bg-indigo-600 px-4 py-2 text-sm font-semibold text-white transition-colors hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50`},s(E.value?`Saving…`:`Set new password`),9,y)],32)])]))}});export{b as default};
1
+ import{B as e,E as t,P as n,c as r,d as i,g as a,u as o,ut as s}from"./schema-B-RKX_ep.js";import{c,d as l,o as u,t as d,u as f}from"./index-DHBhcS6-.js";var p={class:`flex min-h-screen items-center justify-center bg-gray-50 px-4`},m={class:`w-full max-w-sm`},h=[`disabled`],g=[`disabled`],_=[`disabled`],v={key:0,class:`text-sm text-red-600`,role:`alert`},y=[`disabled`],b=a({__name:`ChangePasswordView`,setup(a){let b=c(),x=d(),S=u(),C=e(``),w=e(``),T=e(``),E=e(!1),D=e(``);async function O(){if(D.value=``,w.value!==T.value){D.value=`Passwords do not match.`;return}E.value=!0;let e=await x.post(`/users/change-password`,{current_password:C.value,new_password:w.value});if(E.value=!1,!e.ok){e.error.code===`INVALID_CREDENTIALS`?D.value=`Current password is incorrect.`:D.value=`Something went wrong. Please try again.`;return}S.setUser({id:S.id,email:S.email,role:S.role,mustChangePassword:!1}),b.push(`/admin/media`)}return(e,a)=>(t(),i(`div`,p,[r(`div`,m,[a[6]||=r(`h1`,{class:`mb-2 text-center text-2xl font-bold text-gray-900`},`Change password`,-1),a[7]||=r(`p`,{class:`mb-8 text-center text-sm text-gray-500`},` You must set a new password before continuing. `,-1),r(`form`,{class:`space-y-5`,novalidate:``,onSubmit:l(O,[`prevent`])},[r(`div`,null,[a[3]||=r(`label`,{for:`current-password`,class:`block text-[13px] font-semibold text-[#3D3D52]`},` Current password `,-1),n(r(`input`,{id:`current-password`,"onUpdate:modelValue":a[0]||=e=>C.value=e,type:`password`,required:``,autocomplete:`current-password`,disabled:E.value,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},null,8,h),[[f,C.value]])]),r(`div`,null,[a[4]||=r(`label`,{for:`new-password`,class:`block text-[13px] font-semibold text-[#3D3D52]`},` New password `,-1),n(r(`input`,{id:`new-password`,"onUpdate:modelValue":a[1]||=e=>w.value=e,type:`password`,required:``,autocomplete:`new-password`,disabled:E.value,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},null,8,g),[[f,w.value]])]),r(`div`,null,[a[5]||=r(`label`,{for:`confirm-password`,class:`block text-[13px] font-semibold text-[#3D3D52]`},` Confirm new password `,-1),n(r(`input`,{id:`confirm-password`,"onUpdate:modelValue":a[2]||=e=>T.value=e,type:`password`,required:``,autocomplete:`new-password`,disabled:E.value,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},null,8,_),[[f,T.value]])]),D.value?(t(),i(`p`,v,s(D.value),1)):o(``,!0),r(`button`,{type:`submit`,disabled:E.value,class:`w-full rounded-md bg-indigo-600 px-4 py-2 text-sm font-semibold text-white transition-colors hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50`},s(E.value?`Saving…`:`Set new password`),9,y)],32)])]))}});export{b as default};
@@ -0,0 +1 @@
1
+ import{A as e,B as t,E as n,L as r,O as i,P as a,W as o,a as s,c,ct as l,d as u,g as d,h as f,i as p,j as m,l as h,lt as g,m as _,s as v,t as y,u as b,ut as x,v as S,w as C,x as w}from"./schema-B-RKX_ep.js";import{a as T,c as E,d as D,n as O,r as k,s as A,t as ee,u as j}from"./index-DHBhcS6-.js";import{a as M,c as N,i as P,l as F,n as I,o as L,r as R,s as z,t as te,u as ne}from"./field-defaults-m6kJphku.js";import{t as re}from"./useNotification-B8AtuEWL.js";import{t as ie}from"./content--2XYr_UQ.js";import{t as ae}from"./ConfirmDialog-B7nxdDge.js";import{n as B,r as oe,t as V}from"./MediaThumbnail-q7pxungQ.js";var se={class:`flex h-full max-h-144 w-full max-w-3xl flex-col overflow-hidden rounded-lg bg-white shadow-xl`},H={class:`flex items-center justify-between border-b border-gray-200 px-5 py-4`},U={key:0,class:`flex gap-1 border-b border-gray-200 px-5 pt-3`},W=[`onClick`],G={key:1,class:`border-b border-gray-200 px-5 py-2 text-sm text-gray-500`},ce={class:`font-medium text-gray-700`},K={class:`flex-1 overflow-y-auto p-5`},q={key:0,class:`flex items-center justify-center py-16`},J={key:1,class:`flex flex-col items-center justify-center py-16 text-gray-400`},Y={key:2,class:`grid grid-cols-3 gap-3 sm:grid-cols-4 md:grid-cols-5`},X=[`aria-pressed`,`aria-label`,`onClick`],Z={key:0,class:`absolute right-1 top-1 flex h-5 w-5 items-center justify-center rounded-full bg-indigo-600 text-xs text-white`,"aria-hidden":`true`},Q={key:2,class:`flex items-center justify-center gap-3 border-t border-gray-100 px-5 py-2`},le=[`disabled`],ue={class:`text-xs text-gray-500`},de=[`disabled`],fe={class:`flex justify-end gap-3 border-t border-gray-200 px-5 py-4`},pe=[`disabled`],me=d({__name:`MediaSelectModal`,props:{acceptedType:{}},emits:[`select`,`close`],setup(e,{emit:r}){let a=e,d=r,g=ee(),y=[{label:`Images`,value:`image`},{label:`Videos`,value:`video`},{label:`PDFs`,value:`file`}],S=t(a.acceptedType??`all`),w=v(()=>!a.acceptedType);m(()=>a.acceptedType,e=>{e&&(S.value=e)});let T=t([]),E=t(!1),O=t(1),k=t(1),A=t(null);function j(e,t){let n=new URLSearchParams({page:String(t),per_page:`20`});return e!==`all`&&n.set(`type`,e),`/media?${n.toString()}`}async function M(){E.value=!0;let e=await g.get(j(S.value,O.value));E.value=!1,e.ok&&(T.value=e.data,k.value=e.meta?.total_pages??1)}m(S,()=>{O.value=1,A.value=null,M()}),m(O,()=>{M()}),C(()=>{M()});function N(){A.value&&d(`select`,A.value)}return(t,r)=>(n(),h(s,{to:`body`},[c(`div`,{class:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":`Select media`,onClick:r[5]||=D(e=>t.$emit(`close`),[`self`])},[c(`div`,se,[c(`div`,H,[r[6]||=c(`h2`,{class:`text-base font-semibold text-gray-900`},`Select Media`,-1),c(`button`,{type:`button`,class:`text-xl leading-none text-gray-400 hover:text-gray-600`,"aria-label":`Close`,onClick:r[0]||=e=>t.$emit(`close`)},` × `)]),w.value?(n(),u(`div`,U,[c(`button`,{type:`button`,class:l([`rounded-t-md px-3 py-1.5 text-sm font-medium transition-colors`,S.value===`all`?`border-b-2 border-indigo-600 text-indigo-600`:`text-gray-500 hover:text-gray-800`]),onClick:r[1]||=e=>S.value=`all`},` All `,2),(n(),u(p,null,i(y,e=>c(`button`,{key:e.value,type:`button`,class:l([`rounded-t-md px-3 py-1.5 text-sm font-medium transition-colors`,S.value===e.value?`border-b-2 border-indigo-600 text-indigo-600`:`text-gray-500 hover:text-gray-800`]),onClick:t=>S.value=e.value},x(e.label),11,W)),64))])):(n(),u(`div`,G,[r[7]||=_(` Showing: `,-1),c(`span`,ce,x(y.find(t=>t.value===e.acceptedType)?.label??e.acceptedType),1)])),c(`div`,K,[E.value?(n(),u(`div`,q,[...r[8]||=[c(`span`,{class:`inline-block h-6 w-6 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent`,"aria-hidden":`true`},null,-1)]])):T.value.length===0?(n(),u(`div`,J,[...r[9]||=[c(`span`,{class:`text-4xl`,"aria-hidden":`true`},`🖼`,-1),c(`p`,{class:`mt-2 text-sm`},`No media found`,-1)]])):(n(),u(`div`,Y,[(n(!0),u(p,null,i(T.value,e=>(n(),u(`button`,{key:e.id,type:`button`,class:l([`group relative aspect-square overflow-hidden rounded-md border-2 transition-colors focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-1`,A.value?.id===e.id?`border-indigo-500`:`border-transparent hover:border-gray-300`]),"aria-pressed":A.value?.id===e.id,"aria-label":`Select ${e.alt??o(B)(e.url)}`,onClick:t=>A.value=e},[f(V,{item:e,label:o(B)(e.url)},null,8,[`item`,`label`]),A.value?.id===e.id?(n(),u(`div`,Z,` ✓ `)):b(``,!0)],10,X))),128))]))]),k.value>1?(n(),u(`div`,Q,[c(`button`,{type:`button`,disabled:O.value===1,class:`rounded px-2 py-1 text-sm text-gray-600 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40`,onClick:r[2]||=e=>O.value--},` ← Prev `,8,le),c(`span`,ue,x(O.value)+` / `+x(k.value),1),c(`button`,{type:`button`,disabled:O.value===k.value,class:`rounded px-2 py-1 text-sm text-gray-600 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40`,onClick:r[3]||=e=>O.value++},` Next → `,8,de)])):b(``,!0),c(`div`,fe,[c(`button`,{type:`button`,class:`rounded-md px-4 py-2 text-sm font-medium text-gray-700 ring-1 ring-inset ring-gray-300 hover:bg-gray-50`,onClick:r[4]||=e=>t.$emit(`close`)},` Cancel `),c(`button`,{type:`button`,disabled:!A.value,class:`rounded-md bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50`,onClick:N},` Select `,8,pe)])])])]))}}),he={class:`block text-[13px] font-semibold text-[#3D3D52]`},ge={key:0,class:`ml-0.5 text-red-500`,"aria-hidden":`true`},_e={key:0,class:`mt-1 flex flex-col gap-2 rounded-md border border-gray-200 p-3`},ve={class:`flex items-center gap-3`},$={class:`h-16 w-16 shrink-0 overflow-hidden rounded`},ye={class:`min-w-0 flex-1`},be={class:`truncate text-sm font-medium text-gray-800`},xe={class:`text-xs text-gray-500`},Se={key:0},Ce=[`for`],we=[`id`],Te={key:1,class:`mt-1 rounded-md border border-gray-200 p-3`},Ee={class:`flex items-center gap-2`},De={class:`h-2 flex-1 overflow-hidden rounded-full bg-gray-100`},Oe={class:`w-8 shrink-0 text-right text-xs text-gray-500`},ke={key:2,class:`mt-1 rounded-md border border-gray-200 p-3`},Ae={class:`mb-2 truncate text-[13px] font-semibold text-[#3D3D52]`},je=[`for`],Me=[`id`],Ne={class:`mt-3 flex justify-end gap-2`},Pe=[`disabled`],Fe={key:3,class:`mt-1 flex gap-2`},Ie=[`accept`],Le=[`disabled`],Re=[`disabled`],ze={key:4,class:`mt-1 text-sm text-red-600`,role:`alert`},Be={key:5,class:`mt-1 text-sm text-red-600`,role:`alert`},Ve=d({__name:`MediaUpload`,props:{field:{},modelValue:{},error:{},disabled:{type:Boolean}},emits:[`update:modelValue`],setup(e,{emit:r}){let i=e,s=r,l=k(),d=v(()=>{let e=i.field.ui_component;return e.component===`file-upload`?e.accepted_mime_types.join(`,`):``}),p=v(()=>{let e=i.field.field_type;return e===`image`||e===`video`||e===`file`?e:`file`}),m=v(()=>p.value!==`image`),y=t(`idle`),S=t(0),w=t(``),T=t(null),E=t(``),D=t(null),O=t(!1),A=t(null);function ee(e){return e>=1e6?`${(e/1e6).toFixed(1)} MB`:e>=1e3?`${(e/1e3).toFixed(0)} KB`:`${e} B`}function M(e,t){return new Promise((n,r)=>{let i=new FormData;i.append(`file`,e),t&&i.append(`alt`,t);let a=new XMLHttpRequest;a.withCredentials=!0,a.open(`POST`,`/admin/api/media/${p.value}`),a.upload.onprogress=e=>{e.lengthComputable&&(S.value=Math.round(e.loaded/e.total*100))},a.onload=()=>{try{let e=JSON.parse(a.responseText);e.ok&&e.data?n(e.data):r(Error(e.error?.message??`Upload failed`))}catch{r(Error(`Invalid server response`))}},a.onerror=()=>r(Error(`Network error`)),a.send(i)})}async function N(e,t){let n=new URLSearchParams({type:p.value,filename:e.name,mime_type:e.type}),r=await(await fetch(`/admin/api/media/presigned-url?${n.toString()}`,{credentials:`include`})).json();if(!r.ok||!r.data)throw Error(r.error?.message??`Failed to get upload URL`);let{upload_url:i,media_id:a,method:o,fields:s}=r.data;await new Promise((t,n)=>{let r=new XMLHttpRequest;if(r.upload.onprogress=e=>{e.lengthComputable&&(S.value=Math.round(e.loaded/e.total*100))},r.onload=()=>{r.status>=200&&r.status<300?t():n(Error(`Storage upload failed (${r.status})`))},r.onerror=()=>n(Error(`Network error during upload`)),o===`POST`&&s){let t=new FormData;for(let[e,n]of Object.entries(s))t.append(e,n);t.append(`file`,e),r.open(`POST`,i),r.send(t)}else r.open(`PUT`,i),r.send(e)});let c=await(await fetch(`/admin/api/media/confirm/${a}`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({alt:t})})).json();if(!c.ok||!c.data)throw Error(c.error?.message??`Upload confirmation failed`);return c.data}async function P(e){y.value=`uploading`,S.value=0,w.value=``;try{let t=E.value.trim(),n=l.presignedUploads?await N(e,t):await M(e,t);D.value=n,E.value=n.alt??``,s(`update:modelValue`,n.id)}catch(e){w.value=e instanceof Error?e.message:`Upload failed`}finally{y.value=`idle`,T.value=null}}async function F(){let e=D.value;if(!e)return;let t=new XMLHttpRequest;t.withCredentials=!0,t.open(`PATCH`,`/admin/api/media/${e.id}`),t.setRequestHeader(`Content-Type`,`application/json`),t.onload=()=>{try{let e=JSON.parse(t.responseText);e.ok&&e.data&&(D.value=e.data)}catch{}},t.send(JSON.stringify({alt:E.value.trim()}))}function I(e){let t=e.target.files?.[0];t&&(T.value=t,E.value=``,e.target.value=``,m.value?y.value=`alt-collect`:P(t))}function L(){T.value&&(m.value&&!E.value.trim()||P(T.value))}function R(){T.value=null,E.value=``,y.value=`idle`,w.value=``}function z(){D.value=null,E.value=``,s(`update:modelValue`,null)}function te(e){D.value=e,E.value=e.alt??``,O.value=!1,s(`update:modelValue`,e.id)}return C(async()=>{if(typeof i.modelValue!=`string`||!i.modelValue)return;let e=await fetch(`/admin/api/media/${i.modelValue}`,{credentials:`include`});if(!e.ok)return;let t=await e.json();t.ok&&t.data&&(D.value=t.data,E.value=t.data.alt??``)}),(t,r)=>(n(),u(`div`,null,[c(`label`,he,[_(x(e.field.label)+` `,1),e.field.required?(n(),u(`span`,ge,`*`)):b(``,!0)]),D.value?(n(),u(`div`,_e,[c(`div`,ve,[c(`div`,$,[f(V,{item:D.value},null,8,[`item`])]),c(`div`,ye,[c(`p`,be,x(o(B)(D.value.url)),1),c(`p`,xe,x(ee(D.value.file_size)),1)]),e.disabled?b(``,!0):(n(),u(`button`,{key:0,type:`button`,class:`shrink-0 text-lg leading-none text-gray-400 hover:text-red-500`,"aria-label":`Remove selected media`,onClick:z},` × `))]),D.value.type===`image`&&!e.disabled?(n(),u(`div`,Se,[c(`label`,{for:`${e.field.name}-alt`,class:`block text-xs text-gray-500`},[...r[5]||=[_(` Alt text `,-1),c(`span`,{class:`text-gray-400`},`(optional)`,-1)]],8,Ce),a(c(`input`,{id:`${e.field.name}-alt`,"onUpdate:modelValue":r[0]||=e=>E.value=e,type:`text`,placeholder:`Describe this image`,class:`mt-0.5 block w-full rounded-md border border-gray-300 px-2 py-1 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200`,onBlur:F},null,40,we),[[j,E.value]])])):b(``,!0)])):y.value===`uploading`?(n(),u(`div`,Te,[r[6]||=c(`p`,{class:`mb-1.5 text-xs text-gray-500`},`Uploading…`,-1),c(`div`,Ee,[c(`div`,De,[c(`div`,{class:`h-2 rounded-full bg-indigo-600 transition-all duration-150`,style:g({width:`${S.value}%`})},null,4)]),c(`span`,Oe,x(S.value)+`% `,1)])])):y.value===`alt-collect`?(n(),u(`div`,ke,[c(`p`,Ae,x(T.value?.name),1),c(`label`,{for:`${e.field.name}-alt-pre`,class:`block text-xs text-gray-600`},[...r[7]||=[_(` Alt text `,-1),c(`span`,{class:`text-red-500`,"aria-hidden":`true`},`*`,-1)]],8,je),a(c(`input`,{id:`${e.field.name}-alt-pre`,"onUpdate:modelValue":r[1]||=e=>E.value=e,type:`text`,placeholder:`Describe this file`,class:`mt-0.5 block w-full rounded-md border border-gray-300 px-2 py-1 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200`},null,8,Me),[[j,E.value]]),c(`div`,Ne,[c(`button`,{type:`button`,class:`rounded-md px-3 py-1.5 text-sm text-gray-600 ring-1 ring-inset ring-gray-300 hover:bg-gray-50`,onClick:R},` Cancel `),c(`button`,{type:`button`,disabled:!E.value.trim(),class:`rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50`,onClick:L},` Upload `,8,Pe)])])):(n(),u(`div`,Fe,[c(`input`,{ref_key:`fileInputRef`,ref:A,type:`file`,class:`hidden`,accept:d.value,onChange:I},null,40,Ie),c(`button`,{type:`button`,disabled:e.disabled,class:`rounded-md border border-gray-300 px-3 py-2 text-sm text-gray-700 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,onClick:r[2]||=e=>A.value?.click()},` Upload `,8,Le),c(`button`,{type:`button`,disabled:e.disabled,class:`rounded-md border border-gray-300 px-3 py-2 text-sm text-gray-700 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,onClick:r[3]||=e=>O.value=!0},` Select from library `,8,Re)])),w.value?(n(),u(`p`,ze,x(w.value),1)):b(``,!0),e.error?(n(),u(`p`,Be,x(e.error),1)):b(``,!0),O.value?(n(),h(me,{key:6,"accepted-type":p.value,onSelect:te,onClose:r[4]||=e=>O.value=!1},null,8,[`accepted-type`])):b(``,!0)]))}}),He={class:`block text-[13px] font-semibold text-[#3D3D52]`},Ue={key:0,class:`ml-0.5 text-red-500`,"aria-hidden":`true`},We={key:0,class:`mt-1.5 flex flex-wrap gap-1.5`},Ge=[`disabled`,`aria-label`,`onClick`],Ke={key:1,class:`mt-1.5`},qe={class:`inline-flex items-center gap-1 rounded-full bg-indigo-100 px-2.5 py-0.5 text-xs font-medium text-indigo-800`},Je=[`disabled`],Ye={key:2,class:`mt-0.5 text-xs text-gray-500`},Xe={class:`relative mt-1`},Ze=[`id`,`value`,`disabled`,`placeholder`],Qe={key:0,role:`listbox`,class:`absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-sm shadow-lg ring-1 ring-black/5 focus:outline-none`},$e={key:0,class:`flex items-center gap-2 px-3 py-2 text-gray-400`},et={key:0,class:`px-3 py-2 text-gray-500`},tt=[`onClick`],nt={key:3,class:`mt-1 text-sm text-red-600`,role:`alert`},rt=d({__name:`ReferenceSelect`,props:{field:{},modelValue:{},error:{},disabled:{type:Boolean}},emits:[`update:modelValue`],setup(e,{emit:r}){let a=e,o=r,s=ee(),d=y(),f=v(()=>{let e=a.field.ui_component;return e.component===`typeahead-select`?e:null}),m=v(()=>f.value?.ref??``),h=v(()=>a.field.validation.max_items??null),g=v(()=>R(a.field)===`many`),S=v(()=>!!d.contentTypes[m.value]),w=v(()=>(S.value?d.contentTypes[m.value]:d.taxonomyTypes[m.value])?.fields.find(e=>e.field_type===`text/plain`)?.name??`id`),E=v(()=>g.value?Array.isArray(a.modelValue)?a.modelValue.filter(e=>typeof e==`string`):[]:typeof a.modelValue==`string`?[a.modelValue]:[]),O=v(()=>h.value!==null&&E.value.length>=h.value),k=v(()=>E.value[0]??``),A=t({}),j=t(``),M=t(!1),N=t([]),P=t(!1);function F(){return S.value?`/content/${m.value}`:`/taxonomy/${m.value}`}function I(e){let t=new URLSearchParams({[`filters[${w.value}][like]`]:e,per_page:`10`});return`${F()}?${t.toString()}`}function L(e){return String(e[w.value]??e.id??``)}let z=T(async e=>{if(e.length<2){N.value=[],P.value=!1;return}M.value=!0,P.value=!0;let t=await s.get(I(e));M.value=!1,t.ok&&(N.value=t.data)},300);function te(e){j.value=e.target.value,z(j.value)}function ne(){setTimeout(()=>{P.value=!1},150)}function re(){j.value.length>=2&&(P.value=!0)}function ie(e){let t=String(e.id);if(A.value[t]=L(e),j.value=``,N.value=[],P.value=!1,g.value){let e=[...E.value];e.includes(t)||e.push(t),o(`update:modelValue`,e)}else o(`update:modelValue`,t)}function ae(e){g.value?o(`update:modelValue`,E.value.filter(t=>t!==e)):o(`update:modelValue`,null)}return C(async()=>{for(let e of E.value){if(A.value[e])continue;let t=await s.get(`${F()}/${e}`);t.ok?A.value[e]=L(t.data):A.value[e]=e}}),(t,r)=>(n(),u(`div`,null,[c(`label`,He,[_(x(e.field.label)+` `,1),e.field.required?(n(),u(`span`,Ue,`*`)):b(``,!0)]),g.value&&E.value.length?(n(),u(`div`,We,[(n(!0),u(p,null,i(E.value,t=>(n(),u(`span`,{key:t,class:`inline-flex items-center gap-1 rounded-full bg-indigo-100 px-2.5 py-0.5 text-xs font-medium text-indigo-800`},[_(x(A.value[t]??t)+` `,1),c(`button`,{type:`button`,disabled:e.disabled,class:`ml-0.5 flex h-3.5 w-3.5 items-center justify-center rounded-full hover:bg-indigo-200 disabled:cursor-not-allowed`,"aria-label":`Remove ${A.value[t]??t}`,onClick:e=>ae(t)},[...r[2]||=[c(`span`,{"aria-hidden":`true`},`×`,-1)]],8,Ge)]))),128))])):!g.value&&E.value.length?(n(),u(`div`,Ke,[c(`span`,qe,[_(x(A.value[k.value]??k.value)+` `,1),c(`button`,{type:`button`,disabled:e.disabled,class:`ml-0.5 flex h-3.5 w-3.5 items-center justify-center rounded-full hover:bg-indigo-200 disabled:cursor-not-allowed`,"aria-label":`Clear selection`,onClick:r[0]||=e=>ae(k.value)},[...r[3]||=[c(`span`,{"aria-hidden":`true`},`×`,-1)]],8,Je)])])):b(``,!0),h.value===null?b(``,!0):(n(),u(`p`,Ye,x(E.value.length)+` / `+x(h.value)+` selected `,1)),c(`div`,Xe,[c(`input`,{id:e.field.name,type:`text`,value:j.value,disabled:e.disabled||O.value,placeholder:O.value?`Limit reached`:`Search ${e.field.label}…`,class:l([`block w-full rounded-[11px] border px-3.5 py-3 text-sm focus:outline-none focus:ring-[3px]`,e.error?`border-red-300 focus:border-red-400 focus:ring-red-200`:`border-[#E4E3EE] bg-[#FBFBFD] focus:border-indigo-400 focus:bg-white focus:ring-indigo-50`,(e.disabled||O.value)&&`cursor-not-allowed bg-gray-50 opacity-60`]),autocomplete:`off`,onInput:te,onFocus:re,onFocusout:ne},null,42,Ze),P.value?(n(),u(`ul`,Qe,[M.value?(n(),u(`li`,$e,[...r[4]||=[c(`span`,{class:`inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent`,"aria-hidden":`true`},null,-1),_(` Searching… `,-1)]])):(n(),u(p,{key:1},[N.value.length===0?(n(),u(`li`,et,` No results found for "`+x(j.value)+`" `,1)):b(``,!0),(n(!0),u(p,null,i(N.value,e=>(n(),u(`li`,{key:String(e.id),role:`option`,class:`cursor-pointer px-3 py-2 hover:bg-indigo-50`,onMousedown:r[1]||=D(()=>{},[`prevent`]),onClick:t=>ie(e)},x(L(e)),41,tt))),128))],64))])):b(``,!0)]),e.error?(n(),u(`p`,nt,x(e.error),1)):b(``,!0)]))}}),it={class:`block text-[13px] font-semibold text-[#3D3D52]`},at={key:0,class:`ml-0.5 text-red-500`,"aria-hidden":`true`},ot={class:`flex items-center gap-2 border-b border-gray-100 px-3 py-2`},st={class:`text-xs font-medium text-gray-500`},ct=[`aria-label`],lt={class:`p-3`},ut={class:`mt-1 space-y-2`},dt=[`onDragstart`,`onDragover`,`onDrop`],ft={class:`flex items-center gap-2 border-b border-gray-100 px-3 py-2`},pt={class:`text-xs font-medium text-gray-500`},mt=[`aria-label`,`onClick`],ht={class:`p-3`},gt={key:2,class:`mt-1 text-sm text-red-600`,role:`alert`},_t=d({__name:`ParagraphEmbed`,props:{field:{},modelValue:{},error:{},disabled:{type:Boolean},formComponent:{}},emits:[`update:modelValue`],setup(r,{emit:a}){let o=r,s=a,d=v(()=>R(o.field)===`one`),f=v(()=>{let e=o.modelValue;return typeof e==`object`&&e&&!Array.isArray(e)?e:null});function m(){s(`update:modelValue`,{})}function g(){s(`update:modelValue`,null)}function y(e){s(`update:modelValue`,e)}let S=v(()=>Array.isArray(o.modelValue)?o.modelValue:[]),C=t(null),w=t(null);function T(){let e=[...S.value];e.push({order:e.length}),s(`update:modelValue`,e)}function E(e){let t=[...S.value];t.splice(e,1),s(`update:modelValue`,t.map((e,t)=>({...e,order:t})))}function O(e,t){let n=[...S.value];n[e]={...t,order:e},s(`update:modelValue`,n)}function k(e){C.value=e}function A(e){w.value=e}function ee(e){if(C.value===null||C.value===e){C.value=null,w.value=null;return}let t=[...S.value],[n]=t.splice(C.value,1);n!==void 0&&(t.splice(e,0,n),s(`update:modelValue`,t.map((e,t)=>({...e,order:t}))),C.value=null,w.value=null)}function j(){C.value=null,w.value=null}return(t,a)=>(n(),u(`div`,null,[c(`label`,it,[_(x(r.field.label)+` `,1),r.field.required?(n(),u(`span`,at,`*`)):b(``,!0)]),d.value?(n(),u(p,{key:0},[f.value?(n(),u(`div`,{key:0,class:l([`mt-1 rounded-md border border-gray-200 bg-white`,r.disabled&&`opacity-60`])},[c(`div`,ot,[c(`span`,st,x(r.field.label),1),r.disabled?b(``,!0):(n(),u(`button`,{key:0,type:`button`,class:`ml-auto text-xs text-red-500 hover:text-red-700`,"aria-label":`Remove ${r.field.label}`,onClick:g},` Remove `,8,ct))]),c(`div`,lt,[(n(),h(e(r.formComponent),{"model-value":f.value,disabled:r.disabled,"onUpdate:modelValue":a[0]||=e=>y(e)},null,8,[`model-value`,`disabled`]))])],2)):r.disabled?b(``,!0):(n(),u(`button`,{key:1,type:`button`,class:`mt-2 inline-flex items-center gap-1.5 rounded-md border border-dashed border-gray-300 px-3 py-2 text-sm text-gray-600 hover:border-indigo-400 hover:text-indigo-600`,onClick:m},[a[1]||=c(`span`,{"aria-hidden":`true`},`+`,-1),_(` Add `+x(r.field.label),1)]))],64)):(n(),u(p,{key:1},[c(`div`,ut,[(n(!0),u(p,null,i(S.value,(t,i)=>(n(),u(`div`,{key:i,draggable:`true`,class:l([`rounded-md border bg-white transition-colors`,w.value===i&&C.value!==i?`border-indigo-400 ring-2 ring-indigo-200`:`border-gray-200`,r.disabled&&`opacity-60`]),onDragstart:e=>k(i),onDragover:D(e=>A(i),[`prevent`]),onDrop:D(e=>ee(i),[`prevent`]),onDragend:j},[c(`div`,ft,[a[2]||=c(`span`,{class:`cursor-grab select-none text-gray-400`,title:`Drag to reorder`,"aria-hidden":`true`},` ⋮⋮ `,-1),c(`span`,pt,` Item `+x(i+1),1),r.disabled?b(``,!0):(n(),u(`button`,{key:0,type:`button`,class:`ml-auto text-xs text-red-500 hover:text-red-700`,"aria-label":`Remove item ${i+1}`,onClick:e=>E(i)},` Remove `,8,mt))]),c(`div`,ht,[(n(),h(e(r.formComponent),{"model-value":t,disabled:r.disabled,"onUpdate:modelValue":e=>O(i,e)},null,8,[`model-value`,`disabled`,`onUpdate:modelValue`]))])],42,dt))),128))]),r.disabled?b(``,!0):(n(),u(`button`,{key:0,type:`button`,class:`mt-2 inline-flex items-center gap-1.5 rounded-md border border-dashed border-gray-300 px-3 py-2 text-sm text-gray-600 hover:border-indigo-400 hover:text-indigo-600`,onClick:T},[a[3]||=c(`span`,{"aria-hidden":`true`},`+`,-1),_(` Add `+x(r.field.label),1)]))],64)),r.error?(n(),u(`p`,gt,x(r.error),1)):b(``,!0)]))}}),vt={"text/plain":r(F),"text/rich":r(N),integer:r(z),float:r(z),boolean:r(L),date:r(M),image:r(Ve),video:r(Ve),file:r(Ve),enum:r(P),reference:r(rt),paragraph:r(_t),programmatic:r(I)};function yt(e){return vt[e.field_type]??vt[`text/plain`]}function bt(e){return e.ui_component.component===`paragraph-embed`?{formComponent:St(e.ui_component.ref)}:{}}var xt=new Map;function St(e){let t=xt.get(e);if(t)return t;let n=r(d({name:`ParagraphForm_${e}`,props:{modelValue:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`],setup(t,{emit:n}){let r=y(),i=v(()=>r.paragraphTypes[e]);function a(e,r){n(`update:modelValue`,{...t.modelValue,[e]:r})}return()=>i.value?S(`div`,{class:`space-y-3`},i.value.fields.map(e=>S(yt(e),{key:e.name,field:e,modelValue:(t.modelValue??{})[e.name],disabled:t.disabled,...bt(e),"onUpdate:modelValue":t=>a(e.name,t)}))):S(`div`,{class:`text-sm text-gray-400`},`Unknown paragraph type`)}}));return xt.set(e,n),n}var Ct={key:0,class:`flex items-center justify-center py-20`},wt={key:1,class:`py-12 text-center text-sm text-gray-500`},Tt={key:2},Et={class:`mb-[22px] flex flex-wrap items-start justify-between gap-4`},Dt={class:`mb-1.5 text-[11px] font-bold uppercase tracking-[.06em] text-faint`},Ot={class:`text-[25px] font-bold tracking-tight text-ink`},kt={class:`flex shrink-0 flex-wrap items-center gap-[9px]`},At=[`disabled`],jt=[`disabled`],Mt=[`disabled`],Nt=[`disabled`],Pt={key:0,class:`mb-[18px] rounded-2xl border border-card-border bg-white p-5 shadow-[0_1px_2px_rgba(24,24,48,0.04),0_8px_22px_rgba(24,24,48,0.04)]`},Ft={class:`mt-2 flex flex-wrap items-center gap-[10px]`},It=[`disabled`],Lt={key:0,class:`mt-[9px] text-[12.5px] text-[#D9913C]`},Rt={key:1,class:`mt-1 text-sm text-red-600`,role:`alert`},zt=[`data-tab`,`onClick`],Bt={class:`space-y-5`},Vt={key:2,class:`mt-4 text-sm text-red-600`,role:`alert`},Ht=d({__name:`ContentFormView`,setup(r){let s=A(),d=E(),f=ee(),{can:S}=O(),{errors:T,validate:D,mergeServerErrors:k,clearErrors:M,setError:N}=ne(),P=re(),F=y(),I=ie(),L=v(()=>s.params.type),R=v(()=>s.params.id),z=v(()=>F.contentTypes[L.value]),B=v(()=>z.value?.fields??[]),V=v(()=>z.value?.ui.tabs??[]),se=v(()=>z.value?.only_one===!0),H=v(()=>se.value?`singleton`:R.value?`edit`:`create`),U=t(null),W=t({}),G=t(!1),ce=t(``),K=t(!1),q=t(!0),J=t(!1),Y=t(``),X=t(!1),Z=t(!1),Q=t(null),le=t(0),ue=v(()=>V.value[le.value]?.name??``),de=t(null),{left:fe,width:pe}=oe(de,ue),me=v(()=>{if(V.value.length===0)return B.value;let e=V.value[le.value];return e?e.fields.map(e=>B.value.find(t=>t.name===e)).filter(e=>e!==void 0):B.value}),he=v(()=>H.value===`edit`&&G.value&&W.value.slug!==ce.value);function ge(e){let t={};se.value||(t.slug=e?.slug??``);for(let n of B.value)n.field_type!==`programmatic`&&(t[n.name]=e?.[n.name]??te(n));W.value=t,G.value=e?.published===!0,e?.slug&&(ce.value=String(e.slug))}function _e(e,t){W.value[e]=t}async function ve(e){let t=await f.get(`/content/${L.value}/${e}`);t.ok?(U.value=t.data,ge(t.data)):Y.value=t.error.message}C(async()=>{if(!z.value){q.value=!1;return}H.value===`edit`&&R.value||H.value===`singleton`&&R.value?await ve(R.value):ge(),q.value=!1}),m(R,async(e,t)=>{e!==t&&(q.value=!0,K.value=!1,M(),e?await ve(e):(U.value=null,ge()),q.value=!1)});async function $(e){J.value=!0,Y.value=``;let t={...W.value};e!==void 0&&(t.published=e);let n;if(n=H.value===`create`?await f.post(`/content/${L.value}`,t):H.value===`singleton`?await f.put(`/content/${L.value}`,t):await f.patch(`/content/${L.value}/${R.value}`,t),J.value=!1,!n.ok){let e=n.error;e.code===`PUBLISH_VALIDATION_ERROR`&&e.details?k(e.details):e.code===`SLUG_CONFLICT`?N(`slug`,`This slug is already taken.`):Y.value=e.message;return}U.value=n.data,G.value=n.data.published===!0,ce.value=String(n.data.slug??``),K.value=!1,I.invalidate(L.value),P.success(`Saved.`),H.value===`create`&&d.replace({name:`content-edit`,params:{type:L.value,id:String(n.data.id)}})}function ye(){if(D(B.value,W.value)){if(he.value){Q.value=()=>$(),X.value=!0;return}$()}}function be(){if(D(B.value,W.value,!0)){if(he.value){Q.value=()=>$(!0),X.value=!0;return}$(!0)}}function xe(){$(!1)}function Se(){X.value=!1,Q.value&&=(Q.value(),null)}function Ce(){X.value=!1,Q.value=null}async function we(){Z.value=!1,J.value=!0;let e=await f.del(`/content/${L.value}/${R.value}`);if(J.value=!1,!e.ok){Y.value=e.error.message;return}I.invalidate(L.value),d.push({name:`content-list`,params:{type:L.value}})}let Te=v(()=>{if(H.value===`create`)return`New ${z.value?.label??``}`;if(H.value===`singleton`)return z.value?.label??``;let e=B.value.find(e=>e.field_type===`text/plain`);return(e?String(U.value?.[e.name]??``):``)||(z.value?.label??``)});return(t,r)=>q.value?(n(),u(`div`,Ct,[...r[3]||=[c(`span`,{class:`inline-block h-6 w-6 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent`,"aria-hidden":`true`},null,-1)]])):z.value?(n(),u(`div`,Tt,[c(`div`,Et,[c(`div`,null,[c(`p`,Dt,x(z.value.label),1),c(`h1`,Ot,x(Te.value),1)]),c(`div`,kt,[o(S)(`content:delete`)&&H.value===`edit`?(n(),u(`button`,{key:0,type:`button`,disabled:J.value,class:`inline-flex items-center gap-1.5 rounded-[10px] border border-[#F3D2D7] bg-white px-[15px] py-2.5 text-[13px] font-semibold text-[#E1495B] transition-colors hover:bg-[#FDF2F4] disabled:cursor-not-allowed disabled:opacity-50`,onClick:r[0]||=e=>Z.value=!0},` Delete `,8,At)):b(``,!0),o(S)(`content:edit`)?(n(),u(p,{key:1},[G.value?(n(),u(`button`,{key:0,type:`button`,disabled:J.value,class:`rounded-[10px] border border-[#E4E3EE] bg-white px-4 py-2.5 text-[13px] font-semibold text-[#3D3D52] transition-colors hover:bg-surface disabled:cursor-not-allowed disabled:opacity-50`,onClick:xe},` Unpublish `,8,jt)):(n(),u(`button`,{key:1,type:`button`,disabled:J.value,class:`rounded-[10px] border border-[#E4E3EE] bg-white px-4 py-2.5 text-[13px] font-semibold text-[#3D3D52] transition-colors hover:bg-surface disabled:cursor-not-allowed disabled:opacity-50`,onClick:be},` Publish `,8,Mt)),c(`button`,{type:`button`,disabled:J.value,class:`inline-flex items-center gap-1.5 rounded-[10px] bg-indigo-600 px-4 py-2.5 text-[13px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)] disabled:cursor-not-allowed disabled:opacity-50`,onClick:ye},x(J.value?`Saving…`:`Save draft`),9,Nt)],64)):b(``,!0)])]),se.value?b(``,!0):(n(),u(`div`,Pt,[r[4]||=c(`label`,{for:`slug-field`,class:`block text-[13px] font-semibold text-[#3D3D52]`},[_(` Slug `),c(`span`,{class:`ml-0.5 text-red-500`,"aria-hidden":`true`},`*`)],-1),c(`div`,Ft,[a(c(`input`,{id:`slug-field`,"onUpdate:modelValue":r[1]||=e=>W.value.slug=e,type:`text`,disabled:J.value||G.value&&!K.value,class:l([`block min-w-[180px] flex-1 rounded-[10px] border px-[13px] py-[11px] font-mono text-sm focus:outline-none focus:ring-2`,o(T).slug?`border-red-300 focus:border-red-400 focus:ring-red-200`:`border-[#E4E3EE] bg-surface focus:border-indigo-400 focus:ring-indigo-200`,(J.value||G.value&&!K.value)&&`cursor-not-allowed bg-gray-100 opacity-70`]),placeholder:`url-slug`},null,10,It),[[j,W.value.slug]]),G.value&&!K.value?(n(),u(`button`,{key:0,type:`button`,class:`shrink-0 rounded-[10px] border border-[#E4E3EE] bg-white px-4 py-2.5 text-sm font-semibold text-[#3D3D52] transition-colors hover:bg-surface`,onClick:r[2]||=e=>K.value=!0},` Edit slug `)):b(``,!0)]),G.value?(n(),u(`p`,Lt,` Changing this slug will break existing links. `)):b(``,!0),o(T).slug?(n(),u(`p`,Rt,x(o(T).slug),1)):b(``,!0)])),V.value.length>1?(n(),u(`div`,{key:1,ref_key:`tabBarRef`,ref:de,class:`relative mb-[22px] flex gap-0 overflow-x-auto border-b border-card-border`},[(n(!0),u(p,null,i(V.value,(e,t)=>(n(),u(`button`,{key:e.name,"data-tab":e.name,type:`button`,class:l([`mr-6 whitespace-nowrap bg-none px-0.5 py-[11px] text-sm transition-colors`,le.value===t?`font-semibold text-indigo-600`:`font-medium text-faint hover:text-[#8A8A9E]`]),onClick:e=>le.value=t},x(e.label),11,zt))),128)),c(`div`,{class:`absolute -bottom-px h-0.5 rounded-full bg-indigo-600 transition-[left,width] duration-300`,style:g({left:`${o(fe)}px`,width:`${o(pe)}px`})},null,4)],512)):b(``,!0),c(`div`,Bt,[(n(!0),u(p,null,i(me.value,t=>(n(),h(e(o(yt)(t)),w({key:t.name,field:t,"model-value":W.value[t.name],error:o(T)[t.name],disabled:J.value},{ref_for:!0},o(bt)(t),{"onUpdate:modelValue":e=>_e(t.name,e)}),null,16,[`field`,`model-value`,`error`,`disabled`,`onUpdate:modelValue`]))),128))]),Y.value?(n(),u(`p`,Vt,x(Y.value),1)):b(``,!0),X.value?(n(),h(ae,{key:3,message:`This item is published. Changing its slug will break existing links. Continue?`,"on-confirm":Se,"on-cancel":Ce})):b(``,!0),Z.value?(n(),h(ae,{key:4,message:`Are you sure you want to delete this item? This action cannot be undone.`,"on-confirm":we,"on-cancel":()=>Z.value=!1},null,8,[`on-cancel`])):b(``,!0)])):(n(),u(`div`,wt,` Content type not found. `))}});export{Ht as default};
@@ -1 +1 @@
1
- import{B as e,E as t,O as n,P as r,W as i,c as a,ct as o,d as s,g as c,h as l,i as u,j as d,m as ee,s as f,t as te,u as p,ut as m,w as h}from"./schema-B-RKX_ep.js";import{a as g,c as _,n as v,s as ne,t as y,u as b}from"./index-GvXDeXi5.js";import{t as x}from"./content--2XYr_UQ.js";import{t as S}from"./Pagination-BIf7mQy7.js";var re=c({__name:`StatusBadge`,props:{published:{type:Boolean}},setup(e){return(n,r)=>(t(),s(`span`,{class:o([`inline-flex items-center rounded-full px-[11px] py-1 text-xs font-semibold`,e.published?`bg-[#E7F6EC] text-[#1E8E4E]`:`bg-[#FBF1DF] text-[#B5790E]`])},m(e.published?`Published`:`Draft`),3))}}),ie={key:0},ae={key:1},oe={class:`mb-[22px] flex flex-wrap items-center justify-between gap-4`},se={class:`text-[26px] font-bold tracking-tight text-ink`},ce={class:`mb-4 flex h-[38px] items-center gap-2 rounded-[10px] border border-card-border bg-[#FBFBFD] px-[11px] text-[13px] transition-colors focus-within:border-indigo-400`},C=[`placeholder`],w={key:0,class:`space-y-2`},T={key:1,class:`rounded-[16px] border border-dashed border-gray-300 p-12 text-center`},E={class:`text-sm text-muted`},D={key:2,class:`overflow-hidden rounded-[16px] border border-card-border bg-white shadow-[0_1px_2px_rgba(24,24,48,0.04),0_10px_28px_rgba(24,24,48,0.04)]`},O={class:`w-full text-sm`},k={class:`divide-y divide-[#F4F3F9]`},A=[`onClick`],j={class:`px-[22px] py-4 text-[14.5px] font-semibold text-ink`},M={class:`px-[22px] py-4 font-mono text-[12.5px] text-muted`},N={class:`px-[22px] py-4`},P={class:`px-[22px] py-4 text-[13px] text-faint`},F={key:3,class:`mt-4 flex justify-center`},I=c({__name:`ContentListView`,setup(o){let c=ne(),I=_(),L=y(),{can:R}=v(),z=te(),B=x(),V=f(()=>c.params.type),H=f(()=>z.contentTypes[V.value]),U=f(()=>H.value?.only_one===!0),W=f(()=>H.value?.fields.find(e=>e.field_type===`text/plain`)?.name??`id`),G=e([]),K=e(0),q=e(1),J=e(!1),Y=e(``);function le(e){return typeof e!=`string`||!e?`—`:new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}async function X(e){J.value=!0;let t=Y.value.trim();if(t===``){let t=B.getPage(V.value,e,50);if(t){G.value=t,K.value=B.total,J.value=!1;return}}let n=t===``?``:`&search=${encodeURIComponent(t)}`,r=await L.get(`/content/${V.value}?page=${e}&per_page=50${n}`);J.value=!1,r.ok&&(G.value=r.data,K.value=r.meta?.total??r.data.length,t===``&&(B.total=K.value,B.setPage(V.value,e,50,r.data)))}let Z=g(()=>{q.value=1,X(1)},300);async function Q(){let e=await L.get(`/content/${V.value}`),t=e.ok?e.data[0]:void 0;t?I.replace({name:`content-edit`,params:{type:V.value,id:String(t.id)}}):I.replace({name:`content-new`,params:{type:V.value}})}h(async()=>{if(H.value){if(U.value){await Q();return}await X(q.value)}}),d(V,async()=>{if(q.value=1,G.value=[],H.value){if(U.value){await Q();return}await X(1)}});function ue(e){q.value=e,X(e)}function de(e){I.push({name:`content-edit`,params:{type:V.value,id:String(e.id)}})}function $(){I.push({name:`content-new`,params:{type:V.value}})}return(e,o)=>U.value||!H.value?(t(),s(`div`,ie)):(t(),s(`div`,ae,[a(`div`,oe,[a(`h1`,se,m(H.value.label),1),i(R)(`content:create`)?(t(),s(`button`,{key:0,type:`button`,class:`inline-flex items-center gap-[7px] rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)]`,onClick:$},[o[2]||=a(`svg`,{width:`17`,height:`17`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},[a(`path`,{d:`M12 5v14`}),a(`path`,{d:`M5 12h14`})],-1),ee(` New `+m(H.value.label),1)])):p(``,!0)]),a(`div`,ce,[o[3]||=a(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`shrink-0 text-faint`},[a(`path`,{d:`M21 21l-4.3-4.3`}),a(`path`,{d:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z`})],-1),r(a(`input`,{"onUpdate:modelValue":o[0]||=e=>Y.value=e,type:`text`,placeholder:`Search ${H.value.label.toLowerCase()}…`,class:`w-full bg-transparent text-ink outline-none placeholder:text-faint`,onInput:o[1]||=(...e)=>i(Z)&&i(Z)(...e)},null,40,C),[[b,Y.value]])]),J.value?(t(),s(`div`,w,[(t(),s(u,null,n(8,e=>a(`div`,{key:e,class:`h-12 animate-pulse rounded-[10px] bg-gray-100`})),64))])):G.value.length===0?(t(),s(`div`,T,[a(`p`,E,m(Y.value.trim()===``?`No ${H.value.label} items yet.`:`No results for “${Y.value.trim()}”.`),1),i(R)(`content:create`)&&Y.value.trim()===``?(t(),s(`button`,{key:0,type:`button`,class:`mt-3 text-sm font-medium text-indigo-600 hover:text-indigo-800`,onClick:$},` Create the first one → `)):p(``,!0)])):(t(),s(`div`,D,[a(`table`,O,[o[4]||=a(`thead`,{class:`text-[11.5px] font-bold uppercase tracking-[.06em] text-faint`},[a(`tr`,{class:`border-b border-divider`},[a(`th`,{class:`px-[22px] py-3.5 text-left`},`Title`),a(`th`,{class:`px-[22px] py-3.5 text-left`},`Slug`),a(`th`,{class:`px-[22px] py-3.5 text-left`},`Status`),a(`th`,{class:`px-[22px] py-3.5 text-left`},`Updated`)])],-1),a(`tbody`,k,[(t(!0),s(u,null,n(G.value,e=>(t(),s(`tr`,{key:String(e.id),class:`cursor-pointer transition-colors hover:bg-[#FAFAFE]`,onClick:t=>de(e)},[a(`td`,j,m(e[W.value]??`—`),1),a(`td`,M,m(e.slug??`—`),1),a(`td`,N,[l(re,{published:e.published===!0},null,8,[`published`])]),a(`td`,P,m(le(e.updated_at)),1)],8,A))),128))])])])),!J.value&&K.value>i(50)?(t(),s(`div`,F,[l(S,{total:K.value,page:q.value,"per-page":i(50),"onUpdate:page":ue},null,8,[`total`,`page`,`per-page`])])):p(``,!0)]))}});export{I as default};
1
+ import{B as e,E as t,O as n,P as r,W as i,c as a,ct as o,d as s,g as c,h as l,i as u,j as d,m as ee,s as f,t as te,u as p,ut as m,w as h}from"./schema-B-RKX_ep.js";import{a as g,c as _,n as v,s as ne,t as y,u as b}from"./index-DHBhcS6-.js";import{t as x}from"./content--2XYr_UQ.js";import{t as S}from"./Pagination-BIf7mQy7.js";var re=c({__name:`StatusBadge`,props:{published:{type:Boolean}},setup(e){return(n,r)=>(t(),s(`span`,{class:o([`inline-flex items-center rounded-full px-[11px] py-1 text-xs font-semibold`,e.published?`bg-[#E7F6EC] text-[#1E8E4E]`:`bg-[#FBF1DF] text-[#B5790E]`])},m(e.published?`Published`:`Draft`),3))}}),ie={key:0},ae={key:1},oe={class:`mb-[22px] flex flex-wrap items-center justify-between gap-4`},se={class:`text-[26px] font-bold tracking-tight text-ink`},ce={class:`mb-4 flex h-[38px] items-center gap-2 rounded-[10px] border border-card-border bg-[#FBFBFD] px-[11px] text-[13px] transition-colors focus-within:border-indigo-400`},C=[`placeholder`],w={key:0,class:`space-y-2`},T={key:1,class:`rounded-[16px] border border-dashed border-gray-300 p-12 text-center`},E={class:`text-sm text-muted`},D={key:2,class:`overflow-hidden rounded-[16px] border border-card-border bg-white shadow-[0_1px_2px_rgba(24,24,48,0.04),0_10px_28px_rgba(24,24,48,0.04)]`},O={class:`w-full text-sm`},k={class:`divide-y divide-[#F4F3F9]`},A=[`onClick`],j={class:`px-[22px] py-4 text-[14.5px] font-semibold text-ink`},M={class:`px-[22px] py-4 font-mono text-[12.5px] text-muted`},N={class:`px-[22px] py-4`},P={class:`px-[22px] py-4 text-[13px] text-faint`},F={key:3,class:`mt-4 flex justify-center`},I=c({__name:`ContentListView`,setup(o){let c=ne(),I=_(),L=y(),{can:R}=v(),z=te(),B=x(),V=f(()=>c.params.type),H=f(()=>z.contentTypes[V.value]),U=f(()=>H.value?.only_one===!0),W=f(()=>H.value?.fields.find(e=>e.field_type===`text/plain`)?.name??`id`),G=e([]),K=e(0),q=e(1),J=e(!1),Y=e(``);function le(e){return typeof e!=`string`||!e?`—`:new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}async function X(e){J.value=!0;let t=Y.value.trim();if(t===``){let t=B.getPage(V.value,e,50);if(t){G.value=t,K.value=B.total,J.value=!1;return}}let n=t===``?``:`&search=${encodeURIComponent(t)}`,r=await L.get(`/content/${V.value}?page=${e}&per_page=50${n}`);J.value=!1,r.ok&&(G.value=r.data,K.value=r.meta?.total??r.data.length,t===``&&(B.total=K.value,B.setPage(V.value,e,50,r.data)))}let Z=g(()=>{q.value=1,X(1)},300);async function Q(){let e=await L.get(`/content/${V.value}`),t=e.ok?e.data[0]:void 0;t?I.replace({name:`content-edit`,params:{type:V.value,id:String(t.id)}}):I.replace({name:`content-new`,params:{type:V.value}})}h(async()=>{if(H.value){if(U.value){await Q();return}await X(q.value)}}),d(V,async()=>{if(q.value=1,G.value=[],H.value){if(U.value){await Q();return}await X(1)}});function ue(e){q.value=e,X(e)}function de(e){I.push({name:`content-edit`,params:{type:V.value,id:String(e.id)}})}function $(){I.push({name:`content-new`,params:{type:V.value}})}return(e,o)=>U.value||!H.value?(t(),s(`div`,ie)):(t(),s(`div`,ae,[a(`div`,oe,[a(`h1`,se,m(H.value.label),1),i(R)(`content:create`)?(t(),s(`button`,{key:0,type:`button`,class:`inline-flex items-center gap-[7px] rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)]`,onClick:$},[o[2]||=a(`svg`,{width:`17`,height:`17`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},[a(`path`,{d:`M12 5v14`}),a(`path`,{d:`M5 12h14`})],-1),ee(` New `+m(H.value.label),1)])):p(``,!0)]),a(`div`,ce,[o[3]||=a(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`shrink-0 text-faint`},[a(`path`,{d:`M21 21l-4.3-4.3`}),a(`path`,{d:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z`})],-1),r(a(`input`,{"onUpdate:modelValue":o[0]||=e=>Y.value=e,type:`text`,placeholder:`Search ${H.value.label.toLowerCase()}…`,class:`w-full bg-transparent text-ink outline-none placeholder:text-faint`,onInput:o[1]||=(...e)=>i(Z)&&i(Z)(...e)},null,40,C),[[b,Y.value]])]),J.value?(t(),s(`div`,w,[(t(),s(u,null,n(8,e=>a(`div`,{key:e,class:`h-12 animate-pulse rounded-[10px] bg-gray-100`})),64))])):G.value.length===0?(t(),s(`div`,T,[a(`p`,E,m(Y.value.trim()===``?`No ${H.value.label} items yet.`:`No results for “${Y.value.trim()}”.`),1),i(R)(`content:create`)&&Y.value.trim()===``?(t(),s(`button`,{key:0,type:`button`,class:`mt-3 text-sm font-medium text-indigo-600 hover:text-indigo-800`,onClick:$},` Create the first one → `)):p(``,!0)])):(t(),s(`div`,D,[a(`table`,O,[o[4]||=a(`thead`,{class:`text-[11.5px] font-bold uppercase tracking-[.06em] text-faint`},[a(`tr`,{class:`border-b border-divider`},[a(`th`,{class:`px-[22px] py-3.5 text-left`},`Title`),a(`th`,{class:`px-[22px] py-3.5 text-left`},`Slug`),a(`th`,{class:`px-[22px] py-3.5 text-left`},`Status`),a(`th`,{class:`px-[22px] py-3.5 text-left`},`Updated`)])],-1),a(`tbody`,k,[(t(!0),s(u,null,n(G.value,e=>(t(),s(`tr`,{key:String(e.id),class:`cursor-pointer transition-colors hover:bg-[#FAFAFE]`,onClick:t=>de(e)},[a(`td`,j,m(e[W.value]??`—`),1),a(`td`,M,m(e.slug??`—`),1),a(`td`,N,[l(re,{published:e.published===!0},null,8,[`published`])]),a(`td`,P,m(le(e.updated_at)),1)],8,A))),128))])])])),!J.value&&K.value>i(50)?(t(),s(`div`,F,[l(S,{total:K.value,page:q.value,"per-page":i(50),"onUpdate:page":ue},null,8,[`total`,`page`,`per-page`])])):p(``,!0)]))}});export{I as default};
@@ -1 +1 @@
1
- import{B as e,E as t,O as n,P as r,c as i,d as a,g as o,i as s,s as c,t as l,u,ut as d,w as f}from"./schema-B-RKX_ep.js";import{d as p,l as m,s as h,t as g,u as _}from"./index-GvXDeXi5.js";import{t as v}from"./useNotification-DXsAIQaa.js";var y={class:`max-w-lg`},b={class:`mb-6`},x={class:`text-[26px] font-bold tracking-tight text-ink`},S={key:0,class:`space-y-2`},C=[`disabled`],w=[`value`],T=[`disabled`],E={key:0,class:`text-sm text-red-600`,role:`alert`},D=[`disabled`],O=o({__name:`ContentSettingsView`,setup(o){let O=h(),k=g(),A=v(),j=l(),M=c(()=>O.params.type),N=c(()=>j.contentTypes[M.value]),P=e([]),F=e(``),I=e(!0),L=e(!1),R=e(``);f(async()=>{F.value=N.value?.default_base_path??``;let e=await k.get(`/routes`);I.value=!1,e.ok?(P.value=e.data,F.value&&!P.value.includes(F.value)&&(P.value=[F.value,...P.value])):P.value=[]});async function z(){if(!F.value.trim())return;L.value=!0,R.value=``;let e=await k.patch(`/content/${M.value}/settings`,{base_path:F.value.trim()});if(L.value=!1,!e.ok){R.value=e.error.message;return}A.success(`Settings saved.`)}return(e,o)=>(t(),a(`div`,y,[i(`div`,b,[i(`h1`,x,d(N.value?.label??M.value)+` — Settings `,1),o[2]||=i(`p`,{class:`mt-1 text-sm text-gray-500`},` Change the base path for this content type. This does not modify schema files. `,-1)]),I.value?(t(),a(`div`,S,[...o[3]||=[i(`div`,{class:`h-8 w-48 animate-pulse rounded bg-gray-100`},null,-1),i(`div`,{class:`h-10 animate-pulse rounded bg-gray-100`},null,-1)]])):(t(),a(`form`,{key:1,class:`space-y-4`,onSubmit:p(z,[`prevent`])},[i(`div`,null,[o[4]||=i(`label`,{for:`base-path`,class:`block text-[13px] font-semibold text-[#3D3D52]`},` Base path `,-1),P.value.length>0?r((t(),a(`select`,{key:0,id:`base-path`,"onUpdate:modelValue":o[0]||=e=>F.value=e,disabled:L.value,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},[(t(!0),a(s,null,n(P.value,e=>(t(),a(`option`,{key:e,value:e},d(e),9,w))),128))],8,C)),[[m,F.value]]):r((t(),a(`input`,{key:1,id:`base-path`,"onUpdate:modelValue":o[1]||=e=>F.value=e,type:`text`,disabled:L.value,placeholder:`/my-route`,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 font-mono text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},null,8,T)),[[_,F.value]])]),R.value?(t(),a(`p`,E,d(R.value),1)):u(``,!0),i(`button`,{type:`submit`,disabled:L.value||!F.value.trim(),class:`rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)] disabled:cursor-not-allowed disabled:opacity-50`},d(L.value?`Saving…`:`Save`),9,D)],32))]))}});export{O as default};
1
+ import{B as e,E as t,O as n,P as r,c as i,d as a,g as o,i as s,s as c,t as l,u,ut as d,w as f}from"./schema-B-RKX_ep.js";import{d as p,l as m,s as h,t as g,u as _}from"./index-DHBhcS6-.js";import{t as v}from"./useNotification-B8AtuEWL.js";var y={class:`max-w-lg`},b={class:`mb-6`},x={class:`text-[26px] font-bold tracking-tight text-ink`},S={key:0,class:`space-y-2`},C=[`disabled`],w=[`value`],T=[`disabled`],E={key:0,class:`text-sm text-red-600`,role:`alert`},D=[`disabled`],O=o({__name:`ContentSettingsView`,setup(o){let O=h(),k=g(),A=v(),j=l(),M=c(()=>O.params.type),N=c(()=>j.contentTypes[M.value]),P=e([]),F=e(``),I=e(!0),L=e(!1),R=e(``);f(async()=>{F.value=N.value?.default_base_path??``;let e=await k.get(`/routes`);I.value=!1,e.ok?(P.value=e.data,F.value&&!P.value.includes(F.value)&&(P.value=[F.value,...P.value])):P.value=[]});async function z(){if(!F.value.trim())return;L.value=!0,R.value=``;let e=await k.patch(`/content/${M.value}/settings`,{base_path:F.value.trim()});if(L.value=!1,!e.ok){R.value=e.error.message;return}A.success(`Settings saved.`)}return(e,o)=>(t(),a(`div`,y,[i(`div`,b,[i(`h1`,x,d(N.value?.label??M.value)+` — Settings `,1),o[2]||=i(`p`,{class:`mt-1 text-sm text-gray-500`},` Change the base path for this content type. This does not modify schema files. `,-1)]),I.value?(t(),a(`div`,S,[...o[3]||=[i(`div`,{class:`h-8 w-48 animate-pulse rounded bg-gray-100`},null,-1),i(`div`,{class:`h-10 animate-pulse rounded bg-gray-100`},null,-1)]])):(t(),a(`form`,{key:1,class:`space-y-4`,onSubmit:p(z,[`prevent`])},[i(`div`,null,[o[4]||=i(`label`,{for:`base-path`,class:`block text-[13px] font-semibold text-[#3D3D52]`},` Base path `,-1),P.value.length>0?r((t(),a(`select`,{key:0,id:`base-path`,"onUpdate:modelValue":o[0]||=e=>F.value=e,disabled:L.value,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},[(t(!0),a(s,null,n(P.value,e=>(t(),a(`option`,{key:e,value:e},d(e),9,w))),128))],8,C)),[[m,F.value]]):r((t(),a(`input`,{key:1,id:`base-path`,"onUpdate:modelValue":o[1]||=e=>F.value=e,type:`text`,disabled:L.value,placeholder:`/my-route`,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 font-mono text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},null,8,T)),[[_,F.value]])]),R.value?(t(),a(`p`,E,d(R.value),1)):u(``,!0),i(`button`,{type:`submit`,disabled:L.value||!F.value.trim(),class:`rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)] disabled:cursor-not-allowed disabled:opacity-50`},d(L.value?`Saving…`:`Save`),9,D)],32))]))}});export{O as default};
@@ -1 +1 @@
1
- import{B as e,E as t,P as n,T as r,W as i,c as a,d as o,g as s,p as c,s as l,u,ut as d}from"./schema-B-RKX_ep.js";import{c as f,d as p,o as m,r as h,s as g,u as _}from"./index-GvXDeXi5.js";var v={class:`flex min-h-screen bg-surface`},y={class:`hidden lg:flex lg:w-80 lg:shrink-0 lg:flex-col lg:items-start lg:justify-between bg-gradient-to-br from-[#1C1C30] to-[#121220] px-10 py-12 text-white`},b={class:`mt-8 text-[28px] font-bold leading-tight tracking-tight`},x={class:`flex flex-1 flex-col items-center justify-center px-6 py-12`},S={class:`mb-8 flex flex-col items-center lg:hidden`},C={class:`mt-4 text-lg font-bold text-ink`},w={class:`w-full max-w-sm rounded-[20px] border border-card-border bg-white px-8 py-10 shadow-[0_10px_40px_rgba(24,24,48,0.1)]`},T=[`disabled`],E=[`disabled`],D={key:0,class:`rounded-[10px] bg-red-50 px-3 py-2 text-sm text-red-600`,role:`alert`},O=[`disabled`],k=s({__name:`LoginView`,setup(s){let k=f(),A=g(),j=m(),M=h(),N=e(``),P=e(``),F=e(!1),I=e(``),L=e(0),R=null,z=l(()=>F.value||L.value>0);function B(){I.value=`Too many attempts. Try again in ${Math.ceil(L.value/60)} minutes.`}function V(e){L.value=e,B(),R&&clearInterval(R),R=setInterval(()=>{--L.value,L.value<=0?(clearInterval(R),R=null,L.value=0,I.value=``):B()},1e3)}r(()=>{R&&clearInterval(R)});async function H(){if(z.value)return;F.value=!0,I.value=``;let e;try{e=await fetch(`/admin/api/auth/login`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:N.value,password:P.value})})}catch{I.value=`Something went wrong. Please try again.`,F.value=!1;return}let t=await e.json();if(!t.ok){let n=t.error?.code??``;if(n===`INVALID_CREDENTIALS`)I.value=`Invalid email or password.`;else if(n===`RATE_LIMITED`){let t=parseInt(e.headers.get(`Retry-After`)??`60`,10);V(isNaN(t)?60:t)}else I.value=`Something went wrong. Please try again.`;F.value=!1;return}let n=t.data;if(j.setUser({id:n.id,email:n.email,role:n.role,mustChangePassword:n.must_change_password}),n.must_change_password)k.push(`/admin/change-password`);else{let e=A.query.redirect;k.push(typeof e==`string`?e:`/admin/media`)}}return(e,r)=>(t(),o(`div`,v,[a(`div`,y,[a(`div`,null,[r[2]||=c(`<div class="flex h-[42px] w-[42px] items-center justify-center rounded-[13px] bg-gradient-to-br from-[#6D5EF0] to-indigo-600 shadow-[0_6px_18px_rgba(91,87,232,0.5)]"><svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.1" stroke-linecap="round" aria-hidden="true"><path d="M4 7h16"></path><path d="M4 12h10"></path><path d="M4 17h13"></path></svg></div>`,1),a(`h1`,b,d(i(M).cmsName),1),r[3]||=a(`p`,{class:`mt-3.5 max-w-[300px] text-[15px] leading-relaxed text-white/60`},` Schema-driven headless CMS — manage your content with confidence. `,-1)]),r[4]||=a(`p`,{class:`text-xs text-white/40`},`Self-hosted & open source`,-1)]),a(`div`,x,[a(`div`,S,[r[5]||=a(`div`,{class:`flex h-10 w-10 items-center justify-center rounded-[11px] bg-gradient-to-br from-[#6D5EF0] to-indigo-600 shadow-[0_4px_12px_rgba(91,87,232,0.36)]`},[a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,class:`h-5 w-5 text-white`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"stroke-width":`2`,"aria-hidden":`true`},[a(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,d:`M4 6h16M4 10h16M4 14h10M4 18h6`})])],-1),a(`h1`,C,d(i(M).cmsName),1)]),a(`div`,w,[r[8]||=a(`h2`,{class:`mb-1 text-[21px] font-bold tracking-tight text-ink`},`Sign in`,-1),r[9]||=a(`p`,{class:`mb-6 text-sm text-muted`},`Enter your credentials to continue.`,-1),a(`form`,{class:`space-y-[18px]`,novalidate:``,onSubmit:p(H,[`prevent`])},[a(`div`,null,[r[6]||=a(`label`,{for:`email`,class:`block text-[13px] font-semibold text-[#3D3D52]`},`Email`,-1),n(a(`input`,{id:`email`,"onUpdate:modelValue":r[0]||=e=>N.value=e,type:`email`,required:``,autocomplete:`email`,disabled:F.value,class:`mt-[7px] block w-full rounded-[11px] border border-[#E4E3EE] bg-[#FBFBFD] px-3.5 py-3 text-sm text-ink placeholder-faint transition-colors focus:border-indigo-400 focus:bg-white focus:outline-none focus:ring-[3px] focus:ring-indigo-50 disabled:cursor-not-allowed disabled:opacity-60`},null,8,T),[[_,N.value]])]),a(`div`,null,[r[7]||=a(`label`,{for:`password`,class:`block text-[13px] font-semibold text-[#3D3D52]`},`Password`,-1),n(a(`input`,{id:`password`,"onUpdate:modelValue":r[1]||=e=>P.value=e,type:`password`,required:``,autocomplete:`current-password`,disabled:F.value,class:`mt-[7px] block w-full rounded-[11px] border border-[#E4E3EE] bg-[#FBFBFD] px-3.5 py-3 text-sm text-ink placeholder-faint transition-colors focus:border-indigo-400 focus:bg-white focus:outline-none focus:ring-[3px] focus:ring-indigo-50 disabled:cursor-not-allowed disabled:opacity-60`},null,8,E),[[_,P.value]])]),I.value?(t(),o(`p`,D,d(I.value),1)):u(``,!0),a(`button`,{type:`submit`,disabled:z.value,class:`w-full rounded-[11px] bg-indigo-600 px-4 py-[13px] text-sm font-semibold text-white shadow-[0_4px_14px_rgba(91,87,232,0.34)] transition-colors hover:bg-indigo-700 hover:shadow-[0_8px_22px_rgba(91,87,232,0.44)] focus:outline-none focus:ring-2 focus:ring-indigo-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`},d(F.value?`Signing in…`:`Sign in`),9,O)],32)])])]))}});export{k as default};
1
+ import{B as e,E as t,P as n,T as r,W as i,c as a,d as o,g as s,p as c,s as l,u,ut as d}from"./schema-B-RKX_ep.js";import{c as f,d as p,o as m,r as h,s as g,u as _}from"./index-DHBhcS6-.js";var v={class:`flex min-h-screen bg-surface`},y={class:`hidden lg:flex lg:w-80 lg:shrink-0 lg:flex-col lg:items-start lg:justify-between bg-gradient-to-br from-[#1C1C30] to-[#121220] px-10 py-12 text-white`},b={class:`mt-8 text-[28px] font-bold leading-tight tracking-tight`},x={class:`flex flex-1 flex-col items-center justify-center px-6 py-12`},S={class:`mb-8 flex flex-col items-center lg:hidden`},C={class:`mt-4 text-lg font-bold text-ink`},w={class:`w-full max-w-sm rounded-[20px] border border-card-border bg-white px-8 py-10 shadow-[0_10px_40px_rgba(24,24,48,0.1)]`},T=[`disabled`],E=[`disabled`],D={key:0,class:`rounded-[10px] bg-red-50 px-3 py-2 text-sm text-red-600`,role:`alert`},O=[`disabled`],k=s({__name:`LoginView`,setup(s){let k=f(),A=g(),j=m(),M=h(),N=e(``),P=e(``),F=e(!1),I=e(``),L=e(0),R=null,z=l(()=>F.value||L.value>0);function B(){I.value=`Too many attempts. Try again in ${Math.ceil(L.value/60)} minutes.`}function V(e){L.value=e,B(),R&&clearInterval(R),R=setInterval(()=>{--L.value,L.value<=0?(clearInterval(R),R=null,L.value=0,I.value=``):B()},1e3)}r(()=>{R&&clearInterval(R)});async function H(){if(z.value)return;F.value=!0,I.value=``;let e;try{e=await fetch(`/admin/api/auth/login`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:N.value,password:P.value})})}catch{I.value=`Something went wrong. Please try again.`,F.value=!1;return}let t=await e.json();if(!t.ok){let n=t.error?.code??``;if(n===`INVALID_CREDENTIALS`)I.value=`Invalid email or password.`;else if(n===`RATE_LIMITED`){let t=parseInt(e.headers.get(`Retry-After`)??`60`,10);V(isNaN(t)?60:t)}else I.value=`Something went wrong. Please try again.`;F.value=!1;return}let n=t.data;if(j.setUser({id:n.id,email:n.email,role:n.role,mustChangePassword:n.must_change_password}),n.must_change_password)k.push(`/admin/change-password`);else{let e=A.query.redirect;k.push(typeof e==`string`?e:`/admin/media`)}}return(e,r)=>(t(),o(`div`,v,[a(`div`,y,[a(`div`,null,[r[2]||=c(`<div class="flex h-[42px] w-[42px] items-center justify-center rounded-[13px] bg-gradient-to-br from-[#6D5EF0] to-indigo-600 shadow-[0_6px_18px_rgba(91,87,232,0.5)]"><svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.1" stroke-linecap="round" aria-hidden="true"><path d="M4 7h16"></path><path d="M4 12h10"></path><path d="M4 17h13"></path></svg></div>`,1),a(`h1`,b,d(i(M).cmsName),1),r[3]||=a(`p`,{class:`mt-3.5 max-w-[300px] text-[15px] leading-relaxed text-white/60`},` Schema-driven headless CMS — manage your content with confidence. `,-1)]),r[4]||=a(`p`,{class:`text-xs text-white/40`},`Self-hosted & open source`,-1)]),a(`div`,x,[a(`div`,S,[r[5]||=a(`div`,{class:`flex h-10 w-10 items-center justify-center rounded-[11px] bg-gradient-to-br from-[#6D5EF0] to-indigo-600 shadow-[0_4px_12px_rgba(91,87,232,0.36)]`},[a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,class:`h-5 w-5 text-white`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"stroke-width":`2`,"aria-hidden":`true`},[a(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,d:`M4 6h16M4 10h16M4 14h10M4 18h6`})])],-1),a(`h1`,C,d(i(M).cmsName),1)]),a(`div`,w,[r[8]||=a(`h2`,{class:`mb-1 text-[21px] font-bold tracking-tight text-ink`},`Sign in`,-1),r[9]||=a(`p`,{class:`mb-6 text-sm text-muted`},`Enter your credentials to continue.`,-1),a(`form`,{class:`space-y-[18px]`,novalidate:``,onSubmit:p(H,[`prevent`])},[a(`div`,null,[r[6]||=a(`label`,{for:`email`,class:`block text-[13px] font-semibold text-[#3D3D52]`},`Email`,-1),n(a(`input`,{id:`email`,"onUpdate:modelValue":r[0]||=e=>N.value=e,type:`email`,required:``,autocomplete:`email`,disabled:F.value,class:`mt-[7px] block w-full rounded-[11px] border border-[#E4E3EE] bg-[#FBFBFD] px-3.5 py-3 text-sm text-ink placeholder-faint transition-colors focus:border-indigo-400 focus:bg-white focus:outline-none focus:ring-[3px] focus:ring-indigo-50 disabled:cursor-not-allowed disabled:opacity-60`},null,8,T),[[_,N.value]])]),a(`div`,null,[r[7]||=a(`label`,{for:`password`,class:`block text-[13px] font-semibold text-[#3D3D52]`},`Password`,-1),n(a(`input`,{id:`password`,"onUpdate:modelValue":r[1]||=e=>P.value=e,type:`password`,required:``,autocomplete:`current-password`,disabled:F.value,class:`mt-[7px] block w-full rounded-[11px] border border-[#E4E3EE] bg-[#FBFBFD] px-3.5 py-3 text-sm text-ink placeholder-faint transition-colors focus:border-indigo-400 focus:bg-white focus:outline-none focus:ring-[3px] focus:ring-indigo-50 disabled:cursor-not-allowed disabled:opacity-60`},null,8,E),[[_,P.value]])]),I.value?(t(),o(`p`,D,d(I.value),1)):u(``,!0),a(`button`,{type:`submit`,disabled:z.value,class:`w-full rounded-[11px] bg-indigo-600 px-4 py-[13px] text-sm font-semibold text-white shadow-[0_4px_14px_rgba(91,87,232,0.34)] transition-colors hover:bg-indigo-700 hover:shadow-[0_8px_22px_rgba(91,87,232,0.44)] focus:outline-none focus:ring-2 focus:ring-indigo-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`},d(F.value?`Signing in…`:`Sign in`),9,O)],32)])])]))}});export{k as default};
@@ -1 +1 @@
1
- import{B as e,E as t,P as n,W as r,c as i,d as a,g as o,l as s,m as c,s as l,u,ut as d,w as f}from"./schema-B-RKX_ep.js";import{c as p,n as m,s as h,t as ee,u as te}from"./index-GvXDeXi5.js";import{t as ne}from"./useNotification-DXsAIQaa.js";import{t as re}from"./ConfirmDialog-B7nxdDge.js";import{t as ie}from"./media-DvQfZD4o.js";var ae={key:0,class:`flex items-center justify-center py-20`},oe={key:1,class:`py-12 text-center text-sm text-gray-500`},se={key:2,class:`mx-auto max-w-2xl space-y-6`},g={class:`overflow-hidden rounded-2xl border border-card-border shadow-[0_1px_2px_rgba(24,24,48,0.04),0_8px_22px_rgba(24,24,48,0.04)] bg-white`},_=[`src`,`alt`],v=[`src`],y={key:2,class:`flex h-48 flex-col items-center justify-center gap-3`},b=[`href`],x={class:`rounded-2xl border border-card-border shadow-[0_1px_2px_rgba(24,24,48,0.04),0_8px_22px_rgba(24,24,48,0.04)] bg-white p-5`},S={class:`grid grid-cols-2 gap-x-6 gap-y-3 text-sm`},C={class:`mt-0.5 font-medium text-gray-800`},w={class:`mt-0.5 font-medium text-gray-800`},T={key:0},E={class:`mt-0.5 font-medium text-gray-800`},D={key:1},O={class:`mt-0.5 font-medium text-gray-800`},k={class:`mt-0.5 font-medium text-gray-800`},A={class:`mt-0.5 font-medium text-gray-800`},j={class:`rounded-2xl border border-card-border shadow-[0_1px_2px_rgba(24,24,48,0.04),0_8px_22px_rgba(24,24,48,0.04)] bg-white p-5`},M=[`disabled`],N={class:`mt-3 flex justify-end`},P=[`disabled`],F={key:0,class:`rounded-lg border border-red-200 bg-white p-5`},ce=[`title`],I=[`disabled`],L={key:0,class:`mt-2 text-xs text-gray-400`},R=o({__name:`MediaDetailView`,setup(o){let R=h(),z=p(),B=ee(),{can:V}=m(),H=ne(),U=ie(),W=l(()=>R.params.id),G=e(null),K=e(!0),q=e(``),J=e(!1),Y=e(!1),X=e(!1),le=l(()=>G.value?.mime_type===`application/pdf`);function ue(e){return e>=1e6?`${(e/1e6).toFixed(1)} MB`:e>=1e3?`${Math.round(e/1e3)} KB`:`${e} B`}function de(e){return e?new Date(String(e)).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):`—`}f(async()=>{let e=U.items.get(W.value);if(e){G.value=e,q.value=e.alt??``,K.value=!1;return}let t=await B.get(`/media/${W.value}`);K.value=!1,t.ok&&(G.value=t.data,q.value=t.data.alt??``,U.setItem(t.data))});async function Z(){if(!G.value)return;J.value=!0;let e=await B.patch(`/media/${G.value.id}`,{alt:q.value.trim()});J.value=!1,e.ok?(G.value=e.data,U.setItem(e.data),H.success(`Alt text saved.`)):H.error(e.error.message)}async function fe(){if(!G.value)return;X.value=!1,Y.value=!0;let e=await B.del(`/media/${G.value.id}`);if(Y.value=!1,!e.ok){H.error(e.error.message);return}U.removeItem(G.value.id),z.push({name:`media-library`})}let Q=l(()=>G.value!==null&&G.value.reference_count===0),$=l(()=>Q.value?void 0:`This file is referenced by ${G.value?.reference_count??0} item${(G.value?.reference_count??0)===1?``:`s`} and cannot be deleted.`);return(e,o)=>K.value?(t(),a(`div`,ae,[...o[3]||=[i(`span`,{class:`inline-block h-6 w-6 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent`,"aria-hidden":`true`},null,-1)]])):G.value?(t(),a(`div`,se,[i(`button`,{type:`button`,class:`text-sm text-indigo-600 hover:text-indigo-800`,onClick:o[0]||=e=>r(z).back()},` ← Back to library `),i(`div`,g,[G.value.type===`image`?(t(),a(`img`,{key:0,src:G.value.url,alt:G.value.alt??``,class:`max-h-96 w-full object-contain`},null,8,_)):G.value.type===`video`?(t(),a(`video`,{key:1,src:G.value.url,controls:``,preload:`metadata`,class:`max-h-96 w-full bg-black object-contain`},` Your browser cannot play this video. `,8,v)):(t(),a(`div`,y,[o[5]||=i(`div`,{class:`text-6xl text-gray-300`,"aria-hidden":`true`},`📄`,-1),i(`a`,{href:G.value.url,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center gap-1.5 rounded-md border border-indigo-200 bg-indigo-50 px-3 py-1.5 text-sm font-medium text-indigo-700 hover:border-indigo-300 hover:bg-indigo-100`},[c(d(le.value?`Open PDF in new tab`:`Open file in new tab`)+` `,1),o[4]||=i(`span`,{"aria-hidden":`true`},`↗`,-1)],8,b)]))]),i(`div`,x,[o[12]||=i(`h2`,{class:`mb-4 text-sm font-semibold uppercase tracking-wide text-gray-500`},`Metadata`,-1),i(`dl`,S,[i(`div`,null,[o[6]||=i(`dt`,{class:`text-gray-500`},`Type`,-1),i(`dd`,C,d(G.value.mime_type),1)]),i(`div`,null,[o[7]||=i(`dt`,{class:`text-gray-500`},`Size`,-1),i(`dd`,w,d(ue(G.value.file_size)),1)]),G.value.width&&G.value.height?(t(),a(`div`,T,[o[8]||=i(`dt`,{class:`text-gray-500`},`Dimensions`,-1),i(`dd`,E,d(G.value.width)+` × `+d(G.value.height)+`px`,1)])):u(``,!0),G.value.duration?(t(),a(`div`,D,[o[9]||=i(`dt`,{class:`text-gray-500`},`Duration`,-1),i(`dd`,O,d(G.value.duration)+`s`,1)])):u(``,!0),i(`div`,null,[o[10]||=i(`dt`,{class:`text-gray-500`},`Uploaded`,-1),i(`dd`,k,d(de(G.value.created_at)),1)]),i(`div`,null,[o[11]||=i(`dt`,{class:`text-gray-500`},`References`,-1),i(`dd`,A,d(G.value.reference_count)+` content item`+d(G.value.reference_count===1?``:`s`),1)])])]),i(`div`,j,[o[13]||=i(`h2`,{class:`mb-3 text-sm font-semibold uppercase tracking-wide text-gray-500`},`Alt text`,-1),n(i(`textarea`,{"onUpdate:modelValue":o[1]||=e=>q.value=e,rows:`3`,disabled:J.value,placeholder:`Describe this file for screen readers and SEO`,class:`block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},null,8,M),[[te,q.value]]),i(`div`,N,[i(`button`,{type:`button`,disabled:J.value,class:`rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)] disabled:cursor-not-allowed disabled:opacity-50`,onClick:Z},d(J.value?`Saving…`:`Save alt text`),9,P)])]),r(V)(`media:delete`)?(t(),a(`div`,F,[o[14]||=i(`h2`,{class:`mb-1 text-sm font-semibold uppercase tracking-wide text-red-500`},`Danger zone`,-1),o[15]||=i(`p`,{class:`mb-3 text-sm text-gray-500`},` Permanently deletes this file from storage. This cannot be undone. `,-1),i(`span`,{title:$.value},[i(`button`,{type:`button`,disabled:!Q.value||Y.value,class:`rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 disabled:cursor-not-allowed disabled:opacity-50`,onClick:o[2]||=e=>X.value=!0},d(Y.value?`Deleting…`:`Delete file`),9,I)],8,ce),Q.value?u(``,!0):(t(),a(`p`,L,d($.value),1))])):u(``,!0),X.value?(t(),s(re,{key:1,message:`Permanently delete this file? This action cannot be undone.`,"on-confirm":fe,"on-cancel":()=>X.value=!1},null,8,[`on-cancel`])):u(``,!0)])):(t(),a(`div`,oe,` Media item not found. `))}});export{R as default};
1
+ import{B as e,E as t,P as n,W as r,c as i,d as a,g as o,l as s,m as c,s as l,u,ut as d,w as f}from"./schema-B-RKX_ep.js";import{c as p,n as m,s as h,t as ee,u as te}from"./index-DHBhcS6-.js";import{t as ne}from"./useNotification-B8AtuEWL.js";import{t as re}from"./ConfirmDialog-B7nxdDge.js";import{t as ie}from"./media-DvQfZD4o.js";var ae={key:0,class:`flex items-center justify-center py-20`},oe={key:1,class:`py-12 text-center text-sm text-gray-500`},se={key:2,class:`mx-auto max-w-2xl space-y-6`},g={class:`overflow-hidden rounded-2xl border border-card-border shadow-[0_1px_2px_rgba(24,24,48,0.04),0_8px_22px_rgba(24,24,48,0.04)] bg-white`},_=[`src`,`alt`],v=[`src`],y={key:2,class:`flex h-48 flex-col items-center justify-center gap-3`},b=[`href`],x={class:`rounded-2xl border border-card-border shadow-[0_1px_2px_rgba(24,24,48,0.04),0_8px_22px_rgba(24,24,48,0.04)] bg-white p-5`},S={class:`grid grid-cols-2 gap-x-6 gap-y-3 text-sm`},C={class:`mt-0.5 font-medium text-gray-800`},w={class:`mt-0.5 font-medium text-gray-800`},T={key:0},E={class:`mt-0.5 font-medium text-gray-800`},D={key:1},O={class:`mt-0.5 font-medium text-gray-800`},k={class:`mt-0.5 font-medium text-gray-800`},A={class:`mt-0.5 font-medium text-gray-800`},j={class:`rounded-2xl border border-card-border shadow-[0_1px_2px_rgba(24,24,48,0.04),0_8px_22px_rgba(24,24,48,0.04)] bg-white p-5`},M=[`disabled`],N={class:`mt-3 flex justify-end`},P=[`disabled`],F={key:0,class:`rounded-lg border border-red-200 bg-white p-5`},ce=[`title`],I=[`disabled`],L={key:0,class:`mt-2 text-xs text-gray-400`},R=o({__name:`MediaDetailView`,setup(o){let R=h(),z=p(),B=ee(),{can:V}=m(),H=ne(),U=ie(),W=l(()=>R.params.id),G=e(null),K=e(!0),q=e(``),J=e(!1),Y=e(!1),X=e(!1),le=l(()=>G.value?.mime_type===`application/pdf`);function ue(e){return e>=1e6?`${(e/1e6).toFixed(1)} MB`:e>=1e3?`${Math.round(e/1e3)} KB`:`${e} B`}function de(e){return e?new Date(String(e)).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):`—`}f(async()=>{let e=U.items.get(W.value);if(e){G.value=e,q.value=e.alt??``,K.value=!1;return}let t=await B.get(`/media/${W.value}`);K.value=!1,t.ok&&(G.value=t.data,q.value=t.data.alt??``,U.setItem(t.data))});async function Z(){if(!G.value)return;J.value=!0;let e=await B.patch(`/media/${G.value.id}`,{alt:q.value.trim()});J.value=!1,e.ok?(G.value=e.data,U.setItem(e.data),H.success(`Alt text saved.`)):H.error(e.error.message)}async function fe(){if(!G.value)return;X.value=!1,Y.value=!0;let e=await B.del(`/media/${G.value.id}`);if(Y.value=!1,!e.ok){H.error(e.error.message);return}U.removeItem(G.value.id),z.push({name:`media-library`})}let Q=l(()=>G.value!==null&&G.value.reference_count===0),$=l(()=>Q.value?void 0:`This file is referenced by ${G.value?.reference_count??0} item${(G.value?.reference_count??0)===1?``:`s`} and cannot be deleted.`);return(e,o)=>K.value?(t(),a(`div`,ae,[...o[3]||=[i(`span`,{class:`inline-block h-6 w-6 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent`,"aria-hidden":`true`},null,-1)]])):G.value?(t(),a(`div`,se,[i(`button`,{type:`button`,class:`text-sm text-indigo-600 hover:text-indigo-800`,onClick:o[0]||=e=>r(z).back()},` ← Back to library `),i(`div`,g,[G.value.type===`image`?(t(),a(`img`,{key:0,src:G.value.url,alt:G.value.alt??``,class:`max-h-96 w-full object-contain`},null,8,_)):G.value.type===`video`?(t(),a(`video`,{key:1,src:G.value.url,controls:``,preload:`metadata`,class:`max-h-96 w-full bg-black object-contain`},` Your browser cannot play this video. `,8,v)):(t(),a(`div`,y,[o[5]||=i(`div`,{class:`text-6xl text-gray-300`,"aria-hidden":`true`},`📄`,-1),i(`a`,{href:G.value.url,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center gap-1.5 rounded-md border border-indigo-200 bg-indigo-50 px-3 py-1.5 text-sm font-medium text-indigo-700 hover:border-indigo-300 hover:bg-indigo-100`},[c(d(le.value?`Open PDF in new tab`:`Open file in new tab`)+` `,1),o[4]||=i(`span`,{"aria-hidden":`true`},`↗`,-1)],8,b)]))]),i(`div`,x,[o[12]||=i(`h2`,{class:`mb-4 text-sm font-semibold uppercase tracking-wide text-gray-500`},`Metadata`,-1),i(`dl`,S,[i(`div`,null,[o[6]||=i(`dt`,{class:`text-gray-500`},`Type`,-1),i(`dd`,C,d(G.value.mime_type),1)]),i(`div`,null,[o[7]||=i(`dt`,{class:`text-gray-500`},`Size`,-1),i(`dd`,w,d(ue(G.value.file_size)),1)]),G.value.width&&G.value.height?(t(),a(`div`,T,[o[8]||=i(`dt`,{class:`text-gray-500`},`Dimensions`,-1),i(`dd`,E,d(G.value.width)+` × `+d(G.value.height)+`px`,1)])):u(``,!0),G.value.duration?(t(),a(`div`,D,[o[9]||=i(`dt`,{class:`text-gray-500`},`Duration`,-1),i(`dd`,O,d(G.value.duration)+`s`,1)])):u(``,!0),i(`div`,null,[o[10]||=i(`dt`,{class:`text-gray-500`},`Uploaded`,-1),i(`dd`,k,d(de(G.value.created_at)),1)]),i(`div`,null,[o[11]||=i(`dt`,{class:`text-gray-500`},`References`,-1),i(`dd`,A,d(G.value.reference_count)+` content item`+d(G.value.reference_count===1?``:`s`),1)])])]),i(`div`,j,[o[13]||=i(`h2`,{class:`mb-3 text-sm font-semibold uppercase tracking-wide text-gray-500`},`Alt text`,-1),n(i(`textarea`,{"onUpdate:modelValue":o[1]||=e=>q.value=e,rows:`3`,disabled:J.value,placeholder:`Describe this file for screen readers and SEO`,class:`block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},null,8,M),[[te,q.value]]),i(`div`,N,[i(`button`,{type:`button`,disabled:J.value,class:`rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)] disabled:cursor-not-allowed disabled:opacity-50`,onClick:Z},d(J.value?`Saving…`:`Save alt text`),9,P)])]),r(V)(`media:delete`)?(t(),a(`div`,F,[o[14]||=i(`h2`,{class:`mb-1 text-sm font-semibold uppercase tracking-wide text-red-500`},`Danger zone`,-1),o[15]||=i(`p`,{class:`mb-3 text-sm text-gray-500`},` Permanently deletes this file from storage. This cannot be undone. `,-1),i(`span`,{title:$.value},[i(`button`,{type:`button`,disabled:!Q.value||Y.value,class:`rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 disabled:cursor-not-allowed disabled:opacity-50`,onClick:o[2]||=e=>X.value=!0},d(Y.value?`Deleting…`:`Delete file`),9,I)],8,ce),Q.value?u(``,!0):(t(),a(`p`,L,d($.value),1))])):u(``,!0),X.value?(t(),s(re,{key:1,message:`Permanently delete this file? This action cannot be undone.`,"on-confirm":fe,"on-cancel":()=>X.value=!1},null,8,[`on-cancel`])):u(``,!0)])):(t(),a(`div`,oe,` Media item not found. `))}});export{R as default};
@@ -0,0 +1 @@
1
+ import{B as e,E as t,O as n,P as r,W as i,c as a,ct as o,d as s,g as c,h as l,i as u,j as ee,l as te,lt as d,m as f,s as ne,u as p,ut as m,w as re}from"./schema-B-RKX_ep.js";import{c as ie,d as ae,n as oe,r as se,t as ce,u as le}from"./index-DHBhcS6-.js";import{t as ue}from"./useNotification-B8AtuEWL.js";import{t as de}from"./ConfirmDialog-B7nxdDge.js";import{n as h,r as fe,t as pe}from"./MediaThumbnail-q7pxungQ.js";import{t as me}from"./Pagination-BIf7mQy7.js";import{t as he}from"./media-DvQfZD4o.js";var ge={class:`mb-[18px] flex flex-wrap items-center justify-between gap-4`},_e={key:0},ve={key:0,class:`mb-5 rounded-md border border-gray-200 bg-white p-4 shadow-sm`},ye={key:0,class:`space-y-3`},be={class:`text-sm font-medium text-gray-700`},xe={class:`flex gap-2`},Se=[`disabled`],Ce={key:1,class:`space-y-2`},we={class:`text-sm text-gray-500`},Te={class:`flex items-center gap-2`},g={class:`h-2 flex-1 overflow-hidden rounded-full bg-gray-100`},_={class:`w-8 shrink-0 text-right text-xs text-gray-500`},v={key:2,class:`mt-2 text-sm text-red-600`,role:`alert`},y=[`data-tab`,`onClick`],b={key:1,class:`mb-3 flex items-center gap-3`},x={class:`flex cursor-pointer items-center gap-2 text-sm text-gray-600`},S=[`checked`,`indeterminate`],C={key:2,class:`grid grid-cols-3 gap-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6`},w={key:3,class:`rounded-2xl border border-dashed border-gray-300 p-12 text-center`},T={class:`text-sm text-muted`},E={key:4,class:`grid grid-cols-3 gap-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6`},D=[`checked`,`onChange`],O=[`aria-label`,`onClick`],Ee={key:5,class:`mt-5 flex justify-center`},k=20,A=c({__name:`MediaLibraryView`,setup(c){let A=ie(),j=ce(),{can:M}=oe(),N=ue(),De=se(),P=he(),F=e(`all`),I=ne(()=>F.value===`orphaned`),Oe=[{value:`all`,label:`All`},{value:`image`,label:`Images`},{value:`video`,label:`Videos`},{value:`file`,label:`PDFs`},{value:`orphaned`,label:`Orphaned`}],L=e(null),{left:R,width:ke}=fe(L,F),z=e([]),B=e(0),V=e(1),H=e(!1);function Ae(e,t){let n=new URLSearchParams({page:String(t),per_page:String(k)});return e===`orphaned`?n.set(`orphaned`,`true`):e!==`all`&&n.set(`type`,e),`/media?${n.toString()}`}async function U(e,t){H.value=!0;let n=await j.get(Ae(e,t));H.value=!1,n.ok&&(z.value=n.data,B.value=n.meta?.total??n.data.length,P.setItems(n.data))}re(()=>{U(F.value,V.value)}),ee(F,e=>{V.value=1,W.value.clear(),U(e,1)});function je(e){V.value=e,U(F.value,e)}function Me(e){A.push({name:`media-detail`,params:{id:e}})}let W=e(new Set),G=e(!1);function Ne(e){W.value.has(e)?W.value.delete(e):W.value.add(e)}function Pe(){W.value.size===z.value.length?W.value.clear():W.value=new Set(z.value.map(e=>e.id))}async function Fe(){G.value=!1;let e=[...W.value];for(let t of e)await j.del(`/media/${t}`),P.removeItem(t);z.value=z.value.filter(t=>!e.includes(t.id)),B.value=Math.max(0,B.value-e.length),W.value.clear(),N.success(`Deleted ${e.length} item${e.length===1?``:`s`}.`)}let K=e(`idle`),q=e(null),J=e(`file`),Y=e(``),X=e(0),Z=e(``),Q=e(null);function Ie(e){return e.type.startsWith(`image/`)?`image`:e.type.startsWith(`video/`)?`video`:`file`}function Le(e){return e>=1e6?`${(e/1e6).toFixed(1)} MB`:e>=1e3?`${Math.round(e/1e3)} KB`:`${e} B`}function Re(e){let t=e.target.files?.[0];t&&(e.target.value=``,q.value=t,J.value=Ie(t),Y.value=``,Z.value=``,J.value===`image`?$(t):K.value=`alt-collect`)}function ze(e,t){return new Promise((n,r)=>{let i=new FormData;i.append(`file`,e),t&&i.append(`alt`,t);let a=new XMLHttpRequest;a.withCredentials=!0,a.open(`POST`,`/admin/api/media/${J.value}`),a.upload.onprogress=e=>{e.lengthComputable&&(X.value=Math.round(e.loaded/e.total*100))},a.onload=()=>{try{let e=JSON.parse(a.responseText);e.ok&&e.data?n(e.data):r(Error(e.error?.message??`Upload failed`))}catch{r(Error(`Invalid server response`))}},a.onerror=()=>r(Error(`Network error`)),a.send(i)})}async function Be(e,t){let n=new URLSearchParams({type:J.value,filename:e.name,mime_type:e.type}),r=await(await fetch(`/admin/api/media/presigned-url?${n.toString()}`,{credentials:`include`})).json();if(!r.ok||!r.data)throw Error(r.error?.message??`Failed to get upload URL`);let{upload_url:i,media_id:a,method:o,fields:s}=r.data;await new Promise((t,n)=>{let r=new XMLHttpRequest;if(r.upload.onprogress=e=>{e.lengthComputable&&(X.value=Math.round(e.loaded/e.total*100))},r.onload=()=>r.status>=200&&r.status<300?t():n(Error(`Storage upload failed (${r.status})`)),r.onerror=()=>n(Error(`Network error`)),o===`POST`&&s){let t=new FormData;for(let[e,n]of Object.entries(s))t.append(e,n);t.append(`file`,e),r.open(`POST`,i),r.send(t)}else r.open(`PUT`,i),r.send(e)});let c=await(await fetch(`/admin/api/media/confirm/${a}`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({alt:t})})).json();if(!c.ok||!c.data)throw Error(c.error?.message??`Upload confirmation failed`);return c.data}async function $(e){K.value=`uploading`,X.value=0,Z.value=``;try{let t=Y.value.trim(),n=De.presignedUploads?await Be(e,t):await ze(e,t);z.value=[n,...z.value],B.value+=1,P.setItem(n),N.success(`Upload complete.`)}catch(e){Z.value=e instanceof Error?e.message:`Upload failed`}finally{K.value=`idle`,q.value=null}}function Ve(){q.value&&$(q.value)}function He(){q.value=null,Y.value=``,Z.value=``,K.value=`idle`}return(e,c)=>(t(),s(`div`,null,[a(`div`,ge,[c[5]||=a(`h1`,{class:`text-[26px] font-bold tracking-tight text-ink`},`Media library`,-1),i(M)(`media:create`)?(t(),s(`div`,_e,[a(`input`,{ref_key:`fileInputRef`,ref:Q,type:`file`,class:`hidden`,accept:`image/*,video/*,application/pdf,.pdf`,onChange:Re},null,544),a(`button`,{type:`button`,class:`inline-flex items-center gap-1.75 rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)]`,onClick:c[0]||=e=>Q.value?.click()},[...c[4]||=[a(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.9`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[a(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),a(`path`,{d:`M17 8l-5-5-5 5`}),a(`path`,{d:`M12 3v12`})],-1),f(` Upload `,-1)]])])):p(``,!0)]),K.value===`idle`?p(``,!0):(t(),s(`div`,ve,[K.value===`alt-collect`?(t(),s(`div`,ye,[a(`p`,be,m(q.value?.name),1),a(`div`,null,[c[6]||=a(`label`,{for:`upload-alt`,class:`block text-xs text-gray-600`},[f(` Alt text `),a(`span`,{class:`text-red-500`},`*`)],-1),r(a(`input`,{id:`upload-alt`,"onUpdate:modelValue":c[1]||=e=>Y.value=e,type:`text`,placeholder:`Describe this file`,class:`mt-0.5 block w-full rounded-md border border-gray-300 px-3 py-1.5 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200`},null,512),[[le,Y.value]])]),a(`div`,xe,[a(`button`,{type:`button`,class:`rounded-md px-3 py-1.5 text-sm text-gray-600 ring-1 ring-inset ring-gray-300 hover:bg-gray-50`,onClick:He},` Cancel `),a(`button`,{type:`button`,disabled:!Y.value.trim(),class:`rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50`,onClick:Ve},` Upload `,8,Se)])])):K.value===`uploading`?(t(),s(`div`,Ce,[a(`p`,we,`Uploading`+m(q.value?` ${q.value.name}`:`…`),1),a(`div`,Te,[a(`div`,g,[a(`div`,{class:`h-2 rounded-full bg-indigo-600 transition-all duration-150`,style:d({width:`${X.value}%`})},null,4)]),a(`span`,_,m(X.value)+`%`,1)])])):p(``,!0),Z.value?(t(),s(`p`,v,m(Z.value),1)):p(``,!0)])),a(`div`,{ref_key:`tabBarRef`,ref:L,class:`relative mb-[22px] flex gap-0 overflow-x-auto border-b border-card-border`},[(t(),s(u,null,n(Oe,e=>a(`button`,{key:e.value,"data-tab":e.value,type:`button`,class:o([`mr-[22px] whitespace-nowrap bg-none px-0.5 py-[11px] text-sm transition-colors`,F.value===e.value?`font-semibold text-indigo-600`:`font-medium text-faint hover:text-[#8A8A9E]`]),onClick:t=>F.value=e.value},m(e.label),11,y)),64)),a(`div`,{class:`absolute bottom-[-1px] h-[2px] rounded-full bg-indigo-600 transition-[left,width] duration-300`,style:d({left:`${i(R)}px`,width:`${i(ke)}px`})},null,4)],512),I.value&&z.value.length>0&&i(M)(`media:delete`)?(t(),s(`div`,b,[a(`label`,x,[a(`input`,{type:`checkbox`,checked:W.value.size===z.value.length&&z.value.length>0,indeterminate:W.value.size>0&&W.value.size<z.value.length,class:`rounded border-gray-300 text-indigo-600 focus:ring-indigo-500`,onChange:Pe},null,40,S),c[7]||=f(` Select all `,-1)]),W.value.size>0?(t(),s(`button`,{key:0,type:`button`,class:`rounded-md bg-red-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-red-700`,onClick:c[2]||=e=>G.value=!0},` Delete `+m(W.value.size)+` selected `,1)):p(``,!0)])):p(``,!0),H.value?(t(),s(`div`,C,[(t(),s(u,null,n(12,e=>a(`div`,{key:e,class:`aspect-square animate-pulse rounded-[14px] bg-gray-100`})),64))])):z.value.length===0?(t(),s(`div`,w,[a(`p`,T,m(I.value?`No orphaned files.`:`No media files yet.`),1)])):(t(),s(`div`,E,[(t(!0),s(u,null,n(z.value,e=>(t(),s(`div`,{key:e.id,class:`group relative aspect-square`},[I.value&&i(M)(`media:delete`)?(t(),s(`label`,{key:0,class:`absolute left-1.5 top-1.5 z-10 cursor-pointer`,onClick:c[3]||=ae(()=>{},[`stop`])},[a(`input`,{type:`checkbox`,checked:W.value.has(e.id),class:`rounded border-gray-300 bg-white text-indigo-600 shadow focus:ring-indigo-500`,onChange:t=>Ne(e.id)},null,40,D)])):p(``,!0),a(`button`,{type:`button`,class:`h-full w-full overflow-hidden rounded-[14px] border border-card-border shadow-[0_1px_2px_rgba(24,24,48,0.04),0_8px_22px_rgba(24,24,48,0.05)] transition-all hover:-translate-y-[3px] hover:shadow-[0_12px_30px_rgba(24,24,48,0.12)] focus:outline-none focus:ring-2 focus:ring-indigo-500`,"aria-label":`View ${e.alt??i(h)(e.url)}`,onClick:t=>Me(e.id)},[l(pe,{item:e,label:i(h)(e.url),detail:Le(e.file_size)},null,8,[`item`,`label`,`detail`])],8,O)]))),128))])),!H.value&&B.value>k?(t(),s(`div`,Ee,[l(me,{total:B.value,page:V.value,"per-page":k,"onUpdate:page":je},null,8,[`total`,`page`])])):p(``,!0),G.value?(t(),te(de,{key:6,message:`Permanently delete ${W.value.size} file${W.value.size===1?``:`s`}? This cannot be undone.`,"on-confirm":Fe,"on-cancel":()=>G.value=!1},null,8,[`message`,`on-cancel`])):p(``,!0)]))}});export{A as default};
@@ -0,0 +1 @@
1
+ import{B as e,C as t,E as n,S as r,W as i,c as a,ct as o,d as s,g as c,i as l,j as u,s as d,u as f,ut as p,w as m}from"./schema-B-RKX_ep.js";function h(t,n){let i=e(0),a=e(0);function o(){let e=t.value;if(!e)return;let r=e.querySelector(`[data-tab="${n.value}"]`);r&&(i.value=r.offsetLeft,a.value=r.offsetWidth)}return u([t,n],()=>{r(()=>o())},{immediate:!0}),{left:i,width:a,measure:o}}var g={red:`bg-red-600`,blue:`bg-blue-600`,green:`bg-green-600`,orange:`bg-orange-500`,gray:`bg-gray-500`},_=[{test:e=>e===`application/pdf`,kind:{label:`PDF`,tone:`red`}},{test:e=>e===`application/msword`||e===`application/rtf`||e.includes(`wordprocessingml`)||e===`application/vnd.oasis.opendocument.text`,kind:{label:`DOC`,tone:`blue`}},{test:e=>e===`application/vnd.ms-excel`||e===`text/csv`||e.includes(`spreadsheetml`)||e===`application/vnd.oasis.opendocument.spreadsheet`,kind:{label:`XLS`,tone:`green`}},{test:e=>e===`application/vnd.ms-powerpoint`||e.includes(`presentationml`)||e===`application/vnd.oasis.opendocument.presentation`,kind:{label:`PPT`,tone:`orange`}},{test:e=>e===`application/zip`||e===`application/x-zip-compressed`||e===`application/gzip`||e===`application/x-gzip`||e===`application/x-tar`||e===`application/x-7z-compressed`||e===`application/x-rar-compressed`||e===`application/vnd.rar`,kind:{label:`ZIP`,tone:`gray`}},{test:e=>e.startsWith(`text/`),kind:{label:`TXT`,tone:`gray`}}];function v(e){return(e.split(/[?#]/)[0]??``).split(`/`).pop()||e}function y(e){let t=v(e),n=t.lastIndexOf(`.`);if(n<=0)return``;let r=t.slice(n+1);return/^[a-z0-9]{1,5}$/i.test(r)?r.toUpperCase():``}function b(e,t){let n=(e.split(`;`)[0]??``).trim().toLowerCase(),r=_.find(e=>e.test(n));return r?r.kind:{label:y(t)||`FILE`,tone:`gray`}}var x=[`src`,`alt`],S=[`src`],C={key:0,class:`absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent px-1 pb-1 pt-4 text-center`},w={key:0,class:`truncate text-xs text-white`},T={key:1,class:`text-[10px] text-gray-200`},E={key:2,class:`flex h-full w-full flex-col items-center justify-center gap-1 bg-gray-50 p-1 text-gray-400`},D={key:0,class:`max-w-full truncate text-center text-xs`},O={key:1,class:`text-xs text-gray-300`},k=c({__name:`MediaThumbnail`,props:{item:{},label:{},detail:{}},setup(r){let c=r,h=e(null),_=typeof IntersectionObserver<`u`,v=e(!_),y=e(!1),k=null;function A(){k?.disconnect(),k=null}function j(){A(),y.value=!1,v.value=!_,!(c.item.type!==`video`||!_||!h.value)&&(k=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(v.value=!0,A())}),k.observe(h.value))}m(j),u(()=>[c.item.url,c.item.type],j),t(A);let M=d(()=>v.value?`${c.item.url}#t=0.1`:void 0),N=d(()=>b(c.item.mime_type,c.item.url));return(e,t)=>(n(),s(`div`,{ref_key:`root`,ref:h,class:`relative h-full w-full overflow-hidden`},[r.item.type===`image`?(n(),s(`img`,{key:0,src:r.item.url,alt:r.item.alt??``,class:`h-full w-full object-cover`,loading:`lazy`},null,8,x)):r.item.type===`video`&&!y.value?(n(),s(l,{key:1},[a(`video`,{src:M.value,preload:`metadata`,muted:``,playsinline:``,class:`h-full w-full bg-gray-900 object-cover`,onError:t[0]||=e=>y.value=!0},null,40,S),t[1]||=a(`span`,{class:`absolute left-1 top-1 flex h-5 w-5 items-center justify-center rounded-full bg-black/60 text-[10px] text-white`,"aria-hidden":`true`},`▶`,-1),r.label||r.detail?(n(),s(`div`,C,[r.label?(n(),s(`p`,w,p(r.label),1)):f(``,!0),r.detail?(n(),s(`p`,T,p(r.detail),1)):f(``,!0)])):f(``,!0)],64)):(n(),s(`div`,E,[t[2]||=a(`span`,{class:`relative inline-flex`,"aria-hidden":`true`},[a(`svg`,{viewBox:`0 0 24 24`,class:`h-9 w-9`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`},[a(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),a(`path`,{d:`M14 3v5h5`})])],-1),a(`span`,{"data-testid":`file-badge`,class:o([`rounded px-1 text-[10px] font-semibold leading-4 text-white`,r.item.type===`video`?`bg-gray-700`:i(g)[N.value.tone]])},p(r.item.type===`video`?`VIDEO`:N.value.label),3),r.label?(n(),s(`span`,D,p(r.label),1)):f(``,!0),r.detail?(n(),s(`span`,O,p(r.detail),1)):f(``,!0)]))],512))}});export{v as n,h as r,k as t};
@@ -1 +1 @@
1
- import{A as e,B as t,E as n,O as r,W as i,c as a,d as o,g as s,i as ee,j as c,l,s as u,t as te,u as d,ut as f,w as ne}from"./schema-B-RKX_ep.js";import{c as re,n as ie,s as ae,t as oe}from"./index-GvXDeXi5.js";import{a as se,c as ce,i as le,l as p,n as ue,o as de,s as m,t as h,u as g}from"./field-defaults-BTA4TEHe.js";import{t as _}from"./useNotification-DXsAIQaa.js";import{t as v}from"./ConfirmDialog-B7nxdDge.js";import{t as y}from"./taxonomy-DC-6wyg3.js";function b(e){return e.field_type===`programmatic`?!1:e.db_column!==null&&!e.db_column.junction}function fe(e,t){let n={};for(let r of e)b(r)&&(n[r.name]=t?.[r.name]??h(r));return n}var x={key:0,class:`flex items-center justify-center py-20`},S={key:1,class:`py-12 text-center text-sm text-gray-500`},C={key:2},w={class:`mb-6 flex items-start justify-between gap-4`},T={class:`text-xs font-medium uppercase tracking-wide text-gray-400`},E={class:`text-[26px] font-bold tracking-tight text-ink`},D={class:`flex shrink-0 items-center gap-2`},O=[`disabled`],k=[`disabled`],A={class:`space-y-5`},j={key:0,class:`mt-4 text-sm text-red-600`,role:`alert`},M=s({__name:`TaxonomyFormView`,setup(s){let h=ae(),b=re(),M=oe(),{can:N}=ie(),{errors:P,validate:F,mergeServerErrors:I,clearErrors:L,setError:R}=g(),z=_(),pe=te(),B=y(),V=u(()=>h.params.type),H=u(()=>h.params.id),U=u(()=>!!H.value),W=u(()=>pe.taxonomyTypes[V.value]),G=u(()=>W.value?.fields??[]),K=t(null),q=t({}),J=t(!0),Y=t(!1),X=t(``),Z=t(!1),me={"text/plain":p,"text/rich":ce,integer:m,float:m,boolean:de,date:se,enum:le,programmatic:ue};function he(e){let t=e.field_type;return me[t]??p}function Q(e){q.value=fe(G.value,e)}function ge(e,t){q.value[e]=t}async function $(e){let t=await M.get(`/taxonomy/${V.value}/${e}`);t.ok?(K.value=t.data,Q(t.data)):X.value=t.error.message}ne(async()=>{if(!W.value){J.value=!1;return}U.value&&H.value?await $(H.value):Q(),J.value=!1}),c(H,async(e,t)=>{e!==t&&(J.value=!0,L(),e?await $(e):(K.value=null,Q()),J.value=!1)});async function _e(){if(!F(G.value,q.value))return;Y.value=!0,X.value=``;let e=U.value?await M.patch(`/taxonomy/${V.value}/${H.value}`,q.value):await M.post(`/taxonomy/${V.value}`,q.value);if(Y.value=!1,!e.ok){let t=e.error;t.code===`PUBLISH_VALIDATION_ERROR`&&t.details?I(t.details):t.code===`SLUG_CONFLICT`?R(`slug`,`This slug is already taken.`):X.value=t.message;return}K.value=e.data,B.invalidate(V.value),z.success(`Saved.`),U.value||b.replace({name:`taxonomy-edit`,params:{type:V.value,id:String(e.data.id)}})}async function ve(){Z.value=!1,Y.value=!0;let e=await M.del(`/taxonomy/${V.value}/${H.value}`);if(Y.value=!1,!e.ok){X.value=e.error.message;return}B.invalidate(V.value),b.push({name:`taxonomy-list`,params:{type:V.value}})}let ye=u(()=>{if(!U.value)return`New ${W.value?.label??``}`;let e=G.value.find(e=>e.field_type===`text/plain`);return e?String(K.value?.[e.name]??``):W.value?.label??``});return(t,s)=>J.value?(n(),o(`div`,x,[...s[1]||=[a(`span`,{class:`inline-block h-6 w-6 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent`,"aria-hidden":`true`},null,-1)]])):W.value?(n(),o(`div`,C,[a(`div`,w,[a(`div`,null,[a(`p`,T,f(W.value.label),1),a(`h1`,E,f(ye.value),1)]),a(`div`,D,[i(N)(`taxonomy:delete`)&&U.value?(n(),o(`button`,{key:0,type:`button`,disabled:Y.value,class:`rounded-md px-3 py-2 text-sm font-medium text-red-600 ring-1 ring-inset ring-red-300 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-50`,onClick:s[0]||=e=>Z.value=!0},` Delete `,8,O)):d(``,!0),(U.value?i(N)(`taxonomy:edit`):i(N)(`taxonomy:create`))?(n(),o(`button`,{key:1,type:`button`,disabled:Y.value,class:`rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)] disabled:cursor-not-allowed disabled:opacity-50`,onClick:_e},f(Y.value?`Saving…`:`Save`),9,k)):d(``,!0)])]),a(`div`,A,[(n(!0),o(ee,null,r(G.value,t=>(n(),l(e(he(t)),{key:t.name,field:t,"model-value":q.value[t.name],error:i(P)[t.name],disabled:Y.value,"onUpdate:modelValue":e=>ge(t.name,e)},null,8,[`field`,`model-value`,`error`,`disabled`,`onUpdate:modelValue`]))),128))]),X.value?(n(),o(`p`,j,f(X.value),1)):d(``,!0),Z.value?(n(),l(v,{key:1,message:`Are you sure you want to delete this term? This action cannot be undone.`,"on-confirm":ve,"on-cancel":()=>Z.value=!1},null,8,[`on-cancel`])):d(``,!0)])):(n(),o(`div`,S,` Taxonomy type not found. `))}});export{M as default};
1
+ import{A as e,B as t,E as n,O as r,W as i,c as a,d as o,g as s,i as ee,j as c,l,s as u,t as te,u as d,ut as f,w as ne}from"./schema-B-RKX_ep.js";import{c as re,n as ie,s as ae,t as oe}from"./index-DHBhcS6-.js";import{a as se,c as ce,i as le,l as p,n as ue,o as de,s as m,t as h,u as g}from"./field-defaults-m6kJphku.js";import{t as _}from"./useNotification-B8AtuEWL.js";import{t as v}from"./ConfirmDialog-B7nxdDge.js";import{t as y}from"./taxonomy-DC-6wyg3.js";function b(e){return e.field_type===`programmatic`?!1:e.db_column!==null&&!e.db_column.junction}function fe(e,t){let n={};for(let r of e)b(r)&&(n[r.name]=t?.[r.name]??h(r));return n}var x={key:0,class:`flex items-center justify-center py-20`},S={key:1,class:`py-12 text-center text-sm text-gray-500`},C={key:2},w={class:`mb-6 flex items-start justify-between gap-4`},T={class:`text-xs font-medium uppercase tracking-wide text-gray-400`},E={class:`text-[26px] font-bold tracking-tight text-ink`},D={class:`flex shrink-0 items-center gap-2`},O=[`disabled`],k=[`disabled`],A={class:`space-y-5`},j={key:0,class:`mt-4 text-sm text-red-600`,role:`alert`},M=s({__name:`TaxonomyFormView`,setup(s){let h=ae(),b=re(),M=oe(),{can:N}=ie(),{errors:P,validate:F,mergeServerErrors:I,clearErrors:L,setError:R}=g(),z=_(),pe=te(),B=y(),V=u(()=>h.params.type),H=u(()=>h.params.id),U=u(()=>!!H.value),W=u(()=>pe.taxonomyTypes[V.value]),G=u(()=>W.value?.fields??[]),K=t(null),q=t({}),J=t(!0),Y=t(!1),X=t(``),Z=t(!1),me={"text/plain":p,"text/rich":ce,integer:m,float:m,boolean:de,date:se,enum:le,programmatic:ue};function he(e){let t=e.field_type;return me[t]??p}function Q(e){q.value=fe(G.value,e)}function ge(e,t){q.value[e]=t}async function $(e){let t=await M.get(`/taxonomy/${V.value}/${e}`);t.ok?(K.value=t.data,Q(t.data)):X.value=t.error.message}ne(async()=>{if(!W.value){J.value=!1;return}U.value&&H.value?await $(H.value):Q(),J.value=!1}),c(H,async(e,t)=>{e!==t&&(J.value=!0,L(),e?await $(e):(K.value=null,Q()),J.value=!1)});async function _e(){if(!F(G.value,q.value))return;Y.value=!0,X.value=``;let e=U.value?await M.patch(`/taxonomy/${V.value}/${H.value}`,q.value):await M.post(`/taxonomy/${V.value}`,q.value);if(Y.value=!1,!e.ok){let t=e.error;t.code===`PUBLISH_VALIDATION_ERROR`&&t.details?I(t.details):t.code===`SLUG_CONFLICT`?R(`slug`,`This slug is already taken.`):X.value=t.message;return}K.value=e.data,B.invalidate(V.value),z.success(`Saved.`),U.value||b.replace({name:`taxonomy-edit`,params:{type:V.value,id:String(e.data.id)}})}async function ve(){Z.value=!1,Y.value=!0;let e=await M.del(`/taxonomy/${V.value}/${H.value}`);if(Y.value=!1,!e.ok){X.value=e.error.message;return}B.invalidate(V.value),b.push({name:`taxonomy-list`,params:{type:V.value}})}let ye=u(()=>{if(!U.value)return`New ${W.value?.label??``}`;let e=G.value.find(e=>e.field_type===`text/plain`);return e?String(K.value?.[e.name]??``):W.value?.label??``});return(t,s)=>J.value?(n(),o(`div`,x,[...s[1]||=[a(`span`,{class:`inline-block h-6 w-6 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent`,"aria-hidden":`true`},null,-1)]])):W.value?(n(),o(`div`,C,[a(`div`,w,[a(`div`,null,[a(`p`,T,f(W.value.label),1),a(`h1`,E,f(ye.value),1)]),a(`div`,D,[i(N)(`taxonomy:delete`)&&U.value?(n(),o(`button`,{key:0,type:`button`,disabled:Y.value,class:`rounded-md px-3 py-2 text-sm font-medium text-red-600 ring-1 ring-inset ring-red-300 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-50`,onClick:s[0]||=e=>Z.value=!0},` Delete `,8,O)):d(``,!0),(U.value?i(N)(`taxonomy:edit`):i(N)(`taxonomy:create`))?(n(),o(`button`,{key:1,type:`button`,disabled:Y.value,class:`rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)] disabled:cursor-not-allowed disabled:opacity-50`,onClick:_e},f(Y.value?`Saving…`:`Save`),9,k)):d(``,!0)])]),a(`div`,A,[(n(!0),o(ee,null,r(G.value,t=>(n(),l(e(he(t)),{key:t.name,field:t,"model-value":q.value[t.name],error:i(P)[t.name],disabled:Y.value,"onUpdate:modelValue":e=>ge(t.name,e)},null,8,[`field`,`model-value`,`error`,`disabled`,`onUpdate:modelValue`]))),128))]),X.value?(n(),o(`p`,j,f(X.value),1)):d(``,!0),Z.value?(n(),l(v,{key:1,message:`Are you sure you want to delete this term? This action cannot be undone.`,"on-confirm":ve,"on-cancel":()=>Z.value=!1},null,8,[`on-cancel`])):d(``,!0)])):(n(),o(`div`,S,` Taxonomy type not found. `))}});export{M as default};
@@ -1 +1 @@
1
- import{B as e,E as t,O as n,P as r,W as i,c as a,d as o,g as s,h as c,i as l,j as u,m as d,s as f,t as p,u as m,ut as h,w as g}from"./schema-B-RKX_ep.js";import{a as _,c as v,n as y,s as b,t as x,u as S}from"./index-GvXDeXi5.js";import{t as C}from"./Pagination-BIf7mQy7.js";import{t as w}from"./taxonomy-DC-6wyg3.js";var T={class:`mb-5.5 flex flex-wrap items-center justify-between gap-4`},ee={class:`text-[26px] font-bold tracking-tight text-ink`},te={class:`mb-4 flex h-9.5 items-center gap-2 rounded-[10px] border border-card-border bg-[#FBFBFD] px-2.75 text-[13px] transition-colors focus-within:border-indigo-400`},E={key:0,class:`space-y-2`},D={key:1,class:`rounded-2xl border border-dashed border-gray-300 p-12 text-center`},O={class:`text-sm text-muted`},k={key:2,class:`overflow-hidden rounded-2xl border border-card-border bg-white shadow-[0_1px_2px_rgba(24,24,48,0.04),0_10px_28px_rgba(24,24,48,0.04)]`},A={class:`w-full text-sm`},j={class:`divide-y divide-[#F4F3F9]`},M=[`onClick`],N={class:`px-5.5 py-4 text-[14.5px] font-semibold text-ink`},P={class:`px-5.5 py-4 text-[13px] text-faint`},F={key:3,class:`mt-4 flex justify-center`},I=s({__name:`TaxonomyListView`,setup(s){let I=b(),L=v(),R=x(),{can:z}=y(),B=p(),V=w(),H=f(()=>I.params.type),U=f(()=>B.taxonomyTypes[H.value]),W=f(()=>U.value?.fields.find(e=>e.field_type===`text/plain`)?.name??`id`),G=e([]),K=e(0),q=e(1),J=e(!1),Y=e(``);function X(e){return typeof e!=`string`||!e?`—`:new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}async function Z(e){J.value=!0;let t=Y.value.trim();if(t===``){let t=V.getPage(H.value,e,50);if(t){G.value=t,K.value=V.total,J.value=!1;return}}let n=t===``?``:`&search=${encodeURIComponent(t)}`,r=await R.get(`/taxonomy/${H.value}?page=${e}&per_page=50${n}`);J.value=!1,r.ok&&(G.value=r.data,K.value=r.meta?.total??r.data.length,t===``&&(V.total=K.value,V.setPage(H.value,e,50,r.data)))}let Q=_(()=>{q.value=1,Z(1)},300);g(()=>{Z(q.value)}),u(H,()=>{q.value=1,G.value=[],Z(1)});function ne(e){q.value=e,Z(e)}function re(e){L.push({name:`taxonomy-edit`,params:{type:H.value,id:String(e.id)}})}function $(){L.push({name:`taxonomy-new`,params:{type:H.value}})}return(e,s)=>(t(),o(`div`,null,[a(`div`,T,[a(`h1`,ee,h(U.value?.label??H.value),1),i(z)(`taxonomy:create`)?(t(),o(`button`,{key:0,type:`button`,class:`inline-flex items-center gap-1.75 rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)]`,onClick:$},[s[2]||=a(`svg`,{width:`17`,height:`17`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},[a(`path`,{d:`M12 5v14`}),a(`path`,{d:`M5 12h14`})],-1),d(` New `+h(U.value?.label??`Term`),1)])):m(``,!0)]),a(`div`,te,[s[3]||=a(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`shrink-0 text-faint`},[a(`path`,{d:`M21 21l-4.3-4.3`}),a(`path`,{d:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z`})],-1),r(a(`input`,{"onUpdate:modelValue":s[0]||=e=>Y.value=e,type:`text`,placeholder:`Search terms…`,class:`w-full bg-transparent text-ink outline-none placeholder:text-faint`,onInput:s[1]||=(...e)=>i(Q)&&i(Q)(...e)},null,544),[[S,Y.value]])]),J.value?(t(),o(`div`,E,[(t(),o(l,null,n(6,e=>a(`div`,{key:e,class:`h-12 animate-pulse rounded-[10px] bg-gray-100`})),64))])):G.value.length===0?(t(),o(`div`,D,[a(`p`,O,h(Y.value.trim()===``?`No terms yet.`:`No results for “${Y.value.trim()}”.`),1),i(z)(`taxonomy:create`)&&Y.value.trim()===``?(t(),o(`button`,{key:0,type:`button`,class:`mt-3 text-sm font-medium text-indigo-600 hover:text-indigo-800`,onClick:$},` Create the first one → `)):m(``,!0)])):(t(),o(`div`,k,[a(`table`,A,[s[4]||=a(`thead`,{class:`text-[11.5px] font-bold uppercase tracking-[.06em] text-faint`},[a(`tr`,{class:`border-b border-divider`},[a(`th`,{class:`px-5.5 py-3.5 text-left`},`Name`),a(`th`,{class:`px-5.5 py-3.5 text-left`},`Updated`)])],-1),a(`tbody`,j,[(t(!0),o(l,null,n(G.value,e=>(t(),o(`tr`,{key:String(e.id),class:`cursor-pointer transition-colors hover:bg-[#FAFAFE]`,onClick:t=>re(e)},[a(`td`,N,h(e[W.value]??`—`),1),a(`td`,P,h(X(e.updated_at)),1)],8,M))),128))])])])),!J.value&&K.value>i(50)?(t(),o(`div`,F,[c(C,{total:K.value,page:q.value,"per-page":i(50),"onUpdate:page":ne},null,8,[`total`,`page`,`per-page`])])):m(``,!0)]))}});export{I as default};
1
+ import{B as e,E as t,O as n,P as r,W as i,c as a,d as o,g as s,h as c,i as l,j as u,m as d,s as f,t as p,u as m,ut as h,w as g}from"./schema-B-RKX_ep.js";import{a as _,c as v,n as y,s as b,t as x,u as S}from"./index-DHBhcS6-.js";import{t as C}from"./Pagination-BIf7mQy7.js";import{t as w}from"./taxonomy-DC-6wyg3.js";var T={class:`mb-5.5 flex flex-wrap items-center justify-between gap-4`},ee={class:`text-[26px] font-bold tracking-tight text-ink`},te={class:`mb-4 flex h-9.5 items-center gap-2 rounded-[10px] border border-card-border bg-[#FBFBFD] px-2.75 text-[13px] transition-colors focus-within:border-indigo-400`},E={key:0,class:`space-y-2`},D={key:1,class:`rounded-2xl border border-dashed border-gray-300 p-12 text-center`},O={class:`text-sm text-muted`},k={key:2,class:`overflow-hidden rounded-2xl border border-card-border bg-white shadow-[0_1px_2px_rgba(24,24,48,0.04),0_10px_28px_rgba(24,24,48,0.04)]`},A={class:`w-full text-sm`},j={class:`divide-y divide-[#F4F3F9]`},M=[`onClick`],N={class:`px-5.5 py-4 text-[14.5px] font-semibold text-ink`},P={class:`px-5.5 py-4 text-[13px] text-faint`},F={key:3,class:`mt-4 flex justify-center`},I=s({__name:`TaxonomyListView`,setup(s){let I=b(),L=v(),R=x(),{can:z}=y(),B=p(),V=w(),H=f(()=>I.params.type),U=f(()=>B.taxonomyTypes[H.value]),W=f(()=>U.value?.fields.find(e=>e.field_type===`text/plain`)?.name??`id`),G=e([]),K=e(0),q=e(1),J=e(!1),Y=e(``);function X(e){return typeof e!=`string`||!e?`—`:new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}async function Z(e){J.value=!0;let t=Y.value.trim();if(t===``){let t=V.getPage(H.value,e,50);if(t){G.value=t,K.value=V.total,J.value=!1;return}}let n=t===``?``:`&search=${encodeURIComponent(t)}`,r=await R.get(`/taxonomy/${H.value}?page=${e}&per_page=50${n}`);J.value=!1,r.ok&&(G.value=r.data,K.value=r.meta?.total??r.data.length,t===``&&(V.total=K.value,V.setPage(H.value,e,50,r.data)))}let Q=_(()=>{q.value=1,Z(1)},300);g(()=>{Z(q.value)}),u(H,()=>{q.value=1,G.value=[],Z(1)});function ne(e){q.value=e,Z(e)}function re(e){L.push({name:`taxonomy-edit`,params:{type:H.value,id:String(e.id)}})}function $(){L.push({name:`taxonomy-new`,params:{type:H.value}})}return(e,s)=>(t(),o(`div`,null,[a(`div`,T,[a(`h1`,ee,h(U.value?.label??H.value),1),i(z)(`taxonomy:create`)?(t(),o(`button`,{key:0,type:`button`,class:`inline-flex items-center gap-1.75 rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)]`,onClick:$},[s[2]||=a(`svg`,{width:`17`,height:`17`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},[a(`path`,{d:`M12 5v14`}),a(`path`,{d:`M5 12h14`})],-1),d(` New `+h(U.value?.label??`Term`),1)])):m(``,!0)]),a(`div`,te,[s[3]||=a(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`shrink-0 text-faint`},[a(`path`,{d:`M21 21l-4.3-4.3`}),a(`path`,{d:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z`})],-1),r(a(`input`,{"onUpdate:modelValue":s[0]||=e=>Y.value=e,type:`text`,placeholder:`Search terms…`,class:`w-full bg-transparent text-ink outline-none placeholder:text-faint`,onInput:s[1]||=(...e)=>i(Q)&&i(Q)(...e)},null,544),[[S,Y.value]])]),J.value?(t(),o(`div`,E,[(t(),o(l,null,n(6,e=>a(`div`,{key:e,class:`h-12 animate-pulse rounded-[10px] bg-gray-100`})),64))])):G.value.length===0?(t(),o(`div`,D,[a(`p`,O,h(Y.value.trim()===``?`No terms yet.`:`No results for “${Y.value.trim()}”.`),1),i(z)(`taxonomy:create`)&&Y.value.trim()===``?(t(),o(`button`,{key:0,type:`button`,class:`mt-3 text-sm font-medium text-indigo-600 hover:text-indigo-800`,onClick:$},` Create the first one → `)):m(``,!0)])):(t(),o(`div`,k,[a(`table`,A,[s[4]||=a(`thead`,{class:`text-[11.5px] font-bold uppercase tracking-[.06em] text-faint`},[a(`tr`,{class:`border-b border-divider`},[a(`th`,{class:`px-5.5 py-3.5 text-left`},`Name`),a(`th`,{class:`px-5.5 py-3.5 text-left`},`Updated`)])],-1),a(`tbody`,j,[(t(!0),o(l,null,n(G.value,e=>(t(),o(`tr`,{key:String(e.id),class:`cursor-pointer transition-colors hover:bg-[#FAFAFE]`,onClick:t=>re(e)},[a(`td`,N,h(e[W.value]??`—`),1),a(`td`,P,h(X(e.updated_at)),1)],8,M))),128))])])])),!J.value&&K.value>i(50)?(t(),o(`div`,F,[c(C,{total:K.value,page:q.value,"per-page":i(50),"onUpdate:page":ne},null,8,[`total`,`page`,`per-page`])])):m(``,!0)]))}});export{I as default};
@@ -1 +1 @@
1
- import{B as e,E as t,O as ee,P as n,W as r,c as i,d as a,g as o,i as s,l as c,s as l,u,ut as d,w as te}from"./schema-B-RKX_ep.js";import{c as f,d as p,l as m,n as h,o as g,s as _,t as v,u as y}from"./index-GvXDeXi5.js";import{t as ne}from"./useNotification-DXsAIQaa.js";import{t as re}from"./ConfirmDialog-B7nxdDge.js";import{t as ie}from"./users-DVibZ_HD.js";var ae={key:0,class:`flex items-center justify-center py-20`},oe={key:1,class:`mx-auto max-w-lg`},se={class:`mb-6 flex items-start justify-between gap-4`},ce={class:`text-[26px] font-bold tracking-tight text-ink`},le={class:`flex shrink-0 items-center gap-2`},ue=[`disabled`],de=[`disabled`],b={key:0,class:`mb-5 rounded-md border border-amber-200 bg-amber-50 p-4`,role:`alert`},x={class:`flex items-center gap-2`},S=[`value`],C={key:1,class:`mb-5 rounded-md border border-amber-200 bg-amber-50 p-4`,role:`alert`},w={class:`flex items-center gap-2`},T=[`value`],E=[`disabled`],D={key:0},O=[`disabled`],k=[`value`],A={key:0,class:`mt-1 text-xs text-gray-400`},j={key:1,class:`text-sm text-red-600`,role:`alert`},M=[`disabled`],N=o({__name:`UserFormView`,setup(o){let N=_(),P=f(),F=v(),{can:I,rolesBelow:L}=h(),R=ne(),fe=g(),z=ie(),B=l(()=>N.params.id),V=l(()=>!!B.value),H=l(()=>fe.id===B.value),U=e(``),W=e(``),G=e(!1),K=e(!1),q=e(``),J=e(null),Y=e(!1),X=e(null),Z=e(!1),Q=e(!1);te(async()=>{if(!V.value||!B.value){W.value=L()[0]?.name??``;return}G.value=!0;let e=z.users.find(e=>e.id===B.value);if(e){U.value=e.email,W.value=e.role,G.value=!1;return}let t=await F.get(`/users/${B.value}`);G.value=!1,t.ok&&(U.value=t.data.email,W.value=t.data.role,z.setUser(t.data))});async function pe(){if(q.value=``,K.value=!0,V.value){let e=await F.patch(`/users/${B.value}`,{email:U.value.trim(),role:W.value});if(K.value=!1,!e.ok){q.value=e.error.message;return}z.setUser(e.data),R.success(`User updated.`)}else{let e=await F.post(`/users`,{email:U.value.trim(),role:W.value});if(K.value=!1,!e.ok){q.value=e.error.message;return}z.setUser(e.data),J.value=e.data.temporary_password??null,R.success(`User created.`)}}async function $(e){try{await navigator.clipboard.writeText(e),Y.value=!0,setTimeout(()=>{Y.value=!1},2e3)}catch{}}async function me(){if(!B.value)return;Z.value=!0;let e=await F.post(`/users/${B.value}/reset-password`,{});Z.value=!1,e.ok?(X.value=e.data.temporary_password,Y.value=!1):R.error(e.error.message)}async function he(){if(Q.value=!1,!B.value)return;K.value=!0;let e=await F.del(`/users/${B.value}`);if(K.value=!1,!e.ok){q.value=e.error.message;return}z.removeUser(B.value),P.push({name:`user-list`})}let ge=l(()=>V.value?U.value||`Edit user`:`New user`);return(e,o)=>G.value?(t(),a(`div`,ae,[...o[5]||=[i(`span`,{class:`inline-block h-6 w-6 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent`,"aria-hidden":`true`},null,-1)]])):(t(),a(`div`,oe,[i(`div`,se,[i(`h1`,ce,d(ge.value),1),i(`div`,le,[r(I)(`users:edit`)&&V.value&&!H.value?(t(),a(`button`,{key:0,type:`button`,disabled:Z.value,class:`rounded-md px-3 py-2 text-[13px] font-semibold text-[#3D3D52] ring-1 ring-inset ring-gray-300 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,onClick:me},d(Z.value?`Resetting…`:`Reset password`),9,ue)):u(``,!0),r(I)(`users:delete`)&&V.value&&!H.value?(t(),a(`button`,{key:1,type:`button`,disabled:K.value,class:`rounded-md px-3 py-2 text-sm font-medium text-red-600 ring-1 ring-inset ring-red-300 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-50`,onClick:o[0]||=e=>Q.value=!0},` Delete `,8,de)):u(``,!0)])]),J.value?(t(),a(`div`,b,[o[6]||=i(`p`,{class:`mb-2 text-sm font-medium text-amber-800`},` User created. Share this temporary password — it will not be shown again. `,-1),i(`div`,x,[i(`input`,{value:J.value,type:`text`,readonly:``,class:`flex-1 rounded-md border border-amber-200 bg-white px-3 py-1.5 font-mono text-sm`},null,8,S),i(`button`,{type:`button`,class:`shrink-0 rounded-md bg-amber-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-amber-700`,onClick:o[1]||=e=>$(J.value)},d(Y.value?`Copied!`:`Copy`),1)])])):u(``,!0),X.value?(t(),a(`div`,C,[o[7]||=i(`p`,{class:`mb-2 text-sm font-medium text-amber-800`},` Password reset. Share this temporary password — it will not be shown again. `,-1),i(`div`,w,[i(`input`,{value:X.value,type:`text`,readonly:``,class:`flex-1 rounded-md border border-amber-200 bg-white px-3 py-1.5 font-mono text-sm`},null,8,T),i(`button`,{type:`button`,class:`shrink-0 rounded-md bg-amber-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-amber-700`,onClick:o[2]||=e=>$(X.value)},d(Y.value?`Copied!`:`Copy`),1)])])):u(``,!0),i(`form`,{class:`space-y-5`,novalidate:``,onSubmit:p(pe,[`prevent`])},[i(`div`,null,[o[8]||=i(`label`,{for:`user-email`,class:`block text-[13px] font-semibold text-[#3D3D52]`},`Email`,-1),n(i(`input`,{id:`user-email`,"onUpdate:modelValue":o[3]||=e=>U.value=e,type:`email`,required:``,autocomplete:`email`,disabled:K.value,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},null,8,E),[[y,U.value]])]),H.value?u(``,!0):(t(),a(`div`,D,[o[10]||=i(`label`,{for:`user-role`,class:`block text-[13px] font-semibold text-[#3D3D52]`},`Role`,-1),n(i(`select`,{id:`user-role`,"onUpdate:modelValue":o[4]||=e=>W.value=e,disabled:K.value||r(L)().length===0,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},[o[9]||=i(`option`,{value:``,disabled:``},`Select a role`,-1),(t(!0),a(s,null,ee(r(L)(),e=>(t(),a(`option`,{key:e.name,value:e.name},d(e.label),9,k))),128))],8,O),[[m,W.value]]),r(L)().length===0?(t(),a(`p`,A,` No assignable roles available. `)):u(``,!0)])),q.value?(t(),a(`p`,j,d(q.value),1)):u(``,!0),(V.value?r(I)(`users:edit`):r(I)(`users:create`))?(t(),a(`button`,{key:2,type:`submit`,disabled:K.value||!U.value.trim()||!H.value&&!W.value,class:`w-full rounded-md bg-indigo-600 px-4 py-2 text-sm font-semibold text-white hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50`},d(K.value?`Saving…`:V.value?`Save changes`:`Create user`),9,M)):u(``,!0)],32),Q.value?(t(),c(re,{key:2,message:`Are you sure you want to delete this user? This action cannot be undone.`,"on-confirm":he,"on-cancel":()=>Q.value=!1},null,8,[`on-cancel`])):u(``,!0)]))}});export{N as default};
1
+ import{B as e,E as t,O as ee,P as n,W as r,c as i,d as a,g as o,i as s,l as c,s as l,u,ut as d,w as te}from"./schema-B-RKX_ep.js";import{c as f,d as p,l as m,n as h,o as g,s as _,t as v,u as y}from"./index-DHBhcS6-.js";import{t as ne}from"./useNotification-B8AtuEWL.js";import{t as re}from"./ConfirmDialog-B7nxdDge.js";import{t as ie}from"./users-DVibZ_HD.js";var ae={key:0,class:`flex items-center justify-center py-20`},oe={key:1,class:`mx-auto max-w-lg`},se={class:`mb-6 flex items-start justify-between gap-4`},ce={class:`text-[26px] font-bold tracking-tight text-ink`},le={class:`flex shrink-0 items-center gap-2`},ue=[`disabled`],de=[`disabled`],b={key:0,class:`mb-5 rounded-md border border-amber-200 bg-amber-50 p-4`,role:`alert`},x={class:`flex items-center gap-2`},S=[`value`],C={key:1,class:`mb-5 rounded-md border border-amber-200 bg-amber-50 p-4`,role:`alert`},w={class:`flex items-center gap-2`},T=[`value`],E=[`disabled`],D={key:0},O=[`disabled`],k=[`value`],A={key:0,class:`mt-1 text-xs text-gray-400`},j={key:1,class:`text-sm text-red-600`,role:`alert`},M=[`disabled`],N=o({__name:`UserFormView`,setup(o){let N=_(),P=f(),F=v(),{can:I,rolesBelow:L}=h(),R=ne(),fe=g(),z=ie(),B=l(()=>N.params.id),V=l(()=>!!B.value),H=l(()=>fe.id===B.value),U=e(``),W=e(``),G=e(!1),K=e(!1),q=e(``),J=e(null),Y=e(!1),X=e(null),Z=e(!1),Q=e(!1);te(async()=>{if(!V.value||!B.value){W.value=L()[0]?.name??``;return}G.value=!0;let e=z.users.find(e=>e.id===B.value);if(e){U.value=e.email,W.value=e.role,G.value=!1;return}let t=await F.get(`/users/${B.value}`);G.value=!1,t.ok&&(U.value=t.data.email,W.value=t.data.role,z.setUser(t.data))});async function pe(){if(q.value=``,K.value=!0,V.value){let e=await F.patch(`/users/${B.value}`,{email:U.value.trim(),role:W.value});if(K.value=!1,!e.ok){q.value=e.error.message;return}z.setUser(e.data),R.success(`User updated.`)}else{let e=await F.post(`/users`,{email:U.value.trim(),role:W.value});if(K.value=!1,!e.ok){q.value=e.error.message;return}z.setUser(e.data),J.value=e.data.temporary_password??null,R.success(`User created.`)}}async function $(e){try{await navigator.clipboard.writeText(e),Y.value=!0,setTimeout(()=>{Y.value=!1},2e3)}catch{}}async function me(){if(!B.value)return;Z.value=!0;let e=await F.post(`/users/${B.value}/reset-password`,{});Z.value=!1,e.ok?(X.value=e.data.temporary_password,Y.value=!1):R.error(e.error.message)}async function he(){if(Q.value=!1,!B.value)return;K.value=!0;let e=await F.del(`/users/${B.value}`);if(K.value=!1,!e.ok){q.value=e.error.message;return}z.removeUser(B.value),P.push({name:`user-list`})}let ge=l(()=>V.value?U.value||`Edit user`:`New user`);return(e,o)=>G.value?(t(),a(`div`,ae,[...o[5]||=[i(`span`,{class:`inline-block h-6 w-6 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent`,"aria-hidden":`true`},null,-1)]])):(t(),a(`div`,oe,[i(`div`,se,[i(`h1`,ce,d(ge.value),1),i(`div`,le,[r(I)(`users:edit`)&&V.value&&!H.value?(t(),a(`button`,{key:0,type:`button`,disabled:Z.value,class:`rounded-md px-3 py-2 text-[13px] font-semibold text-[#3D3D52] ring-1 ring-inset ring-gray-300 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,onClick:me},d(Z.value?`Resetting…`:`Reset password`),9,ue)):u(``,!0),r(I)(`users:delete`)&&V.value&&!H.value?(t(),a(`button`,{key:1,type:`button`,disabled:K.value,class:`rounded-md px-3 py-2 text-sm font-medium text-red-600 ring-1 ring-inset ring-red-300 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-50`,onClick:o[0]||=e=>Q.value=!0},` Delete `,8,de)):u(``,!0)])]),J.value?(t(),a(`div`,b,[o[6]||=i(`p`,{class:`mb-2 text-sm font-medium text-amber-800`},` User created. Share this temporary password — it will not be shown again. `,-1),i(`div`,x,[i(`input`,{value:J.value,type:`text`,readonly:``,class:`flex-1 rounded-md border border-amber-200 bg-white px-3 py-1.5 font-mono text-sm`},null,8,S),i(`button`,{type:`button`,class:`shrink-0 rounded-md bg-amber-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-amber-700`,onClick:o[1]||=e=>$(J.value)},d(Y.value?`Copied!`:`Copy`),1)])])):u(``,!0),X.value?(t(),a(`div`,C,[o[7]||=i(`p`,{class:`mb-2 text-sm font-medium text-amber-800`},` Password reset. Share this temporary password — it will not be shown again. `,-1),i(`div`,w,[i(`input`,{value:X.value,type:`text`,readonly:``,class:`flex-1 rounded-md border border-amber-200 bg-white px-3 py-1.5 font-mono text-sm`},null,8,T),i(`button`,{type:`button`,class:`shrink-0 rounded-md bg-amber-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-amber-700`,onClick:o[2]||=e=>$(X.value)},d(Y.value?`Copied!`:`Copy`),1)])])):u(``,!0),i(`form`,{class:`space-y-5`,novalidate:``,onSubmit:p(pe,[`prevent`])},[i(`div`,null,[o[8]||=i(`label`,{for:`user-email`,class:`block text-[13px] font-semibold text-[#3D3D52]`},`Email`,-1),n(i(`input`,{id:`user-email`,"onUpdate:modelValue":o[3]||=e=>U.value=e,type:`email`,required:``,autocomplete:`email`,disabled:K.value,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},null,8,E),[[y,U.value]])]),H.value?u(``,!0):(t(),a(`div`,D,[o[10]||=i(`label`,{for:`user-role`,class:`block text-[13px] font-semibold text-[#3D3D52]`},`Role`,-1),n(i(`select`,{id:`user-role`,"onUpdate:modelValue":o[4]||=e=>W.value=e,disabled:K.value||r(L)().length===0,class:`mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-indigo-400 focus:outline-none focus:ring-2 focus:ring-indigo-200 disabled:cursor-not-allowed disabled:opacity-60`},[o[9]||=i(`option`,{value:``,disabled:``},`Select a role`,-1),(t(!0),a(s,null,ee(r(L)(),e=>(t(),a(`option`,{key:e.name,value:e.name},d(e.label),9,k))),128))],8,O),[[m,W.value]]),r(L)().length===0?(t(),a(`p`,A,` No assignable roles available. `)):u(``,!0)])),q.value?(t(),a(`p`,j,d(q.value),1)):u(``,!0),(V.value?r(I)(`users:edit`):r(I)(`users:create`))?(t(),a(`button`,{key:2,type:`submit`,disabled:K.value||!U.value.trim()||!H.value&&!W.value,class:`w-full rounded-md bg-indigo-600 px-4 py-2 text-sm font-semibold text-white hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50`},d(K.value?`Saving…`:V.value?`Save changes`:`Create user`),9,M)):u(``,!0)],32),Q.value?(t(),c(re,{key:2,message:`Are you sure you want to delete this user? This action cannot be undone.`,"on-confirm":he,"on-cancel":()=>Q.value=!1},null,8,[`on-cancel`])):u(``,!0)]))}});export{N as default};
@@ -1 +1 @@
1
- import{B as e,E as t,O as n,P as r,W as i,c as a,d as o,g as s,i as c,m as l,s as u,u as d,ut as f,w as p}from"./schema-B-RKX_ep.js";import{c as m,n as h,t as g,u as _}from"./index-GvXDeXi5.js";import{t as v}from"./users-DVibZ_HD.js";var y={class:`mb-5.5 flex flex-wrap items-center justify-between gap-4`},b={key:0,class:`space-y-2`},x={key:1,class:`mb-4 flex h-9.5 items-center gap-2 rounded-[10px] border border-card-border bg-[#FBFBFD] px-2.75 text-[13px] transition-colors focus-within:border-indigo-400`},S={key:2,class:`rounded-2xl border border-dashed border-gray-300 p-12 text-center text-sm text-muted`},C={key:3,class:`rounded-2xl border border-dashed border-gray-300 p-12 text-center text-sm text-muted`},w={key:4,class:`overflow-hidden rounded-2xl border border-card-border bg-white shadow-[0_1px_2px_rgba(24,24,48,0.04),0_10px_28px_rgba(24,24,48,0.04)]`},T={class:`w-full text-sm`},E={class:`divide-y divide-[#F4F3F9]`},D=[`onClick`],O={class:`px-5.5 py-4 text-[14.5px] font-semibold text-ink`},k={class:`px-5.5 py-4`},A={class:`rounded-[7px] bg-indigo-50 px-2.5 py-1 font-mono text-xs font-medium text-indigo-600`},j={class:`px-5.5 py-4 text-[13px] text-faint`},M=s({__name:`UserListView`,setup(s){let M=m(),N=g(),{can:P}=h(),F=v(),I=e(``),L=u(()=>{let e=I.value.trim().toLowerCase();return e===``?F.users:F.users.filter(t=>t.email.toLowerCase().includes(e))});function R(e){return typeof e!=`string`||!e?`—`:new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}p(async()=>{if(F.users.length>0)return;F.loading=!0;let e=await N.get(`/users`);F.loading=!1,e.ok&&F.setUsers(e.data)});function z(e){M.push({name:`user-edit`,params:{id:e.id}})}function B(){M.push({name:`user-new`})}return(e,s)=>(t(),o(`div`,null,[a(`div`,y,[s[2]||=a(`h1`,{class:`text-[26px] font-bold tracking-tight text-ink`},`Users`,-1),i(P)(`users:create`)?(t(),o(`button`,{key:0,type:`button`,class:`inline-flex items-center gap-1.75 rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)]`,onClick:B},[...s[1]||=[a(`svg`,{width:`17`,height:`17`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},[a(`path`,{d:`M12 5v14`}),a(`path`,{d:`M5 12h14`})],-1),l(` New user `,-1)]])):d(``,!0)]),i(F).loading?(t(),o(`div`,b,[(t(),o(c,null,n(5,e=>a(`div`,{key:e,class:`h-12 animate-pulse rounded-[10px] bg-gray-100`})),64))])):i(F).users.length>0?(t(),o(`div`,x,[s[3]||=a(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`shrink-0 text-faint`},[a(`path`,{d:`M21 21l-4.3-4.3`}),a(`path`,{d:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z`})],-1),r(a(`input`,{"onUpdate:modelValue":s[0]||=e=>I.value=e,type:`text`,placeholder:`Search users…`,class:`w-full bg-transparent text-ink outline-none placeholder:text-faint`},null,512),[[_,I.value]])])):d(``,!0),!i(F).loading&&i(F).users.length===0?(t(),o(`div`,S,` No users found. `)):!i(F).loading&&L.value.length===0?(t(),o(`div`,C,` No results for “`+f(I.value.trim())+`”. `,1)):i(F).loading?d(``,!0):(t(),o(`div`,w,[a(`table`,T,[s[4]||=a(`thead`,{class:`text-[11.5px] font-bold uppercase tracking-[.06em] text-faint`},[a(`tr`,{class:`border-b border-divider`},[a(`th`,{class:`px-5.5 py-3.5 text-left`},`Email`),a(`th`,{class:`px-5.5 py-3.5 text-left`},`Role`),a(`th`,{class:`px-5.5 py-3.5 text-left`},`Created`)])],-1),a(`tbody`,E,[(t(!0),o(c,null,n(L.value,e=>(t(),o(`tr`,{key:e.id,class:`cursor-pointer transition-colors hover:bg-[#FAFAFE]`,onClick:t=>z(e)},[a(`td`,O,f(e.email),1),a(`td`,k,[a(`span`,A,f(e.role),1)]),a(`td`,j,f(R(e.created_at)),1)],8,D))),128))])])]))]))}});export{M as default};
1
+ import{B as e,E as t,O as n,P as r,W as i,c as a,d as o,g as s,i as c,m as l,s as u,u as d,ut as f,w as p}from"./schema-B-RKX_ep.js";import{c as m,n as h,t as g,u as _}from"./index-DHBhcS6-.js";import{t as v}from"./users-DVibZ_HD.js";var y={class:`mb-5.5 flex flex-wrap items-center justify-between gap-4`},b={key:0,class:`space-y-2`},x={key:1,class:`mb-4 flex h-9.5 items-center gap-2 rounded-[10px] border border-card-border bg-[#FBFBFD] px-2.75 text-[13px] transition-colors focus-within:border-indigo-400`},S={key:2,class:`rounded-2xl border border-dashed border-gray-300 p-12 text-center text-sm text-muted`},C={key:3,class:`rounded-2xl border border-dashed border-gray-300 p-12 text-center text-sm text-muted`},w={key:4,class:`overflow-hidden rounded-2xl border border-card-border bg-white shadow-[0_1px_2px_rgba(24,24,48,0.04),0_10px_28px_rgba(24,24,48,0.04)]`},T={class:`w-full text-sm`},E={class:`divide-y divide-[#F4F3F9]`},D=[`onClick`],O={class:`px-5.5 py-4 text-[14.5px] font-semibold text-ink`},k={class:`px-5.5 py-4`},A={class:`rounded-[7px] bg-indigo-50 px-2.5 py-1 font-mono text-xs font-medium text-indigo-600`},j={class:`px-5.5 py-4 text-[13px] text-faint`},M=s({__name:`UserListView`,setup(s){let M=m(),N=g(),{can:P}=h(),F=v(),I=e(``),L=u(()=>{let e=I.value.trim().toLowerCase();return e===``?F.users:F.users.filter(t=>t.email.toLowerCase().includes(e))});function R(e){return typeof e!=`string`||!e?`—`:new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}p(async()=>{if(F.users.length>0)return;F.loading=!0;let e=await N.get(`/users`);F.loading=!1,e.ok&&F.setUsers(e.data)});function z(e){M.push({name:`user-edit`,params:{id:e.id}})}function B(){M.push({name:`user-new`})}return(e,s)=>(t(),o(`div`,null,[a(`div`,y,[s[2]||=a(`h1`,{class:`text-[26px] font-bold tracking-tight text-ink`},`Users`,-1),i(P)(`users:create`)?(t(),o(`button`,{key:0,type:`button`,class:`inline-flex items-center gap-1.75 rounded-[11px] bg-indigo-600 px-4 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_3px_10px_rgba(91,87,232,0.3)] transition-all hover:bg-indigo-700 hover:shadow-[0_6px_18px_rgba(91,87,232,0.4)]`,onClick:B},[...s[1]||=[a(`svg`,{width:`17`,height:`17`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},[a(`path`,{d:`M12 5v14`}),a(`path`,{d:`M5 12h14`})],-1),l(` New user `,-1)]])):d(``,!0)]),i(F).loading?(t(),o(`div`,b,[(t(),o(c,null,n(5,e=>a(`div`,{key:e,class:`h-12 animate-pulse rounded-[10px] bg-gray-100`})),64))])):i(F).users.length>0?(t(),o(`div`,x,[s[3]||=a(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`shrink-0 text-faint`},[a(`path`,{d:`M21 21l-4.3-4.3`}),a(`path`,{d:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z`})],-1),r(a(`input`,{"onUpdate:modelValue":s[0]||=e=>I.value=e,type:`text`,placeholder:`Search users…`,class:`w-full bg-transparent text-ink outline-none placeholder:text-faint`},null,512),[[_,I.value]])])):d(``,!0),!i(F).loading&&i(F).users.length===0?(t(),o(`div`,S,` No users found. `)):!i(F).loading&&L.value.length===0?(t(),o(`div`,C,` No results for “`+f(I.value.trim())+`”. `,1)):i(F).loading?d(``,!0):(t(),o(`div`,w,[a(`table`,T,[s[4]||=a(`thead`,{class:`text-[11.5px] font-bold uppercase tracking-[.06em] text-faint`},[a(`tr`,{class:`border-b border-divider`},[a(`th`,{class:`px-5.5 py-3.5 text-left`},`Email`),a(`th`,{class:`px-5.5 py-3.5 text-left`},`Role`),a(`th`,{class:`px-5.5 py-3.5 text-left`},`Created`)])],-1),a(`tbody`,E,[(t(!0),o(c,null,n(L.value,e=>(t(),o(`tr`,{key:e.id,class:`cursor-pointer transition-colors hover:bg-[#FAFAFE]`,onClick:t=>z(e)},[a(`td`,O,f(e.email),1),a(`td`,k,[a(`span`,A,f(e.role),1)]),a(`td`,j,f(R(e.created_at)),1)],8,D))),128))])])]))]))}});export{M as default};
@@ -1,4 +1,4 @@
1
- import{B as e,C as t,E as n,F as r,H as i,L as a,M as o,O as s,P as c,S as l,W as u,_ as d,c as f,ct as p,d as m,g as h,i as g,j as _,l as v,m as y,s as b,u as x,ut as S,v as C,w}from"./schema-B-RKX_ep.js";import{i as ee,l as T,u as E}from"./index-GvXDeXi5.js";function D(){let t=e({}),n=e(new Set);function r(e){n.value.add(e)}function i(e,n){t.value[e]=n}function a(){t.value={},n.value=new Set}function o(e){for(let{field:n,message:r}of e)t.value[n]=r}function s(e,r,i=!1){if(i)for(let t of e)n.value.add(t.name);let a=!0;for(let i of e){let e=r[i.name],o=c(i,e);o?(a=!1,n.value.has(i.name)&&(t.value[i.name]=o)):delete t.value[i.name]}return a}function c(e,t){let{required:n,pattern:r,min:i,max:a,max_items:o,allowed_values:s}=e.validation;if(n&&l(t))return`${e.label} is required.`;if(l(t))return null;if(r&&typeof t==`string`&&!new RegExp(r).test(t))return`${e.label} is not in the correct format.`;if(typeof t==`number`){if(i!==void 0&&t<i)return`${e.label} must be at least ${i}.`;if(a!==void 0&&t>a)return`${e.label} must be at most ${a}.`}return s&&s.length>0&&typeof t==`string`&&!s.includes(t)?`${e.label} must be one of: ${s.join(`, `)}.`:o!==void 0&&Array.isArray(t)&&t.length>o?`${e.label} can have at most ${o} items.`:null}function l(e){return e==null||e===``}return{errors:t,touched:n,touch:r,setError:i,clearErrors:a,mergeServerErrors:o,validate:s}}var O=[`for`],te={key:0,class:`ml-0.5 text-red-500`,"aria-hidden":`true`},k={class:`mt-1`},A=[`id`,`value`,`disabled`,`placeholder`],j={key:0,class:`mt-1 text-xs text-gray-500`},ne={class:`font-mono`},re={key:1,class:`mt-1 text-sm text-red-600`,role:`alert`},ie=h({__name:`TextInput`,props:{field:{},modelValue:{},error:{},disabled:{type:Boolean}},emits:[`update:modelValue`],setup(t,{emit:r}){let i=t,a=r,o=b(()=>i.field.name===`slug`||i.field.name.endsWith(`_slug`)),s=e(typeof i.modelValue==`string`?i.modelValue:``);_(()=>i.modelValue,e=>{typeof e==`string`&&e!==s.value&&(s.value=e)});function c(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``)}let l=b(()=>o.value?c(s.value):``);function u(e){let t=e.target.value;s.value=t,a(`update:modelValue`,o.value?c(t):t)}return(e,r)=>(n(),m(`div`,null,[f(`label`,{for:t.field.name,class:`block text-[13px] font-semibold text-[#3D3D52]`},[y(S(t.field.label)+` `,1),t.field.required?(n(),m(`span`,te,`*`)):x(``,!0)],8,O),f(`div`,k,[f(`input`,{id:t.field.name,type:`text`,value:s.value,disabled:t.disabled,placeholder:t.field.label,class:p([`block w-full rounded-[11px] border px-3.5 py-3 text-sm focus:outline-none focus:ring-[3px]`,t.error?`border-red-300 focus:border-red-400 focus:ring-red-200`:`border-[#E4E3EE] bg-[#FBFBFD] focus:border-indigo-400 focus:bg-white focus:ring-indigo-50`,t.disabled&&`cursor-not-allowed bg-gray-50 opacity-60`]),onInput:u},null,42,A)]),o.value&&s.value?(n(),m(`p`,j,[r[0]||=y(` Slug: `,-1),f(`span`,ne,S(l.value),1)])):x(``,!0),t.error?(n(),m(`p`,re,S(t.error),1)):x(``,!0)]))}});function M(e){this.content=e}M.prototype={constructor:M,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new M(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new M(n)},addToStart:function(e,t){return new M([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new M(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new M(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=M.from(e),e.size?new M(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=M.from(e),e.size?new M(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=M.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},M.from=function(e){if(e instanceof M)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new M(t)};function ae(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&ce(e.charCodeAt(r-1))&&se(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=ae(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function oe(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&ce(e.charCodeAt(i-1))&&se(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=oe(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function se(e){return e>=56320&&e<57344}function ce(e){return e>=55296&&e<56320}var N=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return ae(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return oe(this,e,t,n)}findIndex(e){if(e==0)return ue(0,e);if(e==this.size)return ue(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?ue(t+1,i):ue(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};N.empty=new N([],0);var le={index:0,offset:0};function ue(e,t){return le.index=e,le.offset=t,le}function de(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!de(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!de(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var P=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&de(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};P.none=[];var fe=class extends Error{},F=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=me(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(pe(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(N.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};F.empty=new F(N.empty,0,0);function pe(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(pe(a.content,t-i-1,n-i-1)))}function me(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=me(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function he(e,t,n){if(n.openStart>e.depth)throw new fe(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new fe(`Inconsistent open depths`);return ge(e,t,n,0)}function ge(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=ge(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return xe(a,Ce(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return xe(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=we(n,e);return xe(a,Se(e,i,o,t,r))}}function _e(e,t){if(!t.type.compatibleContent(e.type))throw new fe(`Cannot join `+t.type.name+` onto `+e.type.name)}function ve(e,t,n){let r=e.node(n);return _e(r,t.node(n)),r}function ye(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function be(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(ye(e.nodeAfter,r),a++));for(let e=a;e<o;e++)ye(i.child(e),r);t&&t.depth==n&&t.textOffset&&ye(t.nodeBefore,r)}function xe(e,t){if(!e.type.validContent(t))throw new fe(`Invalid content for node `+e.type.name);return e.copy(t)}function Se(e,t,n,r,i){let a=e.depth>i&&ve(e,t,i+1),o=r.depth>i&&ve(n,r,i+1),s=[];return be(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(_e(a,o),ye(xe(a,Se(e,t,n,r,i+1)),s)):(a&&ye(xe(a,Ce(e,t,i+1)),s),be(t,n,i,s),o&&ye(xe(o,Ce(n,r,i+1)),s)),be(r,null,i,s),new N(s)}function Ce(e,t,n){let r=[];return be(null,e,n,r),e.depth>n&&ye(xe(ve(e,t,n+1),Ce(e,t,n+1)),r),be(t,null,n,r),new N(r)}function we(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(N.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Te=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return P.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ke(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Oe.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Oe.set(t,r=new Ee);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%De,i}},Ee=class{constructor(){this.elts=[],this.i=0}},De=12,Oe=new WeakMap,ke=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},Ae=Object.create(null),je=class e{constructor(e,t,n,r=P.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||N.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&de(this.attrs,t||e.defaultAttrs||Ae)&&P.sameSet(this.marks,n||P.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return F.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new F(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return he(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Te.resolveCached(this,e)}resolveNoCache(e){return Te.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),Ne(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=N.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=P.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!P.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=N.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};je.prototype.text=void 0;var Me=class e extends je{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ne(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Ne(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Pe=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Fe(t,n);if(r.next==null)return e.empty;let i=Ie(r);r.next&&r.err(`Unexpected trailing text`);let a=Ke(Ue(i));return qe(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return N.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
1
+ import{B as e,C as t,E as n,F as r,H as i,L as a,M as o,O as s,P as c,S as l,W as u,_ as d,c as f,ct as p,d as m,g as h,i as g,j as _,l as v,m as y,s as b,u as x,ut as S,v as C,w}from"./schema-B-RKX_ep.js";import{i as ee,l as T,u as E}from"./index-DHBhcS6-.js";function D(){let t=e({}),n=e(new Set);function r(e){n.value.add(e)}function i(e,n){t.value[e]=n}function a(){t.value={},n.value=new Set}function o(e){for(let{field:n,message:r}of e)t.value[n]=r}function s(e,r,i=!1){if(i)for(let t of e)n.value.add(t.name);let a=!0;for(let i of e){let e=r[i.name],o=c(i,e);o?(a=!1,n.value.has(i.name)&&(t.value[i.name]=o)):delete t.value[i.name]}return a}function c(e,t){let{required:n,pattern:r,min:i,max:a,max_items:o,allowed_values:s}=e.validation;if(n&&l(t))return`${e.label} is required.`;if(l(t))return null;if(r&&typeof t==`string`&&!new RegExp(r).test(t))return`${e.label} is not in the correct format.`;if(typeof t==`number`){if(i!==void 0&&t<i)return`${e.label} must be at least ${i}.`;if(a!==void 0&&t>a)return`${e.label} must be at most ${a}.`}return s&&s.length>0&&typeof t==`string`&&!s.includes(t)?`${e.label} must be one of: ${s.join(`, `)}.`:o!==void 0&&Array.isArray(t)&&t.length>o?`${e.label} can have at most ${o} items.`:null}function l(e){return e==null||e===``}return{errors:t,touched:n,touch:r,setError:i,clearErrors:a,mergeServerErrors:o,validate:s}}var O=[`for`],te={key:0,class:`ml-0.5 text-red-500`,"aria-hidden":`true`},k={class:`mt-1`},A=[`id`,`value`,`disabled`,`placeholder`],j={key:0,class:`mt-1 text-xs text-gray-500`},ne={class:`font-mono`},re={key:1,class:`mt-1 text-sm text-red-600`,role:`alert`},ie=h({__name:`TextInput`,props:{field:{},modelValue:{},error:{},disabled:{type:Boolean}},emits:[`update:modelValue`],setup(t,{emit:r}){let i=t,a=r,o=b(()=>i.field.name===`slug`||i.field.name.endsWith(`_slug`)),s=e(typeof i.modelValue==`string`?i.modelValue:``);_(()=>i.modelValue,e=>{typeof e==`string`&&e!==s.value&&(s.value=e)});function c(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``)}let l=b(()=>o.value?c(s.value):``);function u(e){let t=e.target.value;s.value=t,a(`update:modelValue`,o.value?c(t):t)}return(e,r)=>(n(),m(`div`,null,[f(`label`,{for:t.field.name,class:`block text-[13px] font-semibold text-[#3D3D52]`},[y(S(t.field.label)+` `,1),t.field.required?(n(),m(`span`,te,`*`)):x(``,!0)],8,O),f(`div`,k,[f(`input`,{id:t.field.name,type:`text`,value:s.value,disabled:t.disabled,placeholder:t.field.label,class:p([`block w-full rounded-[11px] border px-3.5 py-3 text-sm focus:outline-none focus:ring-[3px]`,t.error?`border-red-300 focus:border-red-400 focus:ring-red-200`:`border-[#E4E3EE] bg-[#FBFBFD] focus:border-indigo-400 focus:bg-white focus:ring-indigo-50`,t.disabled&&`cursor-not-allowed bg-gray-50 opacity-60`]),onInput:u},null,42,A)]),o.value&&s.value?(n(),m(`p`,j,[r[0]||=y(` Slug: `,-1),f(`span`,ne,S(l.value),1)])):x(``,!0),t.error?(n(),m(`p`,re,S(t.error),1)):x(``,!0)]))}});function M(e){this.content=e}M.prototype={constructor:M,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new M(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new M(n)},addToStart:function(e,t){return new M([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new M(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new M(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=M.from(e),e.size?new M(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=M.from(e),e.size?new M(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=M.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},M.from=function(e){if(e instanceof M)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new M(t)};function ae(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&ce(e.charCodeAt(r-1))&&se(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=ae(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function oe(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&ce(e.charCodeAt(i-1))&&se(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=oe(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function se(e){return e>=56320&&e<57344}function ce(e){return e>=55296&&e<56320}var N=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return ae(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return oe(this,e,t,n)}findIndex(e){if(e==0)return ue(0,e);if(e==this.size)return ue(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?ue(t+1,i):ue(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};N.empty=new N([],0);var le={index:0,offset:0};function ue(e,t){return le.index=e,le.offset=t,le}function de(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!de(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!de(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var P=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&de(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};P.none=[];var fe=class extends Error{},F=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=me(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(pe(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(N.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};F.empty=new F(N.empty,0,0);function pe(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(pe(a.content,t-i-1,n-i-1)))}function me(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=me(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function he(e,t,n){if(n.openStart>e.depth)throw new fe(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new fe(`Inconsistent open depths`);return ge(e,t,n,0)}function ge(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=ge(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return xe(a,Ce(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return xe(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=we(n,e);return xe(a,Se(e,i,o,t,r))}}function _e(e,t){if(!t.type.compatibleContent(e.type))throw new fe(`Cannot join `+t.type.name+` onto `+e.type.name)}function ve(e,t,n){let r=e.node(n);return _e(r,t.node(n)),r}function ye(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function be(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(ye(e.nodeAfter,r),a++));for(let e=a;e<o;e++)ye(i.child(e),r);t&&t.depth==n&&t.textOffset&&ye(t.nodeBefore,r)}function xe(e,t){if(!e.type.validContent(t))throw new fe(`Invalid content for node `+e.type.name);return e.copy(t)}function Se(e,t,n,r,i){let a=e.depth>i&&ve(e,t,i+1),o=r.depth>i&&ve(n,r,i+1),s=[];return be(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(_e(a,o),ye(xe(a,Se(e,t,n,r,i+1)),s)):(a&&ye(xe(a,Ce(e,t,i+1)),s),be(t,n,i,s),o&&ye(xe(o,Ce(n,r,i+1)),s)),be(r,null,i,s),new N(s)}function Ce(e,t,n){let r=[];return be(null,e,n,r),e.depth>n&&ye(xe(ve(e,t,n+1),Ce(e,t,n+1)),r),be(t,null,n,r),new N(r)}function we(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(N.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Te=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return P.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ke(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Oe.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Oe.set(t,r=new Ee);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%De,i}},Ee=class{constructor(){this.elts=[],this.i=0}},De=12,Oe=new WeakMap,ke=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},Ae=Object.create(null),je=class e{constructor(e,t,n,r=P.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||N.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&de(this.attrs,t||e.defaultAttrs||Ae)&&P.sameSet(this.marks,n||P.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return F.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new F(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return he(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Te.resolveCached(this,e)}resolveNoCache(e){return Te.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),Ne(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=N.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=P.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!P.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=N.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};je.prototype.text=void 0;var Me=class e extends je{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ne(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Ne(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Pe=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Fe(t,n);if(r.next==null)return e.empty;let i=Ie(r);r.next&&r.err(`Unexpected trailing text`);let a=Ke(Ue(i));return qe(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return N.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
2
2
  `)}};Pe.empty=new Pe(!0);var Fe=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Ie(e){let t=[];do t.push(Le(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Le(e){let t=[];do t.push(Re(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Re(e){let t=He(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Be(e,t);else break;return t}function ze(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Be(e,t){let n=ze(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:ze(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Ve(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function He(e){if(e.eat(`(`)){let t=Ie(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Ve(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Ue(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function We(e,t){return t-e}function Ge(e,t){let n=[];return r(t),n.sort(We);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Ke(e){let t=Object.create(null);return n(Ge(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Ge(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Pe(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(We);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function qe(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Je(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Ye(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Xe(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function Ze(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new et(e,r,t[r]);return n}var Qe=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=Ze(e,n.attrs),this.defaultAttrs=Je(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Pe.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ye(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new je(this,this.computeAttrs(e),N.from(t),P.setFrom(n))}createChecked(e=null,t,n){return t=N.from(t),this.checkContent(t),new je(this,this.computeAttrs(e),t,P.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=N.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(N.empty,!0);return i?new je(this,e,t.append(i),P.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Xe(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:P.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function $e(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var et=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?$e(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},tt=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Ze(e,r.attrs),this.excluded=null;let i=Je(this.attrs);this.instance=i?new P(this,i):null}create(e=null){return!e&&this.instance?this.instance:new P(this,Ye(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Xe(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},nt=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=M.from(e.nodes),t.marks=M.from(e.marks||{}),this.nodes=Qe.compile(this.spec.nodes,this),this.marks=tt.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Pe.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?rt(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:rt(this,n.split(` `))}this.nodeFromJSON=e=>je.fromJSON(this,e),this.markFromJSON=e=>P.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Qe))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Me(n,n.defaultAttrs,e,P.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function rt(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function it(e){return e.tag!=null}function at(e){return e.style!=null}var ot=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(it(e))this.tags.push(e);else if(at(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new ht(this,t,!1);return n.addAll(e,P.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new ht(this,t,!0);return n.addAll(e,P.none,t.from,t.to),F.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(_t(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=vt(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=vt(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},st={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ct={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},lt={ol:!0,ul:!0},ut=1,dt=2,ft=4;function pt(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?ut:0)|(t===`full`?dt:0)}var mt=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=P.none,this.match=i||(a&ft?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(N.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ut)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=N.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(N.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!st.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},ht=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=pt(null,t.preserveWhitespace,0)|(n?ft:0);i=r?new mt(r.type,r.attrs,P.none,!0,t.topMatch||r.type.contentMatch,a):n?new mt(null,null,P.none,!0,null,a):new mt(e.schema.topNodeType,null,P.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&dt?`full`:this.localPreserveWS||(r.options&ut)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
3
3
  `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;lt.hasOwnProperty(a)&&this.parser.normalizeLists&&gt(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:ct.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(st.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=P.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):yt(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=pt(e,i,a.options);a.options&ft&&a.content.length==0&&(o|=ft);let s=P.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):yt(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new mt(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=ut);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function gt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&lt.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function _t(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function vt(e){let t={};for(let n in e)t[n]=e[n];return t}function yt(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var bt=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=St(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return St(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Et(St(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Et(St(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Et(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=xt(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return xt(e.marks)}};function xt(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function St(e){return e.document||window.document}var Ct=new WeakMap;function wt(e){let t=Ct.get(e);return t===void 0&&Ct.set(e,t=Tt(e)),t}function Tt(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function Et(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=wt(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=Et(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Dt=65535,Ot=2**16;function kt(e,t){return e+t*Ot}function At(e){return e&Dt}function jt(e){return(e-(e&Dt))/Ot}var Mt=1,Nt=2,Pt=4,Ft=8,It=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Ft)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&Pt)>0}},Lt=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=At(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+jt(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:kt(o/3,e-s),f=e==s?Nt:e==u?Mt:Pt;return(t<0?e!=s:e!=u)&&(f|=Ft),new It(a,f,d)}r+=l-c}return n?e+r:new It(e+r,0,null)}touches(e,t){let n=0,r=At(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Lt.empty=new Lt([]);var Rt=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new It(e,r,null)}},zt=Object.create(null),I=class{getMap(){return Lt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=zt[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in zt)throw RangeError(`Duplicate use of step JSON ID `+e);return zt[e]=t,t.prototype.jsonID=e,t}},Bt=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof fe)return e.fail(t.message);throw t}}};function Vt(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Vt(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return N.fromArray(r)}var Ht=class e extends I{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new F(Vt(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return Bt.fromReplace(e,this.from,this.to,i)}invert(){return new Ut(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};I.jsonID(`addMark`,Ht);var Ut=class e extends I{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new F(Vt(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return Bt.fromReplace(e,this.from,this.to,n)}invert(){return new Ht(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};I.jsonID(`removeMark`,Ut);var Wt=class e extends I{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Bt.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Bt.fromReplace(e,this.pos,this.pos+1,new F(N.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Gt(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};I.jsonID(`addNodeMark`,Wt);var Gt=class e extends I{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Bt.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Bt.fromReplace(e,this.pos,this.pos+1,new F(N.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Wt(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};I.jsonID(`removeNodeMark`,Gt);var Kt=class e extends I{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Jt(e,this.from,this.to)?Bt.fail(`Structure replace would overwrite content`):Bt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Lt([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?F.empty:new F(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?F.empty:new F(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,F.fromJSON(t,n.slice),!!n.structure)}};Kt.MAP_BIAS=1,I.jsonID(`replace`,Kt);var qt=class e extends I{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(Jt(e,this.from,this.gapFrom)||Jt(e,this.gapTo,this.to)))return Bt.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Bt.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?Bt.fromReplace(e,this.from,this.to,n):Bt.fail(`Content does not fit in gap`)}getMap(){return new Lt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,F.fromJSON(t,n.slice),n.insert,!!n.structure)}};I.jsonID(`replaceAround`,qt);function Jt(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Yt(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new Ut(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new Ht(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function Xt(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof tt){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new Ut(t.from,t.to,t.style)))}function Zt(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Kt(s,l,F.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new Ut(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new F(N.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new Kt(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(N.empty,!0);e.replace(s,s,new F(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function Qt(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function $t(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!Qt(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function en(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=N.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=N.from(r.node(e).copy(u)),d++):c--;let f=N.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=N.from(i.node(e).copy(f)),p++):l++;e.step(new qt(c,l,o,s,new F(u.append(f),d,p),u.size-d,!0))}function tn(e,t,n=null,r=e){let i=rn(e,t),a=i&&an(r,t);return a?i.map(nn).concat({type:t,attrs:n}).concat(a.map(nn)):null}function nn(e){return{type:e,attrs:null}}function rn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function an(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function on(e,t,n){let r=N.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=N.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new qt(i,a,i,a,new F(r,0,0),n.length,!0))}function sn(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&un(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&ln(e,t,n,a),Zt(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new qt(c,l,c+1,l-1,new F(N.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&cn(e,t,n,a),!1}})}function cn(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function ln(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`