@krantho/studio 1.0.1 → 1.0.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 (24) hide show
  1. package/dist/assets/{AssistantPanel-B7HETGhh.js → AssistantPanel-ECkcslXS.js} +1 -1
  2. package/dist/assets/{GraphBrowser-DIjsu_2L.js → GraphBrowser-BBKTzzRV.js} +2 -2
  3. package/dist/assets/{GraphCanvas-B1JM8f2x.js → GraphCanvas-Cct1E2As.js} +1 -1
  4. package/dist/assets/{api-seo-Cjv4a9Y_.js → api-seo-CwGP6Bi2.js} +1 -1
  5. package/dist/assets/{collection-view-CUWLWvwR.js → collection-view--erTGbRH.js} +1 -1
  6. package/dist/assets/{editor-page-jSK3xMkh.js → editor-page-XOJrwlcZ.js} +3 -3
  7. package/dist/assets/{fill-job-B-Z4jnVQ.js → fill-job-YPZFETW1.js} +1 -1
  8. package/dist/assets/{fill-run-view-Bx-nSvtd.js → fill-run-view-B6rnYhKS.js} +1 -1
  9. package/dist/assets/{graph-config-BJA_ztYM.js → graph-config-DKVGDPTG.js} +1 -1
  10. package/dist/assets/{image-editor-CEzh5OFw.js → image-editor-BX-DHJDa.js} +1 -1
  11. package/dist/assets/{index-qiIlvPyv.js → index-CEQ7ZdKC.js} +2 -2
  12. package/dist/assets/{live-markdown-editor-BGbJGFKJ.js → live-markdown-editor-DM8hYG3n.js} +29 -29
  13. package/dist/assets/{media-page-B3Q4EH3m.js → media-page-CeBC5FQS.js} +1 -1
  14. package/dist/assets/{pulse-page-HsxpGgEu.js → pulse-page-C00oCF2o.js} +1 -1
  15. package/dist/assets/{setup-page-DsYYpFrd.js → setup-page-BHJcTaTH.js} +1 -1
  16. package/dist/assets/{site-BfbIKOk1.js → site-BYsfQB_3.js} +1 -1
  17. package/dist/assets/{site-model-CoSgHHeY.js → site-model-C5bJvTbk.js} +1 -1
  18. package/dist/assets/{site-overview-BJNMesQZ.js → site-overview-5EhmXIR0.js} +1 -1
  19. package/dist/assets/{structure-page-ZD8c7Ukz.js → structure-page-9d9MG7vU.js} +2 -2
  20. package/dist/assets/{use-drawer-actions-D-rIBvJ8.js → use-drawer-actions-CR6Q0qdd.js} +1 -1
  21. package/dist/assets/{use-loaded-DFUDFVFt.js → use-loaded-BBFak2E1.js} +1 -1
  22. package/dist/assets/{use-locale-versions-DHt-x8c_.js → use-locale-versions-BycCbBLd.js} +1 -1
  23. package/dist/index.html +1 -1
  24. package/package.json +14 -14
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{s as t}from"./vendor-diff-DGCTJYJ4.js";import{t as n}from"./createLucideIcon-BklFHeMd.js";import{r,v as i}from"./api-seo-Cjv4a9Y_.js";import{f as a}from"./index-qiIlvPyv.js";var o={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};o.node;var s=n(o),c=e(t(),1),l={"meta-descriptions":`Meta description`,archetype:`Schema.org properties`},u=500,d=e=>new Promise(t=>setTimeout(t,e));async function f(e,t,n){for(;;){let i=await r(e);if(!t())return null;if(n(i),i.status!==`running`)return i;await d(u)}}async function p(e,t,n,r=()=>void 0,a=!1){let o=await i({type:e,force:a,...t});if(!o.jobId)return{state:`empty`,message:o.message??`Nothing to enrich`};let s=await f(o.jobId,n,r);return s?{state:`finished`,status:s}:null}var m={steps:[`meta-descriptions`,`archetype`],force:!1},h={steps:[`meta-descriptions`],force:!1},g={steps:m.steps,force:!0};function _(e,t){return`step ${e.steps.indexOf(t)+1} of ${e.steps.length}`}var v={state:`idle`},y=new Set;function b(e){v=e;for(let e of y)e()}function x(e){return y.add(e),()=>{y.delete(e)}}var S=()=>v;async function C(e,t){let n=[];for(let r of t.steps){let i=e=>({state:`running`,plan:t,step:r,status:e,done:[...n]});b(i(null));let a=await p(r,e,()=>!0,e=>b(i(e)),t.force);if(!a)throw Error(`${r} stopped without an answer`);n.push(a.state===`empty`?{step:r,empty:a.message,status:null}:{step:r,empty:null,status:a.status})}return n}function w(e,t,n=m){return v.state!==`running`&&(C(e,n).then(e=>b({state:`done`,plan:n,reports:e}),e=>{let t=v.state===`running`?v.done:[];b({state:`failed`,plan:n,message:a(e,`Enrichment failed`),reports:t})}).finally(()=>t(v)),!0)}function T(){v.state!==`running`&&b({state:`idle`})}function E(){return(0,c.useSyncExternalStore)(x,S,S)}export{w as a,l as c,T as i,p as l,g as n,_ as o,h as r,E as s,m as t,s as u};
1
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{s as t}from"./vendor-diff-DGCTJYJ4.js";import{t as n}from"./createLucideIcon-BklFHeMd.js";import{r,v as i}from"./api-seo-CwGP6Bi2.js";import{f as a}from"./index-CEQ7ZdKC.js";var o={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};o.node;var s=n(o),c=e(t(),1),l={"meta-descriptions":`Meta description`,archetype:`Schema.org properties`},u=500,d=e=>new Promise(t=>setTimeout(t,e));async function f(e,t,n){for(;;){let i=await r(e);if(!t())return null;if(n(i),i.status!==`running`)return i;await d(u)}}async function p(e,t,n,r=()=>void 0,a=!1){let o=await i({type:e,force:a,...t});if(!o.jobId)return{state:`empty`,message:o.message??`Nothing to enrich`};let s=await f(o.jobId,n,r);return s?{state:`finished`,status:s}:null}var m={steps:[`meta-descriptions`,`archetype`],force:!1},h={steps:[`meta-descriptions`],force:!1},g={steps:m.steps,force:!0};function _(e,t){return`step ${e.steps.indexOf(t)+1} of ${e.steps.length}`}var v={state:`idle`},y=new Set;function b(e){v=e;for(let e of y)e()}function x(e){return y.add(e),()=>{y.delete(e)}}var S=()=>v;async function C(e,t){let n=[];for(let r of t.steps){let i=e=>({state:`running`,plan:t,step:r,status:e,done:[...n]});b(i(null));let a=await p(r,e,()=>!0,e=>b(i(e)),t.force);if(!a)throw Error(`${r} stopped without an answer`);n.push(a.state===`empty`?{step:r,empty:a.message,status:null}:{step:r,empty:null,status:a.status})}return n}function w(e,t,n=m){return v.state!==`running`&&(C(e,n).then(e=>b({state:`done`,plan:n,reports:e}),e=>{let t=v.state===`running`?v.done:[];b({state:`failed`,plan:n,message:a(e,`Enrichment failed`),reports:t})}).finally(()=>t(v)),!0)}function T(){v.state!==`running`&&b({state:`idle`})}function E(){return(0,c.useSyncExternalStore)(x,S,S)}export{w as a,l as c,T as i,p as l,g as n,_ as o,h as r,E as s,m as t,s as u};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{o as t,s as n}from"./vendor-diff-DGCTJYJ4.js";import{u as r}from"./vendor-router-B4czwg8X.js";import{t as i}from"./format-C3ZX9yGM.js";import{c as a,o}from"./fill-job-B-Z4jnVQ.js";var s=e(n(),1),c=t(),l={ArrowRight:1,ArrowLeft:-1};function u(e,t,n){if(e===`Home`)return 0;if(e===`End`)return n-1;let r=l[e];return r===void 0?null:(t+r+n)%n}function d({label:e,tabs:t,current:n,tabId:i,panelId:a}){let o=r(),l=(0,s.useRef)(null);function d(e,t){e.id!==n&&o(e.path),t&&l.current?.querySelector(`#${CSS.escape(i(e.id))}`)?.focus()}function f(e){let r=t.findIndex(e=>e.id===n),i=u(e.key,r,t.length),a=i===null?void 0:t[i];a&&(e.preventDefault(),d(a,!0))}return(0,c.jsx)(`div`,{ref:l,role:`tablist`,"aria-label":e,className:`ui-tabs`,onKeyDown:f,children:t.map(e=>(0,c.jsx)(`button`,{id:i(e.id),type:`button`,role:`tab`,className:`ui-tab`,"aria-selected":e.id===n,"aria-controls":a,tabIndex:e.id===n?0:-1,onClick:()=>d(e,!1),children:e.label},e.id))})}var f=``;function p(e){return e===f?{scope:`all`}:{scope:`collection`,collection:e}}function m({collections:e,value:t,disabled:n,onChange:r}){let a=(0,s.useId)();return(0,c.jsxs)(`div`,{className:`fill-run-field`,children:[(0,c.jsx)(`label`,{htmlFor:a,children:`Scope`}),(0,c.jsxs)(`select`,{id:a,className:`fill-run-select`,value:t.scope===`all`?f:t.collection,disabled:n,onChange:e=>r(p(e.target.value)),children:[(0,c.jsx)(`option`,{value:f,children:`The whole site`}),e.map(e=>(0,c.jsxs)(`option`,{value:e.name,children:[i(e.name),` only`]},e.name))]})]})}function h(e,t){return e?t===`loading`?`Reading the AI provider…`:t===`missing`?`No language model is set up.`:null:`Enrichment is run by an admin.`}function g(e){if(e.empty!==null)return e.empty;let t=e.status?.items??[],n=e=>t.filter(t=>t.status===e).length,r=n(`error`);return`${n(`complete`)} filled, ${n(`skipped`)} already set or skipped${r>0?`, ${r} failed`:``}`}function _(e){let t=e?.usage;return t?[t.inputTokens+t.outputTokens>0?`${t.inputTokens.toLocaleString(`en`)} tokens in, ${t.outputTokens.toLocaleString(`en`)} out`:``,t.model??``].filter(Boolean).join(` · `):``}function v(e){switch(e.state){case`running`:{let t=o(e.plan,e.step),n=`${t.charAt(0).toUpperCase()}${t.slice(1)}, ${a[e.step]}`,r=e.status?.progress;if(!r)return`${n}: starting…`;let i=r.completed+r.skipped+r.errors,s=r.current?`, now ${r.current}`:``;return`${n}: ${i} of ${r.total} documents${s}…`}case`done`:return`Finished. ${e.reports.map(e=>`${a[e.step]}: ${g(e)}`).join(`. `)}.`;case`failed`:return`Enrichment failed: ${e.message}`;default:return``}}function y({reports:e}){return(0,c.jsx)(`ul`,{className:`fill-run-reports`,children:e.map(e=>(0,c.jsxs)(`li`,{children:[(0,c.jsx)(`strong`,{children:a[e.step]}),` · `,g(e),_(e.status)!==``&&(0,c.jsxs)(`span`,{className:`fill-run-usage`,children:[` · `,_(e.status)]}),(e.status?.items.length??0)>0&&(0,c.jsxs)(`details`,{className:`fill-run-disclosure`,children:[(0,c.jsx)(`summary`,{children:`Each document`}),(0,c.jsx)(`ul`,{className:`fill-run-items`,children:e.status?.items.map(e=>(0,c.jsxs)(`li`,{children:[(0,c.jsxs)(`code`,{children:[e.collection,`/`,e.slug]}),` `,`· `,e.status,e.result||e.error?` · ${e.result??e.error}`:``]},`${e.collection}/${e.slug}`))})]})]},e.step))})}function b({run:e}){let t=e.state===`running`?e.done:e.state===`idle`?[]:e.reports;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`p`,{className:`fill-run-note`,role:`status`,children:v(e)}),t.length>0&&(0,c.jsx)(y,{reports:t})]})}export{d as i,m as n,h as r,b as t};
1
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{o as t,s as n}from"./vendor-diff-DGCTJYJ4.js";import{u as r}from"./vendor-router-B4czwg8X.js";import{t as i}from"./format-C3ZX9yGM.js";import{c as a,o}from"./fill-job-YPZFETW1.js";var s=e(n(),1),c=t(),l={ArrowRight:1,ArrowLeft:-1};function u(e,t,n){if(e===`Home`)return 0;if(e===`End`)return n-1;let r=l[e];return r===void 0?null:(t+r+n)%n}function d({label:e,tabs:t,current:n,tabId:i,panelId:a}){let o=r(),l=(0,s.useRef)(null);function d(e,t){e.id!==n&&o(e.path),t&&l.current?.querySelector(`#${CSS.escape(i(e.id))}`)?.focus()}function f(e){let r=t.findIndex(e=>e.id===n),i=u(e.key,r,t.length),a=i===null?void 0:t[i];a&&(e.preventDefault(),d(a,!0))}return(0,c.jsx)(`div`,{ref:l,role:`tablist`,"aria-label":e,className:`ui-tabs`,onKeyDown:f,children:t.map(e=>(0,c.jsx)(`button`,{id:i(e.id),type:`button`,role:`tab`,className:`ui-tab`,"aria-selected":e.id===n,"aria-controls":a,tabIndex:e.id===n?0:-1,onClick:()=>d(e,!1),children:e.label},e.id))})}var f=``;function p(e){return e===f?{scope:`all`}:{scope:`collection`,collection:e}}function m({collections:e,value:t,disabled:n,onChange:r}){let a=(0,s.useId)();return(0,c.jsxs)(`div`,{className:`fill-run-field`,children:[(0,c.jsx)(`label`,{htmlFor:a,children:`Scope`}),(0,c.jsxs)(`select`,{id:a,className:`fill-run-select`,value:t.scope===`all`?f:t.collection,disabled:n,onChange:e=>r(p(e.target.value)),children:[(0,c.jsx)(`option`,{value:f,children:`The whole site`}),e.map(e=>(0,c.jsxs)(`option`,{value:e.name,children:[i(e.name),` only`]},e.name))]})]})}function h(e,t){return e?t===`loading`?`Reading the AI provider…`:t===`missing`?`No language model is set up.`:null:`Enrichment is run by an admin.`}function g(e){if(e.empty!==null)return e.empty;let t=e.status?.items??[],n=e=>t.filter(t=>t.status===e).length,r=n(`error`);return`${n(`complete`)} filled, ${n(`skipped`)} already set or skipped${r>0?`, ${r} failed`:``}`}function _(e){let t=e?.usage;return t?[t.inputTokens+t.outputTokens>0?`${t.inputTokens.toLocaleString(`en`)} tokens in, ${t.outputTokens.toLocaleString(`en`)} out`:``,t.model??``].filter(Boolean).join(` · `):``}function v(e){switch(e.state){case`running`:{let t=o(e.plan,e.step),n=`${t.charAt(0).toUpperCase()}${t.slice(1)}, ${a[e.step]}`,r=e.status?.progress;if(!r)return`${n}: starting…`;let i=r.completed+r.skipped+r.errors,s=r.current?`, now ${r.current}`:``;return`${n}: ${i} of ${r.total} documents${s}…`}case`done`:return`Finished. ${e.reports.map(e=>`${a[e.step]}: ${g(e)}`).join(`. `)}.`;case`failed`:return`Enrichment failed: ${e.message}`;default:return``}}function y({reports:e}){return(0,c.jsx)(`ul`,{className:`fill-run-reports`,children:e.map(e=>(0,c.jsxs)(`li`,{children:[(0,c.jsx)(`strong`,{children:a[e.step]}),` · `,g(e),_(e.status)!==``&&(0,c.jsxs)(`span`,{className:`fill-run-usage`,children:[` · `,_(e.status)]}),(e.status?.items.length??0)>0&&(0,c.jsxs)(`details`,{className:`fill-run-disclosure`,children:[(0,c.jsx)(`summary`,{children:`Each document`}),(0,c.jsx)(`ul`,{className:`fill-run-items`,children:e.status?.items.map(e=>(0,c.jsxs)(`li`,{children:[(0,c.jsxs)(`code`,{children:[e.collection,`/`,e.slug]}),` `,`· `,e.status,e.result||e.error?` · ${e.result??e.error}`:``]},`${e.collection}/${e.slug}`))})]})]},e.step))})}function b({run:e}){let t=e.state===`running`?e.done:e.state===`idle`?[]:e.reports;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`p`,{className:`fill-run-note`,role:`status`,children:v(e)}),t.length>0&&(0,c.jsx)(y,{reports:t})]})}export{d as i,m as n,h as r,b as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{o as t,s as n}from"./vendor-diff-DGCTJYJ4.js";import{n as r,t as i}from"./createLucideIcon-BklFHeMd.js";import{n as a}from"./use-loaded-DFUDFVFt.js";import{t as o}from"./copy-V85khWct.js";import{t as s}from"./corner-down-right-BpwOGRFR.js";import{a as c}from"./findability-BrhtZ2yD.js";import{t as l}from"./layers-0VWe0rKm.js";import{T as u,c as ee,ct as d}from"./index-qiIlvPyv.js";import{t as f}from"./guards-BFEDbduR.js";var p={name:`calculator`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`line`,{x1:`8`,x2:`16`,y1:`6`,y2:`6`,key:`x4nwl0`}],[`line`,{x1:`16`,x2:`16`,y1:`14`,y2:`18`,key:`wjye3r`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]};p.node;var te=i(p),m={name:`circle-minus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]],aliases:[`minus-circle`]};m.node;var ne=i(m),h={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};h.node;var g=i(h),_={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};_.node;var v=i(_),y={name:`panels-top-left`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]],aliases:[`layout`]};y.node;var b=i(y),x={name:`route`,size:24,node:[[`path`,{d:`M9 5h8.5a1 1 0 010 7h-11a1 1 0 000 7H15`,key:`1r1aam`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`circle`,{cx:`6`,cy:`5`,r:`3`,key:`151irh`}]]};x.node;var S=i(x),C=e(n(),1),w=t(),T={business:`Business & Organization`,content:`Content`,commerce:`Commerce & Services`,people:`People & Events`,navigation:`Navigation & Structure`,reviews:`Reviews & Ratings`},E=new Set(Object.keys(T)),D=new Set([`WebPage`,`AboutPage`,`CheckoutPage`,`CollectionPage`,`ContactPage`,`FAQPage`,`ItemPage`,`MedicalWebPage`,`ProfilePage`,`QAPage`,`RealEstateListing`,`SearchResultsPage`]);function re(e){let t=ie(e),n=[];for(let e of t)ae(e)&&n.push(e);z(n);let r=B(n),i=oe(n);return{nodes:n,byEk:r,byId:i,referencedBy:O(n),primary:se(n,i)}}function ie(e){if(e==null)return[];if(Array.isArray(e))return e;if(typeof e!=`object`)return[];let t=e,n=t[`@graph`];return Array.isArray(n)?n:`@type`in t?[t]:[]}function ae(e){return typeof e!=`object`||!e||Array.isArray(e)?!1:`@type`in e}function oe(e){let t=new Map;for(let n of e){let e=n[`@id`];typeof e==`string`&&t.set(e,n)}return t}function O(e){let t=new Map;for(let n of e)for(let[e,r]of Object.entries(n))if(e!==`@type`&&e!==`@id`&&e!==`@context`&&e!==`_ek`)for(let i of k(r)){let r=t.get(i);r||(r=[],t.set(i,r)),r.push({source:n,property:e})}return t}function k(e){if(typeof e!=`object`||!e)return[];if(Array.isArray(e)){let t=[];for(let n of e)for(let e of k(n))t.push(e);return t}let t=e,n=t[`@id`];if(typeof n==`string`)return[n];let r=[];for(let e of Object.values(t))for(let t of k(e))r.push(t);return r}function se(e,t){let n=e.find(e=>ce(e));if(!n)return null;let r=I(n.mainEntity);return r===void 0?null:t.get(r)??null}function ce(e){let t=A(e[`@type`]);return t!==null&&D.has(t)}function A(e){return typeof e==`string`?e:Array.isArray(e)&&e.length>0&&typeof e[0]==`string`?e[0]:null}function j(e,t){let n=[],r=[],i=[];for(let a of e.nodes){let e=A(a[`@type`]);e!==null&&(D.has(e)?r.push(a):t.has(e)?n.push(a):i.push(a))}let a=r[0]??null,o=e.primary??i[0]??null;return{siteContext:n,page:a,primary:o,linked:i.filter(e=>e!==o)}}function M(e,t){let n=A(e[`@type`]);if(n===null)return null;let r=t.find(e=>e.type===n);return r&&E.has(r.category)?r.category:null}function N(e,t){let n=new Set;for(let t of Object.keys(e))t!==`@type`&&t!==`@id`&&t!==`@context`&&t!==`_ek`&&n.add(t);if(t)for(let e of t.properties)n.add(e.property);let r=new Map;if(t)for(let e of t.properties)r.set(e.property,e);let i=[];for(let t of n){let n=e[t],a=r.get(t),o=a?.importance??`unknown`,s=P(n)?`set`:`missing`,c=F(n),l=c?I(n):void 0,u={property:t,value:n,importance:o,state:s,isReference:c,...a?{def:a}:{},...l===void 0?{}:{referenceId:l}};i.push(u)}return i}function P(e){return!(e==null||e===``||Array.isArray(e)&&e.length===0)}function F(e){return typeof e!=`object`||!e||Array.isArray(e)?!1:typeof e[`@id`]==`string`}function I(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e;return typeof t[`@id`]==`string`?t[`@id`]:void 0}function L(e){let t=0,n=0;for(let r of e)r.importance===`required`&&(n+=1,r.state===`set`&&(t+=1));return{requiredSet:t,requiredTotal:n}}function R(e){let t=e.lastIndexOf(`#`);if(t!==-1)return e.slice(t);let n=e.lastIndexOf(`/`);return n!==-1&&n<e.length-1?e.slice(n):e}function z(e){for(let t=0;t<e.length;t++){let n=e[t];n._ek=String(t)}}function B(e){let t=new Map;for(let n of e){let e=n._ek;typeof e==`string`&&t.set(e,n)}return t}function V(e,t){let n=new Map,r=new Set;for(let i of e){let e=i._ek;if(typeof e!=`string`)continue;let a=A(i[`@type`]),o=typeof i[`@id`]==`string`?i[`@id`]:void 0,s=typeof i.role==`string`?i.role:void 0,c=-1;o&&(c=t.findIndex((e,t)=>!r.has(t)&&e[`@id`]===o)),c<0&&a&&(c=t.findIndex((e,t)=>!r.has(t)&&e[`@type`]===a&&(e.role??void 0)===s)),c<0&&a&&(c=t.findIndex((e,t)=>!r.has(t)&&e[`@type`]===a)),c>=0&&(n.set(e,c),r.add(c))}return n}function H(e){let t=e=>e.importance===`required`&&e.state===`missing`?0:e.importance===`recommended`&&e.state===`missing`?1:e.state===`set`?2:e.importance===`optional`?3:4;return[...e].sort((e,n)=>{let r=t(e),i=t(n);return r===i?e.property.localeCompare(n.property):r-i})}var U={idle:``,copied:`JSON-LD copied`,failed:`Could not copy. Select the text and copy it yourself.`};function W(e){let[t,n]=(0,C.useState)(`idle`),r=(0,C.useRef)(null);(0,C.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);function i(e){n(e),r.current&&clearTimeout(r.current),e===`copied`&&(r.current=setTimeout(()=>n(`idle`),2e3))}function a(){navigator.clipboard?navigator.clipboard.writeText(e).then(()=>i(`copied`),()=>i(`failed`)):i(`failed`)}return{state:t,copy:a}}function G({data:e,label:t}){let n=JSON.stringify(e,null,2),{state:i,copy:s}=W(n),c=i===`copied`;return(0,w.jsxs)(`div`,{className:`json-ld-code`,children:[(0,w.jsxs)(`div`,{className:`json-ld-code-head`,children:[(0,w.jsx)(`span`,{className:`json-ld-code-label`,children:t}),(0,w.jsx)(r,{size:`sm`,variant:`ghost`,icon:c?a:o,onClick:s,children:c?`Copied`:`Copy`}),(0,w.jsx)(`span`,{className:i===`failed`?`json-ld-code-status`:`visually-hidden`,role:`status`,children:U[i]})]}),(0,w.jsx)(`section`,{className:`json-ld-code-source`,tabIndex:0,"aria-label":t,children:(0,w.jsx)(`pre`,{children:(0,w.jsx)(`code`,{children:n})})})]})}function le(e,t,n){let r=e?.entities.map(e=>e[`@type`])??[];if(r.length>0)return r;let i=t?.entities.map(e=>e[`@type`])??[];if(i.length>0)return i;let a=n?.entities.map(e=>e[`@type`])??[];return a.length>0?a:[]}function ue(){let[e,t]=(0,C.useState)(`loading`);return(0,C.useEffect)(()=>{let e=!0;return u().then(n=>e&&t(n.configured?`configured`:`missing`)).catch(()=>e&&t(`unknown`)),()=>{e=!1}},[]),e}var K={site:{label:`site`,meaning:`From the site entities`},collection:{label:`collection`,meaning:`From the collection archetype`},route:{label:`URL pattern`,meaning:`From a URL-pattern override`},document:{label:`document`,meaning:`Set in this document`},computed:{label:`computed`,meaning:`Computed from the page: no one typed it`},linked:{label:`linked`,meaning:`A reference to another entity, by its @id`}},de={site:{label:`site`,meaning:`A site entity: every page emits it`},page:{label:`page`,meaning:`This page's own entity, from its archetype`}};function fe(e){if(!f(e))return null;let t=e[`@id`];return typeof t==`string`?t:null}function q(e){return(Array.isArray(e)?e:[e]).map(fe).filter(e=>e!==null)}function pe(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);let t=q(e),n=Array.isArray(e)?e:[e];return t.length>0&&t.length===n.length?t.join(`, `):JSON.stringify(e)??``}function J(e){let t=e[`@type`];return typeof t==`string`?t:Array.isArray(t)&&typeof t[0]==`string`?t[0]:`Thing`}function me(e,t,n){let r=n?.properties.find(t=>t.property===e);return{key:e,text:pe(t),scope:r?.scope??`computed`,origin:r?.origin??`Added by krantho when it composes the page`,references:q(t),fixed:r?!r.editable:!1}}function he(e,t,n,r,i){return n?n.level===`site`?`site`:`page`:r.siteTypes.has(J(e))||t<i?`site`:`page`}function ge(e){let t=new Set(e.resolved.filter(e=>e.level===`document`).map(e=>e.id)),n=e.nodes.findIndex(e=>t.has(String(e[`@id`])));return n>=0?n:0}var Y={computed:0,linked:0,site:1,collection:2,route:3,document:4};function _e(e,t){return Y[e.scope]>Y[t.scope]?e:t}function ve(e){let t=new Map;for(let n of e){let e=t.get(n.id);if(!e){t.set(n.id,n);continue}let r=new Map(e.properties.map(e=>[e.property,e]));for(let e of n.properties){let t=r.get(e.property);r.set(e.property,t?_e(t,e):e)}let i=e.level===`document`||n.level===`document`?`document`:`site`;t.set(n.id,{...n,level:i,properties:[...r.values()]})}return t}function X(e){let t=ge(e),n=ve(e.resolved);return e.nodes.map((r,i)=>{let a=typeof r[`@id`]==`string`?r[`@id`]:``,o=n.get(a),s=Object.entries(r).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>me(e,t,o));return{id:a,type:J(r),scope:he(r,i,o,e,t),rows:s}})}function ye(e){let t=X(e);return[...t.filter(e=>e.scope===`page`),...t.filter(e=>e.scope===`site`)]}function be(e){let t=new Map;for(let n of e.flatMap(e=>e.rows))t.set(n.scope,(t.get(n.scope)??0)+1);return Object.keys(K).filter(e=>t.has(e)).map(e=>[e,t.get(e)??0])}var xe={site:g,collection:l,route:S,document:c,computed:te,linked:v},Se={site:g,page:b};function Z({icon:e,label:t,meaning:n,own:r}){return(0,w.jsxs)(`span`,{className:ee(r?`accent`:`neutral`,`data-scope`),title:n,children:[(0,w.jsx)(e,{className:`ui-chip-icon`,"aria-hidden":`true`}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:t}),(0,w.jsxs)(`span`,{className:`visually-hidden`,children:[t,`: `,n]})]})}function Q({scope:e}){let{label:t,meaning:n}=K[e];return(0,w.jsx)(Z,{icon:xe[e],label:t,meaning:n,own:e===`document`})}function Ce({scope:e}){let{label:t,meaning:n}=de[e];return(0,w.jsx)(Z,{icon:Se[e],label:t,meaning:n,own:e===`page`})}function we({counts:e}){return(0,w.jsx)(`ul`,{className:`data-legend`,"aria-label":`Sources`,children:e.map(([e,t])=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(Q,{scope:e}),(0,w.jsxs)(`span`,{className:`data-legend-text`,children:[K[e].meaning,` · `,t]})]},e))})}function Te({row:e,headingOf:t}){return(0,w.jsx)(`span`,{className:`data-refs`,children:e.references.map(e=>{let n=t(e);return n?(0,w.jsxs)(`button`,{type:`button`,className:`data-ref`,"aria-label":`Go to ${e}`,onClick:()=>document.getElementById(n)?.focus(),children:[(0,w.jsx)(s,{"aria-hidden":`true`}),(0,w.jsx)(`code`,{children:e})]},e):(0,w.jsx)(`code`,{children:e},e)})})}function Ee({row:e,headingOf:t}){return(0,w.jsxs)(`tr`,{children:[(0,w.jsxs)(`th`,{scope:`row`,className:`data-prop-key`,children:[(0,w.jsx)(`code`,{children:e.key}),e.fixed&&(0,w.jsxs)(`span`,{className:`data-prop-fixed`,title:`Set by the type: the SEO settings cannot change it`,children:[(0,w.jsx)(d,{"aria-hidden":`true`}),(0,w.jsx)(`span`,{className:`visually-hidden`,children:`set by the type`})]})]}),(0,w.jsx)(`td`,{className:`data-prop-value`,"data-label":`Value`,children:e.references.length>0?(0,w.jsx)(Te,{row:e,headingOf:t}):(0,w.jsx)(`code`,{title:e.text,children:e.text})}),(0,w.jsxs)(`td`,{className:`data-prop-source`,"data-label":`Source`,children:[(0,w.jsx)(Q,{scope:e.scope}),(0,w.jsx)(`span`,{className:`data-prop-origin`,children:e.origin})]})]})}function De({view:e,headingOf:t}){return(0,w.jsxs)(`table`,{className:`data-props`,children:[(0,w.jsxs)(`caption`,{className:`visually-hidden`,children:[e.type,` `,e.id,`: each property's value and where it comes from`]}),(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{scope:`col`,children:`Property`}),(0,w.jsx)(`th`,{scope:`col`,children:`Value`}),(0,w.jsx)(`th`,{scope:`col`,children:`Source`})]})}),(0,w.jsx)(`tbody`,{children:e.rows.map(e=>(0,w.jsx)(Ee,{row:e,headingOf:t},e.key))})]})}function $({view:e,headingId:t,headingOf:n}){return(0,w.jsxs)(`li`,{className:`data-entity`,"data-entity-id":e.id,children:[(0,w.jsxs)(`div`,{className:`data-entity-head`,children:[(0,w.jsx)(`h3`,{id:t,tabIndex:-1,className:`data-entity-type`,children:e.type}),(0,w.jsx)(Ce,{scope:e.scope}),(0,w.jsx)(`code`,{className:`data-entity-id`,children:e.id||`no @id`})]}),e.rows.length===0?(0,w.jsx)(`p`,{className:`data-note`,children:`No property has a value.`}):(0,w.jsx)(De,{view:e,headingOf:n})]})}function Oe({views:e}){let t=(0,C.useId)(),n=e=>`${t}-entity-${e}`,r=t=>{let r=t?e.findIndex(e=>e.id===t):-1;return r>=0?n(r):null};return(0,w.jsx)(`ul`,{className:`data-entities`,"aria-label":`Entities`,children:e.map((e,t)=>(0,w.jsx)($,{view:e,headingId:n(t),headingOf:r},`${t}-${e.id}`))})}function ke(e){if(!f(e))return[];let t=e[`@graph`];return Array.isArray(t)?t.filter(f):[e]}function Ae(e){return e.document?e.document:e.collection?{entities:e.collection.entities}:{entities:le(null,null,e.site).map(e=>({"@type":e,properties:{}}))}}function je(e,t,n,r){let i=e=>!t.has(e),a=r?e.findIndex((e,t)=>i(t)&&e[`@id`]===r):-1;return a>=0?a:e.findIndex((e,t)=>i(t)&&e[`@type`]===n&&!e[`@id`])}function Me(e,t){let n=Ae(t),r=new Set,i=[];for(let t of e){let e=A(t[`@type`]);if(e===null)continue;let a=typeof t[`@id`]==`string`?t[`@id`]:void 0,o=je(n.entities,r,e,a),s=n.entities[o];o>=0&&s?(r.add(o),i.push(!s[`@id`]&&a?{...s,"@id":a}:s)):i.push({"@type":e,...a?{"@id":a}:{},properties:{}})}return{...n,entities:i}}function Ne(e){let t=e.flatMap(e=>{let t=A(e[`@type`]);return t===null?[]:[t]});return[...new Set(t)]}export{A as C,ne as D,g as E,R as S,v as T,N as _,we as a,H as b,q as c,G as d,T as f,j as g,O as h,Oe as i,be as l,V as m,ke as n,ye as o,B as p,Ne as r,X as s,Me as t,ue as u,L as v,S as w,re as x,M as y};
1
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{o as t,s as n}from"./vendor-diff-DGCTJYJ4.js";import{n as r,t as i}from"./createLucideIcon-BklFHeMd.js";import{n as a}from"./use-loaded-BBFak2E1.js";import{t as o}from"./copy-V85khWct.js";import{t as s}from"./corner-down-right-BpwOGRFR.js";import{a as c}from"./findability-BrhtZ2yD.js";import{t as l}from"./layers-0VWe0rKm.js";import{T as u,c as ee,ct as d}from"./index-CEQ7ZdKC.js";import{t as f}from"./guards-BFEDbduR.js";var p={name:`calculator`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`line`,{x1:`8`,x2:`16`,y1:`6`,y2:`6`,key:`x4nwl0`}],[`line`,{x1:`16`,x2:`16`,y1:`14`,y2:`18`,key:`wjye3r`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]};p.node;var te=i(p),m={name:`circle-minus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]],aliases:[`minus-circle`]};m.node;var ne=i(m),h={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};h.node;var g=i(h),_={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};_.node;var v=i(_),y={name:`panels-top-left`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]],aliases:[`layout`]};y.node;var b=i(y),x={name:`route`,size:24,node:[[`path`,{d:`M9 5h8.5a1 1 0 010 7h-11a1 1 0 000 7H15`,key:`1r1aam`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`circle`,{cx:`6`,cy:`5`,r:`3`,key:`151irh`}]]};x.node;var S=i(x),C=e(n(),1),w=t(),T={business:`Business & Organization`,content:`Content`,commerce:`Commerce & Services`,people:`People & Events`,navigation:`Navigation & Structure`,reviews:`Reviews & Ratings`},E=new Set(Object.keys(T)),D=new Set([`WebPage`,`AboutPage`,`CheckoutPage`,`CollectionPage`,`ContactPage`,`FAQPage`,`ItemPage`,`MedicalWebPage`,`ProfilePage`,`QAPage`,`RealEstateListing`,`SearchResultsPage`]);function re(e){let t=ie(e),n=[];for(let e of t)ae(e)&&n.push(e);z(n);let r=B(n),i=oe(n);return{nodes:n,byEk:r,byId:i,referencedBy:O(n),primary:se(n,i)}}function ie(e){if(e==null)return[];if(Array.isArray(e))return e;if(typeof e!=`object`)return[];let t=e,n=t[`@graph`];return Array.isArray(n)?n:`@type`in t?[t]:[]}function ae(e){return typeof e!=`object`||!e||Array.isArray(e)?!1:`@type`in e}function oe(e){let t=new Map;for(let n of e){let e=n[`@id`];typeof e==`string`&&t.set(e,n)}return t}function O(e){let t=new Map;for(let n of e)for(let[e,r]of Object.entries(n))if(e!==`@type`&&e!==`@id`&&e!==`@context`&&e!==`_ek`)for(let i of k(r)){let r=t.get(i);r||(r=[],t.set(i,r)),r.push({source:n,property:e})}return t}function k(e){if(typeof e!=`object`||!e)return[];if(Array.isArray(e)){let t=[];for(let n of e)for(let e of k(n))t.push(e);return t}let t=e,n=t[`@id`];if(typeof n==`string`)return[n];let r=[];for(let e of Object.values(t))for(let t of k(e))r.push(t);return r}function se(e,t){let n=e.find(e=>ce(e));if(!n)return null;let r=I(n.mainEntity);return r===void 0?null:t.get(r)??null}function ce(e){let t=A(e[`@type`]);return t!==null&&D.has(t)}function A(e){return typeof e==`string`?e:Array.isArray(e)&&e.length>0&&typeof e[0]==`string`?e[0]:null}function j(e,t){let n=[],r=[],i=[];for(let a of e.nodes){let e=A(a[`@type`]);e!==null&&(D.has(e)?r.push(a):t.has(e)?n.push(a):i.push(a))}let a=r[0]??null,o=e.primary??i[0]??null;return{siteContext:n,page:a,primary:o,linked:i.filter(e=>e!==o)}}function M(e,t){let n=A(e[`@type`]);if(n===null)return null;let r=t.find(e=>e.type===n);return r&&E.has(r.category)?r.category:null}function N(e,t){let n=new Set;for(let t of Object.keys(e))t!==`@type`&&t!==`@id`&&t!==`@context`&&t!==`_ek`&&n.add(t);if(t)for(let e of t.properties)n.add(e.property);let r=new Map;if(t)for(let e of t.properties)r.set(e.property,e);let i=[];for(let t of n){let n=e[t],a=r.get(t),o=a?.importance??`unknown`,s=P(n)?`set`:`missing`,c=F(n),l=c?I(n):void 0,u={property:t,value:n,importance:o,state:s,isReference:c,...a?{def:a}:{},...l===void 0?{}:{referenceId:l}};i.push(u)}return i}function P(e){return!(e==null||e===``||Array.isArray(e)&&e.length===0)}function F(e){return typeof e!=`object`||!e||Array.isArray(e)?!1:typeof e[`@id`]==`string`}function I(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e;return typeof t[`@id`]==`string`?t[`@id`]:void 0}function L(e){let t=0,n=0;for(let r of e)r.importance===`required`&&(n+=1,r.state===`set`&&(t+=1));return{requiredSet:t,requiredTotal:n}}function R(e){let t=e.lastIndexOf(`#`);if(t!==-1)return e.slice(t);let n=e.lastIndexOf(`/`);return n!==-1&&n<e.length-1?e.slice(n):e}function z(e){for(let t=0;t<e.length;t++){let n=e[t];n._ek=String(t)}}function B(e){let t=new Map;for(let n of e){let e=n._ek;typeof e==`string`&&t.set(e,n)}return t}function V(e,t){let n=new Map,r=new Set;for(let i of e){let e=i._ek;if(typeof e!=`string`)continue;let a=A(i[`@type`]),o=typeof i[`@id`]==`string`?i[`@id`]:void 0,s=typeof i.role==`string`?i.role:void 0,c=-1;o&&(c=t.findIndex((e,t)=>!r.has(t)&&e[`@id`]===o)),c<0&&a&&(c=t.findIndex((e,t)=>!r.has(t)&&e[`@type`]===a&&(e.role??void 0)===s)),c<0&&a&&(c=t.findIndex((e,t)=>!r.has(t)&&e[`@type`]===a)),c>=0&&(n.set(e,c),r.add(c))}return n}function H(e){let t=e=>e.importance===`required`&&e.state===`missing`?0:e.importance===`recommended`&&e.state===`missing`?1:e.state===`set`?2:e.importance===`optional`?3:4;return[...e].sort((e,n)=>{let r=t(e),i=t(n);return r===i?e.property.localeCompare(n.property):r-i})}var U={idle:``,copied:`JSON-LD copied`,failed:`Could not copy. Select the text and copy it yourself.`};function W(e){let[t,n]=(0,C.useState)(`idle`),r=(0,C.useRef)(null);(0,C.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);function i(e){n(e),r.current&&clearTimeout(r.current),e===`copied`&&(r.current=setTimeout(()=>n(`idle`),2e3))}function a(){navigator.clipboard?navigator.clipboard.writeText(e).then(()=>i(`copied`),()=>i(`failed`)):i(`failed`)}return{state:t,copy:a}}function G({data:e,label:t}){let n=JSON.stringify(e,null,2),{state:i,copy:s}=W(n),c=i===`copied`;return(0,w.jsxs)(`div`,{className:`json-ld-code`,children:[(0,w.jsxs)(`div`,{className:`json-ld-code-head`,children:[(0,w.jsx)(`span`,{className:`json-ld-code-label`,children:t}),(0,w.jsx)(r,{size:`sm`,variant:`ghost`,icon:c?a:o,onClick:s,children:c?`Copied`:`Copy`}),(0,w.jsx)(`span`,{className:i===`failed`?`json-ld-code-status`:`visually-hidden`,role:`status`,children:U[i]})]}),(0,w.jsx)(`section`,{className:`json-ld-code-source`,tabIndex:0,"aria-label":t,children:(0,w.jsx)(`pre`,{children:(0,w.jsx)(`code`,{children:n})})})]})}function le(e,t,n){let r=e?.entities.map(e=>e[`@type`])??[];if(r.length>0)return r;let i=t?.entities.map(e=>e[`@type`])??[];if(i.length>0)return i;let a=n?.entities.map(e=>e[`@type`])??[];return a.length>0?a:[]}function ue(){let[e,t]=(0,C.useState)(`loading`);return(0,C.useEffect)(()=>{let e=!0;return u().then(n=>e&&t(n.configured?`configured`:`missing`)).catch(()=>e&&t(`unknown`)),()=>{e=!1}},[]),e}var K={site:{label:`site`,meaning:`From the site entities`},collection:{label:`collection`,meaning:`From the collection archetype`},route:{label:`URL pattern`,meaning:`From a URL-pattern override`},document:{label:`document`,meaning:`Set in this document`},computed:{label:`computed`,meaning:`Computed from the page: no one typed it`},linked:{label:`linked`,meaning:`A reference to another entity, by its @id`}},de={site:{label:`site`,meaning:`A site entity: every page emits it`},page:{label:`page`,meaning:`This page's own entity, from its archetype`}};function fe(e){if(!f(e))return null;let t=e[`@id`];return typeof t==`string`?t:null}function q(e){return(Array.isArray(e)?e:[e]).map(fe).filter(e=>e!==null)}function pe(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);let t=q(e),n=Array.isArray(e)?e:[e];return t.length>0&&t.length===n.length?t.join(`, `):JSON.stringify(e)??``}function J(e){let t=e[`@type`];return typeof t==`string`?t:Array.isArray(t)&&typeof t[0]==`string`?t[0]:`Thing`}function me(e,t,n){let r=n?.properties.find(t=>t.property===e);return{key:e,text:pe(t),scope:r?.scope??`computed`,origin:r?.origin??`Added by krantho when it composes the page`,references:q(t),fixed:r?!r.editable:!1}}function he(e,t,n,r,i){return n?n.level===`site`?`site`:`page`:r.siteTypes.has(J(e))||t<i?`site`:`page`}function ge(e){let t=new Set(e.resolved.filter(e=>e.level===`document`).map(e=>e.id)),n=e.nodes.findIndex(e=>t.has(String(e[`@id`])));return n>=0?n:0}var Y={computed:0,linked:0,site:1,collection:2,route:3,document:4};function _e(e,t){return Y[e.scope]>Y[t.scope]?e:t}function ve(e){let t=new Map;for(let n of e){let e=t.get(n.id);if(!e){t.set(n.id,n);continue}let r=new Map(e.properties.map(e=>[e.property,e]));for(let e of n.properties){let t=r.get(e.property);r.set(e.property,t?_e(t,e):e)}let i=e.level===`document`||n.level===`document`?`document`:`site`;t.set(n.id,{...n,level:i,properties:[...r.values()]})}return t}function X(e){let t=ge(e),n=ve(e.resolved);return e.nodes.map((r,i)=>{let a=typeof r[`@id`]==`string`?r[`@id`]:``,o=n.get(a),s=Object.entries(r).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>me(e,t,o));return{id:a,type:J(r),scope:he(r,i,o,e,t),rows:s}})}function ye(e){let t=X(e);return[...t.filter(e=>e.scope===`page`),...t.filter(e=>e.scope===`site`)]}function be(e){let t=new Map;for(let n of e.flatMap(e=>e.rows))t.set(n.scope,(t.get(n.scope)??0)+1);return Object.keys(K).filter(e=>t.has(e)).map(e=>[e,t.get(e)??0])}var xe={site:g,collection:l,route:S,document:c,computed:te,linked:v},Se={site:g,page:b};function Z({icon:e,label:t,meaning:n,own:r}){return(0,w.jsxs)(`span`,{className:ee(r?`accent`:`neutral`,`data-scope`),title:n,children:[(0,w.jsx)(e,{className:`ui-chip-icon`,"aria-hidden":`true`}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:t}),(0,w.jsxs)(`span`,{className:`visually-hidden`,children:[t,`: `,n]})]})}function Q({scope:e}){let{label:t,meaning:n}=K[e];return(0,w.jsx)(Z,{icon:xe[e],label:t,meaning:n,own:e===`document`})}function Ce({scope:e}){let{label:t,meaning:n}=de[e];return(0,w.jsx)(Z,{icon:Se[e],label:t,meaning:n,own:e===`page`})}function we({counts:e}){return(0,w.jsx)(`ul`,{className:`data-legend`,"aria-label":`Sources`,children:e.map(([e,t])=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(Q,{scope:e}),(0,w.jsxs)(`span`,{className:`data-legend-text`,children:[K[e].meaning,` · `,t]})]},e))})}function Te({row:e,headingOf:t}){return(0,w.jsx)(`span`,{className:`data-refs`,children:e.references.map(e=>{let n=t(e);return n?(0,w.jsxs)(`button`,{type:`button`,className:`data-ref`,"aria-label":`Go to ${e}`,onClick:()=>document.getElementById(n)?.focus(),children:[(0,w.jsx)(s,{"aria-hidden":`true`}),(0,w.jsx)(`code`,{children:e})]},e):(0,w.jsx)(`code`,{children:e},e)})})}function Ee({row:e,headingOf:t}){return(0,w.jsxs)(`tr`,{children:[(0,w.jsxs)(`th`,{scope:`row`,className:`data-prop-key`,children:[(0,w.jsx)(`code`,{children:e.key}),e.fixed&&(0,w.jsxs)(`span`,{className:`data-prop-fixed`,title:`Set by the type: the SEO settings cannot change it`,children:[(0,w.jsx)(d,{"aria-hidden":`true`}),(0,w.jsx)(`span`,{className:`visually-hidden`,children:`set by the type`})]})]}),(0,w.jsx)(`td`,{className:`data-prop-value`,"data-label":`Value`,children:e.references.length>0?(0,w.jsx)(Te,{row:e,headingOf:t}):(0,w.jsx)(`code`,{title:e.text,children:e.text})}),(0,w.jsxs)(`td`,{className:`data-prop-source`,"data-label":`Source`,children:[(0,w.jsx)(Q,{scope:e.scope}),(0,w.jsx)(`span`,{className:`data-prop-origin`,children:e.origin})]})]})}function De({view:e,headingOf:t}){return(0,w.jsxs)(`table`,{className:`data-props`,children:[(0,w.jsxs)(`caption`,{className:`visually-hidden`,children:[e.type,` `,e.id,`: each property's value and where it comes from`]}),(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{scope:`col`,children:`Property`}),(0,w.jsx)(`th`,{scope:`col`,children:`Value`}),(0,w.jsx)(`th`,{scope:`col`,children:`Source`})]})}),(0,w.jsx)(`tbody`,{children:e.rows.map(e=>(0,w.jsx)(Ee,{row:e,headingOf:t},e.key))})]})}function $({view:e,headingId:t,headingOf:n}){return(0,w.jsxs)(`li`,{className:`data-entity`,"data-entity-id":e.id,children:[(0,w.jsxs)(`div`,{className:`data-entity-head`,children:[(0,w.jsx)(`h3`,{id:t,tabIndex:-1,className:`data-entity-type`,children:e.type}),(0,w.jsx)(Ce,{scope:e.scope}),(0,w.jsx)(`code`,{className:`data-entity-id`,children:e.id||`no @id`})]}),e.rows.length===0?(0,w.jsx)(`p`,{className:`data-note`,children:`No property has a value.`}):(0,w.jsx)(De,{view:e,headingOf:n})]})}function Oe({views:e}){let t=(0,C.useId)(),n=e=>`${t}-entity-${e}`,r=t=>{let r=t?e.findIndex(e=>e.id===t):-1;return r>=0?n(r):null};return(0,w.jsx)(`ul`,{className:`data-entities`,"aria-label":`Entities`,children:e.map((e,t)=>(0,w.jsx)($,{view:e,headingId:n(t),headingOf:r},`${t}-${e.id}`))})}function ke(e){if(!f(e))return[];let t=e[`@graph`];return Array.isArray(t)?t.filter(f):[e]}function Ae(e){return e.document?e.document:e.collection?{entities:e.collection.entities}:{entities:le(null,null,e.site).map(e=>({"@type":e,properties:{}}))}}function je(e,t,n,r){let i=e=>!t.has(e),a=r?e.findIndex((e,t)=>i(t)&&e[`@id`]===r):-1;return a>=0?a:e.findIndex((e,t)=>i(t)&&e[`@type`]===n&&!e[`@id`])}function Me(e,t){let n=Ae(t),r=new Set,i=[];for(let t of e){let e=A(t[`@type`]);if(e===null)continue;let a=typeof t[`@id`]==`string`?t[`@id`]:void 0,o=je(n.entities,r,e,a),s=n.entities[o];o>=0&&s?(r.add(o),i.push(!s[`@id`]&&a?{...s,"@id":a}:s)):i.push({"@type":e,...a?{"@id":a}:{},properties:{}})}return{...n,entities:i}}function Ne(e){let t=e.flatMap(e=>{let t=A(e[`@type`]);return t===null?[]:[t]});return[...new Set(t)]}export{A as C,ne as D,g as E,R as S,v as T,N as _,we as a,H as b,q as c,G as d,T as f,j as g,O as h,Oe as i,be as l,V as m,ke as n,ye as o,B as p,Ne as r,X as s,Me as t,ue as u,L as v,S as w,re as x,M as y};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{t}from"./arrow-left-7opbl8fu.js";import{t as n}from"./rotate-ccw-BgARBEK3.js";import{t as r}from"./save-ClSXW9cb.js";import{o as i,s as a}from"./vendor-diff-DGCTJYJ4.js";import{t as o}from"./vendor-media-DXSmPN_d.js";import{f as s,t as c,u as l}from"./vendor-router-B4czwg8X.js";import{t as u}from"./action-button-DIrhqMRc.js";import{i as d}from"./auth-CIpilSKF.js";import{I as f,b as p,k as m,r as h,u as g}from"./media-model-D4F1Farw.js";import{i as _,n as v}from"./createLucideIcon-BklFHeMd.js";import{d as y,et as b,f as x}from"./index-qiIlvPyv.js";var S=e(a(),1),C=[{label:`Free`,value:void 0},{label:`1:1`,value:1},{label:`16:9`,value:16/9},{label:`4:3`,value:4/3},{label:`3:2`,value:3/2}],w=[{label:`Original`,aspect:null},{label:`1:1`,aspect:`1:1`},{label:`16:9`,aspect:`16:9`},{label:`4:3`,aspect:`4:3`},{label:`3:2`,aspect:`3:2`}];function T(e){return{x:e.x,y:e.y,width:e.width,height:e.height,unit:`%`}}var E=e=>Math.round(e*100)/100;function D(e){return!e||e.width<=0||e.height<=0?null:{x:E(e.x),y:E(e.y),width:E(e.width),height:E(e.height)}}var O=15,k=e=>Math.max(0,Math.min(100,e));function A(e,t){return{x:k(e),y:k(t),width:O,height:O}}var j=2,M={ArrowLeft:[-2,0],ArrowRight:[j,0],ArrowUp:[0,-2],ArrowDown:[0,j]};function N(e,t){let n=M[t];if(!n)return null;let r=e??A(50,50);return e?A(r.x+n[0],r.y+n[1]):r}function P(e,t,n){let r=new URLSearchParams({preset:`md`,fmt:`webp`});return t&&r.set(`aspect`,t),r.set(`v`,String(n)),`/api/media/${encodeURIComponent(e)}/image?${r}`}function F(e){let[t,n]=(0,S.useState)({state:`loading`});return(0,S.useEffect)(()=>{let t=!0;return n({state:`loading`}),m(e).then(e=>t&&n({state:`ready`,item:e})).catch(e=>t&&n({state:`missing`,message:x(e,`The file could not be read`)})),()=>{t=!1}},[e]),[t,e=>n({state:`ready`,item:e})]}function I(e){let[t,n]=(0,S.useState)(void 0),[r,i]=(0,S.useState)(null),a=e.state===`ready`?e.item:null;return(0,S.useEffect)(()=>{n(a?.crop?T(a.crop):void 0),i(a?.hotspot??null)},[a]),{crop:t,hotspot:r,set:(e,t)=>{n(e),i(t)}}}function L(e,t,n){let r=b(),[i,a]=(0,S.useState)(!1);async function o(i,o,s){if(!t){a(!0);try{n(await f(e,{crop:D(i),hotspot:o})),r({text:s})}catch(e){r({text:x(e,`The crop could not be saved`),tone:`error`})}finally{a(!1)}}}return{busy:i,write:o}}function R(e,t){let[n,r]=F(e),i=I(n),[a,o]=(0,S.useState)(`crop`),[s,c]=(0,S.useState)(void 0),[l,u]=(0,S.useState)(!1),[d,f]=(0,S.useState)(0),{busy:p,write:m}=L(e,t,e=>{r(e),u(!1),f(e=>e+1)}),h=(e,n)=>{t||(i.set(e,n),u(!0))};return{loaded:n,tool:a,setTool:o,crop:i.crop,setCrop:e=>h(e,i.hotspot),aspect:s,setAspect:e=>{c(e),i.set(void 0,i.hotspot)},hotspot:i.hotspot,setHotspot:e=>h(i.crop,e),dirty:l,busy:p,readOnly:t,version:d,save:()=>m(i.crop,i.hotspot,`Crop and hotspot saved.`),reset:()=>m(void 0,null,`Crop and hotspot removed; the original framing is back.`)}}var z=i();function B({hotspot:e}){return(0,z.jsx)(`span`,{className:`image-editor-hotspot-mark`,"aria-hidden":`true`,style:{left:`${e.x}%`,top:`${e.y}%`,width:`${e.width}%`,height:`${e.height}%`}})}function V({item:e,editor:t}){let{hotspot:n}=t;function r(e){if(e.detail===0){n||t.setHotspot(A(50,50));return}let r=e.currentTarget.getBoundingClientRect();t.setHotspot(A((e.clientX-r.left)/r.width*100,(e.clientY-r.top)/r.height*100))}function i(e){let r=N(n,e.key);r&&(e.preventDefault(),t.setHotspot(r))}return(0,z.jsxs)(`button`,{type:`button`,className:`image-editor-hotspot`,disabled:t.readOnly,"aria-label":`Place the hotspot: click the image, or use the arrow keys`,onClick:r,onKeyDown:i,children:[(0,z.jsx)(`img`,{src:p(e.id),alt:``}),n&&(0,z.jsx)(B,{hotspot:n})]})}function H({item:e,editor:t}){return(0,z.jsx)(o,{...t.crop?{crop:t.crop}:{},...t.aspect?{aspect:t.aspect}:{},disabled:t.readOnly,onChange:(e,n)=>t.setCrop(n),children:(0,z.jsx)(`img`,{src:p(e.id),alt:e.altText})})}function U({label:e,options:t,value:n,onChange:r}){return(0,z.jsxs)(`fieldset`,{className:`image-editor-toggles`,children:[(0,z.jsx)(`legend`,{className:`image-editor-legend`,children:e}),t.map(e=>(0,z.jsx)(`button`,{type:`button`,className:`image-editor-toggle`,"aria-pressed":e.value===n,onClick:()=>r(e.value),children:e.label},e.label))]})}var W=[{label:`Crop`,value:`crop`},{label:`Hotspot`,value:`hotspot`}];function G({editor:e}){let{hotspot:t}=e;return(0,z.jsxs)(`p`,{className:`image-editor-note`,children:[t?`Hotspot at ${Math.round(t.x)}%, ${Math.round(t.y)}%. Click or use the arrow keys to move it.`:`No hotspot: click the image, or focus it and press an arrow key.`,t&&(0,z.jsx)(v,{size:`sm`,variant:`ghost`,onClick:()=>e.setHotspot(null),children:`Clear hotspot`})]})}function K({editor:e}){return(0,z.jsxs)(`div`,{className:`image-editor-toolbar`,children:[(0,z.jsx)(U,{label:`Tool`,options:W,value:e.tool,onChange:e.setTool}),e.tool===`crop`?(0,z.jsx)(U,{label:`Aspect ratio`,options:C,value:e.aspect,onChange:e.setAspect}):(0,z.jsx)(G,{editor:e})]})}function q({item:e,version:t}){return(0,z.jsxs)(`section`,{className:`image-editor-previews`,"aria-labelledby":`image-editor-previews`,children:[(0,z.jsx)(`h2`,{id:`image-editor-previews`,className:`image-editor-subtitle`,children:`Saved framing at each aspect ratio`}),(0,z.jsx)(`p`,{className:`image-editor-note`,children:e.hotspot?`The hotspot guides where each crop centres.`:`Set a hotspot to control where each crop centres.`}),(0,z.jsx)(`ul`,{className:`image-editor-strip`,children:w.map(n=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`img`,{src:P(e.id,n.aspect,t),alt:`${n.label} framing`}),(0,z.jsx)(`span`,{children:n.label})]},n.label))})]})}function J({onStay:e,onLeave:t}){let n=(0,S.useRef)(null);return(0,z.jsx)(y,{title:`Discard changes`,onClose:e,initialFocus:n,actions:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(v,{ref:n,onClick:e,children:`Keep editing`}),(0,z.jsx)(v,{variant:`danger`,onClick:t,children:`Discard`})]}),children:(0,z.jsx)(`p`,{children:`The crop and hotspot you drew are not saved. Leave without saving them?`})})}function Y({editor:e}){let t=e.readOnly?h:e.busy?`Saving…`:null;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(u,{icon:n,reason:t,onClick:()=>void e.reset(),children:`Reset`}),(0,z.jsx)(u,{variant:`primary`,icon:r,reason:t??(e.dirty?null:`Nothing has changed since the last save.`),onClick:()=>void e.save(),children:e.busy?`Saving…`:`Save`})]})}function X({item:e,editor:n}){let r=l(),[i,a]=(0,S.useState)(!1);return(0,z.jsxs)(`header`,{className:`image-editor-header`,children:[(0,z.jsxs)(`h1`,{className:`image-editor-title`,children:[`Crop & hotspot · `,e.filename]}),(0,z.jsxs)(`div`,{className:`image-editor-actions`,children:[(0,z.jsx)(v,{variant:`ghost`,icon:t,onClick:()=>n.dirty?a(!0):r(`/media`),children:`Back to Media`}),(0,z.jsx)(Y,{editor:n})]}),n.readOnly&&(0,z.jsxs)(`p`,{className:`image-editor-note`,role:`note`,children:[`Your role can view media but not change it.`,` The crop and hotspot are shown as saved.`]}),i&&(0,z.jsx)(J,{onStay:()=>a(!1),onLeave:()=>r(`/media`)})]})}function Z({item:e,editor:t}){return g(e)?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`image-editor-canvas`,children:t.tool===`crop`?(0,z.jsx)(H,{item:e,editor:t}):(0,z.jsx)(V,{item:e,editor:t})}),(0,z.jsx)(K,{editor:t}),(0,z.jsx)(q,{item:e,version:t.version})]}):(0,z.jsx)(`p`,{className:`image-editor-note`,children:`This file is not an image: only images have a crop and a hotspot.`})}function Q(){let{id:e=``}=s(),{hasRole:t}=d(),n=R(e,!t(`editor`)),{loaded:r}=n;return r.state===`loading`?(0,z.jsx)(`p`,{role:`status`,children:`Reading the image…`}):r.state===`missing`?(0,z.jsxs)(`div`,{className:`image-editor`,children:[(0,z.jsx)(`p`,{role:`alert`,children:r.message}),(0,z.jsx)(c,{to:`/media`,className:_(`secondary`,`sm`),children:`Back to Media`})]}):(0,z.jsxs)(`div`,{className:`image-editor`,children:[(0,z.jsx)(X,{item:r.item,editor:n}),(0,z.jsx)(Z,{item:r.item,editor:n})]})}export{Q as ImageEditorPage};
1
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{t}from"./arrow-left-7opbl8fu.js";import{t as n}from"./rotate-ccw-BgARBEK3.js";import{t as r}from"./save-ClSXW9cb.js";import{o as i,s as a}from"./vendor-diff-DGCTJYJ4.js";import{t as o}from"./vendor-media-DXSmPN_d.js";import{f as s,t as c,u as l}from"./vendor-router-B4czwg8X.js";import{t as u}from"./action-button-DIrhqMRc.js";import{i as d}from"./auth-CIpilSKF.js";import{I as f,b as p,k as m,r as h,u as g}from"./media-model-D4F1Farw.js";import{i as _,n as v}from"./createLucideIcon-BklFHeMd.js";import{d as y,et as b,f as x}from"./index-CEQ7ZdKC.js";var S=e(a(),1),C=[{label:`Free`,value:void 0},{label:`1:1`,value:1},{label:`16:9`,value:16/9},{label:`4:3`,value:4/3},{label:`3:2`,value:3/2}],w=[{label:`Original`,aspect:null},{label:`1:1`,aspect:`1:1`},{label:`16:9`,aspect:`16:9`},{label:`4:3`,aspect:`4:3`},{label:`3:2`,aspect:`3:2`}];function T(e){return{x:e.x,y:e.y,width:e.width,height:e.height,unit:`%`}}var E=e=>Math.round(e*100)/100;function D(e){return!e||e.width<=0||e.height<=0?null:{x:E(e.x),y:E(e.y),width:E(e.width),height:E(e.height)}}var O=15,k=e=>Math.max(0,Math.min(100,e));function A(e,t){return{x:k(e),y:k(t),width:O,height:O}}var j=2,M={ArrowLeft:[-2,0],ArrowRight:[j,0],ArrowUp:[0,-2],ArrowDown:[0,j]};function N(e,t){let n=M[t];if(!n)return null;let r=e??A(50,50);return e?A(r.x+n[0],r.y+n[1]):r}function P(e,t,n){let r=new URLSearchParams({preset:`md`,fmt:`webp`});return t&&r.set(`aspect`,t),r.set(`v`,String(n)),`/api/media/${encodeURIComponent(e)}/image?${r}`}function F(e){let[t,n]=(0,S.useState)({state:`loading`});return(0,S.useEffect)(()=>{let t=!0;return n({state:`loading`}),m(e).then(e=>t&&n({state:`ready`,item:e})).catch(e=>t&&n({state:`missing`,message:x(e,`The file could not be read`)})),()=>{t=!1}},[e]),[t,e=>n({state:`ready`,item:e})]}function I(e){let[t,n]=(0,S.useState)(void 0),[r,i]=(0,S.useState)(null),a=e.state===`ready`?e.item:null;return(0,S.useEffect)(()=>{n(a?.crop?T(a.crop):void 0),i(a?.hotspot??null)},[a]),{crop:t,hotspot:r,set:(e,t)=>{n(e),i(t)}}}function L(e,t,n){let r=b(),[i,a]=(0,S.useState)(!1);async function o(i,o,s){if(!t){a(!0);try{n(await f(e,{crop:D(i),hotspot:o})),r({text:s})}catch(e){r({text:x(e,`The crop could not be saved`),tone:`error`})}finally{a(!1)}}}return{busy:i,write:o}}function R(e,t){let[n,r]=F(e),i=I(n),[a,o]=(0,S.useState)(`crop`),[s,c]=(0,S.useState)(void 0),[l,u]=(0,S.useState)(!1),[d,f]=(0,S.useState)(0),{busy:p,write:m}=L(e,t,e=>{r(e),u(!1),f(e=>e+1)}),h=(e,n)=>{t||(i.set(e,n),u(!0))};return{loaded:n,tool:a,setTool:o,crop:i.crop,setCrop:e=>h(e,i.hotspot),aspect:s,setAspect:e=>{c(e),i.set(void 0,i.hotspot)},hotspot:i.hotspot,setHotspot:e=>h(i.crop,e),dirty:l,busy:p,readOnly:t,version:d,save:()=>m(i.crop,i.hotspot,`Crop and hotspot saved.`),reset:()=>m(void 0,null,`Crop and hotspot removed; the original framing is back.`)}}var z=i();function B({hotspot:e}){return(0,z.jsx)(`span`,{className:`image-editor-hotspot-mark`,"aria-hidden":`true`,style:{left:`${e.x}%`,top:`${e.y}%`,width:`${e.width}%`,height:`${e.height}%`}})}function V({item:e,editor:t}){let{hotspot:n}=t;function r(e){if(e.detail===0){n||t.setHotspot(A(50,50));return}let r=e.currentTarget.getBoundingClientRect();t.setHotspot(A((e.clientX-r.left)/r.width*100,(e.clientY-r.top)/r.height*100))}function i(e){let r=N(n,e.key);r&&(e.preventDefault(),t.setHotspot(r))}return(0,z.jsxs)(`button`,{type:`button`,className:`image-editor-hotspot`,disabled:t.readOnly,"aria-label":`Place the hotspot: click the image, or use the arrow keys`,onClick:r,onKeyDown:i,children:[(0,z.jsx)(`img`,{src:p(e.id),alt:``}),n&&(0,z.jsx)(B,{hotspot:n})]})}function H({item:e,editor:t}){return(0,z.jsx)(o,{...t.crop?{crop:t.crop}:{},...t.aspect?{aspect:t.aspect}:{},disabled:t.readOnly,onChange:(e,n)=>t.setCrop(n),children:(0,z.jsx)(`img`,{src:p(e.id),alt:e.altText})})}function U({label:e,options:t,value:n,onChange:r}){return(0,z.jsxs)(`fieldset`,{className:`image-editor-toggles`,children:[(0,z.jsx)(`legend`,{className:`image-editor-legend`,children:e}),t.map(e=>(0,z.jsx)(`button`,{type:`button`,className:`image-editor-toggle`,"aria-pressed":e.value===n,onClick:()=>r(e.value),children:e.label},e.label))]})}var W=[{label:`Crop`,value:`crop`},{label:`Hotspot`,value:`hotspot`}];function G({editor:e}){let{hotspot:t}=e;return(0,z.jsxs)(`p`,{className:`image-editor-note`,children:[t?`Hotspot at ${Math.round(t.x)}%, ${Math.round(t.y)}%. Click or use the arrow keys to move it.`:`No hotspot: click the image, or focus it and press an arrow key.`,t&&(0,z.jsx)(v,{size:`sm`,variant:`ghost`,onClick:()=>e.setHotspot(null),children:`Clear hotspot`})]})}function K({editor:e}){return(0,z.jsxs)(`div`,{className:`image-editor-toolbar`,children:[(0,z.jsx)(U,{label:`Tool`,options:W,value:e.tool,onChange:e.setTool}),e.tool===`crop`?(0,z.jsx)(U,{label:`Aspect ratio`,options:C,value:e.aspect,onChange:e.setAspect}):(0,z.jsx)(G,{editor:e})]})}function q({item:e,version:t}){return(0,z.jsxs)(`section`,{className:`image-editor-previews`,"aria-labelledby":`image-editor-previews`,children:[(0,z.jsx)(`h2`,{id:`image-editor-previews`,className:`image-editor-subtitle`,children:`Saved framing at each aspect ratio`}),(0,z.jsx)(`p`,{className:`image-editor-note`,children:e.hotspot?`The hotspot guides where each crop centres.`:`Set a hotspot to control where each crop centres.`}),(0,z.jsx)(`ul`,{className:`image-editor-strip`,children:w.map(n=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`img`,{src:P(e.id,n.aspect,t),alt:`${n.label} framing`}),(0,z.jsx)(`span`,{children:n.label})]},n.label))})]})}function J({onStay:e,onLeave:t}){let n=(0,S.useRef)(null);return(0,z.jsx)(y,{title:`Discard changes`,onClose:e,initialFocus:n,actions:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(v,{ref:n,onClick:e,children:`Keep editing`}),(0,z.jsx)(v,{variant:`danger`,onClick:t,children:`Discard`})]}),children:(0,z.jsx)(`p`,{children:`The crop and hotspot you drew are not saved. Leave without saving them?`})})}function Y({editor:e}){let t=e.readOnly?h:e.busy?`Saving…`:null;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(u,{icon:n,reason:t,onClick:()=>void e.reset(),children:`Reset`}),(0,z.jsx)(u,{variant:`primary`,icon:r,reason:t??(e.dirty?null:`Nothing has changed since the last save.`),onClick:()=>void e.save(),children:e.busy?`Saving…`:`Save`})]})}function X({item:e,editor:n}){let r=l(),[i,a]=(0,S.useState)(!1);return(0,z.jsxs)(`header`,{className:`image-editor-header`,children:[(0,z.jsxs)(`h1`,{className:`image-editor-title`,children:[`Crop & hotspot · `,e.filename]}),(0,z.jsxs)(`div`,{className:`image-editor-actions`,children:[(0,z.jsx)(v,{variant:`ghost`,icon:t,onClick:()=>n.dirty?a(!0):r(`/media`),children:`Back to Media`}),(0,z.jsx)(Y,{editor:n})]}),n.readOnly&&(0,z.jsxs)(`p`,{className:`image-editor-note`,role:`note`,children:[`Your role can view media but not change it.`,` The crop and hotspot are shown as saved.`]}),i&&(0,z.jsx)(J,{onStay:()=>a(!1),onLeave:()=>r(`/media`)})]})}function Z({item:e,editor:t}){return g(e)?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`image-editor-canvas`,children:t.tool===`crop`?(0,z.jsx)(H,{item:e,editor:t}):(0,z.jsx)(V,{item:e,editor:t})}),(0,z.jsx)(K,{editor:t}),(0,z.jsx)(q,{item:e,version:t.version})]}):(0,z.jsx)(`p`,{className:`image-editor-note`,children:`This file is not an image: only images have a crop and a hotspot.`})}function Q(){let{id:e=``}=s(),{hasRole:t}=d(),n=R(e,!t(`editor`)),{loaded:r}=n;return r.state===`loading`?(0,z.jsx)(`p`,{role:`status`,children:`Reading the image…`}):r.state===`missing`?(0,z.jsxs)(`div`,{className:`image-editor`,children:[(0,z.jsx)(`p`,{role:`alert`,children:r.message}),(0,z.jsx)(c,{to:`/media`,className:_(`secondary`,`sm`),children:`Back to Media`})]}):(0,z.jsxs)(`div`,{className:`image-editor`,children:[(0,z.jsx)(X,{item:r.item,editor:n}),(0,z.jsx)(Z,{item:r.item,editor:n})]})}export{Q as ImageEditorPage};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AssistantPanel-B7HETGhh.js","assets/rolldown-runtime-COiEfhsA.js","assets/createLucideIcon-BklFHeMd.js","assets/vendor-diff-DGCTJYJ4.js","assets/createLucideIcon-DO6kYgVn.css","assets/vendor-router-B4czwg8X.js","assets/api-client-BRi_ki2Y.js","assets/auth-CIpilSKF.js","assets/send-kYpW5JED.js","assets/vendor-markdown-pd8vs9n-.js","assets/circle-check-big-DQjpuxcC.js","assets/clock-DoBIVjZO.js","assets/copy-V85khWct.js","assets/info-Cxkabti5.js","assets/triangle-exclamation-point-ttN5lZI0.js","assets/circle-x-peGpq98w.js","assets/AssistantPanel-DB6gluI1.css","assets/pulse-page-HsxpGgEu.js","assets/api-seo-Cjv4a9Y_.js","assets/format-C3ZX9yGM.js","assets/source-CGZGd3Xy.js","assets/empty-state-CeUZocHx.js","assets/empty-state-Bvnil5AQ.css","assets/findability-BrhtZ2yD.js","assets/meter-ZOLJ0WhG.js","assets/meter-WebPk4WX.css","assets/pen-line-B524Nue8.js","assets/pulse-page-HgFM-MfC.css","assets/site-overview-BJNMesQZ.js","assets/data-table-B1kqxrEw.js","assets/data-table-Dm9uZXES.css","assets/site-model-CoSgHHeY.js","assets/site-BfbIKOk1.js","assets/use-loaded-DFUDFVFt.js","assets/circle-dashed-cuYrILNo.js","assets/corner-down-right-BpwOGRFR.js","assets/external-link-Dh7p8Ii6.js","assets/site-lUERQFzn.css","assets/collection-view-CUWLWvwR.js","assets/export-helpers-C_HVpJN9.js","assets/upload-CaqQJaUr.js","assets/guards-BFEDbduR.js","assets/trash-DzRCm500.js","assets/collection-view-Dllo4l_w.css","assets/editor-page-jSK3xMkh.js","assets/use-drawer-actions-D-rIBvJ8.js","assets/media-model-D4F1Farw.js","assets/action-button-DIrhqMRc.js","assets/use-drawer-actions-DeFJMhBn.css","assets/rotate-ccw-BgARBEK3.js","assets/vendor-react-CXaWJ_ii.js","assets/vendor-react-DLioOiRN.css","assets/graph-config-BJA_ztYM.js","assets/layers-0VWe0rKm.js","assets/graph-config-mZyX0Lqo.css","assets/fill-job-B-Z4jnVQ.js","assets/arrow-left-7opbl8fu.js","assets/use-locale-versions-DHt-x8c_.js","assets/editor-page-D-qGDgmd.css","assets/structure-page-ZD8c7Ukz.js","assets/fill-run-view-Bx-nSvtd.js","assets/fill-run-view-BhqhXo7I.css","assets/save-ClSXW9cb.js","assets/vendor-reactflow-CMKi7AEX.js","assets/catalog-offer-CeRRk2Zo.js","assets/arrow-down-B5kfR2lG.js","assets/list-checks-BCEhMMVY.js","assets/structure-page-DVSxQzgj.css","assets/media-page-B3Q4EH3m.js","assets/pencil-xdGZtrO4.js","assets/media-page-DBdAvFvu.css","assets/image-editor-CEzh5OFw.js","assets/vendor-media-DXSmPN_d.js","assets/vendor-media-DJOnVxEf.css","assets/image-editor-BTlqjPtS.css","assets/setup-page-DsYYpFrd.js","assets/setup-page-Bc799yav.css"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,o as n,s as r}from"./vendor-diff-DGCTJYJ4.js";import{m as i,p as a}from"./vendor-react-CXaWJ_ii.js";import{a as o,c as s,d as c,i as l,l as u,n as d,o as ee,p as f,t as p,u as te}from"./vendor-router-B4czwg8X.js";import{i as m,r as ne,t as re}from"./auth-CIpilSKF.js";import{c as ie,d as h,o as ae,s as oe,t as g,u as _}from"./format-C3ZX9yGM.js";import{i as v,n as y,r as b,t as x}from"./createLucideIcon-BklFHeMd.js";import{i as S,r as C,t as se}from"./api-client-BRi_ki2Y.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var w=e(r(),1),ce=a(),T=`globals`,E=encodeURIComponent;function D(e,t,n){let r=e===`globals`?`/layout/${E(t)}`:`/site/${E(e)}/${E(t)}`;return n?`${r}?locale=${E(n)}`:r}function le(e,t,n){let r=new URLSearchParams({...n?{locale:n}:{},mode:`data`});return`/site/${E(e)}/${E(t)}?${r}`}function O(e){return`/site/${E(e)}`}function k(e){return`/new/${E(e)}`}var ue=`/structure/graph?fill=1`;function de(e){return e?`/structure/scopes#scope-${e}`:`/structure/scopes`}function fe(e){return`/media/${E(e)}/edit`}var pe=`/setup/ai`,A=n();function me(e){if(typeof e!=`object`||!e)return!1;let{name:t,login_url:n}=e;return typeof t==`string`&&typeof n==`string`}function he(e){let t=e?.capabilities?.oidc_providers;return Array.isArray(t)?t.filter(me):[]}function ge(){let{login:e,authMode:t}=m(),[n,r]=(0,w.useState)(``),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)([]),u=(0,w.useCallback)(e=>{e?.focus()},[]);(0,w.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get(`error`);e&&(a(e),window.history.replaceState({},``,window.location.pathname))},[]),(0,w.useEffect)(()=>{t===`oidc`&&fetch(`/api/auth/capabilities`).then(e=>e.json()).then(e=>{l(he(e))}).catch(()=>{})},[t]);async function d(t){t.preventDefault(),n.trim()&&(s(!0),a(null),await e(n.trim())||a(`Invalid access token`),s(!1))}return(0,A.jsx)(`div`,{className:`login-page`,children:(0,A.jsxs)(`div`,{className:`login-card`,children:[(0,A.jsx)(`h1`,{className:`login-title`,children:`krantho`}),(0,A.jsx)(`p`,{className:`login-subtitle`,children:t===`token`?`Enter your access token to continue`:`Sign in to continue`}),i&&(0,A.jsx)(`div`,{className:`login-error`,children:i}),t===`token`&&(0,A.jsxs)(`form`,{onSubmit:d,className:`login-form`,children:[(0,A.jsxs)(`div`,{className:`field`,children:[(0,A.jsx)(`label`,{className:`field-label`,htmlFor:`token`,children:`Access Token`}),(0,A.jsx)(`input`,{id:`token`,type:`password`,className:`field-input`,value:n,onChange:e=>r(e.target.value),placeholder:`Enter token`,ref:u})]}),(0,A.jsx)(`button`,{type:`submit`,className:v(`primary`,`md`,`login-btn`),disabled:o,children:o?`Signing in...`:`Sign In`})]}),t===`oidc`&&(0,A.jsxs)(`div`,{className:`login-oidc`,children:[c.map(e=>(0,A.jsxs)(`a`,{href:e.login_url,className:v(`primary`,`md`,`login-btn`),children:[`Sign in with `,e.name]},e.login_url)),c.length===0&&(0,A.jsx)(`p`,{className:`login-subtitle`,children:`No OIDC providers configured`})]})]})})}var _e=(0,w.createContext)(null);function ve({children:e}){let[t,n]=(0,w.useState)(!1),[r,i]=(0,w.useState)(!1),a=(0,w.useRef)(null),o=(0,w.useCallback)(()=>{i(!0),n(e=>!e)},[]),s=(0,w.useCallback)(()=>{n(!1),a.current?.focus()},[]),c=(0,w.useMemo)(()=>({open:t,opened:r,toggle:o,close:s,launcherRef:a}),[t,r,o,s]);return(0,A.jsx)(_e,{value:c,children:e})}function j(){return(0,w.useContext)(_e)}function ye(e){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(e).matches}function be(e){let[t,n]=(0,w.useState)(()=>ye(e));return(0,w.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function xe(e){try{let t=JSON.parse(localStorage.getItem(e)??`null`);return typeof t==`object`&&t?t:{}}catch{return{}}}function Se(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function Ce(e,t,n){return typeof e==`number`&&e>=t.min&&e<=t.max?e:n}function we(e,t){let[n,r]=(0,w.useState)(t),i=(0,w.useRef)(n);return(0,w.useEffect)(()=>{n!==i.current&&(i.current=n,Se(e,n))},[e,n]),[n,r]}var Te=`krantho-studio-nav`,M={min:200,max:360,fallback:236};function Ee(){let{collapsed:e,width:t,closedGroups:n}=xe(Te);return{collapsed:e===!0,width:Ce(t,M,M.fallback),closedGroups:Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}}function De(){let[e,t]=we(Te,Ee),n=(0,w.useCallback)(e=>t(t=>({...t,collapsed:e})),[t]),r=(0,w.useCallback)(e=>t(t=>({...t,width:e})),[t]),i=(0,w.useCallback)(e=>t(t=>({...t,closedGroups:t.closedGroups.includes(e)?t.closedGroups.filter(t=>t!==e):[...t.closedGroups,e]})),[t]);return{...e,setCollapsed:n,setWidth:r,toggleGroup:i}}var Oe={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};Oe.node;var ke=x(Oe),Ae={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};Ae.node;var je=x(Ae),Me={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};Me.node;var Ne=x(Me),Pe={name:`boxes`,size:24,node:[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]};Pe.node;var Fe=x(Pe),Ie={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Ie.node;var N=x(Ie),Le={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};Le.node;var Re=x(Le),ze={name:`circle-exclamation-point`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`,`circle-alert`]};ze.node;var Be=x(ze),Ve={name:`cloud-upload`,size:24,node:[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]],aliases:[`upload-cloud`]};Ve.node;var He=x(Ve),Ue={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};Ue.node;var We=x(Ue),Ge={name:`file-plus`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]};Ge.node;var Ke=x(Ge),qe={name:`folder-tree`,size:24,node:[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]};qe.node;var Je=x(qe),Ye={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};Ye.node;var Xe=x(Ye),Ze={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};Ze.node;var Qe=x(Ze),$e={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};$e.node;var et=x($e),tt={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};tt.node;var nt=x(tt),rt={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};rt.node;var it=x(rt),at={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};at.node;var ot=x(at),st={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};st.node;var ct=x(st),lt={name:`network`,size:24,node:[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]};lt.node;var P=x(lt),ut={name:`panel-left-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]],aliases:[`sidebar-close`]};ut.node;var dt=x(ut),ft={name:`panel-left-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]],aliases:[`sidebar-open`]};ft.node;var pt=x(ft),mt={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};mt.node;var ht=x(mt),gt={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};gt.node;var _t=x(gt),vt={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};vt.node;var F=x(vt),yt={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};yt.node;var bt=x(yt),xt={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};xt.node;var St=x(xt),Ct={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};Ct.node;var wt=x(Ct),Tt={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};Tt.node;var Et=x(Tt),Dt={name:`wand-sparkles`,size:24,node:[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]],aliases:[`wand-2`]};Dt.node;var Ot=x(Dt),kt={name:`webhook`,size:24,node:[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]};kt.node;var At=x(kt),jt={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};jt.node;var I=x(jt),Mt=6e3,Nt=(0,w.createContext)(null);function Pt(){let e=(0,w.useContext)(Nt);if(!e)throw Error(`useToast needs a ToastProvider`);return e}function Ft(e,t){let[n,r]=(0,w.useState)(!1),i=(0,w.useRef)(t);return(0,w.useEffect)(()=>{i.current=t},[t]),(0,w.useEffect)(()=>{if(e!==`success`||n)return;let t=setTimeout(()=>i.current(),Mt);return()=>clearTimeout(t)},[e,n]),r}function It(e){(0,w.useLayoutEffect)(()=>{let t=e.current;return()=>{if(!t?.contains(document.activeElement))return;let e=[...document.querySelectorAll(`.ui-toast-dismiss`)].filter(e=>!t.contains(e))[0]??document.getElementById(`studio-main`);queueMicrotask(()=>(e?.isConnected?e:document.getElementById(`studio-main`))?.focus())}},[e])}var Lt={success:Re,error:Be};function Rt({entry:e,onExpire:t,onDismiss:n}){let r=Ft(e.tone,t),i=(0,w.useRef)(null);It(i);let a=Lt[e.tone];return(0,A.jsxs)(`div`,{ref:i,className:`ui-toast ui-toast--${e.tone}`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),n())},children:[(0,A.jsx)(a,{className:`ui-toast-icon`,"aria-hidden":`true`}),(0,A.jsx)(`p`,{className:`ui-toast-text`,children:e.text}),(0,A.jsx)(`button`,{type:`button`,className:`ui-toast-dismiss`,"aria-label":`Dismiss`,onClick:n,children:(0,A.jsx)(I,{"aria-hidden":`true`})})]})}function zt({entries:e,dismiss:t}){return e.map(e=>(0,A.jsx)(Rt,{entry:e,onExpire:()=>t(e.id),onDismiss:()=>t(e.id)},e.id))}function Bt({children:e}){let[t,n]=(0,w.useState)([]),r=(0,w.useRef)(0),i=(0,w.useCallback)(({text:e,tone:t=`success`})=>{r.current+=1;let i={id:r.current,text:e,tone:t};n(e=>[...e,i].slice(-3))},[]),a=(0,w.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e))},[]);return(0,A.jsxs)(Nt.Provider,{value:i,children:[e,(0,A.jsxs)(`div`,{className:`ui-toasts`,children:[(0,A.jsx)(`div`,{className:`ui-toast-region`,role:`status`,"aria-label":`Notifications`,children:(0,A.jsx)(zt,{entries:t.filter(e=>e.tone===`success`),dismiss:a})}),(0,A.jsx)(`div`,{className:`ui-toast-region`,role:`alert`,"aria-label":`Errors`,children:(0,A.jsx)(zt,{entries:t.filter(e=>e.tone===`error`),dismiss:a})})]})]})}var Vt=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`;function L(e){return[...e.querySelectorAll(Vt)].filter(e=>!e.closest(`[hidden], [inert]`))}function Ht(e,t){if(e.key!==`Tab`)return;let n=L(t),r=n[0],i=n[n.length-1];if(!r||!i){e.preventDefault();return}let a=document.activeElement;e.shiftKey&&(a===r||!t.contains(a))?(e.preventDefault(),i.focus()):e.shiftKey||a!==i&&t.contains(a)||(e.preventDefault(),r.focus())}function R(e,t,n){(0,w.useEffect)(()=>{let r=e.current;if(!t||!r)return;let i=document.activeElement instanceof HTMLElement?document.activeElement:null;(n?.current??L(r)[0]??r).focus();let a=e=>Ht(e,r);return document.addEventListener(`keydown`,a),()=>{document.removeEventListener(`keydown`,a),i?.isConnected&&i.focus()}},[t,e,n])}async function z(){return(await S(`/collections`)).collections}async function Ut(e,t){let n=new URLSearchParams({view:`summary`});t?.status&&n.set(`status`,t.status),t?.sort&&n.set(`sort`,t.sort),t?.limit!==void 0&&n.set(`limit`,String(t.limit)),t?.offset!==void 0&&n.set(`offset`,String(t.offset)),t?.locale&&n.set(`locale`,t.locale);let r=n.toString();return S(`/content/${e}?${r}`)}async function Wt(e){return S(`/content-tree?locale=${encodeURIComponent(e)}`)}var Gt=500;async function Kt(e={}){let t=[];for(;;){let n=new URLSearchParams({view:e.view??`summary`});e.collections?.length&&n.set(`collections`,e.collections.join(`,`)),e.locale&&n.set(`locale`,e.locale),e.status&&n.set(`status`,e.status),n.set(`limit`,String(Gt)),n.set(`offset`,String(t.length));let r=await S(`/content?${n}`);if(t.push(...r.items),!r.hasMore||r.items.length===0)return t}}async function qt(e,t,n){return S(`/content/${e}/${t}${C(n)}`)}async function Jt(e){return S(`/schema/${e}`)}async function Yt(e,t){return S(`/content/${e}`,{method:`POST`,body:JSON.stringify(t)})}async function Xt(e,t,n){return S(`/content/${e}/${t}`,{method:`PUT`,body:JSON.stringify(n)})}async function Zt(e,t,n){return S(`/content/${e}/${t}/publish-impact${C(n)}`)}async function Qt(e,t,n){let r={method:`POST`};return n?.status&&(r.body=JSON.stringify({status:n.status})),S(`/content/${e}/${t}/publish${C(n?.locale)}`,r)}async function $t(e){return S(`/content/search?q=${encodeURIComponent(e)}`)}async function en(e,t,n){return S(`/content/${e}/bulk`,{method:`DELETE`,body:JSON.stringify(n?{slugs:t,locale:n}:{slugs:t})})}async function tn(e,t,n){return S(`/content/${e}/bulk-publish`,{method:`POST`,body:JSON.stringify(n?{slugs:t,locale:n}:{slugs:t})})}async function nn(e){return S(`/schema/${e}/runtime`)}async function rn(e,t){return S(`/schema/${e}/fields`,{method:`PUT`,body:JSON.stringify(t)})}async function an(e,t){return S(`/schema/${e}/fields/${t}`,{method:`DELETE`})}async function on(e){return S(`/schema/${e}/export`)}async function sn(e,t=`json`,n){let r=new URLSearchParams({format:t});return n&&r.set(`locale`,n),S(`/content/${e}/export?${r}`)}async function cn(e,t){return S(`/content/${e}/import`,{method:`POST`,body:JSON.stringify({items:t})})}async function ln(e){let t=new URLSearchParams;e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset)),e?.status&&t.set(`status`,e.status);let n=t.toString();return S(`/webhooks/deliveries${n?`?${n}`:``}`)}async function un(e){return S(`/webhooks/deliveries/${e}/retry`,{method:`POST`})}async function dn(){return S(`/translations/status`)}function B(e){return e.liveVersion===null?`draft`:e.liveVersion>=e.version?`live`:`ahead`}var fn={live:`Live`,ahead:`Unpublished changes`,draft:`Not published`};async function pn(){return S(`/site-config`)}async function mn(){return S(`/settings/locales`)}async function hn(e){return S(`/settings/locales`,{method:`PUT`,body:JSON.stringify({supportedLocales:e})})}async function gn(){return S(`/settings/llm`)}async function _n(e){return S(`/settings/llm`,{method:`PUT`,body:JSON.stringify(e)})}async function vn(e){return S(`/settings/llm?provider=${encodeURIComponent(e)}`,{method:`DELETE`})}async function yn(e){return S(`/settings/llm/test`,{method:`POST`,body:JSON.stringify({provider:e})})}async function V(){let{defaultLocale:e,supportedLocales:t}=await mn();return{defaultLocale:e,supportedLocales:t}}function bn(e){return e.supportedLocales.length>1}async function xn(){let[e,t]=await Promise.all([Kt({view:`meta`}),V()]),n=new Map;for(let r of e){if(!t.supportedLocales.includes(r.locale)||B(r)!==`ahead`)continue;let e=`${r.collection}\u0000${r.locale}`,i=n.get(e)??{collection:r.collection,locale:r.locale,slugs:[]};i.slugs.push(r.slug),n.set(e,i)}return[...n.values()]}function Sn(e){return e.reduce((e,t)=>e+t.slugs.length,0)}async function Cn(e){let t=0;for(let n of e){let e=await tn(n.collection,n.slugs,n.locale);t+=e.published}return t}function H({status:e,decorative:t=!1}){let n=`ui-status-dot ui-status-dot--${e}`;if(t)return(0,A.jsx)(`span`,{className:n,"aria-hidden":`true`});let r=fn[e];return(0,A.jsx)(`span`,{className:n,role:`img`,"aria-label":r,title:r})}async function wn(){let{checkpoints:e}=await S(`/checkpoints`);return e}async function Tn(e){return S(`/checkpoints`,{method:`POST`,body:JSON.stringify(e?{name:e}:{})})}async function En(e){return S(`/checkpoints/${e}/restore`,{method:`POST`})}async function Dn(e){await S(`/checkpoints/${e}`,{method:`DELETE`})}async function On(e,t,n){try{return await S(`/content/${e}/${t}/lock${C(n)}`,{method:`POST`})}catch(e){if(e instanceof se){let t=typeof e.body.lockedBy==`string`?e.body.lockedBy:null,n=typeof e.body.expiresAt==`string`?e.body.expiresAt:null;return{locked:!1,error:e.message,status:e.status,...t?{lockedBy:t}:{},...n?{expiresAt:n}:{}}}return{locked:!1,error:e instanceof Error?e.message:`Failed to acquire lock`}}}async function kn(e,t,n){try{await S(`/content/${e}/${t}/lock${C(n)}`,{method:`DELETE`})}catch{}}async function An(){return(await S(`/locks`)).locks}function jn(e){return e instanceof se&&e.status===404}function U(e,t){return e instanceof Error?e.message:t}var Mn=200,Nn=8;function Pn(e){let[t,n]=(0,w.useState)({phase:`idle`}),r=e.trim();return(0,w.useEffect)(()=>{if(r.length<2){n({phase:`idle`});return}let e=!0;n({phase:`loading`});let t=setTimeout(()=>{$t(r).then(t=>{e&&n({phase:`done`,items:t.items.slice(0,Nn)})}).catch(t=>{e&&n({phase:`failed`,message:t instanceof Error?t.message:`Search failed`})})},Mn);return()=>{e=!1,clearTimeout(t)}},[r]),t}function Fn(){let[e,t]=(0,w.useState)(null);return(0,w.useEffect)(()=>{let e=!0;return z().then(n=>{e&&t(n.find(e=>e.pages)??null)}).catch(()=>{}),()=>{e=!1}},[]),e}function In({canEdit:e,pages:t,go:n,confirmPublishAll:r}){if(!e)return[];let i=[];return t&&i.push({id:`new-page`,label:`New page`,detail:`In ${g(t.name)}`,icon:Ke,run:n(k(t.name))}),i.push({id:`publish-all`,label:`Publish all drafts ahead of live`,detail:`Asks before publishing`,icon:He,run:r}),i}function Ln({canEdit:e,checkpoints:t,seo:n,go:r}){let i=[];return e&&t&&i.push({id:`checkpoint`,label:`Create checkpoint`,detail:`A restorable copy of the whole content store`,icon:je,run:async()=>{await Tn(),r(`/setup/checkpoints`)()}}),e&&n&&i.push({id:`enrich`,label:`Enrich missing SEO`,detail:`Opens Structure's Fill what's missing`,icon:Ot,run:r(ue)}),n&&i.push({id:`structure`,label:`Structure`,detail:`How search engines and assistants read the site`,icon:P,run:r(`/structure`)}),i}function Rn({close:e,confirmPublishAll:t}){let n=te(),r=h(),{hasRole:i}=m(),a=Fn(),o=i(`editor`),s=_(r,`checkpoints`),c=_(r,`seo`);return(0,w.useMemo)(()=>{let r={canEdit:o,checkpoints:s,seo:c,pages:a,go:t=>()=>{e(),n(t)},confirmPublishAll:t};return[...In(r),...Ln(r)]},[o,s,c,a,e,t,n])}function zn(e){return e.map(({id:e,label:t,detail:n,icon:r,run:i})=>({id:e,label:t,detail:n,icon:r,run:i}))}function Bn(e,t){return e.phase===`done`?e.items.map(({meta:e,fields:n})=>({id:`${e.collection}/${e.slug}/${e.locale}`,label:typeof n.title==`string`&&n.title?n.title:e.slug,detail:`${g(e.collection)} · ${e.slug}`,status:B(e),run:()=>t(D(e.collection,e.slug))})):[]}function Vn(e,t,n){let r=e.trim();return r===``?n===0?`No commands are available to you here.`:null:r.length<2?`Keep typing to search documents.`:t.phase===`loading`?`Searching…`:t.phase===`failed`?t.message:t.phase===`done`&&n===0?`No documents match “${r}”.`:null}function Hn(e,t){let n=te(),r=Pn(e),i=Rn({close:t.onClose,confirmPublishAll:t.confirmPublishAll});return e.trim()===``?{options:zn(i),search:r}:{options:Bn(r,e=>{t.onClose(),n(e)}),search:r}}function Un(e,t,n,r){return i=>{let a=e.length;if(i.key===`ArrowDown`||i.key===`ArrowUp`){if(i.preventDefault(),a===0)return;let e=i.key===`ArrowDown`?1:-1;n(t=>(t+e+a)%a)}else i.key===`Enter`&&(i.preventDefault(),r(e[t]))}}function Wn(e){let[t,n]=(0,w.useState)(``),[r,i]=(0,w.useState)(0),[a,o]=(0,w.useState)(null),{options:s,search:c}=Hn(t,e),l=a??Vn(t,c,s.length);(0,w.useEffect)(()=>i(0),[t,s.length]);async function u(e){if(e){o(e.id===`publish-all`?`Counting drafts ahead of live…`:null);try{await e.run()}catch(t){o(U(t,`${e.label} failed`))}}}return{query:t,setQuery:e=>{n(e),o(null)},active:r,setActive:i,options:s,status:l,run:u,handleKeyDown:Un(s,r,i,u)}}var Gn=i();function Kn({title:e,children:t,actions:n,onClose:r,initialFocus:i,busy:a=!1}){let o=(0,w.useRef)(null),s=(0,w.useId)();R(o,!0,i);function c(e){e.key===`Escape`&&(e.stopPropagation(),r())}return(0,Gn.createPortal)((0,A.jsxs)(`div`,{className:`ui-modal-layer`,children:[(0,A.jsx)(`div`,{className:`ui-modal-scrim`,"aria-hidden":`true`,onClick:r}),(0,A.jsxs)(`div`,{ref:o,role:`dialog`,"aria-modal":`true`,"aria-labelledby":s,"aria-busy":a,className:`ui-modal`,tabIndex:-1,onKeyDown:c,children:[(0,A.jsx)(`h2`,{id:s,className:`ui-modal-title`,children:e}),(0,A.jsx)(`div`,{className:`ui-modal-body`,children:t}),(0,A.jsx)(`div`,{className:`ui-modal-actions`,children:n})]})]}),document.body)}function qn(e){return e===1?`1 document`:`${e} documents`}function Jn({phase:e,count:t}){return e.name===`done`?(0,A.jsxs)(`p`,{role:`status`,children:[`Published `,qn(e.published),`. Visitors now see the saved versions.`]}):e.name===`failed`?(0,A.jsx)(`p`,{role:`alert`,children:e.message}):t===0?(0,A.jsx)(`p`,{children:`No document has unpublished changes. Every live page shows its latest saved version.`}):(0,A.jsxs)(`p`,{children:[t===1?`1 document has`:`${t} documents have`,` unpublished changes. Publishing makes each saved version what visitors see.`]})}function Yn(e,t){let[n,r]=(0,w.useState)({name:`ask`});async function i(){if(n.name!==`publishing`){r({name:`publishing`});try{let n=await Cn(e);r({name:`done`,published:n}),t()}catch(e){r({name:`failed`,message:U(e,`Publishing failed`)})}}}return{phase:n,publish:i}}function Xn({phase:e,count:t,safeRef:n,onClose:r,onPublish:i}){let a=e.name===`publishing`;return t===0||e.name===`done`||e.name===`failed`?(0,A.jsx)(y,{ref:n,onClick:r,children:`Close`}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(y,{ref:n,onClick:a?void 0:r,"aria-disabled":a,children:`Cancel`}),(0,A.jsx)(y,{variant:`primary`,onClick:a?void 0:i,"aria-disabled":a,children:a?`Publishing…`:`Publish ${qn(t)}`})]})}function Zn({groups:e,onClose:t,onPublished:n}){let r=Sn(e),{phase:i,publish:a}=Yn(e,n),o=(0,w.useRef)(null),s=i.name===`publishing`;return(0,w.useEffect)(()=>{(i.name===`done`||i.name===`failed`)&&o.current?.focus()},[i.name]),(0,A.jsx)(Kn,{title:`Publish all drafts ahead of live`,onClose:s?()=>void 0:t,initialFocus:o,busy:s,actions:(0,A.jsx)(Xn,{phase:i,count:r,safeRef:o,onClose:t,onPublish:()=>void a()}),children:(0,A.jsx)(Jn,{phase:i,count:r})})}function Qn({open:e,onClose:t,onContentChanged:n}){let[r,i]=(0,w.useState)(null),a=(0,w.useCallback)(async()=>{i(await xn())},[]);return(0,w.useEffect)(()=>{e||i(null)},[e]),e?r?(0,A.jsx)(Zn,{groups:r,onClose:t,onPublished:n}):(0,A.jsx)($n,{onClose:t,confirmPublishAll:a}):null}function $n(e){let t=Wn(e),n=(0,w.useRef)(null),r=(0,w.useRef)(null),i=(0,w.useId)();return R(n,!0,r),(0,A.jsxs)(`div`,{className:`palette-layer`,children:[(0,A.jsx)(`div`,{className:`palette-scrim`,"aria-hidden":`true`,onClick:e.onClose}),(0,A.jsxs)(`div`,{ref:n,role:`dialog`,"aria-modal":`true`,"aria-label":`Command palette`,className:`palette`,onKeyDown:t=>{t.key===`Escape`&&e.onClose()},children:[(0,A.jsx)(er,{inputRef:r,listId:i,state:t}),(0,A.jsx)(`p`,{className:`palette-status`,role:`status`,children:t.status}),(0,A.jsx)(tr,{listId:i,state:t}),(0,A.jsxs)(`p`,{className:`palette-hint`,"aria-hidden":`true`,children:[(0,A.jsx)(`kbd`,{children:`↑`}),(0,A.jsx)(`kbd`,{children:`↓`}),` to move `,(0,A.jsx)(`kbd`,{children:`↵`}),` to open `,(0,A.jsx)(`kbd`,{children:`Esc`}),` to close`]})]})]})}function er({inputRef:e,listId:t,state:n}){let r=n.options.length>0;return(0,A.jsxs)(`div`,{className:`palette-search`,children:[(0,A.jsx)(F,{className:`palette-search-icon`,"aria-hidden":`true`}),(0,A.jsx)(`input`,{ref:e,className:`palette-input`,role:`combobox`,"aria-expanded":r,"aria-controls":t,"aria-autocomplete":`list`,"aria-activedescendant":r?`${t}-${n.active}`:void 0,"aria-label":`Search documents or run a command`,placeholder:`Search documents or run a command…`,autoComplete:`off`,spellCheck:!1,value:n.query,onChange:e=>n.setQuery(e.target.value),onKeyDown:n.handleKeyDown}),(0,A.jsx)(`kbd`,{className:`palette-key`,children:`Esc`})]})}function tr({listId:e,state:t}){return(0,w.useEffect)(()=>{document.getElementById(`${e}-${t.active}`)?.scrollIntoView({block:`nearest`})},[e,t.active]),(0,A.jsx)(`div`,{id:e,role:`listbox`,"aria-label":t.query.trim()===``?`Commands`:`Documents`,className:`palette-list`,hidden:t.options.length===0,children:t.options.map((n,r)=>{let i=n.icon;return(0,A.jsxs)(`div`,{id:`${e}-${r}`,role:`option`,"aria-selected":r===t.active,className:`palette-option`,onMouseMove:()=>t.setActive(r),onClick:()=>void t.run(n),children:[(0,A.jsx)(`span`,{className:`palette-option-icon`,"aria-hidden":!n.status||void 0,children:n.status?(0,A.jsx)(H,{status:n.status}):i&&(0,A.jsx)(i,{})}),(0,A.jsxs)(`span`,{className:`palette-option-text`,children:[(0,A.jsx)(`span`,{className:`palette-option-label`,children:n.label}),(0,A.jsx)(`span`,{className:`palette-option-detail`,children:n.detail})]})]},n.id)})})}var nr=16;function rr(e,t,n){return Math.min(n,Math.max(t,e))}function ir(e){let{label:t,value:n,min:r,max:i,grows:a,onChange:o,onReset:s,controls:c}=e,l=a===`right`?1:-1,u=(0,w.useRef)(null);function d(e){if(e.button!==0)return;let t=e.currentTarget;typeof t.setPointerCapture==`function`&&t.setPointerCapture(e.pointerId),u.current={x:e.clientX,width:n},document.body.dataset.resizing=`true`}function ee(e){let t=u.current;t&&o(rr(t.width+l*(e.clientX-t.x),r,i))}function f(){u.current=null,delete document.body.dataset.resizing}function p(e){let t=e.shiftKey?64:nr,a={ArrowRight:t,ArrowLeft:-t};if(e.key===`Home`)o(r);else if(e.key===`End`)o(i);else if(e.key in a)o(rr(n+l*(a[e.key]??0),r,i));else return;e.preventDefault()}return(0,A.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":t,"aria-valuenow":n,"aria-valuemin":r,"aria-valuemax":i,"aria-controls":c,tabIndex:0,className:`resize-handle`,"data-edge":a,onPointerDown:d,onPointerMove:ee,onPointerUp:f,onPointerCancel:f,onKeyDown:p,onDoubleClick:s})}var W=()=>!0,G=e=>t=>_(t,e),K=[{id:`collections`,path:`/setup/collections`,label:`Collections & schema`,icon:Fe,visible:(e,t)=>_(e,`runtimeSchema`)&&(!t.loginRequired||ne(t.roles,`admin`))},{id:`locales`,path:`/setup/locales`,label:`Locales`,icon:Qe,visible:W},{id:`ai`,path:`/setup/ai`,label:`AI provider`,icon:We,visible:W},{id:`integrations`,path:`/setup/integrations`,label:`Integrations`,icon:At,visible:G(`webhookDeliveries`)},{id:`checkpoints`,path:`/setup/checkpoints`,label:`Checkpoints`,icon:_t,visible:G(`checkpoints`)},{id:`people`,path:`/setup/people`,label:`People`,icon:Et,visible:(e,t)=>(e.authMode===`token`||e.authMode===`oidc`)&&ne(t.roles,`admin`)},{id:`environment`,path:`/setup/environment`,label:`Environment`,icon:bt,visible:W}],ar=[{id:`pulse`,path:`/`,label:`Pulse`,icon:ke,visible:W},{id:`site`,path:`/site`,label:`Site`,icon:Je,visible:W},{id:`structure`,path:`/structure`,label:`Structure`,icon:P,visible:G(`seo`)},{id:`media`,path:`/media`,label:`Media`,icon:Xe,visible:G(`media`)},{id:`setup`,path:`/setup`,label:`Setup`,icon:St,visible:(e,t)=>K.some(n=>n.visible(e,t))}],q=[{id:`graph`,path:`/structure/graph`,label:`Graph`},{id:`scopes`,path:`/structure/scopes`,label:`Scopes & archetypes`},{id:`rich-results`,path:`/structure/rich-results`,label:`Rich results`},{id:`crawlers`,path:`/structure/crawlers`,label:`Crawlers & assistants`}];function or(e,t){return ar.filter(n=>n.visible(e,t))}function sr(e,t){return K.filter(n=>n.visible(e,t))}function cr(e,t,n){return ar.some(r=>r.id===e&&r.visible(t,n))}function lr(e){if(e===`/`||e===``)return`pulse`;let t=e.split(`/`)[1]??``;return t===`site`||t===`layout`||t===`new`?`site`:t===`structure`||t===`media`||t===`setup`?t:null}function ur(e=`neutral`,t){return[`ui-chip`,`ui-chip--${e}`,t].filter(Boolean).join(` `)}function dr({tone:e=`neutral`,icon:t,children:n}){return(0,A.jsxs)(`span`,{className:ur(e),children:[t&&(0,A.jsx)(t,{className:`ui-chip-icon`,"aria-hidden":`true`}),n]})}var fr=`krantho-studio-theme`;function pr(){try{let e=localStorage.getItem(fr);return e===`light`||e===`dark`?e:`system`}catch{return`system`}}function mr(){let[e,t]=(0,w.useState)(pr),n=(0,w.useCallback)(e=>{t(e);try{localStorage.setItem(fr,e)}catch{}},[]);return(0,w.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,e)},[e]),{theme:e,setTheme:n}}var J=[{value:`light`,label:`Light`,icon:wt},{value:`dark`,label:`Dark`,icon:ct},{value:`system`,label:`System`,icon:ot}],hr={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};function gr({index:e,checked:t,buttons:n,onChoose:r}){let i=J[e];if(!i)return null;let a=i.icon;function o(t){let n=hr[t.key];n!==void 0&&(t.preventDefault(),r((e+n+J.length)%J.length))}return(0,A.jsx)(`button`,{ref:t=>{n.current[e]=t},type:`button`,role:`radio`,"aria-checked":t,"aria-label":i.label,title:i.label,tabIndex:t?0:-1,className:`theme-switch-option`,onClick:()=>r(e),onKeyDown:o,children:(0,A.jsx)(a,{"aria-hidden":`true`})})}function _r({vertical:e=!1}){let{theme:t,setTheme:n}=mr(),r=(0,w.useRef)([]);function i(e){let t=J[e];t&&(n(t.value),r.current[e]?.focus())}return(0,A.jsx)(`div`,{className:`theme-switch`,role:`radiogroup`,"aria-label":`Theme`,"aria-orientation":e?`vertical`:`horizontal`,"data-vertical":e,children:J.map((e,n)=>(0,A.jsx)(gr,{index:n,checked:t===e.value,buttons:r,onChoose:i},e.value))})}function vr(){let e=j();return e?(0,A.jsxs)(`button`,{ref:e.launcherRef,type:`button`,className:`nav-item`,"aria-expanded":e.open,"aria-controls":e.opened?`assistant-panel`:void 0,onClick:e.toggle,children:[(0,A.jsx)(Ne,{className:`nav-item-icon`,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`nav-item-label`,children:`Assistant`})]}):null}function yr({collapsed:e}){let t=m();if(!t.loginRequired)return null;let n=t.user?.roles[0]??`viewer`;return(0,A.jsxs)(A.Fragment,{children:[t.user&&!e&&(0,A.jsxs)(`div`,{className:`nav-user`,children:[(0,A.jsx)(`span`,{className:`nav-user-email`,title:t.user.email,children:t.user.email}),(0,A.jsx)(dr,{tone:n===`admin`?`accent`:`neutral`,children:n})]}),(0,A.jsxs)(`button`,{type:`button`,className:`nav-item`,onClick:()=>void t.logout(),children:[(0,A.jsx)(nt,{className:`nav-item-icon`,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`nav-item-label`,children:`Log out`})]})]})}function br({mode:e,onToggleCollapsed:t}){let n=e===`collapsed`;return(0,A.jsxs)(`div`,{className:`nav-footer`,children:[(0,A.jsx)(vr,{}),(0,A.jsx)(yr,{collapsed:n}),(0,A.jsxs)(`div`,{className:`nav-footer-row`,children:[(0,A.jsx)(_r,{vertical:n}),e!==`drawer`&&(0,A.jsx)(b,{icon:n?pt:dt,label:n?`Expand navigation`:`Collapse navigation`,"aria-expanded":!n,"aria-controls":`studio-nav`,size:`sm`,onClick:t})]})]})}var Y=`:slug`;function xr(e){return e.path===void 0?e.name!==`globals`:e.path!==!1}function Sr(e,t){if(!xr(e))return null;let{name:n,path:r}=e;return typeof r==`string`?wr(r,t):n===`pages`?t===`home`?`/`:`/${t}`:`/${n}/${t}`}function Cr(e){if(!xr(e))return null;let{name:t,path:n}=e;return typeof n==`string`?n.replace(`/${Y}`,``)||`/`:t===`pages`?`/`:`/${t}`}function wr(e,t){if(!e.includes(Y))return e;let n=`/${Y}`;return t===`index`&&e.includes(n)?e.replace(n,``)||`/`:e.replaceAll(Y,t)}function Tr(e){return e?`${e.roles[0]??`unknown`}:${e.email}`:null}function Er(e){return e.replace(/^(admin|editor|viewer|unknown):/,``)}function Dr(e,t,n=Date.now()){let r=Tr(t);return e.filter(e=>e.lockedBy!==r&&new Date(e.expiresAt).getTime()>n)}function Or(e,t,n,r=Date.now()){let i=new Map;for(let a of Dr(e,n,r))t&&a.locale!==t||i.set(`${a.collection}/${a.slug}`,Er(a.lockedBy));return i}function kr(){let[e,t]=(0,w.useState)(null);return(0,w.useEffect)(()=>{let e=!0;return V().then(n=>{e&&t(n)}).catch(()=>{e&&t(null)}),()=>{e=!1}},[]),e}var Ar=6e4,jr=6e5,Mr=[`pointerdown`,`pointermove`,`keydown`,`wheel`,`touchstart`],Nr={groups:[],layout:null};function Pr(e,t){let n=new Set;return e.filter(e=>!n.has(e.slug)&&!!n.add(e.slug)).map(e=>({collection:e.collection,slug:e.slug,status:B(e),lockedBy:t.get(`${e.collection}/${e.slug}`)??null})).sort((e,t)=>e.slug.localeCompare(t.slug))}async function Fr(e,t){let[n,r,{collections:i}]=await Promise.all([z(),An().catch(()=>[]),Wt(e)]),a=Or(r,e,t),o=new Map(i.map(e=>[e.name,e.documents])),s=[],c=null;for(let e of n){let t=Pr(o.get(e.name)??[],a);e.name===`globals`?c=t:s.push({collection:e,documents:t})}return{groups:s,layout:c}}function Ir(e,t){let[n,r]=(0,w.useState)(Nr),{pathname:i}=s(),a=kr()?.defaultLocale,o=(0,w.useCallback)(async()=>{if(a===void 0)return null;try{return await Fr(a,e)}catch(e){return console.warn(`[studio] Failed to load the site tree:`,e),null}},[a,e]);return(0,w.useEffect)(()=>{let e=!0,t=()=>{o().then(t=>{e&&t&&r(t)})},n=()=>document.visibilityState===`visible`,i=Date.now(),a=()=>Date.now()-i>=jr,s=()=>{n()&&!a()&&t()},c=()=>{let e=a();i=Date.now(),e&&n()&&t()},l=()=>{n()&&(i=Date.now(),t())};t();let u=setInterval(s,Ar);document.addEventListener(`visibilitychange`,l);for(let e of Mr)document.addEventListener(e,c,{passive:!0});return()=>{e=!1,clearInterval(u),document.removeEventListener(`visibilitychange`,l);for(let e of Mr)document.removeEventListener(e,c)}},[o,i,t]),n}function Lr(e){let t=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0;if(t===0)return;let n=L(e.currentTarget),r=n.indexOf(document.activeElement);r!==-1&&(e.preventDefault(),n[(r+t+n.length)%n.length]?.focus())}function Rr({document:e}){let{pathname:t}=s(),n=D(e.collection,e.slug),r=t===n||t.startsWith(`${n}/`);return(0,A.jsx)(`li`,{children:(0,A.jsxs)(p,{to:n,className:`tree-item`,"aria-current":r?`page`:void 0,children:[(0,A.jsx)(H,{status:e.status}),(0,A.jsx)(`span`,{className:`tree-item-label`,children:e.slug}),e.lockedBy&&(0,A.jsx)(`span`,{className:`tree-lock`,role:`img`,"aria-label":`Locked by ${e.lockedBy}`,children:(0,A.jsx)(et,{"aria-hidden":`true`})})]})})}function zr({label:e,urlPath:t,path:n}){let{pathname:r}=s();return n?(0,A.jsxs)(p,{to:n,className:`tree-group-label`,"aria-current":r===n?`page`:void 0,children:[e,t&&(0,A.jsxs)(A.Fragment,{children:[` `,(0,A.jsx)(`span`,{className:`tree-group-path`,children:t})]})]}):(0,A.jsx)(`span`,{className:`tree-group-label`,children:e})}function Br(e){let{name:t,label:n,open:r,onToggle:i,children:a}=e,o=(0,w.useId)();return(0,A.jsxs)(`div`,{className:`tree-group`,role:`group`,"aria-label":n,"data-group":t,children:[(0,A.jsxs)(`div`,{className:`tree-group-head`,children:[(0,A.jsx)(`button`,{type:`button`,className:`tree-toggle`,"aria-expanded":r,"aria-controls":o,"aria-label":`${n} documents`,onClick:i,children:(0,A.jsx)(N,{"aria-hidden":`true`})}),(0,A.jsx)(zr,{label:n,urlPath:e.urlPath,path:e.path})]}),(0,A.jsx)(`ul`,{id:o,className:`tree-list`,hidden:!r,children:a})]})}function Vr(){return(0,A.jsxs)(`ul`,{className:`tree-legend`,"aria-label":`Status legend`,children:[(0,A.jsxs)(`li`,{children:[(0,A.jsx)(H,{status:`live`,decorative:!0}),`live`]}),(0,A.jsxs)(`li`,{children:[(0,A.jsx)(H,{status:`ahead`,decorative:!0}),`draft ahead`]}),(0,A.jsxs)(`li`,{children:[(0,A.jsx)(H,{status:`draft`,decorative:!0}),`draft`]})]})}function Hr({group:e,canCreate:t,open:n,onToggle:r}){let{collection:i,documents:a}=e;return(0,A.jsxs)(Br,{name:i.name,label:g(i.name),urlPath:Cr(i),path:O(i.name),open:n,onToggle:r,children:[a.map(e=>(0,A.jsx)(Rr,{document:e},e.slug)),t&&(0,A.jsx)(`li`,{children:(0,A.jsxs)(p,{to:k(i.name),className:`tree-item tree-item--new`,children:[(0,A.jsx)(ht,{"aria-hidden":`true`}),(0,A.jsxs)(`span`,{className:`tree-item-label`,children:[`New `,ae(i.name)]})]})})]})}function Ur({revision:e,closedGroups:t,onToggleGroup:n}){let{user:r,hasRole:i}=m(),a=Ir(r,e),o=i(`editor`);return(0,A.jsxs)(`div`,{className:`site-tree`,role:`group`,"aria-label":`Site tree`,onKeyDown:Lr,children:[a.groups.map(e=>(0,A.jsx)(Hr,{group:e,canCreate:o,open:!t.includes(e.collection.name),onToggle:()=>n(e.collection.name)},e.collection.name)),a.layout&&(0,A.jsx)(Br,{name:`globals`,label:`Layout`,open:!t.includes(`globals`),onToggle:()=>n(`globals`),children:a.layout.map(e=>(0,A.jsx)(Rr,{document:e},e.slug))}),(0,A.jsx)(Vr,{})]})}function Wr(){return(0,A.jsxs)(`svg`,{className:`nav-brand-mark`,viewBox:`0 0 32 32`,fill:`none`,"aria-hidden":`true`,children:[(0,A.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`2.25`,strokeLinecap:`round`,children:[(0,A.jsx)(`path`,{d:`M9 4.5v23`}),(0,A.jsx)(`path`,{d:`M9 17.5 23 7`}),(0,A.jsx)(`path`,{d:`M14.5 13.4 23.5 27`})]}),(0,A.jsxs)(`g`,{fill:`currentColor`,children:[(0,A.jsx)(`circle`,{cx:`9`,cy:`4.5`,r:`2.6`}),(0,A.jsx)(`circle`,{cx:`9`,cy:`27.5`,r:`2.6`}),(0,A.jsx)(`circle`,{cx:`23`,cy:`7`,r:`2.6`}),(0,A.jsx)(`circle`,{cx:`23.5`,cy:`27`,r:`2.6`})]}),(0,A.jsx)(`circle`,{cx:`9`,cy:`17.5`,r:`3.6`,fill:`var(--color-accent)`})]})}function Gr(){let e=h(),{user:t,loginRequired:n}=m(),{pathname:r}=s(),i=lr(r),a={roles:t?.roles??[],loginRequired:n};return(0,A.jsx)(`ul`,{className:`nav-destinations`,"aria-label":`Destinations`,children:or(e,a).map(e=>{let t=e.icon,n=r===e.path?`page`:i===e.id?`true`:void 0;return(0,A.jsx)(`li`,{children:(0,A.jsxs)(p,{to:e.path,className:`nav-item`,"aria-current":n,children:[(0,A.jsx)(t,{className:`nav-item-icon`,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`nav-item-label`,children:e.label})]})},e.id)})})}function Kr(e,t,n){R(e,t),(0,w.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t,n])}function qr(e){(0,w.useEffect)(()=>{let t=e.current;if(!t)return;let n=new Set,r=e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`.nav-item`),r=e.relatedTarget;!t||r instanceof Node&&t.contains(r)||n.delete(t)&&t.removeAttribute(`data-tip-dismissed`)},i=e=>{if(e.key===`Escape`&&t.dataset.mode===`collapsed`)for(let e of t.querySelectorAll(`.nav-item:hover, .nav-item:focus`))e.setAttribute(`data-tip-dismissed`,``),n.add(e)};return document.addEventListener(`keydown`,i),t.addEventListener(`mouseout`,r),t.addEventListener(`focusout`,r),()=>{document.removeEventListener(`keydown`,i),t.removeEventListener(`mouseout`,r),t.removeEventListener(`focusout`,r)}},[e])}function Jr({onCloseDrawer:e}){return(0,A.jsxs)(`div`,{className:`nav-header`,children:[(0,A.jsxs)(p,{to:`/`,className:`nav-brand`,children:[(0,A.jsx)(Wr,{}),(0,A.jsxs)(`span`,{className:`nav-brand-word`,children:[`krantho `,(0,A.jsx)(`span`,{className:`nav-brand-studio`,children:`studio`})]})]}),e&&(0,A.jsx)(b,{icon:I,label:`Close navigation`,onClick:e})]})}function Yr(e){let{mode:t,drawerOpen:n,onCloseDrawer:r}=e,i=(0,w.useRef)(null),a=t===`drawer`,o=a&&n;return Kr(i,o,r),qr(i),(0,A.jsxs)(`div`,{ref:i,id:`studio-nav`,className:`shell-nav`,"data-mode":t,"data-open":o,inert:a&&!n,...o?{role:`dialog`,"aria-modal":!0,"aria-label":`Navigation`}:{},children:[(0,A.jsxs)(`nav`,{className:`nav`,"aria-label":`Studio`,children:[(0,A.jsx)(Jr,{onCloseDrawer:a?r:null}),(0,A.jsxs)(`div`,{className:`nav-scroll`,children:[(0,A.jsx)(Gr,{}),t!==`collapsed`&&(0,A.jsx)(Ur,{revision:e.treeRevision,closedGroups:e.closedGroups,onToggleGroup:e.onToggleGroup})]}),(0,A.jsx)(br,{mode:t,onToggleCollapsed:e.onToggleCollapsed})]}),t===`expanded`&&(0,A.jsx)(ir,{label:`Resize navigation`,value:e.width,min:M.min,max:M.max,grows:`right`,onChange:e.onResize,onReset:e.onResetWidth,controls:`studio-nav`})]})}var Xr={notFound:!0};function Zr(e){return typeof e==`object`&&!!e&&`notFound`in e}var X=(0,w.createContext)({path:null,report:()=>{}});function Qr({children:e}){let[t,n]=(0,w.useState)(null);return(0,A.jsx)(X.Provider,{value:{path:t,report:n},children:e})}function $r(e){return(0,w.useContext)(X).path===e}function Z(){let{pathname:e}=s(),{report:t}=(0,w.useContext)(X);return(0,w.useEffect)(()=>(t(e),()=>t(null)),[t,e]),(0,A.jsxs)(`section`,{className:`not-found`,"aria-labelledby":`not-found-title`,children:[(0,A.jsx)(`p`,{className:`not-found-code`,children:`404`}),(0,A.jsx)(`h1`,{id:`not-found-title`,children:`Nothing here`}),(0,A.jsx)(`p`,{children:`This screen does not exist, or it is turned off for this site or for your role.`}),(0,A.jsx)(p,{to:`/`,className:v(`primary`),children:`Go to Pulse`})]})}var Q={label:`Site`,path:`/site`},ei={label:`Structure`,path:`/structure`},ti={label:`Setup`,path:`/setup`},ni={label:`Media`,path:`/media`};function ri(e){return{label:g(e),path:O(e)}}function ii(e){return q.find(t=>t.id===e)?.label??e}function ai(e){return K.find(t=>t.id===e)?.label??e}var oi=[{pattern:`/`,trail:()=>[{label:`Pulse`}]},{pattern:`/site`,trail:()=>[{label:`Site`}]},{pattern:`/site/:collection`,trail:e=>[Q,{label:g(e.collection??``)}]},{pattern:`/site/:collection/:slug`,trail:e=>[Q,ri(e.collection??``),{label:e.slug??``}]},{pattern:`/new/:collection`,trail:e=>[Q,ri(e.collection??``),{label:`New`}]},{pattern:`/layout/:slug`,trail:e=>[Q,{label:`Layout`},{label:e.slug??``}]},{pattern:`/structure`,trail:()=>[ei,{label:ii(`graph`)}]},{pattern:`/structure/:tab`,trail:e=>[ei,{label:ii(e.tab??``)}]},{pattern:`/setup`,trail:()=>[{label:`Setup`}]},{pattern:`/setup/:tab`,trail:e=>[ti,{label:ai(e.tab??``)}]},{pattern:`/media`,trail:()=>[{label:`Media`}]},{pattern:`/media/:id/edit`,trail:()=>[ni,{label:`Edit image`}]}],si=[{label:`Not found`}];function ci(e,t=!1){if(t)return si;for(let{pattern:t,trail:n}of oi){let r=f(t,e);if(r)return n(r.params)}return si}function li(){let{pathname:e}=s(),t=u().some(e=>Zr(e.handle)),n=$r(e),r=ci(e,t||n);return(0,A.jsx)(`nav`,{className:`breadcrumbs`,"aria-label":`Breadcrumb`,children:(0,A.jsx)(`ol`,{className:`breadcrumbs-list`,children:r.map((e,t)=>{let n=t===r.length-1;return(0,A.jsxs)(`li`,{className:`breadcrumbs-item`,children:[t>0&&(0,A.jsx)(N,{className:`breadcrumbs-separator`,"aria-hidden":`true`}),n?(0,A.jsx)(`span`,{className:`breadcrumbs-current`,"aria-current":`page`,children:e.label}):e.path?(0,A.jsx)(p,{to:e.path,className:`breadcrumbs-link`,children:e.label}):(0,A.jsx)(`span`,{className:`breadcrumbs-text`,children:e.label})]},r.slice(0,t+1).map(e=>e.label).join(`/`))})})})}function ui(){let e=typeof navigator>`u`?``:navigator.platform||navigator.userAgent;return/Mac|iPhone|iPad|iPod/i.test(e)?`⌘K`:`Ctrl K`}function di({showMenuButton:e,menuOpen:t,onOpenMenu:n,onOpenPalette:r}){return(0,A.jsxs)(`header`,{className:`top-bar`,children:[e&&(0,A.jsx)(b,{icon:it,label:`Open navigation`,"aria-expanded":t,"aria-controls":`studio-nav`,onClick:n}),(0,A.jsx)(li,{}),(0,A.jsxs)(`button`,{type:`button`,className:`top-bar-command`,"aria-label":`Search or command`,"aria-keyshortcuts":`Meta+K Control+K`,"aria-haspopup":`dialog`,onClick:r,children:[(0,A.jsx)(F,{className:`top-bar-command-icon`,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`top-bar-command-label`,children:`Search or command`}),(0,A.jsx)(`kbd`,{className:`top-bar-command-key`,children:ui()})]})]})}var fi=(0,w.lazy)(()=>t(()=>import(`./AssistantPanel-B7HETGhh.js`).then(e=>({default:e.AssistantPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])));function pi(){}function mi(){return c()?.contentChanged??pi}var hi=`(max-width: 959.98px)`;function gi(){return j()?.opened?(0,A.jsx)(w.Suspense,{fallback:null,children:(0,A.jsx)(fi,{})}):null}function _i(e){(0,w.useEffect)(()=>{function t(t){(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`k`&&(t.preventDefault(),e())}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function vi(e){let[t,n]=(0,w.useState)(!1),{pathname:r}=s();return(0,w.useEffect)(()=>n(!1),[r,e]),[t,n]}function yi(){let e=be(hi),t=De(),[n,r]=vi(e),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(0),c=(0,w.useCallback)(()=>{r(!1),a(!0)},[r]);return _i((0,w.useCallback)(()=>{r(!1),a(e=>!e)},[r])),{mode:e?`drawer`:t.collapsed?`collapsed`:`expanded`,drawerOpen:n,openDrawer:(0,w.useCallback)(()=>r(!0),[r]),closeDrawer:(0,w.useCallback)(()=>r(!1),[r]),toggleCollapsed:()=>t.setCollapsed(!t.collapsed),paletteOpen:i,openPalette:c,closePalette:(0,w.useCallback)(()=>a(!1),[]),treeRevision:o,contentChanged:(0,w.useCallback)(()=>s(e=>e+1),[]),preferences:t}}function bi(){let e=yi();return(0,A.jsxs)(`div`,{className:`shell`,"data-nav":e.mode,style:{"--nav-width":`${e.preferences.width}px`},children:[(0,A.jsx)(`a`,{className:`shell-skip`,href:`#studio-main`,children:`Skip to content`}),(0,A.jsx)(Yr,{mode:e.mode,drawerOpen:e.drawerOpen,onCloseDrawer:e.closeDrawer,onToggleCollapsed:e.toggleCollapsed,width:e.preferences.width,onResize:e.preferences.setWidth,onResetWidth:()=>e.preferences.setWidth(M.fallback),treeRevision:e.treeRevision,closedGroups:e.preferences.closedGroups,onToggleGroup:e.preferences.toggleGroup}),e.mode===`drawer`&&e.drawerOpen&&(0,A.jsx)(`div`,{className:`shell-scrim`,"aria-hidden":`true`,onClick:e.closeDrawer}),(0,A.jsxs)(`div`,{className:`shell-column`,children:[(0,A.jsx)(di,{showMenuButton:e.mode===`drawer`,menuOpen:e.drawerOpen,onOpenMenu:e.openDrawer,onOpenPalette:e.openPalette}),(0,A.jsx)(`main`,{id:`studio-main`,className:`shell-page`,tabIndex:-1,children:(0,A.jsx)(w.Suspense,{fallback:(0,A.jsx)(`div`,{className:`loading`,children:`Loading…`}),children:(0,A.jsx)(o,{context:{contentChanged:e.contentChanged}})})})]}),(0,A.jsx)(Qn,{open:e.paletteOpen,onClose:e.closePalette,onContentChanged:e.contentChanged}),(0,A.jsx)(gi,{})]})}function xi(){let{isAuthenticated:e,user:t}=m(),n=h(),r=_(n,`assistant`)&&e&&t!==null,i=(0,A.jsx)(Bt,{children:(0,A.jsx)(Qr,{children:(0,A.jsx)(bi,{})})});return r?(0,A.jsx)(ve,{children:i}):i}var Si=(0,w.lazy)(()=>t(()=>import(`./pulse-page-HsxpGgEu.js`).then(e=>({default:e.PulsePage})),__vite__mapDeps([17,1,18,2,3,4,6,14,7,19,20,21,22,5,23,24,25,26,27]))),Ci=(0,w.lazy)(()=>t(()=>import(`./site-overview-BJNMesQZ.js`).then(e=>({default:e.SiteOverview})),__vite__mapDeps([28,1,23,2,3,4,5,19,29,30,21,22,31,18,6,14,32,33,34,15,35,36,20,37]))),wi=(0,w.lazy)(()=>t(()=>import(`./collection-view-CUWLWvwR.js`).then(e=>({default:e.CollectionPage})),__vite__mapDeps([38,1,23,2,3,4,5,7,19,29,30,21,22,39,40,41,31,18,6,14,42,32,33,34,15,35,36,20,37,43]))),$=(0,w.lazy)(()=>t(()=>import(`./editor-page-jSK3xMkh.js`).then(e=>({default:e.EditorPage})),__vite__mapDeps([44,1,3,5,19,31,2,4,23,18,6,14,21,22,33,45,40,46,47,48,11,9,49,50,51,7,24,25,52,12,35,53,41,54,15,55,36,13,26,56,57,58]))),Ti=(0,w.lazy)(()=>t(()=>import(`./structure-page-ZD8c7Ukz.js`).then(e=>({default:e.StructurePage})),__vite__mapDeps([59,1,18,2,3,4,6,14,5,7,21,22,60,19,55,61,36,41,33,29,30,49,62,47,20,52,12,35,23,53,54,39,26,63,34,15,64,65,13,66,67]))),Ei=(0,w.lazy)(()=>t(()=>import(`./media-page-B3Q4EH3m.js`).then(e=>({default:e.MediaPage})),__vite__mapDeps([68,1,45,3,2,4,40,46,6,47,48,7,19,21,22,5,12,36,42,41,62,53,69,66,70]))),Di=(0,w.lazy)(()=>t(()=>import(`./image-editor-CEzh5OFw.js`).then(e=>({default:e.ImageEditorPage})),__vite__mapDeps([71,1,56,2,3,4,49,62,72,73,5,47,7,46,6,74]))),Oi=(0,w.lazy)(()=>t(()=>import(`./setup-page-DsYYpFrd.js`).then(e=>({default:e.SetupPage})),__vite__mapDeps([75,1,3,60,5,19,55,2,4,18,6,61,7,33,42,47,66,29,30,21,22,41,20,69,12,11,8,57,76]))),ki=[{path:`site`,element:(0,A.jsx)(Ci,{})},{path:`site/${T}`,element:(0,A.jsx)(Z,{}),handle:Xr},{path:`site/:collection`,element:(0,A.jsx)(wi,{})},{path:`site/:collection/:slug`,element:(0,A.jsx)($,{})},{path:`new/:collection`,element:(0,A.jsx)($,{})},{path:`layout/:slug`,element:(0,A.jsx)($,{collection:T})}],Ai=[{path:`structure`,element:(0,A.jsx)(l,{replace:!0,to:q[0]?.path??`/`})},...q.map(e=>({path:e.path.slice(1),element:(0,A.jsx)(Ti,{tab:e.id})}))],ji=[{path:`media`,element:(0,A.jsx)(Ei,{})},{path:`media/:id/edit`,element:(0,A.jsx)(Di,{})}];function Mi(e){let t=e[0];return t?[{path:`setup`,element:(0,A.jsx)(l,{replace:!0,to:t.path})},...e.map(t=>({path:t.path.slice(1),element:(0,A.jsx)(Oi,{tab:t.id,tabs:e})}))]:[]}function Ni({caps:e,viewer:t}){let n=n=>cr(n,e,t),r=[{index:!0,element:(0,A.jsx)(Si,{})},...ki,...n(`structure`)?Ai:[],...n(`media`)?ji:[],...n(`setup`)?Mi(sr(e,t)):[],{path:`*`,element:(0,A.jsx)(Z,{}),handle:Xr}];return[{path:`/`,element:(0,A.jsx)(xi,{}),children:r}]}function Pi(e){return d(e,{basename:`/studio`})}function Fi(){return(0,A.jsx)(`div`,{className:`loading`,children:`Loading…`})}function Ii({children:e}){let[t,n]=(0,w.useState)(null);return(0,w.useEffect)(()=>{ie().then(n)},[]),t?(0,A.jsx)(oe.Provider,{value:t,children:e}):(0,A.jsx)(Fi,{})}function Li({makeRouter:e}){let{user:t,loginRequired:n}=m(),r=h(),i=t?.roles,a=(0,w.useMemo)(()=>e(Ni({caps:r,viewer:{roles:i??[],loginRequired:n}})),[e,r,i,n]);return(0,w.useEffect)(()=>()=>a.dispose(),[a]),(0,A.jsx)(ee,{router:a})}function Ri({makeRouter:e}){let{isLoading:t,isAuthenticated:n,loginRequired:r}=m();return t?(0,A.jsx)(Fi,{}):r&&!n?(0,A.jsx)(ge,{}):(0,A.jsx)(Li,{makeRouter:e})}function zi({makeRouter:e=Pi}){return(0,A.jsx)(re,{children:(0,A.jsx)(Ii,{children:(0,A.jsx)(Ri,{makeRouter:e})})})}var Bi=document.getElementById(`root`);if(!Bi)throw Error(`Root element not found`);(0,ce.createRoot)(Bi).render((0,A.jsx)(w.StrictMode,{children:(0,A.jsx)(zi,{})}));export{R as $,hn as A,Ut as B,V as C,O as Ct,pn as D,k as Dt,mn as E,fe as Et,Yt as F,Jt as G,qt as H,an as I,cn as J,dn as K,sn as L,B as M,en as N,yn as O,de as Ot,tn as P,Xt as Q,on as R,bn as S,T as St,gn as T,D as Tt,Zt as U,z as V,nn as W,un as X,Qt as Y,rn as Z,Tn as _,xe as _t,Cr as a,_t as at,En as b,j as bt,ur as c,et as ct,Kn as d,Ke as dt,Pt as et,U as f,Be as ft,kn as g,we as gt,An as h,je as ht,Dr as i,F as it,fn as j,_n as k,q as l,Qe as lt,On as m,N as mt,Z as n,At as nt,Sr as o,ht as ot,jn as p,Re as pt,ln as q,Er as r,bt as rt,dr as s,P as st,mi as t,I as tt,ir as u,Je as ut,Dn as v,Ce as vt,vn as w,le as wt,H as x,pe as xt,wn as y,be as yt,Kt as z};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AssistantPanel-ECkcslXS.js","assets/rolldown-runtime-COiEfhsA.js","assets/createLucideIcon-BklFHeMd.js","assets/vendor-diff-DGCTJYJ4.js","assets/createLucideIcon-DO6kYgVn.css","assets/vendor-router-B4czwg8X.js","assets/api-client-BRi_ki2Y.js","assets/auth-CIpilSKF.js","assets/send-kYpW5JED.js","assets/vendor-markdown-pd8vs9n-.js","assets/circle-check-big-DQjpuxcC.js","assets/clock-DoBIVjZO.js","assets/copy-V85khWct.js","assets/info-Cxkabti5.js","assets/triangle-exclamation-point-ttN5lZI0.js","assets/circle-x-peGpq98w.js","assets/AssistantPanel-DB6gluI1.css","assets/pulse-page-C00oCF2o.js","assets/api-seo-CwGP6Bi2.js","assets/format-C3ZX9yGM.js","assets/source-CGZGd3Xy.js","assets/empty-state-CeUZocHx.js","assets/empty-state-Bvnil5AQ.css","assets/findability-BrhtZ2yD.js","assets/meter-ZOLJ0WhG.js","assets/meter-WebPk4WX.css","assets/pen-line-B524Nue8.js","assets/pulse-page-HgFM-MfC.css","assets/site-overview-5EhmXIR0.js","assets/data-table-B1kqxrEw.js","assets/data-table-Dm9uZXES.css","assets/site-model-C5bJvTbk.js","assets/site-BYsfQB_3.js","assets/use-loaded-BBFak2E1.js","assets/circle-dashed-cuYrILNo.js","assets/corner-down-right-BpwOGRFR.js","assets/external-link-Dh7p8Ii6.js","assets/site-lUERQFzn.css","assets/collection-view--erTGbRH.js","assets/export-helpers-C_HVpJN9.js","assets/upload-CaqQJaUr.js","assets/guards-BFEDbduR.js","assets/trash-DzRCm500.js","assets/collection-view-Dllo4l_w.css","assets/editor-page-XOJrwlcZ.js","assets/use-drawer-actions-CR6Q0qdd.js","assets/media-model-D4F1Farw.js","assets/action-button-DIrhqMRc.js","assets/use-drawer-actions-DeFJMhBn.css","assets/rotate-ccw-BgARBEK3.js","assets/vendor-react-CXaWJ_ii.js","assets/vendor-react-DLioOiRN.css","assets/graph-config-DKVGDPTG.js","assets/layers-0VWe0rKm.js","assets/graph-config-mZyX0Lqo.css","assets/fill-job-YPZFETW1.js","assets/arrow-left-7opbl8fu.js","assets/use-locale-versions-BycCbBLd.js","assets/editor-page-D-qGDgmd.css","assets/structure-page-9d9MG7vU.js","assets/fill-run-view-B6rnYhKS.js","assets/fill-run-view-BhqhXo7I.css","assets/save-ClSXW9cb.js","assets/vendor-reactflow-CMKi7AEX.js","assets/catalog-offer-CeRRk2Zo.js","assets/arrow-down-B5kfR2lG.js","assets/list-checks-BCEhMMVY.js","assets/structure-page-DVSxQzgj.css","assets/media-page-CeBC5FQS.js","assets/pencil-xdGZtrO4.js","assets/media-page-DBdAvFvu.css","assets/image-editor-BX-DHJDa.js","assets/vendor-media-DXSmPN_d.js","assets/vendor-media-DJOnVxEf.css","assets/image-editor-BTlqjPtS.css","assets/setup-page-BHJcTaTH.js","assets/setup-page-Bc799yav.css"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,o as n,s as r}from"./vendor-diff-DGCTJYJ4.js";import{m as i,p as a}from"./vendor-react-CXaWJ_ii.js";import{a as o,c as s,d as c,i as l,l as u,n as d,o as ee,p as f,t as p,u as te}from"./vendor-router-B4czwg8X.js";import{i as m,r as ne,t as re}from"./auth-CIpilSKF.js";import{c as ie,d as h,o as ae,s as oe,t as g,u as _}from"./format-C3ZX9yGM.js";import{i as v,n as y,r as b,t as x}from"./createLucideIcon-BklFHeMd.js";import{i as S,r as C,t as se}from"./api-client-BRi_ki2Y.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var w=e(r(),1),ce=a(),T=`globals`,E=encodeURIComponent;function D(e,t,n){let r=e===`globals`?`/layout/${E(t)}`:`/site/${E(e)}/${E(t)}`;return n?`${r}?locale=${E(n)}`:r}function le(e,t,n){let r=new URLSearchParams({...n?{locale:n}:{},mode:`data`});return`/site/${E(e)}/${E(t)}?${r}`}function O(e){return`/site/${E(e)}`}function k(e){return`/new/${E(e)}`}var ue=`/structure/graph?fill=1`;function de(e){return e?`/structure/scopes#scope-${e}`:`/structure/scopes`}function fe(e){return`/media/${E(e)}/edit`}var pe=`/setup/ai`,A=n();function me(e){if(typeof e!=`object`||!e)return!1;let{name:t,login_url:n}=e;return typeof t==`string`&&typeof n==`string`}function he(e){let t=e?.capabilities?.oidc_providers;return Array.isArray(t)?t.filter(me):[]}function ge(){let{login:e,authMode:t}=m(),[n,r]=(0,w.useState)(``),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)([]),u=(0,w.useCallback)(e=>{e?.focus()},[]);(0,w.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get(`error`);e&&(a(e),window.history.replaceState({},``,window.location.pathname))},[]),(0,w.useEffect)(()=>{t===`oidc`&&fetch(`/api/auth/capabilities`).then(e=>e.json()).then(e=>{l(he(e))}).catch(()=>{})},[t]);async function d(t){t.preventDefault(),n.trim()&&(s(!0),a(null),await e(n.trim())||a(`Invalid access token`),s(!1))}return(0,A.jsx)(`div`,{className:`login-page`,children:(0,A.jsxs)(`div`,{className:`login-card`,children:[(0,A.jsx)(`h1`,{className:`login-title`,children:`krantho`}),(0,A.jsx)(`p`,{className:`login-subtitle`,children:t===`token`?`Enter your access token to continue`:`Sign in to continue`}),i&&(0,A.jsx)(`div`,{className:`login-error`,children:i}),t===`token`&&(0,A.jsxs)(`form`,{onSubmit:d,className:`login-form`,children:[(0,A.jsxs)(`div`,{className:`field`,children:[(0,A.jsx)(`label`,{className:`field-label`,htmlFor:`token`,children:`Access Token`}),(0,A.jsx)(`input`,{id:`token`,type:`password`,className:`field-input`,value:n,onChange:e=>r(e.target.value),placeholder:`Enter token`,ref:u})]}),(0,A.jsx)(`button`,{type:`submit`,className:v(`primary`,`md`,`login-btn`),disabled:o,children:o?`Signing in...`:`Sign In`})]}),t===`oidc`&&(0,A.jsxs)(`div`,{className:`login-oidc`,children:[c.map(e=>(0,A.jsxs)(`a`,{href:e.login_url,className:v(`primary`,`md`,`login-btn`),children:[`Sign in with `,e.name]},e.login_url)),c.length===0&&(0,A.jsx)(`p`,{className:`login-subtitle`,children:`No OIDC providers configured`})]})]})})}var _e=(0,w.createContext)(null);function ve({children:e}){let[t,n]=(0,w.useState)(!1),[r,i]=(0,w.useState)(!1),a=(0,w.useRef)(null),o=(0,w.useCallback)(()=>{i(!0),n(e=>!e)},[]),s=(0,w.useCallback)(()=>{n(!1),a.current?.focus()},[]),c=(0,w.useMemo)(()=>({open:t,opened:r,toggle:o,close:s,launcherRef:a}),[t,r,o,s]);return(0,A.jsx)(_e,{value:c,children:e})}function j(){return(0,w.useContext)(_e)}function ye(e){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(e).matches}function be(e){let[t,n]=(0,w.useState)(()=>ye(e));return(0,w.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function xe(e){try{let t=JSON.parse(localStorage.getItem(e)??`null`);return typeof t==`object`&&t?t:{}}catch{return{}}}function Se(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function Ce(e,t,n){return typeof e==`number`&&e>=t.min&&e<=t.max?e:n}function we(e,t){let[n,r]=(0,w.useState)(t),i=(0,w.useRef)(n);return(0,w.useEffect)(()=>{n!==i.current&&(i.current=n,Se(e,n))},[e,n]),[n,r]}var Te=`krantho-studio-nav`,M={min:200,max:360,fallback:236};function Ee(){let{collapsed:e,width:t,closedGroups:n}=xe(Te);return{collapsed:e===!0,width:Ce(t,M,M.fallback),closedGroups:Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}}function De(){let[e,t]=we(Te,Ee),n=(0,w.useCallback)(e=>t(t=>({...t,collapsed:e})),[t]),r=(0,w.useCallback)(e=>t(t=>({...t,width:e})),[t]),i=(0,w.useCallback)(e=>t(t=>({...t,closedGroups:t.closedGroups.includes(e)?t.closedGroups.filter(t=>t!==e):[...t.closedGroups,e]})),[t]);return{...e,setCollapsed:n,setWidth:r,toggleGroup:i}}var Oe={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};Oe.node;var ke=x(Oe),Ae={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};Ae.node;var je=x(Ae),Me={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};Me.node;var Ne=x(Me),Pe={name:`boxes`,size:24,node:[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]};Pe.node;var Fe=x(Pe),Ie={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Ie.node;var N=x(Ie),Le={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};Le.node;var Re=x(Le),ze={name:`circle-exclamation-point`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`,`circle-alert`]};ze.node;var Be=x(ze),Ve={name:`cloud-upload`,size:24,node:[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]],aliases:[`upload-cloud`]};Ve.node;var He=x(Ve),Ue={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};Ue.node;var We=x(Ue),Ge={name:`file-plus`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]};Ge.node;var Ke=x(Ge),qe={name:`folder-tree`,size:24,node:[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]};qe.node;var Je=x(qe),Ye={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};Ye.node;var Xe=x(Ye),Ze={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};Ze.node;var Qe=x(Ze),$e={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};$e.node;var et=x($e),tt={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};tt.node;var nt=x(tt),rt={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};rt.node;var it=x(rt),at={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};at.node;var ot=x(at),st={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};st.node;var ct=x(st),lt={name:`network`,size:24,node:[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]};lt.node;var P=x(lt),ut={name:`panel-left-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]],aliases:[`sidebar-close`]};ut.node;var dt=x(ut),ft={name:`panel-left-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]],aliases:[`sidebar-open`]};ft.node;var pt=x(ft),mt={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};mt.node;var ht=x(mt),gt={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};gt.node;var _t=x(gt),vt={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};vt.node;var F=x(vt),yt={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};yt.node;var bt=x(yt),xt={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};xt.node;var St=x(xt),Ct={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};Ct.node;var wt=x(Ct),Tt={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};Tt.node;var Et=x(Tt),Dt={name:`wand-sparkles`,size:24,node:[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]],aliases:[`wand-2`]};Dt.node;var Ot=x(Dt),kt={name:`webhook`,size:24,node:[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]};kt.node;var At=x(kt),jt={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};jt.node;var I=x(jt),Mt=6e3,Nt=(0,w.createContext)(null);function Pt(){let e=(0,w.useContext)(Nt);if(!e)throw Error(`useToast needs a ToastProvider`);return e}function Ft(e,t){let[n,r]=(0,w.useState)(!1),i=(0,w.useRef)(t);return(0,w.useEffect)(()=>{i.current=t},[t]),(0,w.useEffect)(()=>{if(e!==`success`||n)return;let t=setTimeout(()=>i.current(),Mt);return()=>clearTimeout(t)},[e,n]),r}function It(e){(0,w.useLayoutEffect)(()=>{let t=e.current;return()=>{if(!t?.contains(document.activeElement))return;let e=[...document.querySelectorAll(`.ui-toast-dismiss`)].filter(e=>!t.contains(e))[0]??document.getElementById(`studio-main`);queueMicrotask(()=>(e?.isConnected?e:document.getElementById(`studio-main`))?.focus())}},[e])}var Lt={success:Re,error:Be};function Rt({entry:e,onExpire:t,onDismiss:n}){let r=Ft(e.tone,t),i=(0,w.useRef)(null);It(i);let a=Lt[e.tone];return(0,A.jsxs)(`div`,{ref:i,className:`ui-toast ui-toast--${e.tone}`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),n())},children:[(0,A.jsx)(a,{className:`ui-toast-icon`,"aria-hidden":`true`}),(0,A.jsx)(`p`,{className:`ui-toast-text`,children:e.text}),(0,A.jsx)(`button`,{type:`button`,className:`ui-toast-dismiss`,"aria-label":`Dismiss`,onClick:n,children:(0,A.jsx)(I,{"aria-hidden":`true`})})]})}function zt({entries:e,dismiss:t}){return e.map(e=>(0,A.jsx)(Rt,{entry:e,onExpire:()=>t(e.id),onDismiss:()=>t(e.id)},e.id))}function Bt({children:e}){let[t,n]=(0,w.useState)([]),r=(0,w.useRef)(0),i=(0,w.useCallback)(({text:e,tone:t=`success`})=>{r.current+=1;let i={id:r.current,text:e,tone:t};n(e=>[...e,i].slice(-3))},[]),a=(0,w.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e))},[]);return(0,A.jsxs)(Nt.Provider,{value:i,children:[e,(0,A.jsxs)(`div`,{className:`ui-toasts`,children:[(0,A.jsx)(`div`,{className:`ui-toast-region`,role:`status`,"aria-label":`Notifications`,children:(0,A.jsx)(zt,{entries:t.filter(e=>e.tone===`success`),dismiss:a})}),(0,A.jsx)(`div`,{className:`ui-toast-region`,role:`alert`,"aria-label":`Errors`,children:(0,A.jsx)(zt,{entries:t.filter(e=>e.tone===`error`),dismiss:a})})]})]})}var Vt=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`;function L(e){return[...e.querySelectorAll(Vt)].filter(e=>!e.closest(`[hidden], [inert]`))}function Ht(e,t){if(e.key!==`Tab`)return;let n=L(t),r=n[0],i=n[n.length-1];if(!r||!i){e.preventDefault();return}let a=document.activeElement;e.shiftKey&&(a===r||!t.contains(a))?(e.preventDefault(),i.focus()):e.shiftKey||a!==i&&t.contains(a)||(e.preventDefault(),r.focus())}function R(e,t,n){(0,w.useEffect)(()=>{let r=e.current;if(!t||!r)return;let i=document.activeElement instanceof HTMLElement?document.activeElement:null;(n?.current??L(r)[0]??r).focus();let a=e=>Ht(e,r);return document.addEventListener(`keydown`,a),()=>{document.removeEventListener(`keydown`,a),i?.isConnected&&i.focus()}},[t,e,n])}async function z(){return(await S(`/collections`)).collections}async function Ut(e,t){let n=new URLSearchParams({view:`summary`});t?.status&&n.set(`status`,t.status),t?.sort&&n.set(`sort`,t.sort),t?.limit!==void 0&&n.set(`limit`,String(t.limit)),t?.offset!==void 0&&n.set(`offset`,String(t.offset)),t?.locale&&n.set(`locale`,t.locale);let r=n.toString();return S(`/content/${e}?${r}`)}async function Wt(e){return S(`/content-tree?locale=${encodeURIComponent(e)}`)}var Gt=500;async function Kt(e={}){let t=[];for(;;){let n=new URLSearchParams({view:e.view??`summary`});e.collections?.length&&n.set(`collections`,e.collections.join(`,`)),e.locale&&n.set(`locale`,e.locale),e.status&&n.set(`status`,e.status),n.set(`limit`,String(Gt)),n.set(`offset`,String(t.length));let r=await S(`/content?${n}`);if(t.push(...r.items),!r.hasMore||r.items.length===0)return t}}async function qt(e,t,n){return S(`/content/${e}/${t}${C(n)}`)}async function Jt(e){return S(`/schema/${e}`)}async function Yt(e,t){return S(`/content/${e}`,{method:`POST`,body:JSON.stringify(t)})}async function Xt(e,t,n){return S(`/content/${e}/${t}`,{method:`PUT`,body:JSON.stringify(n)})}async function Zt(e,t,n){return S(`/content/${e}/${t}/publish-impact${C(n)}`)}async function Qt(e,t,n){let r={method:`POST`};return n?.status&&(r.body=JSON.stringify({status:n.status})),S(`/content/${e}/${t}/publish${C(n?.locale)}`,r)}async function $t(e){return S(`/content/search?q=${encodeURIComponent(e)}`)}async function en(e,t,n){return S(`/content/${e}/bulk`,{method:`DELETE`,body:JSON.stringify(n?{slugs:t,locale:n}:{slugs:t})})}async function tn(e,t,n){return S(`/content/${e}/bulk-publish`,{method:`POST`,body:JSON.stringify(n?{slugs:t,locale:n}:{slugs:t})})}async function nn(e){return S(`/schema/${e}/runtime`)}async function rn(e,t){return S(`/schema/${e}/fields`,{method:`PUT`,body:JSON.stringify(t)})}async function an(e,t){return S(`/schema/${e}/fields/${t}`,{method:`DELETE`})}async function on(e){return S(`/schema/${e}/export`)}async function sn(e,t=`json`,n){let r=new URLSearchParams({format:t});return n&&r.set(`locale`,n),S(`/content/${e}/export?${r}`)}async function cn(e,t){return S(`/content/${e}/import`,{method:`POST`,body:JSON.stringify({items:t})})}async function ln(e){let t=new URLSearchParams;e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset)),e?.status&&t.set(`status`,e.status);let n=t.toString();return S(`/webhooks/deliveries${n?`?${n}`:``}`)}async function un(e){return S(`/webhooks/deliveries/${e}/retry`,{method:`POST`})}async function dn(){return S(`/translations/status`)}function B(e){return e.liveVersion===null?`draft`:e.liveVersion>=e.version?`live`:`ahead`}var fn={live:`Live`,ahead:`Unpublished changes`,draft:`Not published`};async function pn(){return S(`/site-config`)}async function mn(){return S(`/settings/locales`)}async function hn(e){return S(`/settings/locales`,{method:`PUT`,body:JSON.stringify({supportedLocales:e})})}async function gn(){return S(`/settings/llm`)}async function _n(e){return S(`/settings/llm`,{method:`PUT`,body:JSON.stringify(e)})}async function vn(e){return S(`/settings/llm?provider=${encodeURIComponent(e)}`,{method:`DELETE`})}async function yn(e){return S(`/settings/llm/test`,{method:`POST`,body:JSON.stringify({provider:e})})}async function V(){let{defaultLocale:e,supportedLocales:t}=await mn();return{defaultLocale:e,supportedLocales:t}}function bn(e){return e.supportedLocales.length>1}async function xn(){let[e,t]=await Promise.all([Kt({view:`meta`}),V()]),n=new Map;for(let r of e){if(!t.supportedLocales.includes(r.locale)||B(r)!==`ahead`)continue;let e=`${r.collection}\u0000${r.locale}`,i=n.get(e)??{collection:r.collection,locale:r.locale,slugs:[]};i.slugs.push(r.slug),n.set(e,i)}return[...n.values()]}function Sn(e){return e.reduce((e,t)=>e+t.slugs.length,0)}async function Cn(e){let t=0;for(let n of e){let e=await tn(n.collection,n.slugs,n.locale);t+=e.published}return t}function H({status:e,decorative:t=!1}){let n=`ui-status-dot ui-status-dot--${e}`;if(t)return(0,A.jsx)(`span`,{className:n,"aria-hidden":`true`});let r=fn[e];return(0,A.jsx)(`span`,{className:n,role:`img`,"aria-label":r,title:r})}async function wn(){let{checkpoints:e}=await S(`/checkpoints`);return e}async function Tn(e){return S(`/checkpoints`,{method:`POST`,body:JSON.stringify(e?{name:e}:{})})}async function En(e){return S(`/checkpoints/${e}/restore`,{method:`POST`})}async function Dn(e){await S(`/checkpoints/${e}`,{method:`DELETE`})}async function On(e,t,n){try{return await S(`/content/${e}/${t}/lock${C(n)}`,{method:`POST`})}catch(e){if(e instanceof se){let t=typeof e.body.lockedBy==`string`?e.body.lockedBy:null,n=typeof e.body.expiresAt==`string`?e.body.expiresAt:null;return{locked:!1,error:e.message,status:e.status,...t?{lockedBy:t}:{},...n?{expiresAt:n}:{}}}return{locked:!1,error:e instanceof Error?e.message:`Failed to acquire lock`}}}async function kn(e,t,n){try{await S(`/content/${e}/${t}/lock${C(n)}`,{method:`DELETE`})}catch{}}async function An(){return(await S(`/locks`)).locks}function jn(e){return e instanceof se&&e.status===404}function U(e,t){return e instanceof Error?e.message:t}var Mn=200,Nn=8;function Pn(e){let[t,n]=(0,w.useState)({phase:`idle`}),r=e.trim();return(0,w.useEffect)(()=>{if(r.length<2){n({phase:`idle`});return}let e=!0;n({phase:`loading`});let t=setTimeout(()=>{$t(r).then(t=>{e&&n({phase:`done`,items:t.items.slice(0,Nn)})}).catch(t=>{e&&n({phase:`failed`,message:t instanceof Error?t.message:`Search failed`})})},Mn);return()=>{e=!1,clearTimeout(t)}},[r]),t}function Fn(){let[e,t]=(0,w.useState)(null);return(0,w.useEffect)(()=>{let e=!0;return z().then(n=>{e&&t(n.find(e=>e.pages)??null)}).catch(()=>{}),()=>{e=!1}},[]),e}function In({canEdit:e,pages:t,go:n,confirmPublishAll:r}){if(!e)return[];let i=[];return t&&i.push({id:`new-page`,label:`New page`,detail:`In ${g(t.name)}`,icon:Ke,run:n(k(t.name))}),i.push({id:`publish-all`,label:`Publish all drafts ahead of live`,detail:`Asks before publishing`,icon:He,run:r}),i}function Ln({canEdit:e,checkpoints:t,seo:n,go:r}){let i=[];return e&&t&&i.push({id:`checkpoint`,label:`Create checkpoint`,detail:`A restorable copy of the whole content store`,icon:je,run:async()=>{await Tn(),r(`/setup/checkpoints`)()}}),e&&n&&i.push({id:`enrich`,label:`Enrich missing SEO`,detail:`Opens Structure's Fill what's missing`,icon:Ot,run:r(ue)}),n&&i.push({id:`structure`,label:`Structure`,detail:`How search engines and assistants read the site`,icon:P,run:r(`/structure`)}),i}function Rn({close:e,confirmPublishAll:t}){let n=te(),r=h(),{hasRole:i}=m(),a=Fn(),o=i(`editor`),s=_(r,`checkpoints`),c=_(r,`seo`);return(0,w.useMemo)(()=>{let r={canEdit:o,checkpoints:s,seo:c,pages:a,go:t=>()=>{e(),n(t)},confirmPublishAll:t};return[...In(r),...Ln(r)]},[o,s,c,a,e,t,n])}function zn(e){return e.map(({id:e,label:t,detail:n,icon:r,run:i})=>({id:e,label:t,detail:n,icon:r,run:i}))}function Bn(e,t){return e.phase===`done`?e.items.map(({meta:e,fields:n})=>({id:`${e.collection}/${e.slug}/${e.locale}`,label:typeof n.title==`string`&&n.title?n.title:e.slug,detail:`${g(e.collection)} · ${e.slug}`,status:B(e),run:()=>t(D(e.collection,e.slug))})):[]}function Vn(e,t,n){let r=e.trim();return r===``?n===0?`No commands are available to you here.`:null:r.length<2?`Keep typing to search documents.`:t.phase===`loading`?`Searching…`:t.phase===`failed`?t.message:t.phase===`done`&&n===0?`No documents match “${r}”.`:null}function Hn(e,t){let n=te(),r=Pn(e),i=Rn({close:t.onClose,confirmPublishAll:t.confirmPublishAll});return e.trim()===``?{options:zn(i),search:r}:{options:Bn(r,e=>{t.onClose(),n(e)}),search:r}}function Un(e,t,n,r){return i=>{let a=e.length;if(i.key===`ArrowDown`||i.key===`ArrowUp`){if(i.preventDefault(),a===0)return;let e=i.key===`ArrowDown`?1:-1;n(t=>(t+e+a)%a)}else i.key===`Enter`&&(i.preventDefault(),r(e[t]))}}function Wn(e){let[t,n]=(0,w.useState)(``),[r,i]=(0,w.useState)(0),[a,o]=(0,w.useState)(null),{options:s,search:c}=Hn(t,e),l=a??Vn(t,c,s.length);(0,w.useEffect)(()=>i(0),[t,s.length]);async function u(e){if(e){o(e.id===`publish-all`?`Counting drafts ahead of live…`:null);try{await e.run()}catch(t){o(U(t,`${e.label} failed`))}}}return{query:t,setQuery:e=>{n(e),o(null)},active:r,setActive:i,options:s,status:l,run:u,handleKeyDown:Un(s,r,i,u)}}var Gn=i();function Kn({title:e,children:t,actions:n,onClose:r,initialFocus:i,busy:a=!1}){let o=(0,w.useRef)(null),s=(0,w.useId)();R(o,!0,i);function c(e){e.key===`Escape`&&(e.stopPropagation(),r())}return(0,Gn.createPortal)((0,A.jsxs)(`div`,{className:`ui-modal-layer`,children:[(0,A.jsx)(`div`,{className:`ui-modal-scrim`,"aria-hidden":`true`,onClick:r}),(0,A.jsxs)(`div`,{ref:o,role:`dialog`,"aria-modal":`true`,"aria-labelledby":s,"aria-busy":a,className:`ui-modal`,tabIndex:-1,onKeyDown:c,children:[(0,A.jsx)(`h2`,{id:s,className:`ui-modal-title`,children:e}),(0,A.jsx)(`div`,{className:`ui-modal-body`,children:t}),(0,A.jsx)(`div`,{className:`ui-modal-actions`,children:n})]})]}),document.body)}function qn(e){return e===1?`1 document`:`${e} documents`}function Jn({phase:e,count:t}){return e.name===`done`?(0,A.jsxs)(`p`,{role:`status`,children:[`Published `,qn(e.published),`. Visitors now see the saved versions.`]}):e.name===`failed`?(0,A.jsx)(`p`,{role:`alert`,children:e.message}):t===0?(0,A.jsx)(`p`,{children:`No document has unpublished changes. Every live page shows its latest saved version.`}):(0,A.jsxs)(`p`,{children:[t===1?`1 document has`:`${t} documents have`,` unpublished changes. Publishing makes each saved version what visitors see.`]})}function Yn(e,t){let[n,r]=(0,w.useState)({name:`ask`});async function i(){if(n.name!==`publishing`){r({name:`publishing`});try{let n=await Cn(e);r({name:`done`,published:n}),t()}catch(e){r({name:`failed`,message:U(e,`Publishing failed`)})}}}return{phase:n,publish:i}}function Xn({phase:e,count:t,safeRef:n,onClose:r,onPublish:i}){let a=e.name===`publishing`;return t===0||e.name===`done`||e.name===`failed`?(0,A.jsx)(y,{ref:n,onClick:r,children:`Close`}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(y,{ref:n,onClick:a?void 0:r,"aria-disabled":a,children:`Cancel`}),(0,A.jsx)(y,{variant:`primary`,onClick:a?void 0:i,"aria-disabled":a,children:a?`Publishing…`:`Publish ${qn(t)}`})]})}function Zn({groups:e,onClose:t,onPublished:n}){let r=Sn(e),{phase:i,publish:a}=Yn(e,n),o=(0,w.useRef)(null),s=i.name===`publishing`;return(0,w.useEffect)(()=>{(i.name===`done`||i.name===`failed`)&&o.current?.focus()},[i.name]),(0,A.jsx)(Kn,{title:`Publish all drafts ahead of live`,onClose:s?()=>void 0:t,initialFocus:o,busy:s,actions:(0,A.jsx)(Xn,{phase:i,count:r,safeRef:o,onClose:t,onPublish:()=>void a()}),children:(0,A.jsx)(Jn,{phase:i,count:r})})}function Qn({open:e,onClose:t,onContentChanged:n}){let[r,i]=(0,w.useState)(null),a=(0,w.useCallback)(async()=>{i(await xn())},[]);return(0,w.useEffect)(()=>{e||i(null)},[e]),e?r?(0,A.jsx)(Zn,{groups:r,onClose:t,onPublished:n}):(0,A.jsx)($n,{onClose:t,confirmPublishAll:a}):null}function $n(e){let t=Wn(e),n=(0,w.useRef)(null),r=(0,w.useRef)(null),i=(0,w.useId)();return R(n,!0,r),(0,A.jsxs)(`div`,{className:`palette-layer`,children:[(0,A.jsx)(`div`,{className:`palette-scrim`,"aria-hidden":`true`,onClick:e.onClose}),(0,A.jsxs)(`div`,{ref:n,role:`dialog`,"aria-modal":`true`,"aria-label":`Command palette`,className:`palette`,onKeyDown:t=>{t.key===`Escape`&&e.onClose()},children:[(0,A.jsx)(er,{inputRef:r,listId:i,state:t}),(0,A.jsx)(`p`,{className:`palette-status`,role:`status`,children:t.status}),(0,A.jsx)(tr,{listId:i,state:t}),(0,A.jsxs)(`p`,{className:`palette-hint`,"aria-hidden":`true`,children:[(0,A.jsx)(`kbd`,{children:`↑`}),(0,A.jsx)(`kbd`,{children:`↓`}),` to move `,(0,A.jsx)(`kbd`,{children:`↵`}),` to open `,(0,A.jsx)(`kbd`,{children:`Esc`}),` to close`]})]})]})}function er({inputRef:e,listId:t,state:n}){let r=n.options.length>0;return(0,A.jsxs)(`div`,{className:`palette-search`,children:[(0,A.jsx)(F,{className:`palette-search-icon`,"aria-hidden":`true`}),(0,A.jsx)(`input`,{ref:e,className:`palette-input`,role:`combobox`,"aria-expanded":r,"aria-controls":t,"aria-autocomplete":`list`,"aria-activedescendant":r?`${t}-${n.active}`:void 0,"aria-label":`Search documents or run a command`,placeholder:`Search documents or run a command…`,autoComplete:`off`,spellCheck:!1,value:n.query,onChange:e=>n.setQuery(e.target.value),onKeyDown:n.handleKeyDown}),(0,A.jsx)(`kbd`,{className:`palette-key`,children:`Esc`})]})}function tr({listId:e,state:t}){return(0,w.useEffect)(()=>{document.getElementById(`${e}-${t.active}`)?.scrollIntoView({block:`nearest`})},[e,t.active]),(0,A.jsx)(`div`,{id:e,role:`listbox`,"aria-label":t.query.trim()===``?`Commands`:`Documents`,className:`palette-list`,hidden:t.options.length===0,children:t.options.map((n,r)=>{let i=n.icon;return(0,A.jsxs)(`div`,{id:`${e}-${r}`,role:`option`,"aria-selected":r===t.active,className:`palette-option`,onMouseMove:()=>t.setActive(r),onClick:()=>void t.run(n),children:[(0,A.jsx)(`span`,{className:`palette-option-icon`,"aria-hidden":!n.status||void 0,children:n.status?(0,A.jsx)(H,{status:n.status}):i&&(0,A.jsx)(i,{})}),(0,A.jsxs)(`span`,{className:`palette-option-text`,children:[(0,A.jsx)(`span`,{className:`palette-option-label`,children:n.label}),(0,A.jsx)(`span`,{className:`palette-option-detail`,children:n.detail})]})]},n.id)})})}var nr=16;function rr(e,t,n){return Math.min(n,Math.max(t,e))}function ir(e){let{label:t,value:n,min:r,max:i,grows:a,onChange:o,onReset:s,controls:c}=e,l=a===`right`?1:-1,u=(0,w.useRef)(null);function d(e){if(e.button!==0)return;let t=e.currentTarget;typeof t.setPointerCapture==`function`&&t.setPointerCapture(e.pointerId),u.current={x:e.clientX,width:n},document.body.dataset.resizing=`true`}function ee(e){let t=u.current;t&&o(rr(t.width+l*(e.clientX-t.x),r,i))}function f(){u.current=null,delete document.body.dataset.resizing}function p(e){let t=e.shiftKey?64:nr,a={ArrowRight:t,ArrowLeft:-t};if(e.key===`Home`)o(r);else if(e.key===`End`)o(i);else if(e.key in a)o(rr(n+l*(a[e.key]??0),r,i));else return;e.preventDefault()}return(0,A.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":t,"aria-valuenow":n,"aria-valuemin":r,"aria-valuemax":i,"aria-controls":c,tabIndex:0,className:`resize-handle`,"data-edge":a,onPointerDown:d,onPointerMove:ee,onPointerUp:f,onPointerCancel:f,onKeyDown:p,onDoubleClick:s})}var W=()=>!0,G=e=>t=>_(t,e),K=[{id:`collections`,path:`/setup/collections`,label:`Collections & schema`,icon:Fe,visible:(e,t)=>_(e,`runtimeSchema`)&&(!t.loginRequired||ne(t.roles,`admin`))},{id:`locales`,path:`/setup/locales`,label:`Locales`,icon:Qe,visible:W},{id:`ai`,path:`/setup/ai`,label:`AI provider`,icon:We,visible:W},{id:`integrations`,path:`/setup/integrations`,label:`Integrations`,icon:At,visible:G(`webhookDeliveries`)},{id:`checkpoints`,path:`/setup/checkpoints`,label:`Checkpoints`,icon:_t,visible:G(`checkpoints`)},{id:`people`,path:`/setup/people`,label:`People`,icon:Et,visible:(e,t)=>(e.authMode===`token`||e.authMode===`oidc`)&&ne(t.roles,`admin`)},{id:`environment`,path:`/setup/environment`,label:`Environment`,icon:bt,visible:W}],ar=[{id:`pulse`,path:`/`,label:`Pulse`,icon:ke,visible:W},{id:`site`,path:`/site`,label:`Site`,icon:Je,visible:W},{id:`structure`,path:`/structure`,label:`Structure`,icon:P,visible:G(`seo`)},{id:`media`,path:`/media`,label:`Media`,icon:Xe,visible:G(`media`)},{id:`setup`,path:`/setup`,label:`Setup`,icon:St,visible:(e,t)=>K.some(n=>n.visible(e,t))}],q=[{id:`graph`,path:`/structure/graph`,label:`Graph`},{id:`scopes`,path:`/structure/scopes`,label:`Scopes & archetypes`},{id:`rich-results`,path:`/structure/rich-results`,label:`Rich results`},{id:`crawlers`,path:`/structure/crawlers`,label:`Crawlers & assistants`}];function or(e,t){return ar.filter(n=>n.visible(e,t))}function sr(e,t){return K.filter(n=>n.visible(e,t))}function cr(e,t,n){return ar.some(r=>r.id===e&&r.visible(t,n))}function lr(e){if(e===`/`||e===``)return`pulse`;let t=e.split(`/`)[1]??``;return t===`site`||t===`layout`||t===`new`?`site`:t===`structure`||t===`media`||t===`setup`?t:null}function ur(e=`neutral`,t){return[`ui-chip`,`ui-chip--${e}`,t].filter(Boolean).join(` `)}function dr({tone:e=`neutral`,icon:t,children:n}){return(0,A.jsxs)(`span`,{className:ur(e),children:[t&&(0,A.jsx)(t,{className:`ui-chip-icon`,"aria-hidden":`true`}),n]})}var fr=`krantho-studio-theme`;function pr(){try{let e=localStorage.getItem(fr);return e===`light`||e===`dark`?e:`system`}catch{return`system`}}function mr(){let[e,t]=(0,w.useState)(pr),n=(0,w.useCallback)(e=>{t(e);try{localStorage.setItem(fr,e)}catch{}},[]);return(0,w.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,e)},[e]),{theme:e,setTheme:n}}var J=[{value:`light`,label:`Light`,icon:wt},{value:`dark`,label:`Dark`,icon:ct},{value:`system`,label:`System`,icon:ot}],hr={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};function gr({index:e,checked:t,buttons:n,onChoose:r}){let i=J[e];if(!i)return null;let a=i.icon;function o(t){let n=hr[t.key];n!==void 0&&(t.preventDefault(),r((e+n+J.length)%J.length))}return(0,A.jsx)(`button`,{ref:t=>{n.current[e]=t},type:`button`,role:`radio`,"aria-checked":t,"aria-label":i.label,title:i.label,tabIndex:t?0:-1,className:`theme-switch-option`,onClick:()=>r(e),onKeyDown:o,children:(0,A.jsx)(a,{"aria-hidden":`true`})})}function _r({vertical:e=!1}){let{theme:t,setTheme:n}=mr(),r=(0,w.useRef)([]);function i(e){let t=J[e];t&&(n(t.value),r.current[e]?.focus())}return(0,A.jsx)(`div`,{className:`theme-switch`,role:`radiogroup`,"aria-label":`Theme`,"aria-orientation":e?`vertical`:`horizontal`,"data-vertical":e,children:J.map((e,n)=>(0,A.jsx)(gr,{index:n,checked:t===e.value,buttons:r,onChoose:i},e.value))})}function vr(){let e=j();return e?(0,A.jsxs)(`button`,{ref:e.launcherRef,type:`button`,className:`nav-item`,"aria-expanded":e.open,"aria-controls":e.opened?`assistant-panel`:void 0,onClick:e.toggle,children:[(0,A.jsx)(Ne,{className:`nav-item-icon`,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`nav-item-label`,children:`Assistant`})]}):null}function yr({collapsed:e}){let t=m();if(!t.loginRequired)return null;let n=t.user?.roles[0]??`viewer`;return(0,A.jsxs)(A.Fragment,{children:[t.user&&!e&&(0,A.jsxs)(`div`,{className:`nav-user`,children:[(0,A.jsx)(`span`,{className:`nav-user-email`,title:t.user.email,children:t.user.email}),(0,A.jsx)(dr,{tone:n===`admin`?`accent`:`neutral`,children:n})]}),(0,A.jsxs)(`button`,{type:`button`,className:`nav-item`,onClick:()=>void t.logout(),children:[(0,A.jsx)(nt,{className:`nav-item-icon`,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`nav-item-label`,children:`Log out`})]})]})}function br({mode:e,onToggleCollapsed:t}){let n=e===`collapsed`;return(0,A.jsxs)(`div`,{className:`nav-footer`,children:[(0,A.jsx)(vr,{}),(0,A.jsx)(yr,{collapsed:n}),(0,A.jsxs)(`div`,{className:`nav-footer-row`,children:[(0,A.jsx)(_r,{vertical:n}),e!==`drawer`&&(0,A.jsx)(b,{icon:n?pt:dt,label:n?`Expand navigation`:`Collapse navigation`,"aria-expanded":!n,"aria-controls":`studio-nav`,size:`sm`,onClick:t})]})]})}var Y=`:slug`;function xr(e){return e.path===void 0?e.name!==`globals`:e.path!==!1}function Sr(e,t){if(!xr(e))return null;let{name:n,path:r}=e;return typeof r==`string`?wr(r,t):n===`pages`?t===`home`?`/`:`/${t}`:`/${n}/${t}`}function Cr(e){if(!xr(e))return null;let{name:t,path:n}=e;return typeof n==`string`?n.replace(`/${Y}`,``)||`/`:t===`pages`?`/`:`/${t}`}function wr(e,t){if(!e.includes(Y))return e;let n=`/${Y}`;return t===`index`&&e.includes(n)?e.replace(n,``)||`/`:e.replaceAll(Y,t)}function Tr(e){return e?`${e.roles[0]??`unknown`}:${e.email}`:null}function Er(e){return e.replace(/^(admin|editor|viewer|unknown):/,``)}function Dr(e,t,n=Date.now()){let r=Tr(t);return e.filter(e=>e.lockedBy!==r&&new Date(e.expiresAt).getTime()>n)}function Or(e,t,n,r=Date.now()){let i=new Map;for(let a of Dr(e,n,r))t&&a.locale!==t||i.set(`${a.collection}/${a.slug}`,Er(a.lockedBy));return i}function kr(){let[e,t]=(0,w.useState)(null);return(0,w.useEffect)(()=>{let e=!0;return V().then(n=>{e&&t(n)}).catch(()=>{e&&t(null)}),()=>{e=!1}},[]),e}var Ar=6e4,jr=6e5,Mr=[`pointerdown`,`pointermove`,`keydown`,`wheel`,`touchstart`],Nr={groups:[],layout:null};function Pr(e,t){let n=new Set;return e.filter(e=>!n.has(e.slug)&&!!n.add(e.slug)).map(e=>({collection:e.collection,slug:e.slug,status:B(e),lockedBy:t.get(`${e.collection}/${e.slug}`)??null})).sort((e,t)=>e.slug.localeCompare(t.slug))}async function Fr(e,t){let[n,r,{collections:i}]=await Promise.all([z(),An().catch(()=>[]),Wt(e)]),a=Or(r,e,t),o=new Map(i.map(e=>[e.name,e.documents])),s=[],c=null;for(let e of n){let t=Pr(o.get(e.name)??[],a);e.name===`globals`?c=t:s.push({collection:e,documents:t})}return{groups:s,layout:c}}function Ir(e,t){let[n,r]=(0,w.useState)(Nr),{pathname:i}=s(),a=kr()?.defaultLocale,o=(0,w.useCallback)(async()=>{if(a===void 0)return null;try{return await Fr(a,e)}catch(e){return console.warn(`[studio] Failed to load the site tree:`,e),null}},[a,e]);return(0,w.useEffect)(()=>{let e=!0,t=()=>{o().then(t=>{e&&t&&r(t)})},n=()=>document.visibilityState===`visible`,i=Date.now(),a=()=>Date.now()-i>=jr,s=()=>{n()&&!a()&&t()},c=()=>{let e=a();i=Date.now(),e&&n()&&t()},l=()=>{n()&&(i=Date.now(),t())};t();let u=setInterval(s,Ar);document.addEventListener(`visibilitychange`,l);for(let e of Mr)document.addEventListener(e,c,{passive:!0});return()=>{e=!1,clearInterval(u),document.removeEventListener(`visibilitychange`,l);for(let e of Mr)document.removeEventListener(e,c)}},[o,i,t]),n}function Lr(e){let t=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0;if(t===0)return;let n=L(e.currentTarget),r=n.indexOf(document.activeElement);r!==-1&&(e.preventDefault(),n[(r+t+n.length)%n.length]?.focus())}function Rr({document:e}){let{pathname:t}=s(),n=D(e.collection,e.slug),r=t===n||t.startsWith(`${n}/`);return(0,A.jsx)(`li`,{children:(0,A.jsxs)(p,{to:n,className:`tree-item`,"aria-current":r?`page`:void 0,children:[(0,A.jsx)(H,{status:e.status}),(0,A.jsx)(`span`,{className:`tree-item-label`,children:e.slug}),e.lockedBy&&(0,A.jsx)(`span`,{className:`tree-lock`,role:`img`,"aria-label":`Locked by ${e.lockedBy}`,children:(0,A.jsx)(et,{"aria-hidden":`true`})})]})})}function zr({label:e,urlPath:t,path:n}){let{pathname:r}=s();return n?(0,A.jsxs)(p,{to:n,className:`tree-group-label`,"aria-current":r===n?`page`:void 0,children:[e,t&&(0,A.jsxs)(A.Fragment,{children:[` `,(0,A.jsx)(`span`,{className:`tree-group-path`,children:t})]})]}):(0,A.jsx)(`span`,{className:`tree-group-label`,children:e})}function Br(e){let{name:t,label:n,open:r,onToggle:i,children:a}=e,o=(0,w.useId)();return(0,A.jsxs)(`div`,{className:`tree-group`,role:`group`,"aria-label":n,"data-group":t,children:[(0,A.jsxs)(`div`,{className:`tree-group-head`,children:[(0,A.jsx)(`button`,{type:`button`,className:`tree-toggle`,"aria-expanded":r,"aria-controls":o,"aria-label":`${n} documents`,onClick:i,children:(0,A.jsx)(N,{"aria-hidden":`true`})}),(0,A.jsx)(zr,{label:n,urlPath:e.urlPath,path:e.path})]}),(0,A.jsx)(`ul`,{id:o,className:`tree-list`,hidden:!r,children:a})]})}function Vr(){return(0,A.jsxs)(`ul`,{className:`tree-legend`,"aria-label":`Status legend`,children:[(0,A.jsxs)(`li`,{children:[(0,A.jsx)(H,{status:`live`,decorative:!0}),`live`]}),(0,A.jsxs)(`li`,{children:[(0,A.jsx)(H,{status:`ahead`,decorative:!0}),`draft ahead`]}),(0,A.jsxs)(`li`,{children:[(0,A.jsx)(H,{status:`draft`,decorative:!0}),`draft`]})]})}function Hr({group:e,canCreate:t,open:n,onToggle:r}){let{collection:i,documents:a}=e;return(0,A.jsxs)(Br,{name:i.name,label:g(i.name),urlPath:Cr(i),path:O(i.name),open:n,onToggle:r,children:[a.map(e=>(0,A.jsx)(Rr,{document:e},e.slug)),t&&(0,A.jsx)(`li`,{children:(0,A.jsxs)(p,{to:k(i.name),className:`tree-item tree-item--new`,children:[(0,A.jsx)(ht,{"aria-hidden":`true`}),(0,A.jsxs)(`span`,{className:`tree-item-label`,children:[`New `,ae(i.name)]})]})})]})}function Ur({revision:e,closedGroups:t,onToggleGroup:n}){let{user:r,hasRole:i}=m(),a=Ir(r,e),o=i(`editor`);return(0,A.jsxs)(`div`,{className:`site-tree`,role:`group`,"aria-label":`Site tree`,onKeyDown:Lr,children:[a.groups.map(e=>(0,A.jsx)(Hr,{group:e,canCreate:o,open:!t.includes(e.collection.name),onToggle:()=>n(e.collection.name)},e.collection.name)),a.layout&&(0,A.jsx)(Br,{name:`globals`,label:`Layout`,open:!t.includes(`globals`),onToggle:()=>n(`globals`),children:a.layout.map(e=>(0,A.jsx)(Rr,{document:e},e.slug))}),(0,A.jsx)(Vr,{})]})}function Wr(){return(0,A.jsxs)(`svg`,{className:`nav-brand-mark`,viewBox:`0 0 32 32`,fill:`none`,"aria-hidden":`true`,children:[(0,A.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`2.25`,strokeLinecap:`round`,children:[(0,A.jsx)(`path`,{d:`M9 4.5v23`}),(0,A.jsx)(`path`,{d:`M9 17.5 23 7`}),(0,A.jsx)(`path`,{d:`M14.5 13.4 23.5 27`})]}),(0,A.jsxs)(`g`,{fill:`currentColor`,children:[(0,A.jsx)(`circle`,{cx:`9`,cy:`4.5`,r:`2.6`}),(0,A.jsx)(`circle`,{cx:`9`,cy:`27.5`,r:`2.6`}),(0,A.jsx)(`circle`,{cx:`23`,cy:`7`,r:`2.6`}),(0,A.jsx)(`circle`,{cx:`23.5`,cy:`27`,r:`2.6`})]}),(0,A.jsx)(`circle`,{cx:`9`,cy:`17.5`,r:`3.6`,fill:`var(--color-accent)`})]})}function Gr(){let e=h(),{user:t,loginRequired:n}=m(),{pathname:r}=s(),i=lr(r),a={roles:t?.roles??[],loginRequired:n};return(0,A.jsx)(`ul`,{className:`nav-destinations`,"aria-label":`Destinations`,children:or(e,a).map(e=>{let t=e.icon,n=r===e.path?`page`:i===e.id?`true`:void 0;return(0,A.jsx)(`li`,{children:(0,A.jsxs)(p,{to:e.path,className:`nav-item`,"aria-current":n,children:[(0,A.jsx)(t,{className:`nav-item-icon`,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`nav-item-label`,children:e.label})]})},e.id)})})}function Kr(e,t,n){R(e,t),(0,w.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t,n])}function qr(e){(0,w.useEffect)(()=>{let t=e.current;if(!t)return;let n=new Set,r=e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`.nav-item`),r=e.relatedTarget;!t||r instanceof Node&&t.contains(r)||n.delete(t)&&t.removeAttribute(`data-tip-dismissed`)},i=e=>{if(e.key===`Escape`&&t.dataset.mode===`collapsed`)for(let e of t.querySelectorAll(`.nav-item:hover, .nav-item:focus`))e.setAttribute(`data-tip-dismissed`,``),n.add(e)};return document.addEventListener(`keydown`,i),t.addEventListener(`mouseout`,r),t.addEventListener(`focusout`,r),()=>{document.removeEventListener(`keydown`,i),t.removeEventListener(`mouseout`,r),t.removeEventListener(`focusout`,r)}},[e])}function Jr({onCloseDrawer:e}){return(0,A.jsxs)(`div`,{className:`nav-header`,children:[(0,A.jsxs)(p,{to:`/`,className:`nav-brand`,children:[(0,A.jsx)(Wr,{}),(0,A.jsxs)(`span`,{className:`nav-brand-word`,children:[`krantho `,(0,A.jsx)(`span`,{className:`nav-brand-studio`,children:`studio`})]})]}),e&&(0,A.jsx)(b,{icon:I,label:`Close navigation`,onClick:e})]})}function Yr(e){let{mode:t,drawerOpen:n,onCloseDrawer:r}=e,i=(0,w.useRef)(null),a=t===`drawer`,o=a&&n;return Kr(i,o,r),qr(i),(0,A.jsxs)(`div`,{ref:i,id:`studio-nav`,className:`shell-nav`,"data-mode":t,"data-open":o,inert:a&&!n,...o?{role:`dialog`,"aria-modal":!0,"aria-label":`Navigation`}:{},children:[(0,A.jsxs)(`nav`,{className:`nav`,"aria-label":`Studio`,children:[(0,A.jsx)(Jr,{onCloseDrawer:a?r:null}),(0,A.jsxs)(`div`,{className:`nav-scroll`,children:[(0,A.jsx)(Gr,{}),t!==`collapsed`&&(0,A.jsx)(Ur,{revision:e.treeRevision,closedGroups:e.closedGroups,onToggleGroup:e.onToggleGroup})]}),(0,A.jsx)(br,{mode:t,onToggleCollapsed:e.onToggleCollapsed})]}),t===`expanded`&&(0,A.jsx)(ir,{label:`Resize navigation`,value:e.width,min:M.min,max:M.max,grows:`right`,onChange:e.onResize,onReset:e.onResetWidth,controls:`studio-nav`})]})}var Xr={notFound:!0};function Zr(e){return typeof e==`object`&&!!e&&`notFound`in e}var X=(0,w.createContext)({path:null,report:()=>{}});function Qr({children:e}){let[t,n]=(0,w.useState)(null);return(0,A.jsx)(X.Provider,{value:{path:t,report:n},children:e})}function $r(e){return(0,w.useContext)(X).path===e}function Z(){let{pathname:e}=s(),{report:t}=(0,w.useContext)(X);return(0,w.useEffect)(()=>(t(e),()=>t(null)),[t,e]),(0,A.jsxs)(`section`,{className:`not-found`,"aria-labelledby":`not-found-title`,children:[(0,A.jsx)(`p`,{className:`not-found-code`,children:`404`}),(0,A.jsx)(`h1`,{id:`not-found-title`,children:`Nothing here`}),(0,A.jsx)(`p`,{children:`This screen does not exist, or it is turned off for this site or for your role.`}),(0,A.jsx)(p,{to:`/`,className:v(`primary`),children:`Go to Pulse`})]})}var Q={label:`Site`,path:`/site`},ei={label:`Structure`,path:`/structure`},ti={label:`Setup`,path:`/setup`},ni={label:`Media`,path:`/media`};function ri(e){return{label:g(e),path:O(e)}}function ii(e){return q.find(t=>t.id===e)?.label??e}function ai(e){return K.find(t=>t.id===e)?.label??e}var oi=[{pattern:`/`,trail:()=>[{label:`Pulse`}]},{pattern:`/site`,trail:()=>[{label:`Site`}]},{pattern:`/site/:collection`,trail:e=>[Q,{label:g(e.collection??``)}]},{pattern:`/site/:collection/:slug`,trail:e=>[Q,ri(e.collection??``),{label:e.slug??``}]},{pattern:`/new/:collection`,trail:e=>[Q,ri(e.collection??``),{label:`New`}]},{pattern:`/layout/:slug`,trail:e=>[Q,{label:`Layout`},{label:e.slug??``}]},{pattern:`/structure`,trail:()=>[ei,{label:ii(`graph`)}]},{pattern:`/structure/:tab`,trail:e=>[ei,{label:ii(e.tab??``)}]},{pattern:`/setup`,trail:()=>[{label:`Setup`}]},{pattern:`/setup/:tab`,trail:e=>[ti,{label:ai(e.tab??``)}]},{pattern:`/media`,trail:()=>[{label:`Media`}]},{pattern:`/media/:id/edit`,trail:()=>[ni,{label:`Edit image`}]}],si=[{label:`Not found`}];function ci(e,t=!1){if(t)return si;for(let{pattern:t,trail:n}of oi){let r=f(t,e);if(r)return n(r.params)}return si}function li(){let{pathname:e}=s(),t=u().some(e=>Zr(e.handle)),n=$r(e),r=ci(e,t||n);return(0,A.jsx)(`nav`,{className:`breadcrumbs`,"aria-label":`Breadcrumb`,children:(0,A.jsx)(`ol`,{className:`breadcrumbs-list`,children:r.map((e,t)=>{let n=t===r.length-1;return(0,A.jsxs)(`li`,{className:`breadcrumbs-item`,children:[t>0&&(0,A.jsx)(N,{className:`breadcrumbs-separator`,"aria-hidden":`true`}),n?(0,A.jsx)(`span`,{className:`breadcrumbs-current`,"aria-current":`page`,children:e.label}):e.path?(0,A.jsx)(p,{to:e.path,className:`breadcrumbs-link`,children:e.label}):(0,A.jsx)(`span`,{className:`breadcrumbs-text`,children:e.label})]},r.slice(0,t+1).map(e=>e.label).join(`/`))})})})}function ui(){let e=typeof navigator>`u`?``:navigator.platform||navigator.userAgent;return/Mac|iPhone|iPad|iPod/i.test(e)?`⌘K`:`Ctrl K`}function di({showMenuButton:e,menuOpen:t,onOpenMenu:n,onOpenPalette:r}){return(0,A.jsxs)(`header`,{className:`top-bar`,children:[e&&(0,A.jsx)(b,{icon:it,label:`Open navigation`,"aria-expanded":t,"aria-controls":`studio-nav`,onClick:n}),(0,A.jsx)(li,{}),(0,A.jsxs)(`button`,{type:`button`,className:`top-bar-command`,"aria-label":`Search or command`,"aria-keyshortcuts":`Meta+K Control+K`,"aria-haspopup":`dialog`,onClick:r,children:[(0,A.jsx)(F,{className:`top-bar-command-icon`,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`top-bar-command-label`,children:`Search or command`}),(0,A.jsx)(`kbd`,{className:`top-bar-command-key`,children:ui()})]})]})}var fi=(0,w.lazy)(()=>t(()=>import(`./AssistantPanel-ECkcslXS.js`).then(e=>({default:e.AssistantPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])));function pi(){}function mi(){return c()?.contentChanged??pi}var hi=`(max-width: 959.98px)`;function gi(){return j()?.opened?(0,A.jsx)(w.Suspense,{fallback:null,children:(0,A.jsx)(fi,{})}):null}function _i(e){(0,w.useEffect)(()=>{function t(t){(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`k`&&(t.preventDefault(),e())}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function vi(e){let[t,n]=(0,w.useState)(!1),{pathname:r}=s();return(0,w.useEffect)(()=>n(!1),[r,e]),[t,n]}function yi(){let e=be(hi),t=De(),[n,r]=vi(e),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(0),c=(0,w.useCallback)(()=>{r(!1),a(!0)},[r]);return _i((0,w.useCallback)(()=>{r(!1),a(e=>!e)},[r])),{mode:e?`drawer`:t.collapsed?`collapsed`:`expanded`,drawerOpen:n,openDrawer:(0,w.useCallback)(()=>r(!0),[r]),closeDrawer:(0,w.useCallback)(()=>r(!1),[r]),toggleCollapsed:()=>t.setCollapsed(!t.collapsed),paletteOpen:i,openPalette:c,closePalette:(0,w.useCallback)(()=>a(!1),[]),treeRevision:o,contentChanged:(0,w.useCallback)(()=>s(e=>e+1),[]),preferences:t}}function bi(){let e=yi();return(0,A.jsxs)(`div`,{className:`shell`,"data-nav":e.mode,style:{"--nav-width":`${e.preferences.width}px`},children:[(0,A.jsx)(`a`,{className:`shell-skip`,href:`#studio-main`,children:`Skip to content`}),(0,A.jsx)(Yr,{mode:e.mode,drawerOpen:e.drawerOpen,onCloseDrawer:e.closeDrawer,onToggleCollapsed:e.toggleCollapsed,width:e.preferences.width,onResize:e.preferences.setWidth,onResetWidth:()=>e.preferences.setWidth(M.fallback),treeRevision:e.treeRevision,closedGroups:e.preferences.closedGroups,onToggleGroup:e.preferences.toggleGroup}),e.mode===`drawer`&&e.drawerOpen&&(0,A.jsx)(`div`,{className:`shell-scrim`,"aria-hidden":`true`,onClick:e.closeDrawer}),(0,A.jsxs)(`div`,{className:`shell-column`,children:[(0,A.jsx)(di,{showMenuButton:e.mode===`drawer`,menuOpen:e.drawerOpen,onOpenMenu:e.openDrawer,onOpenPalette:e.openPalette}),(0,A.jsx)(`main`,{id:`studio-main`,className:`shell-page`,tabIndex:-1,children:(0,A.jsx)(w.Suspense,{fallback:(0,A.jsx)(`div`,{className:`loading`,children:`Loading…`}),children:(0,A.jsx)(o,{context:{contentChanged:e.contentChanged}})})})]}),(0,A.jsx)(Qn,{open:e.paletteOpen,onClose:e.closePalette,onContentChanged:e.contentChanged}),(0,A.jsx)(gi,{})]})}function xi(){let{isAuthenticated:e,user:t}=m(),n=h(),r=_(n,`assistant`)&&e&&t!==null,i=(0,A.jsx)(Bt,{children:(0,A.jsx)(Qr,{children:(0,A.jsx)(bi,{})})});return r?(0,A.jsx)(ve,{children:i}):i}var Si=(0,w.lazy)(()=>t(()=>import(`./pulse-page-C00oCF2o.js`).then(e=>({default:e.PulsePage})),__vite__mapDeps([17,1,18,2,3,4,6,14,7,19,20,21,22,5,23,24,25,26,27]))),Ci=(0,w.lazy)(()=>t(()=>import(`./site-overview-5EhmXIR0.js`).then(e=>({default:e.SiteOverview})),__vite__mapDeps([28,1,23,2,3,4,5,19,29,30,21,22,31,18,6,14,32,33,34,15,35,36,20,37]))),wi=(0,w.lazy)(()=>t(()=>import(`./collection-view--erTGbRH.js`).then(e=>({default:e.CollectionPage})),__vite__mapDeps([38,1,23,2,3,4,5,7,19,29,30,21,22,39,40,41,31,18,6,14,42,32,33,34,15,35,36,20,37,43]))),$=(0,w.lazy)(()=>t(()=>import(`./editor-page-XOJrwlcZ.js`).then(e=>({default:e.EditorPage})),__vite__mapDeps([44,1,3,5,19,31,2,4,23,18,6,14,21,22,33,45,40,46,47,48,11,9,49,50,51,7,24,25,52,12,35,53,41,54,15,55,36,13,26,56,57,58]))),Ti=(0,w.lazy)(()=>t(()=>import(`./structure-page-9d9MG7vU.js`).then(e=>({default:e.StructurePage})),__vite__mapDeps([59,1,18,2,3,4,6,14,5,7,21,22,60,19,55,61,36,41,33,29,30,49,62,47,20,52,12,35,23,53,54,39,26,63,34,15,64,65,13,66,67]))),Ei=(0,w.lazy)(()=>t(()=>import(`./media-page-CeBC5FQS.js`).then(e=>({default:e.MediaPage})),__vite__mapDeps([68,1,45,3,2,4,40,46,6,47,48,7,19,21,22,5,12,36,42,41,62,53,69,66,70]))),Di=(0,w.lazy)(()=>t(()=>import(`./image-editor-BX-DHJDa.js`).then(e=>({default:e.ImageEditorPage})),__vite__mapDeps([71,1,56,2,3,4,49,62,72,73,5,47,7,46,6,74]))),Oi=(0,w.lazy)(()=>t(()=>import(`./setup-page-BHJcTaTH.js`).then(e=>({default:e.SetupPage})),__vite__mapDeps([75,1,3,60,5,19,55,2,4,18,6,61,7,33,42,47,66,29,30,21,22,41,20,69,12,11,8,57,76]))),ki=[{path:`site`,element:(0,A.jsx)(Ci,{})},{path:`site/${T}`,element:(0,A.jsx)(Z,{}),handle:Xr},{path:`site/:collection`,element:(0,A.jsx)(wi,{})},{path:`site/:collection/:slug`,element:(0,A.jsx)($,{})},{path:`new/:collection`,element:(0,A.jsx)($,{})},{path:`layout/:slug`,element:(0,A.jsx)($,{collection:T})}],Ai=[{path:`structure`,element:(0,A.jsx)(l,{replace:!0,to:q[0]?.path??`/`})},...q.map(e=>({path:e.path.slice(1),element:(0,A.jsx)(Ti,{tab:e.id})}))],ji=[{path:`media`,element:(0,A.jsx)(Ei,{})},{path:`media/:id/edit`,element:(0,A.jsx)(Di,{})}];function Mi(e){let t=e[0];return t?[{path:`setup`,element:(0,A.jsx)(l,{replace:!0,to:t.path})},...e.map(t=>({path:t.path.slice(1),element:(0,A.jsx)(Oi,{tab:t.id,tabs:e})}))]:[]}function Ni({caps:e,viewer:t}){let n=n=>cr(n,e,t),r=[{index:!0,element:(0,A.jsx)(Si,{})},...ki,...n(`structure`)?Ai:[],...n(`media`)?ji:[],...n(`setup`)?Mi(sr(e,t)):[],{path:`*`,element:(0,A.jsx)(Z,{}),handle:Xr}];return[{path:`/`,element:(0,A.jsx)(xi,{}),children:r}]}function Pi(e){return d(e,{basename:`/studio`})}function Fi(){return(0,A.jsx)(`div`,{className:`loading`,children:`Loading…`})}function Ii({children:e}){let[t,n]=(0,w.useState)(null);return(0,w.useEffect)(()=>{ie().then(n)},[]),t?(0,A.jsx)(oe.Provider,{value:t,children:e}):(0,A.jsx)(Fi,{})}function Li({makeRouter:e}){let{user:t,loginRequired:n}=m(),r=h(),i=t?.roles,a=(0,w.useMemo)(()=>e(Ni({caps:r,viewer:{roles:i??[],loginRequired:n}})),[e,r,i,n]);return(0,w.useEffect)(()=>()=>a.dispose(),[a]),(0,A.jsx)(ee,{router:a})}function Ri({makeRouter:e}){let{isLoading:t,isAuthenticated:n,loginRequired:r}=m();return t?(0,A.jsx)(Fi,{}):r&&!n?(0,A.jsx)(ge,{}):(0,A.jsx)(Li,{makeRouter:e})}function zi({makeRouter:e=Pi}){return(0,A.jsx)(re,{children:(0,A.jsx)(Ii,{children:(0,A.jsx)(Ri,{makeRouter:e})})})}var Bi=document.getElementById(`root`);if(!Bi)throw Error(`Root element not found`);(0,ce.createRoot)(Bi).render((0,A.jsx)(w.StrictMode,{children:(0,A.jsx)(zi,{})}));export{R as $,hn as A,Ut as B,V as C,O as Ct,pn as D,k as Dt,mn as E,fe as Et,Yt as F,Jt as G,qt as H,an as I,cn as J,dn as K,sn as L,B as M,en as N,yn as O,de as Ot,tn as P,Xt as Q,on as R,bn as S,T as St,gn as T,D as Tt,Zt as U,z as V,nn as W,un as X,Qt as Y,rn as Z,Tn as _,xe as _t,Cr as a,_t as at,En as b,j as bt,ur as c,et as ct,Kn as d,Ke as dt,Pt as et,U as f,Be as ft,kn as g,we as gt,An as h,je as ht,Dr as i,F as it,fn as j,_n as k,q as l,Qe as lt,On as m,N as mt,Z as n,At as nt,Sr as o,ht as ot,jn as p,Re as pt,ln as q,Er as r,bt as rt,dr as s,P as st,mi as t,I as tt,ir as u,Je as ut,Dn as v,Ce as vt,vn as w,le as wt,H as x,pe as xt,wn as y,be as yt,Kt as z};