@oktis-works/admin 0.5.4 → 0.5.5

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 (72) hide show
  1. package/dist/client/_astro/{ActivityWidget.BNFwjO71.js → ActivityWidget.CLFjbNJf.js} +1 -1
  2. package/dist/client/_astro/{AdminBar.DRgRB1PC.js → AdminBar.CKYNoMCz.js} +1 -1
  3. package/dist/client/_astro/{AtGlanceWidget.h60KI_JU.js → AtGlanceWidget.rW3GsIjs.js} +1 -1
  4. package/dist/client/_astro/{ContentEditor.BDb6qSSI.js → ContentEditor.BmpwqkNT.js} +1 -1
  5. package/dist/client/_astro/ContentEditor.saSUoKf0.js +1 -0
  6. package/dist/client/_astro/ContentTypeWorkspace.00bHkcJD.js +1 -0
  7. package/dist/client/_astro/{DashboardHome.1vPxu78E.js → DashboardHome.DCz0EiH2.js} +1 -1
  8. package/dist/client/_astro/{DashboardLayout.astro_astro_type_script_index_0_lang.D3odZySo.js → DashboardLayout.astro_astro_type_script_index_0_lang.DdRNBOsR.js} +1 -1
  9. package/dist/client/_astro/{FieldGroupEditor.C9U6-zxk.js → FieldGroupEditor.Bdm2FW0L.js} +1 -1
  10. package/dist/client/_astro/{FieldGroupList.DYFBUBY7.js → FieldGroupList.BaNTs6an.js} +1 -1
  11. package/dist/client/_astro/{Footer.BwLmoHuk.js → Footer.BqulPU-0.js} +1 -1
  12. package/dist/client/_astro/GeneralSettings.BH-f6pL0.js +1 -0
  13. package/dist/client/_astro/{LogsManager.CBwBkCUP.js → LogsManager.1c_AlgX8.js} +1 -1
  14. package/dist/client/_astro/MediaLibrary.DH7eqign.js +1 -0
  15. package/dist/client/_astro/{MenuManager.BhYhygsR.js → MenuManager.CLPv5Ths.js} +1 -1
  16. package/dist/client/_astro/{PluginManager.DxAKvMfM.js → PluginManager.Duzn64IF.js} +1 -1
  17. package/dist/client/_astro/{PostTypesManager.DLymaQPT.js → PostTypesManager.BHKbIEwD.js} +1 -1
  18. package/dist/client/_astro/{QuickDraftWidget.CfUR8qmY.js → QuickDraftWidget.DLKpQRu8.js} +1 -1
  19. package/dist/client/_astro/{ResourceHubs.BnINa0O3.js → ResourceHubs.CL3KxW6a.js} +1 -1
  20. package/dist/client/_astro/{TaxonomiesManager.1EZYO2u5.js → TaxonomiesManager.DEwFIIP9.js} +1 -1
  21. package/dist/client/_astro/{TaxonomyTermsManager.YXbuam33.js → TaxonomyTermsManager.DWljfgZH.js} +1 -1
  22. package/dist/client/_astro/{ThemeManager.EFMZJdmx.js → ThemeManager.CAGeBTsz.js} +1 -1
  23. package/dist/client/_astro/{UserCreateForm.C_m7ovUU.js → UserCreateForm.wCOVD_YS.js} +1 -1
  24. package/dist/client/_astro/UsersManager.RHbgYhoE.js +1 -0
  25. package/dist/client/_astro/{WebhooksManager.CKRtabi3.js → WebhooksManager.B-g7Wbit.js} +1 -1
  26. package/dist/client/_astro/api.CGA0D2A2.js +1 -0
  27. package/dist/client/_astro/extensions.CKCZC04g.js +1 -0
  28. package/dist/client/_astro/{i18n.EKfvSb1v.js → i18n.3zKFZ7KU.js} +1 -1
  29. package/dist/client/_astro/{login.astro_astro_type_script_index_0_lang.D8XVBan6.js → login.astro_astro_type_script_index_0_lang.DzXBvx_L.js} +1 -1
  30. package/dist/client/_astro/src.DQwsXUur.js +1 -0
  31. package/dist/client/_astro/{version.B4bPYHRP.js → version.DMCc00VQ.js} +1 -1
  32. package/dist/server/chunks/{ContentEditor_DfYDk5IM.mjs → ContentEditor_BJIimcCo.mjs} +525 -2
  33. package/dist/server/chunks/{DashboardLayout_7Gcd6oTS.mjs → DashboardLayout_65mMCENw.mjs} +9 -6
  34. package/dist/server/chunks/{MediaLibrary_fu8AtNog.mjs → MediaLibrary_C0RSa4ta.mjs} +2 -2
  35. package/dist/server/chunks/{_id__BVLdyCKg.mjs → _id__DxVKarzj.mjs} +2 -2
  36. package/dist/server/chunks/{_slug__DG6xjEan.mjs → _slug__CzAHP75q.mjs} +1 -1
  37. package/dist/server/chunks/{access_B8fU0pWq.mjs → access_Ckqo1E-w.mjs} +2 -2
  38. package/dist/server/chunks/{custom-fields_BOqCiSPQ.mjs → custom-fields_Bahyrq-n.mjs} +2 -2
  39. package/dist/server/chunks/{dist_D98LO9y-.mjs → dist_CP9QIrJI.mjs} +2 -1394
  40. package/dist/server/chunks/{edit_C27RHq7N.mjs → edit_D5xfX3vT.mjs} +2 -2
  41. package/dist/server/chunks/{general_TSviTaPT.mjs → general_Cl6S80ws.mjs} +2 -2
  42. package/dist/server/chunks/{i18n_Co0XNC0I.mjs → i18n_B-Vk5esc.mjs} +4 -1
  43. package/dist/server/chunks/{index_BwaqRmvv.mjs → index_-cQPQBUp.mjs} +2 -2
  44. package/dist/server/chunks/{index_t5k7sOZ8.mjs → index_BHrQe5Hj.mjs} +3 -3
  45. package/dist/server/chunks/{index_CCNhQxvS.mjs → index_C2ozXuTS.mjs} +2 -2
  46. package/dist/server/chunks/{index_40l_yCUu.mjs → index_C58uHJZI.mjs} +1 -1
  47. package/dist/server/chunks/{index_CRSTdqw0.mjs → index_DqA4Ie-S.mjs} +2 -2
  48. package/dist/server/chunks/{logs_DrjJ6S6J.mjs → logs_Bf4fqT8n.mjs} +2 -2
  49. package/dist/server/chunks/{menus_DjfOcrez.mjs → menus_Cq6sQKRq.mjs} +2 -2
  50. package/dist/server/chunks/{new_DNNbQ1Zw.mjs → new_B-geMMoa.mjs} +2 -2
  51. package/dist/server/chunks/{new_B484WwaA.mjs → new_DM3-Wq-j.mjs} +2 -2
  52. package/dist/server/chunks/{node_CECPlmah.mjs → node_kWZa8y--.mjs} +1 -1
  53. package/dist/server/chunks/{plugins_Bhuk-oUR.mjs → plugins_BnnK185w.mjs} +2 -2
  54. package/dist/server/chunks/{post-types_BtisIanW.mjs → post-types_BJz6Zjgo.mjs} +2 -2
  55. package/dist/server/chunks/semver_WbqCUY_o.mjs +1395 -0
  56. package/dist/server/chunks/{sharp_DQfjpH-u.mjs → sharp_37gnUicY.mjs} +2 -2
  57. package/dist/server/chunks/{taxonomies_CHJK2gT1.mjs → taxonomies_ygpYI9wq.mjs} +2 -2
  58. package/dist/server/chunks/{taxonomy_DboKpEOu.mjs → taxonomy_b8pfYEmY.mjs} +2 -2
  59. package/dist/server/chunks/{themes_MC8vERGL.mjs → themes_M56sjN9n.mjs} +2 -2
  60. package/dist/server/chunks/{upload_BMoVV-rt.mjs → upload_B2dn_wjn.mjs} +2 -2
  61. package/dist/server/chunks/{webhooks_EHN9q7Yv.mjs → webhooks_BlAAcsf_.mjs} +2 -2
  62. package/dist/server/entry.mjs +24 -24
  63. package/dist/server/virtual_astro_middleware.mjs +1 -1
  64. package/package.json +5 -5
  65. package/dist/client/_astro/ContentEditor.QGAstGzA.js +0 -1
  66. package/dist/client/_astro/ContentTypeWorkspace.K35mfD2P.js +0 -1
  67. package/dist/client/_astro/GeneralSettings.EU3z_sSD.js +0 -1
  68. package/dist/client/_astro/MediaLibrary.D56bkgPF.js +0 -1
  69. package/dist/client/_astro/UsersManager.t4-9GwDK.js +0 -1
  70. package/dist/client/_astro/api.CM0tblEa.js +0 -1
  71. package/dist/client/_astro/dist.D-evrPNi.js +0 -1
  72. package/dist/client/_astro/extensions.OpEcHTzv.js +0 -1
