@oktis-works/admin 0.20.0 → 0.23.2

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 (114) hide show
  1. package/dist/client/_astro/{ActivityWidget.DtG_8-bC.js → ActivityWidget.Dzoi-bq3.js} +1 -1
  2. package/dist/client/_astro/{AdminBar.DWgISuE1.js → AdminBar.eT1ch_B6.js} +1 -1
  3. package/dist/client/_astro/{ApiKeysManager.9WL8yofB.js → ApiKeysManager.kbTE1CPk.js} +1 -1
  4. package/dist/client/_astro/{AtGlanceWidget.B5byv-Z6.js → AtGlanceWidget.w23IIv06.js} +1 -1
  5. package/dist/client/_astro/{BaseLayout.Dw2OoSEv.css → BaseLayout.Rpr86VwM.css} +1 -1
  6. package/dist/client/_astro/{CommentsManager.C5gleTZN.js → CommentsManager.BN7i1RHa.js} +1 -1
  7. package/dist/client/_astro/ContentEditor.BlsJ2bwD.js +1 -0
  8. package/dist/client/_astro/{ContentTypeWorkspace.wFn1FHsk.js → ContentTypeWorkspace.BPVuQgzA.js} +1 -1
  9. package/dist/client/_astro/{DashboardHome.CoVmaWtV.js → DashboardHome.DXzu_IXZ.js} +1 -1
  10. package/dist/client/_astro/{DashboardLayout.astro_astro_type_script_index_0_lang.BEDbOjeH.js → DashboardLayout.astro_astro_type_script_index_0_lang.DmNSzErX.js} +1 -1
  11. package/dist/client/_astro/{FieldGroupEditor.DixyIeAD.js → FieldGroupEditor.DsqphEgt.js} +1 -1
  12. package/dist/client/_astro/{FieldGroupList.KCRsCtjN.js → FieldGroupList.pW2Um9om.js} +1 -1
  13. package/dist/client/_astro/FieldRenderer.AYtSBfHZ.js +3 -0
  14. package/dist/client/_astro/{Footer.Bis7kk52.js → Footer.5Lcn2VXz.js} +1 -1
  15. package/dist/client/_astro/{GeneralSettings.DWUL4EPc.js → GeneralSettings.B-H8Rzy7.js} +1 -1
  16. package/dist/client/_astro/{LogsManager.wobqWCrD.js → LogsManager.Crd8q2te.js} +1 -1
  17. package/dist/client/_astro/{MediaLibrary.B_DxFMQi.js → MediaLibrary.Cv6Ry3u9.js} +1 -1
  18. package/dist/client/_astro/{MenuManager.CB6j6yQw.js → MenuManager.D25ika09.js} +1 -1
  19. package/dist/client/_astro/{Modal.eJIvbMT2.js → Modal.572hmVvb.js} +1 -1
  20. package/dist/client/_astro/{PluginManager.CT-7t4Wz.js → PluginManager.DLfgQFPF.js} +1 -1
  21. package/dist/client/_astro/{PostTypesManager.LW5RMORG.js → PostTypesManager.C3RbmOZT.js} +1 -1
  22. package/dist/client/_astro/{QuickDraftWidget.zabr8JfM.js → QuickDraftWidget.BtSGzhKq.js} +1 -1
  23. package/dist/client/_astro/{ReadingSettings.BiSPyKOf.js → ReadingSettings.ZFDaeo5U.js} +1 -1
  24. package/dist/client/_astro/{ResourceHubs.CmV4Mz6z.js → ResourceHubs.Cx9fbCv1.js} +1 -1
  25. package/dist/client/_astro/{TaxonomiesManager.BzFfeZEj.js → TaxonomiesManager.BLsvmjaL.js} +1 -1
  26. package/dist/client/_astro/TaxonomyTermsManager.C_xEh8Ab.js +1 -0
  27. package/dist/client/_astro/ThemeCustomizer.BrDHVXLk.js +577 -0
  28. package/dist/client/_astro/{ThemeManager.BVqp2Bk3.js → ThemeManager.BpS3m7Qc.js} +2 -2
  29. package/dist/client/_astro/{UserCreateForm.D2dkK0S5.js → UserCreateForm.BYwgAqKk.js} +1 -1
  30. package/dist/client/_astro/{UsersManager.CUU4ncDR.js → UsersManager.DODMr48D.js} +1 -1
  31. package/dist/client/_astro/{WebhooksManager.DV2TWIOt.js → WebhooksManager.DmWIW272.js} +1 -1
  32. package/dist/client/_astro/ar.BCtMLfbL.js +1 -0
  33. package/dist/client/_astro/clone.oDfZEkVn.js +1 -0
  34. package/dist/client/_astro/es-ES.BfYd3kCv.js +1 -0
  35. package/dist/client/_astro/he.pQFPO6hc.js +1 -0
  36. package/dist/client/_astro/{i18n.BFBHzd3w.js → i18n.A82w5XQu.js} +1 -1
  37. package/dist/client/_astro/it.ZpeUogpB.js +1 -0
  38. package/dist/client/_astro/ja.Ch5X4gaR.js +1 -0
  39. package/dist/client/_astro/pl.DDgkAPXr.js +1 -0
  40. package/dist/client/_astro/{pt-BR.DB_qjzov.js → pt-BR.zZcF2v3X.js} +1 -1
  41. package/dist/client/_astro/ru.CAjJz8Cj.js +1 -0
  42. package/dist/client/_astro/sw.CehAEkRN.js +1 -0
  43. package/dist/client/_astro/tr.Sf1XkPHa.js +1 -0
  44. package/dist/client/_astro/uk.-2u2eOOq.js +1 -0
  45. package/dist/client/_astro/yo.os9m69tq.js +1 -0
  46. package/dist/client/_astro/zh-CN.Bt1lpQQu.js +1 -0
  47. package/dist/server/chunks/{404_BMps-rRP.mjs → 404_BAOD9OCa.mjs} +1 -1
  48. package/dist/server/chunks/{BaseLayout_eq-iwg5V.mjs → BaseLayout_BE8O-LS4.mjs} +2 -2
  49. package/dist/server/chunks/{ContentEditor_CD80dY0I.mjs → ContentEditor_DPy3I4HM.mjs} +4 -3
  50. package/dist/server/chunks/{DashboardLayout_CrO_yWkB.mjs → DashboardLayout_D6zphdT0.mjs} +2 -2
  51. package/dist/server/chunks/{FieldRenderer_BSvrsqN8.mjs → FieldRenderer_D4dcZjgt.mjs} +3 -61
  52. package/dist/server/chunks/{MediaLibrary_BGZEgsua.mjs → MediaLibrary_DGmYSSZH.mjs} +2 -2
  53. package/dist/server/chunks/{Modal_QxIjzTdp.mjs → Modal_BmuvdwoB.mjs} +1 -1
  54. package/dist/server/chunks/{_id__BIPcYNtN.mjs → _id__XEnJ5nS2.mjs} +2 -2
  55. package/dist/server/chunks/{_slug__XNFTP0Q1.mjs → _slug__BkXrukGe.mjs} +1 -1
  56. package/dist/server/chunks/{access_D-_mBK3K.mjs → access_B5npG273.mjs} +3 -3
  57. package/dist/server/chunks/{api-keys_z4-GVRaL.mjs → api-keys_Bs6zIXYm.mjs} +3 -3
  58. package/dist/server/chunks/{ar_DObFFdrO.mjs → ar_Cgz1nkYN.mjs} +30 -3
  59. package/dist/server/chunks/clone_FT3Zf-Bf.mjs +59 -0
  60. package/dist/server/chunks/{comments_qCxr0Y8w.mjs → comments_zJrnFEjl.mjs} +2 -2
  61. package/dist/server/chunks/{custom-fields_Dp3OiD0S.mjs → custom-fields_C5EBkR02.mjs} +2 -2
  62. package/dist/server/chunks/customize_CKqMX14y.mjs +1629 -0
  63. package/dist/server/chunks/{edit_BxXS3NT6.mjs → edit_QKBYgFkJ.mjs} +2 -2
  64. package/dist/server/chunks/{es-ES_D6jd6T7H.mjs → es-ES_Bw0g3h9x.mjs} +30 -3
  65. package/dist/server/chunks/{he_DwGJwonL.mjs → he_BcJYW2q8.mjs} +30 -3
  66. package/dist/server/chunks/{i18n_jhv_lr6z.mjs → i18n_C-sgJSi1.mjs} +14 -13
  67. package/dist/server/chunks/{index_tQk65WtE.mjs → index_BM_-WBYo.mjs} +2 -2
  68. package/dist/server/chunks/{index_aa5_ET2K.mjs → index_BletZ9T6.mjs} +3 -3
  69. package/dist/server/chunks/{index_BuUzsa32.mjs → index_Btvmuytk.mjs} +2 -2
  70. package/dist/server/chunks/{index_CaR204jg.mjs → index_CDwohy44.mjs} +2 -2
  71. package/dist/server/chunks/{index_DVQd057F.mjs → index_DenKi4a3.mjs} +2 -2
  72. package/dist/server/chunks/{it_CMLpQyoj.mjs → it_CgOxhoxy.mjs} +30 -3
  73. package/dist/server/chunks/{ja_CYRz0pHv.mjs → ja_0swn1wUm.mjs} +30 -3
  74. package/dist/server/chunks/{login_JwlFuBYd.mjs → login_CtIWLqC2.mjs} +1 -1
  75. package/dist/server/chunks/{logs_td2w_HCW.mjs → logs_DlTldv5b.mjs} +2 -2
  76. package/dist/server/chunks/{menus_Brbqh27T.mjs → menus_z2d_K44p.mjs} +2 -2
  77. package/dist/server/chunks/{new_aklFjYkE.mjs → new_CYvLScge.mjs} +2 -2
  78. package/dist/server/chunks/{new_M5jNG81S.mjs → new_Cxp8Mdw4.mjs} +2 -2
  79. package/dist/server/chunks/{pl_BuXVPvU1.mjs → pl_eLBKfEwP.mjs} +30 -3
  80. package/dist/server/chunks/{plugins_KhcXhLHj.mjs → plugins_4g6EEkCb.mjs} +2 -2
  81. package/dist/server/chunks/{post-types_DD3nerIE.mjs → post-types_7cW4BLBV.mjs} +2 -2
  82. package/dist/server/chunks/{pt-BR_Barbcx-V.mjs → pt-BR_AVNE88MZ.mjs} +1 -0
  83. package/dist/server/chunks/{reading_ghF5feXj.mjs → reading_2DqfBhj_.mjs} +2 -2
  84. package/dist/server/chunks/{ru_C56ltukG.mjs → ru_Dt3fMzac.mjs} +30 -3
  85. package/dist/server/chunks/{sw_Dhw0GAgD.mjs → sw_oPyQwKSK.mjs} +30 -3
  86. package/dist/server/chunks/{taxonomies_CsUEhmvC.mjs → taxonomies_D7mMKpNX.mjs} +2 -2
  87. package/dist/server/chunks/{taxonomy_BfNm0HUh.mjs → taxonomy_64ggDTF9.mjs} +4 -3
  88. package/dist/server/chunks/{themes_DnFB-Bio.mjs → themes_Dscq-5uk.mjs} +6 -4
  89. package/dist/server/chunks/{tr_zELRy7A-.mjs → tr_DG1ipiJ0.mjs} +30 -3
  90. package/dist/server/chunks/{uk_DVOqp1x6.mjs → uk_DCWgX6k4.mjs} +30 -3
  91. package/dist/server/chunks/{upload_D5xS-Nri.mjs → upload_B-DdqpaQ.mjs} +2 -2
  92. package/dist/server/chunks/{webhooks_B_6eHrir.mjs → webhooks_D05B4_Rs.mjs} +2 -2
  93. package/dist/server/chunks/{yo_BqgZcoxs.mjs → yo_DsFzhH21.mjs} +30 -3
  94. package/dist/server/chunks/{zh-CN_Dz2D1XUc.mjs → zh-CN_OaG8XYVK.mjs} +30 -3
  95. package/dist/server/entry.mjs +28 -28
  96. package/dist/server/virtual_astro_middleware.mjs +1 -1
  97. package/package.json +2 -2
  98. package/dist/client/_astro/ContentEditor.C0RpyhzW.js +0 -1
  99. package/dist/client/_astro/FieldRenderer.BjnbGFPe.js +0 -3
  100. package/dist/client/_astro/TaxonomyTermsManager.CvCxMf0u.js +0 -1
  101. package/dist/client/_astro/ThemeCustomizer.BIct4Scf.js +0 -49
  102. package/dist/client/_astro/ar.BeEmOTlL.js +0 -1
  103. package/dist/client/_astro/es-ES.C0DI0CK6.js +0 -1
  104. package/dist/client/_astro/he.RF4swhtn.js +0 -1
  105. package/dist/client/_astro/it.DhCR9YsW.js +0 -1
  106. package/dist/client/_astro/ja.DPrxHQvU.js +0 -1
  107. package/dist/client/_astro/pl.6VCoPa7y.js +0 -1
  108. package/dist/client/_astro/ru.Cv0Z6X2y.js +0 -1
  109. package/dist/client/_astro/sw.BBMIgY-Y.js +0 -1
  110. package/dist/client/_astro/tr.BWEmWhCE.js +0 -1
  111. package/dist/client/_astro/uk.DDXJXOmn.js +0 -1
  112. package/dist/client/_astro/yo.DNoEBLJd.js +0 -1
  113. package/dist/client/_astro/zh-CN.CVKBB6Ky.js +0 -1
  114. package/dist/server/chunks/customize_zTqT6Yj2.mjs +0 -233