@@ -1 +1 @@
1
- import{d as e,i as t,p as n,r,s as i,u as a,v as o}from"./solid.8gBSxpeo.js";import{a as s,c,d as l,f as u,i as d,m as f,r as p,s as m,u as h}from"./web.DwNv8rLL.js";import{n as g}from"./i18n.EKfvSb1v.js";import{t as _}from"./api.CM0tblEa.js";var v=f(`<div class=wp-menu-empty-level>`),y=f(`<div class=wp-menu-tree><!$><!/><!$><!/>`),b=f(`<article class=wp-menu-item><div class=wp-menu-item__header><span class=wp-menu-drag draggable=true>⠿⠿⠿</span><span class=wp-menu-item__label><strong></strong><small></small></span><div class=wp-menu-item__actions><button type=button class="btn btn-sm">↑</button><button type=button class="btn btn-sm">↓</button><button type=button class="btn btn-sm">→</button><button type=button class="btn btn-sm">←</button></div></div><details class=wp-menu-item__details><summary></summary><div class=wp-menu-item__fields><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><select class=input><option value=_self></option><option value=_blank></option></select></label><label><!$><!/><input class=input></label><label class=wp-menu-item__wide><!$><!/><textarea class=input rows=2></textarea></label><button type=button class="btn btn-danger btn-sm"></button></div></details><!$><!/>`),x=f(`<p class=muted>`),S=f(`<details class=wp-menu-box><summary></summary><div class=wp-menu-box__body><!$><!/><!$><!/>`),C=f(`<div class="notice notice--error">`),w=f(`<div class=notice>`),T=f(`<div class="menus-manager wp-menus-manager"><!$><!/><!$><!/><!$><!/><style>.wp-menu-editor__top,.wp-structure-heading,.wp-menu-editor__identity,.wp-menu-item__header,.wp-menu-item__actions,.form-actions{display:flex;align-items:center;gap:.7rem}.wp-menu-editor__top,.wp-structure-heading{justify-content:space-between}.wp-menu-editor__top{margin-bottom:1rem}.wp-menu-editor__top h3{margin:.25rem 0 0}.wp-eyebrow{display:block;margin-top:.7rem;font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;color:var(--color-muted)}.wp-menu-editor__identity{margin-bottom:1rem;align-items:end}.wp-menu-editor__identity label{display:grid;gap:.35rem;flex:1}.wp-menu-editor__columns{display:grid;grid-template-columns:330px minmax(0,1fr);gap:1.2rem;align-items:start}.wp-menu-sources,.wp-menu-structure{min-width:0}.wp-menu-sources>h4,.wp-structure-heading h4{margin:0}.wp-menu-box{background:var(--color-surface,#fff);border:1px solid var(--color-border,#ddd);margin-bottom:.7rem}.wp-menu-box summary{cursor:pointer;padding:.8rem;font-weight:600}.wp-menu-box__body{padding:0 .8rem .8rem;display:grid;gap:.6rem}.wp-menu-box__body p{margin:0}.wp-source-list{display:grid;gap:.35rem;max-height:220px;overflow:auto;border:1px solid var(--color-border,#ddd);padding:.45rem}.wp-source-row{display:flex!important;align-items:start;gap:.45rem!important;padding:.3rem}.wp-source-row span,.wp-source-link{display:grid;gap:.12rem;text-align:left}.wp-source-row small,.wp-source-link small,.wp-menu-item__label small{color:var(--color-muted);font-size:.75rem}.wp-source-link{border:0;background:none;color:inherit;padding:.35rem;width:100%;cursor:pointer}.wp-source-link:hover{background:var(--color-surface-muted,#f5f5f5)}.wp-taxonomy-source{display:grid;gap:.2rem;border-top:1px solid var(--color-border,#ddd);padding-top:.5rem}.wp-taxonomy-source:first-child{border-top:0;padding-top:0}.wp-menu-structure{background:var(--color-surface-muted,#f7f7f7);padding:1rem}.wp-menu-structure .wp-structure-heading{margin-bottom:1rem}.wp-menu-tree{display:grid;gap:.55rem}.wp-menu-tree[data-depth="1"]{margin:.55rem 0 0 2rem}.wp-menu-item{background:var(--color-surface,#fff);border:1px solid var(--color-border,#dcdcde);box-shadow:0 1px 1px rgba(0,0,0,.04)}.wp-menu-item__header{padding:.55rem .7rem}.wp-menu-drag{cursor:grab;letter-spacing:-.2rem;width:1.4rem;color:var(--color-muted);user-select:none}.wp-menu-item__label{display:grid;gap:.15rem;flex:1;min-width:0}.wp-menu-item__label small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-menu-item__actions{margin-left:auto}.wp-menu-item__details{border-top:1px solid var(--color-border,#ddd)}.wp-menu-item__details summary{padding:.5rem .7rem;cursor:pointer;color:var(--color-muted);font-size:.85rem}.wp-menu-item__fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.7rem;padding:.7rem;border-top:1px solid var(--color-border,#ddd)}.wp-menu-item__fields label{display:grid;gap:.3rem}.wp-menu-item__wide{grid-column:1/-1}.wp-menu-empty,.wp-menu-empty-level{text-align:center;padding:2rem;color:var(--color-muted)}.wp-menu-empty-level{border:1px dashed var(--color-border,#ccc);padding:1rem}.wp-menu-settings{margin-top:1rem}.wp-menu-settings h4{margin-top:0}.wp-menu-settings p{margin-bottom:0}.wp-menus-manager .menu-actions{white-space:nowrap;text-align:right}@media(max-width:850px){.wp-menu-editor__columns{grid-template-columns:1fr}.wp-menu-sources{order:2}.wp-menu-structure{order:1}.wp-menu-editor__identity,.wp-menu-editor__top{align-items:stretch;display:grid}.wp-menu-item__fields{grid-template-columns:1fr}.wp-menu-item__wide{grid-column:auto}}`),E=f(`<div class=skeleton>`),ee=f(`<div class=manager-toolbar><p class=muted></p><button class="btn btn-primary"type=button>+ <!$><!/>`),D=f(`<table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody>`),te=f(`<section class=card>`),O=f(`<p class="muted empty-state">`),k=f(`<tr><td><strong></strong></td><td><code></code></td><td></td><td class=menu-actions><button class="btn btn-secondary btn-sm"type=button></button> <button class="btn btn-danger btn-sm"type=button>`),ne=f(`<input class=input>`),A=f(`<div class=wp-source-list>`),j=f(`<button type=button class="btn btn-secondary btn-sm">`),re=f(`<label><!$><!/><input class=input placeholder=https://>`),ie=f(`<label><!$><!/><input class=input>`),ae=f(`<form class=wp-menu-editor><div class=wp-menu-editor__top><div><button type=button class="btn btn-secondary btn-sm">← <!$><!/></button><span class=wp-eyebrow></span><h3></h3></div><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit></button></div></div><div class="wp-menu-editor__identity card"><label><!$><!/><input class=input required></label><label><!$><!/><input class=input></label></div><div class=wp-menu-editor__columns><aside class=wp-menu-sources><h4></h4><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></aside><main class=wp-menu-structure><div class=wp-structure-heading><div><h4></h4><p class=muted></p></div><span class=badge><!$><!/> <!$><!/></span></div><!$><!/><section class="card wp-menu-settings"><h4></h4><label class=checkbox-label><input type=checkbox> <!$><!/></label><p class=muted>`),oe=f(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/<!$><!/>`),se=f(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/post/<!$><!/>`),M=f(`<div class=wp-taxonomy-source><strong></strong><!$><!/>`),N=f(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>/<!$><!/>`),ce=f(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>`),le=f(`<div class="wp-menu-empty card">`);function P(e){return`${e}_${typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():Math.random().toString(36).slice(2)}`}function F(e){return e.toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``)}function I(e,t=null){let n=e.id||P(`item`);return{...e,id:n,clientId:n,parentId:t??e.parentId??null,children:[]}}function ue(e){let t=(Array.isArray(e)?e:[]).map(e=>I(e)),n=new Map(t.map(e=>[e.id,e])),r=[];for(let e of t){let t=e.parentId?n.get(e.parentId):void 0;t&&t.id!==e.id?t.children.push(e):r.push(e)}let i=e=>(e.sort((e,t)=>(e.order??0)-(t.order??0)),e.forEach(e=>i(e.children)),e);return i(r)}function L(e,t=null){let n=[];return e.forEach((e,r)=>{let{clientId:i,children:a,...o}=e;n.push({...o,id:e.id,parentId:t,order:r}),n.push(...L(a,e.id))}),n}function R(e){return e.map(e=>({...e,children:R(e.children)}))}function z(e,t){return e.id===t||e.children.some(e=>z(e,t))}function B(e,t){let n=e.findIndex(e=>e.id===t);if(n>=0){let t=[...e],[r]=t.splice(n,1);return{items:t,removed:r}}for(let n=0;n<e.length;n+=1){let r=B(e[n].children,t);if(r.removed){let t=[...e];return t[n]={...t[n],children:r.items},{items:t,removed:r.removed}}}return{items:e}}function V(e,t,n){let r=e.findIndex(e=>e.id===t);if(r>=0){let t=[...e];return t.splice(r,0,n),{items:t,inserted:!0}}for(let r=0;r<e.length;r+=1){let i=V(e[r].children,t,n);if(i.inserted){let t=[...e];return t[r]={...t[r],children:i.items},{items:t,inserted:!0}}}return{items:e,inserted:!1}}function H(e,t,n){for(let r=0;r<e.length;r+=1){let i=e[r];if(i.id===t){let t=[...e];return t[r]={...i,children:[...i.children,n]},{items:t,inserted:!0}}let a=H(i.children,t,n);if(a.inserted){let t=[...e];return t[r]={...i,children:a.items},{items:t,inserted:!0}}}return{items:e,inserted:!1}}function U(e,t,n){return e.map(e=>e.id===t?{...e,...n}:{...e,children:U(e.children,t,n)})}function de(e,t){return B(e,t).items}function fe(e,t,n){if(t===n||e.some(e=>e.id===t&&z(e,n)))return e;let r=B(e,t);if(!r.removed)return e;let i=V(r.items,n,r.removed);return i.inserted?i.items:e}function pe(e,t,n){if(t===n||e.some(e=>e.id===t&&z(e,n)))return e;let r=B(e,t);if(!r.removed)return e;let i=H(r.items,n,r.removed);return i.inserted?i.items:e}function W(e,t,n){let r=e.findIndex(e=>e.id===t);if(r>=0)return{siblings:e,index:r,parent:n};for(let n of e){let e=W(n.children,t,n);if(e)return e}return null}function me(e,t,n){let r=R(e),i=W(r,t);if(!i)return e;let a=i.index+n;return a<0||a>=i.siblings.length?e:([i.siblings[i.index],i.siblings[a]]=[i.siblings[a],i.siblings[i.index]],r)}function he(e,t){let n=R(e),r=W(n,t);return!r||r.index===0?e:pe(n,t,r.siblings[r.index-1].id)}function ge(e,t){let n=R(e),r=W(n,t);return r?.parent?fe(n,t,r.parent.id):e}function _e(e){let t=P(`item`);return{id:t,clientId:t,type:e.type,label:e.label,url:e.url,objectId:e.objectId,objectType:e.objectType,parentId:null,order:0,target:`_self`,children:[]}}function ve(a){let[o,c]=n(null);return(()=>{var n=d(y),f=n.firstChild,[p,g]=s(f.nextSibling),_=p.nextSibling,[x,S]=s(_.nextSibling);return m(n,i(r,{get each(){return a.items},children:n=>(()=>{var r=d(b),f=r.firstChild,p=f.firstChild,g=p.nextSibling,_=g.firstChild,v=_.nextSibling,y=g.nextSibling.firstChild,x=y.nextSibling,S=x.nextSibling,C=S.nextSibling,w=f.nextSibling,T=w.firstChild,E=T.nextSibling.firstChild,ee=E.firstChild,[D,te]=s(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,ne=k.firstChild,[A,j]=s(ne.nextSibling),re=A.nextSibling,ie=k.nextSibling,ae=ie.firstChild,[oe,se]=s(ae.nextSibling),M=oe.nextSibling,N=ie.nextSibling,ce=N.firstChild,[le,P]=s(ce.nextSibling),F=le.nextSibling,I=N.nextSibling,ue=I.firstChild,[L,R]=s(ue.nextSibling),z=L.nextSibling,B=z.firstChild,V=B.nextSibling,H=I.nextSibling,pe=H.firstChild,[W,_e]=s(pe.nextSibling),G=W.nextSibling,K=H.nextSibling,q=K.firstChild,[J,ye]=s(q.nextSibling),Y=J.nextSibling,be=K.nextSibling,xe=w.nextSibling,[Se,Ce]=s(xe.nextSibling);return r.addEventListener(`drop`,e=>{e.preventDefault();let t=o()??e.dataTransfer?.getData(`text/plain`);t&&a.onChange(fe(a.items,t,n.id)),c(null)}),r.addEventListener(`dragover`,e=>e.preventDefault()),p.addEventListener(`dragend`,()=>c(null)),p.addEventListener(`dragstart`,e=>{c(n.id),e.dataTransfer?.setData(`text/plain`,n.id)}),m(_,()=>n.label||a.t(`menus.editor.untitled`)),m(v,()=>n.url||a.t(`menus.editor.noUrl`)),y.$$click=()=>a.onChange(me(a.items,n.id,-1)),x.$$click=()=>a.onChange(me(a.items,n.id,1)),S.$$click=()=>a.onChange(he(a.items,n.id)),C.$$click=()=>a.onChange(ge(a.items,n.id)),m(T,()=>a.t(`menus.editor.itemSettings`)),m(E,()=>a.t(`menus.editor.navigationLabel`),D,te),O.$$input=e=>a.onChange(U(a.items,n.id,{label:e.currentTarget.value})),m(k,()=>a.t(`menus.editor.url`),A,j),re.$$input=e=>a.onChange(U(a.items,n.id,{url:e.currentTarget.value})),m(ie,()=>a.t(`menus.editor.titleAttribute`),oe,se),M.$$input=e=>a.onChange(U(a.items,n.id,{attrTitle:e.currentTarget.value})),m(N,()=>a.t(`menus.editor.cssClasses`),le,P),F.$$input=e=>a.onChange(U(a.items,n.id,{cssClasses:e.currentTarget.value})),m(I,()=>a.t(`menus.editor.target`),L,R),z.addEventListener(`change`,e=>a.onChange(U(a.items,n.id,{target:e.currentTarget.value}))),m(B,()=>a.t(`menus.editor.sameWindow`)),m(V,()=>a.t(`menus.editor.newWindow`)),m(H,()=>a.t(`menus.editor.xfn`),W,_e),G.$$input=e=>a.onChange(U(a.items,n.id,{xfn:e.currentTarget.value})),m(K,()=>a.t(`menus.editor.description`),J,ye),Y.$$input=e=>a.onChange(U(a.items,n.id,{description:e.currentTarget.value})),be.$$click=()=>a.onChange(de(a.items,n.id)),m(be,()=>a.t(`menus.editor.remove`)),m(r,i(t,{get when(){return n.children.length>0},get children(){return i(ve,{get items(){return n.children},get depth(){return(a.depth??0)+1},get t(){return a.t},onChange:e=>a.onChange(U(a.items,n.id,{children:e}))})}}),Se,Ce),e(e=>{var t=a.t(`menus.editor.drag`),n=a.t(`menus.editor.up`),r=a.t(`menus.editor.down`),i=a.t(`menus.editor.indent`),o=a.t(`menus.editor.outdent`);return t!==e.e&&l(p,`title`,e.e=t),n!==e.t&&l(y,`title`,e.t=n),r!==e.a&&l(x,`title`,e.a=r),i!==e.o&&l(S,`title`,e.o=i),o!==e.i&&l(C,`title`,e.i=o),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e(()=>u(O,`value`,n.label)),e(()=>u(re,`value`,n.url??``)),e(()=>u(M,`value`,n.attrTitle??``)),e(()=>u(F,`value`,n.cssClasses??``)),e(()=>u(z,`value`,n.target??`_self`)),e(()=>u(G,`value`,n.xfn??``)),e(()=>u(Y,`value`,n.description??``)),h(),r})()}),p,g),m(n,i(t,{get when(){return a.items.length===0},get children(){var e=d(v);return m(e,()=>a.t(`menus.editor.emptyLevel`)),e}}),x,S),e(()=>l(n,`data-depth`,a.depth??0)),n})()}function G(n){return(()=>{var r=d(S),a=r.firstChild,o=a.nextSibling,c=o.firstChild,[l,f]=s(c.nextSibling),p=l.nextSibling,[h,g]=s(p.nextSibling);return m(a,()=>n.title),m(o,i(t,{get when(){return n.description},get children(){var e=d(x);return m(e,()=>n.description),e}}),l,f),m(o,()=>n.children,h,g),e(()=>u(r,`open`,n.open)),r})()}function K(){let{t:f}=g(),[p,v]=n([]),[y,b]=n(null),[x,S]=n([]),[I,R]=n([]),[z,B]=n({}),[V,H]=n([]),[U,de]=n([]),[fe,pe]=n({}),[W,me]=n(``),[he,ge]=n(``),[K,q]=n([]),[J,ye]=n(``),[Y,be]=n(``),[xe,Se]=n(!0),[Ce,we]=n(!1),[Te,X]=n(``),[Ee,Z]=n(``),De=async()=>{Se(!0),X(``);try{let[e,t,n,r,i]=await Promise.all([_.getMenus(),_.getContent({type:`page`,status:`PUBLISHED`,limit:100}),_.getContent({type:`post`,status:`PUBLISHED`,limit:100}),_.getContentTypes(),_.getTaxonomies()]);v(e),S(t.data),R(n.data),H(r),de(i);let a=await Promise.all(r.filter(e=>e.slug!==`page`&&e.slug!==`post`&&!e.singleton).map(async e=>[e.slug,(await _.getContent({type:e.slug,status:`PUBLISHED`,limit:100})).data]));B(Object.fromEntries(a));let o=await Promise.all(i.map(async e=>[e.slug,await _.getTaxonomyTerms(e.slug)]));pe(Object.fromEntries(o))}catch(e){X(e instanceof Error?e.message:String(e))}finally{Se(!1)}};o(De);let Oe=e=>{b({id:e?.id,name:e?.name??``,slug:e?.slug??``,items:ue(e?.items),settings:{...e?.settings??{}}}),q([]),X(``),Z(``)},Q=e=>{let t=y();t&&b({...t,...e})},$=e=>{let t=y();t&&Q({items:[...t.items,_e(e)]})},ke=e=>{let t=new Set(K()),n=y();n&&(Q({items:[...n.items,...e.filter(e=>t.has(e.id)).map(_e)]}),q([]))},Ae=()=>{J().trim()&&Y().trim()&&($({id:P(`custom`),type:`custom`,label:Y().trim(),url:J().trim()}),ye(``),be(``))},je=async e=>{e.preventDefault();let t=y();if(t){if(!t.name.trim()){X(f(`menus.nameRequired`));return}we(!0),X(``);try{let e={name:t.name.trim(),slug:t.slug.trim()||F(t.name),items:L(t.items),settings:t.settings};t.id?await _.updateMenu(t.id,e):await _.createMenu(e),b(null),Z(f(`menus.saved`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}finally{we(!1)}}},Me=async e=>{if(e.id&&confirm(f(`menus.confirmDelete`,{name:e.name})))try{await _.deleteMenu(e.id),Z(f(`menus.deleted`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}},Ne=a(()=>x().filter(e=>!W()||`${e.title} ${e.slug}`.toLowerCase().includes(W().toLowerCase()))),Pe=a(()=>I().filter(e=>!he()||`${e.title} ${e.slug}`.toLowerCase().includes(he().toLowerCase()))),Fe=e=>({id:`page:${e.id}`,type:`page`,label:e.title,url:`/${e.slug}`,objectId:e.id,objectType:`page`}),Ie=e=>({id:`post:${e.id}`,type:`post`,label:e.title,url:`/post/${e.slug}`,objectId:e.id,objectType:`post`}),Le=e=>({id:`content:${e.type}:${e.id}`,type:`content`,label:e.title,url:`/${e.type}/${e.slug}`,objectId:e.id,objectType:e.type});return(()=>{var n=d(T),a=n.firstChild,[o,g]=s(a.nextSibling),_=o.nextSibling,[v,x]=s(_.nextSibling),S=v.nextSibling,[P,I]=s(S.nextSibling);return P.nextSibling,m(n,i(t,{get when(){return Te()},get children(){var e=d(C);return m(e,Te),e}}),o,g),m(n,i(t,{get when(){return Ee()},get children(){var e=d(w);return m(e,Ee),e}}),v,x),m(n,i(t,{get when(){return!xe()},get fallback(){return(()=>{var e=d(E);return m(e,()=>f(`common.loading`)),e})()},get children(){return i(t,{get when(){return y()},get fallback(){return[(()=>{var e=d(ee),t=e.firstChild,n=t.nextSibling,r=n.firstChild.nextSibling,[i,a]=s(r.nextSibling);return m(t,()=>f(`menus.hint`)),n.$$click=()=>Oe(),m(n,()=>f(`menus.new`),i,a),h(),e})(),(()=>{var e=d(te);return m(e,i(t,{get when(){return p().length>0},get fallback(){return(()=>{var e=d(O);return m(e,()=>f(`menus.empty`)),e})()},get children(){var e=d(D),t=e.firstChild,n=t.firstChild.firstChild,a=n.nextSibling,o=a.nextSibling,s=t.nextSibling;return m(n,()=>f(`menus.name`)),m(a,()=>f(`menus.slug`)),m(o,()=>f(`menus.items`)),m(s,i(r,{get each(){return p()},children:e=>(()=>{var t=d(k),n=t.firstChild,r=n.firstChild,i=n.nextSibling,a=i.firstChild,o=i.nextSibling,s=o.nextSibling.firstChild,c=s.nextSibling.nextSibling;return m(r,()=>e.name),m(a,()=>e.slug),m(o,()=>e.items?.length??0),s.$$click=()=>Oe(e),m(s,()=>f(`common.edit`)),c.$$click=()=>void Me(e),m(c,()=>f(`common.delete`)),h(),t})()})),e}})),e})()]},children:n=>(()=>{var a=d(ae),o=a.firstChild,p=o.firstChild,g=p.firstChild,_=g.firstChild.nextSibling,[v,y]=s(_.nextSibling),x=g.nextSibling,S=x.nextSibling,C=p.nextSibling.firstChild,w=C.nextSibling,T=o.nextSibling,E=T.firstChild,ee=E.firstChild,[D,te]=s(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,P=k.firstChild,[I,ue]=s(P.nextSibling),L=I.nextSibling,R=T.nextSibling.firstChild,B=R.firstChild,H=B.nextSibling,[de,pe]=s(H.nextSibling),_e=de.nextSibling,[xe,Se]=s(_e.nextSibling),we=xe.nextSibling,[Te,X]=s(we.nextSibling),Ee=Te.nextSibling,[Z,De]=s(Ee.nextSibling),Oe=Z.nextSibling,[Me,Re]=s(Oe.nextSibling),ze=Me.nextSibling,[Be,Ve]=s(ze.nextSibling),He=Be.nextSibling,[Ue,We]=s(He.nextSibling),Ge=R.nextSibling,Ke=Ge.firstChild,qe=Ke.firstChild,Je=qe.firstChild,Ye=Je.nextSibling,Xe=qe.nextSibling,Ze=Xe.firstChild,[Qe,$e]=s(Ze.nextSibling),et=Qe.nextSibling.nextSibling,[tt,nt]=s(et.nextSibling),rt=Ke.nextSibling,[it,at]=s(rt.nextSibling),ot=it.nextSibling.firstChild,st=ot.nextSibling,ct=st.firstChild,lt=ct.nextSibling.nextSibling,[ut,dt]=s(lt.nextSibling),ft=st.nextSibling;return a.addEventListener(`submit`,je),g.$$click=()=>b(null),m(g,()=>f(`menus.back`),v,y),m(x,()=>f(`menus.editor.eyebrow`)),m(S,(()=>{var e=c(()=>!!n().id);return()=>e()?f(`menus.edit`):f(`menus.create`)})()),C.$$click=()=>b(null),m(C,()=>f(`common.cancel`)),m(w,(()=>{var e=c(()=>!!Ce());return()=>e()?f(`common.loading`):f(`common.save`)})()),m(E,()=>f(`menus.name`),D,te),O.$$input=e=>Q({name:e.currentTarget.value}),m(k,()=>f(`menus.slug`),I,ue),L.$$input=e=>Q({slug:e.currentTarget.value}),m(B,()=>f(`menus.editor.addItems`)),m(R,i(G,{get title(){return f(`menus.sources.pages`)},open:!0,get children(){return[(()=>{var t=d(ne);return t.$$input=e=>me(e.currentTarget.value),e(()=>l(t,`placeholder`,f(`menus.editor.search`))),e(()=>u(t,`value`,W())),h(),t})(),(()=>{var t=d(A);return m(t,i(r,{get each(){return Ne()},children:t=>(()=>{var n=d(oe),r=n.firstChild,i=r.nextSibling,a=i.firstChild,[o,c]=s(a.nextSibling),l=o.nextSibling,f=l.firstChild.nextSibling,[p,h]=s(f.nextSibling);return r.addEventListener(`change`,e=>q(e.currentTarget.checked?[...K(),`page:${t.id}`]:K().filter(e=>e!==`page:${t.id}`))),m(i,()=>t.title,o,c),m(l,()=>t.slug,p,h),e(()=>u(r,`checked`,K().includes(`page:${t.id}`))),n})()})),t})(),(()=>{var e=d(j);return e.$$click=()=>ke(Ne().map(Fe)),m(e,()=>f(`menus.editor.addSelected`)),h(),e})()]}}),de,pe),m(R,i(G,{get title(){return f(`menus.sources.posts`)},get children(){return[(()=>{var t=d(ne);return t.$$input=e=>ge(e.currentTarget.value),e(()=>l(t,`placeholder`,f(`menus.editor.search`))),e(()=>u(t,`value`,he())),h(),t})(),(()=>{var t=d(A);return m(t,i(r,{get each(){return Pe()},children:t=>(()=>{var n=d(se),r=n.firstChild,i=r.nextSibling,a=i.firstChild,[o,c]=s(a.nextSibling),l=o.nextSibling,f=l.firstChild.nextSibling,[p,h]=s(f.nextSibling);return r.addEventListener(`change`,e=>q(e.currentTarget.checked?[...K(),`post:${t.id}`]:K().filter(e=>e!==`post:${t.id}`))),m(i,()=>t.title,o,c),m(l,()=>t.slug,p,h),e(()=>u(r,`checked`,K().includes(`post:${t.id}`))),n})()})),t})(),(()=>{var e=d(j);return e.$$click=()=>ke(Pe().map(Ie)),m(e,()=>f(`menus.editor.addSelected`)),h(),e})()]}}),xe,Se),m(R,i(G,{get title(){return f(`menus.sources.contentTypes`)},get children(){return i(r,{get each(){return V().filter(e=>e.slug!==`page`&&e.slug!==`post`&&!e.singleton)},children:e=>(()=>{var t=d(M),n=t.firstChild,a=n.nextSibling,[o,c]=s(a.nextSibling);return m(n,()=>e.pluralLabel),m(t,i(r,{get each(){return z()[e.slug]??[]},children:t=>(()=>{var n=d(N),r=n.firstChild,[i,a]=s(r.nextSibling),o=i.nextSibling,c=o.firstChild.nextSibling,[l,u]=s(c.nextSibling),f=l.nextSibling.nextSibling,[p,g]=s(f.nextSibling);return n.$$click=()=>$(Le(t)),m(n,()=>t.title,i,a),m(o,()=>e.slug,l,u),m(o,()=>t.slug,p,g),h(),n})()}),o,c),t})()})}}),Te,X),m(R,i(G,{get title(){return f(`menus.sources.custom`)},get description(){return f(`menus.sources.customHint`)},get children(){return[(()=>{var t=d(re),n=t.firstChild,[r,i]=s(n.nextSibling),a=r.nextSibling;return m(t,()=>f(`menus.editor.url`),r,i),a.$$input=e=>ye(e.currentTarget.value),e(()=>u(a,`value`,J())),h(),t})(),(()=>{var t=d(ie),n=t.firstChild,[r,i]=s(n.nextSibling),a=r.nextSibling;return m(t,()=>f(`menus.editor.navigationLabel`),r,i),a.$$input=e=>be(e.currentTarget.value),e(()=>u(a,`value`,Y())),h(),t})(),(()=>{var e=d(j);return e.$$click=Ae,m(e,()=>f(`menus.editor.addToMenu`)),h(),e})()]}}),Z,De),m(R,i(G,{get title(){return f(`menus.sources.home`)},get children(){var e=d(j);return e.$$click=()=>$({id:`home`,type:`home`,label:f(`menus.sources.home`),url:`/`}),m(e,()=>f(`menus.editor.addToMenu`)),h(),e}}),Me,Re),m(R,i(G,{get title(){return f(`menus.sources.archives`)},get children(){var e=d(A);return m(e,i(r,{get each(){return V().filter(e=>e.hasArchive)},children:e=>(()=>{var t=d(ce),n=t.firstChild,[r,i]=s(n.nextSibling),a=r.nextSibling,o=a.firstChild.nextSibling,[c,l]=s(o.nextSibling);return t.$$click=()=>$({id:`archive:${e.slug}`,type:`archive`,label:e.pluralLabel,url:`/${e.slug}`,objectType:e.slug}),m(t,()=>e.pluralLabel,r,i),m(a,()=>e.slug,c,l),h(),t})()})),e}}),Be,Ve),m(R,i(G,{get title(){return f(`menus.sources.taxonomies`)},get children(){return i(r,{get each(){return U()},children:e=>(()=>{var t=d(M),n=t.firstChild,a=n.nextSibling,[o,c]=s(a.nextSibling);return m(n,()=>e.name),m(t,i(r,{get each(){return fe()[e.slug]??[]},children:t=>(()=>{var n=d(N),r=n.firstChild,[i,a]=s(r.nextSibling),o=i.nextSibling,c=o.firstChild.nextSibling,[l,u]=s(c.nextSibling),f=l.nextSibling.nextSibling,[p,g]=s(f.nextSibling);return n.$$click=()=>$({id:`term:${e.slug}:${t.slug}`,type:`taxonomy`,label:t.name,url:`/${e.slug}/${t.slug}`,objectId:t.id,objectType:e.slug}),m(n,()=>t.name,i,a),m(o,()=>e.slug,l,u),m(o,()=>t.slug,p,g),h(),n})()}),o,c),t})()})}}),Ue,We),m(Je,()=>f(`menus.editor.structure`)),m(Ye,()=>f(`menus.editor.structureHint`)),m(Xe,()=>n().items.length,Qe,$e),m(Xe,()=>f(`menus.items`),tt,nt),m(Ge,i(t,{get when(){return n().items.length>0},get fallback(){return(()=>{var e=d(le);return m(e,()=>f(`menus.editor.empty`)),e})()},get children(){return i(ve,{get items(){return n().items},t:f,onChange:e=>Q({items:e})})}}),it,at),m(ot,()=>f(`menus.editor.settings`)),ct.addEventListener(`change`,e=>Q({settings:{...n().settings,autoAddNewPages:e.currentTarget.checked}})),m(st,()=>f(`menus.editor.autoAddPages`),ut,dt),m(ft,()=>f(`menus.editor.autoAddPagesHint`)),e(e=>{var t=Ce(),r=F(n().name);return t!==e.e&&u(w,`disabled`,e.e=t),r!==e.t&&l(L,`placeholder`,e.t=r),e},{e:void 0,t:void 0}),e(()=>u(O,`value`,n().name)),e(()=>u(L,`value`,n().slug)),e(()=>u(ct,`checked`,n().settings.autoAddNewPages===!0)),h(),a})()})}}),P,I),n})()}p([`click`,`input`]);export{K as MenuManager};
1
+ import{d as e,i as t,p as n,r,s as i,u as a,v as o}from"./solid.8gBSxpeo.js";import{a as s,c,d as l,f as u,i as d,m as f,r as p,s as m,u as h}from"./web.DwNv8rLL.js";import{n as g}from"./i18n.3zKFZ7KU.js";import{t as _}from"./api.CGA0D2A2.js";var v=f(`<div class=wp-menu-empty-level>`),y=f(`<div class=wp-menu-tree><!$><!/><!$><!/>`),b=f(`<article class=wp-menu-item><div class=wp-menu-item__header><span class=wp-menu-drag draggable=true>⠿⠿⠿</span><span class=wp-menu-item__label><strong></strong><small></small></span><div class=wp-menu-item__actions><button type=button class="btn btn-sm">↑</button><button type=button class="btn btn-sm">↓</button><button type=button class="btn btn-sm">→</button><button type=button class="btn btn-sm">←</button></div></div><details class=wp-menu-item__details><summary></summary><div class=wp-menu-item__fields><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><select class=input><option value=_self></option><option value=_blank></option></select></label><label><!$><!/><input class=input></label><label class=wp-menu-item__wide><!$><!/><textarea class=input rows=2></textarea></label><button type=button class="btn btn-danger btn-sm"></button></div></details><!$><!/>`),x=f(`<p class=muted>`),S=f(`<details class=wp-menu-box><summary></summary><div class=wp-menu-box__body><!$><!/><!$><!/>`),C=f(`<div class="notice notice--error">`),w=f(`<div class=notice>`),T=f(`<div class="menus-manager wp-menus-manager"><!$><!/><!$><!/><!$><!/><style>.wp-menu-editor__top,.wp-structure-heading,.wp-menu-editor__identity,.wp-menu-item__header,.wp-menu-item__actions,.form-actions{display:flex;align-items:center;gap:.7rem}.wp-menu-editor__top,.wp-structure-heading{justify-content:space-between}.wp-menu-editor__top{margin-bottom:1rem}.wp-menu-editor__top h3{margin:.25rem 0 0}.wp-eyebrow{display:block;margin-top:.7rem;font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;color:var(--color-muted)}.wp-menu-editor__identity{margin-bottom:1rem;align-items:end}.wp-menu-editor__identity label{display:grid;gap:.35rem;flex:1}.wp-menu-editor__columns{display:grid;grid-template-columns:330px minmax(0,1fr);gap:1.2rem;align-items:start}.wp-menu-sources,.wp-menu-structure{min-width:0}.wp-menu-sources>h4,.wp-structure-heading h4{margin:0}.wp-menu-box{background:var(--color-surface,#fff);border:1px solid var(--color-border,#ddd);margin-bottom:.7rem}.wp-menu-box summary{cursor:pointer;padding:.8rem;font-weight:600}.wp-menu-box__body{padding:0 .8rem .8rem;display:grid;gap:.6rem}.wp-menu-box__body p{margin:0}.wp-source-list{display:grid;gap:.35rem;max-height:220px;overflow:auto;border:1px solid var(--color-border,#ddd);padding:.45rem}.wp-source-row{display:flex!important;align-items:start;gap:.45rem!important;padding:.3rem}.wp-source-row span,.wp-source-link{display:grid;gap:.12rem;text-align:left}.wp-source-row small,.wp-source-link small,.wp-menu-item__label small{color:var(--color-muted);font-size:.75rem}.wp-source-link{border:0;background:none;color:inherit;padding:.35rem;width:100%;cursor:pointer}.wp-source-link:hover{background:var(--color-surface-muted,#f5f5f5)}.wp-taxonomy-source{display:grid;gap:.2rem;border-top:1px solid var(--color-border,#ddd);padding-top:.5rem}.wp-taxonomy-source:first-child{border-top:0;padding-top:0}.wp-menu-structure{background:var(--color-surface-muted,#f7f7f7);padding:1rem}.wp-menu-structure .wp-structure-heading{margin-bottom:1rem}.wp-menu-tree{display:grid;gap:.55rem}.wp-menu-tree[data-depth="1"]{margin:.55rem 0 0 2rem}.wp-menu-item{background:var(--color-surface,#fff);border:1px solid var(--color-border,#dcdcde);box-shadow:0 1px 1px rgba(0,0,0,.04)}.wp-menu-item__header{padding:.55rem .7rem}.wp-menu-drag{cursor:grab;letter-spacing:-.2rem;width:1.4rem;color:var(--color-muted);user-select:none}.wp-menu-item__label{display:grid;gap:.15rem;flex:1;min-width:0}.wp-menu-item__label small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-menu-item__actions{margin-left:auto}.wp-menu-item__details{border-top:1px solid var(--color-border,#ddd)}.wp-menu-item__details summary{padding:.5rem .7rem;cursor:pointer;color:var(--color-muted);font-size:.85rem}.wp-menu-item__fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.7rem;padding:.7rem;border-top:1px solid var(--color-border,#ddd)}.wp-menu-item__fields label{display:grid;gap:.3rem}.wp-menu-item__wide{grid-column:1/-1}.wp-menu-empty,.wp-menu-empty-level{text-align:center;padding:2rem;color:var(--color-muted)}.wp-menu-empty-level{border:1px dashed var(--color-border,#ccc);padding:1rem}.wp-menu-settings{margin-top:1rem}.wp-menu-settings h4{margin-top:0}.wp-menu-settings p{margin-bottom:0}.wp-menus-manager .menu-actions{white-space:nowrap;text-align:right}@media(max-width:850px){.wp-menu-editor__columns{grid-template-columns:1fr}.wp-menu-sources{order:2}.wp-menu-structure{order:1}.wp-menu-editor__identity,.wp-menu-editor__top{align-items:stretch;display:grid}.wp-menu-item__fields{grid-template-columns:1fr}.wp-menu-item__wide{grid-column:auto}}`),E=f(`<div class=skeleton>`),ee=f(`<div class=manager-toolbar><p class=muted></p><button class="btn btn-primary"type=button>+ <!$><!/>`),D=f(`<table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody>`),te=f(`<section class=card>`),O=f(`<p class="muted empty-state">`),k=f(`<tr><td><strong></strong></td><td><code></code></td><td></td><td class=menu-actions><button class="btn btn-secondary btn-sm"type=button></button> <button class="btn btn-danger btn-sm"type=button>`),ne=f(`<input class=input>`),A=f(`<div class=wp-source-list>`),j=f(`<button type=button class="btn btn-secondary btn-sm">`),re=f(`<label><!$><!/><input class=input placeholder=https://>`),ie=f(`<label><!$><!/><input class=input>`),ae=f(`<form class=wp-menu-editor><div class=wp-menu-editor__top><div><button type=button class="btn btn-secondary btn-sm">← <!$><!/></button><span class=wp-eyebrow></span><h3></h3></div><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit></button></div></div><div class="wp-menu-editor__identity card"><label><!$><!/><input class=input required></label><label><!$><!/><input class=input></label></div><div class=wp-menu-editor__columns><aside class=wp-menu-sources><h4></h4><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></aside><main class=wp-menu-structure><div class=wp-structure-heading><div><h4></h4><p class=muted></p></div><span class=badge><!$><!/> <!$><!/></span></div><!$><!/><section class="card wp-menu-settings"><h4></h4><label class=checkbox-label><input type=checkbox> <!$><!/></label><p class=muted>`),oe=f(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/<!$><!/>`),se=f(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/post/<!$><!/>`),M=f(`<div class=wp-taxonomy-source><strong></strong><!$><!/>`),N=f(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>/<!$><!/>`),ce=f(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>`),le=f(`<div class="wp-menu-empty card">`);function P(e){return`${e}_${typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():Math.random().toString(36).slice(2)}`}function F(e){return e.toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``)}function I(e,t=null){let n=e.id||P(`item`);return{...e,id:n,clientId:n,parentId:t??e.parentId??null,children:[]}}function ue(e){let t=(Array.isArray(e)?e:[]).map(e=>I(e)),n=new Map(t.map(e=>[e.id,e])),r=[];for(let e of t){let t=e.parentId?n.get(e.parentId):void 0;t&&t.id!==e.id?t.children.push(e):r.push(e)}let i=e=>(e.sort((e,t)=>(e.order??0)-(t.order??0)),e.forEach(e=>i(e.children)),e);return i(r)}function L(e,t=null){let n=[];return e.forEach((e,r)=>{let{clientId:i,children:a,...o}=e;n.push({...o,id:e.id,parentId:t,order:r}),n.push(...L(a,e.id))}),n}function R(e){return e.map(e=>({...e,children:R(e.children)}))}function z(e,t){return e.id===t||e.children.some(e=>z(e,t))}function B(e,t){let n=e.findIndex(e=>e.id===t);if(n>=0){let t=[...e],[r]=t.splice(n,1);return{items:t,removed:r}}for(let n=0;n<e.length;n+=1){let r=B(e[n].children,t);if(r.removed){let t=[...e];return t[n]={...t[n],children:r.items},{items:t,removed:r.removed}}}return{items:e}}function V(e,t,n){let r=e.findIndex(e=>e.id===t);if(r>=0){let t=[...e];return t.splice(r,0,n),{items:t,inserted:!0}}for(let r=0;r<e.length;r+=1){let i=V(e[r].children,t,n);if(i.inserted){let t=[...e];return t[r]={...t[r],children:i.items},{items:t,inserted:!0}}}return{items:e,inserted:!1}}function H(e,t,n){for(let r=0;r<e.length;r+=1){let i=e[r];if(i.id===t){let t=[...e];return t[r]={...i,children:[...i.children,n]},{items:t,inserted:!0}}let a=H(i.children,t,n);if(a.inserted){let t=[...e];return t[r]={...i,children:a.items},{items:t,inserted:!0}}}return{items:e,inserted:!1}}function U(e,t,n){return e.map(e=>e.id===t?{...e,...n}:{...e,children:U(e.children,t,n)})}function de(e,t){return B(e,t).items}function fe(e,t,n){if(t===n||e.some(e=>e.id===t&&z(e,n)))return e;let r=B(e,t);if(!r.removed)return e;let i=V(r.items,n,r.removed);return i.inserted?i.items:e}function pe(e,t,n){if(t===n||e.some(e=>e.id===t&&z(e,n)))return e;let r=B(e,t);if(!r.removed)return e;let i=H(r.items,n,r.removed);return i.inserted?i.items:e}function W(e,t,n){let r=e.findIndex(e=>e.id===t);if(r>=0)return{siblings:e,index:r,parent:n};for(let n of e){let e=W(n.children,t,n);if(e)return e}return null}function me(e,t,n){let r=R(e),i=W(r,t);if(!i)return e;let a=i.index+n;return a<0||a>=i.siblings.length?e:([i.siblings[i.index],i.siblings[a]]=[i.siblings[a],i.siblings[i.index]],r)}function he(e,t){let n=R(e),r=W(n,t);return!r||r.index===0?e:pe(n,t,r.siblings[r.index-1].id)}function ge(e,t){let n=R(e),r=W(n,t);return r?.parent?fe(n,t,r.parent.id):e}function _e(e){let t=P(`item`);return{id:t,clientId:t,type:e.type,label:e.label,url:e.url,objectId:e.objectId,objectType:e.objectType,parentId:null,order:0,target:`_self`,children:[]}}function ve(a){let[o,c]=n(null);return(()=>{var n=d(y),f=n.firstChild,[p,g]=s(f.nextSibling),_=p.nextSibling,[x,S]=s(_.nextSibling);return m(n,i(r,{get each(){return a.items},children:n=>(()=>{var r=d(b),f=r.firstChild,p=f.firstChild,g=p.nextSibling,_=g.firstChild,v=_.nextSibling,y=g.nextSibling.firstChild,x=y.nextSibling,S=x.nextSibling,C=S.nextSibling,w=f.nextSibling,T=w.firstChild,E=T.nextSibling.firstChild,ee=E.firstChild,[D,te]=s(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,ne=k.firstChild,[A,j]=s(ne.nextSibling),re=A.nextSibling,ie=k.nextSibling,ae=ie.firstChild,[oe,se]=s(ae.nextSibling),M=oe.nextSibling,N=ie.nextSibling,ce=N.firstChild,[le,P]=s(ce.nextSibling),F=le.nextSibling,I=N.nextSibling,ue=I.firstChild,[L,R]=s(ue.nextSibling),z=L.nextSibling,B=z.firstChild,V=B.nextSibling,H=I.nextSibling,pe=H.firstChild,[W,_e]=s(pe.nextSibling),G=W.nextSibling,K=H.nextSibling,q=K.firstChild,[J,ye]=s(q.nextSibling),Y=J.nextSibling,be=K.nextSibling,xe=w.nextSibling,[Se,Ce]=s(xe.nextSibling);return r.addEventListener(`drop`,e=>{e.preventDefault();let t=o()??e.dataTransfer?.getData(`text/plain`);t&&a.onChange(fe(a.items,t,n.id)),c(null)}),r.addEventListener(`dragover`,e=>e.preventDefault()),p.addEventListener(`dragend`,()=>c(null)),p.addEventListener(`dragstart`,e=>{c(n.id),e.dataTransfer?.setData(`text/plain`,n.id)}),m(_,()=>n.label||a.t(`menus.editor.untitled`)),m(v,()=>n.url||a.t(`menus.editor.noUrl`)),y.$$click=()=>a.onChange(me(a.items,n.id,-1)),x.$$click=()=>a.onChange(me(a.items,n.id,1)),S.$$click=()=>a.onChange(he(a.items,n.id)),C.$$click=()=>a.onChange(ge(a.items,n.id)),m(T,()=>a.t(`menus.editor.itemSettings`)),m(E,()=>a.t(`menus.editor.navigationLabel`),D,te),O.$$input=e=>a.onChange(U(a.items,n.id,{label:e.currentTarget.value})),m(k,()=>a.t(`menus.editor.url`),A,j),re.$$input=e=>a.onChange(U(a.items,n.id,{url:e.currentTarget.value})),m(ie,()=>a.t(`menus.editor.titleAttribute`),oe,se),M.$$input=e=>a.onChange(U(a.items,n.id,{attrTitle:e.currentTarget.value})),m(N,()=>a.t(`menus.editor.cssClasses`),le,P),F.$$input=e=>a.onChange(U(a.items,n.id,{cssClasses:e.currentTarget.value})),m(I,()=>a.t(`menus.editor.target`),L,R),z.addEventListener(`change`,e=>a.onChange(U(a.items,n.id,{target:e.currentTarget.value}))),m(B,()=>a.t(`menus.editor.sameWindow`)),m(V,()=>a.t(`menus.editor.newWindow`)),m(H,()=>a.t(`menus.editor.xfn`),W,_e),G.$$input=e=>a.onChange(U(a.items,n.id,{xfn:e.currentTarget.value})),m(K,()=>a.t(`menus.editor.description`),J,ye),Y.$$input=e=>a.onChange(U(a.items,n.id,{description:e.currentTarget.value})),be.$$click=()=>a.onChange(de(a.items,n.id)),m(be,()=>a.t(`menus.editor.remove`)),m(r,i(t,{get when(){return n.children.length>0},get children(){return i(ve,{get items(){return n.children},get depth(){return(a.depth??0)+1},get t(){return a.t},onChange:e=>a.onChange(U(a.items,n.id,{children:e}))})}}),Se,Ce),e(e=>{var t=a.t(`menus.editor.drag`),n=a.t(`menus.editor.up`),r=a.t(`menus.editor.down`),i=a.t(`menus.editor.indent`),o=a.t(`menus.editor.outdent`);return t!==e.e&&l(p,`title`,e.e=t),n!==e.t&&l(y,`title`,e.t=n),r!==e.a&&l(x,`title`,e.a=r),i!==e.o&&l(S,`title`,e.o=i),o!==e.i&&l(C,`title`,e.i=o),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e(()=>u(O,`value`,n.label)),e(()=>u(re,`value`,n.url??``)),e(()=>u(M,`value`,n.attrTitle??``)),e(()=>u(F,`value`,n.cssClasses??``)),e(()=>u(z,`value`,n.target??`_self`)),e(()=>u(G,`value`,n.xfn??``)),e(()=>u(Y,`value`,n.description??``)),h(),r})()}),p,g),m(n,i(t,{get when(){return a.items.length===0},get children(){var e=d(v);return m(e,()=>a.t(`menus.editor.emptyLevel`)),e}}),x,S),e(()=>l(n,`data-depth`,a.depth??0)),n})()}function G(n){return(()=>{var r=d(S),a=r.firstChild,o=a.nextSibling,c=o.firstChild,[l,f]=s(c.nextSibling),p=l.nextSibling,[h,g]=s(p.nextSibling);return m(a,()=>n.title),m(o,i(t,{get when(){return n.description},get children(){var e=d(x);return m(e,()=>n.description),e}}),l,f),m(o,()=>n.children,h,g),e(()=>u(r,`open`,n.open)),r})()}function K(){let{t:f}=g(),[p,v]=n([]),[y,b]=n(null),[x,S]=n([]),[I,R]=n([]),[z,B]=n({}),[V,H]=n([]),[U,de]=n([]),[fe,pe]=n({}),[W,me]=n(``),[he,ge]=n(``),[K,q]=n([]),[J,ye]=n(``),[Y,be]=n(``),[xe,Se]=n(!0),[Ce,we]=n(!1),[Te,X]=n(``),[Ee,Z]=n(``),De=async()=>{Se(!0),X(``);try{let[e,t,n,r,i]=await Promise.all([_.getMenus(),_.getContent({type:`page`,status:`PUBLISHED`,limit:100}),_.getContent({type:`post`,status:`PUBLISHED`,limit:100}),_.getContentTypes(),_.getTaxonomies()]);v(e),S(t.data),R(n.data),H(r),de(i);let a=await Promise.all(r.filter(e=>e.slug!==`page`&&e.slug!==`post`&&!e.singleton).map(async e=>[e.slug,(await _.getContent({type:e.slug,status:`PUBLISHED`,limit:100})).data]));B(Object.fromEntries(a));let o=await Promise.all(i.map(async e=>[e.slug,await _.getTaxonomyTerms(e.slug)]));pe(Object.fromEntries(o))}catch(e){X(e instanceof Error?e.message:String(e))}finally{Se(!1)}};o(De);let Oe=e=>{b({id:e?.id,name:e?.name??``,slug:e?.slug??``,items:ue(e?.items),settings:{...e?.settings??{}}}),q([]),X(``),Z(``)},Q=e=>{let t=y();t&&b({...t,...e})},$=e=>{let t=y();t&&Q({items:[...t.items,_e(e)]})},ke=e=>{let t=new Set(K()),n=y();n&&(Q({items:[...n.items,...e.filter(e=>t.has(e.id)).map(_e)]}),q([]))},Ae=()=>{J().trim()&&Y().trim()&&($({id:P(`custom`),type:`custom`,label:Y().trim(),url:J().trim()}),ye(``),be(``))},je=async e=>{e.preventDefault();let t=y();if(t){if(!t.name.trim()){X(f(`menus.nameRequired`));return}we(!0),X(``);try{let e={name:t.name.trim(),slug:t.slug.trim()||F(t.name),items:L(t.items),settings:t.settings};t.id?await _.updateMenu(t.id,e):await _.createMenu(e),b(null),Z(f(`menus.saved`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}finally{we(!1)}}},Me=async e=>{if(e.id&&confirm(f(`menus.confirmDelete`,{name:e.name})))try{await _.deleteMenu(e.id),Z(f(`menus.deleted`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}},Ne=a(()=>x().filter(e=>!W()||`${e.title} ${e.slug}`.toLowerCase().includes(W().toLowerCase()))),Pe=a(()=>I().filter(e=>!he()||`${e.title} ${e.slug}`.toLowerCase().includes(he().toLowerCase()))),Fe=e=>({id:`page:${e.id}`,type:`page`,label:e.title,url:`/${e.slug}`,objectId:e.id,objectType:`page`}),Ie=e=>({id:`post:${e.id}`,type:`post`,label:e.title,url:`/post/${e.slug}`,objectId:e.id,objectType:`post`}),Le=e=>({id:`content:${e.type}:${e.id}`,type:`content`,label:e.title,url:`/${e.type}/${e.slug}`,objectId:e.id,objectType:e.type});return(()=>{var n=d(T),a=n.firstChild,[o,g]=s(a.nextSibling),_=o.nextSibling,[v,x]=s(_.nextSibling),S=v.nextSibling,[P,I]=s(S.nextSibling);return P.nextSibling,m(n,i(t,{get when(){return Te()},get children(){var e=d(C);return m(e,Te),e}}),o,g),m(n,i(t,{get when(){return Ee()},get children(){var e=d(w);return m(e,Ee),e}}),v,x),m(n,i(t,{get when(){return!xe()},get fallback(){return(()=>{var e=d(E);return m(e,()=>f(`common.loading`)),e})()},get children(){return i(t,{get when(){return y()},get fallback(){return[(()=>{var e=d(ee),t=e.firstChild,n=t.nextSibling,r=n.firstChild.nextSibling,[i,a]=s(r.nextSibling);return m(t,()=>f(`menus.hint`)),n.$$click=()=>Oe(),m(n,()=>f(`menus.new`),i,a),h(),e})(),(()=>{var e=d(te);return m(e,i(t,{get when(){return p().length>0},get fallback(){return(()=>{var e=d(O);return m(e,()=>f(`menus.empty`)),e})()},get children(){var e=d(D),t=e.firstChild,n=t.firstChild.firstChild,a=n.nextSibling,o=a.nextSibling,s=t.nextSibling;return m(n,()=>f(`menus.name`)),m(a,()=>f(`menus.slug`)),m(o,()=>f(`menus.items`)),m(s,i(r,{get each(){return p()},children:e=>(()=>{var t=d(k),n=t.firstChild,r=n.firstChild,i=n.nextSibling,a=i.firstChild,o=i.nextSibling,s=o.nextSibling.firstChild,c=s.nextSibling.nextSibling;return m(r,()=>e.name),m(a,()=>e.slug),m(o,()=>e.items?.length??0),s.$$click=()=>Oe(e),m(s,()=>f(`common.edit`)),c.$$click=()=>void Me(e),m(c,()=>f(`common.delete`)),h(),t})()})),e}})),e})()]},children:n=>(()=>{var a=d(ae),o=a.firstChild,p=o.firstChild,g=p.firstChild,_=g.firstChild.nextSibling,[v,y]=s(_.nextSibling),x=g.nextSibling,S=x.nextSibling,C=p.nextSibling.firstChild,w=C.nextSibling,T=o.nextSibling,E=T.firstChild,ee=E.firstChild,[D,te]=s(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,P=k.firstChild,[I,ue]=s(P.nextSibling),L=I.nextSibling,R=T.nextSibling.firstChild,B=R.firstChild,H=B.nextSibling,[de,pe]=s(H.nextSibling),_e=de.nextSibling,[xe,Se]=s(_e.nextSibling),we=xe.nextSibling,[Te,X]=s(we.nextSibling),Ee=Te.nextSibling,[Z,De]=s(Ee.nextSibling),Oe=Z.nextSibling,[Me,Re]=s(Oe.nextSibling),ze=Me.nextSibling,[Be,Ve]=s(ze.nextSibling),He=Be.nextSibling,[Ue,We]=s(He.nextSibling),Ge=R.nextSibling,Ke=Ge.firstChild,qe=Ke.firstChild,Je=qe.firstChild,Ye=Je.nextSibling,Xe=qe.nextSibling,Ze=Xe.firstChild,[Qe,$e]=s(Ze.nextSibling),et=Qe.nextSibling.nextSibling,[tt,nt]=s(et.nextSibling),rt=Ke.nextSibling,[it,at]=s(rt.nextSibling),ot=it.nextSibling.firstChild,st=ot.nextSibling,ct=st.firstChild,lt=ct.nextSibling.nextSibling,[ut,dt]=s(lt.nextSibling),ft=st.nextSibling;return a.addEventListener(`submit`,je),g.$$click=()=>b(null),m(g,()=>f(`menus.back`),v,y),m(x,()=>f(`menus.editor.eyebrow`)),m(S,(()=>{var e=c(()=>!!n().id);return()=>e()?f(`menus.edit`):f(`menus.create`)})()),C.$$click=()=>b(null),m(C,()=>f(`common.cancel`)),m(w,(()=>{var e=c(()=>!!Ce());return()=>e()?f(`common.loading`):f(`common.save`)})()),m(E,()=>f(`menus.name`),D,te),O.$$input=e=>Q({name:e.currentTarget.value}),m(k,()=>f(`menus.slug`),I,ue),L.$$input=e=>Q({slug:e.currentTarget.value}),m(B,()=>f(`menus.editor.addItems`)),m(R,i(G,{get title(){return f(`menus.sources.pages`)},open:!0,get children(){return[(()=>{var t=d(ne);return t.$$input=e=>me(e.currentTarget.value),e(()=>l(t,`placeholder`,f(`menus.editor.search`))),e(()=>u(t,`value`,W())),h(),t})(),(()=>{var t=d(A);return m(t,i(r,{get each(){return Ne()},children:t=>(()=>{var n=d(oe),r=n.firstChild,i=r.nextSibling,a=i.firstChild,[o,c]=s(a.nextSibling),l=o.nextSibling,f=l.firstChild.nextSibling,[p,h]=s(f.nextSibling);return r.addEventListener(`change`,e=>q(e.currentTarget.checked?[...K(),`page:${t.id}`]:K().filter(e=>e!==`page:${t.id}`))),m(i,()=>t.title,o,c),m(l,()=>t.slug,p,h),e(()=>u(r,`checked`,K().includes(`page:${t.id}`))),n})()})),t})(),(()=>{var e=d(j);return e.$$click=()=>ke(Ne().map(Fe)),m(e,()=>f(`menus.editor.addSelected`)),h(),e})()]}}),de,pe),m(R,i(G,{get title(){return f(`menus.sources.posts`)},get children(){return[(()=>{var t=d(ne);return t.$$input=e=>ge(e.currentTarget.value),e(()=>l(t,`placeholder`,f(`menus.editor.search`))),e(()=>u(t,`value`,he())),h(),t})(),(()=>{var t=d(A);return m(t,i(r,{get each(){return Pe()},children:t=>(()=>{var n=d(se),r=n.firstChild,i=r.nextSibling,a=i.firstChild,[o,c]=s(a.nextSibling),l=o.nextSibling,f=l.firstChild.nextSibling,[p,h]=s(f.nextSibling);return r.addEventListener(`change`,e=>q(e.currentTarget.checked?[...K(),`post:${t.id}`]:K().filter(e=>e!==`post:${t.id}`))),m(i,()=>t.title,o,c),m(l,()=>t.slug,p,h),e(()=>u(r,`checked`,K().includes(`post:${t.id}`))),n})()})),t})(),(()=>{var e=d(j);return e.$$click=()=>ke(Pe().map(Ie)),m(e,()=>f(`menus.editor.addSelected`)),h(),e})()]}}),xe,Se),m(R,i(G,{get title(){return f(`menus.sources.contentTypes`)},get children(){return i(r,{get each(){return V().filter(e=>e.slug!==`page`&&e.slug!==`post`&&!e.singleton)},children:e=>(()=>{var t=d(M),n=t.firstChild,a=n.nextSibling,[o,c]=s(a.nextSibling);return m(n,()=>e.pluralLabel),m(t,i(r,{get each(){return z()[e.slug]??[]},children:t=>(()=>{var n=d(N),r=n.firstChild,[i,a]=s(r.nextSibling),o=i.nextSibling,c=o.firstChild.nextSibling,[l,u]=s(c.nextSibling),f=l.nextSibling.nextSibling,[p,g]=s(f.nextSibling);return n.$$click=()=>$(Le(t)),m(n,()=>t.title,i,a),m(o,()=>e.slug,l,u),m(o,()=>t.slug,p,g),h(),n})()}),o,c),t})()})}}),Te,X),m(R,i(G,{get title(){return f(`menus.sources.custom`)},get description(){return f(`menus.sources.customHint`)},get children(){return[(()=>{var t=d(re),n=t.firstChild,[r,i]=s(n.nextSibling),a=r.nextSibling;return m(t,()=>f(`menus.editor.url`),r,i),a.$$input=e=>ye(e.currentTarget.value),e(()=>u(a,`value`,J())),h(),t})(),(()=>{var t=d(ie),n=t.firstChild,[r,i]=s(n.nextSibling),a=r.nextSibling;return m(t,()=>f(`menus.editor.navigationLabel`),r,i),a.$$input=e=>be(e.currentTarget.value),e(()=>u(a,`value`,Y())),h(),t})(),(()=>{var e=d(j);return e.$$click=Ae,m(e,()=>f(`menus.editor.addToMenu`)),h(),e})()]}}),Z,De),m(R,i(G,{get title(){return f(`menus.sources.home`)},get children(){var e=d(j);return e.$$click=()=>$({id:`home`,type:`home`,label:f(`menus.sources.home`),url:`/`}),m(e,()=>f(`menus.editor.addToMenu`)),h(),e}}),Me,Re),m(R,i(G,{get title(){return f(`menus.sources.archives`)},get children(){var e=d(A);return m(e,i(r,{get each(){return V().filter(e=>e.hasArchive)},children:e=>(()=>{var t=d(ce),n=t.firstChild,[r,i]=s(n.nextSibling),a=r.nextSibling,o=a.firstChild.nextSibling,[c,l]=s(o.nextSibling);return t.$$click=()=>$({id:`archive:${e.slug}`,type:`archive`,label:e.pluralLabel,url:`/${e.slug}`,objectType:e.slug}),m(t,()=>e.pluralLabel,r,i),m(a,()=>e.slug,c,l),h(),t})()})),e}}),Be,Ve),m(R,i(G,{get title(){return f(`menus.sources.taxonomies`)},get children(){return i(r,{get each(){return U()},children:e=>(()=>{var t=d(M),n=t.firstChild,a=n.nextSibling,[o,c]=s(a.nextSibling);return m(n,()=>e.name),m(t,i(r,{get each(){return fe()[e.slug]??[]},children:t=>(()=>{var n=d(N),r=n.firstChild,[i,a]=s(r.nextSibling),o=i.nextSibling,c=o.firstChild.nextSibling,[l,u]=s(c.nextSibling),f=l.nextSibling.nextSibling,[p,g]=s(f.nextSibling);return n.$$click=()=>$({id:`term:${e.slug}:${t.slug}`,type:`taxonomy`,label:t.name,url:`/${e.slug}/${t.slug}`,objectId:t.id,objectType:e.slug}),m(n,()=>t.name,i,a),m(o,()=>e.slug,l,u),m(o,()=>t.slug,p,g),h(),n})()}),o,c),t})()})}}),Ue,We),m(Je,()=>f(`menus.editor.structure`)),m(Ye,()=>f(`menus.editor.structureHint`)),m(Xe,()=>n().items.length,Qe,$e),m(Xe,()=>f(`menus.items`),tt,nt),m(Ge,i(t,{get when(){return n().items.length>0},get fallback(){return(()=>{var e=d(le);return m(e,()=>f(`menus.editor.empty`)),e})()},get children(){return i(ve,{get items(){return n().items},t:f,onChange:e=>Q({items:e})})}}),it,at),m(ot,()=>f(`menus.editor.settings`)),ct.addEventListener(`change`,e=>Q({settings:{...n().settings,autoAddNewPages:e.currentTarget.checked}})),m(st,()=>f(`menus.editor.autoAddPages`),ut,dt),m(ft,()=>f(`menus.editor.autoAddPagesHint`)),e(e=>{var t=Ce(),r=F(n().name);return t!==e.e&&u(w,`disabled`,e.e=t),r!==e.t&&l(L,`placeholder`,e.t=r),e},{e:void 0,t:void 0}),e(()=>u(O,`value`,n().name)),e(()=>u(L,`value`,n().slug)),e(()=>u(ct,`checked`,n().settings.autoAddNewPages===!0)),h(),a})()})}}),P,I),n})()}p([`click`,`input`]);export{K as MenuManager};
@@ -1,4 +1,4 @@
1
- import{d as e,p as t,r as n,s as r,v as i}from"./solid.8gBSxpeo.js";import{a,c as o,d as s,f as c,i as l,m as u,n as d,r as f,s as p,u as m}from"./web.DwNv8rLL.js";import{n as h}from"./i18n.EKfvSb1v.js";import{t as g}from"./api.CM0tblEa.js";var _=u(`<div class=plugin-manager><div class=page-header><h2></h2><p class=page-description></p><p class=page-hint></p></div><!$><!/><!$><!/><!$><!/><style>
1
+ import{d as e,p as t,r as n,s as r,v as i}from"./solid.8gBSxpeo.js";import{a,c as o,d as s,f as c,i as l,m as u,n as d,r as f,s as p,u as m}from"./web.DwNv8rLL.js";import{n as h}from"./i18n.3zKFZ7KU.js";import{t as g}from"./api.CGA0D2A2.js";var _=u(`<div class=plugin-manager><div class=page-header><h2></h2><p class=page-description></p><p class=page-hint></p></div><!$><!/><!$><!/><!$><!/><style>
2
2
  .page-header {
3
3
  margin-bottom: 1.5rem;
4
4
  }
@@ -1 +1 @@
1
- import{d as e,i as t,p as n,r,s as i,u as a,v as o}from"./solid.8gBSxpeo.js";import{a as s,c,d as l,f as u,i as d,m as f,r as p,s as m,u as h}from"./web.DwNv8rLL.js";import{n as g}from"./i18n.EKfvSb1v.js";import{t as _}from"./api.CM0tblEa.js";var v=f(`<div class="notice notice--error">`),y=f(`<button type=button class="btn btn-secondary">`),b=f(`<div class=post-types-manager><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required pattern=[a-z0-9_]+></label><label><!$><!/><input class=input required></label><label><!$><!/><input class=input required></label><label><!$><!/><input class=input placeholder=box><small class=muted></small></label></div><fieldset class=supports><legend></legend><!$><!/><label><input type=checkbox> <!$><!/></label><label><input type=checkbox> <!$><!/></label></fieldset><button type=submit class="btn btn-primary"></button><!$><!/></form><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),x=f(`<label><input type=checkbox> <!$><!/>`),ee=f(`<button type=button class="btn btn-danger">`),te=f(`<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><button type=button class="btn btn-secondary"></button> <!$><!/>`);function S(){let{t:f}=g(),[p,S]=n([]),[C,w]=n(``),[ne,T]=n(!1),[E,D]=n(null),re=a(()=>[{value:`title`,label:f(`settings.postTypes.form.supportsOptions.title`)},{value:`editor`,label:f(`settings.postTypes.form.supportsOptions.editor`)},{value:`thumbnail`,label:f(`settings.postTypes.form.supportsOptions.thumbnail`)},{value:`excerpt`,label:f(`settings.postTypes.form.supportsOptions.excerpt`)},{value:`revisions`,label:f(`settings.postTypes.form.supportsOptions.revisions`)}]),[O,k]=n({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]}),A=()=>{D(null),k({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]})},j=async()=>{try{S(await _.getContentTypes())}catch(e){w(e instanceof Error?e.message:String(e))}};o(j);let ie=async e=>{e.preventDefault(),w(``),T(!0);try{let e={name:O().name||O().slug,slug:O().slug,singularLabel:O().singularLabel,pluralLabel:O().pluralLabel,hasArchive:O().hasArchive,singleton:O().singleton,menuIcon:O().menuIcon||`box`,supports:O().supports};E()?await _.updateContentType(E(),e):await _.createContentType(e),A(),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){w(e instanceof Error?e.message:String(e))}finally{T(!1)}},ae=e=>{D(e.slug),k({name:e.name,slug:e.slug,singularLabel:e.singularLabel,pluralLabel:e.pluralLabel,hasArchive:e.hasArchive??!1,singleton:e.singleton??!1,menuIcon:e.menuIcon??`box`,supports:[...e.supports??[`title`,`editor`]]})},oe=async e=>{try{await _.deleteContentType(e),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){w(e instanceof Error?e.message:String(e))}};return(()=>{var n=d(b),a=n.firstChild,[o,g]=s(a.nextSibling),_=o.nextSibling,S=_.firstChild,w=S.nextSibling,T=w.firstChild,D=T.firstChild,[j,se]=s(D.nextSibling),M=j.nextSibling,N=T.nextSibling,ce=N.firstChild,[P,le]=s(ce.nextSibling),F=P.nextSibling,I=N.nextSibling,ue=I.firstChild,[L,de]=s(ue.nextSibling),R=L.nextSibling,z=I.nextSibling,fe=z.firstChild,[B,pe]=s(fe.nextSibling),V=B.nextSibling,me=V.nextSibling,H=w.nextSibling,U=H.firstChild,he=U.nextSibling,[W,ge]=s(he.nextSibling),G=W.nextSibling,K=G.firstChild,_e=K.nextSibling.nextSibling,[ve,ye]=s(_e.nextSibling),q=G.nextSibling,J=q.firstChild,be=J.nextSibling.nextSibling,[xe,Se]=s(be.nextSibling),Y=H.nextSibling,Ce=Y.nextSibling,[we,Te]=s(Ce.nextSibling),X=_.nextSibling.firstChild,Z=X.firstChild.firstChild,Q=Z.nextSibling,$=Q.nextSibling,Ee=$.nextSibling,De=Ee.nextSibling,Oe=De.nextSibling,ke=Oe.nextSibling,Ae=ke.nextSibling,je=X.nextSibling;return m(n,i(t,{get when(){return C()},get children(){var e=d(v);return m(e,C),e}}),o,g),_.addEventListener(`submit`,ie),m(S,(()=>{var e=c(()=>!!E());return()=>e()?f(`settings.postTypes.form.editTitle`):f(`settings.postTypes.form.title`)})()),m(T,()=>f(`settings.postTypes.form.slug`),j,se),M.$$input=e=>k({...O(),slug:e.currentTarget.value}),m(N,()=>f(`settings.postTypes.form.singular`),P,le),F.$$input=e=>k({...O(),singularLabel:e.currentTarget.value}),m(I,()=>f(`settings.postTypes.form.plural`),L,de),R.$$input=e=>k({...O(),pluralLabel:e.currentTarget.value}),m(z,()=>f(`settings.postTypes.form.icon`),B,pe),V.$$input=e=>k({...O(),menuIcon:e.currentTarget.value}),m(me,()=>f(`settings.postTypes.form.iconHint`)),m(U,()=>f(`settings.postTypes.form.supports`)),m(H,i(r,{get each(){return re()},children:t=>(()=>{var n=d(x),r=n.firstChild,i=r.nextSibling.nextSibling,[a,o]=s(i.nextSibling);return r.addEventListener(`change`,e=>k({...O(),supports:e.currentTarget.checked?[...O().supports,t.value]:O().supports.filter(e=>e!==t.value)})),m(n,()=>t.label,a,o),e(()=>u(r,`checked`,O().supports.includes(t.value))),n})()}),W,ge),K.addEventListener(`change`,e=>k({...O(),hasArchive:e.currentTarget.checked})),m(G,()=>f(`settings.postTypes.form.hasArchive`),ve,ye),J.addEventListener(`change`,e=>k({...O(),singleton:e.currentTarget.checked})),m(q,()=>f(`settings.postTypes.form.singleton`),xe,Se),m(Y,(()=>{var e=c(()=>!!E());return()=>e()?f(`settings.postTypes.form.update`):f(`settings.postTypes.form.create`)})()),m(_,i(t,{get when(){return E()},get children(){var e=d(y);return e.$$click=A,m(e,()=>f(`settings.postTypes.form.cancel`)),h(),e}}),we,Te),m(Z,()=>f(`settings.postTypes.table.slug`)),m(Q,()=>f(`settings.postTypes.table.singular`)),m($,()=>f(`settings.postTypes.table.plural`)),m(Ee,()=>f(`settings.postTypes.table.source`)),m(De,()=>f(`settings.postTypes.table.supports`)),m(Oe,()=>f(`settings.postTypes.table.archive`)),m(ke,()=>f(`settings.postTypes.table.mode`)),m(Ae,()=>f(`settings.postTypes.table.icon`)),m(je,i(r,{get each(){return p()},children:e=>(()=>{var n=d(te),r=n.firstChild,a=r.nextSibling,o=a.nextSibling,l=o.nextSibling,u=l.nextSibling,p=u.nextSibling,g=p.nextSibling,_=g.nextSibling,v=_.nextSibling,y=v.firstChild,b=y.nextSibling.nextSibling,[x,S]=s(b.nextSibling);return m(r,()=>e.slug),m(a,()=>e.singularLabel),m(o,()=>e.pluralLabel),m(l,()=>e.source??f(`settings.postTypes.sources.admin`)),m(u,()=>(e.supports??[]).join(`, `)),m(p,(()=>{var t=c(()=>!!e.hasArchive);return()=>t()?f(`common.yes`):f(`common.no`)})()),m(g,(()=>{var t=c(()=>!!e.singleton);return()=>t()?f(`settings.postTypes.table.singleton`):f(`settings.postTypes.table.collection`)})()),m(_,()=>e.menuIcon??`box`),y.$$click=()=>ae(e),m(y,()=>f(`settings.postTypes.table.actions.edit`)),m(v,i(t,{get when(){return e.source!==`CORE`},get children(){var t=d(ee);return t.$$click=()=>oe(e.slug),m(t,()=>f(`settings.postTypes.table.actions.remove`)),h(),t}}),x,S),h(),n})()})),e(e=>{var t=f(`settings.postTypes.form.slugHint`),n=ne();return t!==e.e&&l(M,`title`,e.e=t),n!==e.t&&u(Y,`disabled`,e.t=n),e},{e:void 0,t:void 0}),e(()=>u(M,`value`,O().slug)),e(()=>u(F,`value`,O().singularLabel)),e(()=>u(R,`value`,O().pluralLabel)),e(()=>u(V,`value`,O().menuIcon)),e(()=>u(K,`checked`,O().hasArchive)),e(()=>u(J,`checked`,O().singleton)),h(),n})()}p([`input`,`click`]);export{S as PostTypesManager};
1
+ import{d as e,i as t,p as n,r,s as i,u as a,v as o}from"./solid.8gBSxpeo.js";import{a as s,c,d as l,f as u,i as d,m as f,r as p,s as m,u as h}from"./web.DwNv8rLL.js";import{n as g}from"./i18n.3zKFZ7KU.js";import{t as _}from"./api.CGA0D2A2.js";var v=f(`<div class="notice notice--error">`),y=f(`<button type=button class="btn btn-secondary">`),b=f(`<div class=post-types-manager><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required pattern=[a-z0-9_]+></label><label><!$><!/><input class=input required></label><label><!$><!/><input class=input required></label><label><!$><!/><input class=input placeholder=box><small class=muted></small></label></div><fieldset class=supports><legend></legend><!$><!/><label><input type=checkbox> <!$><!/></label><label><input type=checkbox> <!$><!/></label></fieldset><button type=submit class="btn btn-primary"></button><!$><!/></form><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),x=f(`<label><input type=checkbox> <!$><!/>`),ee=f(`<button type=button class="btn btn-danger">`),te=f(`<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><button type=button class="btn btn-secondary"></button> <!$><!/>`);function S(){let{t:f}=g(),[p,S]=n([]),[C,w]=n(``),[ne,T]=n(!1),[E,D]=n(null),re=a(()=>[{value:`title`,label:f(`settings.postTypes.form.supportsOptions.title`)},{value:`editor`,label:f(`settings.postTypes.form.supportsOptions.editor`)},{value:`thumbnail`,label:f(`settings.postTypes.form.supportsOptions.thumbnail`)},{value:`excerpt`,label:f(`settings.postTypes.form.supportsOptions.excerpt`)},{value:`revisions`,label:f(`settings.postTypes.form.supportsOptions.revisions`)}]),[O,k]=n({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]}),A=()=>{D(null),k({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]})},j=async()=>{try{S(await _.getContentTypes())}catch(e){w(e instanceof Error?e.message:String(e))}};o(j);let ie=async e=>{e.preventDefault(),w(``),T(!0);try{let e={name:O().name||O().slug,slug:O().slug,singularLabel:O().singularLabel,pluralLabel:O().pluralLabel,hasArchive:O().hasArchive,singleton:O().singleton,menuIcon:O().menuIcon||`box`,supports:O().supports};E()?await _.updateContentType(E(),e):await _.createContentType(e),A(),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){w(e instanceof Error?e.message:String(e))}finally{T(!1)}},ae=e=>{D(e.slug),k({name:e.name,slug:e.slug,singularLabel:e.singularLabel,pluralLabel:e.pluralLabel,hasArchive:e.hasArchive??!1,singleton:e.singleton??!1,menuIcon:e.menuIcon??`box`,supports:[...e.supports??[`title`,`editor`]]})},oe=async e=>{try{await _.deleteContentType(e),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){w(e instanceof Error?e.message:String(e))}};return(()=>{var n=d(b),a=n.firstChild,[o,g]=s(a.nextSibling),_=o.nextSibling,S=_.firstChild,w=S.nextSibling,T=w.firstChild,D=T.firstChild,[j,se]=s(D.nextSibling),M=j.nextSibling,N=T.nextSibling,ce=N.firstChild,[P,le]=s(ce.nextSibling),F=P.nextSibling,I=N.nextSibling,ue=I.firstChild,[L,de]=s(ue.nextSibling),R=L.nextSibling,z=I.nextSibling,fe=z.firstChild,[B,pe]=s(fe.nextSibling),V=B.nextSibling,me=V.nextSibling,H=w.nextSibling,U=H.firstChild,he=U.nextSibling,[W,ge]=s(he.nextSibling),G=W.nextSibling,K=G.firstChild,_e=K.nextSibling.nextSibling,[ve,ye]=s(_e.nextSibling),q=G.nextSibling,J=q.firstChild,be=J.nextSibling.nextSibling,[xe,Se]=s(be.nextSibling),Y=H.nextSibling,Ce=Y.nextSibling,[we,Te]=s(Ce.nextSibling),X=_.nextSibling.firstChild,Z=X.firstChild.firstChild,Q=Z.nextSibling,$=Q.nextSibling,Ee=$.nextSibling,De=Ee.nextSibling,Oe=De.nextSibling,ke=Oe.nextSibling,Ae=ke.nextSibling,je=X.nextSibling;return m(n,i(t,{get when(){return C()},get children(){var e=d(v);return m(e,C),e}}),o,g),_.addEventListener(`submit`,ie),m(S,(()=>{var e=c(()=>!!E());return()=>e()?f(`settings.postTypes.form.editTitle`):f(`settings.postTypes.form.title`)})()),m(T,()=>f(`settings.postTypes.form.slug`),j,se),M.$$input=e=>k({...O(),slug:e.currentTarget.value}),m(N,()=>f(`settings.postTypes.form.singular`),P,le),F.$$input=e=>k({...O(),singularLabel:e.currentTarget.value}),m(I,()=>f(`settings.postTypes.form.plural`),L,de),R.$$input=e=>k({...O(),pluralLabel:e.currentTarget.value}),m(z,()=>f(`settings.postTypes.form.icon`),B,pe),V.$$input=e=>k({...O(),menuIcon:e.currentTarget.value}),m(me,()=>f(`settings.postTypes.form.iconHint`)),m(U,()=>f(`settings.postTypes.form.supports`)),m(H,i(r,{get each(){return re()},children:t=>(()=>{var n=d(x),r=n.firstChild,i=r.nextSibling.nextSibling,[a,o]=s(i.nextSibling);return r.addEventListener(`change`,e=>k({...O(),supports:e.currentTarget.checked?[...O().supports,t.value]:O().supports.filter(e=>e!==t.value)})),m(n,()=>t.label,a,o),e(()=>u(r,`checked`,O().supports.includes(t.value))),n})()}),W,ge),K.addEventListener(`change`,e=>k({...O(),hasArchive:e.currentTarget.checked})),m(G,()=>f(`settings.postTypes.form.hasArchive`),ve,ye),J.addEventListener(`change`,e=>k({...O(),singleton:e.currentTarget.checked})),m(q,()=>f(`settings.postTypes.form.singleton`),xe,Se),m(Y,(()=>{var e=c(()=>!!E());return()=>e()?f(`settings.postTypes.form.update`):f(`settings.postTypes.form.create`)})()),m(_,i(t,{get when(){return E()},get children(){var e=d(y);return e.$$click=A,m(e,()=>f(`settings.postTypes.form.cancel`)),h(),e}}),we,Te),m(Z,()=>f(`settings.postTypes.table.slug`)),m(Q,()=>f(`settings.postTypes.table.singular`)),m($,()=>f(`settings.postTypes.table.plural`)),m(Ee,()=>f(`settings.postTypes.table.source`)),m(De,()=>f(`settings.postTypes.table.supports`)),m(Oe,()=>f(`settings.postTypes.table.archive`)),m(ke,()=>f(`settings.postTypes.table.mode`)),m(Ae,()=>f(`settings.postTypes.table.icon`)),m(je,i(r,{get each(){return p()},children:e=>(()=>{var n=d(te),r=n.firstChild,a=r.nextSibling,o=a.nextSibling,l=o.nextSibling,u=l.nextSibling,p=u.nextSibling,g=p.nextSibling,_=g.nextSibling,v=_.nextSibling,y=v.firstChild,b=y.nextSibling.nextSibling,[x,S]=s(b.nextSibling);return m(r,()=>e.slug),m(a,()=>e.singularLabel),m(o,()=>e.pluralLabel),m(l,()=>e.source??f(`settings.postTypes.sources.admin`)),m(u,()=>(e.supports??[]).join(`, `)),m(p,(()=>{var t=c(()=>!!e.hasArchive);return()=>t()?f(`common.yes`):f(`common.no`)})()),m(g,(()=>{var t=c(()=>!!e.singleton);return()=>t()?f(`settings.postTypes.table.singleton`):f(`settings.postTypes.table.collection`)})()),m(_,()=>e.menuIcon??`box`),y.$$click=()=>ae(e),m(y,()=>f(`settings.postTypes.table.actions.edit`)),m(v,i(t,{get when(){return e.source!==`CORE`},get children(){var t=d(ee);return t.$$click=()=>oe(e.slug),m(t,()=>f(`settings.postTypes.table.actions.remove`)),h(),t}}),x,S),h(),n})()})),e(e=>{var t=f(`settings.postTypes.form.slugHint`),n=ne();return t!==e.e&&l(M,`title`,e.e=t),n!==e.t&&u(Y,`disabled`,e.t=n),e},{e:void 0,t:void 0}),e(()=>u(M,`value`,O().slug)),e(()=>u(F,`value`,O().singularLabel)),e(()=>u(R,`value`,O().pluralLabel)),e(()=>u(V,`value`,O().menuIcon)),e(()=>u(K,`checked`,O().hasArchive)),e(()=>u(J,`checked`,O().singleton)),h(),n})()}p([`input`,`click`]);export{S as PostTypesManager};
@@ -1,4 +1,4 @@
1
- import{d as e,p as t,r as n,s as r,v as i}from"./solid.8gBSxpeo.js";import{a,c as o,d as s,f as c,i as l,m as u,r as d,s as f,u as p}from"./web.DwNv8rLL.js";import{n as m}from"./i18n.EKfvSb1v.js";import{t as h}from"./api.CM0tblEa.js";import{DashboardWidget as g}from"./AtGlanceWidget.h60KI_JU.js";var _=u(`<div class=quick-draft-wrapper><div class=quick-draft-content-wrapper>`),v=u(`<style>
1
+ import{d as e,p as t,r as n,s as r,v as i}from"./solid.8gBSxpeo.js";import{a,c as o,d as s,f as c,i as l,m as u,r as d,s as f,u as p}from"./web.DwNv8rLL.js";import{n as m}from"./i18n.3zKFZ7KU.js";import{t as h}from"./api.CGA0D2A2.js";import{DashboardWidget as g}from"./AtGlanceWidget.rW3GsIjs.js";var _=u(`<div class=quick-draft-wrapper><div class=quick-draft-content-wrapper>`),v=u(`<style>
2
2
  .quick-draft-form { display: flex; flex-direction: column; gap: 1rem; }
3
3
  .form-group textarea { min-height: 100px; resize: vertical; font-family: inherit; }
4
4
  .drafts-list h4 { margin-bottom: 1rem; }
@@ -1 +1 @@
1
- import{d as e,i as t,p as n,r,s as i,v as a}from"./solid.8gBSxpeo.js";import{a as o,d as s,f as c,i as l,m as u,r as d,s as f,u as p}from"./web.DwNv8rLL.js";import{n as m}from"./i18n.EKfvSb1v.js";import{t as h}from"./api.CM0tblEa.js";var g=u(`<div class="notice notice--error">`),_=u(`<div class=resource-hub><!$><!/><div class=access-grid><section class=card><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button><!$><!/><table class=table><tbody></tbody></table></section><section class=card><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button><!$><!/><table class=table><tbody>`),v=u(`<form class=resource-form><input class=input required><input class=input required><input class=input><button class="btn btn-primary"type=submit>`),y=u(`<button class="btn btn-danger"type=button>`),b=u(`<tr><td></td><td></td><td><button class=btn type=button></button><!$><!/>`),x=u(`<tr><td></td><td></td><td></td><td><button class=btn type=button></button><button class="btn btn-danger"type=button>`);function S(){let{t:u}=m(),[d,S]=n([]),[C,w]=n([]),[T,E]=n(null),[D,O]=n(null),[k,A]=n(``),j=async()=>{try{S(await h.listRoles()),w((await h.listTenants({limit:100})).data??[])}catch(e){A(e instanceof Error?e.message:String(e))}};return a(j),(()=>{var n=l(_),a=n.firstChild,[m,S]=o(a.nextSibling),w=m.nextSibling.firstChild,M=w.firstChild,N=M.nextSibling,P=N.firstChild.nextSibling,[F,I]=o(P.nextSibling),L=N.nextSibling,[R,z]=o(L.nextSibling),B=R.nextSibling.firstChild,V=w.nextSibling,H=V.firstChild,U=H.nextSibling,W=U.firstChild.nextSibling,[G,K]=o(W.nextSibling),q=U.nextSibling,[J,Y]=o(q.nextSibling),X=J.nextSibling.firstChild;return f(n,i(t,{get when(){return k()},get children(){var e=l(g);return f(e,k),e}}),m,S),f(M,()=>u(`access.roles`)),N.$$click=()=>E({name:``,slug:``,permissions:[]}),f(N,()=>u(`common.create`),F,I),f(w,i(t,{get when(){return T()},children:t=>(()=>{var n=l(v),r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=a.nextSibling;return n.addEventListener(`submit`,e=>{e.preventDefault(),(t().id?h.updateRole(t().id,t()):h.createRole(t())).then(()=>(E(null),j())).catch(e=>A(e instanceof Error?e.message:String(e)))}),r.$$input=e=>E({...t(),name:e.currentTarget.value}),i.$$input=e=>E({...t(),slug:e.currentTarget.value}),a.$$input=e=>E({...t(),permissions:e.currentTarget.value.split(`,`).map(e=>e.trim()).filter(Boolean)}),f(o,()=>u(`common.save`)),e(e=>{var t=u(`resources.name`),n=u(`resources.slug`),o=u(`access.permissions`);return t!==e.e&&s(r,`placeholder`,e.e=t),n!==e.t&&s(i,`placeholder`,e.t=n),o!==e.a&&s(a,`placeholder`,e.a=o),e},{e:void 0,t:void 0,a:void 0}),e(()=>c(r,`value`,t().name??``)),e(()=>c(i,`value`,t().slug??``)),e(()=>c(a,`value`,(t().permissions??[]).join(`, `))),p(),n})()}),R,z),f(B,i(r,{get each(){return d()},children:e=>(()=>{var n=l(b),r=n.firstChild,a=r.nextSibling,s=a.nextSibling,c=s.firstChild,d=c.nextSibling,[m,g]=o(d.nextSibling);return f(r,()=>e.name),f(a,()=>e.slug),c.$$click=()=>E(e),f(c,()=>u(`common.edit`)),f(s,i(t,{get when(){return!e.is_system},get children(){var t=l(y);return t.$$click=()=>void h.deleteRole(e.id).then(j),f(t,()=>u(`common.delete`)),p(),t}}),m,g),p(),n})()})),f(H,()=>u(`access.tenants`)),U.$$click=()=>O({name:``,slug:``}),f(U,()=>u(`common.create`),G,K),f(V,i(t,{get when(){return D()},children:t=>(()=>{var n=l(v),r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=a.nextSibling;return n.addEventListener(`submit`,e=>{e.preventDefault(),(t().id?h.updateTenant(t().id,t()):h.createTenant(t())).then(()=>(O(null),j())).catch(e=>A(e instanceof Error?e.message:String(e)))}),r.$$input=e=>O({...t(),name:e.currentTarget.value}),i.$$input=e=>O({...t(),slug:e.currentTarget.value}),a.$$input=e=>O({...t(),domain:e.currentTarget.value}),f(o,()=>u(`common.save`)),e(e=>{var t=u(`resources.name`),n=u(`resources.slug`),o=u(`access.domain`);return t!==e.e&&s(r,`placeholder`,e.e=t),n!==e.t&&s(i,`placeholder`,e.t=n),o!==e.a&&s(a,`placeholder`,e.a=o),e},{e:void 0,t:void 0,a:void 0}),e(()=>c(r,`value`,t().name??``)),e(()=>c(i,`value`,t().slug??``)),e(()=>c(a,`value`,t().domain??``)),p(),n})()}),J,Y),f(X,i(r,{get each(){return C()},children:e=>(()=>{var t=l(x),n=t.firstChild,r=n.nextSibling,i=r.nextSibling,a=i.nextSibling.firstChild,o=a.nextSibling;return f(n,()=>e.name),f(r,()=>e.slug),f(i,()=>e.status),a.$$click=()=>O(e),f(a,()=>u(`common.edit`)),o.$$click=()=>e.id&&void h.deleteTenant(e.id).then(j),f(o,()=>u(`common.delete`)),p(),t})()})),p(),n})()}d([`click`,`input`]);export{S as AccessManager};
1
+ import{d as e,i as t,p as n,r,s as i,v as a}from"./solid.8gBSxpeo.js";import{a as o,d as s,f as c,i as l,m as u,r as d,s as f,u as p}from"./web.DwNv8rLL.js";import{n as m}from"./i18n.3zKFZ7KU.js";import{t as h}from"./api.CGA0D2A2.js";var g=u(`<div class="notice notice--error">`),_=u(`<div class=resource-hub><!$><!/><div class=access-grid><section class=card><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button><!$><!/><table class=table><tbody></tbody></table></section><section class=card><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button><!$><!/><table class=table><tbody>`),v=u(`<form class=resource-form><input class=input required><input class=input required><input class=input><button class="btn btn-primary"type=submit>`),y=u(`<button class="btn btn-danger"type=button>`),b=u(`<tr><td></td><td></td><td><button class=btn type=button></button><!$><!/>`),x=u(`<tr><td></td><td></td><td></td><td><button class=btn type=button></button><button class="btn btn-danger"type=button>`);function S(){let{t:u}=m(),[d,S]=n([]),[C,w]=n([]),[T,E]=n(null),[D,O]=n(null),[k,A]=n(``),j=async()=>{try{S(await h.listRoles()),w((await h.listTenants({limit:100})).data??[])}catch(e){A(e instanceof Error?e.message:String(e))}};return a(j),(()=>{var n=l(_),a=n.firstChild,[m,S]=o(a.nextSibling),w=m.nextSibling.firstChild,M=w.firstChild,N=M.nextSibling,P=N.firstChild.nextSibling,[F,I]=o(P.nextSibling),L=N.nextSibling,[R,z]=o(L.nextSibling),B=R.nextSibling.firstChild,V=w.nextSibling,H=V.firstChild,U=H.nextSibling,W=U.firstChild.nextSibling,[G,K]=o(W.nextSibling),q=U.nextSibling,[J,Y]=o(q.nextSibling),X=J.nextSibling.firstChild;return f(n,i(t,{get when(){return k()},get children(){var e=l(g);return f(e,k),e}}),m,S),f(M,()=>u(`access.roles`)),N.$$click=()=>E({name:``,slug:``,permissions:[]}),f(N,()=>u(`common.create`),F,I),f(w,i(t,{get when(){return T()},children:t=>(()=>{var n=l(v),r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=a.nextSibling;return n.addEventListener(`submit`,e=>{e.preventDefault(),(t().id?h.updateRole(t().id,t()):h.createRole(t())).then(()=>(E(null),j())).catch(e=>A(e instanceof Error?e.message:String(e)))}),r.$$input=e=>E({...t(),name:e.currentTarget.value}),i.$$input=e=>E({...t(),slug:e.currentTarget.value}),a.$$input=e=>E({...t(),permissions:e.currentTarget.value.split(`,`).map(e=>e.trim()).filter(Boolean)}),f(o,()=>u(`common.save`)),e(e=>{var t=u(`resources.name`),n=u(`resources.slug`),o=u(`access.permissions`);return t!==e.e&&s(r,`placeholder`,e.e=t),n!==e.t&&s(i,`placeholder`,e.t=n),o!==e.a&&s(a,`placeholder`,e.a=o),e},{e:void 0,t:void 0,a:void 0}),e(()=>c(r,`value`,t().name??``)),e(()=>c(i,`value`,t().slug??``)),e(()=>c(a,`value`,(t().permissions??[]).join(`, `))),p(),n})()}),R,z),f(B,i(r,{get each(){return d()},children:e=>(()=>{var n=l(b),r=n.firstChild,a=r.nextSibling,s=a.nextSibling,c=s.firstChild,d=c.nextSibling,[m,g]=o(d.nextSibling);return f(r,()=>e.name),f(a,()=>e.slug),c.$$click=()=>E(e),f(c,()=>u(`common.edit`)),f(s,i(t,{get when(){return!e.is_system},get children(){var t=l(y);return t.$$click=()=>void h.deleteRole(e.id).then(j),f(t,()=>u(`common.delete`)),p(),t}}),m,g),p(),n})()})),f(H,()=>u(`access.tenants`)),U.$$click=()=>O({name:``,slug:``}),f(U,()=>u(`common.create`),G,K),f(V,i(t,{get when(){return D()},children:t=>(()=>{var n=l(v),r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=a.nextSibling;return n.addEventListener(`submit`,e=>{e.preventDefault(),(t().id?h.updateTenant(t().id,t()):h.createTenant(t())).then(()=>(O(null),j())).catch(e=>A(e instanceof Error?e.message:String(e)))}),r.$$input=e=>O({...t(),name:e.currentTarget.value}),i.$$input=e=>O({...t(),slug:e.currentTarget.value}),a.$$input=e=>O({...t(),domain:e.currentTarget.value}),f(o,()=>u(`common.save`)),e(e=>{var t=u(`resources.name`),n=u(`resources.slug`),o=u(`access.domain`);return t!==e.e&&s(r,`placeholder`,e.e=t),n!==e.t&&s(i,`placeholder`,e.t=n),o!==e.a&&s(a,`placeholder`,e.a=o),e},{e:void 0,t:void 0,a:void 0}),e(()=>c(r,`value`,t().name??``)),e(()=>c(i,`value`,t().slug??``)),e(()=>c(a,`value`,t().domain??``)),p(),n})()}),J,Y),f(X,i(r,{get each(){return C()},children:e=>(()=>{var t=l(x),n=t.firstChild,r=n.nextSibling,i=r.nextSibling,a=i.nextSibling.firstChild,o=a.nextSibling;return f(n,()=>e.name),f(r,()=>e.slug),f(i,()=>e.status),a.$$click=()=>O(e),f(a,()=>u(`common.edit`)),o.$$click=()=>e.id&&void h.deleteTenant(e.id).then(j),f(o,()=>u(`common.delete`)),p(),t})()})),p(),n})()}d([`click`,`input`]);export{S as AccessManager};
@@ -1 +1 @@
1
- import{d as e,i as t,p as n,r,s as i,v as a}from"./solid.8gBSxpeo.js";import{a as o,c as s,d as c,f as l,i as u,m as d,r as f,s as p,u as m}from"./web.DwNv8rLL.js";import{n as h}from"./i18n.EKfvSb1v.js";import{t as g}from"./api.CM0tblEa.js";var _=d(`<div class="notice notice--error">`),v=d(`<div class=taxonomies-manager><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required></label><label><!$><!/><input class=input pattern=[a-z0-9_]*></label><label><input type=checkbox> <!$><!/></label></div><fieldset><legend></legend><!$><!/></fieldset><button type=submit class="btn btn-primary"></button></form><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody>`),y=d(`<label><input type=checkbox> <!$><!/> (<!$><!/>)`),b=d(`<button type=button class="btn btn-danger">`),x=d(`<tr><td><!$><!/> (<!$><!/>)</td><td></td><td></td><td>`),ee=d(`<label style=margin-right:0.75rem><input type=checkbox> <!$><!/>`);function S(){let{t:d}=h(),[f,S]=n([]),[C,w]=n([]),[T,E]=n(``),[D,O]=n(!1),[k,A]=n({name:``,slug:``,hierarchical:!1,attachTo:[]}),j=async()=>{try{let[e,t]=await Promise.all([g.getTaxonomies(),g.getContentTypes()]);S(e),w(t)}catch(e){E(e instanceof Error?e.message:String(e))}};a(j);let M=async e=>{e.preventDefault(),E(``),O(!0);try{await g.createTaxonomy({name:k().name,slug:k().slug||void 0,hierarchical:k().hierarchical,attachTo:k().attachTo,labels:{singular_name:k().name}}),A({name:``,slug:``,hierarchical:!1,attachTo:[]}),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}finally{O(!1)}},N=async(e,t)=>{let n=e.attachTo?.includes(t);try{n?await g.detachTaxonomy(e.slug,t):await g.attachTaxonomy(e.slug,t),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}},P=async e=>{try{await g.deleteTaxonomy(e),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}};return(()=>{var n=u(v),a=n.firstChild,[h,g]=o(a.nextSibling),S=h.nextSibling,w=S.firstChild,E=w.nextSibling,O=E.firstChild,j=O.firstChild,[F,I]=o(j.nextSibling),L=F.nextSibling,R=O.nextSibling,z=R.firstChild,[B,V]=o(z.nextSibling),H=B.nextSibling,U=R.nextSibling,W=U.firstChild,G=W.nextSibling.nextSibling,[K,q]=o(G.nextSibling),J=E.nextSibling,Y=J.firstChild,te=Y.nextSibling,[ne,re]=o(te.nextSibling),X=J.nextSibling,Z=S.nextSibling.firstChild,Q=Z.firstChild.firstChild,$=Q.nextSibling,ie=$.nextSibling,ae=Z.nextSibling;return p(n,i(t,{get when(){return T()},get children(){var e=u(_);return p(e,T),e}}),h,g),S.addEventListener(`submit`,M),p(w,()=>d(`settings.taxonomies.form.title`)),p(O,()=>d(`settings.taxonomies.form.name`),F,I),L.$$input=e=>A({...k(),name:e.currentTarget.value}),p(R,()=>d(`settings.taxonomies.form.slug`),B,V),H.$$input=e=>A({...k(),slug:e.currentTarget.value}),W.addEventListener(`change`,e=>A({...k(),hierarchical:e.currentTarget.checked})),p(U,()=>d(`settings.taxonomies.form.hierarchical`),K,q),p(Y,()=>d(`settings.taxonomies.form.attachTo`)),p(J,i(r,{get each(){return C()},children:t=>(()=>{var n=u(y),r=n.firstChild,i=r.nextSibling.nextSibling,[a,s]=o(i.nextSibling),c=a.nextSibling.nextSibling,[d,f]=o(c.nextSibling);return d.nextSibling,r.addEventListener(`change`,e=>A({...k(),attachTo:e.currentTarget.checked?[...k().attachTo,t.slug]:k().attachTo.filter(e=>e!==t.slug)})),p(n,()=>t.pluralLabel,a,s),p(n,()=>t.slug,d,f),e(()=>l(r,`checked`,k().attachTo.includes(t.slug))),n})()}),ne,re),p(X,()=>d(`settings.taxonomies.form.create`)),p(Q,()=>d(`settings.taxonomies.table.taxonomy`)),p($,()=>d(`settings.taxonomies.table.hierarchical`)),p(ie,()=>d(`settings.taxonomies.table.attachedTypes`)),p(ae,i(r,{get each(){return f()},children:n=>(()=>{var a=u(x),c=a.firstChild,f=c.firstChild,[h,g]=o(f.nextSibling),_=h.nextSibling.nextSibling,[v,y]=o(_.nextSibling);v.nextSibling;var S=c.nextSibling,w=S.nextSibling,T=w.nextSibling;return p(c,()=>n.name,h,g),p(c,()=>n.slug,v,y),p(S,(()=>{var e=s(()=>!!n.hierarchical);return()=>e()?d(`common.yes`):d(`common.no`)})()),p(w,i(r,{get each(){return C()},children:t=>(()=>{var r=u(ee),i=r.firstChild,a=i.nextSibling.nextSibling,[s,c]=o(a.nextSibling);return i.addEventListener(`change`,()=>N(n,t.slug)),p(r,()=>t.slug,s,c),e(()=>l(i,`checked`,n.attachTo?.includes(t.slug)??!1)),r})()})),p(T,i(t,{get when(){return n.source!==`CORE`},get children(){var e=u(b);return e.$$click=()=>P(n.slug),p(e,()=>d(`settings.taxonomies.table.actions.remove`)),m(),e}})),a})()})),e(e=>{var t=d(`settings.taxonomies.form.slugHint`),n=D();return t!==e.e&&c(H,`title`,e.e=t),n!==e.t&&l(X,`disabled`,e.t=n),e},{e:void 0,t:void 0}),e(()=>l(L,`value`,k().name)),e(()=>l(H,`value`,k().slug)),e(()=>l(W,`checked`,k().hierarchical)),m(),n})()}f([`input`,`click`]);export{S as TaxonomiesManager};
1
+ import{d as e,i as t,p as n,r,s as i,v as a}from"./solid.8gBSxpeo.js";import{a as o,c as s,d as c,f as l,i as u,m as d,r as f,s as p,u as m}from"./web.DwNv8rLL.js";import{n as h}from"./i18n.3zKFZ7KU.js";import{t as g}from"./api.CGA0D2A2.js";var _=d(`<div class="notice notice--error">`),v=d(`<div class=taxonomies-manager><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required></label><label><!$><!/><input class=input pattern=[a-z0-9_]*></label><label><input type=checkbox> <!$><!/></label></div><fieldset><legend></legend><!$><!/></fieldset><button type=submit class="btn btn-primary"></button></form><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody>`),y=d(`<label><input type=checkbox> <!$><!/> (<!$><!/>)`),b=d(`<button type=button class="btn btn-danger">`),x=d(`<tr><td><!$><!/> (<!$><!/>)</td><td></td><td></td><td>`),ee=d(`<label style=margin-right:0.75rem><input type=checkbox> <!$><!/>`);function S(){let{t:d}=h(),[f,S]=n([]),[C,w]=n([]),[T,E]=n(``),[D,O]=n(!1),[k,A]=n({name:``,slug:``,hierarchical:!1,attachTo:[]}),j=async()=>{try{let[e,t]=await Promise.all([g.getTaxonomies(),g.getContentTypes()]);S(e),w(t)}catch(e){E(e instanceof Error?e.message:String(e))}};a(j);let M=async e=>{e.preventDefault(),E(``),O(!0);try{await g.createTaxonomy({name:k().name,slug:k().slug||void 0,hierarchical:k().hierarchical,attachTo:k().attachTo,labels:{singular_name:k().name}}),A({name:``,slug:``,hierarchical:!1,attachTo:[]}),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}finally{O(!1)}},N=async(e,t)=>{let n=e.attachTo?.includes(t);try{n?await g.detachTaxonomy(e.slug,t):await g.attachTaxonomy(e.slug,t),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}},P=async e=>{try{await g.deleteTaxonomy(e),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}};return(()=>{var n=u(v),a=n.firstChild,[h,g]=o(a.nextSibling),S=h.nextSibling,w=S.firstChild,E=w.nextSibling,O=E.firstChild,j=O.firstChild,[F,I]=o(j.nextSibling),L=F.nextSibling,R=O.nextSibling,z=R.firstChild,[B,V]=o(z.nextSibling),H=B.nextSibling,U=R.nextSibling,W=U.firstChild,G=W.nextSibling.nextSibling,[K,q]=o(G.nextSibling),J=E.nextSibling,Y=J.firstChild,te=Y.nextSibling,[ne,re]=o(te.nextSibling),X=J.nextSibling,Z=S.nextSibling.firstChild,Q=Z.firstChild.firstChild,$=Q.nextSibling,ie=$.nextSibling,ae=Z.nextSibling;return p(n,i(t,{get when(){return T()},get children(){var e=u(_);return p(e,T),e}}),h,g),S.addEventListener(`submit`,M),p(w,()=>d(`settings.taxonomies.form.title`)),p(O,()=>d(`settings.taxonomies.form.name`),F,I),L.$$input=e=>A({...k(),name:e.currentTarget.value}),p(R,()=>d(`settings.taxonomies.form.slug`),B,V),H.$$input=e=>A({...k(),slug:e.currentTarget.value}),W.addEventListener(`change`,e=>A({...k(),hierarchical:e.currentTarget.checked})),p(U,()=>d(`settings.taxonomies.form.hierarchical`),K,q),p(Y,()=>d(`settings.taxonomies.form.attachTo`)),p(J,i(r,{get each(){return C()},children:t=>(()=>{var n=u(y),r=n.firstChild,i=r.nextSibling.nextSibling,[a,s]=o(i.nextSibling),c=a.nextSibling.nextSibling,[d,f]=o(c.nextSibling);return d.nextSibling,r.addEventListener(`change`,e=>A({...k(),attachTo:e.currentTarget.checked?[...k().attachTo,t.slug]:k().attachTo.filter(e=>e!==t.slug)})),p(n,()=>t.pluralLabel,a,s),p(n,()=>t.slug,d,f),e(()=>l(r,`checked`,k().attachTo.includes(t.slug))),n})()}),ne,re),p(X,()=>d(`settings.taxonomies.form.create`)),p(Q,()=>d(`settings.taxonomies.table.taxonomy`)),p($,()=>d(`settings.taxonomies.table.hierarchical`)),p(ie,()=>d(`settings.taxonomies.table.attachedTypes`)),p(ae,i(r,{get each(){return f()},children:n=>(()=>{var a=u(x),c=a.firstChild,f=c.firstChild,[h,g]=o(f.nextSibling),_=h.nextSibling.nextSibling,[v,y]=o(_.nextSibling);v.nextSibling;var S=c.nextSibling,w=S.nextSibling,T=w.nextSibling;return p(c,()=>n.name,h,g),p(c,()=>n.slug,v,y),p(S,(()=>{var e=s(()=>!!n.hierarchical);return()=>e()?d(`common.yes`):d(`common.no`)})()),p(w,i(r,{get each(){return C()},children:t=>(()=>{var r=u(ee),i=r.firstChild,a=i.nextSibling.nextSibling,[s,c]=o(a.nextSibling);return i.addEventListener(`change`,()=>N(n,t.slug)),p(r,()=>t.slug,s,c),e(()=>l(i,`checked`,n.attachTo?.includes(t.slug)??!1)),r})()})),p(T,i(t,{get when(){return n.source!==`CORE`},get children(){var e=u(b);return e.$$click=()=>P(n.slug),p(e,()=>d(`settings.taxonomies.table.actions.remove`)),m(),e}})),a})()})),e(e=>{var t=d(`settings.taxonomies.form.slugHint`),n=D();return t!==e.e&&c(H,`title`,e.e=t),n!==e.t&&l(X,`disabled`,e.t=n),e},{e:void 0,t:void 0}),e(()=>l(L,`value`,k().name)),e(()=>l(H,`value`,k().slug)),e(()=>l(W,`checked`,k().hierarchical)),m(),n})()}f([`input`,`click`]);export{S as TaxonomiesManager};
@@ -1 +1 @@
1
- import{d as e,i as t,p as n,r,s as i,v as a}from"./solid.8gBSxpeo.js";import{a as o,c as s,f as c,i as l,m as u,r as d,s as f,u as p}from"./web.DwNv8rLL.js";import{n as m}from"./i18n.EKfvSb1v.js";import{t as h}from"./api.CM0tblEa.js";var g=u(`<div class="notice notice--error">`),_=u(`<button class=btn type=button>`),v=u(`<form class="card term-form"><h3></h3><label><!$><!/><input class=input required></label><label><!$><!/><input class=input></label><label><!$><!/><textarea class=input rows=3></textarea></label><div class=form-actions><button class="btn btn-primary"type=submit></button><!$><!/>`),y=u(`<table class=table><thead><tr><th></th><th></th><th></th></tr></thead><tbody>`),b=u(`<div class=card><div class=card-header><div><h3></h3><p class=muted></p></div><span class=badge></span></div><!$><!/>`),x=u(`<div class=terms-panel><!$><!/><!$><!/><!$><!/>`),S=u(`<p class=muted>`),C=u(`<tr><td></td><td></td><td><button class="btn btn-secondary btn-sm"type=button></button> <button class="btn btn-danger btn-sm"type=button>`);function w(u){let{t:d}=m(),[w,T]=n(null),[E,D]=n([]),[O,k]=n(``),[A,j]=n(``),[M,N]=n(``),[P,F]=n(null),[I,L]=n(``),[R,z]=n(!1),B=async()=>{if(u.taxonomySlug)try{let[e,t]=await Promise.all([h.getTaxonomies(),h.getTaxonomyTerms(u.taxonomySlug)]);T(e.find(e=>e.slug===u.taxonomySlug)??null),D(t)}catch(e){L(e instanceof Error?e.message:String(e))}};a(B);let V=()=>{F(null),k(``),j(``),N(``)},H=e=>{F(e.id??null),k(e.name),j(e.slug),N(e.description??``),L(``)},U=async e=>{e.preventDefault(),L(``),z(!0);try{let e={name:O(),slug:A()||void 0,description:M()||void 0};P()?await h.updateTaxonomyTerm(u.taxonomySlug,P(),e):await h.createTaxonomyTerm(u.taxonomySlug,e),V(),await B()}catch(e){L(e instanceof Error?e.message:String(e))}finally{z(!1)}},W=async e=>{if(e.id&&confirm(d(`content.taxonomy.confirmDelete`,{name:e.name})))try{await h.deleteTaxonomyTerm(u.taxonomySlug,e.id),await B()}catch(e){L(e instanceof Error?e.message:String(e))}};return(()=>{var n=l(x),a=n.firstChild,[m,h]=o(a.nextSibling),T=m.nextSibling,[D,F]=o(T.nextSibling),L=D.nextSibling,[z,B]=o(L.nextSibling);return f(n,i(t,{get when(){return I()},get children(){var e=l(g);return f(e,I),e}}),m,h),f(n,i(t,{get when(){return s(()=>!w())()&&u.taxonomySlug},get children(){var e=l(g);return f(e,()=>d(`content.taxonomy.notFound`)),e}}),D,F),f(n,i(t,{get when(){return w()},get children(){return[(()=>{var n=l(v),r=n.firstChild,a=r.nextSibling,u=a.firstChild,[m,h]=o(u.nextSibling),g=m.nextSibling,y=a.nextSibling,b=y.firstChild,[x,S]=o(b.nextSibling),C=x.nextSibling,w=y.nextSibling,T=w.firstChild,[E,D]=o(T.nextSibling),F=E.nextSibling,I=w.nextSibling,L=I.firstChild,z=L.nextSibling,[B,H]=o(z.nextSibling);return n.addEventListener(`submit`,U),f(r,(()=>{var e=s(()=>!!P());return()=>e()?d(`content.taxonomy.editTerm`):d(`content.taxonomy.addTerm`)})()),f(a,()=>d(`content.taxonomy.name`),m,h),g.$$input=e=>k(e.currentTarget.value),f(y,()=>d(`content.taxonomy.slug`),x,S),C.$$input=e=>j(e.currentTarget.value),f(w,()=>d(`content.taxonomy.description`),E,D),F.$$input=e=>N(e.currentTarget.value),f(L,(()=>{var e=s(()=>!!P());return()=>e()?d(`common.save`):d(`content.taxonomy.add`)})()),f(I,i(t,{get when(){return P()},get children(){var e=l(_);return e.$$click=V,f(e,()=>d(`common.cancel`)),p(),e}}),B,H),e(()=>c(L,`disabled`,R())),e(()=>c(g,`value`,O())),e(()=>c(C,`value`,A())),e(()=>c(F,`value`,M())),p(),n})(),(()=>{var e=l(b),n=e.firstChild,a=n.firstChild,c=a.firstChild,m=c.nextSibling,h=a.nextSibling,g=n.nextSibling,[_,v]=o(g.nextSibling);return f(c,()=>w().name),f(m,(()=>{var e=s(()=>!!u.contentType);return()=>e()?`${d(`content.taxonomy.attachedTo`)}: ${u.contentType}`:d(`content.taxonomy.descriptionHint`)})()),f(h,()=>E().length),f(e,i(t,{get when(){return E().length>0},get fallback(){return(()=>{var e=l(S);return f(e,()=>d(`content.taxonomy.empty`)),e})()},get children(){var e=l(y),t=e.firstChild,n=t.firstChild.firstChild,a=n.nextSibling,o=t.nextSibling;return f(n,()=>d(`content.taxonomy.name`)),f(a,()=>d(`content.taxonomy.slug`)),f(o,i(r,{get each(){return E()},children:e=>(()=>{var t=l(C),n=t.firstChild,r=n.nextSibling,i=r.nextSibling.firstChild,a=i.nextSibling.nextSibling;return f(n,()=>e.name),f(r,()=>e.slug),i.$$click=()=>H(e),f(i,()=>d(`common.edit`)),a.$$click=()=>void W(e),f(a,()=>d(`content.taxonomy.delete`)),p(),t})()})),e}}),_,v),e})()]}}),z,B),n})()}d([`input`,`click`]);export{w as TaxonomyTermsManager};
1
+ import{d as e,i as t,p as n,r,s as i,v as a}from"./solid.8gBSxpeo.js";import{a as o,c as s,f as c,i as l,m as u,r as d,s as f,u as p}from"./web.DwNv8rLL.js";import{n as m}from"./i18n.3zKFZ7KU.js";import{t as h}from"./api.CGA0D2A2.js";var g=u(`<div class="notice notice--error">`),_=u(`<button class=btn type=button>`),v=u(`<form class="card term-form"><h3></h3><label><!$><!/><input class=input required></label><label><!$><!/><input class=input></label><label><!$><!/><textarea class=input rows=3></textarea></label><div class=form-actions><button class="btn btn-primary"type=submit></button><!$><!/>`),y=u(`<table class=table><thead><tr><th></th><th></th><th></th></tr></thead><tbody>`),b=u(`<div class=card><div class=card-header><div><h3></h3><p class=muted></p></div><span class=badge></span></div><!$><!/>`),x=u(`<div class=terms-panel><!$><!/><!$><!/><!$><!/>`),S=u(`<p class=muted>`),C=u(`<tr><td></td><td></td><td><button class="btn btn-secondary btn-sm"type=button></button> <button class="btn btn-danger btn-sm"type=button>`);function w(u){let{t:d}=m(),[w,T]=n(null),[E,D]=n([]),[O,k]=n(``),[A,j]=n(``),[M,N]=n(``),[P,F]=n(null),[I,L]=n(``),[R,z]=n(!1),B=async()=>{if(u.taxonomySlug)try{let[e,t]=await Promise.all([h.getTaxonomies(),h.getTaxonomyTerms(u.taxonomySlug)]);T(e.find(e=>e.slug===u.taxonomySlug)??null),D(t)}catch(e){L(e instanceof Error?e.message:String(e))}};a(B);let V=()=>{F(null),k(``),j(``),N(``)},H=e=>{F(e.id??null),k(e.name),j(e.slug),N(e.description??``),L(``)},U=async e=>{e.preventDefault(),L(``),z(!0);try{let e={name:O(),slug:A()||void 0,description:M()||void 0};P()?await h.updateTaxonomyTerm(u.taxonomySlug,P(),e):await h.createTaxonomyTerm(u.taxonomySlug,e),V(),await B()}catch(e){L(e instanceof Error?e.message:String(e))}finally{z(!1)}},W=async e=>{if(e.id&&confirm(d(`content.taxonomy.confirmDelete`,{name:e.name})))try{await h.deleteTaxonomyTerm(u.taxonomySlug,e.id),await B()}catch(e){L(e instanceof Error?e.message:String(e))}};return(()=>{var n=l(x),a=n.firstChild,[m,h]=o(a.nextSibling),T=m.nextSibling,[D,F]=o(T.nextSibling),L=D.nextSibling,[z,B]=o(L.nextSibling);return f(n,i(t,{get when(){return I()},get children(){var e=l(g);return f(e,I),e}}),m,h),f(n,i(t,{get when(){return s(()=>!w())()&&u.taxonomySlug},get children(){var e=l(g);return f(e,()=>d(`content.taxonomy.notFound`)),e}}),D,F),f(n,i(t,{get when(){return w()},get children(){return[(()=>{var n=l(v),r=n.firstChild,a=r.nextSibling,u=a.firstChild,[m,h]=o(u.nextSibling),g=m.nextSibling,y=a.nextSibling,b=y.firstChild,[x,S]=o(b.nextSibling),C=x.nextSibling,w=y.nextSibling,T=w.firstChild,[E,D]=o(T.nextSibling),F=E.nextSibling,I=w.nextSibling,L=I.firstChild,z=L.nextSibling,[B,H]=o(z.nextSibling);return n.addEventListener(`submit`,U),f(r,(()=>{var e=s(()=>!!P());return()=>e()?d(`content.taxonomy.editTerm`):d(`content.taxonomy.addTerm`)})()),f(a,()=>d(`content.taxonomy.name`),m,h),g.$$input=e=>k(e.currentTarget.value),f(y,()=>d(`content.taxonomy.slug`),x,S),C.$$input=e=>j(e.currentTarget.value),f(w,()=>d(`content.taxonomy.description`),E,D),F.$$input=e=>N(e.currentTarget.value),f(L,(()=>{var e=s(()=>!!P());return()=>e()?d(`common.save`):d(`content.taxonomy.add`)})()),f(I,i(t,{get when(){return P()},get children(){var e=l(_);return e.$$click=V,f(e,()=>d(`common.cancel`)),p(),e}}),B,H),e(()=>c(L,`disabled`,R())),e(()=>c(g,`value`,O())),e(()=>c(C,`value`,A())),e(()=>c(F,`value`,M())),p(),n})(),(()=>{var e=l(b),n=e.firstChild,a=n.firstChild,c=a.firstChild,m=c.nextSibling,h=a.nextSibling,g=n.nextSibling,[_,v]=o(g.nextSibling);return f(c,()=>w().name),f(m,(()=>{var e=s(()=>!!u.contentType);return()=>e()?`${d(`content.taxonomy.attachedTo`)}: ${u.contentType}`:d(`content.taxonomy.descriptionHint`)})()),f(h,()=>E().length),f(e,i(t,{get when(){return E().length>0},get fallback(){return(()=>{var e=l(S);return f(e,()=>d(`content.taxonomy.empty`)),e})()},get children(){var e=l(y),t=e.firstChild,n=t.firstChild.firstChild,a=n.nextSibling,o=t.nextSibling;return f(n,()=>d(`content.taxonomy.name`)),f(a,()=>d(`content.taxonomy.slug`)),f(o,i(r,{get each(){return E()},children:e=>(()=>{var t=l(C),n=t.firstChild,r=n.nextSibling,i=r.nextSibling.firstChild,a=i.nextSibling.nextSibling;return f(n,()=>e.name),f(r,()=>e.slug),i.$$click=()=>H(e),f(i,()=>d(`common.edit`)),a.$$click=()=>void W(e),f(a,()=>d(`content.taxonomy.delete`)),p(),t})()})),e}}),_,v),e})()]}}),z,B),n})()}d([`input`,`click`]);export{w as TaxonomyTermsManager};
@@ -1,4 +1,4 @@
1
- import{d as e,p as t,r as n,s as r,v as i}from"./solid.8gBSxpeo.js";import{a,c as o,f as s,i as c,m as l,n as u,r as d,s as f,u as p}from"./web.DwNv8rLL.js";import{n as m}from"./i18n.EKfvSb1v.js";import{t as h}from"./api.CM0tblEa.js";var g=l(`<div class=theme-manager><div class=page-header><h2></h2><p class=page-description></p><p class=page-hint></p></div><!$><!/><!$><!/><!$><!/><style>
1
+ import{d as e,p as t,r as n,s as r,v as i}from"./solid.8gBSxpeo.js";import{a,c as o,f as s,i as c,m as l,n as u,r as d,s as f,u as p}from"./web.DwNv8rLL.js";import{n as m}from"./i18n.3zKFZ7KU.js";import{t as h}from"./api.CGA0D2A2.js";var g=l(`<div class=theme-manager><div class=page-header><h2></h2><p class=page-description></p><p class=page-hint></p></div><!$><!/><!$><!/><!$><!/><style>
2
2
  .page-header {
3
3
  margin-bottom: 1.5rem;
4
4
  }
@@ -1 +1 @@
1
- import{d as e,i as t,p as n,r,s as i,v as a}from"./solid.8gBSxpeo.js";import{a as o,c as s,f as c,i as l,m as u,r as d,s as f,u as ee}from"./web.DwNv8rLL.js";import{n as p}from"./i18n.EKfvSb1v.js";import{t as m}from"./api.CM0tblEa.js";var h=u(`<div class="notice notice--error">`),te=u(`<div class=user-create><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required></label><label><!$><!/><input class=input type=email required></label><label><!$><!/><span class=muted></span><input class=input type=password required minlength=8></label><label><!$><!/><select class=input><option value></option><!$><!/></select></label></div><p class=muted><!$><!/> <!$><!/> — <!$><!/> <!$><!/>.</p><div class=media-details__actions><button class="btn btn-primary"type=submit></button><a class="btn btn-secondary"href=/users>`),g=u(`<option><!$><!/> (<!$><!/>)`);function _(){let{t:u}=p(),[d,_]=n(``),[v,y]=n(``),[b,ne]=n(``),[x,S]=n(``),[C,w]=n([]),[T,E]=n(``),[D,O]=n(!1);a(async()=>{try{let e=await m.listRoles();w(e),S(e.find(e=>e.slug===`EDITOR`)?.id??e[0]?.id??``)}catch{}});let re=async e=>{if(e.preventDefault(),E(``),b().length<8){E(u(`users.detail.passwordError`));return}O(!0);try{await m.createUser({name:d(),email:v(),password:b(),roleId:x()||void 0}),window.location.href=`/users`}catch(e){E(e instanceof Error?e.message:String(e)),O(!1)}};return(()=>{var n=l(te),a=n.firstChild,[p,m]=o(a.nextSibling),w=p.nextSibling,E=w.firstChild,O=E.nextSibling,k=O.firstChild,ie=k.firstChild,[A,j]=o(ie.nextSibling),M=A.nextSibling,N=k.nextSibling,P=N.firstChild,[F,ae]=o(P.nextSibling),I=F.nextSibling,L=N.nextSibling,oe=L.firstChild,[R,z]=o(oe.nextSibling),B=R.nextSibling,V=B.nextSibling,H=L.nextSibling,U=H.firstChild,[W,G]=o(U.nextSibling),K=W.nextSibling,q=K.firstChild,se=q.nextSibling,[ce,le]=o(se.nextSibling),J=O.nextSibling,ue=J.firstChild,[Y,de]=o(ue.nextSibling),fe=Y.nextSibling.nextSibling,[X,pe]=o(fe.nextSibling),me=X.nextSibling.nextSibling,[Z,he]=o(me.nextSibling),ge=Z.nextSibling.nextSibling,[Q,_e]=o(ge.nextSibling);Q.nextSibling;var $=J.nextSibling.firstChild,ve=$.nextSibling;return f(n,i(t,{get when(){return T()},get children(){var e=l(h);return f(e,T),e}}),p,m),w.addEventListener(`submit`,re),f(E,()=>u(`users.new`)),f(k,()=>u(`users.detail.fields.name`),A,j),M.$$input=e=>_(e.currentTarget.value),f(N,()=>u(`users.detail.fields.email`),F,ae),I.$$input=e=>y(e.currentTarget.value),f(L,()=>u(`users.detail.fields.password`),R,z),f(B,()=>u(`users.detail.passwordPrompt`,{email:``})),V.$$input=e=>ne(e.currentTarget.value),f(H,()=>u(`users.detail.fields.role`),W,G),K.addEventListener(`change`,e=>S(e.currentTarget.value)),f(q,()=>u(`users.detail.rolePlaceholder`)),f(K,i(r,{get each(){return C()},children:t=>(()=>{var n=l(g),r=n.firstChild,[i,a]=o(r.nextSibling),s=i.nextSibling.nextSibling,[u,d]=o(s.nextSibling);return u.nextSibling,f(n,()=>t.name,i,a),f(n,()=>t.slug,u,d),e(()=>c(n,`value`,t.id)),n})()}),ce,le),f(J,()=>u(`common.save`),Y,de),f(J,()=>u(`users.new`).toLowerCase(),X,pe),f(J,()=>u(`users.detail.fields.role`),Z,he),f(J,()=>u(`users.toolbar.newBtn`).toLowerCase(),Q,_e),f($,(()=>{var e=s(()=>!!D());return()=>e()?u(`common.loading`):u(`common.create`)})()),f(ve,()=>u(`common.back`)),e(()=>c($,`disabled`,D())),e(()=>c(M,`value`,d())),e(()=>c(I,`value`,v())),e(()=>c(V,`value`,b())),e(()=>c(K,`value`,x())),ee(),n})()}d([`input`]);export{_ as UserCreateForm};
1
+ import{d as e,i as t,p as n,r,s as i,v as a}from"./solid.8gBSxpeo.js";import{a as o,c as s,f as c,i as l,m as u,r as d,s as f,u as ee}from"./web.DwNv8rLL.js";import{n as p}from"./i18n.3zKFZ7KU.js";import{t as m}from"./api.CGA0D2A2.js";var h=u(`<div class="notice notice--error">`),te=u(`<div class=user-create><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required></label><label><!$><!/><input class=input type=email required></label><label><!$><!/><span class=muted></span><input class=input type=password required minlength=8></label><label><!$><!/><select class=input><option value></option><!$><!/></select></label></div><p class=muted><!$><!/> <!$><!/> — <!$><!/> <!$><!/>.</p><div class=media-details__actions><button class="btn btn-primary"type=submit></button><a class="btn btn-secondary"href=/users>`),g=u(`<option><!$><!/> (<!$><!/>)`);function _(){let{t:u}=p(),[d,_]=n(``),[v,y]=n(``),[b,ne]=n(``),[x,S]=n(``),[C,w]=n([]),[T,E]=n(``),[D,O]=n(!1);a(async()=>{try{let e=await m.listRoles();w(e),S(e.find(e=>e.slug===`EDITOR`)?.id??e[0]?.id??``)}catch{}});let re=async e=>{if(e.preventDefault(),E(``),b().length<8){E(u(`users.detail.passwordError`));return}O(!0);try{await m.createUser({name:d(),email:v(),password:b(),roleId:x()||void 0}),window.location.href=`/users`}catch(e){E(e instanceof Error?e.message:String(e)),O(!1)}};return(()=>{var n=l(te),a=n.firstChild,[p,m]=o(a.nextSibling),w=p.nextSibling,E=w.firstChild,O=E.nextSibling,k=O.firstChild,ie=k.firstChild,[A,j]=o(ie.nextSibling),M=A.nextSibling,N=k.nextSibling,P=N.firstChild,[F,ae]=o(P.nextSibling),I=F.nextSibling,L=N.nextSibling,oe=L.firstChild,[R,z]=o(oe.nextSibling),B=R.nextSibling,V=B.nextSibling,H=L.nextSibling,U=H.firstChild,[W,G]=o(U.nextSibling),K=W.nextSibling,q=K.firstChild,se=q.nextSibling,[ce,le]=o(se.nextSibling),J=O.nextSibling,ue=J.firstChild,[Y,de]=o(ue.nextSibling),fe=Y.nextSibling.nextSibling,[X,pe]=o(fe.nextSibling),me=X.nextSibling.nextSibling,[Z,he]=o(me.nextSibling),ge=Z.nextSibling.nextSibling,[Q,_e]=o(ge.nextSibling);Q.nextSibling;var $=J.nextSibling.firstChild,ve=$.nextSibling;return f(n,i(t,{get when(){return T()},get children(){var e=l(h);return f(e,T),e}}),p,m),w.addEventListener(`submit`,re),f(E,()=>u(`users.new`)),f(k,()=>u(`users.detail.fields.name`),A,j),M.$$input=e=>_(e.currentTarget.value),f(N,()=>u(`users.detail.fields.email`),F,ae),I.$$input=e=>y(e.currentTarget.value),f(L,()=>u(`users.detail.fields.password`),R,z),f(B,()=>u(`users.detail.passwordPrompt`,{email:``})),V.$$input=e=>ne(e.currentTarget.value),f(H,()=>u(`users.detail.fields.role`),W,G),K.addEventListener(`change`,e=>S(e.currentTarget.value)),f(q,()=>u(`users.detail.rolePlaceholder`)),f(K,i(r,{get each(){return C()},children:t=>(()=>{var n=l(g),r=n.firstChild,[i,a]=o(r.nextSibling),s=i.nextSibling.nextSibling,[u,d]=o(s.nextSibling);return u.nextSibling,f(n,()=>t.name,i,a),f(n,()=>t.slug,u,d),e(()=>c(n,`value`,t.id)),n})()}),ce,le),f(J,()=>u(`common.save`),Y,de),f(J,()=>u(`users.new`).toLowerCase(),X,pe),f(J,()=>u(`users.detail.fields.role`),Z,he),f(J,()=>u(`users.toolbar.newBtn`).toLowerCase(),Q,_e),f($,(()=>{var e=s(()=>!!D());return()=>e()?u(`common.loading`):u(`common.create`)})()),f(ve,()=>u(`common.back`)),e(()=>c($,`disabled`,D())),e(()=>c(M,`value`,d())),e(()=>c(I,`value`,v())),e(()=>c(V,`value`,b())),e(()=>c(K,`value`,x())),ee(),n})()}d([`input`]);export{_ as UserCreateForm};
@@ -0,0 +1 @@
1
+ import{d as e,i as t,p as n,r,s as i,v as a}from"./solid.8gBSxpeo.js";import{a as o,f as s,i as c,m as l,r as u,s as d,u as f}from"./web.DwNv8rLL.js";import{n as p}from"./i18n.3zKFZ7KU.js";import{t as m}from"./api.CGA0D2A2.js";import{i as h,n as g,o as _,s as v,t as y}from"./src.DQwsXUur.js";var b=l(`<div class="notice notice--error">`),x=l(`<div class=notice>`),S=l(`<table class=users-table><thead><tr><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),C=l(`<div class=users-manager><!$><!/><!$><!/><div class=toolbar><!$><!/><!$><!/><a class="btn btn-primary"href=/users/new></a><!$><!/></div><!$><!/><!$><!/><!$><!/>`),w=l(`<p class=muted>`),T=l(`<tr><td></td><td class=muted></td><td></td><td><span class=status-dot></span><!$><!/></td><td class=muted></td><td class=users-table__actions><!$><!/><!$><!/>`),E=l(`<span class=muted>`),D=l(`<div class="card user-details"><h3></h3><div class=form-grid><label><!$><!/><input class=input></label><label><!$><!/><input class=input type=email></label><label><!$><!/><select class=input><option value=ACTIVE></option><option value=INACTIVE></option></select></label><label><!$><!/><select class=input><option value></option><!$><!/></select></label></div><p class=muted></p><div class=media-details__actions><!$><!/><!$><!/><!$><!/>`),O=l(`<option><!$><!/> (<!$><!/>)`);function k(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString(`pt-BR`)}function A(){let{t:l}=p(),[u,A]=n([]),[j,M]=n([]),[N,P]=n(0),[F,I]=n(1),[L,R]=n(``),[z,B]=n(``),[V,H]=n(``),[U,W]=n(``),[G,K]=n(null),[q,J]=n(!1),Y=async()=>{try{let e=await m.listUsers({page:F(),limit:20,search:L()||void 0,status:z()||void 0});A(e.data??[]),P(e.total??0)}catch(e){H(e instanceof Error?e.message:String(e))}};a(async()=>{await Y();try{M(await m.listRoles())}catch{}});let X=async()=>{I(1),await Y()},ee=async(e,t)=>{if(t){J(!0),H(``);try{let n=await m.assignRole(e.id,t);K({...e,roles:n.roles}),W(l(`users.detail.toasts.roleUpdated`,{name:e.name})),await Y()}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}}},te=async e=>{let t=prompt(l(`users.detail.passwordPrompt`,{email:e.email}));if(t){if(t.length<8){H(l(`users.detail.passwordError`));return}J(!0),H(``);try{await m.setUserPassword(e.id,t),W(l(`users.detail.toasts.passwordChanged`,{name:e.name}))}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}}},ne=async e=>{J(!0),H(``);try{await m.updateUser(e.id,{name:e.name,email:e.email,status:e.status}),W(l(`users.detail.toasts.saved`,{name:e.name})),K(null),await Y()}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}},re=async e=>{if(confirm(l(`users.detail.confirmDelete`,{email:e.email}))){J(!0),H(``);try{await m.deleteUser(e.id),G()?.id===e.id&&K(null),W(l(`users.detail.toasts.deleted`,{name:e.name})),await Y()}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}}},ie=e=>j().find(t=>t.slug===e.roles[0]);return(()=>{var n=c(C),a=n.firstChild,[p,m]=o(a.nextSibling),A=p.nextSibling,[M,P]=o(A.nextSibling),H=M.nextSibling,W=H.firstChild,[J,Z]=o(W.nextSibling),ae=J.nextSibling,[Q,oe]=o(ae.nextSibling),$=Q.nextSibling,se=$.nextSibling,[ce,le]=o(se.nextSibling),ue=H.nextSibling,[de,fe]=o(ue.nextSibling),pe=de.nextSibling,[me,he]=o(pe.nextSibling),ge=me.nextSibling,[_e,ve]=o(ge.nextSibling);return d(n,i(t,{get when(){return V()},get children(){var e=c(b);return d(e,V),e}}),p,m),d(n,i(t,{get when(){return U()},get children(){var e=c(x);return d(e,U),e}}),M,P),d(H,i(h,{name:`user-search`,get placeholder(){return l(`users.toolbar.search`)},get value(){return L()},onInput:e=>{R(e),X()}}),J,Z),d(H,i(v,{name:`user-status`,get placeholder(){return l(`users.toolbar.allStatus`)},get value(){return z()},get options(){return[{value:`ACTIVE`,label:l(`users.toolbar.active`)},{value:`INACTIVE`,label:l(`users.toolbar.inactive`)}]},onChange:e=>{B(e),X()}}),Q,oe),d($,()=>l(`users.toolbar.newBtn`)),d(H,i(g,{variant:`secondary`,onClick:()=>void X(),get children(){return l(`users.toolbar.searchBtn`)}}),ce,le),d(n,i(t,{get when(){return u().length>0},get fallback(){return(()=>{var e=c(w);return d(e,()=>l(`users.empty`)),e})()},get children(){var n=c(S),a=n.firstChild,s=a.firstChild.firstChild,f=s.nextSibling,p=f.nextSibling,m=p.nextSibling,h=m.nextSibling,_=a.nextSibling;return d(s,()=>l(`users.table.name`)),d(f,()=>l(`users.table.email`)),d(p,()=>l(`users.table.role`)),d(m,()=>l(`users.table.status`)),d(h,()=>l(`users.table.lastAccess`)),d(_,i(r,{get each(){return u()},children:n=>(()=>{var r=c(T),a=r.firstChild,s=a.nextSibling,u=s.nextSibling,f=u.nextSibling,p=f.firstChild,m=p.nextSibling,[h,_]=o(m.nextSibling),v=f.nextSibling,b=v.nextSibling,x=b.firstChild,[S,C]=o(x.nextSibling),w=S.nextSibling,[D,O]=o(w.nextSibling);return d(a,()=>n.name),d(s,()=>n.email),d(u,i(t,{get when(){return n.roles.length>0},get fallback(){return(()=>{var e=c(E);return d(e,()=>l(`users.noRole`)),e})()},get children(){return i(y,{get children(){return n.roles.join(`, `)}})}})),d(f,()=>l(`common.status.`+n.status.toLowerCase()),h,_),d(v,()=>k(n.last_login_at)),d(b,i(g,{variant:`secondary`,size:`sm`,onClick:()=>K(n),get children(){return l(`users.table.actions.manage`)}}),S,C),d(b,i(g,{variant:`danger`,size:`sm`,onClick:()=>void re(n),get children(){return l(`users.table.actions.delete`)}}),D,O),e(e=>{var t=G()?.id===n.id,i=n.status===`ACTIVE`;return t!==e.e&&r.classList.toggle(`users-table__row--selected`,e.e=t),i!==e.t&&p.classList.toggle(`status-dot--active`,e.t=i),e},{e:void 0,t:void 0}),r})()})),n}}),de,fe),d(n,i(_,{get page(){return F()},limit:20,get total(){return N()},onPageChange:e=>{I(e),Y()}}),me,he),d(n,i(t,{get when(){return G()},children:t=>(()=>{var n=c(D),a=n.firstChild,u=a.nextSibling,p=u.firstChild,m=p.firstChild,[h,_]=o(m.nextSibling),v=h.nextSibling,y=p.nextSibling,b=y.firstChild,[x,S]=o(b.nextSibling),C=x.nextSibling,w=y.nextSibling,T=w.firstChild,[E,A]=o(T.nextSibling),M=E.nextSibling,N=M.firstChild,P=N.nextSibling,F=w.nextSibling,I=F.firstChild,[L,R]=o(I.nextSibling),z=L.nextSibling,B=z.firstChild,V=B.nextSibling,[H,U]=o(V.nextSibling),W=u.nextSibling,G=W.nextSibling,J=G.firstChild,[Y,X]=o(J.nextSibling),re=Y.nextSibling,[Z,ae]=o(re.nextSibling),Q=Z.nextSibling,[oe,$]=o(Q.nextSibling);return d(a,()=>l(`users.detail.title`)),d(p,()=>l(`users.detail.fields.name`),h,_),v.$$input=e=>K({...t(),name:e.currentTarget.value}),d(y,()=>l(`users.detail.fields.email`),x,S),C.$$input=e=>K({...t(),email:e.currentTarget.value}),d(w,()=>l(`users.detail.fields.status`),E,A),M.addEventListener(`change`,e=>K({...t(),status:e.currentTarget.value})),d(N,()=>l(`users.detail.statusOptions.active`)),d(P,()=>l(`users.detail.statusOptions.inactive`)),d(F,()=>l(`users.detail.fields.role`),L,R),z.addEventListener(`change`,e=>void ee(t(),e.currentTarget.value)),d(B,()=>l(`users.detail.rolePlaceholder`)),d(z,i(r,{get each(){return j()},children:t=>(()=>{var n=c(O),r=n.firstChild,[i,a]=o(r.nextSibling),l=i.nextSibling.nextSibling,[u,f]=o(l.nextSibling);return u.nextSibling,d(n,()=>t.name,i,a),d(n,()=>t.slug,u,f),e(()=>s(n,`value`,t.id)),n})()}),H,U),d(W,()=>l(`users.detail.meta`,{created:k(t().created_at),lastAccess:k(t().last_login_at)})),d(G,i(g,{variant:`primary`,get disabled(){return q()},get loading(){return q()},onClick:()=>void ne(t()),get children(){return l(`users.detail.actions.save`)}}),Y,X),d(G,i(g,{variant:`secondary`,get disabled(){return q()},onClick:()=>void te(t()),get children(){return l(`users.detail.actions.resetPassword`)}}),Z,ae),d(G,i(g,{variant:`secondary`,onClick:()=>K(null),get children(){return l(`users.detail.actions.close`)}}),oe,$),e(()=>s(z,`disabled`,q())),e(()=>s(v,`value`,t().name)),e(()=>s(C,`value`,t().email)),e(()=>s(M,`value`,t().status)),e(()=>s(z,`value`,ie(t())?.id??``)),f(),n})()}),_e,ve),n})()}u([`input`]);export{A as UsersManager};
@@ -1 +1 @@
1
- import{_ as e,d as t,i as n,p as r,r as i,s as a,v as o}from"./solid.8gBSxpeo.js";import{a as s,c,d as l,f as u,h as d,i as f,m as p,r as m,s as h,u as g}from"./web.DwNv8rLL.js";import{n as _}from"./i18n.EKfvSb1v.js";import{t as v}from"./api.CM0tblEa.js";var y=p(`<div class=webhook-event-select__dropdown role=listbox><input class=input><div class=webhook-event-select__options>`),b=p(`<div class=webhook-event-select><button type=button class="input webhook-event-select__trigger"aria-haspopup=listbox><span></span><span aria-hidden=true>⌄</span></button><!$><!/><div class=webhook-event-select__chips>`),x=p(`<span class=muted>`),S=p(`<label class=webhook-event-option><input type=checkbox><span><!$><!/><small>`),C=p(`<button type=button class=webhook-event-chip><!$><!/> ×`),w=p(`<div class="notice notice--error">`),T=p(`<div class=table-scroll><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),E=p(`<div class="resource-hub webhooks-manager"><!$><!/><div class=card-header-row><div><h3></h3><p></p></div><button class="btn btn-primary"type=button></button></div><!$><!/><section class=card></section><style>.webhook-event-select{position:relative}.webhook-event-select__trigger{width:100%;display:flex;justify-content:space-between;align-items:center;text-align:left;cursor:pointer}.webhook-event-select__dropdown{position:absolute;z-index:20;top:calc(100% + .25rem);left:0;right:0;background:var(--color-surface,#fff);border:1px solid var(--color-border,#dcdcde);box-shadow:0 8px 22px rgba(0,0,0,.14);padding:.6rem}.webhook-event-select__options{max-height:240px;overflow:auto;margin-top:.5rem;display:grid;gap:.2rem}.webhook-event-option{display:flex!important;align-items:flex-start;gap:.5rem!important;padding:.45rem;border-radius:4px;cursor:pointer}.webhook-event-option:hover{background:var(--color-surface-muted,#f5f5f5)}.webhook-event-option span{display:grid;gap:.12rem}.webhook-event-option small{color:var(--color-muted);font-size:.75rem}.webhook-event-select__chips{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.4rem}.webhook-event-chip{border:1px solid var(--color-border,#dcdcde);background:var(--color-surface-muted,#f5f5f5);border-radius:999px;padding:.2rem .55rem;cursor:pointer;font-size:.78rem}`),D=p(`<label><!$><!/><input class=input type=password>`),O=p(`<div class=form-grid><label><!$><!/><input class=input></label><label><!$><!/><input class=input type=password>`),k=p(`<div class=form-grid><label><!$><!/><input class=input type=password></label><label><!$><!/><input class=input>`),A=p(`<section class=card><h3></h3><form class=resource-form><label><!$><!/><input class=input required type=url></label><label><!$><!/><!$><!/></label><label><!$><!/><select class=input><option value=none></option><option value=bearer></option><option value=basic></option><option value=api_key></option><option value=hmac_sha256></option></select></label><!$><!/><!$><!/><!$><!/><!$><!/><label class=checkbox-label><input type=checkbox> <!$><!/></label><div><button class="btn btn-primary"type=submit></button> <button class=btn type=button>`),j=p(`<p>`),M=p(`<tr><td></td><td></td><td></td><td></td><td><button class=btn type=button></button> <button class="btn btn-danger"type=button>`),N=()=>({url:``,events:[],active:!0,auth_type:`hmac_sha256`,auth_config:{signatureHeader:`X-Webhook-Signature`}});function P(p){let[m,_]=r(!1),[v,w]=r(``),T;o(()=>{let t=e=>{T&&!T.contains(e.target)&&_(!1)};document.addEventListener(`mousedown`,t),e(()=>document.removeEventListener(`mousedown`,t))});let E=()=>p.options.filter(e=>`${e.label} ${e.value}`.toLowerCase().includes(v().toLowerCase())),D=e=>p.onChange(p.value.includes(e)?p.value.filter(t=>t!==e):[...p.value,e]);return(()=>{var e=f(b),r=e.firstChild,o=r.firstChild,O=r.nextSibling,[k,A]=s(O.nextSibling),j=k.nextSibling,M=T;return typeof M==`function`?d(M,e):T=e,r.$$click=()=>_(!m()),h(o,(()=>{var e=c(()=>p.value.length>0);return()=>e()?`${p.value.length} selecionado(s)`:p.placeholder})()),h(e,a(n,{get when(){return m()},get children(){var e=f(y),r=e.firstChild,o=r.nextSibling;return r.$$input=e=>w(e.currentTarget.value),h(o,a(n,{get when(){return E().length>0},get fallback(){return(()=>{var e=f(x);return h(e,()=>p.empty),e})()},get children(){return a(i,{get each(){return E()},children:e=>(()=>{var n=f(S),r=n.firstChild,i=r.nextSibling,a=i.firstChild,[o,c]=s(a.nextSibling),l=o.nextSibling;return r.addEventListener(`change`,()=>D(e.value)),h(i,()=>e.label,o,c),h(l,()=>e.value),t(()=>u(r,`checked`,p.value.includes(e.value))),n})()})}})),t(()=>l(r,`placeholder`,p.searchPlaceholder)),t(()=>u(r,`value`,v())),g(),e}}),k,A),h(j,a(i,{get each(){return p.value},children:e=>(()=>{var t=f(C),n=t.firstChild,[r,i]=s(n.nextSibling);return r.nextSibling,t.$$click=()=>D(e),h(t,()=>p.options.find(t=>t.value===e)?.label??e,r,i),g(),t})()})),t(()=>l(r,`aria-expanded`,m())),g(),e})()}function F(){let{t:e}=_(),[d,p]=r([]),[m,y]=r([]),[b,x]=r(null),[S,C]=r(``),[F,I]=r(!0),L=async()=>{I(!0);try{let[e,t]=await Promise.all([v.getWebhooks(),v.getWebhookEvents()]);p(e),y(t)}catch(e){C(e instanceof Error?e.message:String(e))}finally{I(!1)}};o(L);let R=e=>{if(!e){x(N());return}x({...e,events:[...e.events??[]],auth_type:e.auth_type??`hmac_sha256`,auth_config:{...e.auth_config??{}}})},z=(t,n)=>{let r=b();if(r){if(!r.events||r.events.length===0){C(e(`webhooks.eventsRequired`));return}x({...r,auth_config:{...r.auth_config,[t]:n}})}},B=async e=>{e.preventDefault();let t=b();if(!t)return;let n=Object.fromEntries(Object.entries(t.auth_config).filter(([,e])=>e));try{t.id?await v.updateWebhook(t.id,{...t,auth_config:n}):await v.createWebhook({...t,auth_config:n}),x(null),await L()}catch(e){C(e instanceof Error?e.message:String(e))}};return(()=>{var r=f(E),o=r.firstChild,[p,_]=s(o.nextSibling),y=p.nextSibling,C=y.firstChild,N=C.firstChild,I=N.nextSibling,V=C.nextSibling,H=y.nextSibling,[U,W]=s(H.nextSibling),G=U.nextSibling;return h(r,a(n,{get when(){return S()},get children(){var e=f(w);return h(e,S),e}}),p,_),h(N,()=>e(`webhooks.listTitle`)),h(I,()=>e(`webhooks.description`)),V.$$click=()=>R(),h(V,()=>e(`webhooks.new`)),h(r,a(n,{get when(){return b()},children:r=>(()=>{var i=f(A),o=i.firstChild,d=o.nextSibling,p=d.firstChild,_=p.firstChild,[v,y]=s(_.nextSibling),b=v.nextSibling,S=p.nextSibling,C=S.firstChild,[w,T]=s(C.nextSibling),E=w.nextSibling,[j,M]=s(E.nextSibling),N=S.nextSibling,F=N.firstChild,[I,L]=s(F.nextSibling),R=I.nextSibling,V=R.firstChild,H=V.nextSibling,U=H.nextSibling,W=U.nextSibling,G=W.nextSibling,ee=N.nextSibling,[K,te]=s(ee.nextSibling),ne=K.nextSibling,[q,re]=s(ne.nextSibling),ie=q.nextSibling,[J,ae]=s(ie.nextSibling),oe=J.nextSibling,[Y,se]=s(oe.nextSibling),X=Y.nextSibling,Z=X.firstChild,ce=Z.nextSibling.nextSibling,[le,ue]=s(ce.nextSibling),Q=X.nextSibling.firstChild,$=Q.nextSibling.nextSibling;return h(o,(()=>{var t=c(()=>!!r().id);return()=>t()?e(`webhooks.edit`):e(`webhooks.create`)})()),d.addEventListener(`submit`,B),h(p,()=>e(`webhooks.url`),v,y),b.$$input=e=>x({...r(),url:e.currentTarget.value}),h(S,()=>e(`webhooks.events`),w,T),h(S,a(P,{get options(){return m()},get value(){return r().events??[]},onChange:e=>x({...r(),events:e}),get placeholder(){return e(`webhooks.selectEvents`)},get searchPlaceholder(){return e(`webhooks.searchEvents`)},get empty(){return e(`webhooks.noEvents`)}}),j,M),h(N,()=>e(`webhooks.authentication`),I,L),R.addEventListener(`change`,e=>x({...r(),auth_type:e.currentTarget.value,auth_config:{}})),h(V,()=>e(`webhooks.auth.none`)),h(H,()=>e(`webhooks.auth.bearer`)),h(U,()=>e(`webhooks.auth.basic`)),h(W,()=>e(`webhooks.auth.apiKey`)),h(G,()=>e(`webhooks.auth.hmac_sha256`)),h(d,a(n,{get when(){return r().auth_type===`bearer`},get children(){var n=f(D),i=n.firstChild,[a,o]=s(i.nextSibling),c=a.nextSibling;return h(n,()=>e(`webhooks.token`),a,o),c.$$input=e=>z(`token`,e.currentTarget.value),t(()=>l(c,`placeholder`,r().id?e(`webhooks.keepExisting`):``)),t(()=>u(c,`value`,r().auth_config.token??``)),g(),n}}),K,te),h(d,a(n,{get when(){return r().auth_type===`basic`},get children(){var n=f(O),i=n.firstChild,a=i.firstChild,[o,c]=s(a.nextSibling),d=o.nextSibling,p=i.nextSibling,m=p.firstChild,[_,v]=s(m.nextSibling),y=_.nextSibling;return h(i,()=>e(`webhooks.username`),o,c),d.$$input=e=>z(`username`,e.currentTarget.value),h(p,()=>e(`webhooks.password`),_,v),y.$$input=e=>z(`password`,e.currentTarget.value),t(()=>l(y,`placeholder`,r().id?e(`webhooks.keepExisting`):``)),t(()=>u(d,`value`,r().auth_config.username??``)),t(()=>u(y,`value`,r().auth_config.password??``)),g(),n}}),q,re),h(d,a(n,{get when(){return r().auth_type===`api_key`},get children(){var n=f(O),i=n.firstChild,a=i.firstChild,[o,c]=s(a.nextSibling),d=o.nextSibling,p=i.nextSibling,m=p.firstChild,[_,v]=s(m.nextSibling),y=_.nextSibling;return h(i,()=>e(`webhooks.headerName`),o,c),d.$$input=e=>z(`headerName`,e.currentTarget.value),h(p,()=>e(`webhooks.apiKeyValue`),_,v),y.$$input=e=>z(`value`,e.currentTarget.value),t(()=>l(y,`placeholder`,r().id?e(`webhooks.keepExisting`):``)),t(()=>u(d,`value`,r().auth_config.headerName??``)),t(()=>u(y,`value`,r().auth_config.value??``)),g(),n}}),J,ae),h(d,a(n,{get when(){return r().auth_type===`hmac_sha256`},get children(){var n=f(k),i=n.firstChild,a=i.firstChild,[o,c]=s(a.nextSibling),d=o.nextSibling,p=i.nextSibling,m=p.firstChild,[_,v]=s(m.nextSibling),y=_.nextSibling;return h(i,()=>e(`webhooks.secret`),o,c),d.$$input=e=>z(`secret`,e.currentTarget.value),h(p,()=>e(`webhooks.signatureHeader`),_,v),y.$$input=e=>z(`signatureHeader`,e.currentTarget.value),t(t=>{var n=!r().id,i=r().id?e(`webhooks.keepExisting`):``;return n!==t.e&&u(d,`required`,t.e=n),i!==t.t&&l(d,`placeholder`,t.t=i),t},{e:void 0,t:void 0}),t(()=>u(d,`value`,r().auth_config.secret??``)),t(()=>u(y,`value`,r().auth_config.signatureHeader??`X-Webhook-Signature`)),g(),n}}),Y,se),Z.addEventListener(`change`,e=>x({...r(),active:e.currentTarget.checked})),h(X,()=>e(`webhooks.active`),le,ue),h(Q,()=>e(`common.save`)),$.$$click=()=>x(null),h($,()=>e(`common.cancel`)),t(()=>u(b,`value`,r().url??``)),t(()=>u(R,`value`,r().auth_type)),t(()=>u(Z,`checked`,r().active??!0)),g(),i})()}),U,W),h(G,a(n,{get when(){return!F()},get fallback(){return(()=>{var t=f(j);return h(t,()=>e(`webhooks.loading`)),t})()},get children(){return a(n,{get when(){return d().length>0},get fallback(){return(()=>{var t=f(j);return h(t,()=>e(`webhooks.empty`)),t})()},get children(){var t=f(T),n=t.firstChild.firstChild,r=n.firstChild.firstChild,o=r.nextSibling,s=o.nextSibling,l=s.nextSibling,u=l.nextSibling,p=n.nextSibling;return h(r,()=>e(`webhooks.url`)),h(o,()=>e(`webhooks.events`)),h(s,()=>e(`webhooks.authentication`)),h(l,()=>e(`webhooks.active`)),h(u,()=>e(`common.actions`)),h(p,a(i,{get each(){return d()},children:t=>(()=>{var n=f(M),r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=a.nextSibling,s=o.nextSibling.firstChild,l=s.nextSibling.nextSibling;return h(r,()=>t.url),h(i,()=>(t.events??[]).join(`, `)),h(a,()=>e(`webhooks.auth.${t.auth_type??`hmac_sha256`}`)),h(o,(()=>{var n=c(()=>!!t.active);return()=>n()?e(`common.yes`):e(`common.no`)})()),s.$$click=()=>R(t),h(s,()=>e(`common.edit`)),l.$$click=()=>t.id&&void v.deleteWebhook(t.id).then(L),h(l,()=>e(`common.delete`)),g(),n})()})),t}})}})),g(),r})()}m([`click`,`input`]);export{F as WebhooksManager};
1
+ import{_ as e,d as t,i as n,p as r,r as i,s as a,v as o}from"./solid.8gBSxpeo.js";import{a as s,c,d as l,f as u,h as d,i as f,m as p,r as m,s as h,u as g}from"./web.DwNv8rLL.js";import{n as _}from"./i18n.3zKFZ7KU.js";import{t as v}from"./api.CGA0D2A2.js";var y=p(`<div class=webhook-event-select__dropdown role=listbox><input class=input><div class=webhook-event-select__options>`),b=p(`<div class=webhook-event-select><button type=button class="input webhook-event-select__trigger"aria-haspopup=listbox><span></span><span aria-hidden=true>⌄</span></button><!$><!/><div class=webhook-event-select__chips>`),x=p(`<span class=muted>`),S=p(`<label class=webhook-event-option><input type=checkbox><span><!$><!/><small>`),C=p(`<button type=button class=webhook-event-chip><!$><!/> ×`),w=p(`<div class="notice notice--error">`),T=p(`<div class=table-scroll><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),E=p(`<div class="resource-hub webhooks-manager"><!$><!/><div class=card-header-row><div><h3></h3><p></p></div><button class="btn btn-primary"type=button></button></div><!$><!/><section class=card></section><style>.webhook-event-select{position:relative}.webhook-event-select__trigger{width:100%;display:flex;justify-content:space-between;align-items:center;text-align:left;cursor:pointer}.webhook-event-select__dropdown{position:absolute;z-index:20;top:calc(100% + .25rem);left:0;right:0;background:var(--color-surface,#fff);border:1px solid var(--color-border,#dcdcde);box-shadow:0 8px 22px rgba(0,0,0,.14);padding:.6rem}.webhook-event-select__options{max-height:240px;overflow:auto;margin-top:.5rem;display:grid;gap:.2rem}.webhook-event-option{display:flex!important;align-items:flex-start;gap:.5rem!important;padding:.45rem;border-radius:4px;cursor:pointer}.webhook-event-option:hover{background:var(--color-surface-muted,#f5f5f5)}.webhook-event-option span{display:grid;gap:.12rem}.webhook-event-option small{color:var(--color-muted);font-size:.75rem}.webhook-event-select__chips{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.4rem}.webhook-event-chip{border:1px solid var(--color-border,#dcdcde);background:var(--color-surface-muted,#f5f5f5);border-radius:999px;padding:.2rem .55rem;cursor:pointer;font-size:.78rem}`),D=p(`<label><!$><!/><input class=input type=password>`),O=p(`<div class=form-grid><label><!$><!/><input class=input></label><label><!$><!/><input class=input type=password>`),k=p(`<div class=form-grid><label><!$><!/><input class=input type=password></label><label><!$><!/><input class=input>`),A=p(`<section class=card><h3></h3><form class=resource-form><label><!$><!/><input class=input required type=url></label><label><!$><!/><!$><!/></label><label><!$><!/><select class=input><option value=none></option><option value=bearer></option><option value=basic></option><option value=api_key></option><option value=hmac_sha256></option></select></label><!$><!/><!$><!/><!$><!/><!$><!/><label class=checkbox-label><input type=checkbox> <!$><!/></label><div><button class="btn btn-primary"type=submit></button> <button class=btn type=button>`),j=p(`<p>`),M=p(`<tr><td></td><td></td><td></td><td></td><td><button class=btn type=button></button> <button class="btn btn-danger"type=button>`),N=()=>({url:``,events:[],active:!0,auth_type:`hmac_sha256`,auth_config:{signatureHeader:`X-Webhook-Signature`}});function P(p){let[m,_]=r(!1),[v,w]=r(``),T;o(()=>{let t=e=>{T&&!T.contains(e.target)&&_(!1)};document.addEventListener(`mousedown`,t),e(()=>document.removeEventListener(`mousedown`,t))});let E=()=>p.options.filter(e=>`${e.label} ${e.value}`.toLowerCase().includes(v().toLowerCase())),D=e=>p.onChange(p.value.includes(e)?p.value.filter(t=>t!==e):[...p.value,e]);return(()=>{var e=f(b),r=e.firstChild,o=r.firstChild,O=r.nextSibling,[k,A]=s(O.nextSibling),j=k.nextSibling,M=T;return typeof M==`function`?d(M,e):T=e,r.$$click=()=>_(!m()),h(o,(()=>{var e=c(()=>p.value.length>0);return()=>e()?`${p.value.length} selecionado(s)`:p.placeholder})()),h(e,a(n,{get when(){return m()},get children(){var e=f(y),r=e.firstChild,o=r.nextSibling;return r.$$input=e=>w(e.currentTarget.value),h(o,a(n,{get when(){return E().length>0},get fallback(){return(()=>{var e=f(x);return h(e,()=>p.empty),e})()},get children(){return a(i,{get each(){return E()},children:e=>(()=>{var n=f(S),r=n.firstChild,i=r.nextSibling,a=i.firstChild,[o,c]=s(a.nextSibling),l=o.nextSibling;return r.addEventListener(`change`,()=>D(e.value)),h(i,()=>e.label,o,c),h(l,()=>e.value),t(()=>u(r,`checked`,p.value.includes(e.value))),n})()})}})),t(()=>l(r,`placeholder`,p.searchPlaceholder)),t(()=>u(r,`value`,v())),g(),e}}),k,A),h(j,a(i,{get each(){return p.value},children:e=>(()=>{var t=f(C),n=t.firstChild,[r,i]=s(n.nextSibling);return r.nextSibling,t.$$click=()=>D(e),h(t,()=>p.options.find(t=>t.value===e)?.label??e,r,i),g(),t})()})),t(()=>l(r,`aria-expanded`,m())),g(),e})()}function F(){let{t:e}=_(),[d,p]=r([]),[m,y]=r([]),[b,x]=r(null),[S,C]=r(``),[F,I]=r(!0),L=async()=>{I(!0);try{let[e,t]=await Promise.all([v.getWebhooks(),v.getWebhookEvents()]);p(e),y(t)}catch(e){C(e instanceof Error?e.message:String(e))}finally{I(!1)}};o(L);let R=e=>{if(!e){x(N());return}x({...e,events:[...e.events??[]],auth_type:e.auth_type??`hmac_sha256`,auth_config:{...e.auth_config??{}}})},z=(t,n)=>{let r=b();if(r){if(!r.events||r.events.length===0){C(e(`webhooks.eventsRequired`));return}x({...r,auth_config:{...r.auth_config,[t]:n}})}},B=async e=>{e.preventDefault();let t=b();if(!t)return;let n=Object.fromEntries(Object.entries(t.auth_config).filter(([,e])=>e));try{t.id?await v.updateWebhook(t.id,{...t,auth_config:n}):await v.createWebhook({...t,auth_config:n}),x(null),await L()}catch(e){C(e instanceof Error?e.message:String(e))}};return(()=>{var r=f(E),o=r.firstChild,[p,_]=s(o.nextSibling),y=p.nextSibling,C=y.firstChild,N=C.firstChild,I=N.nextSibling,V=C.nextSibling,H=y.nextSibling,[U,W]=s(H.nextSibling),G=U.nextSibling;return h(r,a(n,{get when(){return S()},get children(){var e=f(w);return h(e,S),e}}),p,_),h(N,()=>e(`webhooks.listTitle`)),h(I,()=>e(`webhooks.description`)),V.$$click=()=>R(),h(V,()=>e(`webhooks.new`)),h(r,a(n,{get when(){return b()},children:r=>(()=>{var i=f(A),o=i.firstChild,d=o.nextSibling,p=d.firstChild,_=p.firstChild,[v,y]=s(_.nextSibling),b=v.nextSibling,S=p.nextSibling,C=S.firstChild,[w,T]=s(C.nextSibling),E=w.nextSibling,[j,M]=s(E.nextSibling),N=S.nextSibling,F=N.firstChild,[I,L]=s(F.nextSibling),R=I.nextSibling,V=R.firstChild,H=V.nextSibling,U=H.nextSibling,W=U.nextSibling,G=W.nextSibling,ee=N.nextSibling,[K,te]=s(ee.nextSibling),ne=K.nextSibling,[q,re]=s(ne.nextSibling),ie=q.nextSibling,[J,ae]=s(ie.nextSibling),oe=J.nextSibling,[Y,se]=s(oe.nextSibling),X=Y.nextSibling,Z=X.firstChild,ce=Z.nextSibling.nextSibling,[le,ue]=s(ce.nextSibling),Q=X.nextSibling.firstChild,$=Q.nextSibling.nextSibling;return h(o,(()=>{var t=c(()=>!!r().id);return()=>t()?e(`webhooks.edit`):e(`webhooks.create`)})()),d.addEventListener(`submit`,B),h(p,()=>e(`webhooks.url`),v,y),b.$$input=e=>x({...r(),url:e.currentTarget.value}),h(S,()=>e(`webhooks.events`),w,T),h(S,a(P,{get options(){return m()},get value(){return r().events??[]},onChange:e=>x({...r(),events:e}),get placeholder(){return e(`webhooks.selectEvents`)},get searchPlaceholder(){return e(`webhooks.searchEvents`)},get empty(){return e(`webhooks.noEvents`)}}),j,M),h(N,()=>e(`webhooks.authentication`),I,L),R.addEventListener(`change`,e=>x({...r(),auth_type:e.currentTarget.value,auth_config:{}})),h(V,()=>e(`webhooks.auth.none`)),h(H,()=>e(`webhooks.auth.bearer`)),h(U,()=>e(`webhooks.auth.basic`)),h(W,()=>e(`webhooks.auth.apiKey`)),h(G,()=>e(`webhooks.auth.hmac_sha256`)),h(d,a(n,{get when(){return r().auth_type===`bearer`},get children(){var n=f(D),i=n.firstChild,[a,o]=s(i.nextSibling),c=a.nextSibling;return h(n,()=>e(`webhooks.token`),a,o),c.$$input=e=>z(`token`,e.currentTarget.value),t(()=>l(c,`placeholder`,r().id?e(`webhooks.keepExisting`):``)),t(()=>u(c,`value`,r().auth_config.token??``)),g(),n}}),K,te),h(d,a(n,{get when(){return r().auth_type===`basic`},get children(){var n=f(O),i=n.firstChild,a=i.firstChild,[o,c]=s(a.nextSibling),d=o.nextSibling,p=i.nextSibling,m=p.firstChild,[_,v]=s(m.nextSibling),y=_.nextSibling;return h(i,()=>e(`webhooks.username`),o,c),d.$$input=e=>z(`username`,e.currentTarget.value),h(p,()=>e(`webhooks.password`),_,v),y.$$input=e=>z(`password`,e.currentTarget.value),t(()=>l(y,`placeholder`,r().id?e(`webhooks.keepExisting`):``)),t(()=>u(d,`value`,r().auth_config.username??``)),t(()=>u(y,`value`,r().auth_config.password??``)),g(),n}}),q,re),h(d,a(n,{get when(){return r().auth_type===`api_key`},get children(){var n=f(O),i=n.firstChild,a=i.firstChild,[o,c]=s(a.nextSibling),d=o.nextSibling,p=i.nextSibling,m=p.firstChild,[_,v]=s(m.nextSibling),y=_.nextSibling;return h(i,()=>e(`webhooks.headerName`),o,c),d.$$input=e=>z(`headerName`,e.currentTarget.value),h(p,()=>e(`webhooks.apiKeyValue`),_,v),y.$$input=e=>z(`value`,e.currentTarget.value),t(()=>l(y,`placeholder`,r().id?e(`webhooks.keepExisting`):``)),t(()=>u(d,`value`,r().auth_config.headerName??``)),t(()=>u(y,`value`,r().auth_config.value??``)),g(),n}}),J,ae),h(d,a(n,{get when(){return r().auth_type===`hmac_sha256`},get children(){var n=f(k),i=n.firstChild,a=i.firstChild,[o,c]=s(a.nextSibling),d=o.nextSibling,p=i.nextSibling,m=p.firstChild,[_,v]=s(m.nextSibling),y=_.nextSibling;return h(i,()=>e(`webhooks.secret`),o,c),d.$$input=e=>z(`secret`,e.currentTarget.value),h(p,()=>e(`webhooks.signatureHeader`),_,v),y.$$input=e=>z(`signatureHeader`,e.currentTarget.value),t(t=>{var n=!r().id,i=r().id?e(`webhooks.keepExisting`):``;return n!==t.e&&u(d,`required`,t.e=n),i!==t.t&&l(d,`placeholder`,t.t=i),t},{e:void 0,t:void 0}),t(()=>u(d,`value`,r().auth_config.secret??``)),t(()=>u(y,`value`,r().auth_config.signatureHeader??`X-Webhook-Signature`)),g(),n}}),Y,se),Z.addEventListener(`change`,e=>x({...r(),active:e.currentTarget.checked})),h(X,()=>e(`webhooks.active`),le,ue),h(Q,()=>e(`common.save`)),$.$$click=()=>x(null),h($,()=>e(`common.cancel`)),t(()=>u(b,`value`,r().url??``)),t(()=>u(R,`value`,r().auth_type)),t(()=>u(Z,`checked`,r().active??!0)),g(),i})()}),U,W),h(G,a(n,{get when(){return!F()},get fallback(){return(()=>{var t=f(j);return h(t,()=>e(`webhooks.loading`)),t})()},get children(){return a(n,{get when(){return d().length>0},get fallback(){return(()=>{var t=f(j);return h(t,()=>e(`webhooks.empty`)),t})()},get children(){var t=f(T),n=t.firstChild.firstChild,r=n.firstChild.firstChild,o=r.nextSibling,s=o.nextSibling,l=s.nextSibling,u=l.nextSibling,p=n.nextSibling;return h(r,()=>e(`webhooks.url`)),h(o,()=>e(`webhooks.events`)),h(s,()=>e(`webhooks.authentication`)),h(l,()=>e(`webhooks.active`)),h(u,()=>e(`common.actions`)),h(p,a(i,{get each(){return d()},children:t=>(()=>{var n=f(M),r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=a.nextSibling,s=o.nextSibling.firstChild,l=s.nextSibling.nextSibling;return h(r,()=>t.url),h(i,()=>(t.events??[]).join(`, `)),h(a,()=>e(`webhooks.auth.${t.auth_type??`hmac_sha256`}`)),h(o,(()=>{var n=c(()=>!!t.active);return()=>n()?e(`common.yes`):e(`common.no`)})()),s.$$click=()=>R(t),h(s,()=>e(`common.edit`)),l.$$click=()=>t.id&&void v.deleteWebhook(t.id).then(L),h(l,()=>e(`common.delete`)),g(),n})()})),t}})}})),g(),r})()}m([`click`,`input`]);export{F as WebhooksManager};
@@ -0,0 +1 @@
1
+ function e(){if(typeof document<`u`){let e=document.querySelector(`meta[name="okcms-api-url"]`)?.getAttribute(`content`)?.trim();if(e)return e.startsWith(`/`),e.replace(/\/$/,``)}return``}var t=e(),n=new class{baseUrl;csrfToken=null;refreshPromise=null;refreshOwner=typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():Math.random().toString(36).slice(2);refreshLockKey=`okcms:auth:refresh-lock`;constructor(e=t){this.baseUrl=e}mediaUrl(e){if(/^(?:https?:)?\/\//i.test(e)||!this.baseUrl)return e;try{return new URL(e,`${this.baseUrl.replace(/\/$/,``)}/`).toString()}catch{return e}}async init(){try{await this.ensureCsrfToken()}catch{}}async isLoggedIn(){try{return await this.request(`GET`,`/api/v1/auth/me`),!0}catch{return!1}}async getTenantId(){try{return(await this.request(`GET`,`/api/v1/auth/me`)).tenantId??null}catch{return null}}async getUserLocale(){try{return(await this.request(`GET`,`/api/v1/users/me/locale`)).locale??`pt-BR`}catch{return`pt-BR`}}async setUserLocale(e){await this.request(`PUT`,`/api/v1/users/me/locale`,{locale:e})}async getMe(){return this.request(`GET`,`/api/v1/auth/me`)}async getAuditLogs(e=8){return this.request(`GET`,`/api/v1/audit-logs?limit=${e}`)}async getAuditLogConfig(){return this.request(`GET`,`/api/v1/audit-logs/config`)}async updateAuditLogConfig(e){return this.request(`PUT`,`/api/v1/audit-logs/config`,{retentionDays:e})}async listAuditLogs(e){let t=new URLSearchParams;return e?.limit&&t.set(`limit`,String(e.limit)),e?.action&&t.set(`action`,e.action),e?.resourceType&&t.set(`resourceType`,e.resourceType),this.request(`GET`,`/api/v1/audit-logs?${t.toString()}`)}async login(e){return await this.ensureCsrfToken(),await this.request(`POST`,`/api/v1/auth/login`,e)}async logout(){await this.request(`POST`,`/api/v1/auth/logout`,{}),this.csrfToken=null}async refreshTokens(){return this.refreshPromise||=this.refreshWithCrossTabLock().finally(()=>{this.refreshPromise=null}),this.refreshPromise}async refreshWithCrossTabLock(){if(typeof window>`u`||typeof localStorage>`u`){await this.request(`POST`,`/api/v1/auth/refresh`,{},void 0,{skipRefresh:!0});return}let e=Date.now(),t;try{t=JSON.parse(localStorage.getItem(this.refreshLockKey)??`null`)}catch{await this.request(`POST`,`/api/v1/auth/refresh`,{},void 0,{skipRefresh:!0});return}if(t?.owner&&t.owner!==this.refreshOwner&&Number(t.expiresAt)>e){await this.waitForOtherTabRefresh(Number(t.expiresAt));return}try{localStorage.setItem(this.refreshLockKey,JSON.stringify({owner:this.refreshOwner,expiresAt:e+1e4}))}catch{await this.request(`POST`,`/api/v1/auth/refresh`,{},void 0,{skipRefresh:!0});return}try{await this.request(`POST`,`/api/v1/auth/refresh`,{},void 0,{skipRefresh:!0})}finally{try{JSON.parse(localStorage.getItem(this.refreshLockKey)??`null`)?.owner===this.refreshOwner&&localStorage.removeItem(this.refreshLockKey)}catch{}}}async waitForOtherTabRefresh(e){for(;Date.now()<Math.min(e,Date.now()+1e4);){await new Promise(e=>setTimeout(e,100));try{let e=JSON.parse(localStorage.getItem(this.refreshLockKey)??`null`);if(!e||Number(e.expiresAt)<=Date.now())return}catch{return}}}async request(e,t,n,r,i){let a=`${this.baseUrl}${t}`,o=async()=>{let t={"Content-Type":`application/json`,...r};if(![`GET`,`HEAD`,`OPTIONS`].includes(e.toUpperCase())){let e=await this.ensureCsrfToken();e&&(t[`x-csrf-token`]=e)}return fetch(a,{method:e,headers:t,credentials:`include`,body:n?JSON.stringify(n):void 0})},s=await o();if(s.status===401&&!i?.skipRefresh&&!t.includes(`/auth/refresh`)&&!t.includes(`/auth/logout`)&&(await this.refreshTokens(),s=await o()),s.status===403&&!i?.skipCsrfRecovery){let e=``;try{e=(await(typeof s.clone==`function`?s.clone():s).json()).error??``}catch{}e===`CSRF_TOKEN_INVALID`&&(await this.ensureCsrfToken(!0),s=await o())}if(!s.ok){let e=await s.json().catch(()=>({error:`Request failed`}));throw Error(e.error??`Request failed: ${s.status}`)}return s.json()}async requestRaw(e,t,n,r,i){let a=`${this.baseUrl}${t}`,o=async()=>{let t={"Content-Type":`application/json`,...r};if(![`GET`,`HEAD`,`OPTIONS`].includes(e.toUpperCase())){let e=await this.ensureCsrfToken();e&&(t[`x-csrf-token`]=e)}return fetch(a,{method:e,headers:t,credentials:`include`,body:n?JSON.stringify(n):void 0})},s=await o();if(s.status===401&&!i?.skipRefresh&&!t.includes(`/auth/refresh`)&&!t.includes(`/auth/logout`)&&(await this.refreshTokens(),s=await o()),s.status===403&&!i?.skipCsrfRecovery){let e=``;try{e=(await(typeof s.clone==`function`?s.clone():s).json()).error??``}catch{}e===`CSRF_TOKEN_INVALID`&&(await this.ensureCsrfToken(!0),s=await o())}return s}async ensureCsrfToken(e=!1){let t=this.readCsrfCookie();if(!e&&t)return this.csrfToken=t,t;if(!e&&this.csrfToken)return this.csrfToken;try{let e=await fetch(`${this.baseUrl}/api/v1/auth/csrf`,{credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)return this.csrfToken;let t=await e.json();this.csrfToken=t.csrfToken??this.readCsrfCookie()}catch{}return this.csrfToken}readCsrfCookie(){if(typeof document<`u`){let e=document.cookie.match(/(?:^|;\s*)csrf_token=([^;]+)/);if(e?.[1])return e[1]}return this.csrfToken}async getContent(e){let t=new URLSearchParams;return e?.page&&t.set(`page`,String(e.page)),e?.limit&&t.set(`limit`,String(e.limit)),e?.type&&t.set(`type`,e.type),e?.status&&t.set(`status`,e.status),e?.search&&t.set(`search`,e.search),this.request(`GET`,`/api/v1/content?${t.toString()}`)}async getContentById(e){return this.request(`GET`,`/api/v1/content/${e}`)}async getSingletonContent(e){let t=await this.request(`GET`,`/api/v1/content/singleton/${encodeURIComponent(e)}`);return`content`in t?t.content:t}async createContent(e){return this.request(`POST`,`/api/v1/content`,e)}async updateContent(e,t){return this.request(`PUT`,`/api/v1/content/${e}`,t)}async deleteContent(e){await this.request(`DELETE`,`/api/v1/content/${e}`)}async publishContent(e){let t=await this.request(`POST`,`/api/v1/content/${e}/publish`);return`content`in t?t.content:t}async unpublishContent(e){let t=await this.request(`POST`,`/api/v1/content/${e}/unpublish`);return`content`in t?t.content:t}async publishToggle(e,t){return t?this.unpublishContent(e):this.publishContent(e)}async getContentTypes(){return this.request(`GET`,`/api/v1/content-types`)}async createContentType(e){return this.request(`POST`,`/api/v1/content-types`,e)}async updateContentType(e,t){return this.request(`PUT`,`/api/v1/content-types/${e}`,t)}async deleteContentType(e){await this.request(`DELETE`,`/api/v1/content-types/${e}`)}async getTaxonomies(){return this.request(`GET`,`/api/v1/taxonomies`)}async createTaxonomy(e){return this.request(`POST`,`/api/v1/taxonomies`,e)}async attachTaxonomy(e,t){await this.request(`POST`,`/api/v1/taxonomies/${e}/attach`,{contentType:t})}async detachTaxonomy(e,t){await this.request(`POST`,`/api/v1/taxonomies/${e}/detach`,{contentType:t})}async deleteTaxonomy(e){await this.request(`DELETE`,`/api/v1/taxonomies/${e}`)}async getTaxonomyTerms(e){return this.request(`GET`,`/api/v1/taxonomies/${encodeURIComponent(e)}/terms`)}async createTaxonomyTerm(e,t){return this.request(`POST`,`/api/v1/taxonomies/${encodeURIComponent(e)}/terms`,t)}async updateTaxonomyTerm(e,t,n){return this.request(`PUT`,`/api/v1/taxonomies/${encodeURIComponent(e)}/terms/${t}`,n)}async deleteTaxonomyTerm(e,t){await this.request(`DELETE`,`/api/v1/taxonomies/${encodeURIComponent(e)}/terms/${t}`)}async getCategories(){return this.request(`GET`,`/api/v1/categories`)}async createCategory(e){return this.request(`POST`,`/api/v1/categories`,e)}async updateCategory(e,t){return this.request(`PUT`,`/api/v1/categories/${e}`,t)}async deleteCategory(e){await this.request(`DELETE`,`/api/v1/categories/${e}`)}async getTags(){return this.request(`GET`,`/api/v1/tags`)}async createTag(e){return this.request(`POST`,`/api/v1/tags`,e)}async updateTag(e,t){return this.request(`PUT`,`/api/v1/tags/${e}`,t)}async deleteTag(e){await this.request(`DELETE`,`/api/v1/tags/${e}`)}async getMenus(){return this.request(`GET`,`/api/v1/menus`)}async createMenu(e){return this.request(`POST`,`/api/v1/menus`,e)}async updateMenu(e,t){return this.request(`PUT`,`/api/v1/menus/${e}`,t)}async deleteMenu(e){await this.request(`DELETE`,`/api/v1/menus/${e}`)}async getFieldGroups(e){if(e?.type){let t=new URLSearchParams({type:e.type});for(let[n,r]of Object.entries(e))n!==`type`&&r&&t.set(n,r);return this.request(`GET`,`/api/v1/field-groups?${t.toString()}`)}return this.request(`GET`,`/api/v1/field-groups`)}async getFieldGroup(e){return this.request(`GET`,`/api/v1/field-groups/${e}`)}async exportFieldGroup(e){let t=await this.requestRaw(`GET`,`/api/v1/field-groups/${e}/export`);if(!t.ok)throw Error(await t.text());return t.blob()}async importFieldGroups(e){return this.request(`POST`,`/api/v1/field-groups/import`,e)}async createFieldGroup(e){return this.request(`POST`,`/api/v1/field-groups`,e)}async updateFieldGroup(e,t){return this.request(`PUT`,`/api/v1/field-groups/${e}`,t)}async deleteFieldGroup(e){await this.request(`DELETE`,`/api/v1/field-groups/${e}`)}async getFieldTypes(e){let t=e?`?category=${encodeURIComponent(e)}`:``;return this.request(`GET`,`/api/v1/field-types${t}`)}async getWebhooks(){return this.request(`GET`,`/api/v1/webhooks`)}async getWebhookEvents(){return(await this.request(`GET`,`/api/v1/webhooks/events`)).data}async createWebhook(e){return this.request(`POST`,`/api/v1/webhooks`,e)}async updateWebhook(e,t){return this.request(`PUT`,`/api/v1/webhooks/${e}`,t)}async deleteWebhook(e){await this.request(`DELETE`,`/api/v1/webhooks/${e}`)}async listMedia(e){let t=new URLSearchParams;return e?.page&&t.set(`page`,String(e.page)),e?.limit&&t.set(`limit`,String(e.limit)),e?.mimeType&&t.set(`mimeType`,e.mimeType),e?.search&&t.set(`search`,e.search),this.request(`GET`,`/api/v1/media?${t.toString()}`)}async getMedia(e){return this.request(`GET`,`/api/v1/media/${e}`)}async uploadMedia(e,t){let n=new FormData;n.append(`file`,e),t?.alt&&n.append(`alt`,t.alt),t?.caption&&n.append(`caption`,t.caption);let r=`${this.baseUrl}/api/v1/media/upload`,i=async()=>{let e=await this.ensureCsrfToken(),t={};return e&&(t[`x-csrf-token`]=e),fetch(r,{method:`POST`,headers:t,credentials:`include`,body:n})},a=await i();if(a.status===401&&(await this.refreshTokens(),a=await i()),a.status===403){let e=``;try{e=(await a.clone().json()).error??``}catch{}e===`CSRF_TOKEN_INVALID`&&(await this.ensureCsrfToken(!0),a=await i())}if(!a.ok){let e=await a.json().catch(()=>({error:`Upload failed: ${a.status}`}));throw Error(e.error??`Upload failed: ${a.status}`)}return a.json()}async updateMedia(e,t){return this.request(`PUT`,`/api/v1/media/${e}`,t)}async replaceMediaFile(e,t){let n=new FormData;n.append(`file`,t);let r=`${this.baseUrl}/api/v1/media/${e}/file`,i=async()=>{let e=await this.ensureCsrfToken(),t={};return e&&(t[`x-csrf-token`]=e),fetch(r,{method:`PUT`,headers:t,credentials:`include`,body:n})},a=await i();if(a.status===401&&(await this.refreshTokens(),a=await i()),a.status===403&&(await a.clone().json().catch(()=>({}))).error===`CSRF_TOKEN_INVALID`&&(await this.ensureCsrfToken(!0),a=await i()),!a.ok){let e=await a.json().catch(()=>({error:`Replace failed: ${a.status}`}));throw Error(e.error??`Replace failed: ${a.status}`)}return a.json()}async deleteMedia(e){await this.request(`DELETE`,`/api/v1/media/${e}`)}async listUsers(e){let t=new URLSearchParams;return e?.page&&t.set(`page`,String(e.page)),e?.limit&&t.set(`limit`,String(e.limit)),e?.search&&t.set(`search`,e.search),e?.status&&t.set(`status`,e.status),this.request(`GET`,`/api/v1/users?${t.toString()}`)}async getUser(e){return this.request(`GET`,`/api/v1/users/${e}`)}async createUser(e){return this.request(`POST`,`/api/v1/users`,e)}async updateUser(e,t){return this.request(`PUT`,`/api/v1/users/${e}`,t)}async deleteUser(e){await this.request(`DELETE`,`/api/v1/users/${e}`)}async setUserPassword(e,t){await this.request(`PUT`,`/api/v1/users/${e}/password`,{password:t})}async assignRole(e,t){return this.request(`POST`,`/api/v1/users/${e}/roles`,{roleId:t})}async removeRole(e,t){return this.request(`DELETE`,`/api/v1/users/${e}/roles/${t}`)}async listRoles(){return this.request(`GET`,`/api/v1/roles`)}async createRole(e){return this.request(`POST`,`/api/v1/roles`,e)}async updateRole(e,t){return this.request(`PUT`,`/api/v1/roles/${e}`,t)}async deleteRole(e){await this.request(`DELETE`,`/api/v1/roles/${e}`)}async listTenants(e){let t=new URLSearchParams;return e?.page&&t.set(`page`,String(e.page)),e?.limit&&t.set(`limit`,String(e.limit)),e?.search&&t.set(`search`,e.search),this.request(`GET`,`/api/v1/tenants?${t.toString()}`)}async createTenant(e){return this.request(`POST`,`/api/v1/tenants`,e)}async updateTenant(e,t){return this.request(`PUT`,`/api/v1/tenants/${e}`,t)}async deleteTenant(e){await this.request(`DELETE`,`/api/v1/tenants/${e}`)}async getSettings(e){let t=e?`?group=${encodeURIComponent(e)}`:``;return this.request(`GET`,`/api/v1/settings${t}`)}async updateSettings(e){await this.request(`PUT`,`/api/v1/settings`,e)}async healthCheck(){return this.request(`GET`,`/health`)}async getThemes(){return(await this.request(`GET`,`/api/v1/themes`)).map(e=>({id:String(e.id??``),name:String(e.name??``),version:e.version?String(e.version):void 0,status:String(e.status??`INSTALLED`),manifest:e.manifest??null}))}async activateTheme(e){return this.request(`POST`,`/api/v1/themes/${e}/activate`)}async deactivateTheme(e){return this.request(`POST`,`/api/v1/themes/${e}/deactivate`)}async installTheme(e){return this.request(`POST`,`/api/v1/themes/install`,e)}async uninstallTheme(e){await this.request(`DELETE`,`/api/v1/themes/${e}`)}async getPlugins(){return(await this.request(`GET`,`/api/v1/plugins`)).map(e=>({id:String(e.id??``),name:String(e.name??``),version:String(e.version??``),status:String(e.status??`INSTALLED`),manifest:e.manifest??null}))}async activatePlugin(e){return this.request(`POST`,`/api/v1/plugins/${e}/activate`)}async deactivatePlugin(e){return this.request(`POST`,`/api/v1/plugins/${e}/deactivate`)}async installPlugin(e){return this.request(`POST`,`/api/v1/plugins/install`,e)}async uninstallPlugin(e){await this.request(`DELETE`,`/api/v1/plugins/${e}`)}};export{n as t};
@@ -0,0 +1 @@
1
+ import{d as e,i as t,p as n,r,s as i,v as a}from"./solid.8gBSxpeo.js";import{a as o,c as s,d as c,i as l,m as u,n as d,r as f,s as p}from"./web.DwNv8rLL.js";import{t as m}from"./api.CGA0D2A2.js";import"./src.DQwsXUur.js";var h=u(`<a class=sidebar__link><!$><!/> <!$><!/>`),g=u(`<span aria-hidden=true>`);function _(t){let n=()=>t.extensions.menuPages.filter(e=>t.can(e.capability??`read`));return i(r,{get each(){return n()},children:t=>(()=>{var n=l(h),r=n.firstChild,[i,a]=o(r.nextSibling),u=i.nextSibling.nextSibling,[d,f]=o(u.nextSibling);return p(n,(()=>{var e=s(()=>!!t.icon);return()=>e()?(()=>{var e=l(g);return p(e,()=>t.icon),e})():null})(),i,a),p(n,()=>t.label,d,f),e(()=>c(n,`href`,`/plugins/${t.slug}`)),n})()})}f([`click`]);var v=u(`<div class=sidebar-plugins data-extensions=sidebar><!$><!/><!$><!/>`),y=u(`<div><span>`);function b(){return{menuPages:[],submenuPages:[],dashboardWidgets:[],metaBoxes:[],notices:[],columns:{},columnRenderers:{},actionLinks:[]}}function x(e){let t=b();for(let n of e){if(n.status!==`ACTIVE`&&n.status!==`ACTIVATED`)continue;let e=n.manifest?.admin;if(!e)continue;let r=n.slug??n.name;t.menuPages.push(...e.menuPages?.map(e=>({...e,slug:e.slug.startsWith(`${r}/`)?e.slug:`${r}/${e.slug}`}))??[]),t.dashboardWidgets.push(...e.dashboardWidgets?.map(e=>({...e,id:e.id.includes(`:`)?e.id:`${r}:${e.id}`,componentId:e.componentId.includes(`:`)?e.componentId:`${r}:${e.componentId}`}))??[]),t.notices.push(...e.notices?.map(e=>({...e,id:e.id.includes(`:`)?e.id:`${r}:${e.id}`}))??[])}return t}function S(){let[s,u]=n(b());a(async()=>{try{let e=await m.getPlugins();u(x(e))}catch{}});let f=()=>!0;return i(t,{get when(){return s().menuPages.length>0},get children(){var t=l(v),n=t.firstChild,[a,u]=o(n.nextSibling),m=a.nextSibling,[h,g]=o(m.nextSibling);return p(t,i(r,{get each(){return s().notices},children:t=>(()=>{var n=l(y),r=n.firstChild;return p(r,()=>t.message),e(e=>{var r=`notice notice--${t.level}`,i=t.id.split(`:`)[0];return r!==e.e&&d(n,e.e=r),i!==e.t&&c(n,`data-plugin`,e.t=i),e},{e:void 0,t:void 0}),n})()}),a,u),p(t,i(_,{get extensions(){return s()},can:f}),h,g),t}})}export{S as PluginExtensionsSlot,b as emptyExtensionsState,x as extensionsFromPlugins};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime.BpQH8Ho1.js";import{p as t,v as n}from"./solid.8gBSxpeo.js";import{t as r}from"./api.CM0tblEa.js";var i=[`pt-BR`,`en`,`es-ES`,`ru`,`uk`,`tr`,`he`,`it`,`pl`,`zh-CN`,`ja`,`ar`,`sw`,`yo`,`zu`,`am`,`ha`,`ig`],a={"pt-BR":`Português (Brasil)`,en:`English`,"es-ES":`Español`,ru:`Русский`,uk:`Українська`,tr:`Türkçe`,he:`עברית`,it:`Italiano`,pl:`Polski`,"zh-CN":`中文 (简体)`,ja:`日本語`,ar:`العربية`,sw:`Kiswahili`,yo:`Yorùbá`,zu:`isiZulu`,am:`አማርኛ`,ha:`Hausa`,ig:`Igbo`},o={"pt-BR":`🇧🇷`,en:`🇺🇸`,"es-ES":`🇪🇸`,ru:`🇷🇺`,uk:`🇺🇦`,tr:`🇹🇷`,he:`🇮🇱`,it:`🇮🇹`,pl:`🇵🇱`,"zh-CN":`🇨🇳`,ja:`🇯🇵`,ar:`🇸🇦`,sw:`🇹🇿`,yo:`🇳🇬`,zu:`🇿🇦`,am:`🇪🇹`,ha:`🇳🇬`,ig:`🇳🇬`},s=(e,t,n)=>{let r=t.lastIndexOf(`?`),i=e[r===-1||r<t.lastIndexOf(`/`)?t:t.slice(0,r)];return i?typeof i==`function`?i():Promise.resolve(i):new Promise((e,r)=>{(typeof queueMicrotask==`function`?queueMicrotask:setTimeout)(r.bind(null,Error(`Unknown variable dynamic import: `+t+(t.split(`/`).length===n?``:`. Note that variables only represent file names one level deep.`))))})},c=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),ee=function(e){return`/`+e},l={},u=function(e){return e.pathname.endsWith(`.css`)},d=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=ee(t,n);let r=s(t);if(r.href in l)return;l[r.href]=!0;let i=u(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:c,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},f=new Map;async function p(e){if(f.has(e))return f.get(e);try{let t=await s(Object.assign({"./locales/ar.json":()=>d(()=>import(`./ar.9BcNkJMI.js`),[]),"./locales/en.json":()=>d(()=>Promise.resolve().then(()=>b),void 0),"./locales/es-ES.json":()=>d(()=>import(`./es-ES.DgqDFCmG.js`),[]),"./locales/he.json":()=>d(()=>import(`./he.11dIJHQw.js`),[]),"./locales/it.json":()=>d(()=>import(`./it.yCdgk3Xj.js`),[]),"./locales/ja.json":()=>d(()=>import(`./ja.BIm7Hwe_.js`),[]),"./locales/pl.json":()=>d(()=>import(`./pl.dUwrcITB.js`),[]),"./locales/pt-BR.json":()=>d(()=>import(`./pt-BR.dxAFMMtn.js`),[]),"./locales/ru.json":()=>d(()=>import(`./ru.lmDiQaSu.js`),[]),"./locales/sw.json":()=>d(()=>import(`./sw._qHdoFbp.js`),[]),"./locales/tr.json":()=>d(()=>import(`./tr.Do-lr98T.js`),[]),"./locales/uk.json":()=>d(()=>import(`./uk.DTUX-N1c.js`),[]),"./locales/yo.json":()=>d(()=>import(`./yo.BIYG0J7I.js`),[]),"./locales/zh-CN.json":()=>d(()=>import(`./zh-CN.C7Iod1E1.js`),[])}),`./locales/${e}.json`,3),n=t.default??t;return f.set(e,n),n}catch{return e===`en`?{}:p(`en`)}}var m=`admin_locale`;function h(){if(typeof document>`u`)return null;let e=document.cookie.match(RegExp(`(?:^|; )${m}=([^;]+)`));return e?.[1]&&i.includes(e[1])?e[1]:null}function g(e){typeof document<`u`&&(document.cookie=`${m}=${e}; path=/; max-age=31536000; SameSite=Lax`)}function _(){if(typeof navigator>`u`)return`en`;let e=navigator.language?.split(`-`)[0]?.toLowerCase(),t=navigator.language?.toLowerCase();for(let n of i)if(n.toLowerCase()===t||n.split(`-`)[0]===e)return n;return`en`}async function te(){try{let e=await r.getUserLocale();if(e&&i.includes(e))return e}catch{}return null}async function ne(e){await r.setUserLocale(e)}async function v(){return h()||await te()||_()||`en`}async function y(e){g(e);try{await ne(e)}catch{}}var b=e({access:()=>k,activity:()=>I,adminBar:()=>L,common:()=>F,content:()=>C,dashboard:()=>S,default:()=>V,footer:()=>R,helpTabs:()=>z,layout:()=>x,login:()=>P,logs:()=>A,media:()=>w,menus:()=>D,plugins:()=>M,resources:()=>O,screenOptions:()=>B,settings:()=>E,themes:()=>N,users:()=>T,webhooks:()=>j}),x={appName:`OkCMS`,admin:`Admin`,nav:{dashboard:`Dashboard`,content:`Content`,media:`Media`,users:`Users`,menus:`Menus`,settings:`Settings`,plugins:`Plugins`,themes:`Themes`},actions:{logout:`Logout`,newPost:`New Post`,uploadMedia:`Upload Media`,addUser:`Add User`,openSettings:`Settings`}},S={title:`Dashboard`,stats:{totalContent:`Total Content`,published:`Published`,drafts:`Drafts`,mediaFiles:`Media Files`,users:`Users`},recent:{title:`Recent Content`,viewAll:`View All`,empty:`No content yet — create your first!`,columns:{title:`Title`,type:`Type`,status:`Status`,updated:`Updated`}},widgets:{atGlance:`At a Glance`,posts:`Posts`,postsDesc:`Published / Drafts / Trash`,pages:`Pages`,pagesDesc:`Published / Drafts / Trash`,media:`Media`,mediaDesc:`Files in the library`,users:`Users`,usersDesc:`Total / Active / Inactive`,version:`Version`,storage:`Storage`,quickDraft:{title:`Quick Draft`,heading:`Title`,headingPlaceholder:`Give your draft a title`,content:`Content`,contentPlaceholder:`What's on your mind?`,save:`Save Draft`,yourDrafts:`Your Drafts`,noDrafts:`No drafts yet.`},activity:{title:`Activity`,empty:`No activity yet.`}}},C={list:{title:`Content`,description:`Search, filter, edit and publish your content.`,typeNotFound:`This content type was not found.`,columns:{title:`Title`,type:`Type`,status:`Status`,updated:`Updated`},actions:{edit:`Edit`,publish:`Publish`,unpublish:`Unpublish`,delete:`Delete`},filters:{search:`Search content…`,allTypes:`All types`,allStatus:`All status`},buttons:{new:`+ New content`,addNew:`+ Add new`,search:`Search`},all:`All content`,empty:`No content found.`,statuses:{draft:`Draft`,published:`Published`,archived:`Archived`},confirmDelete:`Delete "{title}"?`,toasts:{published:`Content published ✓`,unpublished:`Content unpublished ✓`}},editor:{type:`Type`,adding:`Add new`,editing:`Edit`,backToList:`Back to list`,saving:`Saving…`,title:`Title`,titlePlaceholder:`Add title`,slug:`Slug`,slugPlaceholder:`auto-generated-from-title`,toolbar:`Editor toolbar`,bodyPlaceholder:`Start writing…`,linkPrompt:`Enter the URL:`,excerpt:`Excerpt`,featuredImage:`Featured Image (media ID)`,mediaIdPlaceholder:`Media ID`,featuredImageHint:`Choose a media item from the Media library.`,pageAttributes:`Page attributes`,publishPanel:`Publish`,status:`Status`,statusOptions:{draft:`Draft`,published:`Published`,archived:`Archived`},layout:`Layout`,layoutAuto:`Automatic (theme hierarchy)`,customFields:`Custom Fields`,inspectTypes:`Inspect available types`,save:`Save`,saved:`Content saved successfully.`},taxonomy:{title:`Taxonomy terms`,back:`← Back to content`,choose:`Choose a taxonomy from the content menu.`,notFound:`Taxonomy not found.`,addTerm:`Add new term`,editTerm:`Edit term`,name:`Name`,slug:`Slug`,description:`Description`,descriptionHint:`Manage the terms used by this content type.`,attachedTo:`Attached to`,add:`Add term`,delete:`Delete`,empty:`No terms yet.`,confirmDelete:`Delete "{name}"?`}},w={title:`Media Library`,description:"Upload and manage images, videos and documents. Files are stored in `uploads/` and served publicly.",upload:{dropzone:`Drop files here or`,select:`Select files`,uploading:`Uploading…`,hint:`Images, videos, audio and documents · up to 25MB per file`},toolbar:{search:`Search by name or alt…`,allTypes:`All types`,searchBtn:`Search`},mimeTypes:{png:`PNG`,jpeg:`JPEG`,gif:`GIF`,webp:`WebP`,svg:`SVG`,pdf:`PDF`,mp4:`MP4`,mp3:`MP3`},empty:`No files yet. Upload the first one!`,details:{title:`Details`,titleField:`Title`,file:`File`,type:`Type`,size:`Size`,dimensions:`Dimensions`,uploaded:`Uploaded`,url:`URL`,copy:`Copy`,alt:`Alt text`,caption:`Caption`,description:`Description`,save:`Save details`,replace:`Replace file`,replacing:`Replacing…`,replaceHint:`Keeps this attachment and its metadata.`,delete:`Delete`,close:`Close`,confirmDelete:`Delete "{filename}"? The file will be removed from disk.`,saved:`Details saved ✓`,copied:`URL copied ✓`,copyError:`Could not copy URL`,replaced:`File replaced ✓`},toasts:{uploaded:`{count} file(s) uploaded ✓`}},T={title:`Users`,description:`Manage accounts, roles and project access.`,new:`New User`,toolbar:{search:`Search by name or email…`,allStatus:`All status`,active:`Active`,inactive:`Inactive`,newBtn:`+ New user`,searchBtn:`Search`},table:{name:`Name`,email:`Email`,role:`Role`,status:`Status`,lastAccess:`Last access`,actions:{manage:`Manage`,delete:`Delete`}},empty:`No users found.`,noRole:`No role`,detail:{title:`Manage user`,fields:{name:`Name`,email:`Email`,status:`Status`,role:`Role`,password:`Password`},statusOptions:{active:`Active`,inactive:`Inactive`},rolePlaceholder:`— no role —`,meta:`Created on {created} · last access {lastAccess}`,actions:{save:`Save`,resetPassword:`Reset password`,close:`Close`},passwordPrompt:`New password for {email} (minimum 8 chars):`,passwordError:`Password must be at least 8 characters`,toasts:{roleUpdated:`Role for {name} updated ✓`,passwordChanged:`Password for {name} changed ✓`,saved:`User {name} saved ✓`,deleted:`User {name} deleted ✓`},confirmDelete:`Delete user {email}?`}},E={general:{title:`General`,description:`Basic information displayed on the site.`,back:`← All settings`,fields:{siteTitle:`Site Title`,siteTitlePlaceholder:`My Site`,siteDescription:`Description`,siteDescriptionPlaceholder:`A new site built with OkCMS`,language:`Language`,timezone:`Timezone`,timezonePlaceholder:`America/Sao_Paulo`},saved:`Settings saved ✓`,loading:`Loading…`,save:`Save`},postTypes:{title:`Content Types`,description:`Create custom content types (CPTs) beyond Posts and Pages.`,form:{title:`Create Content Type`,slug:`Slug (singular, e.g.: portfolio)`,slugHint:`Only lowercase letters, numbers and underscore`,singular:`Singular name`,plural:`Plural name`,supports:`Supports`,supportsOptions:{title:`Title`,editor:`Editor`,thumbnail:`Featured Image`,excerpt:`Excerpt`,revisions:`Revisions`},hasArchive:`Has public archive (/slug)`,singleton:`Singleton (only one content entry)`,icon:`Sidebar icon (Lucide name)`,iconHint:`Examples: box, package, shopping-bag, file-text`,editTitle:`Edit Content Type`,update:`Update`,cancel:`Cancel`,create:`Create`},table:{slug:`Slug`,singular:`Singular`,plural:`Plural`,source:`Source`,supports:`Supports`,archive:`Archive`,mode:`Mode`,singleton:`Singleton`,collection:`Collection`,icon:`Icon`,actions:{edit:`Edit`,remove:`Remove`}},sources:{admin:`Admin`,core:`Core`}},taxonomies:{title:`Taxonomies`,description:`Create custom taxonomies and link them to content types.`,form:{title:`Create Taxonomy`,name:`Name (e.g.: Genre)`,slug:`Slug (optional, generated from name)`,slugHint:`Only lowercase letters, numbers and underscore`,hierarchical:`Hierarchical (allows parent/child terms)`,attachTo:`Link to content types`,create:`Create`},table:{taxonomy:`Taxonomy`,hierarchical:`Hierarchical`,attachedTypes:`Linked content types`,actions:{remove:`Remove`}}},customFields:{title:`Custom Fields`,description:`Create field groups, arrange fields and choose which standard fields are visible for each content type.`,contentType:`Content type`,location:{title:`Location rules`,description:`Choose where this field group appears. Rules in the same group use AND; groups use OR.`,parameter:`Location parameter`,operator:`Operator`,chooseValue:`Choose a value`,valuePlaceholder:`Enter a value or slug`,showIf:`Show if`,removeRule:`Remove rule`,required:`Add a value to every location rule.`,addRule:`Add condition`,addGroup:`Add OR group`,remove:`Remove`,and:`AND`,or:`OR`,params:{content_type:`Post type`,content_slug:`Post slug`,taxonomy:`Taxonomy`,term:`Term slug`,user_role:`User role`,page_template:`Page template`,post_status:`Post status`},operators:{eq:`is`,neq:`is not`}},standard:{title:`Standard fields`,description:`Title and slug are required. The other standard fields can be enabled or disabled.`,enabled:`Enabled`,locked:`Required`,fields:{title:`Title`,slug:`Slug`,content:`Content`,excerpt:`Excerpt`,featured_image:`Featured image`,seo_title:`SEO title`,seo_description:`SEO description`,status:`Status`,author:`Author`}},groups:{title:`Field groups`,new:`New field group`,empty:`No custom field groups yet.`,emptyHint:`Create your first group to start modelling your content.`,search:`Search groups…`,groupName:`Group`,status:`Status`,fields:`fields`,appliesTo:`Applies to`,allContentTypes:`All content types`,edit:`Edit`,active:`Active`,inactive:`Inactive`},form:{createTitle:`Create field group`,editTitle:`Edit field group`,title:`Group name`,titlePlaceholder:`Example: Product details`,displayTitle:`Display title`,active:`Active`,backToGroups:`Back to groups`,editorEyebrow:`Field builder`,groupTitleHint:`This name identifies the field set inside the content editor.`,fieldsTitle:`Fields`,fieldsDescription:`Add, configure and order fields. Use the six-dot handle to drag without losing their position.`,noFields:`This group has no fields yet.`,settingsTitle:`Group settings`,settingsDescription:`Presentation and panel visibility options for this panel.`,description:`Description`,labelPlacement:`Label placement`,instructionPlacement:`Instruction placement`,menuOrder:`Menu order`,hideOnScreen:`Hide on edit screen`,hide:{permalink:`Permalink`,content:`Content editor`,excerpt:`Excerpt`,featured_image:`Featured image`,author:`Author`,revisions:`Revisions`,comments:`Comments`},assignTitle:`Location`,assignDescription:`Choose the content type where this field group will be available.`,contentType:`Content type`,position:`Position`,positions:{normal:`Normal`,side:`Sidebar`,after_title:`After title`},displayStyle:`Display style`,displayStyles:{standard:`Standard`,seamless:`Seamless`,grouped:`Grouped`},field:`Field`,fieldName:`Name/key`,fieldNamePlaceholder:`product_code`,fieldLabel:`Label`,fieldLabelPlaceholder:`Product code`,fieldType:`Type`,instructions:`Instructions`,instructionsPlaceholder:`Optional help text for editors`,required:`Required`,options:`Options`,optionsHint:`One option per line: value|Label`,addField:`Add field`,removeField:`Remove`,dragHint:`Drag to reorder`,editField:`Edit`,duplicateField:`Duplicate`,copySuffix:`(copy)`,selectFieldType:`Select field type`,searchFieldTypes:`Search field types…`,popularFields:`Popular`,noMatchingFieldTypes:`No field types found.`,fieldTypeHint:`Choose the type that best represents the value editors will enter in this field.`,selectField:`Select field`,save:`Save group`,cancel:`Cancel`,newFieldDefault:`New field`,saved:`Field group saved.`,deleted:`Field group deleted.`},listEyebrow:`Content structure`,validation:{titleRequired:`Group name is required.`},tabs:{locationRules:`Location rules`,presentation:`Presentation`,groupSettings:`Group settings`},fieldSettings:{general:`General`,fieldLabel:`Field label`,fieldName:`Field name`,instructions:`Instructions`,required:`Required`,defaultValue:`Default value`,placeholder:`Placeholder`,presentation:`Presentation`,wrapperWidth:`Wrapper width (%)`,labelPlacement:`Label`,instructionPlacement:`Instructions`,top:`Above`,left:`Left`,above:`Before field`,below:`After field`,textSettings:`Text`,prepend:`Prepend`,append:`Append`,minLength:`Minimum length`,maxLength:`Maximum length`,rows:`Rows`,newLines:`New lines`,wpautop:`Automatic paragraphs`,none:`None`,numberSettings:`Number`,min:`Minimum`,max:`Maximum`,step:`Step`,choiceSettings:`Choices`,choices:`Choices`,layout:`Layout`,vertical:`Vertical`,horizontal:`Horizontal`,multiple:`Multiple choice`,allowNull:`Allow empty`,mediaSettings:`Media`,returnFormat:`Return format`,array:`Array`,id:`ID`,previewSize:`Preview size`,library:`Library`,all:`All`,uploadedToPost:`Uploaded to this post`,allowedTypes:`Allowed types`,minWidth:`Minimum width`,maxWidth:`Maximum width`,minHeight:`Minimum height`,maxHeight:`Maximum height`,wysiwygSettings:`WYSIWYG`,tabs:`Tabs`,toolbar:`Toolbar`,mediaUpload:`Allow media upload`,dateSettings:`Date and time`,displayFormat:`Display format`,firstDay:`First day`,colorSettings:`Color`,enableOpacity:`Allow opacity`,mapSettings:`Map`,center:`Center`,zoom:`Zoom`,height:`Height`,relationSettings:`Relationship`,postType:`Post type`,taxonomy:`Taxonomy`,booleanSettings:`True/False`,message:`Message`,defaultChecked:`Checked by default`,linkSettings:`Link`,cloneSettings:`Clone`,cloneFields:`Fields to clone`,cloneHint:`One field name per line`,containerSettings:`Structure`,buttonLabel:`Button label`,collapsed:`Collapsed row title field`,subFields:`Subfields`,layouts:`Layouts`,addLayout:`Add layout`,newLayout:`New layout`,layoutName:`Layout name`,layoutLabel:`Layout label`,layoutDisplay:`Layout display`,conditionalLogic:`Conditional logic`,conditionalHint:`Show this field only when the rules match.`,chooseField:`Choose a field`,conditionValue:`Value`,addCondition:`Add condition`,addConditionGroup:`Add OR group`,conditionsAnd:`Conditions in this group use AND.`,choicesHint:`One choice per line in the format value|Label.`,cloneSource:`Source group or field`,cloneSourceHint:`Field group key or field name to copy fields from.`,requiredOn:`Required`,requiredOff:`Not required`,libraryAll:`All`,libraryUploaded:`Uploaded to this post`,ui:`Enhanced UI`,uiHint:`Use enhanced styling for the dropdown.`,wrapperClass:`Wrapper class`,wrapperWidthHint:`CSS width of the field wrapper, e.g. 50%.`,collapsedHint:`Name of the sub-field used as the row title.`,conditionalActive:`Active`,showIf:`Show if`,removeRule:`Remove rule`,and:`AND`,or:`OR`,noLayouts:`No layouts yet.`,validation:`Validation`,advanced:`Advanced`,fieldType:`Type`,fieldNameHint:`Letters, numbers and underscores only.`,ariaLabel:`Field settings`,operators:{eq:`equals`,neq:`does not equal`,gt:`is greater than`,lt:`is less than`,contains:`contains`,hasAny:`has any value`,hasNone:`is empty`}},actions:{delete:`Delete`,confirmDelete:`Delete this field group?`,edit:`Edit`,duplicate:`Duplicate`,activate:`Activate`,deactivate:`Deactivate`,export:`Export`,import:`Import`},import:{description:`Import field groups from a JSON file. The file must contain a field group object or an array of field group objects. Existing groups with the same key will be updated; new groups will be created.`,dropzone:`Click to select a .json file, or drag and drop here`,hint:`File selected. Click Import to proceed.`},loading:`Loading custom fields…`,loadError:`Could not load custom fields.`}},D={title:`Menus`,description:`Create and manage the navigation menus used by your site.`,hint:`Menus are independent from content types and can be rendered by your theme.`,new:`New menu`,create:`Create menu`,edit:`Edit menu`,name:`Name`,slug:`Slug`,items:`Items`,back:`Back to menus`,nameRequired:`Enter a menu name.`,editor:{eyebrow:`Navigation structure`,addItems:`Add menu items`,search:`Search…`,addSelected:`Add selected`,addToMenu:`Add to menu`,structure:`Menu structure`,structureHint:`Drag items to reorder. Use the arrows to create nested submenus.`,empty:`Add items from the panels on the left.`,emptyLevel:`No submenu items.`,drag:`Drag to reorder`,untitled:`Untitled item`,noUrl:`No URL`,up:`Move up`,down:`Move down`,indent:`Make submenu`,outdent:`Move to parent level`,itemSettings:`Item settings`,navigationLabel:`Navigation label`,url:`URL`,titleAttribute:`Title attribute`,cssClasses:`CSS classes`,target:`Open link in`,sameWindow:`Same window`,newWindow:`New window`,xfn:`Link relationship (XFN)`,description:`Description`,remove:`Remove`,settings:`Menu settings`,autoAddPages:`Automatically add new top-level pages to this menu`,autoAddPagesHint:`This setting is saved with the menu and can be used by the active theme.`},sources:{pages:`Pages`,posts:`Posts`,custom:`Custom Links`,customHint:`Add any internal or external URL.`,home:`Home`,contentTypes:`Content type items`,archives:`Content type archives`,taxonomies:`Taxonomy terms`},saved:`Menu saved.`,deleted:`Menu deleted.`,empty:`No menus yet.`,confirmDelete:`Delete menu "{name}"?`},O={title:`Content Resources`,description:`Description`,tabs:{category:`Categories`,tag:`Tags`,menu:`Menus`},new:`New resource`,name:`Name`,slug:`Slug`,items:`Menu items (JSON)`,saved:`Resource saved.`,confirmDelete:`Delete this resource?`,form:{new:`Create resource`,edit:`Edit resource`},terms:{title:`Taxonomy terms`,choose:`Choose a taxonomy`,new:`New term`}},k={title:`Access`,description:`Manage roles, permissions and tenants.`,roles:`Roles`,tenants:`Tenants`,permissions:`Permissions (comma separated)`,domain:`Domain`},A={title:`Logs`,description:`Complete audit history of actions performed in the CMS.`,retentionTitle:`Log retention`,retentionDescription:`Logs older than this period are removed automatically.`,retentionDays:`Keep logs for (days)`,retentionSaved:`Log retention updated.`,historyTitle:`Audit history`,actionFilter:`Filter by action`,resourceFilter:`Filter by resource`,loading:`Loading logs…`,empty:`No actions recorded yet.`,system:`System`,columns:{date:`Date`,action:`Action`,resource:`Resource`,user:`User`,status:`Status`,ip:`IP`}},j={title:`Webhooks`,description:`Send CMS events to external services with configurable authentication.`,listTitle:`Configured webhooks`,new:`New webhook`,create:`Create webhook`,edit:`Edit webhook`,url:`Endpoint URL`,events:`Events`,selectEvents:`Select one or more events`,searchEvents:`Search events…`,noEvents:`No events found.`,eventsRequired:`Select at least one event.`,authentication:`Authentication`,active:`Active`,token:`Bearer token`,username:`Username`,password:`Password`,headerName:`Header name`,apiKeyValue:`API key value`,secret:`HMAC secret`,signatureHeader:`Signature header`,keepExisting:`Leave blank to keep current value`,loading:`Loading webhooks…`,empty:`No webhooks configured.`,auth:{none:`None`,bearer:`Bearer token`,basic:`Basic authentication`,apiKey:`API key`,hmac_sha256:`HMAC SHA-256`}},M={title:`Plugins`,description:`Manage installed plugins.`,directoryHint:`Detected automatically from the project's plugins/ directory. Use the CLI or deploy files to add extensions.`,columns:{name:`Name`,version:`Version`,status:`Status`,actions:`Actions`},status:{active:`Active`,installed:`Installed`,inactive:`Inactive`},activate:`Activate`,deactivate:`Deactivate`,install:`Install plugin`,uninstall:`Uninstall`,confirmUninstall:`Uninstall {name}?`,name:`Plugin name`,version:`Version`,manifest:`Manifest (JSON)`,loadError:`Could not load plugins.`,activateError:`Could not activate the plugin.`,deactivateError:`Could not deactivate the plugin.`,installError:`Could not install the plugin.`,uninstallError:`Could not uninstall the plugin.`,empty:`No plugins installed.`},N={title:`Themes`,description:`Manage installed themes.`,directoryHint:`Detected automatically from the project's themes/ directory. Use the CLI or deploy files to add themes.`,version:`Version`,active:`Active`,status:{active:`Active`,installed:`Installed`,inactive:`Inactive`},activate:`Activate`,deactivate:`Deactivate`,install:`Install theme`,uninstall:`Uninstall`,confirmUninstall:`Uninstall {name}?`,name:`Theme name`,manifest:`Manifest (JSON)`,loadError:`Could not load themes.`,activateError:`Could not activate the theme.`,deactivateError:`Could not deactivate the theme.`,installError:`Could not install the theme.`,uninstallError:`Could not uninstall the theme.`,empty:`No themes installed.`},P={title:`Login`,subtitle:`Sign in to your account`,email:`Email`,password:`Password`,submit:`Sign In`,failed:`Invalid email or password`},F={save:`Save`,cancel:`Cancel`,delete:`Delete`,edit:`Edit`,close:`Close`,confirm:`Confirm`,loading:`Loading…`,yes:`Yes`,no:`No`,search:`Search`,filter:`Filter`,create:`Create`,update:`Update`,remove:`Remove`,viewAll:`View All`,back:`Back`,next:`Next`,previous:`Previous`,page:`Page`,of:`of`,items:`items`,item:`item`,empty:`No {items} found.`,toast:{success:`✓`,error:`Error: {message}`},status:{active:`Active`,inactive:`Inactive`,draft:`Draft`,published:`Published`,archived:`Archived`,locked:`Locked`},language:`Language`,refresh:`Refresh`,actions:`Actions`},I={justNow:`just now`,minAgo:`minutes ago`,ago:`ago`,published:`Published`,updated:`Updated`,newUser:`New user: {name}`},L={mainMenu:`Main menu`,notifications:`Notifications`,notificationsEmpty:`No recent activity`,settings:`Settings`,toggleSidebar:`Toggle sidebar`,userMenu:`User menu`},R={copyright:`© 2026 OkCMS. All rights reserved.`,links:`Links`,website:`Website`,github:`GitHub`,docs:`Documentation`,community:`Community`,poweredBy:`Powered by Oktis Works`},z={title:`Help`,label:`Help`,tabs:`Help topics`,topics:{overview:{label:`Overview`,content:`<h4>Welcome to the OkCMS Dashboard</h4><p>This dashboard gives you an overview of your site's content and activity.</p><h4>Available Widgets</h4><ul><li><strong>At a Glance:</strong> overview of posts, pages, media, and users</li><li><strong>Quick Draft:</strong> save drafts quickly from the dashboard</li><li><strong>Activity:</strong> recent site activity and updates</li></ul>`},content:{label:`Content Management`,content:`<h4>Managing Content</h4><p>Create, edit, and publish content from the Content section.</p><h4>Quick Actions</h4><ul><li>Click "New Content" to create a new post or page</li><li>Use filters to find specific content</li><li>Bulk actions available for multiple items</li></ul>`},media:{label:`Media Library`,content:`<h4>Managing Media</h4><p>Upload and manage images, videos, and documents.</p><h4>Tips</h4><ul><li>Drag and drop files to upload</li><li>Add alt text for accessibility</li><li>Organize with folders (coming soon)</li></ul>`}}},B={title:`Screen Options`,label:`Screen Options`,showOnScreen:`Show on screen`},V={layout:x,dashboard:S,content:C,media:w,users:T,settings:E,menus:D,resources:O,access:k,logs:A,webhooks:j,plugins:M,themes:N,login:P,common:F,activity:I,adminBar:L,footer:R,helpTabs:z,screenOptions:B},H=new Map,U=V,[W,G]=t(0),K=null;function q(e){return(e.split(`.`).at(-1)??e).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim().replace(/^\w/,e=>e.toUpperCase())}function J(e,t){return function(n,r){let i=n.split(`.`),a=e;for(let e of i)if(a&&typeof a==`object`&&e in a)a=a[e];else{a=t;for(let e of i)if(a&&typeof a==`object`&&e in a)a=a[e];else return q(n);break}return typeof a==`string`?r?a.replace(/\{(\w+)\}/g,(e,t)=>String(r[t]??``)):a:q(n)}}async function Y(e){if(H.has(e))return H.get(e);let[t,n]=await Promise.all([p(e),p(`en`)]),r=J(t,n);return H.set(e,r),r}var X=J(U,U),Z=`en`,Q=!0,re=`okcms:locale-changed`;function $(){typeof window<`u`&&window.dispatchEvent(new CustomEvent(re,{detail:{locale:Z}}))}function ie(e){return n(async()=>{Q&&(K||=(async()=>{let t=e??await v();Z=t,X=await Y(t),Q=!1,G(e=>e+1),$()})(),await K)}),{t:(e,t)=>(W(),X(e,t)),locale:()=>(W(),Z),changeLocale:async e=>{Q=!0,Z=e,X=await Y(e),Q=!1,G(e=>e+1),$(),await y(e)},get loading(){return Q}}}export{i as a,a as i,ie as n,o as r,Y as t};
1
+ import{n as e}from"./rolldown-runtime.BpQH8Ho1.js";import{p as t,v as n}from"./solid.8gBSxpeo.js";import{t as r}from"./api.CGA0D2A2.js";var i=[`pt-BR`,`en`,`es-ES`,`ru`,`uk`,`tr`,`he`,`it`,`pl`,`zh-CN`,`ja`,`ar`,`sw`,`yo`,`zu`,`am`,`ha`,`ig`],a={"pt-BR":`Português (Brasil)`,en:`English`,"es-ES":`Español`,ru:`Русский`,uk:`Українська`,tr:`Türkçe`,he:`עברית`,it:`Italiano`,pl:`Polski`,"zh-CN":`中文 (简体)`,ja:`日本語`,ar:`العربية`,sw:`Kiswahili`,yo:`Yorùbá`,zu:`isiZulu`,am:`አማርኛ`,ha:`Hausa`,ig:`Igbo`},o={"pt-BR":`🇧🇷`,en:`🇺🇸`,"es-ES":`🇪🇸`,ru:`🇷🇺`,uk:`🇺🇦`,tr:`🇹🇷`,he:`🇮🇱`,it:`🇮🇹`,pl:`🇵🇱`,"zh-CN":`🇨🇳`,ja:`🇯🇵`,ar:`🇸🇦`,sw:`🇹🇿`,yo:`🇳🇬`,zu:`🇿🇦`,am:`🇪🇹`,ha:`🇳🇬`,ig:`🇳🇬`},s=(e,t,n)=>{let r=t.lastIndexOf(`?`),i=e[r===-1||r<t.lastIndexOf(`/`)?t:t.slice(0,r)];return i?typeof i==`function`?i():Promise.resolve(i):new Promise((e,r)=>{(typeof queueMicrotask==`function`?queueMicrotask:setTimeout)(r.bind(null,Error(`Unknown variable dynamic import: `+t+(t.split(`/`).length===n?``:`. Note that variables only represent file names one level deep.`))))})},c=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),ee=function(e){return`/`+e},l={},u=function(e){return e.pathname.endsWith(`.css`)},d=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=ee(t,n);let r=s(t);if(r.href in l)return;l[r.href]=!0;let i=u(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:c,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},f=new Map;async function p(e){if(f.has(e))return f.get(e);try{let t=await s(Object.assign({"./locales/ar.json":()=>d(()=>import(`./ar.9BcNkJMI.js`),[]),"./locales/en.json":()=>d(()=>Promise.resolve().then(()=>b),void 0),"./locales/es-ES.json":()=>d(()=>import(`./es-ES.DgqDFCmG.js`),[]),"./locales/he.json":()=>d(()=>import(`./he.11dIJHQw.js`),[]),"./locales/it.json":()=>d(()=>import(`./it.yCdgk3Xj.js`),[]),"./locales/ja.json":()=>d(()=>import(`./ja.BIm7Hwe_.js`),[]),"./locales/pl.json":()=>d(()=>import(`./pl.dUwrcITB.js`),[]),"./locales/pt-BR.json":()=>d(()=>import(`./pt-BR.dxAFMMtn.js`),[]),"./locales/ru.json":()=>d(()=>import(`./ru.lmDiQaSu.js`),[]),"./locales/sw.json":()=>d(()=>import(`./sw._qHdoFbp.js`),[]),"./locales/tr.json":()=>d(()=>import(`./tr.Do-lr98T.js`),[]),"./locales/uk.json":()=>d(()=>import(`./uk.DTUX-N1c.js`),[]),"./locales/yo.json":()=>d(()=>import(`./yo.BIYG0J7I.js`),[]),"./locales/zh-CN.json":()=>d(()=>import(`./zh-CN.C7Iod1E1.js`),[])}),`./locales/${e}.json`,3),n=t.default??t;return f.set(e,n),n}catch{return e===`en`?{}:p(`en`)}}var m=`admin_locale`;function h(){if(typeof document>`u`)return null;let e=document.cookie.match(RegExp(`(?:^|; )${m}=([^;]+)`));return e?.[1]&&i.includes(e[1])?e[1]:null}function g(e){typeof document<`u`&&(document.cookie=`${m}=${e}; path=/; max-age=31536000; SameSite=Lax`)}function _(){if(typeof navigator>`u`)return`en`;let e=navigator.language?.split(`-`)[0]?.toLowerCase(),t=navigator.language?.toLowerCase();for(let n of i)if(n.toLowerCase()===t||n.split(`-`)[0]===e)return n;return`en`}async function te(){try{let e=await r.getUserLocale();if(e&&i.includes(e))return e}catch{}return null}async function ne(e){await r.setUserLocale(e)}async function v(){return h()||await te()||_()||`en`}async function y(e){g(e);try{await ne(e)}catch{}}var b=e({access:()=>k,activity:()=>I,adminBar:()=>L,common:()=>F,content:()=>C,dashboard:()=>S,default:()=>V,footer:()=>R,helpTabs:()=>z,layout:()=>x,login:()=>P,logs:()=>A,media:()=>w,menus:()=>D,plugins:()=>M,resources:()=>O,screenOptions:()=>B,settings:()=>E,themes:()=>N,users:()=>T,webhooks:()=>j}),x={appName:`OkCMS`,admin:`Admin`,nav:{dashboard:`Dashboard`,content:`Content`,media:`Media`,users:`Users`,menus:`Menus`,settings:`Settings`,plugins:`Plugins`,themes:`Themes`},actions:{logout:`Logout`,newPost:`New Post`,uploadMedia:`Upload Media`,addUser:`Add User`,openSettings:`Settings`}},S={title:`Dashboard`,stats:{totalContent:`Total Content`,published:`Published`,drafts:`Drafts`,mediaFiles:`Media Files`,users:`Users`},recent:{title:`Recent Content`,viewAll:`View All`,empty:`No content yet — create your first!`,columns:{title:`Title`,type:`Type`,status:`Status`,updated:`Updated`}},widgets:{atGlance:`At a Glance`,posts:`Posts`,postsDesc:`Published / Drafts / Trash`,pages:`Pages`,pagesDesc:`Published / Drafts / Trash`,media:`Media`,mediaDesc:`Files in the library`,users:`Users`,usersDesc:`Total / Active / Inactive`,version:`Version`,storage:`Storage`,quickDraft:{title:`Quick Draft`,heading:`Title`,headingPlaceholder:`Give your draft a title`,content:`Content`,contentPlaceholder:`What's on your mind?`,save:`Save Draft`,yourDrafts:`Your Drafts`,noDrafts:`No drafts yet.`},activity:{title:`Activity`,empty:`No activity yet.`}}},C={list:{title:`Content`,description:`Search, filter, edit and publish your content.`,typeNotFound:`This content type was not found.`,columns:{title:`Title`,type:`Type`,status:`Status`,updated:`Updated`},actions:{edit:`Edit`,publish:`Publish`,unpublish:`Unpublish`,delete:`Delete`},filters:{search:`Search content…`,allTypes:`All types`,allStatus:`All status`},buttons:{new:`+ New content`,addNew:`+ Add new`,search:`Search`},all:`All content`,empty:`No content found.`,statuses:{draft:`Draft`,published:`Published`,archived:`Archived`},confirmDelete:`Delete "{title}"?`,toasts:{published:`Content published ✓`,unpublished:`Content unpublished ✓`}},editor:{type:`Type`,adding:`Add new`,editing:`Edit`,backToList:`Back to list`,saving:`Saving…`,title:`Title`,titlePlaceholder:`Add title`,slug:`Slug`,slugPlaceholder:`auto-generated-from-title`,toolbar:`Editor toolbar`,bodyPlaceholder:`Start writing…`,linkPrompt:`Enter the URL:`,excerpt:`Excerpt`,featuredImage:`Featured Image (media ID)`,mediaIdPlaceholder:`Media ID`,featuredImageHint:`Choose a media item from the Media library.`,pageAttributes:`Page attributes`,publishPanel:`Publish`,status:`Status`,statusOptions:{draft:`Draft`,published:`Published`,archived:`Archived`},layout:`Layout`,layoutAuto:`Automatic (theme hierarchy)`,customFields:`Custom Fields`,inspectTypes:`Inspect available types`,save:`Save`,saved:`Content saved successfully.`},taxonomy:{title:`Taxonomy terms`,back:`← Back to content`,choose:`Choose a taxonomy from the content menu.`,notFound:`Taxonomy not found.`,addTerm:`Add new term`,editTerm:`Edit term`,name:`Name`,slug:`Slug`,description:`Description`,descriptionHint:`Manage the terms used by this content type.`,attachedTo:`Attached to`,add:`Add term`,delete:`Delete`,empty:`No terms yet.`,confirmDelete:`Delete "{name}"?`}},w={title:`Media Library`,description:"Upload and manage images, videos and documents. Files are stored in `uploads/` and served publicly.",upload:{dropzone:`Drop files here or`,select:`Select files`,uploading:`Uploading…`,hint:`Images, videos, audio and documents · up to 25MB per file`},toolbar:{search:`Search by name or alt…`,allTypes:`All types`,searchBtn:`Search`},mimeTypes:{png:`PNG`,jpeg:`JPEG`,gif:`GIF`,webp:`WebP`,svg:`SVG`,pdf:`PDF`,mp4:`MP4`,mp3:`MP3`},empty:`No files yet. Upload the first one!`,details:{title:`Details`,titleField:`Title`,file:`File`,type:`Type`,size:`Size`,dimensions:`Dimensions`,uploaded:`Uploaded`,url:`URL`,copy:`Copy`,alt:`Alt text`,caption:`Caption`,description:`Description`,save:`Save details`,replace:`Replace file`,replacing:`Replacing…`,replaceHint:`Keeps this attachment and its metadata.`,delete:`Delete`,close:`Close`,confirmDelete:`Delete "{filename}"? The file will be removed from disk.`,saved:`Details saved ✓`,copied:`URL copied ✓`,copyError:`Could not copy URL`,replaced:`File replaced ✓`},toasts:{uploaded:`{count} file(s) uploaded ✓`}},T={title:`Users`,description:`Manage accounts, roles and project access.`,new:`New User`,toolbar:{search:`Search by name or email…`,allStatus:`All status`,active:`Active`,inactive:`Inactive`,newBtn:`+ New user`,searchBtn:`Search`},table:{name:`Name`,email:`Email`,role:`Role`,status:`Status`,lastAccess:`Last access`,actions:{manage:`Manage`,delete:`Delete`}},empty:`No users found.`,noRole:`No role`,detail:{title:`Manage user`,fields:{name:`Name`,email:`Email`,status:`Status`,role:`Role`,password:`Password`},statusOptions:{active:`Active`,inactive:`Inactive`},rolePlaceholder:`— no role —`,meta:`Created on {created} · last access {lastAccess}`,actions:{save:`Save`,resetPassword:`Reset password`,close:`Close`},passwordPrompt:`New password for {email} (minimum 8 chars):`,passwordError:`Password must be at least 8 characters`,toasts:{roleUpdated:`Role for {name} updated ✓`,passwordChanged:`Password for {name} changed ✓`,saved:`User {name} saved ✓`,deleted:`User {name} deleted ✓`},confirmDelete:`Delete user {email}?`}},E={general:{title:`General`,description:`Basic information displayed on the site.`,back:`← All settings`,fields:{siteTitle:`Site Title`,siteTitlePlaceholder:`My Site`,siteDescription:`Description`,siteDescriptionPlaceholder:`A new site built with OkCMS`,language:`Language`,timezone:`Timezone`,timezonePlaceholder:`America/Sao_Paulo`},saved:`Settings saved ✓`,loading:`Loading…`,save:`Save`},postTypes:{title:`Content Types`,description:`Create custom content types (CPTs) beyond Posts and Pages.`,form:{title:`Create Content Type`,slug:`Slug (singular, e.g.: portfolio)`,slugHint:`Only lowercase letters, numbers and underscore`,singular:`Singular name`,plural:`Plural name`,supports:`Supports`,supportsOptions:{title:`Title`,editor:`Editor`,thumbnail:`Featured Image`,excerpt:`Excerpt`,revisions:`Revisions`},hasArchive:`Has public archive (/slug)`,singleton:`Singleton (only one content entry)`,icon:`Sidebar icon (Lucide name)`,iconHint:`Examples: box, package, shopping-bag, file-text`,editTitle:`Edit Content Type`,update:`Update`,cancel:`Cancel`,create:`Create`},table:{slug:`Slug`,singular:`Singular`,plural:`Plural`,source:`Source`,supports:`Supports`,archive:`Archive`,mode:`Mode`,singleton:`Singleton`,collection:`Collection`,icon:`Icon`,actions:{edit:`Edit`,remove:`Remove`}},sources:{admin:`Admin`,core:`Core`}},taxonomies:{title:`Taxonomies`,description:`Create custom taxonomies and link them to content types.`,form:{title:`Create Taxonomy`,name:`Name (e.g.: Genre)`,slug:`Slug (optional, generated from name)`,slugHint:`Only lowercase letters, numbers and underscore`,hierarchical:`Hierarchical (allows parent/child terms)`,attachTo:`Link to content types`,create:`Create`},table:{taxonomy:`Taxonomy`,hierarchical:`Hierarchical`,attachedTypes:`Linked content types`,actions:{remove:`Remove`}}},customFields:{title:`Custom Fields`,description:`Create field groups, arrange fields and choose which standard fields are visible for each content type.`,contentType:`Content type`,location:{title:`Location rules`,description:`Choose where this field group appears. Rules in the same group use AND; groups use OR.`,parameter:`Location parameter`,operator:`Operator`,chooseValue:`Choose a value`,valuePlaceholder:`Enter a value or slug`,showIf:`Show if`,removeRule:`Remove rule`,required:`Add a value to every location rule.`,addRule:`Add condition`,addGroup:`Add OR group`,remove:`Remove`,and:`AND`,or:`OR`,params:{content_type:`Post type`,content_slug:`Post slug`,taxonomy:`Taxonomy`,term:`Term slug`,user_role:`User role`,page_template:`Page template`,post_status:`Post status`},operators:{eq:`is`,neq:`is not`}},standard:{title:`Standard fields`,description:`Title and slug are required. The other standard fields can be enabled or disabled.`,enabled:`Enabled`,locked:`Required`,fields:{title:`Title`,slug:`Slug`,content:`Content`,excerpt:`Excerpt`,featured_image:`Featured image`,seo_title:`SEO title`,seo_description:`SEO description`,status:`Status`,author:`Author`}},groups:{title:`Field groups`,new:`New field group`,empty:`No custom field groups yet.`,emptyHint:`Create your first group to start modelling your content.`,search:`Search groups…`,groupName:`Group`,status:`Status`,fields:`fields`,appliesTo:`Applies to`,allContentTypes:`All content types`,edit:`Edit`,active:`Active`,inactive:`Inactive`},form:{createTitle:`Create field group`,editTitle:`Edit field group`,title:`Group name`,titlePlaceholder:`Example: Product details`,displayTitle:`Display title`,active:`Active`,backToGroups:`Back to groups`,editorEyebrow:`Field builder`,groupTitleHint:`This name identifies the field set inside the content editor.`,fieldsTitle:`Fields`,fieldsDescription:`Add, configure and order fields. Use the six-dot handle to drag without losing their position.`,noFields:`This group has no fields yet.`,settingsTitle:`Group settings`,settingsDescription:`Presentation and panel visibility options for this panel.`,description:`Description`,labelPlacement:`Label placement`,instructionPlacement:`Instruction placement`,menuOrder:`Menu order`,hideOnScreen:`Hide on edit screen`,hide:{permalink:`Permalink`,content:`Content editor`,excerpt:`Excerpt`,featured_image:`Featured image`,author:`Author`,revisions:`Revisions`,comments:`Comments`},assignTitle:`Location`,assignDescription:`Choose the content type where this field group will be available.`,contentType:`Content type`,position:`Position`,positions:{normal:`Normal`,side:`Sidebar`,after_title:`After title`},displayStyle:`Display style`,displayStyles:{standard:`Standard`,seamless:`Seamless`,grouped:`Grouped`},field:`Field`,fieldName:`Name/key`,fieldNamePlaceholder:`product_code`,fieldLabel:`Label`,fieldLabelPlaceholder:`Product code`,fieldType:`Type`,instructions:`Instructions`,instructionsPlaceholder:`Optional help text for editors`,required:`Required`,options:`Options`,optionsHint:`One option per line: value|Label`,addField:`Add field`,removeField:`Remove`,dragHint:`Drag to reorder`,editField:`Edit`,duplicateField:`Duplicate`,copySuffix:`(copy)`,selectFieldType:`Select field type`,searchFieldTypes:`Search field types…`,popularFields:`Popular`,noMatchingFieldTypes:`No field types found.`,fieldTypeHint:`Choose the type that best represents the value editors will enter in this field.`,selectField:`Select field`,save:`Save group`,cancel:`Cancel`,newFieldDefault:`New field`,saved:`Field group saved.`,deleted:`Field group deleted.`},listEyebrow:`Content structure`,validation:{titleRequired:`Group name is required.`},tabs:{locationRules:`Location rules`,presentation:`Presentation`,groupSettings:`Group settings`},fieldSettings:{general:`General`,fieldLabel:`Field label`,fieldName:`Field name`,instructions:`Instructions`,required:`Required`,defaultValue:`Default value`,placeholder:`Placeholder`,presentation:`Presentation`,wrapperWidth:`Wrapper width (%)`,labelPlacement:`Label`,instructionPlacement:`Instructions`,top:`Above`,left:`Left`,above:`Before field`,below:`After field`,textSettings:`Text`,prepend:`Prepend`,append:`Append`,minLength:`Minimum length`,maxLength:`Maximum length`,rows:`Rows`,newLines:`New lines`,wpautop:`Automatic paragraphs`,none:`None`,numberSettings:`Number`,min:`Minimum`,max:`Maximum`,step:`Step`,choiceSettings:`Choices`,choices:`Choices`,layout:`Layout`,vertical:`Vertical`,horizontal:`Horizontal`,multiple:`Multiple choice`,allowNull:`Allow empty`,mediaSettings:`Media`,returnFormat:`Return format`,array:`Array`,id:`ID`,previewSize:`Preview size`,library:`Library`,all:`All`,uploadedToPost:`Uploaded to this post`,allowedTypes:`Allowed types`,minWidth:`Minimum width`,maxWidth:`Maximum width`,minHeight:`Minimum height`,maxHeight:`Maximum height`,wysiwygSettings:`WYSIWYG`,tabs:`Tabs`,toolbar:`Toolbar`,mediaUpload:`Allow media upload`,dateSettings:`Date and time`,displayFormat:`Display format`,firstDay:`First day`,colorSettings:`Color`,enableOpacity:`Allow opacity`,mapSettings:`Map`,center:`Center`,zoom:`Zoom`,height:`Height`,relationSettings:`Relationship`,postType:`Post type`,taxonomy:`Taxonomy`,booleanSettings:`True/False`,message:`Message`,defaultChecked:`Checked by default`,linkSettings:`Link`,cloneSettings:`Clone`,cloneFields:`Fields to clone`,cloneHint:`One field name per line`,containerSettings:`Structure`,buttonLabel:`Button label`,collapsed:`Collapsed row title field`,subFields:`Subfields`,layouts:`Layouts`,addLayout:`Add layout`,newLayout:`New layout`,layoutName:`Layout name`,layoutLabel:`Layout label`,layoutDisplay:`Layout display`,conditionalLogic:`Conditional logic`,conditionalHint:`Show this field only when the rules match.`,chooseField:`Choose a field`,conditionValue:`Value`,addCondition:`Add condition`,addConditionGroup:`Add OR group`,conditionsAnd:`Conditions in this group use AND.`,choicesHint:`One choice per line in the format value|Label.`,cloneSource:`Source group or field`,cloneSourceHint:`Field group key or field name to copy fields from.`,requiredOn:`Required`,requiredOff:`Not required`,libraryAll:`All`,libraryUploaded:`Uploaded to this post`,ui:`Enhanced UI`,uiHint:`Use enhanced styling for the dropdown.`,wrapperClass:`Wrapper class`,wrapperWidthHint:`CSS width of the field wrapper, e.g. 50%.`,collapsedHint:`Name of the sub-field used as the row title.`,conditionalActive:`Active`,showIf:`Show if`,removeRule:`Remove rule`,and:`AND`,or:`OR`,noLayouts:`No layouts yet.`,validation:`Validation`,advanced:`Advanced`,fieldType:`Type`,fieldNameHint:`Letters, numbers and underscores only.`,ariaLabel:`Field settings`,operators:{eq:`equals`,neq:`does not equal`,gt:`is greater than`,lt:`is less than`,contains:`contains`,hasAny:`has any value`,hasNone:`is empty`}},actions:{delete:`Delete`,confirmDelete:`Delete this field group?`,edit:`Edit`,duplicate:`Duplicate`,activate:`Activate`,deactivate:`Deactivate`,export:`Export`,import:`Import`},import:{description:`Import field groups from a JSON file. The file must contain a field group object or an array of field group objects. Existing groups with the same key will be updated; new groups will be created.`,dropzone:`Click to select a .json file, or drag and drop here`,hint:`File selected. Click Import to proceed.`},loading:`Loading custom fields…`,loadError:`Could not load custom fields.`}},D={title:`Menus`,description:`Create and manage the navigation menus used by your site.`,hint:`Menus are independent from content types and can be rendered by your theme.`,new:`New menu`,create:`Create menu`,edit:`Edit menu`,name:`Name`,slug:`Slug`,items:`Items`,back:`Back to menus`,nameRequired:`Enter a menu name.`,editor:{eyebrow:`Navigation structure`,addItems:`Add menu items`,search:`Search…`,addSelected:`Add selected`,addToMenu:`Add to menu`,structure:`Menu structure`,structureHint:`Drag items to reorder. Use the arrows to create nested submenus.`,empty:`Add items from the panels on the left.`,emptyLevel:`No submenu items.`,drag:`Drag to reorder`,untitled:`Untitled item`,noUrl:`No URL`,up:`Move up`,down:`Move down`,indent:`Make submenu`,outdent:`Move to parent level`,itemSettings:`Item settings`,navigationLabel:`Navigation label`,url:`URL`,titleAttribute:`Title attribute`,cssClasses:`CSS classes`,target:`Open link in`,sameWindow:`Same window`,newWindow:`New window`,xfn:`Link relationship (XFN)`,description:`Description`,remove:`Remove`,settings:`Menu settings`,autoAddPages:`Automatically add new top-level pages to this menu`,autoAddPagesHint:`This setting is saved with the menu and can be used by the active theme.`},sources:{pages:`Pages`,posts:`Posts`,custom:`Custom Links`,customHint:`Add any internal or external URL.`,home:`Home`,contentTypes:`Content type items`,archives:`Content type archives`,taxonomies:`Taxonomy terms`},saved:`Menu saved.`,deleted:`Menu deleted.`,empty:`No menus yet.`,confirmDelete:`Delete menu "{name}"?`},O={title:`Content Resources`,description:`Description`,tabs:{category:`Categories`,tag:`Tags`,menu:`Menus`},new:`New resource`,name:`Name`,slug:`Slug`,items:`Menu items (JSON)`,saved:`Resource saved.`,confirmDelete:`Delete this resource?`,form:{new:`Create resource`,edit:`Edit resource`},terms:{title:`Taxonomy terms`,choose:`Choose a taxonomy`,new:`New term`}},k={title:`Access`,description:`Manage roles, permissions and tenants.`,roles:`Roles`,tenants:`Tenants`,permissions:`Permissions (comma separated)`,domain:`Domain`},A={title:`Logs`,description:`Complete audit history of actions performed in the CMS.`,retentionTitle:`Log retention`,retentionDescription:`Logs older than this period are removed automatically.`,retentionDays:`Keep logs for (days)`,retentionSaved:`Log retention updated.`,historyTitle:`Audit history`,actionFilter:`Filter by action`,resourceFilter:`Filter by resource`,loading:`Loading logs…`,empty:`No actions recorded yet.`,system:`System`,columns:{date:`Date`,action:`Action`,resource:`Resource`,user:`User`,status:`Status`,ip:`IP`}},j={title:`Webhooks`,description:`Send CMS events to external services with configurable authentication.`,listTitle:`Configured webhooks`,new:`New webhook`,create:`Create webhook`,edit:`Edit webhook`,url:`Endpoint URL`,events:`Events`,selectEvents:`Select one or more events`,searchEvents:`Search events…`,noEvents:`No events found.`,eventsRequired:`Select at least one event.`,authentication:`Authentication`,active:`Active`,token:`Bearer token`,username:`Username`,password:`Password`,headerName:`Header name`,apiKeyValue:`API key value`,secret:`HMAC secret`,signatureHeader:`Signature header`,keepExisting:`Leave blank to keep current value`,loading:`Loading webhooks…`,empty:`No webhooks configured.`,auth:{none:`None`,bearer:`Bearer token`,basic:`Basic authentication`,apiKey:`API key`,hmac_sha256:`HMAC SHA-256`}},M={title:`Plugins`,description:`Manage installed plugins.`,directoryHint:`Detected automatically from the project's plugins/ directory. Use the CLI or deploy files to add extensions.`,columns:{name:`Name`,version:`Version`,status:`Status`,actions:`Actions`},status:{active:`Active`,installed:`Installed`,inactive:`Inactive`},activate:`Activate`,deactivate:`Deactivate`,install:`Install plugin`,uninstall:`Uninstall`,confirmUninstall:`Uninstall {name}?`,name:`Plugin name`,version:`Version`,manifest:`Manifest (JSON)`,loadError:`Could not load plugins.`,activateError:`Could not activate the plugin.`,deactivateError:`Could not deactivate the plugin.`,installError:`Could not install the plugin.`,uninstallError:`Could not uninstall the plugin.`,empty:`No plugins installed.`},N={title:`Themes`,description:`Manage installed themes.`,directoryHint:`Detected automatically from the project's themes/ directory. Use the CLI or deploy files to add themes.`,version:`Version`,active:`Active`,status:{active:`Active`,installed:`Installed`,inactive:`Inactive`},activate:`Activate`,deactivate:`Deactivate`,install:`Install theme`,uninstall:`Uninstall`,confirmUninstall:`Uninstall {name}?`,name:`Theme name`,manifest:`Manifest (JSON)`,loadError:`Could not load themes.`,activateError:`Could not activate the theme.`,deactivateError:`Could not deactivate the theme.`,installError:`Could not install the theme.`,uninstallError:`Could not uninstall the theme.`,empty:`No themes installed.`},P={title:`Login`,subtitle:`Sign in to your account`,email:`Email`,password:`Password`,submit:`Sign In`,failed:`Invalid email or password`},F={save:`Save`,cancel:`Cancel`,delete:`Delete`,edit:`Edit`,close:`Close`,confirm:`Confirm`,loading:`Loading…`,yes:`Yes`,no:`No`,search:`Search`,filter:`Filter`,create:`Create`,update:`Update`,remove:`Remove`,viewAll:`View All`,back:`Back`,next:`Next`,previous:`Previous`,page:`Page`,of:`of`,items:`items`,item:`item`,empty:`No {items} found.`,toast:{success:`✓`,error:`Error: {message}`},status:{active:`Active`,inactive:`Inactive`,draft:`Draft`,published:`Published`,archived:`Archived`,locked:`Locked`},language:`Language`,refresh:`Refresh`,actions:`Actions`},I={justNow:`just now`,minAgo:`minutes ago`,ago:`ago`,published:`Published`,updated:`Updated`,newUser:`New user: {name}`},L={mainMenu:`Main menu`,notifications:`Notifications`,notificationsEmpty:`No recent activity`,settings:`Settings`,toggleSidebar:`Toggle sidebar`,userMenu:`User menu`},R={copyright:`© 2026 OkCMS. All rights reserved.`,links:`Links`,website:`Website`,github:`GitHub`,docs:`Documentation`,community:`Community`,poweredBy:`Powered by Oktis Works`},z={title:`Help`,label:`Help`,tabs:`Help topics`,topics:{overview:{label:`Overview`,content:`<h4>Welcome to the OkCMS Dashboard</h4><p>This dashboard gives you an overview of your site's content and activity.</p><h4>Available Widgets</h4><ul><li><strong>At a Glance:</strong> overview of posts, pages, media, and users</li><li><strong>Quick Draft:</strong> save drafts quickly from the dashboard</li><li><strong>Activity:</strong> recent site activity and updates</li></ul>`},content:{label:`Content Management`,content:`<h4>Managing Content</h4><p>Create, edit, and publish content from the Content section.</p><h4>Quick Actions</h4><ul><li>Click "New Content" to create a new post or page</li><li>Use filters to find specific content</li><li>Bulk actions available for multiple items</li></ul>`},media:{label:`Media Library`,content:`<h4>Managing Media</h4><p>Upload and manage images, videos, and documents.</p><h4>Tips</h4><ul><li>Drag and drop files to upload</li><li>Add alt text for accessibility</li><li>Organize with folders (coming soon)</li></ul>`}}},B={title:`Screen Options`,label:`Screen Options`,showOnScreen:`Show on screen`},V={layout:x,dashboard:S,content:C,media:w,users:T,settings:E,menus:D,resources:O,access:k,logs:A,webhooks:j,plugins:M,themes:N,login:P,common:F,activity:I,adminBar:L,footer:R,helpTabs:z,screenOptions:B},H=new Map,U=V,[W,G]=t(0),K=null;function q(e){return(e.split(`.`).at(-1)??e).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim().replace(/^\w/,e=>e.toUpperCase())}function J(e,t){return function(n,r){let i=n.split(`.`),a=e;for(let e of i)if(a&&typeof a==`object`&&e in a)a=a[e];else{a=t;for(let e of i)if(a&&typeof a==`object`&&e in a)a=a[e];else return q(n);break}return typeof a==`string`?r?a.replace(/\{(\w+)\}/g,(e,t)=>String(r[t]??``)):a:q(n)}}async function Y(e){if(H.has(e))return H.get(e);let[t,n]=await Promise.all([p(e),p(`en`)]),r=J(t,n);return H.set(e,r),r}var X=J(U,U),Z=`en`,Q=!0,re=`okcms:locale-changed`;function $(){typeof window<`u`&&window.dispatchEvent(new CustomEvent(re,{detail:{locale:Z}}))}function ie(e){return n(async()=>{Q&&(K||=(async()=>{let t=e??await v();Z=t,X=await Y(t),Q=!1,G(e=>e+1),$()})(),await K)}),{t:(e,t)=>(W(),X(e,t)),locale:()=>(W(),Z),changeLocale:async e=>{Q=!0,Z=e,X=await Y(e),Q=!1,G(e=>e+1),$(),await y(e)},get loading(){return Q}}}export{i as a,a as i,ie as n,o as r,Y as t};
@@ -1 +1 @@
1
- import{t as e}from"./api.CM0tblEa.js";var n=document.getElementById(`login-form`),r=document.getElementById(`error-message`),i=document.getElementById(`submit-text`),a=document.getElementById(`submit-spinner`);n?.addEventListener(`submit`,async o=>{o.preventDefault();let s=new FormData(n),c=s.get(`email`),l=s.get(`password`);i.style.display=`none`,a.style.display=`inline-block`,r.style.display=`none`;try{await e.login({email:c,password:l}),window.location.href=`/`}catch(e){r.textContent=e instanceof Error?e.message:t(`login.failed`),r.style.display=`block`}finally{i.style.display=`inline`,a.style.display=`none`}});
1
+ import{t as e}from"./api.CGA0D2A2.js";var n=document.getElementById(`login-form`),r=document.getElementById(`error-message`),i=document.getElementById(`submit-text`),a=document.getElementById(`submit-spinner`);n?.addEventListener(`submit`,async o=>{o.preventDefault();let s=new FormData(n),c=s.get(`email`),l=s.get(`password`);i.style.display=`none`,a.style.display=`inline-block`,r.style.display=`none`;try{await e.login({email:c,password:l}),window.location.href=`/`}catch(e){r.textContent=e instanceof Error?e.message:t(`login.failed`),r.style.display=`block`}finally{i.style.display=`inline`,a.style.display=`none`}});