@@ -1 +1 @@
1
- import{S as e,a as t,f as n,h as r,l as i,p as a,r as o}from"./solid.Ck4Vtfe4.js";import{_ as s,a as c,f as l,l as u,m as d,o as f,p,s as m,u as h}from"./web.DD6VKaIp.js";import{n as g}from"./i18n.BFBHzd3w.js";import{n as _}from"./api.53l1ob4Z.js";var v=s(`<div class=wp-menu-empty-level>`),y=s(`<div class=wp-menu-tree><!$><!/><!$><!/>`),b=s(`<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=s(`<p class=muted>`),S=s(`<details class=wp-menu-box><summary></summary><div class=wp-menu-box__body><!$><!/><!$><!/>`),C=s(`<div class="notice notice--error">`),w=s(`<div class=notice>`),T=s(`<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=s(`<div class=skeleton>`),ee=s(`<div class=manager-toolbar><p class=muted></p><button class="btn btn-primary"type=button>+ <!$><!/>`),D=s(`<table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody>`),te=s(`<section class=card>`),O=s(`<p class="muted empty-state">`),k=s(`<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=s(`<input class=input>`),A=s(`<div class=wp-source-list>`),j=s(`<button type=button class="btn btn-secondary btn-sm">`),re=s(`<label><!$><!/><input class=input placeholder=https://>`),ie=s(`<label><!$><!/><input class=input>`),ae=s(`<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=s(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/<!$><!/>`),se=s(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/post/<!$><!/>`),M=s(`<div class=wp-taxonomy-source><strong></strong><!$><!/>`),N=s(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>/<!$><!/>`),ce=s(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>`),le=s(`<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(e){let[n,s]=r(null);return(()=>{var r=f(y),c=r.firstChild,[h,g]=m(c.nextSibling),_=h.nextSibling,[x,S]=m(_.nextSibling);return u(r,i(o,{get each(){return e.items},children:r=>(()=>{var o=f(b),c=o.firstChild,h=c.firstChild,g=h.nextSibling,_=g.firstChild,v=_.nextSibling,y=g.nextSibling.firstChild,x=y.nextSibling,S=x.nextSibling,C=S.nextSibling,w=c.nextSibling,T=w.firstChild,E=T.nextSibling.firstChild,ee=E.firstChild,[D,te]=m(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,ne=k.firstChild,[A,j]=m(ne.nextSibling),re=A.nextSibling,ie=k.nextSibling,ae=ie.firstChild,[oe,se]=m(ae.nextSibling),M=oe.nextSibling,N=ie.nextSibling,ce=N.firstChild,[le,P]=m(ce.nextSibling),F=le.nextSibling,I=N.nextSibling,ue=I.firstChild,[L,R]=m(ue.nextSibling),z=L.nextSibling,B=z.firstChild,V=B.nextSibling,H=I.nextSibling,pe=H.firstChild,[W,_e]=m(pe.nextSibling),G=W.nextSibling,K=H.nextSibling,q=K.firstChild,[J,ye]=m(q.nextSibling),Y=J.nextSibling,be=K.nextSibling,xe=w.nextSibling,[Se,Ce]=m(xe.nextSibling);return o.addEventListener(`drop`,t=>{t.preventDefault();let i=n()??t.dataTransfer?.getData(`text/plain`);i&&e.onChange(fe(e.items,i,r.id)),s(null)}),o.addEventListener(`dragover`,e=>e.preventDefault()),h.addEventListener(`dragend`,()=>s(null)),h.addEventListener(`dragstart`,e=>{s(r.id),e.dataTransfer?.setData(`text/plain`,r.id)}),u(_,()=>r.label||e.t(`menus.editor.untitled`)),u(v,()=>r.url||e.t(`menus.editor.noUrl`)),y.$$click=()=>e.onChange(me(e.items,r.id,-1)),x.$$click=()=>e.onChange(me(e.items,r.id,1)),S.$$click=()=>e.onChange(he(e.items,r.id)),C.$$click=()=>e.onChange(ge(e.items,r.id)),u(T,()=>e.t(`menus.editor.itemSettings`)),u(E,()=>e.t(`menus.editor.navigationLabel`),D,te),O.$$input=t=>e.onChange(U(e.items,r.id,{label:t.currentTarget.value})),u(k,()=>e.t(`menus.editor.url`),A,j),re.$$input=t=>e.onChange(U(e.items,r.id,{url:t.currentTarget.value})),u(ie,()=>e.t(`menus.editor.titleAttribute`),oe,se),M.$$input=t=>e.onChange(U(e.items,r.id,{attrTitle:t.currentTarget.value})),u(N,()=>e.t(`menus.editor.cssClasses`),le,P),F.$$input=t=>e.onChange(U(e.items,r.id,{cssClasses:t.currentTarget.value})),u(I,()=>e.t(`menus.editor.target`),L,R),z.addEventListener(`change`,t=>e.onChange(U(e.items,r.id,{target:t.currentTarget.value}))),u(B,()=>e.t(`menus.editor.sameWindow`)),u(V,()=>e.t(`menus.editor.newWindow`)),u(H,()=>e.t(`menus.editor.xfn`),W,_e),G.$$input=t=>e.onChange(U(e.items,r.id,{xfn:t.currentTarget.value})),u(K,()=>e.t(`menus.editor.description`),J,ye),Y.$$input=t=>e.onChange(U(e.items,r.id,{description:t.currentTarget.value})),be.$$click=()=>e.onChange(de(e.items,r.id)),u(be,()=>e.t(`menus.editor.remove`)),u(o,i(t,{get when(){return r.children.length>0},get children(){return i(ve,{get items(){return r.children},get depth(){return(e.depth??0)+1},get t(){return e.t},onChange:t=>e.onChange(U(e.items,r.id,{children:t}))})}}),Se,Ce),a(t=>{var n=e.t(`menus.editor.drag`),r=e.t(`menus.editor.up`),i=e.t(`menus.editor.down`),a=e.t(`menus.editor.indent`),o=e.t(`menus.editor.outdent`);return n!==t.e&&p(h,`title`,t.e=n),r!==t.t&&p(y,`title`,t.t=r),i!==t.a&&p(x,`title`,t.a=i),a!==t.o&&p(S,`title`,t.o=a),o!==t.i&&p(C,`title`,t.i=o),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a(()=>d(O,`value`,r.label)),a(()=>d(re,`value`,r.url??``)),a(()=>d(M,`value`,r.attrTitle??``)),a(()=>d(F,`value`,r.cssClasses??``)),a(()=>d(z,`value`,r.target??`_self`)),a(()=>d(G,`value`,r.xfn??``)),a(()=>d(Y,`value`,r.description??``)),l(),o})()}),h,g),u(r,i(t,{get when(){return e.items.length===0},get children(){var t=f(v);return u(t,()=>e.t(`menus.editor.emptyLevel`)),t}}),x,S),a(()=>p(r,`data-depth`,e.depth??0)),r})()}function G(e){return(()=>{var n=f(S),r=n.firstChild,o=r.nextSibling,s=o.firstChild,[c,l]=m(s.nextSibling),p=c.nextSibling,[h,g]=m(p.nextSibling);return u(r,()=>e.title),u(o,i(t,{get when(){return e.description},get children(){var t=f(x);return u(t,()=>e.description),t}}),c,l),u(o,()=>e.children,h,g),a(()=>d(n,`open`,e.open)),n})()}function K(){let{t:s}=g(),[c,v]=r([]),[y,b]=r(null),[x,S]=r([]),[I,R]=r([]),[z,B]=r({}),[V,H]=r([]),[U,de]=r([]),[fe,pe]=r({}),[W,me]=r(``),[he,ge]=r(``),[K,q]=r([]),[J,ye]=r(``),[Y,be]=r(``),[xe,Se]=r(!0),[Ce,we]=r(!1),[Te,X]=r(``),[Ee,Z]=r(``),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)}};e(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(s(`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(s(`menus.saved`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}finally{we(!1)}}},Me=async e=>{if(e.id&&confirm(s(`menus.confirmDelete`,{name:e.name})))try{await _.deleteMenu(e.id),Z(s(`menus.deleted`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}},Ne=n(()=>x().filter(e=>!W()||`${e.title} ${e.slug}`.toLowerCase().includes(W().toLowerCase()))),Pe=n(()=>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 e=f(T),n=e.firstChild,[r,g]=m(n.nextSibling),_=r.nextSibling,[v,x]=m(_.nextSibling),S=v.nextSibling,[P,I]=m(S.nextSibling);return P.nextSibling,u(e,i(t,{get when(){return Te()},get children(){var e=f(C);return u(e,Te),e}}),r,g),u(e,i(t,{get when(){return Ee()},get children(){var e=f(w);return u(e,Ee),e}}),v,x),u(e,i(t,{get when(){return!xe()},get fallback(){return(()=>{var e=f(E);return u(e,()=>s(`common.loading`)),e})()},get children(){return i(t,{get when(){return y()},get fallback(){return[(()=>{var e=f(ee),t=e.firstChild,n=t.nextSibling,r=n.firstChild.nextSibling,[i,a]=m(r.nextSibling);return u(t,()=>s(`menus.hint`)),n.$$click=()=>Oe(),u(n,()=>s(`menus.new`),i,a),l(),e})(),(()=>{var e=f(te);return u(e,i(t,{get when(){return c().length>0},get fallback(){return(()=>{var e=f(O);return u(e,()=>s(`menus.empty`)),e})()},get children(){var e=f(D),t=e.firstChild,n=t.firstChild.firstChild,r=n.nextSibling,a=r.nextSibling,d=t.nextSibling;return u(n,()=>s(`menus.name`)),u(r,()=>s(`menus.slug`)),u(a,()=>s(`menus.items`)),u(d,i(o,{get each(){return c()},children:e=>(()=>{var t=f(k),n=t.firstChild,r=n.firstChild,i=n.nextSibling,a=i.firstChild,o=i.nextSibling,c=o.nextSibling.firstChild,d=c.nextSibling.nextSibling;return u(r,()=>e.name),u(a,()=>e.slug),u(o,()=>e.items?.length??0),c.$$click=()=>Oe(e),u(c,()=>s(`common.edit`)),d.$$click=()=>void Me(e),u(d,()=>s(`common.delete`)),l(),t})()})),e}})),e})()]},children:e=>(()=>{var n=f(ae),r=n.firstChild,c=r.firstChild,g=c.firstChild,_=g.firstChild.nextSibling,[v,y]=m(_.nextSibling),x=g.nextSibling,S=x.nextSibling,C=c.nextSibling.firstChild,w=C.nextSibling,T=r.nextSibling,E=T.firstChild,ee=E.firstChild,[D,te]=m(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,P=k.firstChild,[I,ue]=m(P.nextSibling),L=I.nextSibling,R=T.nextSibling.firstChild,B=R.firstChild,H=B.nextSibling,[de,pe]=m(H.nextSibling),_e=de.nextSibling,[xe,Se]=m(_e.nextSibling),we=xe.nextSibling,[Te,X]=m(we.nextSibling),Ee=Te.nextSibling,[Z,De]=m(Ee.nextSibling),Oe=Z.nextSibling,[Me,Re]=m(Oe.nextSibling),ze=Me.nextSibling,[Be,Ve]=m(ze.nextSibling),He=Be.nextSibling,[Ue,We]=m(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]=m(Ze.nextSibling),et=Qe.nextSibling.nextSibling,[tt,nt]=m(et.nextSibling),rt=Ke.nextSibling,[it,at]=m(rt.nextSibling),ot=it.nextSibling.firstChild,st=ot.nextSibling,ct=st.firstChild,lt=ct.nextSibling.nextSibling,[ut,dt]=m(lt.nextSibling),ft=st.nextSibling;return n.addEventListener(`submit`,je),g.$$click=()=>b(null),u(g,()=>s(`menus.back`),v,y),u(x,()=>s(`menus.editor.eyebrow`)),u(S,(()=>{var t=h(()=>!!e().id);return()=>t()?s(`menus.edit`):s(`menus.create`)})()),C.$$click=()=>b(null),u(C,()=>s(`common.cancel`)),u(w,(()=>{var e=h(()=>!!Ce());return()=>e()?s(`common.loading`):s(`common.save`)})()),u(E,()=>s(`menus.name`),D,te),O.$$input=e=>Q({name:e.currentTarget.value}),u(k,()=>s(`menus.slug`),I,ue),L.$$input=e=>Q({slug:e.currentTarget.value}),u(B,()=>s(`menus.editor.addItems`)),u(R,i(G,{get title(){return s(`menus.sources.pages`)},open:!0,get children(){return[(()=>{var e=f(ne);return e.$$input=e=>me(e.currentTarget.value),a(()=>p(e,`placeholder`,s(`menus.editor.search`))),a(()=>d(e,`value`,W())),l(),e})(),(()=>{var e=f(A);return u(e,i(o,{get each(){return Ne()},children:e=>(()=>{var t=f(oe),n=t.firstChild,r=n.nextSibling,i=r.firstChild,[o,s]=m(i.nextSibling),c=o.nextSibling,l=c.firstChild.nextSibling,[p,h]=m(l.nextSibling);return n.addEventListener(`change`,t=>q(t.currentTarget.checked?[...K(),`page:${e.id}`]:K().filter(t=>t!==`page:${e.id}`))),u(r,()=>e.title,o,s),u(c,()=>e.slug,p,h),a(()=>d(n,`checked`,K().includes(`page:${e.id}`))),t})()})),e})(),(()=>{var e=f(j);return e.$$click=()=>ke(Ne().map(Fe)),u(e,()=>s(`menus.editor.addSelected`)),l(),e})()]}}),de,pe),u(R,i(G,{get title(){return s(`menus.sources.posts`)},get children(){return[(()=>{var e=f(ne);return e.$$input=e=>ge(e.currentTarget.value),a(()=>p(e,`placeholder`,s(`menus.editor.search`))),a(()=>d(e,`value`,he())),l(),e})(),(()=>{var e=f(A);return u(e,i(o,{get each(){return Pe()},children:e=>(()=>{var t=f(se),n=t.firstChild,r=n.nextSibling,i=r.firstChild,[o,s]=m(i.nextSibling),c=o.nextSibling,l=c.firstChild.nextSibling,[p,h]=m(l.nextSibling);return n.addEventListener(`change`,t=>q(t.currentTarget.checked?[...K(),`post:${e.id}`]:K().filter(t=>t!==`post:${e.id}`))),u(r,()=>e.title,o,s),u(c,()=>e.slug,p,h),a(()=>d(n,`checked`,K().includes(`post:${e.id}`))),t})()})),e})(),(()=>{var e=f(j);return e.$$click=()=>ke(Pe().map(Ie)),u(e,()=>s(`menus.editor.addSelected`)),l(),e})()]}}),xe,Se),u(R,i(G,{get title(){return s(`menus.sources.contentTypes`)},get children(){return i(o,{get each(){return V().filter(e=>e.slug!==`page`&&e.slug!==`post`&&!e.singleton)},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,[a,s]=m(r.nextSibling);return u(n,()=>e.pluralLabel),u(t,i(o,{get each(){return z()[e.slug]??[]},children:t=>(()=>{var n=f(N),r=n.firstChild,[i,a]=m(r.nextSibling),o=i.nextSibling,s=o.firstChild.nextSibling,[c,d]=m(s.nextSibling),p=c.nextSibling.nextSibling,[h,g]=m(p.nextSibling);return n.$$click=()=>$(Le(t)),u(n,()=>t.title,i,a),u(o,()=>e.slug,c,d),u(o,()=>t.slug,h,g),l(),n})()}),a,s),t})()})}}),Te,X),u(R,i(G,{get title(){return s(`menus.sources.custom`)},get description(){return s(`menus.sources.customHint`)},get children(){return[(()=>{var e=f(re),t=e.firstChild,[n,r]=m(t.nextSibling),i=n.nextSibling;return u(e,()=>s(`menus.editor.url`),n,r),i.$$input=e=>ye(e.currentTarget.value),a(()=>d(i,`value`,J())),l(),e})(),(()=>{var e=f(ie),t=e.firstChild,[n,r]=m(t.nextSibling),i=n.nextSibling;return u(e,()=>s(`menus.editor.navigationLabel`),n,r),i.$$input=e=>be(e.currentTarget.value),a(()=>d(i,`value`,Y())),l(),e})(),(()=>{var e=f(j);return e.$$click=Ae,u(e,()=>s(`menus.editor.addToMenu`)),l(),e})()]}}),Z,De),u(R,i(G,{get title(){return s(`menus.sources.home`)},get children(){var e=f(j);return e.$$click=()=>$({id:`home`,type:`home`,label:s(`menus.sources.home`),url:`/`}),u(e,()=>s(`menus.editor.addToMenu`)),l(),e}}),Me,Re),u(R,i(G,{get title(){return s(`menus.sources.archives`)},get children(){var e=f(A);return u(e,i(o,{get each(){return V().filter(e=>e.hasArchive)},children:e=>(()=>{var t=f(ce),n=t.firstChild,[r,i]=m(n.nextSibling),a=r.nextSibling,o=a.firstChild.nextSibling,[s,c]=m(o.nextSibling);return t.$$click=()=>$({id:`archive:${e.slug}`,type:`archive`,label:e.pluralLabel,url:`/${e.slug}`,objectType:e.slug}),u(t,()=>e.pluralLabel,r,i),u(a,()=>e.slug,s,c),l(),t})()})),e}}),Be,Ve),u(R,i(G,{get title(){return s(`menus.sources.taxonomies`)},get children(){return i(o,{get each(){return U()},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,[a,s]=m(r.nextSibling);return u(n,()=>e.name),u(t,i(o,{get each(){return fe()[e.slug]??[]},children:t=>(()=>{var n=f(N),r=n.firstChild,[i,a]=m(r.nextSibling),o=i.nextSibling,s=o.firstChild.nextSibling,[c,d]=m(s.nextSibling),p=c.nextSibling.nextSibling,[h,g]=m(p.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}),u(n,()=>t.name,i,a),u(o,()=>e.slug,c,d),u(o,()=>t.slug,h,g),l(),n})()}),a,s),t})()})}}),Ue,We),u(Je,()=>s(`menus.editor.structure`)),u(Ye,()=>s(`menus.editor.structureHint`)),u(Xe,()=>e().items.length,Qe,$e),u(Xe,()=>s(`menus.items`),tt,nt),u(Ge,i(t,{get when(){return e().items.length>0},get fallback(){return(()=>{var e=f(le);return u(e,()=>s(`menus.editor.empty`)),e})()},get children(){return i(ve,{get items(){return e().items},t:s,onChange:e=>Q({items:e})})}}),it,at),u(ot,()=>s(`menus.editor.settings`)),ct.addEventListener(`change`,t=>Q({settings:{...e().settings,autoAddNewPages:t.currentTarget.checked}})),u(st,()=>s(`menus.editor.autoAddPages`),ut,dt),u(ft,()=>s(`menus.editor.autoAddPagesHint`)),a(t=>{var n=Ce(),r=F(e().name);return n!==t.e&&d(w,`disabled`,t.e=n),r!==t.t&&p(L,`placeholder`,t.t=r),t},{e:void 0,t:void 0}),a(()=>d(O,`value`,e().name)),a(()=>d(L,`value`,e().slug)),a(()=>d(ct,`checked`,e().settings.autoAddNewPages===!0)),l(),n})()})}}),P,I),e})()}c([`click`,`input`]);export{K as MenuManager};
1
+ import{S as e,a as t,f as n,h as r,l as i,p as a,r as o}from"./solid.Ck4Vtfe4.js";import{_ as s,a as c,f as l,l as u,m as d,o as f,p,s as m,u as h}from"./web.DD6VKaIp.js";import{n as g}from"./i18n.A82w5XQu.js";import{n as _}from"./api.53l1ob4Z.js";var v=s(`<div class=wp-menu-empty-level>`),y=s(`<div class=wp-menu-tree><!$><!/><!$><!/>`),b=s(`<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=s(`<p class=muted>`),S=s(`<details class=wp-menu-box><summary></summary><div class=wp-menu-box__body><!$><!/><!$><!/>`),C=s(`<div class="notice notice--error">`),w=s(`<div class=notice>`),T=s(`<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=s(`<div class=skeleton>`),ee=s(`<div class=manager-toolbar><p class=muted></p><button class="btn btn-primary"type=button>+ <!$><!/>`),D=s(`<table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody>`),te=s(`<section class=card>`),O=s(`<p class="muted empty-state">`),k=s(`<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=s(`<input class=input>`),A=s(`<div class=wp-source-list>`),j=s(`<button type=button class="btn btn-secondary btn-sm">`),re=s(`<label><!$><!/><input class=input placeholder=https://>`),ie=s(`<label><!$><!/><input class=input>`),ae=s(`<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=s(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/<!$><!/>`),se=s(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/post/<!$><!/>`),M=s(`<div class=wp-taxonomy-source><strong></strong><!$><!/>`),N=s(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>/<!$><!/>`),ce=s(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>`),le=s(`<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(e){let[n,s]=r(null);return(()=>{var r=f(y),c=r.firstChild,[h,g]=m(c.nextSibling),_=h.nextSibling,[x,S]=m(_.nextSibling);return u(r,i(o,{get each(){return e.items},children:r=>(()=>{var o=f(b),c=o.firstChild,h=c.firstChild,g=h.nextSibling,_=g.firstChild,v=_.nextSibling,y=g.nextSibling.firstChild,x=y.nextSibling,S=x.nextSibling,C=S.nextSibling,w=c.nextSibling,T=w.firstChild,E=T.nextSibling.firstChild,ee=E.firstChild,[D,te]=m(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,ne=k.firstChild,[A,j]=m(ne.nextSibling),re=A.nextSibling,ie=k.nextSibling,ae=ie.firstChild,[oe,se]=m(ae.nextSibling),M=oe.nextSibling,N=ie.nextSibling,ce=N.firstChild,[le,P]=m(ce.nextSibling),F=le.nextSibling,I=N.nextSibling,ue=I.firstChild,[L,R]=m(ue.nextSibling),z=L.nextSibling,B=z.firstChild,V=B.nextSibling,H=I.nextSibling,pe=H.firstChild,[W,_e]=m(pe.nextSibling),G=W.nextSibling,K=H.nextSibling,q=K.firstChild,[J,ye]=m(q.nextSibling),Y=J.nextSibling,be=K.nextSibling,xe=w.nextSibling,[Se,Ce]=m(xe.nextSibling);return o.addEventListener(`drop`,t=>{t.preventDefault();let i=n()??t.dataTransfer?.getData(`text/plain`);i&&e.onChange(fe(e.items,i,r.id)),s(null)}),o.addEventListener(`dragover`,e=>e.preventDefault()),h.addEventListener(`dragend`,()=>s(null)),h.addEventListener(`dragstart`,e=>{s(r.id),e.dataTransfer?.setData(`text/plain`,r.id)}),u(_,()=>r.label||e.t(`menus.editor.untitled`)),u(v,()=>r.url||e.t(`menus.editor.noUrl`)),y.$$click=()=>e.onChange(me(e.items,r.id,-1)),x.$$click=()=>e.onChange(me(e.items,r.id,1)),S.$$click=()=>e.onChange(he(e.items,r.id)),C.$$click=()=>e.onChange(ge(e.items,r.id)),u(T,()=>e.t(`menus.editor.itemSettings`)),u(E,()=>e.t(`menus.editor.navigationLabel`),D,te),O.$$input=t=>e.onChange(U(e.items,r.id,{label:t.currentTarget.value})),u(k,()=>e.t(`menus.editor.url`),A,j),re.$$input=t=>e.onChange(U(e.items,r.id,{url:t.currentTarget.value})),u(ie,()=>e.t(`menus.editor.titleAttribute`),oe,se),M.$$input=t=>e.onChange(U(e.items,r.id,{attrTitle:t.currentTarget.value})),u(N,()=>e.t(`menus.editor.cssClasses`),le,P),F.$$input=t=>e.onChange(U(e.items,r.id,{cssClasses:t.currentTarget.value})),u(I,()=>e.t(`menus.editor.target`),L,R),z.addEventListener(`change`,t=>e.onChange(U(e.items,r.id,{target:t.currentTarget.value}))),u(B,()=>e.t(`menus.editor.sameWindow`)),u(V,()=>e.t(`menus.editor.newWindow`)),u(H,()=>e.t(`menus.editor.xfn`),W,_e),G.$$input=t=>e.onChange(U(e.items,r.id,{xfn:t.currentTarget.value})),u(K,()=>e.t(`menus.editor.description`),J,ye),Y.$$input=t=>e.onChange(U(e.items,r.id,{description:t.currentTarget.value})),be.$$click=()=>e.onChange(de(e.items,r.id)),u(be,()=>e.t(`menus.editor.remove`)),u(o,i(t,{get when(){return r.children.length>0},get children(){return i(ve,{get items(){return r.children},get depth(){return(e.depth??0)+1},get t(){return e.t},onChange:t=>e.onChange(U(e.items,r.id,{children:t}))})}}),Se,Ce),a(t=>{var n=e.t(`menus.editor.drag`),r=e.t(`menus.editor.up`),i=e.t(`menus.editor.down`),a=e.t(`menus.editor.indent`),o=e.t(`menus.editor.outdent`);return n!==t.e&&p(h,`title`,t.e=n),r!==t.t&&p(y,`title`,t.t=r),i!==t.a&&p(x,`title`,t.a=i),a!==t.o&&p(S,`title`,t.o=a),o!==t.i&&p(C,`title`,t.i=o),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a(()=>d(O,`value`,r.label)),a(()=>d(re,`value`,r.url??``)),a(()=>d(M,`value`,r.attrTitle??``)),a(()=>d(F,`value`,r.cssClasses??``)),a(()=>d(z,`value`,r.target??`_self`)),a(()=>d(G,`value`,r.xfn??``)),a(()=>d(Y,`value`,r.description??``)),l(),o})()}),h,g),u(r,i(t,{get when(){return e.items.length===0},get children(){var t=f(v);return u(t,()=>e.t(`menus.editor.emptyLevel`)),t}}),x,S),a(()=>p(r,`data-depth`,e.depth??0)),r})()}function G(e){return(()=>{var n=f(S),r=n.firstChild,o=r.nextSibling,s=o.firstChild,[c,l]=m(s.nextSibling),p=c.nextSibling,[h,g]=m(p.nextSibling);return u(r,()=>e.title),u(o,i(t,{get when(){return e.description},get children(){var t=f(x);return u(t,()=>e.description),t}}),c,l),u(o,()=>e.children,h,g),a(()=>d(n,`open`,e.open)),n})()}function K(){let{t:s}=g(),[c,v]=r([]),[y,b]=r(null),[x,S]=r([]),[I,R]=r([]),[z,B]=r({}),[V,H]=r([]),[U,de]=r([]),[fe,pe]=r({}),[W,me]=r(``),[he,ge]=r(``),[K,q]=r([]),[J,ye]=r(``),[Y,be]=r(``),[xe,Se]=r(!0),[Ce,we]=r(!1),[Te,X]=r(``),[Ee,Z]=r(``),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)}};e(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(s(`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(s(`menus.saved`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}finally{we(!1)}}},Me=async e=>{if(e.id&&confirm(s(`menus.confirmDelete`,{name:e.name})))try{await _.deleteMenu(e.id),Z(s(`menus.deleted`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}},Ne=n(()=>x().filter(e=>!W()||`${e.title} ${e.slug}`.toLowerCase().includes(W().toLowerCase()))),Pe=n(()=>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 e=f(T),n=e.firstChild,[r,g]=m(n.nextSibling),_=r.nextSibling,[v,x]=m(_.nextSibling),S=v.nextSibling,[P,I]=m(S.nextSibling);return P.nextSibling,u(e,i(t,{get when(){return Te()},get children(){var e=f(C);return u(e,Te),e}}),r,g),u(e,i(t,{get when(){return Ee()},get children(){var e=f(w);return u(e,Ee),e}}),v,x),u(e,i(t,{get when(){return!xe()},get fallback(){return(()=>{var e=f(E);return u(e,()=>s(`common.loading`)),e})()},get children(){return i(t,{get when(){return y()},get fallback(){return[(()=>{var e=f(ee),t=e.firstChild,n=t.nextSibling,r=n.firstChild.nextSibling,[i,a]=m(r.nextSibling);return u(t,()=>s(`menus.hint`)),n.$$click=()=>Oe(),u(n,()=>s(`menus.new`),i,a),l(),e})(),(()=>{var e=f(te);return u(e,i(t,{get when(){return c().length>0},get fallback(){return(()=>{var e=f(O);return u(e,()=>s(`menus.empty`)),e})()},get children(){var e=f(D),t=e.firstChild,n=t.firstChild.firstChild,r=n.nextSibling,a=r.nextSibling,d=t.nextSibling;return u(n,()=>s(`menus.name`)),u(r,()=>s(`menus.slug`)),u(a,()=>s(`menus.items`)),u(d,i(o,{get each(){return c()},children:e=>(()=>{var t=f(k),n=t.firstChild,r=n.firstChild,i=n.nextSibling,a=i.firstChild,o=i.nextSibling,c=o.nextSibling.firstChild,d=c.nextSibling.nextSibling;return u(r,()=>e.name),u(a,()=>e.slug),u(o,()=>e.items?.length??0),c.$$click=()=>Oe(e),u(c,()=>s(`common.edit`)),d.$$click=()=>void Me(e),u(d,()=>s(`common.delete`)),l(),t})()})),e}})),e})()]},children:e=>(()=>{var n=f(ae),r=n.firstChild,c=r.firstChild,g=c.firstChild,_=g.firstChild.nextSibling,[v,y]=m(_.nextSibling),x=g.nextSibling,S=x.nextSibling,C=c.nextSibling.firstChild,w=C.nextSibling,T=r.nextSibling,E=T.firstChild,ee=E.firstChild,[D,te]=m(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,P=k.firstChild,[I,ue]=m(P.nextSibling),L=I.nextSibling,R=T.nextSibling.firstChild,B=R.firstChild,H=B.nextSibling,[de,pe]=m(H.nextSibling),_e=de.nextSibling,[xe,Se]=m(_e.nextSibling),we=xe.nextSibling,[Te,X]=m(we.nextSibling),Ee=Te.nextSibling,[Z,De]=m(Ee.nextSibling),Oe=Z.nextSibling,[Me,Re]=m(Oe.nextSibling),ze=Me.nextSibling,[Be,Ve]=m(ze.nextSibling),He=Be.nextSibling,[Ue,We]=m(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]=m(Ze.nextSibling),et=Qe.nextSibling.nextSibling,[tt,nt]=m(et.nextSibling),rt=Ke.nextSibling,[it,at]=m(rt.nextSibling),ot=it.nextSibling.firstChild,st=ot.nextSibling,ct=st.firstChild,lt=ct.nextSibling.nextSibling,[ut,dt]=m(lt.nextSibling),ft=st.nextSibling;return n.addEventListener(`submit`,je),g.$$click=()=>b(null),u(g,()=>s(`menus.back`),v,y),u(x,()=>s(`menus.editor.eyebrow`)),u(S,(()=>{var t=h(()=>!!e().id);return()=>t()?s(`menus.edit`):s(`menus.create`)})()),C.$$click=()=>b(null),u(C,()=>s(`common.cancel`)),u(w,(()=>{var e=h(()=>!!Ce());return()=>e()?s(`common.loading`):s(`common.save`)})()),u(E,()=>s(`menus.name`),D,te),O.$$input=e=>Q({name:e.currentTarget.value}),u(k,()=>s(`menus.slug`),I,ue),L.$$input=e=>Q({slug:e.currentTarget.value}),u(B,()=>s(`menus.editor.addItems`)),u(R,i(G,{get title(){return s(`menus.sources.pages`)},open:!0,get children(){return[(()=>{var e=f(ne);return e.$$input=e=>me(e.currentTarget.value),a(()=>p(e,`placeholder`,s(`menus.editor.search`))),a(()=>d(e,`value`,W())),l(),e})(),(()=>{var e=f(A);return u(e,i(o,{get each(){return Ne()},children:e=>(()=>{var t=f(oe),n=t.firstChild,r=n.nextSibling,i=r.firstChild,[o,s]=m(i.nextSibling),c=o.nextSibling,l=c.firstChild.nextSibling,[p,h]=m(l.nextSibling);return n.addEventListener(`change`,t=>q(t.currentTarget.checked?[...K(),`page:${e.id}`]:K().filter(t=>t!==`page:${e.id}`))),u(r,()=>e.title,o,s),u(c,()=>e.slug,p,h),a(()=>d(n,`checked`,K().includes(`page:${e.id}`))),t})()})),e})(),(()=>{var e=f(j);return e.$$click=()=>ke(Ne().map(Fe)),u(e,()=>s(`menus.editor.addSelected`)),l(),e})()]}}),de,pe),u(R,i(G,{get title(){return s(`menus.sources.posts`)},get children(){return[(()=>{var e=f(ne);return e.$$input=e=>ge(e.currentTarget.value),a(()=>p(e,`placeholder`,s(`menus.editor.search`))),a(()=>d(e,`value`,he())),l(),e})(),(()=>{var e=f(A);return u(e,i(o,{get each(){return Pe()},children:e=>(()=>{var t=f(se),n=t.firstChild,r=n.nextSibling,i=r.firstChild,[o,s]=m(i.nextSibling),c=o.nextSibling,l=c.firstChild.nextSibling,[p,h]=m(l.nextSibling);return n.addEventListener(`change`,t=>q(t.currentTarget.checked?[...K(),`post:${e.id}`]:K().filter(t=>t!==`post:${e.id}`))),u(r,()=>e.title,o,s),u(c,()=>e.slug,p,h),a(()=>d(n,`checked`,K().includes(`post:${e.id}`))),t})()})),e})(),(()=>{var e=f(j);return e.$$click=()=>ke(Pe().map(Ie)),u(e,()=>s(`menus.editor.addSelected`)),l(),e})()]}}),xe,Se),u(R,i(G,{get title(){return s(`menus.sources.contentTypes`)},get children(){return i(o,{get each(){return V().filter(e=>e.slug!==`page`&&e.slug!==`post`&&!e.singleton)},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,[a,s]=m(r.nextSibling);return u(n,()=>e.pluralLabel),u(t,i(o,{get each(){return z()[e.slug]??[]},children:t=>(()=>{var n=f(N),r=n.firstChild,[i,a]=m(r.nextSibling),o=i.nextSibling,s=o.firstChild.nextSibling,[c,d]=m(s.nextSibling),p=c.nextSibling.nextSibling,[h,g]=m(p.nextSibling);return n.$$click=()=>$(Le(t)),u(n,()=>t.title,i,a),u(o,()=>e.slug,c,d),u(o,()=>t.slug,h,g),l(),n})()}),a,s),t})()})}}),Te,X),u(R,i(G,{get title(){return s(`menus.sources.custom`)},get description(){return s(`menus.sources.customHint`)},get children(){return[(()=>{var e=f(re),t=e.firstChild,[n,r]=m(t.nextSibling),i=n.nextSibling;return u(e,()=>s(`menus.editor.url`),n,r),i.$$input=e=>ye(e.currentTarget.value),a(()=>d(i,`value`,J())),l(),e})(),(()=>{var e=f(ie),t=e.firstChild,[n,r]=m(t.nextSibling),i=n.nextSibling;return u(e,()=>s(`menus.editor.navigationLabel`),n,r),i.$$input=e=>be(e.currentTarget.value),a(()=>d(i,`value`,Y())),l(),e})(),(()=>{var e=f(j);return e.$$click=Ae,u(e,()=>s(`menus.editor.addToMenu`)),l(),e})()]}}),Z,De),u(R,i(G,{get title(){return s(`menus.sources.home`)},get children(){var e=f(j);return e.$$click=()=>$({id:`home`,type:`home`,label:s(`menus.sources.home`),url:`/`}),u(e,()=>s(`menus.editor.addToMenu`)),l(),e}}),Me,Re),u(R,i(G,{get title(){return s(`menus.sources.archives`)},get children(){var e=f(A);return u(e,i(o,{get each(){return V().filter(e=>e.hasArchive)},children:e=>(()=>{var t=f(ce),n=t.firstChild,[r,i]=m(n.nextSibling),a=r.nextSibling,o=a.firstChild.nextSibling,[s,c]=m(o.nextSibling);return t.$$click=()=>$({id:`archive:${e.slug}`,type:`archive`,label:e.pluralLabel,url:`/${e.slug}`,objectType:e.slug}),u(t,()=>e.pluralLabel,r,i),u(a,()=>e.slug,s,c),l(),t})()})),e}}),Be,Ve),u(R,i(G,{get title(){return s(`menus.sources.taxonomies`)},get children(){return i(o,{get each(){return U()},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,[a,s]=m(r.nextSibling);return u(n,()=>e.name),u(t,i(o,{get each(){return fe()[e.slug]??[]},children:t=>(()=>{var n=f(N),r=n.firstChild,[i,a]=m(r.nextSibling),o=i.nextSibling,s=o.firstChild.nextSibling,[c,d]=m(s.nextSibling),p=c.nextSibling.nextSibling,[h,g]=m(p.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}),u(n,()=>t.name,i,a),u(o,()=>e.slug,c,d),u(o,()=>t.slug,h,g),l(),n})()}),a,s),t})()})}}),Ue,We),u(Je,()=>s(`menus.editor.structure`)),u(Ye,()=>s(`menus.editor.structureHint`)),u(Xe,()=>e().items.length,Qe,$e),u(Xe,()=>s(`menus.items`),tt,nt),u(Ge,i(t,{get when(){return e().items.length>0},get fallback(){return(()=>{var e=f(le);return u(e,()=>s(`menus.editor.empty`)),e})()},get children(){return i(ve,{get items(){return e().items},t:s,onChange:e=>Q({items:e})})}}),it,at),u(ot,()=>s(`menus.editor.settings`)),ct.addEventListener(`change`,t=>Q({settings:{...e().settings,autoAddNewPages:t.currentTarget.checked}})),u(st,()=>s(`menus.editor.autoAddPages`),ut,dt),u(ft,()=>s(`menus.editor.autoAddPagesHint`)),a(t=>{var n=Ce(),r=F(e().name);return n!==t.e&&d(w,`disabled`,t.e=n),r!==t.t&&p(L,`placeholder`,t.t=r),t},{e:void 0,t:void 0}),a(()=>d(O,`value`,e().name)),a(()=>d(L,`value`,e().slug)),a(()=>d(ct,`checked`,e().settings.autoAddNewPages===!0)),l(),n})()})}}),P,I),e})()}c([`click`,`input`]);export{K as MenuManager};
@@ -1 +1 @@
1
- import{a as e,d as t,l as n,p as r,x as i}from"./solid.Ck4Vtfe4.js";import{_ as a,a as o,f as s,l as c,o as l,p as u,s as d}from"./web.DD6VKaIp.js";import{n as f}from"./i18n.BFBHzd3w.js";var p=a(`<div class=modal-overlay role=presentation><section class=modal role=dialog aria-modal=true><header class=modal-header><h3></h3><button type=button class=modal-close>×</button></header><!$><!/>`);function m(a){let{t:o}=f();return t(()=>{if(!a.open)return;let e=e=>{e.key===`Escape`&&a.onClose()};document.addEventListener(`keydown`,e),i(()=>document.removeEventListener(`keydown`,e))}),n(e,{get when(){return a.open},get children(){var e=l(p),t=e.firstChild,n=t.firstChild,i=n.firstChild,f=i.nextSibling,m=n.nextSibling,[h,g]=d(m.nextSibling);return e.$$mousedown=e=>{e.target===e.currentTarget&&a.onClose()},c(i,()=>a.title),f.$$click=()=>a.onClose(),c(t,()=>a.children,h,g),r(e=>{var n=a.title,r=o(`common.close`);return n!==e.e&&u(t,`aria-label`,e.e=n),r!==e.t&&u(f,`aria-label`,e.t=r),e},{e:void 0,t:void 0}),s(),e}})}o([`mousedown`,`click`]);export{m as t};
1
+ import{a as e,d as t,l as n,p as r,x as i}from"./solid.Ck4Vtfe4.js";import{_ as a,a as o,f as s,l as c,o as l,p as u,s as d}from"./web.DD6VKaIp.js";import{n as f}from"./i18n.A82w5XQu.js";var p=a(`<div class=modal-overlay role=presentation><section class=modal role=dialog aria-modal=true><header class=modal-header><h3></h3><button type=button class=modal-close>×</button></header><!$><!/>`);function m(a){let{t:o}=f();return t(()=>{if(!a.open)return;let e=e=>{e.key===`Escape`&&a.onClose()};document.addEventListener(`keydown`,e),i(()=>document.removeEventListener(`keydown`,e))}),n(e,{get when(){return a.open},get children(){var e=l(p),t=e.firstChild,n=t.firstChild,i=n.firstChild,f=i.nextSibling,m=n.nextSibling,[h,g]=d(m.nextSibling);return e.$$mousedown=e=>{e.target===e.currentTarget&&a.onClose()},c(i,()=>a.title),f.$$click=()=>a.onClose(),c(t,()=>a.children,h,g),r(e=>{var n=a.title,r=o(`common.close`);return n!==e.e&&u(t,`aria-label`,e.e=n),r!==e.t&&u(f,`aria-label`,e.t=r),e},{e:void 0,t:void 0}),s(),e}})}o([`mousedown`,`click`]);export{m as t};
@@ -1,4 +1,4 @@
1
- import{S as e,h as t,l as n,p as r,r as i}from"./solid.Ck4Vtfe4.js";import{_ as a,i as o,l as s,o as c,s as l,u}from"./web.DD6VKaIp.js";import{n as d}from"./i18n.BFBHzd3w.js";import{n as f}from"./api.53l1ob4Z.js";var p=a(`<div class=plugin-manager><p class=page-hint></p><!$><!/><!$><!/><!$><!/><style>
1
+ import{S as e,h as t,l as n,p as r,r as i}from"./solid.Ck4Vtfe4.js";import{_ as a,i as o,l as s,o as c,s as l,u}from"./web.DD6VKaIp.js";import{n as d}from"./i18n.A82w5XQu.js";import{n as f}from"./api.53l1ob4Z.js";var p=a(`<div class=plugin-manager><p class=page-hint></p><!$><!/><!$><!/><!$><!/><style>
2
2
  .page-hint {
3
3
  margin: 0 0 1.25rem;
4
4
  color: var(--color-muted);
@@ -1 +1 @@
1
- import{S as e,a as t,d as n,f as r,h as i,l as a,p as o,r as s,x as c}from"./solid.Ck4Vtfe4.js";import{_ as l,a as u,f as d,h as f,l as p,m,o as h,p as g,s as _,u as v,v as y}from"./web.DD6VKaIp.js";import{n as b}from"./i18n.BFBHzd3w.js";import{n as x}from"./api.53l1ob4Z.js";import{t as S}from"./FloatingPanel.BetdW5N2.js";import{t as C}from"./iconsAndAliases.ujTnkhnl.js";var w=l(`<input type=search class="input icon-picker__search">`),T=l(`<div class=icon-picker__viewport><div class=icon-picker__grid role=listbox>`),E=l(`<p class=icon-picker__count>`),D=l(`<div class=icon-picker><button type=button class="input icon-picker__trigger"aria-haspopup=dialog><span class=icon-picker__value><span class=icon-picker__preview aria-hidden=true></span><span class=icon-picker__name></span></span><span class=icon-picker__caret aria-hidden=true></span></button><!$><!/>`),O=l(`<p class=icon-picker__empty>`),k=l(`<button type=button role=option class=icon-picker__cell style=height:56px>`),A=56,j=60,M=300,ee=2,N=Math.ceil(M/j)+4,P=e=>e.replace(/(^|[-_])(\w)/g,(e,t,n)=>n.toUpperCase()),F=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Z])([A-Z][a-z])/g,`$1-$2`).toLowerCase(),I=`xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"`,L=e=>Object.entries(e).map(([e,t])=>`${e}="${String(t).replace(/"/g,`&quot;`)}"`).join(` `),R=null,z=()=>(R||=[...new Set(Object.keys(C).map(F))].sort(),R),B=new Map;function te(e){let t=B.get(e);if(t!==void 0)return t;let n=C[P(e)],r=``;return Array.isArray(n)&&(r=`<svg ${I}>${n.map(([e,t])=>`<${e} ${L(t)} />`).join(``)}</svg>`),B.set(e,r),r}var V=e=>e.toLowerCase().replace(/[-_\s]+/g,` `).trim();function H(l){let[u,b]=i(!1),[x,C]=i(``),[P,F]=i(-1),[I,L]=i(0),[R,B]=i(6),[H,ne]=i(void 0),[re,ie]=i(void 0),U,W,ae,G,K=r(()=>{let e=V(x()).split(` `).filter(Boolean),t=z();return e.length===0?t:t.filter(t=>{let n=V(t);return e.every(e=>n.includes(e))})}),q=r(()=>{let e=Math.max(1,R());return K().map((t,n)=>({name:t,index:n,row:Math.floor(n/e),col:n%e}))}),oe=r(()=>Math.max(0,Math.floor(I()/j)-ee)*R()),J=r(()=>{let e=oe();return q().slice(e,e+N*R())}),Y=r(()=>Math.ceil(q().length/Math.max(1,R()))),X=e=>{let t=e?.clientWidth??0;if(t<=0)return;let n=Math.max(3,Math.floor(t/A));B(e=>e===n?e:n)},Z=(e,t=`nearest`)=>{let n=W;if(!n||e<0)return;let r=Math.max(1,R()),i=Math.floor(e/r)*j,a=i+j,o=n.scrollTop;t===`center`?o=i-M/2+j/2:i<n.scrollTop?o=i:a>n.scrollTop+M&&(o=a-M);let s=Math.max(0,Y()*j-M);o=Math.min(Math.max(0,o),s),n.scrollTop=o,L(o)},se=e=>{l.onChange(e),b(!1),C(``)},Q=e=>{let t=K();if(t.length===0)return;let n=P(),r=n<0?e>0?-1:t.length:n,i=Math.min(Math.max(0,r+e),t.length-1);F(i),Z(i)},$=e=>{let t=Math.max(1,R());switch(e.key){case`ArrowDown`:e.preventDefault(),Q(t);break;case`ArrowUp`:e.preventDefault(),Q(-t);break;case`ArrowRight`:e.preventDefault(),Q(1);break;case`ArrowLeft`:e.preventDefault(),Q(-1);break;case`Home`:e.preventDefault(),F(0),Z(0);break;case`End`:e.preventDefault(),F(K().length-1),Z(K().length-1);break;case`Enter`:{e.preventDefault();let t=K()[P()];t&&se(t);break}}};return e(()=>{typeof ResizeObserver<`u`&&(G=new ResizeObserver(e=>{X(e[0]?.target)})),X(H()),c(()=>G?.disconnect())}),n(()=>{let e=H();e&&(X(e),G?.observe(e))}),n(()=>{u()&&(F(-1),queueMicrotask(()=>{let e=K().indexOf(l.value);e>=0&&Z(e,`center`),ae?.focus()}))}),n(()=>{x(),F(-1),W&&(W.scrollTop=0),L(0)}),(()=>{var e=h(D),n=e.firstChild,r=n.firstChild,i=r.firstChild,c=i.nextSibling,A=r.nextSibling,M=n.nextSibling,[ee,N]=_(M.nextSibling),F=U;return typeof F==`function`?y(F,e):U=e,n.$$click=()=>b(!u()),y(ie,n),p(c,()=>l.value||`box`),p(A,()=>u()?`▴`:`▾`),p(e,a(S,{get open(){return u()},get trigger(){return re()},onClose:()=>b(!1),class:`icon-picker__panel`,role:`dialog`,get"aria-label"(){return l.label},minWidth:360,onKeyDown:$,get children(){return[(()=>{var e=h(w);return y(e=>ae=e,e),e.$$input=e=>C(e.currentTarget.value),o(()=>g(e,`placeholder`,l.searchPlaceholder)),o(()=>m(e,`value`,x())),d(),e})(),a(t,{get when(){return K().length>0},get fallback(){return(()=>{var e=h(O);return p(e,()=>l.emptyLabel??`—`),e})()},get children(){var e=h(T),t=e.firstChild;return e.addEventListener(`scroll`,e=>L(e.currentTarget.scrollTop)),y(e=>W=e,e),y(ne,t),p(t,a(s,{get each(){return J()},children:e=>(()=>{var t=h(k);return t.$$click=()=>se(e.name),o(n=>{var r=e.name,i=e.name,a=l.value===e.name,o=l.value===e.name,s=P()===e.index,c=`${e.row*j}px`,u=`${e.col*(100/Math.max(1,R()))}%`,d=`${100/Math.max(1,R())}%`,p=te(e.name);return r!==n.e&&g(t,`title`,n.e=r),i!==n.t&&g(t,`aria-label`,n.t=i),a!==n.a&&g(t,`aria-selected`,n.a=a),o!==n.o&&t.classList.toggle(`is-selected`,n.o=o),s!==n.i&&t.classList.toggle(`is-active`,n.i=s),c!==n.n&&f(t,`top`,n.n=c),u!==n.s&&f(t,`left`,n.s=u),d!==n.h&&f(t,`width`,n.h=d),p!==n.r&&m(t,`innerHTML`,n.r=p),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),d(),t})()})),o(e=>{var n=l.label,r=`${Y()*j}px`;return n!==e.e&&g(t,`aria-label`,e.e=n),r!==e.t&&f(t,`height`,e.t=r),e},{e:void 0,t:void 0}),e}}),a(t,{get when(){return v(()=>!!l.countLabel)()&&K().length>0},get children(){var e=h(E);return p(e,()=>l.countLabel?.(K().length)),e}})]}}),ee,N),o(e=>{var t=u(),r=te(l.value||`box`);return t!==e.e&&g(n,`aria-expanded`,e.e=t),r!==e.t&&m(i,`innerHTML`,e.t=r),e},{e:void 0,t:void 0}),d(),e})()}u([`click`,`input`]);var ne=l(`<div class="notice notice--error">`),re=l(`<button type=button class="btn btn-secondary">`),ie=l(`<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 class=post-types-manager__icon-field><!$><!/><!$><!/><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><div class="card settings-table-card"><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>`),U=l(`<label><input type=checkbox> <!$><!/>`),W=l(`<button type=button class="btn btn-danger">`),ae=l(`<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><span class=post-types-manager__icon><span class=post-types-manager__icon-preview aria-hidden=true></span><!$><!/></span></td><td><button type=button class="btn btn-secondary"></button> <!$><!/>`);function G(){let{t:n}=b(),[c,l]=i([]),[u,f]=i(``),[y,S]=i(!1),[C,w]=i(null),T=r(()=>[{value:`title`,label:n(`settings.postTypes.form.supportsOptions.title`)},{value:`editor`,label:n(`settings.postTypes.form.supportsOptions.editor`)},{value:`thumbnail`,label:n(`settings.postTypes.form.supportsOptions.thumbnail`)},{value:`excerpt`,label:n(`settings.postTypes.form.supportsOptions.excerpt`)},{value:`revisions`,label:n(`settings.postTypes.form.supportsOptions.revisions`)}]),[E,D]=i({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]}),O=()=>{w(null),D({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]})},k=async()=>{try{l(await x.getContentTypes())}catch(e){f(e instanceof Error?e.message:String(e))}};e(k);let A=async e=>{e.preventDefault(),f(``),S(!0);try{let e={name:E().name||E().slug,slug:E().slug,singularLabel:E().singularLabel,pluralLabel:E().pluralLabel,hasArchive:E().hasArchive,singleton:E().singleton,menuIcon:E().menuIcon||`box`,supports:E().supports};C()?await x.updateContentType(C(),e):await x.createContentType(e),O(),await k(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){f(e instanceof Error?e.message:String(e))}finally{S(!1)}},j=e=>{w(e.slug),D({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`]]})},M=async e=>{try{await x.deleteContentType(e),await k(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){f(e instanceof Error?e.message:String(e))}};return(()=>{var e=h(ie),r=e.firstChild,[i,l]=_(r.nextSibling),f=i.nextSibling,b=f.firstChild,x=b.nextSibling,S=x.firstChild,w=S.firstChild,[k,ee]=_(w.nextSibling),N=k.nextSibling,P=S.nextSibling,F=P.firstChild,[I,L]=_(F.nextSibling),R=I.nextSibling,z=P.nextSibling,B=z.firstChild,[V,G]=_(B.nextSibling),K=V.nextSibling,q=z.nextSibling,oe=q.firstChild,[J,Y]=_(oe.nextSibling),X=J.nextSibling,[Z,se]=_(X.nextSibling),Q=Z.nextSibling,$=x.nextSibling,ce=$.firstChild,le=ce.nextSibling,[ue,de]=_(le.nextSibling),fe=ue.nextSibling,pe=fe.firstChild,me=pe.nextSibling.nextSibling,[he,ge]=_(me.nextSibling),_e=fe.nextSibling,ve=_e.firstChild,ye=ve.nextSibling.nextSibling,[be,xe]=_(ye.nextSibling),Se=$.nextSibling,Ce=Se.nextSibling,[we,Te]=_(Ce.nextSibling),Ee=f.nextSibling.firstChild.firstChild,De=Ee.firstChild.firstChild,Oe=De.nextSibling,ke=Oe.nextSibling,Ae=ke.nextSibling,je=Ae.nextSibling,Me=je.nextSibling,Ne=Me.nextSibling,Pe=Ne.nextSibling,Fe=Ee.nextSibling;return p(e,a(t,{get when(){return u()},get children(){var e=h(ne);return p(e,u),e}}),i,l),f.addEventListener(`submit`,A),p(b,(()=>{var e=v(()=>!!C());return()=>e()?n(`settings.postTypes.form.editTitle`):n(`settings.postTypes.form.title`)})()),p(S,()=>n(`settings.postTypes.form.slug`),k,ee),N.$$input=e=>D({...E(),slug:e.currentTarget.value}),p(P,()=>n(`settings.postTypes.form.singular`),I,L),R.$$input=e=>D({...E(),singularLabel:e.currentTarget.value}),p(z,()=>n(`settings.postTypes.form.plural`),V,G),K.$$input=e=>D({...E(),pluralLabel:e.currentTarget.value}),p(q,()=>n(`settings.postTypes.form.icon`),J,Y),p(q,a(H,{get value(){return E().menuIcon},onChange:e=>D({...E(),menuIcon:e}),get searchPlaceholder(){return n(`settings.postTypes.form.iconSearchPlaceholder`)},get emptyLabel(){return n(`settings.postTypes.form.iconEmpty`)},countLabel:e=>n(`settings.postTypes.form.iconCount`,{count:e}),get label(){return n(`settings.postTypes.form.icon`)}}),Z,se),p(Q,()=>n(`settings.postTypes.form.iconHint`)),p(ce,()=>n(`settings.postTypes.form.supports`)),p($,a(s,{get each(){return T()},children:e=>(()=>{var t=h(U),n=t.firstChild,r=n.nextSibling.nextSibling,[i,a]=_(r.nextSibling);return n.addEventListener(`change`,t=>D({...E(),supports:t.currentTarget.checked?[...E().supports,e.value]:E().supports.filter(t=>t!==e.value)})),p(t,()=>e.label,i,a),o(()=>m(n,`checked`,E().supports.includes(e.value))),t})()}),ue,de),pe.addEventListener(`change`,e=>D({...E(),hasArchive:e.currentTarget.checked})),p(fe,()=>n(`settings.postTypes.form.hasArchive`),he,ge),ve.addEventListener(`change`,e=>D({...E(),singleton:e.currentTarget.checked})),p(_e,()=>n(`settings.postTypes.form.singleton`),be,xe),p(Se,(()=>{var e=v(()=>!!C());return()=>e()?n(`settings.postTypes.form.update`):n(`settings.postTypes.form.create`)})()),p(f,a(t,{get when(){return C()},get children(){var e=h(re);return e.$$click=O,p(e,()=>n(`settings.postTypes.form.cancel`)),d(),e}}),we,Te),p(De,()=>n(`settings.postTypes.table.slug`)),p(Oe,()=>n(`settings.postTypes.table.singular`)),p(ke,()=>n(`settings.postTypes.table.plural`)),p(Ae,()=>n(`settings.postTypes.table.source`)),p(je,()=>n(`settings.postTypes.table.supports`)),p(Me,()=>n(`settings.postTypes.table.archive`)),p(Ne,()=>n(`settings.postTypes.table.mode`)),p(Pe,()=>n(`settings.postTypes.table.icon`)),p(Fe,a(s,{get each(){return c()},children:e=>(()=>{var r=h(ae),i=r.firstChild,s=i.nextSibling,c=s.nextSibling,l=c.nextSibling,u=l.nextSibling,f=u.nextSibling,g=f.nextSibling,y=g.nextSibling,b=y.firstChild,x=b.firstChild,S=x.nextSibling,[C,w]=_(S.nextSibling),T=y.nextSibling,E=T.firstChild,D=E.nextSibling.nextSibling,[O,k]=_(D.nextSibling);return p(i,()=>e.slug),p(s,()=>e.singularLabel),p(c,()=>e.pluralLabel),p(l,()=>e.source??n(`settings.postTypes.sources.admin`)),p(u,()=>(e.supports??[]).join(`, `)),p(f,(()=>{var t=v(()=>!!e.hasArchive);return()=>t()?n(`common.yes`):n(`common.no`)})()),p(g,(()=>{var t=v(()=>!!e.singleton);return()=>t()?n(`settings.postTypes.table.singleton`):n(`settings.postTypes.table.collection`)})()),p(b,()=>e.menuIcon??`box`,C,w),E.$$click=()=>j(e),p(E,()=>n(`settings.postTypes.table.actions.edit`)),p(T,a(t,{get when(){return e.source!==`CORE`},get children(){var t=h(W);return t.$$click=()=>M(e.slug),p(t,()=>n(`settings.postTypes.table.actions.remove`)),d(),t}}),O,k),o(()=>m(x,`innerHTML`,te(e.menuIcon??`box`))),d(),r})()})),o(e=>{var t=n(`settings.postTypes.form.slugHint`),r=y();return t!==e.e&&g(N,`title`,e.e=t),r!==e.t&&m(Se,`disabled`,e.t=r),e},{e:void 0,t:void 0}),o(()=>m(N,`value`,E().slug)),o(()=>m(R,`value`,E().singularLabel)),o(()=>m(K,`value`,E().pluralLabel)),o(()=>m(pe,`checked`,E().hasArchive)),o(()=>m(ve,`checked`,E().singleton)),d(),e})()}u([`input`,`click`]);export{G as PostTypesManager};
1
+ import{S as e,a as t,d as n,f as r,h as i,l as a,p as o,r as s,x as c}from"./solid.Ck4Vtfe4.js";import{_ as l,a as u,f as d,h as f,l as p,m,o as h,p as g,s as _,u as v,v as y}from"./web.DD6VKaIp.js";import{n as b}from"./i18n.A82w5XQu.js";import{n as x}from"./api.53l1ob4Z.js";import{t as S}from"./FloatingPanel.BetdW5N2.js";import{t as C}from"./iconsAndAliases.ujTnkhnl.js";var w=l(`<input type=search class="input icon-picker__search">`),T=l(`<div class=icon-picker__viewport><div class=icon-picker__grid role=listbox>`),E=l(`<p class=icon-picker__count>`),D=l(`<div class=icon-picker><button type=button class="input icon-picker__trigger"aria-haspopup=dialog><span class=icon-picker__value><span class=icon-picker__preview aria-hidden=true></span><span class=icon-picker__name></span></span><span class=icon-picker__caret aria-hidden=true></span></button><!$><!/>`),O=l(`<p class=icon-picker__empty>`),k=l(`<button type=button role=option class=icon-picker__cell style=height:56px>`),A=56,j=60,M=300,ee=2,N=Math.ceil(M/j)+4,P=e=>e.replace(/(^|[-_])(\w)/g,(e,t,n)=>n.toUpperCase()),F=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Z])([A-Z][a-z])/g,`$1-$2`).toLowerCase(),I=`xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"`,L=e=>Object.entries(e).map(([e,t])=>`${e}="${String(t).replace(/"/g,`&quot;`)}"`).join(` `),R=null,z=()=>(R||=[...new Set(Object.keys(C).map(F))].sort(),R),B=new Map;function te(e){let t=B.get(e);if(t!==void 0)return t;let n=C[P(e)],r=``;return Array.isArray(n)&&(r=`<svg ${I}>${n.map(([e,t])=>`<${e} ${L(t)} />`).join(``)}</svg>`),B.set(e,r),r}var V=e=>e.toLowerCase().replace(/[-_\s]+/g,` `).trim();function H(l){let[u,b]=i(!1),[x,C]=i(``),[P,F]=i(-1),[I,L]=i(0),[R,B]=i(6),[H,ne]=i(void 0),[re,ie]=i(void 0),U,W,ae,G,K=r(()=>{let e=V(x()).split(` `).filter(Boolean),t=z();return e.length===0?t:t.filter(t=>{let n=V(t);return e.every(e=>n.includes(e))})}),q=r(()=>{let e=Math.max(1,R());return K().map((t,n)=>({name:t,index:n,row:Math.floor(n/e),col:n%e}))}),oe=r(()=>Math.max(0,Math.floor(I()/j)-ee)*R()),J=r(()=>{let e=oe();return q().slice(e,e+N*R())}),Y=r(()=>Math.ceil(q().length/Math.max(1,R()))),X=e=>{let t=e?.clientWidth??0;if(t<=0)return;let n=Math.max(3,Math.floor(t/A));B(e=>e===n?e:n)},Z=(e,t=`nearest`)=>{let n=W;if(!n||e<0)return;let r=Math.max(1,R()),i=Math.floor(e/r)*j,a=i+j,o=n.scrollTop;t===`center`?o=i-M/2+j/2:i<n.scrollTop?o=i:a>n.scrollTop+M&&(o=a-M);let s=Math.max(0,Y()*j-M);o=Math.min(Math.max(0,o),s),n.scrollTop=o,L(o)},se=e=>{l.onChange(e),b(!1),C(``)},Q=e=>{let t=K();if(t.length===0)return;let n=P(),r=n<0?e>0?-1:t.length:n,i=Math.min(Math.max(0,r+e),t.length-1);F(i),Z(i)},$=e=>{let t=Math.max(1,R());switch(e.key){case`ArrowDown`:e.preventDefault(),Q(t);break;case`ArrowUp`:e.preventDefault(),Q(-t);break;case`ArrowRight`:e.preventDefault(),Q(1);break;case`ArrowLeft`:e.preventDefault(),Q(-1);break;case`Home`:e.preventDefault(),F(0),Z(0);break;case`End`:e.preventDefault(),F(K().length-1),Z(K().length-1);break;case`Enter`:{e.preventDefault();let t=K()[P()];t&&se(t);break}}};return e(()=>{typeof ResizeObserver<`u`&&(G=new ResizeObserver(e=>{X(e[0]?.target)})),X(H()),c(()=>G?.disconnect())}),n(()=>{let e=H();e&&(X(e),G?.observe(e))}),n(()=>{u()&&(F(-1),queueMicrotask(()=>{let e=K().indexOf(l.value);e>=0&&Z(e,`center`),ae?.focus()}))}),n(()=>{x(),F(-1),W&&(W.scrollTop=0),L(0)}),(()=>{var e=h(D),n=e.firstChild,r=n.firstChild,i=r.firstChild,c=i.nextSibling,A=r.nextSibling,M=n.nextSibling,[ee,N]=_(M.nextSibling),F=U;return typeof F==`function`?y(F,e):U=e,n.$$click=()=>b(!u()),y(ie,n),p(c,()=>l.value||`box`),p(A,()=>u()?`▴`:`▾`),p(e,a(S,{get open(){return u()},get trigger(){return re()},onClose:()=>b(!1),class:`icon-picker__panel`,role:`dialog`,get"aria-label"(){return l.label},minWidth:360,onKeyDown:$,get children(){return[(()=>{var e=h(w);return y(e=>ae=e,e),e.$$input=e=>C(e.currentTarget.value),o(()=>g(e,`placeholder`,l.searchPlaceholder)),o(()=>m(e,`value`,x())),d(),e})(),a(t,{get when(){return K().length>0},get fallback(){return(()=>{var e=h(O);return p(e,()=>l.emptyLabel??`—`),e})()},get children(){var e=h(T),t=e.firstChild;return e.addEventListener(`scroll`,e=>L(e.currentTarget.scrollTop)),y(e=>W=e,e),y(ne,t),p(t,a(s,{get each(){return J()},children:e=>(()=>{var t=h(k);return t.$$click=()=>se(e.name),o(n=>{var r=e.name,i=e.name,a=l.value===e.name,o=l.value===e.name,s=P()===e.index,c=`${e.row*j}px`,u=`${e.col*(100/Math.max(1,R()))}%`,d=`${100/Math.max(1,R())}%`,p=te(e.name);return r!==n.e&&g(t,`title`,n.e=r),i!==n.t&&g(t,`aria-label`,n.t=i),a!==n.a&&g(t,`aria-selected`,n.a=a),o!==n.o&&t.classList.toggle(`is-selected`,n.o=o),s!==n.i&&t.classList.toggle(`is-active`,n.i=s),c!==n.n&&f(t,`top`,n.n=c),u!==n.s&&f(t,`left`,n.s=u),d!==n.h&&f(t,`width`,n.h=d),p!==n.r&&m(t,`innerHTML`,n.r=p),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),d(),t})()})),o(e=>{var n=l.label,r=`${Y()*j}px`;return n!==e.e&&g(t,`aria-label`,e.e=n),r!==e.t&&f(t,`height`,e.t=r),e},{e:void 0,t:void 0}),e}}),a(t,{get when(){return v(()=>!!l.countLabel)()&&K().length>0},get children(){var e=h(E);return p(e,()=>l.countLabel?.(K().length)),e}})]}}),ee,N),o(e=>{var t=u(),r=te(l.value||`box`);return t!==e.e&&g(n,`aria-expanded`,e.e=t),r!==e.t&&m(i,`innerHTML`,e.t=r),e},{e:void 0,t:void 0}),d(),e})()}u([`click`,`input`]);var ne=l(`<div class="notice notice--error">`),re=l(`<button type=button class="btn btn-secondary">`),ie=l(`<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 class=post-types-manager__icon-field><!$><!/><!$><!/><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><div class="card settings-table-card"><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>`),U=l(`<label><input type=checkbox> <!$><!/>`),W=l(`<button type=button class="btn btn-danger">`),ae=l(`<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><span class=post-types-manager__icon><span class=post-types-manager__icon-preview aria-hidden=true></span><!$><!/></span></td><td><button type=button class="btn btn-secondary"></button> <!$><!/>`);function G(){let{t:n}=b(),[c,l]=i([]),[u,f]=i(``),[y,S]=i(!1),[C,w]=i(null),T=r(()=>[{value:`title`,label:n(`settings.postTypes.form.supportsOptions.title`)},{value:`editor`,label:n(`settings.postTypes.form.supportsOptions.editor`)},{value:`thumbnail`,label:n(`settings.postTypes.form.supportsOptions.thumbnail`)},{value:`excerpt`,label:n(`settings.postTypes.form.supportsOptions.excerpt`)},{value:`revisions`,label:n(`settings.postTypes.form.supportsOptions.revisions`)}]),[E,D]=i({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]}),O=()=>{w(null),D({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]})},k=async()=>{try{l(await x.getContentTypes())}catch(e){f(e instanceof Error?e.message:String(e))}};e(k);let A=async e=>{e.preventDefault(),f(``),S(!0);try{let e={name:E().name||E().slug,slug:E().slug,singularLabel:E().singularLabel,pluralLabel:E().pluralLabel,hasArchive:E().hasArchive,singleton:E().singleton,menuIcon:E().menuIcon||`box`,supports:E().supports};C()?await x.updateContentType(C(),e):await x.createContentType(e),O(),await k(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){f(e instanceof Error?e.message:String(e))}finally{S(!1)}},j=e=>{w(e.slug),D({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`]]})},M=async e=>{try{await x.deleteContentType(e),await k(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){f(e instanceof Error?e.message:String(e))}};return(()=>{var e=h(ie),r=e.firstChild,[i,l]=_(r.nextSibling),f=i.nextSibling,b=f.firstChild,x=b.nextSibling,S=x.firstChild,w=S.firstChild,[k,ee]=_(w.nextSibling),N=k.nextSibling,P=S.nextSibling,F=P.firstChild,[I,L]=_(F.nextSibling),R=I.nextSibling,z=P.nextSibling,B=z.firstChild,[V,G]=_(B.nextSibling),K=V.nextSibling,q=z.nextSibling,oe=q.firstChild,[J,Y]=_(oe.nextSibling),X=J.nextSibling,[Z,se]=_(X.nextSibling),Q=Z.nextSibling,$=x.nextSibling,ce=$.firstChild,le=ce.nextSibling,[ue,de]=_(le.nextSibling),fe=ue.nextSibling,pe=fe.firstChild,me=pe.nextSibling.nextSibling,[he,ge]=_(me.nextSibling),_e=fe.nextSibling,ve=_e.firstChild,ye=ve.nextSibling.nextSibling,[be,xe]=_(ye.nextSibling),Se=$.nextSibling,Ce=Se.nextSibling,[we,Te]=_(Ce.nextSibling),Ee=f.nextSibling.firstChild.firstChild,De=Ee.firstChild.firstChild,Oe=De.nextSibling,ke=Oe.nextSibling,Ae=ke.nextSibling,je=Ae.nextSibling,Me=je.nextSibling,Ne=Me.nextSibling,Pe=Ne.nextSibling,Fe=Ee.nextSibling;return p(e,a(t,{get when(){return u()},get children(){var e=h(ne);return p(e,u),e}}),i,l),f.addEventListener(`submit`,A),p(b,(()=>{var e=v(()=>!!C());return()=>e()?n(`settings.postTypes.form.editTitle`):n(`settings.postTypes.form.title`)})()),p(S,()=>n(`settings.postTypes.form.slug`),k,ee),N.$$input=e=>D({...E(),slug:e.currentTarget.value}),p(P,()=>n(`settings.postTypes.form.singular`),I,L),R.$$input=e=>D({...E(),singularLabel:e.currentTarget.value}),p(z,()=>n(`settings.postTypes.form.plural`),V,G),K.$$input=e=>D({...E(),pluralLabel:e.currentTarget.value}),p(q,()=>n(`settings.postTypes.form.icon`),J,Y),p(q,a(H,{get value(){return E().menuIcon},onChange:e=>D({...E(),menuIcon:e}),get searchPlaceholder(){return n(`settings.postTypes.form.iconSearchPlaceholder`)},get emptyLabel(){return n(`settings.postTypes.form.iconEmpty`)},countLabel:e=>n(`settings.postTypes.form.iconCount`,{count:e}),get label(){return n(`settings.postTypes.form.icon`)}}),Z,se),p(Q,()=>n(`settings.postTypes.form.iconHint`)),p(ce,()=>n(`settings.postTypes.form.supports`)),p($,a(s,{get each(){return T()},children:e=>(()=>{var t=h(U),n=t.firstChild,r=n.nextSibling.nextSibling,[i,a]=_(r.nextSibling);return n.addEventListener(`change`,t=>D({...E(),supports:t.currentTarget.checked?[...E().supports,e.value]:E().supports.filter(t=>t!==e.value)})),p(t,()=>e.label,i,a),o(()=>m(n,`checked`,E().supports.includes(e.value))),t})()}),ue,de),pe.addEventListener(`change`,e=>D({...E(),hasArchive:e.currentTarget.checked})),p(fe,()=>n(`settings.postTypes.form.hasArchive`),he,ge),ve.addEventListener(`change`,e=>D({...E(),singleton:e.currentTarget.checked})),p(_e,()=>n(`settings.postTypes.form.singleton`),be,xe),p(Se,(()=>{var e=v(()=>!!C());return()=>e()?n(`settings.postTypes.form.update`):n(`settings.postTypes.form.create`)})()),p(f,a(t,{get when(){return C()},get children(){var e=h(re);return e.$$click=O,p(e,()=>n(`settings.postTypes.form.cancel`)),d(),e}}),we,Te),p(De,()=>n(`settings.postTypes.table.slug`)),p(Oe,()=>n(`settings.postTypes.table.singular`)),p(ke,()=>n(`settings.postTypes.table.plural`)),p(Ae,()=>n(`settings.postTypes.table.source`)),p(je,()=>n(`settings.postTypes.table.supports`)),p(Me,()=>n(`settings.postTypes.table.archive`)),p(Ne,()=>n(`settings.postTypes.table.mode`)),p(Pe,()=>n(`settings.postTypes.table.icon`)),p(Fe,a(s,{get each(){return c()},children:e=>(()=>{var r=h(ae),i=r.firstChild,s=i.nextSibling,c=s.nextSibling,l=c.nextSibling,u=l.nextSibling,f=u.nextSibling,g=f.nextSibling,y=g.nextSibling,b=y.firstChild,x=b.firstChild,S=x.nextSibling,[C,w]=_(S.nextSibling),T=y.nextSibling,E=T.firstChild,D=E.nextSibling.nextSibling,[O,k]=_(D.nextSibling);return p(i,()=>e.slug),p(s,()=>e.singularLabel),p(c,()=>e.pluralLabel),p(l,()=>e.source??n(`settings.postTypes.sources.admin`)),p(u,()=>(e.supports??[]).join(`, `)),p(f,(()=>{var t=v(()=>!!e.hasArchive);return()=>t()?n(`common.yes`):n(`common.no`)})()),p(g,(()=>{var t=v(()=>!!e.singleton);return()=>t()?n(`settings.postTypes.table.singleton`):n(`settings.postTypes.table.collection`)})()),p(b,()=>e.menuIcon??`box`,C,w),E.$$click=()=>j(e),p(E,()=>n(`settings.postTypes.table.actions.edit`)),p(T,a(t,{get when(){return e.source!==`CORE`},get children(){var t=h(W);return t.$$click=()=>M(e.slug),p(t,()=>n(`settings.postTypes.table.actions.remove`)),d(),t}}),O,k),o(()=>m(x,`innerHTML`,te(e.menuIcon??`box`))),d(),r})()})),o(e=>{var t=n(`settings.postTypes.form.slugHint`),r=y();return t!==e.e&&g(N,`title`,e.e=t),r!==e.t&&m(Se,`disabled`,e.t=r),e},{e:void 0,t:void 0}),o(()=>m(N,`value`,E().slug)),o(()=>m(R,`value`,E().singularLabel)),o(()=>m(K,`value`,E().pluralLabel)),o(()=>m(pe,`checked`,E().hasArchive)),o(()=>m(ve,`checked`,E().singleton)),d(),e})()}u([`input`,`click`]);export{G as PostTypesManager};
@@ -1,4 +1,4 @@
1
- import{S as e,h as t,l as n,p as r,r as i}from"./solid.Ck4Vtfe4.js";import{_ as a,a as o,f as s,l as c,m as l,o as u,p as d,s as f,u as p}from"./web.DD6VKaIp.js";import{n as m}from"./i18n.BFBHzd3w.js";import{n as h}from"./api.53l1ob4Z.js";import{DashboardWidget as g}from"./AtGlanceWidget.B5byv-Z6.js";var _=a(`<div class=quick-draft-wrapper><div class=quick-draft-content-wrapper>`),v=a(`<style>
1
+ import{S as e,h as t,l as n,p as r,r as i}from"./solid.Ck4Vtfe4.js";import{_ as a,a as o,f as s,l as c,m as l,o as u,p as d,s as f,u as p}from"./web.DD6VKaIp.js";import{n as m}from"./i18n.A82w5XQu.js";import{n as h}from"./api.53l1ob4Z.js";import{DashboardWidget as g}from"./AtGlanceWidget.w23IIv06.js";var _=a(`<div class=quick-draft-wrapper><div class=quick-draft-content-wrapper>`),v=a(`<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{S as e,a as t,h as n,l as r}from"./solid.Ck4Vtfe4.js";import{_ as i,l as a,o,s}from"./web.DD6VKaIp.js";import{n as c}from"./i18n.BFBHzd3w.js";import{n as l}from"./api.53l1ob4Z.js";import{i as u,n as d,r as f,s as p}from"./src.CYKGYEyR.js";import{t as m}from"./TimezoneSelect.DDwsrzLo.js";var h=i(`<div class="notice notice--error">`),g=i(`<div class=notice>`),_=i(`<div class=form-field><label></label><!$><!/>`),v=i(`<form><div class=form-grid><div class=form-field><label></label><!$><!/></div><!$><!/><div class=form-field><label></label><!$><!/><p class=form-hint></p></div><div class=form-field><label></label><!$><!/><p class=form-hint></p></div></div><div class=media-details__actions>`),y=i(`<div class=reading-settings>`),b=i(`<p class=muted>`);function x(){let{t:i}=c(),[x,S]=n({frontPageDisplays:`static`,frontPage:``,postsPage:``,timezone_string:``,gmt_offset:``}),[C,w]=n([]),[T,E]=n(!0),[D,O]=n(!1),[k,A]=n(``),[j,M]=n(``);e(async()=>{let e=setTimeout(()=>{A(`Loading timed out. Please check your connection and try again.`),E(!1)},35e3);try{let e=(await l.getContent({type:`page`,status:`PUBLISHED`,limit:100})).data.map(e=>({value:e.id,label:e.title||e.slug}));w(e);let t=await l.getSettings(`reading`),n={};for(let e of t)n[e.key]=typeof e.value==`string`?e.value:JSON.stringify(e.value??``);n.frontPageDisplays||=`static`,S({frontPageDisplays:n.frontPageDisplays??`static`,frontPage:n.frontPage??``,postsPage:n.postsPage??``,timezone_string:n.timezone_string??``,gmt_offset:n.gmt_offset??``})}catch(e){A(e instanceof Error?e.message:String(e))}finally{clearTimeout(e),E(!1)}});let N=async e=>{e.preventDefault(),A(``),M(``),O(!0);try{let e=x(),t=[{key:`frontPageDisplays`,value:e.frontPageDisplays,group:`reading`,type:`string`},{key:`frontPage`,value:e.frontPage,group:`reading`,type:`string`},{key:`postsPage`,value:e.postsPage,group:`reading`,type:`string`},{key:`timezone_string`,value:e.timezone_string,group:`reading`,type:`string`},{key:`gmt_offset`,value:e.gmt_offset,group:`reading`,type:`string`}];await l.updateSettings(t),M(i(`settings.reading.saved`))}catch(e){A(e instanceof Error?e.message:String(e))}finally{O(!1)}};return(()=>{var e=o(y);return a(e,r(t,{get when(){return!T()},get fallback(){return(()=>{var e=o(b);return a(e,()=>i(`settings.reading.loading`)),e})()},get children(){return[r(t,{get when(){return k()},get children(){var e=o(h);return a(e,k),e}}),r(t,{get when(){return j()},get children(){var e=o(g);return a(e,j),e}}),r(f,{get children(){var e=o(v),n=e.firstChild,c=n.firstChild,l=c.firstChild,f=l.nextSibling,[h,g]=s(f.nextSibling),y=c.nextSibling,[b,w]=s(y.nextSibling),T=b.nextSibling,E=T.firstChild,O=E.nextSibling,[k,A]=s(O.nextSibling),j=k.nextSibling,M=T.nextSibling,P=M.firstChild,F=P.nextSibling,[I,L]=s(F.nextSibling),R=I.nextSibling,z=n.nextSibling;return e.addEventListener(`submit`,N),a(l,()=>i(`settings.reading.frontPageDisplays`)),a(c,r(p,{name:`frontPageDisplays`,get value(){return x().frontPageDisplays},get options(){return[{value:`latest`,label:i(`settings.reading.frontPageDisplaysOptions.latest`)},{value:`static`,label:i(`settings.reading.frontPageDisplaysOptions.static`)}]},onChange:e=>S({...x(),frontPageDisplays:e})}),h,g),a(n,r(t,{get when(){return x().frontPageDisplays===`static`},get children(){return[(()=>{var e=o(_),t=e.firstChild,n=t.nextSibling,[c,l]=s(n.nextSibling);return a(t,()=>i(`settings.reading.frontPage`)),a(e,r(p,{name:`frontPage`,get value(){return x().frontPage},get options(){return[{value:``,label:i(`settings.reading.selectPage`)},...C()]},onChange:e=>S({...x(),frontPage:e})}),c,l),e})(),(()=>{var e=o(_),t=e.firstChild,n=t.nextSibling,[c,l]=s(n.nextSibling);return a(t,()=>i(`settings.reading.postsPage`)),a(e,r(p,{name:`postsPage`,get value(){return x().postsPage},get options(){return[{value:``,label:i(`settings.reading.selectPage`)},...C()]},onChange:e=>S({...x(),postsPage:e})}),c,l),e})()]}}),b,w),a(E,()=>i(`settings.reading.timezoneString`)),a(T,r(m,{get value(){return x().timezone_string??``},get placeholder(){return i(`settings.reading.timezoneStringPlaceholder`)},get searchPlaceholder(){return i(`settings.reading.timezoneStringPlaceholder`)},onChange:e=>S({...x(),timezone_string:e})}),k,A),a(j,()=>i(`settings.reading.timezoneDescription`)),a(P,()=>i(`settings.reading.gmtOffset`)),a(M,r(u,{name:`gmt_offset`,type:`number`,get value(){return x().gmt_offset??``},get placeholder(){return i(`settings.reading.gmtOffsetPlaceholder`)},onInput:e=>S({...x(),gmt_offset:e})}),I,L),a(R,()=>i(`settings.reading.gmtOffsetDescription`)),a(z,r(d,{variant:`primary`,type:`submit`,get disabled(){return D()},get loading(){return D()},get children(){return i(`settings.reading.save`)}})),e}})]}})),e})()}export{x as ReadingSettings};
1
+ import{S as e,a as t,h as n,l as r}from"./solid.Ck4Vtfe4.js";import{_ as i,l as a,o,s}from"./web.DD6VKaIp.js";import{n as c}from"./i18n.A82w5XQu.js";import{n as l}from"./api.53l1ob4Z.js";import{i as u,n as d,r as f,s as p}from"./src.CYKGYEyR.js";import{t as m}from"./TimezoneSelect.DDwsrzLo.js";var h=i(`<div class="notice notice--error">`),g=i(`<div class=notice>`),_=i(`<div class=form-field><label></label><!$><!/>`),v=i(`<form><div class=form-grid><div class=form-field><label></label><!$><!/></div><!$><!/><div class=form-field><label></label><!$><!/><p class=form-hint></p></div><div class=form-field><label></label><!$><!/><p class=form-hint></p></div></div><div class=media-details__actions>`),y=i(`<div class=reading-settings>`),b=i(`<p class=muted>`);function x(){let{t:i}=c(),[x,S]=n({frontPageDisplays:`static`,frontPage:``,postsPage:``,timezone_string:``,gmt_offset:``}),[C,w]=n([]),[T,E]=n(!0),[D,O]=n(!1),[k,A]=n(``),[j,M]=n(``);e(async()=>{let e=setTimeout(()=>{A(`Loading timed out. Please check your connection and try again.`),E(!1)},35e3);try{let e=(await l.getContent({type:`page`,status:`PUBLISHED`,limit:100})).data.map(e=>({value:e.id,label:e.title||e.slug}));w(e);let t=await l.getSettings(`reading`),n={};for(let e of t)n[e.key]=typeof e.value==`string`?e.value:JSON.stringify(e.value??``);n.frontPageDisplays||=`static`,S({frontPageDisplays:n.frontPageDisplays??`static`,frontPage:n.frontPage??``,postsPage:n.postsPage??``,timezone_string:n.timezone_string??``,gmt_offset:n.gmt_offset??``})}catch(e){A(e instanceof Error?e.message:String(e))}finally{clearTimeout(e),E(!1)}});let N=async e=>{e.preventDefault(),A(``),M(``),O(!0);try{let e=x(),t=[{key:`frontPageDisplays`,value:e.frontPageDisplays,group:`reading`,type:`string`},{key:`frontPage`,value:e.frontPage,group:`reading`,type:`string`},{key:`postsPage`,value:e.postsPage,group:`reading`,type:`string`},{key:`timezone_string`,value:e.timezone_string,group:`reading`,type:`string`},{key:`gmt_offset`,value:e.gmt_offset,group:`reading`,type:`string`}];await l.updateSettings(t),M(i(`settings.reading.saved`))}catch(e){A(e instanceof Error?e.message:String(e))}finally{O(!1)}};return(()=>{var e=o(y);return a(e,r(t,{get when(){return!T()},get fallback(){return(()=>{var e=o(b);return a(e,()=>i(`settings.reading.loading`)),e})()},get children(){return[r(t,{get when(){return k()},get children(){var e=o(h);return a(e,k),e}}),r(t,{get when(){return j()},get children(){var e=o(g);return a(e,j),e}}),r(f,{get children(){var e=o(v),n=e.firstChild,c=n.firstChild,l=c.firstChild,f=l.nextSibling,[h,g]=s(f.nextSibling),y=c.nextSibling,[b,w]=s(y.nextSibling),T=b.nextSibling,E=T.firstChild,O=E.nextSibling,[k,A]=s(O.nextSibling),j=k.nextSibling,M=T.nextSibling,P=M.firstChild,F=P.nextSibling,[I,L]=s(F.nextSibling),R=I.nextSibling,z=n.nextSibling;return e.addEventListener(`submit`,N),a(l,()=>i(`settings.reading.frontPageDisplays`)),a(c,r(p,{name:`frontPageDisplays`,get value(){return x().frontPageDisplays},get options(){return[{value:`latest`,label:i(`settings.reading.frontPageDisplaysOptions.latest`)},{value:`static`,label:i(`settings.reading.frontPageDisplaysOptions.static`)}]},onChange:e=>S({...x(),frontPageDisplays:e})}),h,g),a(n,r(t,{get when(){return x().frontPageDisplays===`static`},get children(){return[(()=>{var e=o(_),t=e.firstChild,n=t.nextSibling,[c,l]=s(n.nextSibling);return a(t,()=>i(`settings.reading.frontPage`)),a(e,r(p,{name:`frontPage`,get value(){return x().frontPage},get options(){return[{value:``,label:i(`settings.reading.selectPage`)},...C()]},onChange:e=>S({...x(),frontPage:e})}),c,l),e})(),(()=>{var e=o(_),t=e.firstChild,n=t.nextSibling,[c,l]=s(n.nextSibling);return a(t,()=>i(`settings.reading.postsPage`)),a(e,r(p,{name:`postsPage`,get value(){return x().postsPage},get options(){return[{value:``,label:i(`settings.reading.selectPage`)},...C()]},onChange:e=>S({...x(),postsPage:e})}),c,l),e})()]}}),b,w),a(E,()=>i(`settings.reading.timezoneString`)),a(T,r(m,{get value(){return x().timezone_string??``},get placeholder(){return i(`settings.reading.timezoneStringPlaceholder`)},get searchPlaceholder(){return i(`settings.reading.timezoneStringPlaceholder`)},onChange:e=>S({...x(),timezone_string:e})}),k,A),a(j,()=>i(`settings.reading.timezoneDescription`)),a(P,()=>i(`settings.reading.gmtOffset`)),a(M,r(u,{name:`gmt_offset`,type:`number`,get value(){return x().gmt_offset??``},get placeholder(){return i(`settings.reading.gmtOffsetPlaceholder`)},onInput:e=>S({...x(),gmt_offset:e})}),I,L),a(R,()=>i(`settings.reading.gmtOffsetDescription`)),a(z,r(d,{variant:`primary`,type:`submit`,get disabled(){return D()},get loading(){return D()},get children(){return i(`settings.reading.save`)}})),e}})]}})),e})()}export{x as ReadingSettings};
@@ -1 +1 @@
1
- import{S as e,a as t,f as n,h as r,l as i,p as a,r as o}from"./solid.Ck4Vtfe4.js";import{_ as s,a as c,f as l,l as u,m as d,o as f,p,s as m,u as h,v as g}from"./web.DD6VKaIp.js";import{n as _}from"./i18n.BFBHzd3w.js";import{n as v}from"./api.53l1ob4Z.js";import{t as y}from"./Modal.eJIvbMT2.js";import{t as b}from"./FloatingPanel.BetdW5N2.js";var x=s(`<input type=search class="input permission-picker__search">`),S=s(`<div class=permission-picker__matrix role=presentation><div class="permission-picker__row permission-picker__row--head"role=presentation><span class=permission-picker__resource></span><!$><!/><!$><!/></div><!$><!/>`),C=s(`<div class=permission-picker__custom><p class=permission-picker__custom-label></p><div class=permission-picker__chips><!$><!/><form class=permission-picker__custom-form><input class="input permission-picker__custom-input"><button class="btn btn-secondary btn-sm"type=submit>`),w=s(`<p class=icon-picker__count>`),T=s(`<div class=permission-picker><button type=button class="input permission-picker__trigger"aria-haspopup=dialog><span class=permission-picker__value></span><span class=icon-picker__caret aria-hidden=true></span></button><!$><!/>`),E=s(`<span class=permission-picker__action-label>`),D=s(`<p class=permission-picker__empty>`),O=s(`<div class=permission-picker__row><span class=permission-picker__resource></span><!$><!/>`),k=s(`<label class=permission-picker__cell><input type=checkbox><span aria-hidden=true>✓`),A=s(`<span class="permission-picker__cell permission-picker__cell--empty">`),ee=s(`<span class=permission-picker__chip><code></code><button type=button>×`),j=[`read`,`create`,`update`,`delete`],M=[`content`,`media`,`category`,`tag`,`menu`,`user`,`roles`,`theme`,`plugin`,`setting`,`webhook`,`tenants`,`audit`,`build`,`system`],N={media:[`upload`]},P=(e,t)=>`${e}:${t}`,F=e=>{let[t,n]=e.split(`:`);return!t||!n?!1:j.includes(t)&&M.includes(n)};function I(e){let{t:s}=_(),[c,h]=r(!1),[v,y]=r(``),[I,L]=r(``),[R,z]=r(void 0),B=n(()=>new Set(e.value)),V=n(()=>e.value.filter(e=>!F(e))),H=n(()=>{let e=v().trim().toLowerCase();return e?M.filter(t=>t.includes(e)||s(`access.resources.${t}`).toLowerCase().includes(e)):M}),U=n(()=>{let e=new Set;for(let t of H())for(let n of N[t]??[])e.add(n);return[...e]}),W=(e,t)=>j.includes(e)||(N[t]??[]).includes(e),G=(t,n)=>{let r=P(t,n);e.onChange(B().has(r)?e.value.filter(e=>e!==r):[...e.value,r])},K=t=>{e.onChange(e.value.filter(e=>e!==t))},q=()=>{let t=I().trim().toLowerCase().replace(/\s+/g,`-`);t&&!B().has(t)&&e.onChange([...e.value,t]),L(``)},J=()=>{let t=e.value.length;if(t===0)return e.placeholder??s(`access.permissionsPlaceholder`);let n=new Set(e.value.map(e=>e.split(`:`)[1]??e));return s(`access.permissionsSummary`,{resources:n.size,count:t})};return(()=>{var n=f(T),r=n.firstChild,_=r.firstChild,M=_.nextSibling,N=r.nextSibling,[F,Y]=m(N.nextSibling);return r.$$click=()=>h(!c()),g(z,r),u(_,J),u(M,()=>c()?`▴`:`▾`),u(n,i(b,{get open(){return c()},get trigger(){return R()},onClose:()=>h(!1),class:`permission-picker__panel`,role:`dialog`,get"aria-label"(){return s(`access.permissions`)},minWidth:440,get children(){return[(()=>{var t=f(x);return t.$$input=e=>y(e.currentTarget.value),a(()=>p(t,`placeholder`,e.searchPlaceholder??s(`access.permissionSearch`))),a(()=>d(t,`value`,v())),l(),t})(),(()=>{var e=f(S),t=e.firstChild,n=t.firstChild.nextSibling,[r,c]=m(n.nextSibling),l=r.nextSibling,[h,g]=m(l.nextSibling),_=t.nextSibling,[v,y]=m(_.nextSibling);return u(t,i(o,{each:j,children:e=>(()=>{var t=f(E);return u(t,e),t})()}),r,c),u(t,i(o,{get each(){return U()},children:e=>(()=>{var t=f(E);return u(t,e),t})()}),h,g),u(e,i(o,{get each(){return H()},get fallback(){return(()=>{var e=f(D);return u(e,()=>s(`access.permissionNoMatches`)),e})()},children:e=>(()=>{var t=f(O),n=t.firstChild,r=n.nextSibling,[c,l]=m(r.nextSibling);return p(n,`title`,e),u(n,()=>s(`access.resources.${e}`)),u(t,i(o,{get each(){return[...j,...U()]},children:t=>W(t,e)?(()=>{var n=f(k),r=n.firstChild;return p(n,`title`,`${t}:${e}`),r.addEventListener(`change`,()=>G(t,e)),a(()=>n.classList.toggle(`is-checked`,!!B().has(P(t,e)))),a(()=>d(r,`checked`,B().has(P(t,e)))),n})():f(A)}),c,l),t})()}),v,y),e})(),(()=>{var e=f(C),t=e.firstChild,n=t.nextSibling,r=n.firstChild,[c,h]=m(r.nextSibling),g=c.nextSibling,_=g.firstChild,v=_.nextSibling;return u(t,()=>s(`access.customPermissions`)),u(n,i(o,{get each(){return V()},children:e=>(()=>{var t=f(ee),n=t.firstChild,r=n.nextSibling;return u(n,e),r.$$click=()=>K(e),a(()=>p(r,`aria-label`,`${s(`common.remove`)}: ${e}`)),l(),t})()}),c,h),g.addEventListener(`submit`,e=>{e.preventDefault(),q()}),_.$$input=e=>L(e.currentTarget.value),u(v,()=>s(`common.add`)),a(()=>p(_,`placeholder`,s(`access.customPermission`))),a(()=>d(_,`value`,I())),l(),e})(),i(t,{get when(){return e.value.length>0},get children(){var t=f(w);return u(t,()=>s(`access.permissionsSelected`,{count:e.value.length})),t}})]}}),F,Y),a(t=>{var n=c(),i=e.value.length===0;return n!==t.e&&p(r,`aria-expanded`,t.e=n),i!==t.t&&_.classList.toggle(`is-empty`,t.t=i),t},{e:void 0,t:void 0}),l(),n})()}c([`click`,`input`]);var L=s(`<div class="notice notice--error">`),R=s(`<div class=resource-hub><!$><!/><div class=access-grid><section class=card><div class=card-header-row><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button></div><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/></section><section class=card><div class=card-header-row><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button></div><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/>`),z=s(`<button class="btn btn-danger btn-sm"type=button>`),B=s(`<tr><td></td><td><code></code></td><td class=access-permissions-cell></td><td class=access-actions><button class="btn btn-secondary btn-sm"type=button></button><!$><!/>`),V=s(`<form class=resource-form><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input required></label><div class=resource-form__field><span class=resource-form__label></span><!$><!/></div><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit>`),H=s(`<tr><td></td><td><code></code></td><td></td><td class=access-actions><button class="btn btn-secondary btn-sm"type=button></button><button class="btn btn-danger btn-sm"type=button>`),U=s(`<form class=resource-form><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input></label><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit>`);function W(){let{t:n}=_(),[s,c]=r([]),[g,b]=r([]),[x,S]=r(null),[C,w]=r(null),[T,E]=r(!1),[D,O]=r(``),k=async()=>{try{c(await v.listRoles()),b((await v.listTenants({limit:100})).data??[])}catch(e){O(e instanceof Error?e.message:String(e))}};e(k);let A=e=>{e.preventDefault();let t=x();t&&(E(!0),(t.id?v.updateRole(t.id,t):v.createRole(t)).then(()=>(S(null),k())).catch(e=>O(e instanceof Error?e.message:String(e))).finally(()=>E(!1)))},ee=e=>{e.preventDefault();let t=C();t&&(E(!0),(t.id?v.updateTenant(t.id,t):v.createTenant(t)).then(()=>(w(null),k())).catch(e=>O(e instanceof Error?e.message:String(e))).finally(()=>E(!1)))},j=e=>{let t=e.permissions??[];return t.length===0?`—`:t.slice(0,4).join(`, `)+(t.length>4?` +${t.length-4}`:``)};return(()=>{var e=f(R),r=e.firstChild,[c,_]=m(r.nextSibling),b=c.nextSibling.firstChild,E=b.firstChild,O=E.firstChild,M=O.nextSibling,N=M.firstChild.nextSibling,[P,F]=m(N.nextSibling),W=E.nextSibling,G=W.firstChild,K=G.firstChild.firstChild,q=K.nextSibling,J=q.nextSibling,Y=G.nextSibling,te=W.nextSibling,[ne,re]=m(te.nextSibling),X=b.nextSibling,Z=X.firstChild,Q=Z.firstChild,$=Q.nextSibling,ie=$.firstChild.nextSibling,[ae,oe]=m(ie.nextSibling),se=Z.nextSibling,ce=se.firstChild,le=ce.firstChild.firstChild,ue=le.nextSibling,de=ue.nextSibling,fe=ce.nextSibling,pe=se.nextSibling,[me,he]=m(pe.nextSibling);return u(e,i(t,{get when(){return D()},get children(){var e=f(L);return u(e,D),e}}),c,_),u(O,()=>n(`access.roles`)),M.$$click=()=>S({name:``,slug:``,permissions:[]}),u(M,()=>n(`common.create`),P,F),u(K,()=>n(`resources.name`)),u(q,()=>n(`resources.slug`)),u(J,()=>n(`access.permissions`)),u(Y,i(o,{get each(){return s()},children:e=>(()=>{var r=f(B),o=r.firstChild,s=o.nextSibling,c=s.firstChild,d=s.nextSibling,h=d.nextSibling,g=h.firstChild,_=g.nextSibling,[y,b]=m(_.nextSibling);return u(o,()=>e.name),u(c,()=>e.slug),u(d,()=>j(e)),g.$$click=()=>S({...e,permissions:[...e.permissions??[]]}),u(g,()=>n(`common.edit`)),u(h,i(t,{get when(){return!e.is_system},get children(){var t=f(z);return t.$$click=()=>void v.deleteRole(e.id).then(k),u(t,()=>n(`common.delete`)),l(),t}}),y,b),a(()=>p(d,`title`,(e.permissions??[]).join(`, `))),l(),r})()})),u(b,i(y,{get open(){return x()!==null},onClose:()=>S(null),get title(){return h(()=>!!x()?.id)()?n(`access.editRole`):n(`access.newRole`)},get children(){return i(t,{get when(){return x()},children:e=>(()=>{var t=f(V),r=t.firstChild,o=r.firstChild,s=o.nextSibling,c=r.nextSibling,g=c.firstChild,_=g.nextSibling,v=c.nextSibling,y=v.firstChild,b=y.nextSibling,[x,C]=m(b.nextSibling),w=v.nextSibling.firstChild,E=w.nextSibling;return t.addEventListener(`submit`,A),u(o,()=>n(`resources.name`)),s.$$input=t=>S({...e(),name:t.currentTarget.value}),u(g,()=>n(`resources.slug`)),_.$$input=t=>S({...e(),slug:t.currentTarget.value}),u(y,()=>n(`access.permissions`)),u(v,i(I,{get value(){return e().permissions??[]},onChange:t=>S({...e(),permissions:t})}),x,C),w.$$click=()=>S(null),u(w,()=>n(`common.cancel`)),u(E,(()=>{var e=h(()=>!!T());return()=>e()?n(`common.loading`):n(`common.save`)})()),a(e=>{var t=n(`resources.name`),r=n(`resources.slug`),i=T();return t!==e.e&&p(s,`placeholder`,e.e=t),r!==e.t&&p(_,`placeholder`,e.t=r),i!==e.a&&d(E,`disabled`,e.a=i),e},{e:void 0,t:void 0,a:void 0}),a(()=>d(s,`value`,e().name??``)),a(()=>d(_,`value`,e().slug??``)),l(),t})()})}}),ne,re),u(Q,()=>n(`access.tenants`)),$.$$click=()=>w({name:``,slug:``}),u($,()=>n(`common.create`),ae,oe),u(le,()=>n(`resources.name`)),u(ue,()=>n(`resources.slug`)),u(de,()=>n(`common.status`)),u(fe,i(o,{get each(){return g()},children:e=>(()=>{var t=f(H),r=t.firstChild,i=r.nextSibling,a=i.firstChild,o=i.nextSibling,s=o.nextSibling.firstChild,c=s.nextSibling;return u(r,()=>e.name),u(a,()=>e.slug),u(o,()=>e.status),s.$$click=()=>w({...e}),u(s,()=>n(`common.edit`)),c.$$click=()=>e.id&&void v.deleteTenant(e.id).then(k),u(c,()=>n(`common.delete`)),l(),t})()})),u(X,i(y,{get open(){return C()!==null},onClose:()=>w(null),get title(){return h(()=>!!C()?.id)()?n(`access.editTenant`):n(`access.newTenant`)},get children(){return i(t,{get when(){return C()},children:e=>(()=>{var t=f(U),r=t.firstChild,i=r.firstChild,o=i.nextSibling,s=r.nextSibling,c=s.firstChild,m=c.nextSibling,g=s.nextSibling,_=g.firstChild,v=_.nextSibling,y=g.nextSibling.firstChild,b=y.nextSibling;return t.addEventListener(`submit`,ee),u(i,()=>n(`resources.name`)),o.$$input=t=>w({...e(),name:t.currentTarget.value}),u(c,()=>n(`resources.slug`)),m.$$input=t=>w({...e(),slug:t.currentTarget.value}),u(_,()=>n(`access.domain`)),v.$$input=t=>w({...e(),domain:t.currentTarget.value}),y.$$click=()=>w(null),u(y,()=>n(`common.cancel`)),u(b,(()=>{var e=h(()=>!!T());return()=>e()?n(`common.loading`):n(`common.save`)})()),a(e=>{var t=n(`resources.name`),r=n(`resources.slug`),i=n(`access.domain`),a=T();return t!==e.e&&p(o,`placeholder`,e.e=t),r!==e.t&&p(m,`placeholder`,e.t=r),i!==e.a&&p(v,`placeholder`,e.a=i),a!==e.o&&d(b,`disabled`,e.o=a),e},{e:void 0,t:void 0,a:void 0,o:void 0}),a(()=>d(o,`value`,e().name??``)),a(()=>d(m,`value`,e().slug??``)),a(()=>d(v,`value`,e().domain??``)),l(),t})()})}}),me,he),l(),e})()}c([`click`,`input`]);export{W as AccessManager};
1
+ import{S as e,a as t,f as n,h as r,l as i,p as a,r as o}from"./solid.Ck4Vtfe4.js";import{_ as s,a as c,f as l,l as u,m as d,o as f,p,s as m,u as h,v as g}from"./web.DD6VKaIp.js";import{n as _}from"./i18n.A82w5XQu.js";import{n as v}from"./api.53l1ob4Z.js";import{t as y}from"./Modal.572hmVvb.js";import{t as b}from"./FloatingPanel.BetdW5N2.js";var x=s(`<input type=search class="input permission-picker__search">`),S=s(`<div class=permission-picker__matrix role=presentation><div class="permission-picker__row permission-picker__row--head"role=presentation><span class=permission-picker__resource></span><!$><!/><!$><!/></div><!$><!/>`),C=s(`<div class=permission-picker__custom><p class=permission-picker__custom-label></p><div class=permission-picker__chips><!$><!/><form class=permission-picker__custom-form><input class="input permission-picker__custom-input"><button class="btn btn-secondary btn-sm"type=submit>`),w=s(`<p class=icon-picker__count>`),T=s(`<div class=permission-picker><button type=button class="input permission-picker__trigger"aria-haspopup=dialog><span class=permission-picker__value></span><span class=icon-picker__caret aria-hidden=true></span></button><!$><!/>`),E=s(`<span class=permission-picker__action-label>`),D=s(`<p class=permission-picker__empty>`),O=s(`<div class=permission-picker__row><span class=permission-picker__resource></span><!$><!/>`),k=s(`<label class=permission-picker__cell><input type=checkbox><span aria-hidden=true>✓`),A=s(`<span class="permission-picker__cell permission-picker__cell--empty">`),ee=s(`<span class=permission-picker__chip><code></code><button type=button>×`),j=[`read`,`create`,`update`,`delete`],M=[`content`,`media`,`category`,`tag`,`menu`,`user`,`roles`,`theme`,`plugin`,`setting`,`webhook`,`tenants`,`audit`,`build`,`system`],N={media:[`upload`]},P=(e,t)=>`${e}:${t}`,F=e=>{let[t,n]=e.split(`:`);return!t||!n?!1:j.includes(t)&&M.includes(n)};function I(e){let{t:s}=_(),[c,h]=r(!1),[v,y]=r(``),[I,L]=r(``),[R,z]=r(void 0),B=n(()=>new Set(e.value)),V=n(()=>e.value.filter(e=>!F(e))),H=n(()=>{let e=v().trim().toLowerCase();return e?M.filter(t=>t.includes(e)||s(`access.resources.${t}`).toLowerCase().includes(e)):M}),U=n(()=>{let e=new Set;for(let t of H())for(let n of N[t]??[])e.add(n);return[...e]}),W=(e,t)=>j.includes(e)||(N[t]??[]).includes(e),G=(t,n)=>{let r=P(t,n);e.onChange(B().has(r)?e.value.filter(e=>e!==r):[...e.value,r])},K=t=>{e.onChange(e.value.filter(e=>e!==t))},q=()=>{let t=I().trim().toLowerCase().replace(/\s+/g,`-`);t&&!B().has(t)&&e.onChange([...e.value,t]),L(``)},J=()=>{let t=e.value.length;if(t===0)return e.placeholder??s(`access.permissionsPlaceholder`);let n=new Set(e.value.map(e=>e.split(`:`)[1]??e));return s(`access.permissionsSummary`,{resources:n.size,count:t})};return(()=>{var n=f(T),r=n.firstChild,_=r.firstChild,M=_.nextSibling,N=r.nextSibling,[F,Y]=m(N.nextSibling);return r.$$click=()=>h(!c()),g(z,r),u(_,J),u(M,()=>c()?`▴`:`▾`),u(n,i(b,{get open(){return c()},get trigger(){return R()},onClose:()=>h(!1),class:`permission-picker__panel`,role:`dialog`,get"aria-label"(){return s(`access.permissions`)},minWidth:440,get children(){return[(()=>{var t=f(x);return t.$$input=e=>y(e.currentTarget.value),a(()=>p(t,`placeholder`,e.searchPlaceholder??s(`access.permissionSearch`))),a(()=>d(t,`value`,v())),l(),t})(),(()=>{var e=f(S),t=e.firstChild,n=t.firstChild.nextSibling,[r,c]=m(n.nextSibling),l=r.nextSibling,[h,g]=m(l.nextSibling),_=t.nextSibling,[v,y]=m(_.nextSibling);return u(t,i(o,{each:j,children:e=>(()=>{var t=f(E);return u(t,e),t})()}),r,c),u(t,i(o,{get each(){return U()},children:e=>(()=>{var t=f(E);return u(t,e),t})()}),h,g),u(e,i(o,{get each(){return H()},get fallback(){return(()=>{var e=f(D);return u(e,()=>s(`access.permissionNoMatches`)),e})()},children:e=>(()=>{var t=f(O),n=t.firstChild,r=n.nextSibling,[c,l]=m(r.nextSibling);return p(n,`title`,e),u(n,()=>s(`access.resources.${e}`)),u(t,i(o,{get each(){return[...j,...U()]},children:t=>W(t,e)?(()=>{var n=f(k),r=n.firstChild;return p(n,`title`,`${t}:${e}`),r.addEventListener(`change`,()=>G(t,e)),a(()=>n.classList.toggle(`is-checked`,!!B().has(P(t,e)))),a(()=>d(r,`checked`,B().has(P(t,e)))),n})():f(A)}),c,l),t})()}),v,y),e})(),(()=>{var e=f(C),t=e.firstChild,n=t.nextSibling,r=n.firstChild,[c,h]=m(r.nextSibling),g=c.nextSibling,_=g.firstChild,v=_.nextSibling;return u(t,()=>s(`access.customPermissions`)),u(n,i(o,{get each(){return V()},children:e=>(()=>{var t=f(ee),n=t.firstChild,r=n.nextSibling;return u(n,e),r.$$click=()=>K(e),a(()=>p(r,`aria-label`,`${s(`common.remove`)}: ${e}`)),l(),t})()}),c,h),g.addEventListener(`submit`,e=>{e.preventDefault(),q()}),_.$$input=e=>L(e.currentTarget.value),u(v,()=>s(`common.add`)),a(()=>p(_,`placeholder`,s(`access.customPermission`))),a(()=>d(_,`value`,I())),l(),e})(),i(t,{get when(){return e.value.length>0},get children(){var t=f(w);return u(t,()=>s(`access.permissionsSelected`,{count:e.value.length})),t}})]}}),F,Y),a(t=>{var n=c(),i=e.value.length===0;return n!==t.e&&p(r,`aria-expanded`,t.e=n),i!==t.t&&_.classList.toggle(`is-empty`,t.t=i),t},{e:void 0,t:void 0}),l(),n})()}c([`click`,`input`]);var L=s(`<div class="notice notice--error">`),R=s(`<div class=resource-hub><!$><!/><div class=access-grid><section class=card><div class=card-header-row><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button></div><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/></section><section class=card><div class=card-header-row><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button></div><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/>`),z=s(`<button class="btn btn-danger btn-sm"type=button>`),B=s(`<tr><td></td><td><code></code></td><td class=access-permissions-cell></td><td class=access-actions><button class="btn btn-secondary btn-sm"type=button></button><!$><!/>`),V=s(`<form class=resource-form><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input required></label><div class=resource-form__field><span class=resource-form__label></span><!$><!/></div><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit>`),H=s(`<tr><td></td><td><code></code></td><td></td><td class=access-actions><button class="btn btn-secondary btn-sm"type=button></button><button class="btn btn-danger btn-sm"type=button>`),U=s(`<form class=resource-form><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input></label><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit>`);function W(){let{t:n}=_(),[s,c]=r([]),[g,b]=r([]),[x,S]=r(null),[C,w]=r(null),[T,E]=r(!1),[D,O]=r(``),k=async()=>{try{c(await v.listRoles()),b((await v.listTenants({limit:100})).data??[])}catch(e){O(e instanceof Error?e.message:String(e))}};e(k);let A=e=>{e.preventDefault();let t=x();t&&(E(!0),(t.id?v.updateRole(t.id,t):v.createRole(t)).then(()=>(S(null),k())).catch(e=>O(e instanceof Error?e.message:String(e))).finally(()=>E(!1)))},ee=e=>{e.preventDefault();let t=C();t&&(E(!0),(t.id?v.updateTenant(t.id,t):v.createTenant(t)).then(()=>(w(null),k())).catch(e=>O(e instanceof Error?e.message:String(e))).finally(()=>E(!1)))},j=e=>{let t=e.permissions??[];return t.length===0?`—`:t.slice(0,4).join(`, `)+(t.length>4?` +${t.length-4}`:``)};return(()=>{var e=f(R),r=e.firstChild,[c,_]=m(r.nextSibling),b=c.nextSibling.firstChild,E=b.firstChild,O=E.firstChild,M=O.nextSibling,N=M.firstChild.nextSibling,[P,F]=m(N.nextSibling),W=E.nextSibling,G=W.firstChild,K=G.firstChild.firstChild,q=K.nextSibling,J=q.nextSibling,Y=G.nextSibling,te=W.nextSibling,[ne,re]=m(te.nextSibling),X=b.nextSibling,Z=X.firstChild,Q=Z.firstChild,$=Q.nextSibling,ie=$.firstChild.nextSibling,[ae,oe]=m(ie.nextSibling),se=Z.nextSibling,ce=se.firstChild,le=ce.firstChild.firstChild,ue=le.nextSibling,de=ue.nextSibling,fe=ce.nextSibling,pe=se.nextSibling,[me,he]=m(pe.nextSibling);return u(e,i(t,{get when(){return D()},get children(){var e=f(L);return u(e,D),e}}),c,_),u(O,()=>n(`access.roles`)),M.$$click=()=>S({name:``,slug:``,permissions:[]}),u(M,()=>n(`common.create`),P,F),u(K,()=>n(`resources.name`)),u(q,()=>n(`resources.slug`)),u(J,()=>n(`access.permissions`)),u(Y,i(o,{get each(){return s()},children:e=>(()=>{var r=f(B),o=r.firstChild,s=o.nextSibling,c=s.firstChild,d=s.nextSibling,h=d.nextSibling,g=h.firstChild,_=g.nextSibling,[y,b]=m(_.nextSibling);return u(o,()=>e.name),u(c,()=>e.slug),u(d,()=>j(e)),g.$$click=()=>S({...e,permissions:[...e.permissions??[]]}),u(g,()=>n(`common.edit`)),u(h,i(t,{get when(){return!e.is_system},get children(){var t=f(z);return t.$$click=()=>void v.deleteRole(e.id).then(k),u(t,()=>n(`common.delete`)),l(),t}}),y,b),a(()=>p(d,`title`,(e.permissions??[]).join(`, `))),l(),r})()})),u(b,i(y,{get open(){return x()!==null},onClose:()=>S(null),get title(){return h(()=>!!x()?.id)()?n(`access.editRole`):n(`access.newRole`)},get children(){return i(t,{get when(){return x()},children:e=>(()=>{var t=f(V),r=t.firstChild,o=r.firstChild,s=o.nextSibling,c=r.nextSibling,g=c.firstChild,_=g.nextSibling,v=c.nextSibling,y=v.firstChild,b=y.nextSibling,[x,C]=m(b.nextSibling),w=v.nextSibling.firstChild,E=w.nextSibling;return t.addEventListener(`submit`,A),u(o,()=>n(`resources.name`)),s.$$input=t=>S({...e(),name:t.currentTarget.value}),u(g,()=>n(`resources.slug`)),_.$$input=t=>S({...e(),slug:t.currentTarget.value}),u(y,()=>n(`access.permissions`)),u(v,i(I,{get value(){return e().permissions??[]},onChange:t=>S({...e(),permissions:t})}),x,C),w.$$click=()=>S(null),u(w,()=>n(`common.cancel`)),u(E,(()=>{var e=h(()=>!!T());return()=>e()?n(`common.loading`):n(`common.save`)})()),a(e=>{var t=n(`resources.name`),r=n(`resources.slug`),i=T();return t!==e.e&&p(s,`placeholder`,e.e=t),r!==e.t&&p(_,`placeholder`,e.t=r),i!==e.a&&d(E,`disabled`,e.a=i),e},{e:void 0,t:void 0,a:void 0}),a(()=>d(s,`value`,e().name??``)),a(()=>d(_,`value`,e().slug??``)),l(),t})()})}}),ne,re),u(Q,()=>n(`access.tenants`)),$.$$click=()=>w({name:``,slug:``}),u($,()=>n(`common.create`),ae,oe),u(le,()=>n(`resources.name`)),u(ue,()=>n(`resources.slug`)),u(de,()=>n(`common.status`)),u(fe,i(o,{get each(){return g()},children:e=>(()=>{var t=f(H),r=t.firstChild,i=r.nextSibling,a=i.firstChild,o=i.nextSibling,s=o.nextSibling.firstChild,c=s.nextSibling;return u(r,()=>e.name),u(a,()=>e.slug),u(o,()=>e.status),s.$$click=()=>w({...e}),u(s,()=>n(`common.edit`)),c.$$click=()=>e.id&&void v.deleteTenant(e.id).then(k),u(c,()=>n(`common.delete`)),l(),t})()})),u(X,i(y,{get open(){return C()!==null},onClose:()=>w(null),get title(){return h(()=>!!C()?.id)()?n(`access.editTenant`):n(`access.newTenant`)},get children(){return i(t,{get when(){return C()},children:e=>(()=>{var t=f(U),r=t.firstChild,i=r.firstChild,o=i.nextSibling,s=r.nextSibling,c=s.firstChild,m=c.nextSibling,g=s.nextSibling,_=g.firstChild,v=_.nextSibling,y=g.nextSibling.firstChild,b=y.nextSibling;return t.addEventListener(`submit`,ee),u(i,()=>n(`resources.name`)),o.$$input=t=>w({...e(),name:t.currentTarget.value}),u(c,()=>n(`resources.slug`)),m.$$input=t=>w({...e(),slug:t.currentTarget.value}),u(_,()=>n(`access.domain`)),v.$$input=t=>w({...e(),domain:t.currentTarget.value}),y.$$click=()=>w(null),u(y,()=>n(`common.cancel`)),u(b,(()=>{var e=h(()=>!!T());return()=>e()?n(`common.loading`):n(`common.save`)})()),a(e=>{var t=n(`resources.name`),r=n(`resources.slug`),i=n(`access.domain`),a=T();return t!==e.e&&p(o,`placeholder`,e.e=t),r!==e.t&&p(m,`placeholder`,e.t=r),i!==e.a&&p(v,`placeholder`,e.a=i),a!==e.o&&d(b,`disabled`,e.o=a),e},{e:void 0,t:void 0,a:void 0,o:void 0}),a(()=>d(o,`value`,e().name??``)),a(()=>d(m,`value`,e().slug??``)),a(()=>d(v,`value`,e().domain??``)),l(),t})()})}}),me,he),l(),e})()}c([`click`,`input`]);export{W as AccessManager};
@@ -1 +1 @@
1
- import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as c,l,m as u,o as d,p as f,s as p,u as m}from"./web.DD6VKaIp.js";import{n as h}from"./i18n.BFBHzd3w.js";import{n as g}from"./api.53l1ob4Z.js";var _=o(`<div class="notice notice--error">`),v=o(`<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 class=checkbox-label><input type=checkbox> <!$><!/></label></div><fieldset><legend></legend><!$><!/></fieldset><button type=submit class="btn btn-primary"></button></form><div class="card settings-table-card"><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody>`),y=o(`<label><input type=checkbox> <!$><!/> (<!$><!/>)`),b=o(`<button type=button class="btn btn-danger">`),x=o(`<tr><td><!$><!/> (<!$><!/>)</td><td></td><td></td><td>`),ee=o(`<label style=margin-right:0.75rem><input type=checkbox> <!$><!/>`);function S(){let{t:o}=h(),[s,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))}};e(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 e=d(v),n=e.firstChild,[h,g]=p(n.nextSibling),S=h.nextSibling,w=S.firstChild,E=w.nextSibling,O=E.firstChild,j=O.firstChild,[F,I]=p(j.nextSibling),L=F.nextSibling,R=O.nextSibling,z=R.firstChild,[B,V]=p(z.nextSibling),H=B.nextSibling,U=R.nextSibling,W=U.firstChild,G=W.nextSibling.nextSibling,[K,q]=p(G.nextSibling),J=E.nextSibling,Y=J.firstChild,te=Y.nextSibling,[ne,re]=p(te.nextSibling),X=J.nextSibling,Z=S.nextSibling.firstChild.firstChild,Q=Z.firstChild.firstChild,$=Q.nextSibling,ie=$.nextSibling,ae=Z.nextSibling;return l(e,r(t,{get when(){return T()},get children(){var e=d(_);return l(e,T),e}}),h,g),S.addEventListener(`submit`,M),l(w,()=>o(`settings.taxonomies.form.title`)),l(O,()=>o(`settings.taxonomies.form.name`),F,I),L.$$input=e=>A({...k(),name:e.currentTarget.value}),l(R,()=>o(`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})),l(U,()=>o(`settings.taxonomies.form.hierarchical`),K,q),l(Y,()=>o(`settings.taxonomies.form.attachTo`)),l(J,r(a,{get each(){return C()},children:e=>(()=>{var t=d(y),n=t.firstChild,r=n.nextSibling.nextSibling,[a,o]=p(r.nextSibling),s=a.nextSibling.nextSibling,[c,f]=p(s.nextSibling);return c.nextSibling,n.addEventListener(`change`,t=>A({...k(),attachTo:t.currentTarget.checked?[...k().attachTo,e.slug]:k().attachTo.filter(t=>t!==e.slug)})),l(t,()=>e.pluralLabel,a,o),l(t,()=>e.slug,c,f),i(()=>u(n,`checked`,k().attachTo.includes(e.slug))),t})()}),ne,re),l(X,()=>o(`settings.taxonomies.form.create`)),l(Q,()=>o(`settings.taxonomies.table.taxonomy`)),l($,()=>o(`settings.taxonomies.table.hierarchical`)),l(ie,()=>o(`settings.taxonomies.table.attachedTypes`)),l(ae,r(a,{get each(){return s()},children:e=>(()=>{var n=d(x),s=n.firstChild,f=s.firstChild,[h,g]=p(f.nextSibling),_=h.nextSibling.nextSibling,[v,y]=p(_.nextSibling);v.nextSibling;var S=s.nextSibling,w=S.nextSibling,T=w.nextSibling;return l(s,()=>e.name,h,g),l(s,()=>e.slug,v,y),l(S,(()=>{var t=m(()=>!!e.hierarchical);return()=>t()?o(`common.yes`):o(`common.no`)})()),l(w,r(a,{get each(){return C()},children:t=>(()=>{var n=d(ee),r=n.firstChild,a=r.nextSibling.nextSibling,[o,s]=p(a.nextSibling);return r.addEventListener(`change`,()=>N(e,t.slug)),l(n,()=>t.slug,o,s),i(()=>u(r,`checked`,e.attachTo?.includes(t.slug)??!1)),n})()})),l(T,r(t,{get when(){return e.source!==`CORE`},get children(){var t=d(b);return t.$$click=()=>P(e.slug),l(t,()=>o(`settings.taxonomies.table.actions.remove`)),c(),t}})),n})()})),i(e=>{var t=o(`settings.taxonomies.form.slugHint`),n=D();return t!==e.e&&f(H,`title`,e.e=t),n!==e.t&&u(X,`disabled`,e.t=n),e},{e:void 0,t:void 0}),i(()=>u(L,`value`,k().name)),i(()=>u(H,`value`,k().slug)),i(()=>u(W,`checked`,k().hierarchical)),c(),e})()}s([`input`,`click`]);export{S as TaxonomiesManager};
1
+ import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as c,l,m as u,o as d,p as f,s as p,u as m}from"./web.DD6VKaIp.js";import{n as h}from"./i18n.A82w5XQu.js";import{n as g}from"./api.53l1ob4Z.js";var _=o(`<div class="notice notice--error">`),v=o(`<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 class=checkbox-label><input type=checkbox> <!$><!/></label></div><fieldset><legend></legend><!$><!/></fieldset><button type=submit class="btn btn-primary"></button></form><div class="card settings-table-card"><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody>`),y=o(`<label><input type=checkbox> <!$><!/> (<!$><!/>)`),b=o(`<button type=button class="btn btn-danger">`),x=o(`<tr><td><!$><!/> (<!$><!/>)</td><td></td><td></td><td>`),ee=o(`<label style=margin-right:0.75rem><input type=checkbox> <!$><!/>`);function S(){let{t:o}=h(),[s,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))}};e(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 e=d(v),n=e.firstChild,[h,g]=p(n.nextSibling),S=h.nextSibling,w=S.firstChild,E=w.nextSibling,O=E.firstChild,j=O.firstChild,[F,I]=p(j.nextSibling),L=F.nextSibling,R=O.nextSibling,z=R.firstChild,[B,V]=p(z.nextSibling),H=B.nextSibling,U=R.nextSibling,W=U.firstChild,G=W.nextSibling.nextSibling,[K,q]=p(G.nextSibling),J=E.nextSibling,Y=J.firstChild,te=Y.nextSibling,[ne,re]=p(te.nextSibling),X=J.nextSibling,Z=S.nextSibling.firstChild.firstChild,Q=Z.firstChild.firstChild,$=Q.nextSibling,ie=$.nextSibling,ae=Z.nextSibling;return l(e,r(t,{get when(){return T()},get children(){var e=d(_);return l(e,T),e}}),h,g),S.addEventListener(`submit`,M),l(w,()=>o(`settings.taxonomies.form.title`)),l(O,()=>o(`settings.taxonomies.form.name`),F,I),L.$$input=e=>A({...k(),name:e.currentTarget.value}),l(R,()=>o(`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})),l(U,()=>o(`settings.taxonomies.form.hierarchical`),K,q),l(Y,()=>o(`settings.taxonomies.form.attachTo`)),l(J,r(a,{get each(){return C()},children:e=>(()=>{var t=d(y),n=t.firstChild,r=n.nextSibling.nextSibling,[a,o]=p(r.nextSibling),s=a.nextSibling.nextSibling,[c,f]=p(s.nextSibling);return c.nextSibling,n.addEventListener(`change`,t=>A({...k(),attachTo:t.currentTarget.checked?[...k().attachTo,e.slug]:k().attachTo.filter(t=>t!==e.slug)})),l(t,()=>e.pluralLabel,a,o),l(t,()=>e.slug,c,f),i(()=>u(n,`checked`,k().attachTo.includes(e.slug))),t})()}),ne,re),l(X,()=>o(`settings.taxonomies.form.create`)),l(Q,()=>o(`settings.taxonomies.table.taxonomy`)),l($,()=>o(`settings.taxonomies.table.hierarchical`)),l(ie,()=>o(`settings.taxonomies.table.attachedTypes`)),l(ae,r(a,{get each(){return s()},children:e=>(()=>{var n=d(x),s=n.firstChild,f=s.firstChild,[h,g]=p(f.nextSibling),_=h.nextSibling.nextSibling,[v,y]=p(_.nextSibling);v.nextSibling;var S=s.nextSibling,w=S.nextSibling,T=w.nextSibling;return l(s,()=>e.name,h,g),l(s,()=>e.slug,v,y),l(S,(()=>{var t=m(()=>!!e.hierarchical);return()=>t()?o(`common.yes`):o(`common.no`)})()),l(w,r(a,{get each(){return C()},children:t=>(()=>{var n=d(ee),r=n.firstChild,a=r.nextSibling.nextSibling,[o,s]=p(a.nextSibling);return r.addEventListener(`change`,()=>N(e,t.slug)),l(n,()=>t.slug,o,s),i(()=>u(r,`checked`,e.attachTo?.includes(t.slug)??!1)),n})()})),l(T,r(t,{get when(){return e.source!==`CORE`},get children(){var t=d(b);return t.$$click=()=>P(e.slug),l(t,()=>o(`settings.taxonomies.table.actions.remove`)),c(),t}})),n})()})),i(e=>{var t=o(`settings.taxonomies.form.slugHint`),n=D();return t!==e.e&&f(H,`title`,e.e=t),n!==e.t&&u(X,`disabled`,e.t=n),e},{e:void 0,t:void 0}),i(()=>u(L,`value`,k().name)),i(()=>u(H,`value`,k().slug)),i(()=>u(W,`checked`,k().hierarchical)),c(),e})()}s([`input`,`click`]);export{S as TaxonomiesManager};
@@ -0,0 +1 @@
1
+ import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as c,l,m as u,o as d,s as f,u as p}from"./web.DD6VKaIp.js";import{n as m}from"./i18n.A82w5XQu.js";import{n as h}from"./api.53l1ob4Z.js";import{t as g}from"./FieldRenderer.AYtSBfHZ.js";import{t as _}from"./clone.oDfZEkVn.js";var v=o(`<div class="notice notice--error">`),ee=o(`<div class=term-meta-fields><h4></h4><!$><!/>`),te=o(`<button class=btn type=button>`),ne=o(`<table class=table><thead><tr><th></th><th></th><th></th></tr></thead><tbody>`),y=o(`<div class=taxonomy-manager__layout><div class=taxonomy-manager__form-col><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><!$><!/></div></form></div><div class=taxonomy-manager__table-col><div class=card><div class=card-header><div><h3></h3><p class=muted></p></div><span class=badge></span></div><!$><!/>`),b=o(`<div class=taxonomy-manager><!$><!/><!$><!/><!$><!/>`),re=o(`<p class=muted>`),ie=o(`<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 x(o){let{t:s}=m(),[x,S]=n(null),[C,w]=n([]),[T,E]=n(``),[D,O]=n(``),[k,A]=n(``),[j,M]=n(null),[N,P]=n(``),[ae,F]=n(!1),[I,L]=n([]),[R,z]=n({}),B=async()=>{if(o.taxonomySlug)try{let[e,t]=await Promise.all([h.getTaxonomies(),h.getTaxonomyTerms(o.taxonomySlug)]);S(e.find(e=>e.slug===o.taxonomySlug)??null),w(t)}catch(e){P(e instanceof Error?e.message:String(e))}},V=async()=>{if(o.taxonomySlug)try{let e=await h.getFieldGroups({taxonomy:o.taxonomySlug}),t=await Promise.all(e.filter(e=>e.active).map(async e=>h.getFieldGroup(e.id)));L(_(t.flatMap(e=>e.fields??[])))}catch{L([])}};e(()=>{B(),V()});let H=()=>{M(null),E(``),O(``),A(``),z({})},oe=e=>{M(e.id??null),E(e.name),O(e.slug),A(e.description??``),z({...e.meta??{}}),P(``)},se=async e=>{e.preventDefault(),P(``),F(!0);try{let e=C().find(e=>e.id===j())?.meta??{},t={name:T(),slug:D()||void 0,description:k()||void 0,...I().length>0?{meta:{...e,...R()}}:{}};j()?await h.updateTaxonomyTerm(o.taxonomySlug,j(),t):await h.createTaxonomyTerm(o.taxonomySlug,t),H(),await B()}catch(e){P(e instanceof Error?e.message:String(e))}finally{F(!1)}},ce=async e=>{if(e.id&&confirm(s(`content.taxonomy.confirmDelete`,{name:e.name})))try{await h.deleteTaxonomyTerm(o.taxonomySlug,e.id),await B()}catch(e){P(e instanceof Error?e.message:String(e))}};return(()=>{var e=d(b),n=e.firstChild,[m,h]=f(n.nextSibling),_=m.nextSibling,[S,w]=f(_.nextSibling),M=S.nextSibling,[P,F]=f(M.nextSibling);return l(e,r(t,{get when(){return N()},get children(){var e=d(v);return l(e,N),e}}),m,h),l(e,r(t,{get when(){return p(()=>!x())()&&o.taxonomySlug},get children(){var e=d(v);return l(e,()=>s(`content.taxonomy.notFound`)),e}}),S,w),l(e,r(t,{get when(){return x()},get children(){var e=d(y),n=e.firstChild,m=n.firstChild,h=m.firstChild,_=h.nextSibling,v=_.firstChild,[b,S]=f(v.nextSibling),w=b.nextSibling,M=_.nextSibling,N=M.firstChild,[P,F]=f(N.nextSibling),L=P.nextSibling,B=M.nextSibling,V=B.firstChild,[U,W]=f(V.nextSibling),G=U.nextSibling,le=B.nextSibling,[K,ue]=f(le.nextSibling),q=K.nextSibling,J=q.firstChild,de=J.nextSibling,[fe,Y]=f(de.nextSibling),X=n.nextSibling.firstChild,Z=X.firstChild,Q=Z.firstChild,$=Q.firstChild,pe=$.nextSibling,me=Q.nextSibling,he=Z.nextSibling,[ge,_e]=f(he.nextSibling);return m.addEventListener(`submit`,se),l(h,(()=>{var e=p(()=>!!j());return()=>e()?s(`content.taxonomy.editTerm`):s(`content.taxonomy.addTerm`)})()),l(_,()=>s(`content.taxonomy.name`),b,S),w.$$input=e=>E(e.currentTarget.value),l(M,()=>s(`content.taxonomy.slug`),P,F),L.$$input=e=>O(e.currentTarget.value),l(B,()=>s(`content.taxonomy.description`),U,W),G.$$input=e=>A(e.currentTarget.value),l(m,r(t,{get when(){return I().length>0},get children(){var e=d(ee),t=e.firstChild,n=t.nextSibling,[i,o]=f(n.nextSibling);return l(t,()=>s(`content.taxonomy.termFields`)),l(e,r(a,{get each(){return I()},children:e=>r(g,{field:e,get values(){return R()},onChange:(e,t)=>z({...R(),[e]:t}),t:s})}),i,o),e}}),K,ue),l(J,(()=>{var e=p(()=>!!j());return()=>e()?s(`common.save`):s(`content.taxonomy.add`)})()),l(q,r(t,{get when(){return j()},get children(){var e=d(te);return e.$$click=H,l(e,()=>s(`common.cancel`)),c(),e}}),fe,Y),l($,()=>x().name),l(pe,(()=>{var e=p(()=>!!o.contentType);return()=>e()?`${s(`content.taxonomy.attachedTo`)}: ${o.contentType}`:s(`content.taxonomy.descriptionHint`)})()),l(me,()=>C().length),l(X,r(t,{get when(){return C().length>0},get fallback(){return(()=>{var e=d(re);return l(e,()=>s(`content.taxonomy.empty`)),e})()},get children(){var e=d(ne),t=e.firstChild,n=t.firstChild.firstChild,i=n.nextSibling,o=t.nextSibling;return l(n,()=>s(`content.taxonomy.name`)),l(i,()=>s(`content.taxonomy.slug`)),l(o,r(a,{get each(){return C()},children:e=>(()=>{var t=d(ie),n=t.firstChild,r=n.nextSibling,i=r.nextSibling.firstChild,a=i.nextSibling.nextSibling;return l(n,()=>e.name),l(r,()=>e.slug),i.$$click=()=>oe(e),l(i,()=>s(`common.edit`)),a.$$click=()=>void ce(e),l(a,()=>s(`content.taxonomy.delete`)),c(),t})()})),e}}),ge,_e),i(()=>u(J,`disabled`,ae())),i(()=>u(w,`value`,T())),i(()=>u(L,`value`,D())),i(()=>u(G,`value`,k())),c(),e}}),P,F),e})()}s([`input`,`click`]);export{x as TaxonomyTermsManager};