pandorga 1.4.5 → 1.4.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c08f73c874e192ee0b1bede450515781124405c6875afec2ac4f6500e3a1db46
4
- data.tar.gz: 55c89932abd93336991692769b088ca9dc798d04c2f7615cd175f67f156f06d4
3
+ metadata.gz: a8ea9638b4cbf0679fd3eeb328969878e5c4e7080be6a338257ccfc831f66213
4
+ data.tar.gz: 865776c26a7094cdf151ff21c6ecf492dd9e91171a6608bb23567323ff6ef8a2
5
5
  SHA512:
6
- metadata.gz: '00088be394eb9440225561ca538fd7aef974688c9563d293627b5f3e7ee1f5058c80a6ffb70734d7eaec249a1b50ccf81df68a8dce557519730d666b5da1e3a3'
7
- data.tar.gz: a3a0687866fe28126982d3564595fa6e2193034a2bd0f2e288ccf2e19d180765d5a4e2ca3d8ae92604a8d1c4eb92cf81136076ca292077ad9e6e14d92fbceb3b
6
+ metadata.gz: f14807c5d0798c3dd75253faa2571fd142ee5f9e69017486a89cf65eead3c45707b683ab044bd45c3be03fe177287732a0cb95dfc1a57597917ea9a6e2b272b4
7
+ data.tar.gz: 86216efa57c77d99e3f1369d467edd57580f3046e558325b425ad1ecc85c5b0c9dacb162407840229c50f87de9233f8e668ef3abaa5cd2b34714b76644697042
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.4.6] — 2026-10-07
4
+
5
+ ### Fixed
6
+
7
+ - Pipeline config resolution no longer swallows `_config.yml` read failures as
8
+ a silent “unconfigured”; returns a clear message when
9
+ `pandorga.content.workflow` is missing
10
+ - Studio chip surfaces pipeline-status API errors on boot, not only after Save
11
+
12
+ ### Added
13
+
14
+ - Gate `test-studio-pipeline-config.mjs` for `parseContentWorkflowFromConfig`
15
+
3
16
  ## [1.4.5] — 2026-10-07
4
17
 
5
18
  ### Changed
@@ -307,21 +307,40 @@ export async function resolveContentWorkflowConfig(env) {
307
307
 
308
308
  try {
309
309
  const file = await getFile(env, "_config.yml");
310
- if (file?.content) {
311
- const parsed = parseContentWorkflowFromConfig(file.content);
312
- if (parsed.workflow) {
313
- return {
314
- workflow: parsed.workflow,
315
- ref: parsed.workflowRef || envRef || "main",
316
- source: "config",
317
- };
318
- }
310
+ if (!file?.content) {
311
+ return {
312
+ workflow: null,
313
+ ref: envRef || "main",
314
+ source: null,
315
+ error: "config_missing",
316
+ message: "_config.yml was not found on main.",
317
+ };
318
+ }
319
+ const parsed = parseContentWorkflowFromConfig(file.content);
320
+ if (parsed.workflow) {
321
+ return {
322
+ workflow: parsed.workflow,
323
+ ref: parsed.workflowRef || envRef || "main",
324
+ source: "config",
325
+ };
319
326
  }
320
- } catch {
321
- /* fall through to unconfigured */
327
+ return {
328
+ workflow: null,
329
+ ref: envRef || "main",
330
+ source: null,
331
+ error: "workflow_unset",
332
+ message:
333
+ "Set pandorga.content.workflow in _config.yml (e.g. content-pipeline.yml).",
334
+ };
335
+ } catch (err) {
336
+ return {
337
+ workflow: null,
338
+ ref: envRef || "main",
339
+ source: null,
340
+ error: err.code || "config_read_failed",
341
+ message: String(err.message || err),
342
+ };
322
343
  }
323
-
324
- return { workflow: null, ref: envRef || "main", source: null };
325
344
  }
326
345
 
327
346
  /**
@@ -345,8 +364,11 @@ export async function getContentPipelineStatus(env, sha) {
345
364
  sha: commitSha,
346
365
  state: "unconfigured",
347
366
  run: null,
348
- error: null,
349
- source: null,
367
+ error: resolved.error || "workflow_unset",
368
+ source: resolved.source,
369
+ message:
370
+ resolved.message ||
371
+ "Set pandorga.content.workflow in _config.yml (e.g. content-pipeline.yml).",
350
372
  };
351
373
  }
352
374
  if (commitSha && !/^[0-9a-f]{7,40}$/.test(commitSha)) {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pandorga
4
- VERSION = "1.4.5"
4
+ VERSION = "1.4.6"
5
5
  end
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * parseContentWorkflowFromConfig — reads pandorga.content.workflow from _config.yml.
4
+ */
5
+ import assert from "node:assert/strict";
6
+ import { parseContentWorkflowFromConfig } from "../../functions/api/studio/_lib/github.js";
7
+
8
+ const sample = `# site
9
+ title: Example
10
+
11
+ pandorga:
12
+ # comment above content
13
+ content:
14
+ backend: r2
15
+ base_url: https://example.invalid
16
+ # Actions workflow Studio watches after Save
17
+ workflow: content-pipeline.yml
18
+ workflow_ref: main
19
+ identity:
20
+ name: Example
21
+ `;
22
+
23
+ const parsed = parseContentWorkflowFromConfig(sample);
24
+ assert.equal(parsed.workflow, "content-pipeline.yml");
25
+ assert.equal(parsed.workflowRef, "main");
26
+
27
+ const missing = parseContentWorkflowFromConfig("pandorga:\n identity:\n name: x\n");
28
+ assert.equal(missing.workflow, null);
29
+
30
+ const quoted = parseContentWorkflowFromConfig(
31
+ "pandorga:\n content:\n workflow: \"my-workflow.yml\"\n"
32
+ );
33
+ assert.equal(quoted.workflow, "my-workflow.yml");
34
+
35
+ console.log("All Studio pipeline config parse checks passed.");
data/scripts/validate.sh CHANGED
@@ -68,6 +68,11 @@ for test in "${TESTS[@]}"; do
68
68
  fi
69
69
  done
70
70
 
71
+ echo "-- scripts/test/test-studio-pipeline-config.mjs"
72
+ if ! node scripts/test/test-studio-pipeline-config.mjs; then
73
+ failed=1
74
+ fi
75
+
71
76
  if [[ "$failed" -ne 0 ]]; then
72
77
  echo "VALIDATE FAILED"
73
78
  exit 1
@@ -270,7 +270,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An err
270
270
  This commits a deletion to main and cannot be undone from Studio.`)){s(),r.mediaBusy=!0,r.status=`Deleting ${l}…`,i();try{let c=t.sha||null;c||(c=(await n.getFile(l)).sha);const u=await n.deleteFile({path:l,sha:c,message:`studio: delete ${l}`});r.mediaBusy=!1,r.status=`Deleted ${l}`,typeof e.onCommitted=="function"&&e.onCommitted(u==null?void 0:u.commit),await gr(r.mediaPath,e)}catch(c){r.mediaBusy=!1,o(c),i()}}}async function gr(t,e){const{api:n,state:r,render:i,captureError:o,clearError:s}=e;s(),r.mediaPath=t||xt,r.mediaLoading=!0,r.mediaBusy=!1,r.status=`Loading ${r.mediaPath}…`,i();try{const l=await n.listMedia(r.mediaPath);r.mediaItems=l.items||[],r.mediaPath=l.path||r.mediaPath,r.mediaLoading=!1;const a=r.mediaItems.filter(u=>u.type==="dir").length,c=r.mediaItems.filter(u=>u.type==="file").length;r.status=`${a} folders · ${c} files`}catch(l){r.mediaItems=[],r.mediaLoading=!1,o(l)}i()}async function Vv(t){const{api:e,state:n,render:r,captureError:i,clearError:o}=t,s=window.prompt("New folder name (letters, numbers, .-_)");if(s==null)return;const l=Dv(s);if(!l){n.error="Invalid folder name",n.status="",r();return}const a=`${n.mediaPath||xt}/${l}`;o(),n.mediaBusy=!0,n.status=`Creating ${l}…`,r();try{const c=await e.createMediaFolder({path:a,message:`studio: mkdir ${a}`});n.mediaBusy=!1,n.status=`Created ${vs(a)||a}`,typeof t.onCommitted=="function"&&t.onCommitted(c==null?void 0:c.commit),await gr(n.mediaPath,t)}catch(c){n.mediaBusy=!1,i(c),r()}}async function Uv(t,e){const{api:n,state:r,render:i,captureError:o,clearError:s}=e;s();const l=r.mediaPath||xt;let a=0,c=null;r.mediaBusy=!0;for(const u of t){const d=Rv(u.name);if(!d){r.error=`Skipped invalid name: ${u.name}`;continue}if(u.size>Gd){r.error=`${d} exceeds ${ng(Gd)} (GitHub Contents API soft limit in Studio)`;continue}r.status=`Uploading ${d}…`,i();try{const p=await Pv(u),m=`${l}/${d}`,g=await n.uploadMedia({path:m,content_base64:p,message:`studio: upload ${m}`});a+=1,r.status=`Uploaded ${g.public_path||vs(m)}`,c=(g==null?void 0:g.commit)||c}catch(p){o(p),r.mediaBusy=!1,i();return}}r.mediaBusy=!1,a&&(r.status=a===1?r.status:`Uploaded ${a} files`),a&&c&&typeof e.onCommitted=="function"&&e.onCommitted(c),await gr(l,e)}const qv="pk_test_c291bmQtc3F1aXJyZWwtNDgzMC5jbGVyay5hY2NvdW50cy5kZXYk",Zt="/studio/",Xd="",sg={forceRedirectUrl:Zt,fallbackRedirectUrl:Zt,signInForceRedirectUrl:Zt,signInFallbackRedirectUrl:Zt,signUpForceRedirectUrl:Zt,signUpFallbackRedirectUrl:Zt};function Wv(t){const e=String(t).replace(/^pk_(test|live)_/,"");if(!e)return"";try{const n="=".repeat((4-e.length%4)%4),r=(e+n).replace(/-/g,"+").replace(/_/g,"/");return atob(r).replace(/\$$/,"").trim()}catch{return""}}function Zd(t,e={}){return new Promise((n,r)=>{const i=document.querySelector(`script[src="${t}"]`);if(i){if(i.dataset.loaded==="1")return n();i.addEventListener("load",()=>n(),{once:!0}),i.addEventListener("error",()=>r(new Error(`Failed to load ${t}`)),{once:!0});return}const o=document.createElement("script");o.src=t,o.async=!0,o.defer=!0,o.crossOrigin="anonymous";for(const[s,l]of Object.entries(e))if(s==="dataset"&&l&&typeof l=="object")for(const[a,c]of Object.entries(l))o.dataset[a]=c;else l!=null&&o.setAttribute(s,l);o.onload=()=>{o.dataset.loaded="1",n()},o.onerror=()=>r(new Error(`Failed to load ${t}`)),document.head.appendChild(o)})}async function Kv(t){if(window.Clerk&&typeof window.Clerk.load=="function"&&window.__internal_ClerkUICtor)return window.Clerk;const e="".replace(/^https?:\/\//,"").replace(/\/$/,"")||Wv(t);if(!e)throw new Error("Cannot resolve Clerk Frontend API host from publishable key");const n=`https://${e}/npm`;await Zd(`${n}/@clerk/ui@1/dist/ui.browser.js`),await Zd(`${n}/@clerk/clerk-js@6/dist/clerk.browser.js`,{dataset:{clerkPublishableKey:t}});for(let r=0;r<80;r++){if(window.Clerk&&typeof window.Clerk.load=="function"&&window.__internal_ClerkUICtor)return window.Clerk;await new Promise(o=>setTimeout(o,25))}throw new Error("Clerk / ClerkUI global missing after script load")}async function Yv(){const t=await Kv(qv);return await t.load({clerkUICtor:window.__internal_ClerkUICtor,...sg}),Hg(async()=>t.session?t.session.getToken():null),t}const at=document.getElementById("app"),h={schema:null,session:null,collection:null,items:[],file:null,sha:null,fields:{},body:"",yamlDoc:null,yamlList:null,yamlUiMode:"structured",bodyMode:"visual",lastEditorMode:"visual",baseline:null,dirty:!1,saving:!1,status:"",error:"",errorCode:"",errorDetail:"",listLoading:!1,fileLoading:!1,previewHtml:"",bodyEditor:null,insertMenuOpen:!1,aiProofHint:"",aiProofBusy:!1,aiProofSelection:null,navOpenGroups:new Set,navMenuOpen:!1,themeMenuOpen:!1,pipeline:{state:"idle",sha:"",runUrl:"",message:"",pollGen:0},reexporting:!1,listQueryByCollection:Object.create(null),listSortByCollection:Object.create(null),listPageSizeByCollection:Object.create(null),listPageByCollection:Object.create(null),navCountByCollection:Object.create(null),treeCacheByCollection:Object.create(null),treePrefetchGen:0,frontMatterOpen:null,mediaOpen:!1,mediaPath:"content/media",mediaItems:[],mediaLoading:!1,mediaBusy:!1},Jv={figure:"image",cutIn:"transition_push",youtube:"smart_display",youtubeShort:"mobile_screen_share",video:"videocam",plotly:"analytics",xcite:"format_quote",cite:"bookmark",articleNote:"sticky_note_2",poem:"history_edu"},Ca={Writing:"edit_note",References:"menu_book",Portfolio:"work",Media:"photo_library",Pages:"description","CV Summary":"badge",Presentation:"campaign",Profile:"person"},Gv=[{label:"Default",value:""},{label:"Primary",value:"var(--primary)"},{label:"Secondary",value:"var(--secondary)"},{label:"Tertiary",value:"var(--tertiary)"},{label:"Muted",value:"var(--on-surface-variant)"},{label:"Error",value:"var(--error)"}],Xv={Writing:"Articles and Portuguese rascunhos",References:"Source cards and bibliography entries",Portfolio:"Products, projects, and CV jobs",Media:"Upload and browse content/media — cite /media/… in includes",Pages:"Listing page headers and furniture copy","CV Summary":"Public and PDF CV summary variants",Presentation:"Home catch phrase and CV side notes",Profile:"Contacts, education, languages, and skills"};function Ti(t){return String(t||"").split("/").filter(Boolean).join(" | ")}function lg(t){return Xv[t]||`Browse ${t} collections`}function xc(t){return"nav-group-"+String(t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function ag(t){var i;const e=!h.navOpenGroups.has(t);e?h.navOpenGroups.add(t):h.navOpenGroups.delete(t);const n=document.getElementById(xc(t));if(!n)return;n.hidden=!e;const r=(i=n.closest(".studio-nav-group"))==null?void 0:i.querySelector(".studio-nav-group-toggle");if(r){r.setAttribute("aria-expanded",e?"true":"false");const o=r.querySelector(".material-symbols-outlined");o&&(o.textContent=e?"expand_more":"chevron_right")}}function cg(t){const e=ug(t.description);if(e)return e;const n=Ti(t.path)||t.name;return t.type==="file"?`Open ${t.label} | ${n}`:`List entries in ${t.label} | ${n}`}function ug(t){let e=String(t||"").trim();if(!e)return"";const n=[/\s*The filename uses Key as YYYY-MM-DD-key[^.]*\./gi,/\s*Also the filename stem:[^.]*\./gi,/\s*Also the filename:[^.]*\./gi,/\s*Must match the YYYY-MM-DD in the filename[^.]*\./gi,/\s*;?\s*must match the YYYY-MM-DD in the filename\./gi,/\s*The Updated date is read from Git, never set here\./gi,/\s*ASCII kebab-case\./gi,/\s*\(44 characters total for the key segment is a good ceiling\)\.?/gi,/Metadata-first forms[^.]*\./gi,/TipTap with Liquid blocks[^.]*\./gi,/preview via content-runtime contract\.?/gi,/Paste Liquid \{%\s*include\s*%\} markers[^.]*\./gi,/Do not use rich-text:[^.]*\./gi,/its Editor mode rewrites URLs inside includes\.?/gi,/Markdown source \(code editor\)\.?/gi];for(const r of n)e=e.replace(r,"");return e=e.replace(/\s{2,}/g," ").replace(/\s+\./g,".").trim(),/filename|YYYY-MM-DD-key|content-runtime|autolink|TipTap/i.test(e)?"":e}function Qd(t){return ug(t==null?void 0:t.description)}function Ct(t){var i,o;const e=String((t==null?void 0:t.message)||t||"Request failed"),n=[];t!=null&&t.status&&n.push(`HTTP ${t.status}`);const r=(i=t==null?void 0:t.data)==null?void 0:i.detail;if(r)n.push(String(r));else if(t!=null&&t.data&&typeof t.data=="object")try{n.push(JSON.stringify(t.data,null,2))}catch{}else t!=null&&t.stack&&!String(t.stack).includes(e)&&n.push(String(t.stack).split(`
271
271
  `).slice(0,6).join(`
272
272
  `));h.error=e,h.errorCode=String((t==null?void 0:t.code)||((o=t==null?void 0:t.data)==null?void 0:o.error)||""),h.errorDetail=n.join(`
273
- `).trim(),h.status=""}function ct(){h.error="",h.errorCode="",h.errorDetail=""}function Ll(){var t;return h.mediaOpen?"Media":(t=h.collection)!=null&&t.label?h.collection.label:"Home"}function Sc(){h.navMenuOpen=!1}function wc(){var t,e;vt(),h.collection=null,h.file=null,h.baseline=null,h.items=[],h.yamlDoc=null,h.yamlList=null,h.listLoading=!1,h.fileLoading=!1,h.dirty=!1,h.insertMenuOpen=!1,h.mediaOpen=!1,h.mediaItems=[],h.mediaLoading=!1,h.mediaBusy=!1,Sc(),ct(),h.status=((t=h.session)==null?void 0:t.email)||((e=h.session)==null?void 0:e.userId)||"",Y(),mg()}function dg(){return{api:ze,state:h,el:k,materialIcon:_e,resolveMediaUrl:gg,render:()=>Y(),captureError:Ct,clearError:ct,goHome:wc,onCommitted:t=>Ts(t)}}async function fg(t){vt(),h.collection=null,h.file=null,h.baseline=null,h.items=[],h.insertMenuOpen=!1,h.dirty=!1,h.mediaOpen=!0,h.navOpenGroups.add("Media"),Sc();const e=Iv(h.schema);await gr(e,dg())}function _e(t,e=""){return k("span",{className:"material-symbols-outlined"+(e?` ${e}`:""),text:t,"aria-hidden":"true"})}function Ms({size:t=40,label:e=""}={}){return k("span",{className:"studio-mark",...e?{role:"img","aria-label":e}:{"aria-hidden":"true"},html:`<svg class="studio-mark-svg" viewBox="0 0 32 32" width="${t}" height="${t}" focusable="false"><polygon class="studio-mark-primary" points="16,1 24,5 13,14 2,17 2,9"/><polygon class="studio-mark-secondary" points="24,5 30,9 30,23 22,28 19,18 13,14"/><polygon class="studio-mark-tertiary" points="2,17 13,14 19,18 22,28 16,31 2,23"/><polygon class="studio-mark-frame" points="16,1 30,9 30,23 16,31 2,23 2,9"/></svg>`})}function ef(t){const e=t.title||t.name||"Entry",n=Ti(t.path);return n?`Open ${e} | ${n}`:`Open ${e}`}function Zv(){var e;const t=(e=h.collection)==null?void 0:e.name;return t&&h.listQueryByCollection[t]||""}function Qv(){var n;const t=(n=h.collection)==null?void 0:n.name;if(!t)return es;if(h.listSortByCollection[t])return h.listSortByCollection[t];const e=bv(t,es);return h.listSortByCollection[t]=e,e}function eM(t){var n;const e=(n=h.collection)==null?void 0:n.name;e&&(h.listSortByCollection[e]=t,kv(e,t),Cc())}function tM(){var n;const t=(n=h.collection)==null?void 0:n.name;if(!t)return ns;if(h.listPageSizeByCollection[t])return h.listPageSizeByCollection[t];const e=xv(t,ns);return h.listPageSizeByCollection[t]=e,e}function nM(t){var n;const e=(n=h.collection)==null?void 0:n.name;e&&(h.listPageSizeByCollection[e]=t,Sv(e,t),Cc())}function tf(){var e;const t=(e=h.collection)==null?void 0:e.name;return t?Math.max(1,Number(h.listPageByCollection[t])||1):1}function Il(t){var n;const e=(n=h.collection)==null?void 0:n.name;e&&(h.listPageByCollection[e]=Math.max(1,Number(t)||1))}function Cc(){var e;const t=(e=h.collection)==null?void 0:e.name;t&&(h.listPageByCollection[t]=1)}function pg(t,e){t!=null&&t.name&&(h.navCountByCollection[t.name]=Math.max(0,Number(e)||0))}function hg(t,e){if(!(t!=null&&t.name))return;const n=Array.isArray(e)?e:[];h.treeCacheByCollection[t.name]={items:n},pg(t,n.length)}function rM(t){if(!(t!=null&&t.name))return null;const e=h.treeCacheByCollection[t.name];return e?e.items:null}function vc(t){if(!t){h.treeCacheByCollection=Object.create(null);return}delete h.treeCacheByCollection[t]}function iM(t=h.schema){return((t==null?void 0:t.collections)||[]).filter(e=>e&&e.type!=="file"&&e.path)}function oM(t){return[...t].sort((e,n)=>{const r=e.group==="Writing"?0:1,i=n.group==="Writing"?0:1;return r!==i?r-i:String(e.label||e.name).localeCompare(String(n.label||n.name))})}function mg(){const t=++h.treePrefetchGen,e=()=>{sM(t)};typeof requestIdleCallback=="function"?requestIdleCallback(e,{timeout:2500}):setTimeout(e,400)}async function sM(t){const e=oM(iM()).filter(n=>!h.treeCacheByCollection[n.name]);for(const n of e){if(t!==h.treePrefetchGen)return;try{const r=await ze.tree(n.path);if(t!==h.treePrefetchGen)return;h.treeCacheByCollection[n.name]||(hg(n,r.items||[]),h.file||Y())}catch{}await new Promise(r=>setTimeout(r,60))}}function gg(t){const e=String(t||"").trim();return e?/^https?:\/\//i.test(e)?e:e.startsWith("/media/")?`${Xd.replace(/\/$/,"")}${e}`:e.startsWith("media/")?`${Xd.replace(/\/$/,"")}/${e}`:(e.startsWith("/"),e):""}function nf(){return k("span",{className:"ledger-thumb placeholder",title:"No thumbnail","aria-label":"No thumbnail"},[k("span",{className:"material-symbols-outlined",text:"web_asset_off","aria-hidden":"true"})])}function rf(t){const e=gg(t.thumbnail);if(!e)return nf();const n=k("img",{className:"ledger-thumb",src:e,alt:"",loading:"lazy",referrerpolicy:"no-referrer"});return n.addEventListener("error",()=>{n.replaceWith(nf())}),n}function ve(t,e=document){return e.querySelector(t)}function k(t,e={},n=[]){const r=document.createElement(t);for(const[i,o]of Object.entries(e))i==="className"?r.className=o:i==="text"?r.textContent=o:i==="html"?r.innerHTML=o:i==="htmlFor"?r.htmlFor=o:i.startsWith("on")&&typeof o=="function"?r.addEventListener(i.slice(2).toLowerCase(),o):i==="checked"||i==="selected"||i==="disabled"||i==="multiple"||i==="open"?r[i]=!!o:o===!1||o==null||(o===!0?r.setAttribute(i,""):r.setAttribute(i,o));for(const i of[].concat(n))i==null||i===!1||r.append(i.nodeType?i:document.createTextNode(String(i)));return r}const yg="studio-theme",rs={light:"light_mode",dark:"dark_mode",system:"routine"};function fi(){const t=localStorage.getItem(yg);return t==="light"||t==="dark"||t==="system"?t:"system"}function lM(){const t=fi();return t==="dark"?"dark":t==="light"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function aM(t){localStorage.setItem(yg,t),va(),pi()}function va(){document.documentElement.setAttribute("data-theme",lM())}function cM(){va();const t=window.matchMedia("(prefers-color-scheme: dark)");typeof t.addEventListener=="function"&&t.addEventListener("change",()=>{fi()==="system"&&va()})}function pi(){const t=fi(),e=document.querySelector("[data-studio-theme-icon]");e&&(e.textContent=rs[t]||rs.system);for(const i of document.querySelectorAll("[data-theme-choice]")){const s=i.getAttribute("data-theme-choice")===t;i.setAttribute("aria-checked",s?"true":"false"),i.classList.toggle("is-selected",s)}const n=document.querySelector("[data-studio-action='theme-menu']"),r=document.getElementById("studio-theme-menu");n&&r&&(n.setAttribute("aria-expanded",h.themeMenuOpen?"true":"false"),r.hidden=!h.themeMenuOpen)}function uM(){const t=[{id:"light",label:"Light",icon:"light_mode"},{id:"dark",label:"Dark",icon:"dark_mode"},{id:"system",label:"System",icon:"routine"}],e=k("div",{className:"studio-theme-menu-panel",id:"studio-theme-menu",role:"menu","aria-label":"Choose color theme",hidden:!h.themeMenuOpen},t.map(r=>k("button",{className:"studio-theme-choice",type:"button",role:"menuitemradio","data-theme-choice":r.id,"aria-checked":fi()===r.id?"true":"false",onClick:i=>{i.stopPropagation(),aM(r.id),h.themeMenuOpen=!1,pi();const o=ve("#preview-frame");o&&Mg(o)}},[_e(r.icon),k("span",{text:r.label})]))),n=k("button",{className:"btn btn-tool",type:"button",title:"Theme","aria-label":"Theme","data-studio-action":"theme-menu","aria-haspopup":"true","aria-expanded":h.themeMenuOpen?"true":"false","aria-controls":"studio-theme-menu",onClick:r=>{r.stopPropagation(),h.themeMenuOpen=!h.themeMenuOpen,pi()}},[k("span",{className:"material-symbols-outlined","data-studio-theme-icon":"true",text:rs[fi()]||rs.system,"aria-hidden":"true"}),k("span",{className:"btn-label",text:"Theme"})]);return k("div",{className:"studio-theme-menu"},[n,e])}function Mc(){const t=String(window.location.hostname||"");return t==="localhost"||t==="127.0.0.1"||t==="[::1]"}function dM(t){return new Promise(e=>setTimeout(e,t))}function fM(t){switch(t){case"syncing":case"running":return{label:"Exporting…",icon:"progress_activity",className:"pipeline-chip pipeline-running",spinning:!0,title:"Content export is running"};case"awaiting_run":return{label:"Waiting…",icon:"schedule",className:"pipeline-chip pipeline-awaiting",spinning:!1,title:"Waiting for the content pipeline run"};case"ok":return{label:"Live",icon:"check_circle",className:"pipeline-chip pipeline-ok",spinning:!1,title:"Content pipeline succeeded for this commit"};case"error":return{label:"Failed",icon:"error",className:"pipeline-chip pipeline-error",spinning:!1,title:h.pipeline.message||"Content pipeline failed"};case"stalled":return{label:"No run",icon:"hourglass_disabled",className:"pipeline-chip pipeline-stalled",spinning:!1,title:"No pipeline run appeared for this commit yet"};case"unconfigured":return{label:"Pipeline",icon:"cloud_off",className:"pipeline-chip pipeline-idle",spinning:!1,title:h.pipeline.message||"Set pandorga.content.workflow in _config.yml (e.g. content-pipeline.yml)"};default:return{label:"Pipeline",icon:"cloud",className:"pipeline-chip pipeline-idle",spinning:!1,title:"Content pipeline status"}}}function pM(){const t=fM(h.pipeline.state),e=h.pipeline.runUrl,n=[k("span",{className:"material-symbols-outlined"+(t.spinning?" studio-icon-spin":""),text:t.icon,"aria-hidden":"true"}),k("span",{className:"btn-label",text:t.label})];return k("button",{className:`btn btn-tool ${t.className}`,type:"button",title:t.title,"aria-label":t.label,role:"status","data-studio-action":"pipeline-status",disabled:!e,onClick:()=>{if(e)try{window.open(e,"_blank","noopener,noreferrer")}catch{}}},n)}function bg(t){var e;if(h.pipeline.runUrl=((e=t.run)==null?void 0:e.html_url)||h.pipeline.runUrl||"",t.sha&&(h.pipeline.sha=String(t.sha).toLowerCase()),h.pipeline.message="",t.state==="unconfigured"){h.pipeline.state="unconfigured",h.pipeline.message="Set pandorga.content.workflow in _config.yml (e.g. content-pipeline.yml)";return}h.pipeline.state=t.state||"idle",t.state==="error"&&(h.pipeline.message="Content pipeline failed for this commit.")}async function hM(t=null){if(!Mc())try{const e=await ze.pipelineStatus(t||null);bg(e),Y()}catch(e){const n=(e==null?void 0:e.code)||"";(n==="actions_forbidden"||n==="github_unconfigured")&&(h.pipeline.state="error",h.pipeline.message=String(e.message||e),Y())}}function Ts(t){const e=String(t||"").trim().toLowerCase();if(!e||Mc())return;const n=++h.pipeline.pollGen;h.pipeline.state="awaiting_run",h.pipeline.sha=e,h.pipeline.runUrl="",h.pipeline.message="",Y(),mM(n,e)}async function mM(t,e){const n=Date.now(),r=600*1e3,i=1800*1e3;let o=0;for(;t===h.pipeline.pollGen;){const s=Date.now()-n;if(s>i){(h.pipeline.state==="running"||h.pipeline.state==="awaiting_run")&&(h.pipeline.state="stalled",h.pipeline.message="Timed out waiting for the content pipeline.",Y());return}try{const l=await ze.pipelineStatus(e);if(t!==h.pipeline.pollGen)return;if(o=0,bg(l),l.state==="unconfigured"||l.state==="ok"||l.state==="error"){Y();return}if(l.state==="awaiting_run"&&s>r){h.pipeline.state="stalled",Y();return}Y()}catch(l){if(t!==h.pipeline.pollGen)return;o+=1;const a=(l==null?void 0:l.code)||"";if(a==="actions_forbidden"||a==="github_unconfigured"){h.pipeline.state="error",h.pipeline.message=String(l.message||l),Y();return}if(o>=5){h.pipeline.state="error",h.pipeline.message=String(l.message||l),Y();return}}await dM(s<6e4?2500:7e3)}}function kg(t=h.collection){var e;return!t||t.type!=="collection"?!1:((e=t.operations)==null?void 0:e.create)!==!1}function xg(t=h.collection){var e;return t?((e=t.operations)==null?void 0:e.delete)===!0:!1}function gM(t){return String(t||"").trim().toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function yM(t,e){const n=new Date,r=String(n.getFullYear()),i=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getDate()).padStart(2,"0");return String(t||"{key}.md").replaceAll("{year}",r).replaceAll("{month}",i).replaceAll("{day}",o).replaceAll("{key}",e)}function bM(){const t=new Date;return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function Rl({className:t,title:e,ariaLabel:n,action:r=null,disabled:i=!1,onClick:o,icon:s,label:l=null,spinning:a=!1}){const c=[k("span",{className:"material-symbols-outlined"+(a?" studio-icon-spin":""),text:s,"aria-hidden":"true"})];return l&&c.push(k("span",{className:"btn-label",text:l})),k("button",{className:t,type:"button",title:e,"aria-label":n,"data-studio-action":r,disabled:i,onClick:o},c)}function kM({brand:t=null,menuToggle:e=null}={}){const n=h.saving?"Saving…":h.dirty?"Save":"Saved",r=h.saving?"progress_activity":h.dirty?"save":"check",i=h.error?"Error":h.status||"",o=k("div",{className:"studio-toolbar-brand"},[t,i?k("span",{className:"status-pill studio-toolbar-status"+(h.error?" error":""),text:i,title:h.error||h.errorDetail||h.status||""}):null]),s=[uM()];if(Mc()){const a=h.reexporting||h.pipeline.state==="syncing";s.push(Rl({className:"btn btn-tool btn-reexport"+(a?" pipeline-running":"")+(h.pipeline.state==="ok"&&!a?" pipeline-ok":"")+(h.pipeline.state==="error"&&!a?" pipeline-error":""),title:a?"Exporting content JSON locally":"Export content JSON locally and reload",ariaLabel:a?"Exporting locally":"Export locally",action:"reexport",disabled:a,onClick:()=>dT(),icon:a?"progress_activity":"sync",label:a?"Exporting…":"Export",spinning:a}))}else s.push(pM());s.push(Rl({className:"btn btn-tool",title:"Revert all edits to the last loaded or saved version",ariaLabel:"Discard edits",action:"discard",disabled:!h.file||!h.dirty||!h.baseline,onClick:()=>uT(),icon:"undo",label:"Revert"}),Rl({className:"btn btn-tool btn-primary",title:h.saving?"Saving this draft":h.dirty?"Commit this draft":"No edits to commit yet",ariaLabel:n,action:"save",disabled:h.saving||!h.file||!h.dirty,onClick:()=>hT(),icon:r,label:n,spinning:h.saving}));const l=[o,k("span",{className:"spacer","aria-hidden":"true"}),...s];return e&&l.push(e),k("header",{className:"studio-toolbar studio-icon-bar"},l)}function Sg(t){var r,i;if(!t||t.dev||!t.user)return"";const e=(r=t.user.primaryEmailAddress)==null?void 0:r.emailAddress;return e||((i=(t.user.emailAddresses||[])[0])==null?void 0:i.emailAddress)||""}function hi(t){if(t&&!t.dev&&t.user){xM(t,h.error||"Studio API session failed while you are signed in.");return}at.innerHTML="";const e=k("div",{className:"auth-gate"},[k("div",{className:"studio-brand"},[Ms({size:32,label:"Studio"}),k("strong",{text:"Studio"})]),k("h1",{text:"Sign in to edit"}),k("p",{text:"Studio is for site admins only. Anyone may register; access is granted after review."}),k("div",{id:"clerk-sign-in"})]);at.append(e),t&&!t.dev?t.mountSignIn(ve("#clerk-sign-in"),{...sg}):ve("#clerk-sign-in").append(k("p",{className:"status-pill",text:"No VITE_CLERK_PUBLISHABLE_KEY — using API bypass if enabled."}),k("button",{className:"btn btn-primary",text:"Continue",onClick:()=>oo(t)}))}function xM(t,e){at.innerHTML="";const n=k("div",{className:"auth-gate"},[k("div",{className:"studio-brand"},[Ms({size:32,label:"Studio"}),k("strong",{text:"Studio"})]),k("h1",{text:"Studio API unavailable"}),k("p",{className:"status-pill error",text:e}),k("p",{text:"You are signed in with Clerk, but /api/studio/session did not succeed. Local jekyll serve has no Pages Functions — use a Pages preview, wrangler pages dev, or STUDIO_DEV_BYPASS against a running Function."}),k("button",{className:"btn",type:"button",text:"Sign out",onClick:async()=>{if(t&&!t.dev&&t.signOut){await t.signOut({redirectUrl:Zt});return}hi(t)}})]);at.append(n)}function SM(t,e){const n=e||Sg(t)||"the address you used to register";at.innerHTML="";const r=k("p",{className:"pending-copy"});r.append(document.createTextNode("Thank you for your registration. Your profile is being transferred to the site administration to be reviewed as a potential contributor. You will be contacted via "));const i=document.createElement("strong");i.textContent=n,r.append(i),r.append(document.createTextNode("."));const o=k("div",{className:"auth-gate auth-gate--pending"},[k("div",{className:"studio-brand"},[Ms({size:32,label:"Studio"}),k("strong",{text:"Studio"})]),k("h1",{text:"Registration received"}),r,k("p",{className:"pending-signoff",text:"Have a nice one! ✍️"}),k("button",{className:"btn",type:"button",text:"Sign out",onClick:async()=>{if(t&&!t.dev&&t.signOut){await t.signOut({redirectUrl:Zt});return}hi(t)}})]);at.append(o)}const wM=["Writing","Portfolio","References","Pages","CV Summary","Presentation","Profile"];function wg(t){const e=new Map;for(const r of t.collections)e.has(r.group)||e.set(r.group,[]),e.get(r.group).push(r);const n=new Map;for(const r of wM)e.has(r)&&n.set(r,e.get(r));for(const[r,i]of e)n.has(r)||n.set(r,i);return n}function CM(){const t="Media",e=h.navOpenGroups.has(t),n=k("div",{className:"studio-nav-group-items",id:xc(t),role:"region","aria-label":t});e||(n.hidden=!0),n.append(k("button",{className:"nav-item",type:"button",text:"Library",title:"Browse and upload under content/media","aria-current":h.mediaOpen?"page":null,onClick:()=>fg()}));const r=k("button",{className:"studio-nav-group-toggle",type:"button",title:lg(t),"aria-expanded":e?"true":"false","aria-controls":n.id,onClick:()=>{ag(t)}},[k("span",{className:"material-symbols-outlined",text:e?"expand_more":"chevron_right","aria-hidden":"true"}),k("span",{className:"nav-group-label",text:t})]);return k("div",{className:"studio-nav-group"},[r,n])}function vM(){if(!h.error||!h.file&&!h.mediaOpen)return null;const t=[];if(h.errorCode==="conflict"&&h.file){const e=h.file;t.push(k("button",{className:"btn",type:"button",text:"Reload from GitHub",title:"Replace this screen with the file currently on GitHub",onClick:()=>Os(e)}))}return t.push(k("button",{className:"btn",type:"button",text:"Dismiss",onClick:()=>{ct(),Y()}})),k("div",{className:"studio-error-banner",role:"alert"},[k("p",{className:"studio-error-message",text:h.error}),k("div",{className:"studio-error-actions"},t)])}function Y(){var a;at.innerHTML="";const t=wg(h.schema),e=!!h.navMenuOpen,n=k("button",{className:"studio-brand studio-brand-home studio-brand-toolbar",type:"button",title:"Studio home","aria-current":!h.collection&&!h.mediaOpen?"page":null,onClick:()=>wc()},[Ms({size:22}),k("span",{className:"studio-brand-copy"},[k("span",{className:"studio-brand-name",text:"Studio"})])]),r=k("button",{className:"studio-nav-menu-toggle",type:"button",title:e?"Close collections menu":"Open collections menu","aria-label":e?`Close menu (${Ll()})`:`Open menu (${Ll()})`,"aria-expanded":e?"true":"false","aria-controls":"studio-nav-panel",onClick:()=>{h.navMenuOpen=!h.navMenuOpen,Y()}},[k("span",{className:"studio-nav-menu-label sr-only",text:Ll()}),k("span",{className:"material-symbols-outlined",text:e?"close":"menu","aria-hidden":"true"})]),i=k("div",{className:"studio-nav-panel",id:"studio-nav-panel"});i.append(CM());for(const[c,u]of t){const d=h.navOpenGroups.has(c),p=k("div",{className:"studio-nav-group-items",id:xc(c),role:"region","aria-label":c});d||(p.hidden=!0);for(const g of u){const b=h.navCountByCollection[g.name],x=[k("span",{className:"nav-item-label",text:g.label})];b!=null&&x.push(k("span",{className:"nav-item-count",text:String(b)})),p.append(k("button",{className:"nav-item",type:"button",title:cg(g),"aria-current":((a=h.collection)==null?void 0:a.name)===g.name?"page":null,onClick:()=>Ns(g)},x))}const m=k("button",{className:"studio-nav-group-toggle",type:"button",title:lg(c),"aria-expanded":d?"true":"false","aria-controls":p.id,onClick:()=>{ag(c)}},[k("span",{className:"material-symbols-outlined",text:d?"expand_more":"chevron_right","aria-hidden":"true"}),k("span",{className:"nav-group-label",text:c})]);i.append(k("div",{className:"studio-nav-group"},[m,p]))}const o=k("nav",{className:"studio-nav"+(e?" is-open":""),"aria-label":"Collections"},[i]),s=kM({brand:n,menuToggle:r}),l=k("div",{className:"studio-main"},[vM(),MM(),k("div",{className:"studio-body"+(h.file?"":" list-only"),id:"studio-body"})]);at.append(k("div",{className:"studio-shell"},[s,o,l])),Sn(),pi(),window.__studioMenuDismissBound||(window.__studioMenuDismissBound=!0,document.addEventListener("click",()=>{h.themeMenuOpen&&(h.themeMenuOpen=!1,pi())}))}function MM(){var e,n;const t=[k("span",{className:"studio-crumb",text:"Studio"})];if(h.mediaOpen&&!h.collection)t.push(k("span",{className:"studio-crumb-sep","aria-hidden":"true",text:"/"}),k("span",{className:"studio-crumb is-current",text:"Media"}));else if(h.collection){const r=h.collection.group||"Content",i=h.collection.label||h.collection.name;if(t.push(k("span",{className:"studio-crumb-sep","aria-hidden":"true",text:"/"}),k("span",{className:"studio-crumb",text:r}),k("span",{className:"studio-crumb-sep","aria-hidden":"true",text:"/"}),k("span",{className:"studio-crumb"+(h.file?"":" is-current"),text:i})),h.file){const o=((e=h.fields)==null?void 0:e.title)||((n=h.fields)==null?void 0:n.key)||String(h.file).split("/").pop()||"Entry";t.push(k("span",{className:"studio-crumb-sep","aria-hidden":"true",text:"/"}),k("span",{className:"studio-crumb is-current",text:o}))}}else t.push(k("span",{className:"studio-crumb-sep","aria-hidden":"true",text:"/"}),k("span",{className:"studio-crumb is-current",text:"Map"}));return k("nav",{className:"studio-breadcrumb","aria-label":"Location"},t)}function je(){h.dirty=!0,Ta(),YM()}function Tc(){var t;return!h.file||fr()||h.aiProofBusy?!1:!!String(((t=h.fields)==null?void 0:t.language)||"").trim()}function Ma(){const t=h.aiProofBusy,e=Tc()&&!t;for(const n of["correct","refine"]){const r=document.querySelector(`[data-studio-action='${n}']`);if(!r)continue;r.disabled=!e;const i=r.querySelector(".editor-ai-proof-label");i&&(t?i.textContent="Working…":i.textContent=n==="refine"?"Refine":"Correct")}}function Qr(){h.insertMenuOpen=!1;const t=ve("#insert-menu");t&&(t.hidden=!0);for(const e of document.querySelectorAll(".editor-insert-btn[aria-haspopup='menu']"))e.setAttribute("aria-expanded","false")}function io(t){h.aiProofHint=t;const e=ve("#ai-proof-hint");e&&(e.textContent=t,e.hidden=!t),clearTimeout(h._aiProofHintTimer),t&&(h._aiProofHintTimer=setTimeout(()=>{h.aiProofHint="";const n=ve("#ai-proof-hint");n&&(n.textContent="",n.hidden=!0)},3200))}function Cg(){var t;if(h.bodyMode==="source"){const e=ve("#body-source");if(!e)return null;const n=e.selectionStart,r=e.selectionEnd;if(!Number.isInteger(n)||!Number.isInteger(r)||n===r)return null;cn();const i=h.body||"";return{kind:"source",start:n,end:r,text:i.slice(n,r)}}if(h.bodyMode==="visual"&&((t=h.bodyEditor)!=null&&t.editor)){const e=h.bodyEditor.editor,{from:n,to:r,empty:i}=e.state.selection;if(i||n===r)return null;const o=e.state.doc.textBetween(n,r,`
273
+ `).trim(),h.status=""}function ct(){h.error="",h.errorCode="",h.errorDetail=""}function Ll(){var t;return h.mediaOpen?"Media":(t=h.collection)!=null&&t.label?h.collection.label:"Home"}function Sc(){h.navMenuOpen=!1}function wc(){var t,e;vt(),h.collection=null,h.file=null,h.baseline=null,h.items=[],h.yamlDoc=null,h.yamlList=null,h.listLoading=!1,h.fileLoading=!1,h.dirty=!1,h.insertMenuOpen=!1,h.mediaOpen=!1,h.mediaItems=[],h.mediaLoading=!1,h.mediaBusy=!1,Sc(),ct(),h.status=((t=h.session)==null?void 0:t.email)||((e=h.session)==null?void 0:e.userId)||"",Y(),mg()}function dg(){return{api:ze,state:h,el:k,materialIcon:_e,resolveMediaUrl:gg,render:()=>Y(),captureError:Ct,clearError:ct,goHome:wc,onCommitted:t=>Ts(t)}}async function fg(t){vt(),h.collection=null,h.file=null,h.baseline=null,h.items=[],h.insertMenuOpen=!1,h.dirty=!1,h.mediaOpen=!0,h.navOpenGroups.add("Media"),Sc();const e=Iv(h.schema);await gr(e,dg())}function _e(t,e=""){return k("span",{className:"material-symbols-outlined"+(e?` ${e}`:""),text:t,"aria-hidden":"true"})}function Ms({size:t=40,label:e=""}={}){return k("span",{className:"studio-mark",...e?{role:"img","aria-label":e}:{"aria-hidden":"true"},html:`<svg class="studio-mark-svg" viewBox="0 0 32 32" width="${t}" height="${t}" focusable="false"><polygon class="studio-mark-primary" points="16,1 24,5 13,14 2,17 2,9"/><polygon class="studio-mark-secondary" points="24,5 30,9 30,23 22,28 19,18 13,14"/><polygon class="studio-mark-tertiary" points="2,17 13,14 19,18 22,28 16,31 2,23"/><polygon class="studio-mark-frame" points="16,1 30,9 30,23 16,31 2,23 2,9"/></svg>`})}function ef(t){const e=t.title||t.name||"Entry",n=Ti(t.path);return n?`Open ${e} | ${n}`:`Open ${e}`}function Zv(){var e;const t=(e=h.collection)==null?void 0:e.name;return t&&h.listQueryByCollection[t]||""}function Qv(){var n;const t=(n=h.collection)==null?void 0:n.name;if(!t)return es;if(h.listSortByCollection[t])return h.listSortByCollection[t];const e=bv(t,es);return h.listSortByCollection[t]=e,e}function eM(t){var n;const e=(n=h.collection)==null?void 0:n.name;e&&(h.listSortByCollection[e]=t,kv(e,t),Cc())}function tM(){var n;const t=(n=h.collection)==null?void 0:n.name;if(!t)return ns;if(h.listPageSizeByCollection[t])return h.listPageSizeByCollection[t];const e=xv(t,ns);return h.listPageSizeByCollection[t]=e,e}function nM(t){var n;const e=(n=h.collection)==null?void 0:n.name;e&&(h.listPageSizeByCollection[e]=t,Sv(e,t),Cc())}function tf(){var e;const t=(e=h.collection)==null?void 0:e.name;return t?Math.max(1,Number(h.listPageByCollection[t])||1):1}function Il(t){var n;const e=(n=h.collection)==null?void 0:n.name;e&&(h.listPageByCollection[e]=Math.max(1,Number(t)||1))}function Cc(){var e;const t=(e=h.collection)==null?void 0:e.name;t&&(h.listPageByCollection[t]=1)}function pg(t,e){t!=null&&t.name&&(h.navCountByCollection[t.name]=Math.max(0,Number(e)||0))}function hg(t,e){if(!(t!=null&&t.name))return;const n=Array.isArray(e)?e:[];h.treeCacheByCollection[t.name]={items:n},pg(t,n.length)}function rM(t){if(!(t!=null&&t.name))return null;const e=h.treeCacheByCollection[t.name];return e?e.items:null}function vc(t){if(!t){h.treeCacheByCollection=Object.create(null);return}delete h.treeCacheByCollection[t]}function iM(t=h.schema){return((t==null?void 0:t.collections)||[]).filter(e=>e&&e.type!=="file"&&e.path)}function oM(t){return[...t].sort((e,n)=>{const r=e.group==="Writing"?0:1,i=n.group==="Writing"?0:1;return r!==i?r-i:String(e.label||e.name).localeCompare(String(n.label||n.name))})}function mg(){const t=++h.treePrefetchGen,e=()=>{sM(t)};typeof requestIdleCallback=="function"?requestIdleCallback(e,{timeout:2500}):setTimeout(e,400)}async function sM(t){const e=oM(iM()).filter(n=>!h.treeCacheByCollection[n.name]);for(const n of e){if(t!==h.treePrefetchGen)return;try{const r=await ze.tree(n.path);if(t!==h.treePrefetchGen)return;h.treeCacheByCollection[n.name]||(hg(n,r.items||[]),h.file||Y())}catch{}await new Promise(r=>setTimeout(r,60))}}function gg(t){const e=String(t||"").trim();return e?/^https?:\/\//i.test(e)?e:e.startsWith("/media/")?`${Xd.replace(/\/$/,"")}${e}`:e.startsWith("media/")?`${Xd.replace(/\/$/,"")}/${e}`:(e.startsWith("/"),e):""}function nf(){return k("span",{className:"ledger-thumb placeholder",title:"No thumbnail","aria-label":"No thumbnail"},[k("span",{className:"material-symbols-outlined",text:"web_asset_off","aria-hidden":"true"})])}function rf(t){const e=gg(t.thumbnail);if(!e)return nf();const n=k("img",{className:"ledger-thumb",src:e,alt:"",loading:"lazy",referrerpolicy:"no-referrer"});return n.addEventListener("error",()=>{n.replaceWith(nf())}),n}function ve(t,e=document){return e.querySelector(t)}function k(t,e={},n=[]){const r=document.createElement(t);for(const[i,o]of Object.entries(e))i==="className"?r.className=o:i==="text"?r.textContent=o:i==="html"?r.innerHTML=o:i==="htmlFor"?r.htmlFor=o:i.startsWith("on")&&typeof o=="function"?r.addEventListener(i.slice(2).toLowerCase(),o):i==="checked"||i==="selected"||i==="disabled"||i==="multiple"||i==="open"?r[i]=!!o:o===!1||o==null||(o===!0?r.setAttribute(i,""):r.setAttribute(i,o));for(const i of[].concat(n))i==null||i===!1||r.append(i.nodeType?i:document.createTextNode(String(i)));return r}const yg="studio-theme",rs={light:"light_mode",dark:"dark_mode",system:"routine"};function fi(){const t=localStorage.getItem(yg);return t==="light"||t==="dark"||t==="system"?t:"system"}function lM(){const t=fi();return t==="dark"?"dark":t==="light"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function aM(t){localStorage.setItem(yg,t),va(),pi()}function va(){document.documentElement.setAttribute("data-theme",lM())}function cM(){va();const t=window.matchMedia("(prefers-color-scheme: dark)");typeof t.addEventListener=="function"&&t.addEventListener("change",()=>{fi()==="system"&&va()})}function pi(){const t=fi(),e=document.querySelector("[data-studio-theme-icon]");e&&(e.textContent=rs[t]||rs.system);for(const i of document.querySelectorAll("[data-theme-choice]")){const s=i.getAttribute("data-theme-choice")===t;i.setAttribute("aria-checked",s?"true":"false"),i.classList.toggle("is-selected",s)}const n=document.querySelector("[data-studio-action='theme-menu']"),r=document.getElementById("studio-theme-menu");n&&r&&(n.setAttribute("aria-expanded",h.themeMenuOpen?"true":"false"),r.hidden=!h.themeMenuOpen)}function uM(){const t=[{id:"light",label:"Light",icon:"light_mode"},{id:"dark",label:"Dark",icon:"dark_mode"},{id:"system",label:"System",icon:"routine"}],e=k("div",{className:"studio-theme-menu-panel",id:"studio-theme-menu",role:"menu","aria-label":"Choose color theme",hidden:!h.themeMenuOpen},t.map(r=>k("button",{className:"studio-theme-choice",type:"button",role:"menuitemradio","data-theme-choice":r.id,"aria-checked":fi()===r.id?"true":"false",onClick:i=>{i.stopPropagation(),aM(r.id),h.themeMenuOpen=!1,pi();const o=ve("#preview-frame");o&&Mg(o)}},[_e(r.icon),k("span",{text:r.label})]))),n=k("button",{className:"btn btn-tool",type:"button",title:"Theme","aria-label":"Theme","data-studio-action":"theme-menu","aria-haspopup":"true","aria-expanded":h.themeMenuOpen?"true":"false","aria-controls":"studio-theme-menu",onClick:r=>{r.stopPropagation(),h.themeMenuOpen=!h.themeMenuOpen,pi()}},[k("span",{className:"material-symbols-outlined","data-studio-theme-icon":"true",text:rs[fi()]||rs.system,"aria-hidden":"true"}),k("span",{className:"btn-label",text:"Theme"})]);return k("div",{className:"studio-theme-menu"},[n,e])}function Mc(){const t=String(window.location.hostname||"");return t==="localhost"||t==="127.0.0.1"||t==="[::1]"}function dM(t){return new Promise(e=>setTimeout(e,t))}function fM(t){switch(t){case"syncing":case"running":return{label:"Exporting…",icon:"progress_activity",className:"pipeline-chip pipeline-running",spinning:!0,title:"Content export is running"};case"awaiting_run":return{label:"Waiting…",icon:"schedule",className:"pipeline-chip pipeline-awaiting",spinning:!1,title:"Waiting for the content pipeline run"};case"ok":return{label:"Live",icon:"check_circle",className:"pipeline-chip pipeline-ok",spinning:!1,title:"Content pipeline succeeded for this commit"};case"error":return{label:"Failed",icon:"error",className:"pipeline-chip pipeline-error",spinning:!1,title:h.pipeline.message||"Content pipeline failed"};case"stalled":return{label:"No run",icon:"hourglass_disabled",className:"pipeline-chip pipeline-stalled",spinning:!1,title:"No pipeline run appeared for this commit yet"};case"unconfigured":return{label:"Pipeline",icon:"cloud_off",className:"pipeline-chip pipeline-idle",spinning:!1,title:h.pipeline.message||"Set pandorga.content.workflow in _config.yml (e.g. content-pipeline.yml)"};default:return{label:"Pipeline",icon:"cloud",className:"pipeline-chip pipeline-idle",spinning:!1,title:"Content pipeline status"}}}function pM(){const t=fM(h.pipeline.state),e=h.pipeline.runUrl,n=[k("span",{className:"material-symbols-outlined"+(t.spinning?" studio-icon-spin":""),text:t.icon,"aria-hidden":"true"}),k("span",{className:"btn-label",text:t.label})];return k("button",{className:`btn btn-tool ${t.className}`,type:"button",title:t.title,"aria-label":t.label,role:"status","data-studio-action":"pipeline-status",disabled:!e,onClick:()=>{if(e)try{window.open(e,"_blank","noopener,noreferrer")}catch{}}},n)}function bg(t){var e;if(h.pipeline.runUrl=((e=t.run)==null?void 0:e.html_url)||h.pipeline.runUrl||"",t.sha&&(h.pipeline.sha=String(t.sha).toLowerCase()),h.pipeline.message="",t.state==="unconfigured"){h.pipeline.state="unconfigured",h.pipeline.message=t.message||"Set pandorga.content.workflow in _config.yml (e.g. content-pipeline.yml)";return}h.pipeline.state=t.state||"idle",t.state==="error"&&(h.pipeline.message=t.message||"Content pipeline failed for this commit.")}async function hM(t=null){if(!Mc())try{const e=await ze.pipelineStatus(t||null);bg(e),Y()}catch(e){h.pipeline.state="error",h.pipeline.message=String(e.message||e),Y()}}function Ts(t){const e=String(t||"").trim().toLowerCase();if(!e||Mc())return;const n=++h.pipeline.pollGen;h.pipeline.state="awaiting_run",h.pipeline.sha=e,h.pipeline.runUrl="",h.pipeline.message="",Y(),mM(n,e)}async function mM(t,e){const n=Date.now(),r=600*1e3,i=1800*1e3;let o=0;for(;t===h.pipeline.pollGen;){const s=Date.now()-n;if(s>i){(h.pipeline.state==="running"||h.pipeline.state==="awaiting_run")&&(h.pipeline.state="stalled",h.pipeline.message="Timed out waiting for the content pipeline.",Y());return}try{const l=await ze.pipelineStatus(e);if(t!==h.pipeline.pollGen)return;if(o=0,bg(l),l.state==="unconfigured"||l.state==="ok"||l.state==="error"){Y();return}if(l.state==="awaiting_run"&&s>r){h.pipeline.state="stalled",Y();return}Y()}catch(l){if(t!==h.pipeline.pollGen)return;o+=1;const a=(l==null?void 0:l.code)||"";if(a==="actions_forbidden"||a==="github_unconfigured"){h.pipeline.state="error",h.pipeline.message=String(l.message||l),Y();return}if(o>=5){h.pipeline.state="error",h.pipeline.message=String(l.message||l),Y();return}}await dM(s<6e4?2500:7e3)}}function kg(t=h.collection){var e;return!t||t.type!=="collection"?!1:((e=t.operations)==null?void 0:e.create)!==!1}function xg(t=h.collection){var e;return t?((e=t.operations)==null?void 0:e.delete)===!0:!1}function gM(t){return String(t||"").trim().toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function yM(t,e){const n=new Date,r=String(n.getFullYear()),i=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getDate()).padStart(2,"0");return String(t||"{key}.md").replaceAll("{year}",r).replaceAll("{month}",i).replaceAll("{day}",o).replaceAll("{key}",e)}function bM(){const t=new Date;return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function Rl({className:t,title:e,ariaLabel:n,action:r=null,disabled:i=!1,onClick:o,icon:s,label:l=null,spinning:a=!1}){const c=[k("span",{className:"material-symbols-outlined"+(a?" studio-icon-spin":""),text:s,"aria-hidden":"true"})];return l&&c.push(k("span",{className:"btn-label",text:l})),k("button",{className:t,type:"button",title:e,"aria-label":n,"data-studio-action":r,disabled:i,onClick:o},c)}function kM({brand:t=null,menuToggle:e=null}={}){const n=h.saving?"Saving…":h.dirty?"Save":"Saved",r=h.saving?"progress_activity":h.dirty?"save":"check",i=h.error?"Error":h.status||"",o=k("div",{className:"studio-toolbar-brand"},[t,i?k("span",{className:"status-pill studio-toolbar-status"+(h.error?" error":""),text:i,title:h.error||h.errorDetail||h.status||""}):null]),s=[uM()];if(Mc()){const a=h.reexporting||h.pipeline.state==="syncing";s.push(Rl({className:"btn btn-tool btn-reexport"+(a?" pipeline-running":"")+(h.pipeline.state==="ok"&&!a?" pipeline-ok":"")+(h.pipeline.state==="error"&&!a?" pipeline-error":""),title:a?"Exporting content JSON locally":"Export content JSON locally and reload",ariaLabel:a?"Exporting locally":"Export locally",action:"reexport",disabled:a,onClick:()=>dT(),icon:a?"progress_activity":"sync",label:a?"Exporting…":"Export",spinning:a}))}else s.push(pM());s.push(Rl({className:"btn btn-tool",title:"Revert all edits to the last loaded or saved version",ariaLabel:"Discard edits",action:"discard",disabled:!h.file||!h.dirty||!h.baseline,onClick:()=>uT(),icon:"undo",label:"Revert"}),Rl({className:"btn btn-tool btn-primary",title:h.saving?"Saving this draft":h.dirty?"Commit this draft":"No edits to commit yet",ariaLabel:n,action:"save",disabled:h.saving||!h.file||!h.dirty,onClick:()=>hT(),icon:r,label:n,spinning:h.saving}));const l=[o,k("span",{className:"spacer","aria-hidden":"true"}),...s];return e&&l.push(e),k("header",{className:"studio-toolbar studio-icon-bar"},l)}function Sg(t){var r,i;if(!t||t.dev||!t.user)return"";const e=(r=t.user.primaryEmailAddress)==null?void 0:r.emailAddress;return e||((i=(t.user.emailAddresses||[])[0])==null?void 0:i.emailAddress)||""}function hi(t){if(t&&!t.dev&&t.user){xM(t,h.error||"Studio API session failed while you are signed in.");return}at.innerHTML="";const e=k("div",{className:"auth-gate"},[k("div",{className:"studio-brand"},[Ms({size:32,label:"Studio"}),k("strong",{text:"Studio"})]),k("h1",{text:"Sign in to edit"}),k("p",{text:"Studio is for site admins only. Anyone may register; access is granted after review."}),k("div",{id:"clerk-sign-in"})]);at.append(e),t&&!t.dev?t.mountSignIn(ve("#clerk-sign-in"),{...sg}):ve("#clerk-sign-in").append(k("p",{className:"status-pill",text:"No VITE_CLERK_PUBLISHABLE_KEY — using API bypass if enabled."}),k("button",{className:"btn btn-primary",text:"Continue",onClick:()=>oo(t)}))}function xM(t,e){at.innerHTML="";const n=k("div",{className:"auth-gate"},[k("div",{className:"studio-brand"},[Ms({size:32,label:"Studio"}),k("strong",{text:"Studio"})]),k("h1",{text:"Studio API unavailable"}),k("p",{className:"status-pill error",text:e}),k("p",{text:"You are signed in with Clerk, but /api/studio/session did not succeed. Local jekyll serve has no Pages Functions — use a Pages preview, wrangler pages dev, or STUDIO_DEV_BYPASS against a running Function."}),k("button",{className:"btn",type:"button",text:"Sign out",onClick:async()=>{if(t&&!t.dev&&t.signOut){await t.signOut({redirectUrl:Zt});return}hi(t)}})]);at.append(n)}function SM(t,e){const n=e||Sg(t)||"the address you used to register";at.innerHTML="";const r=k("p",{className:"pending-copy"});r.append(document.createTextNode("Thank you for your registration. Your profile is being transferred to the site administration to be reviewed as a potential contributor. You will be contacted via "));const i=document.createElement("strong");i.textContent=n,r.append(i),r.append(document.createTextNode("."));const o=k("div",{className:"auth-gate auth-gate--pending"},[k("div",{className:"studio-brand"},[Ms({size:32,label:"Studio"}),k("strong",{text:"Studio"})]),k("h1",{text:"Registration received"}),r,k("p",{className:"pending-signoff",text:"Have a nice one! ✍️"}),k("button",{className:"btn",type:"button",text:"Sign out",onClick:async()=>{if(t&&!t.dev&&t.signOut){await t.signOut({redirectUrl:Zt});return}hi(t)}})]);at.append(o)}const wM=["Writing","Portfolio","References","Pages","CV Summary","Presentation","Profile"];function wg(t){const e=new Map;for(const r of t.collections)e.has(r.group)||e.set(r.group,[]),e.get(r.group).push(r);const n=new Map;for(const r of wM)e.has(r)&&n.set(r,e.get(r));for(const[r,i]of e)n.has(r)||n.set(r,i);return n}function CM(){const t="Media",e=h.navOpenGroups.has(t),n=k("div",{className:"studio-nav-group-items",id:xc(t),role:"region","aria-label":t});e||(n.hidden=!0),n.append(k("button",{className:"nav-item",type:"button",text:"Library",title:"Browse and upload under content/media","aria-current":h.mediaOpen?"page":null,onClick:()=>fg()}));const r=k("button",{className:"studio-nav-group-toggle",type:"button",title:lg(t),"aria-expanded":e?"true":"false","aria-controls":n.id,onClick:()=>{ag(t)}},[k("span",{className:"material-symbols-outlined",text:e?"expand_more":"chevron_right","aria-hidden":"true"}),k("span",{className:"nav-group-label",text:t})]);return k("div",{className:"studio-nav-group"},[r,n])}function vM(){if(!h.error||!h.file&&!h.mediaOpen)return null;const t=[];if(h.errorCode==="conflict"&&h.file){const e=h.file;t.push(k("button",{className:"btn",type:"button",text:"Reload from GitHub",title:"Replace this screen with the file currently on GitHub",onClick:()=>Os(e)}))}return t.push(k("button",{className:"btn",type:"button",text:"Dismiss",onClick:()=>{ct(),Y()}})),k("div",{className:"studio-error-banner",role:"alert"},[k("p",{className:"studio-error-message",text:h.error}),k("div",{className:"studio-error-actions"},t)])}function Y(){var a;at.innerHTML="";const t=wg(h.schema),e=!!h.navMenuOpen,n=k("button",{className:"studio-brand studio-brand-home studio-brand-toolbar",type:"button",title:"Studio home","aria-current":!h.collection&&!h.mediaOpen?"page":null,onClick:()=>wc()},[Ms({size:22}),k("span",{className:"studio-brand-copy"},[k("span",{className:"studio-brand-name",text:"Studio"})])]),r=k("button",{className:"studio-nav-menu-toggle",type:"button",title:e?"Close collections menu":"Open collections menu","aria-label":e?`Close menu (${Ll()})`:`Open menu (${Ll()})`,"aria-expanded":e?"true":"false","aria-controls":"studio-nav-panel",onClick:()=>{h.navMenuOpen=!h.navMenuOpen,Y()}},[k("span",{className:"studio-nav-menu-label sr-only",text:Ll()}),k("span",{className:"material-symbols-outlined",text:e?"close":"menu","aria-hidden":"true"})]),i=k("div",{className:"studio-nav-panel",id:"studio-nav-panel"});i.append(CM());for(const[c,u]of t){const d=h.navOpenGroups.has(c),p=k("div",{className:"studio-nav-group-items",id:xc(c),role:"region","aria-label":c});d||(p.hidden=!0);for(const g of u){const b=h.navCountByCollection[g.name],x=[k("span",{className:"nav-item-label",text:g.label})];b!=null&&x.push(k("span",{className:"nav-item-count",text:String(b)})),p.append(k("button",{className:"nav-item",type:"button",title:cg(g),"aria-current":((a=h.collection)==null?void 0:a.name)===g.name?"page":null,onClick:()=>Ns(g)},x))}const m=k("button",{className:"studio-nav-group-toggle",type:"button",title:lg(c),"aria-expanded":d?"true":"false","aria-controls":p.id,onClick:()=>{ag(c)}},[k("span",{className:"material-symbols-outlined",text:d?"expand_more":"chevron_right","aria-hidden":"true"}),k("span",{className:"nav-group-label",text:c})]);i.append(k("div",{className:"studio-nav-group"},[m,p]))}const o=k("nav",{className:"studio-nav"+(e?" is-open":""),"aria-label":"Collections"},[i]),s=kM({brand:n,menuToggle:r}),l=k("div",{className:"studio-main"},[vM(),MM(),k("div",{className:"studio-body"+(h.file?"":" list-only"),id:"studio-body"})]);at.append(k("div",{className:"studio-shell"},[s,o,l])),Sn(),pi(),window.__studioMenuDismissBound||(window.__studioMenuDismissBound=!0,document.addEventListener("click",()=>{h.themeMenuOpen&&(h.themeMenuOpen=!1,pi())}))}function MM(){var e,n;const t=[k("span",{className:"studio-crumb",text:"Studio"})];if(h.mediaOpen&&!h.collection)t.push(k("span",{className:"studio-crumb-sep","aria-hidden":"true",text:"/"}),k("span",{className:"studio-crumb is-current",text:"Media"}));else if(h.collection){const r=h.collection.group||"Content",i=h.collection.label||h.collection.name;if(t.push(k("span",{className:"studio-crumb-sep","aria-hidden":"true",text:"/"}),k("span",{className:"studio-crumb",text:r}),k("span",{className:"studio-crumb-sep","aria-hidden":"true",text:"/"}),k("span",{className:"studio-crumb"+(h.file?"":" is-current"),text:i})),h.file){const o=((e=h.fields)==null?void 0:e.title)||((n=h.fields)==null?void 0:n.key)||String(h.file).split("/").pop()||"Entry";t.push(k("span",{className:"studio-crumb-sep","aria-hidden":"true",text:"/"}),k("span",{className:"studio-crumb is-current",text:o}))}}else t.push(k("span",{className:"studio-crumb-sep","aria-hidden":"true",text:"/"}),k("span",{className:"studio-crumb is-current",text:"Map"}));return k("nav",{className:"studio-breadcrumb","aria-label":"Location"},t)}function je(){h.dirty=!0,Ta(),YM()}function Tc(){var t;return!h.file||fr()||h.aiProofBusy?!1:!!String(((t=h.fields)==null?void 0:t.language)||"").trim()}function Ma(){const t=h.aiProofBusy,e=Tc()&&!t;for(const n of["correct","refine"]){const r=document.querySelector(`[data-studio-action='${n}']`);if(!r)continue;r.disabled=!e;const i=r.querySelector(".editor-ai-proof-label");i&&(t?i.textContent="Working…":i.textContent=n==="refine"?"Refine":"Correct")}}function Qr(){h.insertMenuOpen=!1;const t=ve("#insert-menu");t&&(t.hidden=!0);for(const e of document.querySelectorAll(".editor-insert-btn[aria-haspopup='menu']"))e.setAttribute("aria-expanded","false")}function io(t){h.aiProofHint=t;const e=ve("#ai-proof-hint");e&&(e.textContent=t,e.hidden=!t),clearTimeout(h._aiProofHintTimer),t&&(h._aiProofHintTimer=setTimeout(()=>{h.aiProofHint="";const n=ve("#ai-proof-hint");n&&(n.textContent="",n.hidden=!0)},3200))}function Cg(){var t;if(h.bodyMode==="source"){const e=ve("#body-source");if(!e)return null;const n=e.selectionStart,r=e.selectionEnd;if(!Number.isInteger(n)||!Number.isInteger(r)||n===r)return null;cn();const i=h.body||"";return{kind:"source",start:n,end:r,text:i.slice(n,r)}}if(h.bodyMode==="visual"&&((t=h.bodyEditor)!=null&&t.editor)){const e=h.bodyEditor.editor,{from:n,to:r,empty:i}=e.state.selection;if(i||n===r)return null;const o=e.state.doc.textBetween(n,r,`
274
274
 
275
275
  `);return String(o).trim()?{kind:"visual",from:n,to:r,text:o}:null}return null}function of(t,e){const n=Array.isArray(e)?[...e]:[];n.sort((i,o)=>(o.start||0)-(i.start||0));let r=t;for(const i of n){const o=Number(i.start),s=Number(i.end);if(!Number.isInteger(o)||!Number.isInteger(s)||s<o)continue;const l=String(i.original??""),a=String(i.replacement??"");r.slice(o,s)===l&&(r=r.slice(0,o)+a+r.slice(s))}return r}function TM(t,e){var n;if(t.kind==="source"){const r=h.body||"";h.body=r.slice(0,t.start)+e+r.slice(t.end);const i=ve("#body-source");if(i){i.value=h.body;const o=t.start+e.length;i.focus(),i.setSelectionRange(o,o)}je(),pn();return}t.kind==="visual"&&((n=h.bodyEditor)!=null&&n.editor)&&(h.bodyEditor.editor.chain().focus().insertContentAt({from:t.from,to:t.to},e).run(),cn(),je(),pn())}function AM(){var n;const t=h.aiProofSelection||Cg();if(h.aiProofSelection=null,t)return t;cn();const e=h.body||"";if(!String(e).trim())return null;if(h.bodyMode==="source")return{kind:"source",start:0,end:e.length,text:e,wholeBody:!0};if(h.bodyMode==="visual"&&((n=h.bodyEditor)!=null&&n.editor)){const r=h.bodyEditor.editor,i=0,o=r.state.doc.content.size;return{kind:"visual",from:i,to:o,text:e,wholeBody:!0}}return null}async function EM(t){var l,a;if(Qr(),io(""),!Tc()){io("Set language in front matter before AI Proof."),Ta();return}const e=AM();if(!e){io("Body is empty.");return}cn();const n=String(h.fields.language||"").trim(),r=h.body||"";let i=null;t==="refine"&&e.kind==="source"&&!e.wholeBody&&(i={before:r.slice(Math.max(0,e.start-2e3),e.start),after:r.slice(e.end,Math.min(r.length,e.end+2e3))});const o=e.kind==="source"?{start:e.start,end:e.end}:{start:0,end:e.text.length},s=e.wholeBody?"body":"selection";h.aiProofBusy=!0,h.status=t==="refine"?`Refining ${s}…`:`Correcting ${s}…`,Ma();try{const c=await ze.rewrite({mode:t,path:h.file,language:n,text:e.text,selection:o,context:i}),u=Array.isArray(c.patches)?c.patches:[],d=c.stats||{};if(!u.length){Number(d.proposed)>0?h.status=`No safe changes to apply (${d.proposed} proposed, all dropped).`:h.status=`No changes proposed for the ${s}.`;return}let p;if(e.kind==="visual"&&e.wholeBody){if(p=of(r,u),p===r){h.status=`No changes proposed for the ${s}.`;return}h.body=p,(a=(l=h.bodyEditor)==null?void 0:l.setMarkdown)==null||a.call(l,p),je(),pn()}else{if(p=of(e.text,u),p===e.text){h.status=`No changes proposed for the ${s}.`;return}TM(e,p)}const m=Number(d.dropped)>0?`, ${d.dropped} dropped`:"";h.status=t==="refine"?`Refined ${s} (${u.length}${m}).`:`Corrected ${s} (${u.length}${m}).`}catch(c){Ct(c);const u=h.error;h.error=u?`AI Proof failed. ${u}`:"AI Proof failed."}finally{h.aiProofBusy=!1,Ma(),Ta()}}function Ta(){const t=document.querySelector("[data-studio-action='save']"),e=document.querySelector("[data-studio-action='discard']");if(t){const n=h.saving?"Saving…":h.dirty?"Save":"Saved";t.disabled=h.saving||!h.file||!h.dirty,t.title=h.saving?"Saving this draft":h.dirty?"Commit this draft":"No edits to commit yet",t.setAttribute("aria-label",n);const r=t.querySelector(".material-symbols-outlined");r&&(r.textContent=h.saving?"progress_activity":h.dirty?"save":"check",r.classList.toggle("studio-icon-spin",h.saving));const i=t.querySelector(".btn-label");i&&(i.textContent=n)}e&&(e.disabled=!h.file||!h.dirty||!h.baseline),Ma()}function Sn(){const t=ve("#studio-body");if(!t)return;t.innerHTML="";const e=h.file&&!fr()?` view-${h.bodyMode}`:"";if(t.className="studio-body"+(h.file?"":" list-only")+e,h.fileLoading){t.append(k("div",{className:"pane"},[k("p",{className:"loading-msg",text:"Loading content…"})]));return}if(!h.collection){if(h.mediaOpen){t.append(Bv(dg()));return}t.append($M());return}if(!h.file){t.append(_M());return}if(fr()){t.append(PM(),af()),pn();return}t.append(WM(),af()),nT(),pn()}function fr(t=h.collection){return(t==null?void 0:t.format)==="yaml"}function NM(){const t=h.collection,e=mr(t);try{if(e==="list")h.body=St(h.yamlList||[]);else if(e==="map")if(t.root_key){const n=h.yamlDoc&&typeof h.yamlDoc=="object"?{...h.yamlDoc}:{};n[t.root_key]=_n({...h.fields},t.fields),h.body=St(n)}else h.body=St(_n({...h.fields},t.fields))}catch(n){Ct(n)}}function OM(){const t=h.collection,e=mr(t);ct();try{const n=Zr(h.body);if(e==="list")h.yamlList=Gm(n),h.fields={};else if(e==="map"){if(t.root_key){const r=rr(n);h.yamlDoc=r,h.fields=rr(r[t.root_key])}else h.yamlDoc=null,h.fields=rr(n);h.yamlList=null}return!0}catch(n){return Ct(n),h.status="Invalid YAML — fix source before switching",!1}}function sf(t){if(t===h.yamlUiMode)return;if(t==="source"){NM(),h.yamlUiMode="source",Y();return}const e=ve("#yaml-source");if(e&&(h.body=e.value),!OM()){Y();return}h.yamlUiMode="structured",Y()}function LM(t){const e=h.yamlUiMode==="structured"&&t!=="source";return t==="list"||t==="map"?k("div",{className:"editor-chrome yaml-chrome"},[k("div",{className:"editor-mode-tabs",role:"tablist","aria-label":"YAML editor mode"},[k("button",{className:"editor-mode-tab",type:"button",role:"tab",text:"Fields",title:"Structured field editors","aria-selected":e?"true":"false",onClick:()=>sf("structured")}),k("button",{className:"editor-mode-tab",type:"button",role:"tab",text:"YAML",title:"Raw YAML source","aria-selected":e?"false":"true",onClick:()=>sf("source")})]),k("p",{className:"yaml-chrome-hint",text:t==="list"?"List of entries in one YAML file. Reorder, add, or remove items.":"Structured YAML fields — not a Markdown article body."})]):k("div",{className:"editor-chrome yaml-chrome"},[k("p",{className:"yaml-chrome-hint",text:"Free-form YAML — edit the source directly."})])}function IM(){const t=h.collection,e=As(t),n=Array.isArray(h.yamlList)?h.yamlList:[],r=k("div",{className:"yaml-list",id:"yaml-list"});return n.forEach((i,o)=>{(!i||typeof i!="object"||Array.isArray(i))&&(n[o]={});const s=n[o],l=k("div",{className:"yaml-list-item"}),a=e[0],c=a?s[a.name]||`${t.label} ${o+1}`:`${t.label} ${o+1}`;l.append(k("div",{className:"yaml-list-item-head"},[k("span",{className:"yaml-list-item-index",text:String(c)}),k("div",{className:"yaml-list-item-actions"},[k("button",{className:"btn yaml-list-btn",type:"button",text:"↑",title:"Move up",disabled:o===0,onClick:()=>{if(o===0)return;const d=[...n];[d[o-1],d[o]]=[d[o],d[o-1]],h.yamlList=d,je(),Y()}}),k("button",{className:"btn yaml-list-btn",type:"button",text:"↓",title:"Move down",disabled:o===n.length-1,onClick:()=>{if(o>=n.length-1)return;const d=[...n];[d[o],d[o+1]]=[d[o+1],d[o]],h.yamlList=d,je(),Y()}}),k("button",{className:"btn yaml-list-btn",type:"button",text:"Remove",onClick:()=>{h.yamlList=n.filter((d,p)=>p!==o),je(),Y()}})])]));const u=k("div",{className:"form-grid yaml-list-item-fields"});for(const d of e)u.append(Es(d,{target:s,idPrefix:`yml-${o}-`,onChange:()=>{je()}}));l.append(u),r.append(l)}),r.append(k("button",{className:"btn btn-primary",type:"button",text:"Add item",onClick:()=>{h.yamlList=[...h.yamlList||[],kc(e)],je(),Y()}})),n.length||r.prepend(k("p",{className:"yaml-empty",text:"No items yet. Add one to start this list."})),r}function RM(){const t=k("div",{className:"form-grid",id:"yaml-form"});for(const e of As(h.collection))t.append(Es(e));return t}function DM(){return k("div",{className:"field yaml-source-stack"},[k("label",{className:"field-heading",text:"YAML source"}),k("textarea",{id:"yaml-source",className:"yaml-source editor-surface",text:h.body,"aria-label":"YAML source",spellcheck:"false",onInput:t=>{h.body=t.target.value,je(),pn()}})])}function PM(){const t=h.collection,e=mr(t)||"source",n=h.yamlUiMode==="structured"&&(e==="list"||e==="map"),r=t.type==="file"?"Map":"List",i=k("div",{className:"yaml-editor-body"});return n&&e==="list"?i.append(IM()):n&&e==="map"?i.append(RM()):i.append(DM()),k("div",{className:"pane pane-editor pane-yaml"},[k("button",{className:"btn btn-nav",type:"button",title:`Back to ${r}`,onClick:()=>{if(vt(),t.type==="file"){wc();return}h.file=null,h.baseline=null,h.dirty=!1,h.insertMenuOpen=!1,Y()}},[_e("chevron_left","btn-nav-icon"),k("span",{text:r})]),k("header",{className:"yaml-editor-header"},[k("h1",{className:"yaml-editor-title",text:t.label}),k("p",{className:"yaml-editor-path",text:Ti(h.file||t.path)})]),LM(e),i])}function $M(){const t=wg(h.schema),e=[BM()];for(const[n,r]of t){const i=r.map(o=>k("button",{className:"studio-map-card",type:"button",title:cg(o),onClick:()=>{h.navOpenGroups.add(n),Ns(o)}},[_e(o.type==="file"?"draft":Ca[n]||"folder_open","studio-map-card-icon"),k("span",{className:"studio-map-card-body"},[k("span",{className:"studio-map-card-title",text:o.label}),k("span",{className:"studio-map-card-meta",text:Ti(o.path)||o.name})])]));e.push(k("section",{className:"studio-map-group"},[k("div",{className:"studio-map-group-head"},[_e(Ca[n]||"folder","studio-map-group-icon"),k("h2",{className:"studio-map-group-label",text:n})]),k("div",{className:"studio-map-grid"},i)]))}return k("div",{className:"pane studio-map"},[k("span",{className:"studio-shard studio-shard--lead","aria-hidden":"true"}),k("span",{className:"studio-shard studio-shard--beta studio-shard--trail","aria-hidden":"true"}),k("div",{className:"studio-map-board",role:"navigation","aria-label":"Collections map"},e)])}function BM(){return k("section",{className:"studio-map-group"},[k("div",{className:"studio-map-group-head"},[_e(Ca.Media,"studio-map-group-icon"),k("h2",{className:"studio-map-group-label",text:"Media"})]),k("div",{className:"studio-map-grid"},[k("button",{className:"studio-map-card",type:"button",title:"Browse and upload under content/media",onClick:()=>fg()},[_e("photo_library","studio-map-card-icon"),k("span",{className:"studio-map-card-body"},[k("span",{className:"studio-map-card-title",text:"Library"}),k("span",{className:"studio-map-card-meta",text:Ti("content/media")})])])])])}function _M(){const t=Zv(),e=Qv(),n=tM(),r=aT(),i=gv(h.items,{query:t,sortId:e}),o=yv(i,{pageSizeId:n,page:tf()});o.page!==tf()&&Il(o.page);const s=o.items,l=qM(h.collection,{entryCount:h.listLoading?null:h.items.length});if(h.listLoading)return k("div",{className:"pane"},[l,k("p",{className:"loading-msg",text:"Loading content…"})]);if(h.error&&!h.items.length)return k("div",{className:"pane"},[l,k("div",{className:"list-error"},[k("p",{className:"list-error-title",text:"Could not load entries."}),k("p",{className:"list-error-message",text:h.error}),h.errorDetail?k("pre",{className:"list-error-detail",text:h.errorDetail}):null])]);const a=s.map(T=>HM(T,r)),c=k("input",{className:"list-search-input",type:"search",value:t,placeholder:"Search title, key, path…","aria-label":"Search entries",title:"Filter this list by title, key, filename, or path",onInput:T=>{var J;const R=(J=h.collection)==null?void 0:J.name;if(!R)return;h.listQueryByCollection[R]=T.target.value,Cc(),Sn();const $=ve("#list-search-input");if($){$.focus();const ne=$.value.length;$.setSelectionRange(ne,ne)}}});c.id="list-search-input";const u=k("select",{className:"list-sort-select","aria-label":"Sort entries",title:"Sort entries in this collection",onChange:T=>{eM(T.target.value),Sn()}});for(const T of Qo)u.append(k("option",{value:T.id,text:T.label,selected:T.id===e}));const d=k("select",{className:"list-page-size-select","aria-label":"Entries per page",title:"How many entries to show per page",onChange:T=>{nM(T.target.value),Sn()}});for(const T of ts)d.append(k("option",{value:T.id,text:T.label,selected:T.id===n}));const p=k("div",{className:"list-controls"},[c,k("label",{className:"list-sort-label"},[k("span",{className:"list-sort-caption",text:"Sort"}),u]),k("label",{className:"list-sort-label"},[k("span",{className:"list-sort-caption",text:"Show"}),d])]);let m=null;i.length||(h.error?m=k("div",{className:"list-error"},[k("p",{className:"list-error-title",text:"Could not load entries."}),k("p",{className:"list-error-message",text:h.error}),h.errorDetail?k("pre",{className:"list-error-detail",text:h.errorDetail}):null]):h.items.length===0?m=k("p",{className:"list-empty",text:"No entries in this collection."}):m=k("p",{className:"list-empty",text:"No entries match this search."}));const b=o.pageSize!=null&&o.pageCount>1&&i.length>0?k("div",{className:"list-pager",role:"navigation","aria-label":"List pages"},[k("button",{className:"btn list-pager-btn",type:"button",text:"Prev",title:"Previous page",disabled:o.page<=1,onClick:()=>{o.page<=1||(Il(o.page-1),Sn())}}),k("span",{className:"list-pager-status",text:`Page ${o.page} of ${o.pageCount}`}),k("button",{className:"btn list-pager-btn",type:"button",text:"Next",title:"Next page",disabled:o.page>=o.pageCount,onClick:()=>{o.page>=o.pageCount||(Il(o.page+1),Sn())}})]):null;let x="";if(h.items.length>0){const T=t;if(!i.length)x=T?`0 of ${h.items.length}`:"";else if(o.pageSize==null)x=T?`${i.length} of ${h.items.length}`:"";else{const R=`${o.from}–${o.to} of ${i.length}`;x=T?`${R} (filtered from ${h.items.length})`:R}}const w=r?k("div",{className:"ledger-columns","aria-hidden":"true"},[k("span",{className:"ledger-col-thumb"}),k("span",{className:"ledger-col-manuscript",text:"Manuscript"}),k("span",{className:"ledger-col-ops",text:"Operations"})]):null;return k("div",{className:"pane"},[l,p,x?k("p",{className:"list-count",text:x}):null,w,k("div",{className:"ledger-list"},a.length?a:[m]),b])}function zM(t){const e=String((t==null?void 0:t.language)||"").trim();return e?k("span",{className:"ledger-lang",text:e.toUpperCase(),title:`Language: ${e}`}):null}function FM(t,{open:e}){const n=xg(),r=t.title||t.name||"entry",i=k("button",{className:"btn btn-icon ledger-op-btn ledger-edit-btn",type:"button",title:`Edit ${r}`,"aria-label":`Edit ${r}`,onClick:s=>{s.stopPropagation(),e()}},[_e("edit")]),o=n?k("button",{className:"btn btn-icon ledger-op-btn ledger-delete-btn",type:"button",title:`Delete ${r}`,"aria-label":`Delete ${r}`,onClick:s=>{s.stopPropagation(),pT(t.path,t.sha)}},[_e("delete")]):null;return k("div",{className:"ledger-ops",role:"group","aria-label":"Operations"},[i,o])}function HM(t,e){const n=Tv(t,h.collection),r=()=>Os(t.path),i=FM(t,{open:r});if(!e){const l=k("div",{className:"ledger-copy"},[k("div",{className:"ledger-title",text:t.title||t.name}),n?k("div",{className:"ledger-meta",text:n}):null]);return k("div",{className:"ledger-row ledger-row--plain",role:"button",tabindex:"0",title:ef(t),onClick:r,onKeydown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),r())}},[rf(t),l,i])}const o=k("div",{className:"ledger-title-row"},[Tg(t),k("div",{className:"ledger-title",text:t.title||t.name})]),s=k("div",{className:"ledger-copy"},[o,n?k("div",{className:"ledger-meta",text:n}):null]);return k("div",{className:"ledger-row ledger-row--writing",role:"button",tabindex:"0",title:ef(t),onClick:r,onKeydown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),r())}},[rf(t),s,i])}function As(t){return(t.fields||[]).filter(e=>!e.hidden&&!Af(e)&&e.name!=="layout")}function jM(t){const e=(t.fields||[]).filter(n=>Af(n));return e.length?e:t.format==="raw"&&!t.root_key?[{name:"body",label:"Content",component:"markdown_body"}]:[]}function lf(t,e){return((t==null?void 0:t.fields)||[]).some(n=>n.name===e)}function VM(t){return t==null?!1:Array.isArray(t)?t.length>0:typeof t=="boolean"?!0:String(t).trim()!==""}function UM(){var t;if(h.frontMatterOpen!=null)return!!h.frontMatterOpen;if(h.dirty)return!0;for(const e of As(h.collection))if(e.required&&!VM((t=h.fields)==null?void 0:t[e.name]))return!0;return!1}function qM(t,{entryCount:e=null}={}){const n=(t==null?void 0:t.group)||"Content",r=(t==null?void 0:t.label)||(t==null?void 0:t.name)||"Index",i=[k("h1",{className:"list-pane-title",text:r})];return e!=null&&e>=0&&i.push(k("span",{className:"list-pane-count",text:e===1?"1 entry":`${e} entries`})),kg(t)&&i.push(k("button",{className:"btn btn-tool btn-primary list-new-btn",type:"button",title:`Add a new ${r} entry`,"aria-label":`New ${r} entry`,onClick:()=>fT()},[_e("add"),k("span",{className:"btn-label",text:"New"})])),k("header",{className:"list-register"},[k("p",{className:"list-register-kicker"},[k("span",{className:"list-register-mark","aria-hidden":"true"}),k("span",{text:`Register // ${n}`}),k("span",{className:"list-register-sep","aria-hidden":"true",text:"/"}),k("span",{text:`${r} index`})]),k("div",{className:"list-register-title-row"},i)])}function WM(){const t=As(h.collection),e=jM(h.collection),n=k("div",{className:"form-grid",id:"meta-form"});for(const a of t)n.append(Es(a));const r=UM(),i=t.length>0?k("details",{className:"front-matter",open:r,onToggle:a=>{h.frontMatterOpen=!!a.target.open}},[k("summary",{className:"front-matter-summary"},[k("span",{className:"front-matter-summary-label",text:"Front-matter"}),k("span",{className:"front-matter-summary-hint",text:r?"Collapse":"Expand"})]),n]):null,o=k("div",{className:"field body-editor-stack",id:"body-wrap"});if(e.length){const a=e[0],c=h.bodyMode,d=c==="visual"||c==="preview",p=c==="source",m=k("div",{id:"tiptap-host",className:"tiptap editor-surface"});d||(m.hidden=!0);const g=k("textarea",{id:"body-source",className:"body-source editor-surface",text:h.body,"aria-label":"Markdown source",onInput:b=>{h.body=b.target.value,je(),pn()}});if(p||(g.hidden=!0),o.append(k("label",{text:a.label||"Body"}),JM(c),k("div",{className:"editor-pane-fill"},[m,g])),e.length>1)for(const b of e.slice(1))o.append(k("label",{text:b.label||b.name,style:"margin-top:1rem"}),k("textarea",{"data-extra-body":b.name,text:h.fields[b.name]||"",onInput:x=>{h.fields[b.name]=x.target.value,je()}}))}const s=e.length>0?KM(h.body):null,l=[];if(lf(h.collection,"published")&&l.push(Tg(h.fields)),!lf(h.collection,"language")){const a=zM(h.fields);a&&l.push(a)}return k("div",{className:"pane pane-editor"},[k("div",{className:"editor-mast"},[k("div",{className:"editor-mast-lead"},[k("button",{className:"btn btn-back",type:"button",title:"Back to collection list","aria-label":"Back to collection list",onClick:()=>{vt(),h.file=null,h.baseline=null,h.dirty=!1,h.insertMenuOpen=!1,h.frontMatterOpen=null,Y()}},[_e("chevron_left","btn-nav-icon")]),l.length?k("div",{className:"editor-mast-pills"},l):null])]),i,o,s])}function vg(t){const e=String(t||""),n=e.length,r=e.trim(),i=r?r.split(/\s+/).filter(Boolean).length:0,o=r?r.split(/\n\s*\n/).filter(s=>s.trim()).length:0;return{chars:n,words:i,paras:o}}function KM(t){const{chars:e,words:n,paras:r}=vg(t);return k("div",{className:"editor-body-stats",id:"editor-body-stats"},[k("span",{text:`Chars: ${e}`}),k("span",{className:"editor-body-stats-sep","aria-hidden":"true",text:"·"}),k("span",{text:`Words: ${n}`}),k("span",{className:"editor-body-stats-sep","aria-hidden":"true",text:"·"}),k("span",{text:`Paras: ${r}`})])}function YM(){const t=ve("#editor-body-stats");if(!t)return;const{chars:e,words:n,paras:r}=vg(h.body);t.replaceChildren(k("span",{text:`Chars: ${e}`}),k("span",{className:"editor-body-stats-sep","aria-hidden":"true",text:"·"}),k("span",{text:`Words: ${n}`}),k("span",{className:"editor-body-stats-sep","aria-hidden":"true",text:"·"}),k("span",{text:`Paras: ${r}`}))}function JM(t){const e=t==="visual",n=t==="source",r=t==="preview",i=k("div",{className:"editor-mode-tabs",role:"tablist","aria-label":"Editor mode"},[k("button",{className:"editor-mode-tab",type:"button",role:"tab",text:"Visual",title:"Rich text with Liquid blocks","aria-selected":e?"true":"false",onClick:()=>{e||(cn(),h.bodyMode="visual",h.lastEditorMode="visual",Qr(),Y())}}),k("button",{className:"editor-mode-tab",type:"button",role:"tab",text:"Source",title:"Edit raw Markdown source","aria-selected":n?"true":"false",onClick:()=>{n||(cn(),h.bodyMode="source",h.lastEditorMode="source",Qr(),Y())}}),k("button",{className:"editor-mode-tab editor-mode-tab--preview",type:"button",role:"tab",text:"Preview",title:"Rendered side preview (small screens)","aria-selected":r?"true":"false",onClick:()=>{r||(cn(),(h.bodyMode==="visual"||h.bodyMode==="source")&&(h.lastEditorMode=h.bodyMode),h.bodyMode="preview",Qr(),Y())}})]),o=k("div",{className:"editor-chrome-row"},[i,k("div",{className:"editor-chrome-actions"},[e||n?ZM():null,e?XM():null])]);return k("div",{className:"editor-chrome"},[o,k("p",{id:"ai-proof-hint",className:"ai-proof-hint",text:h.aiProofHint||"",hidden:!h.aiProofHint,"aria-live":"polite"}),e?QM():null])}function GM(t){const e={};if(t.name==="figure")e.src=prompt("Image URL (HTTPS or /media/…)")||"",e.caption=prompt("Caption")||"";else if(t.name==="youtube")e.id=prompt("YouTube id")||"";else if(t.name==="xcite"||t.name==="cite")e.key=prompt("Key")||"";else for(const n of t.fields){const r=prompt(n);r&&(e[n]=r)}return e}function XM(){const t=k("div",{className:"editor-insert-menu",id:"insert-menu",role:"menu"});h.insertMenuOpen||(t.hidden=!0);for(const e of dr.filter(n=>!n.blockBody))t.append(k("button",{className:"editor-insert-item",type:"button",role:"menuitem",title:e.label,onClick:()=>{const n=GM(e);Qr(),h.bodyEditor?h.bodyEditor.insertInclude(e.name,n):Sn()}},[_e(Jv[e.name]||"add","editor-insert-icon"),k("span",{text:e.label})]));return k("div",{className:"editor-insert"},[k("button",{className:"btn editor-insert-btn",type:"button","aria-haspopup":"menu","aria-expanded":h.insertMenuOpen?"true":"false",title:"Insert a Liquid include block",onClick:e=>{e.stopPropagation();const n=!h.insertMenuOpen;h.insertMenuOpen=n;const r=ve("#insert-menu"),i=e.currentTarget;r&&(r.hidden=!n),i.setAttribute("aria-expanded",n?"true":"false")}},[_e("add"),k("span",{text:"Insert"}),_e("expand_more","editor-insert-caret")]),t])}function ZM(){return k("div",{className:"editor-ai-proof"},[{action:"correct",label:"Correct",icon:"check",title:"Spelling, grammar, idiom, and punctuation (selection or full body)"},{action:"refine",label:"Refine",icon:"edit",title:"Clarity and flow (selection or full body), using writing guidelines"}].map(e=>k("button",{className:"btn editor-insert-btn",type:"button",title:e.title,"data-studio-action":e.action,disabled:!Tc()||h.aiProofBusy,onMouseDown:n=>{n.preventDefault(),h.aiProofSelection=Cg()},onClick:()=>{io(""),EM(e.action)}},[_e(e.icon),k("span",{className:"editor-ai-proof-label",text:h.aiProofBusy?"Working…":e.label})])))}function ht(){var t,e;return(e=(t=h.bodyEditor)==null?void 0:t.editor)==null?void 0:e.chain().focus()}function it(t){return k("button",{className:"editor-toolbar-btn",type:"button",title:t.title,"aria-label":t.title,onClick:t.onClick},[t.icon?_e(t.icon):null,t.text?k("span",{text:t.text}):null])}function Dl(){return k("span",{className:"editor-toolbar-sep","aria-hidden":"true"})}function QM(){const t=k("select",{className:"editor-toolbar-select",title:"Text color","aria-label":"Text color",onChange:e=>{const n=ht();if(!n)return;const r=e.target.value;r?n.setColor(r).run():n.unsetColor().run()}});for(const e of Gv)t.append(k("option",{value:e.value,text:e.label}));return k("div",{className:"editor-format-toolbar",role:"toolbar","aria-label":"Formatting"},[it({title:"Paragraph",icon:"notes",onClick:()=>{var e;return(e=ht())==null?void 0:e.setParagraph().run()}}),it({title:"Heading 1",text:"H1",onClick:()=>{var e;return(e=ht())==null?void 0:e.toggleHeading({level:1}).run()}}),it({title:"Heading 2",text:"H2",onClick:()=>{var e;return(e=ht())==null?void 0:e.toggleHeading({level:2}).run()}}),it({title:"Heading 3",text:"H3",onClick:()=>{var e;return(e=ht())==null?void 0:e.toggleHeading({level:3}).run()}}),it({title:"Heading 4",text:"H4",onClick:()=>{var e;return(e=ht())==null?void 0:e.toggleHeading({level:4}).run()}}),it({title:"Blockquote",icon:"format_quote",onClick:()=>{var e;return(e=ht())==null?void 0:e.toggleBlockquote().run()}}),Dl(),it({title:"Bold",icon:"format_bold",onClick:()=>{var e;return(e=ht())==null?void 0:e.toggleBold().run()}}),it({title:"Italic",icon:"format_italic",onClick:()=>{var e;return(e=ht())==null?void 0:e.toggleItalic().run()}}),it({title:"Strikethrough",icon:"format_strikethrough",onClick:()=>{var e;return(e=ht())==null?void 0:e.toggleStrike().run()}}),Dl(),t,Dl(),it({title:"Lowercase",text:"aa",onClick:()=>{var e;return(e=h.bodyEditor)==null?void 0:e.transformSelectionCase("lower")}}),it({title:"Uppercase",text:"AA",onClick:()=>{var e;return(e=h.bodyEditor)==null?void 0:e.transformSelectionCase("upper")}}),it({title:"Title case",text:"Aa",onClick:()=>{var e;return(e=h.bodyEditor)==null?void 0:e.transformSelectionCase("title")}})])}function eT(t,e){return t===!0||t==="true"?!0:t===!1||t==="false"?!1:e===!0||e==="true"}function Es(t,e={}){var a;const n=t.name,r=e.target||h.fields,i=e.onChange||(()=>{je()}),o=r[n]??t.default??"",s=k("div",{className:"field"+(n==="title"?" field--title":"")}),l=`field-${e.idPrefix||""}${n}`;if(s.append(k("label",{className:"field-heading",text:t.label||n,htmlFor:l})),t.type==="boolean"){const c=Object.prototype.hasOwnProperty.call(r,n)?r[n]:t.default,u=eT(c,t.default),d=k("input",{id:l,type:"checkbox",className:"field-checkbox",checked:u,onChange:m=>{r[n]=!!m.target.checked,i()}}),p=Qd(t);return s.classList.add("field--boolean"),s.append(k("label",{className:"field-check-row",htmlFor:l},[d,k("span",{className:"field-check-text",text:p||"On"})])),s}if(t.type==="select"&&((a=t.options)!=null&&a.values)){const c=!!t.options.multiple,u=k("select",{id:l,multiple:c,onChange:d=>{c?r[n]=[...d.target.selectedOptions].map(p=>p.value):r[n]=d.target.value,i()}});for(const d of t.options.values){const p=typeof d=="object"?d.value:d,m=c?String(o).includes(p)||Array.isArray(o)&&o.includes(p):String(o)===String(p);u.append(k("option",{value:p,text:p,selected:m}))}s.append(u)}else if(t.type==="object"&&t.list)Array.isArray(r[n])||(r[n]=Array.isArray(o)?o:[]),s.append(tT(t,r[n],{onChange:c=>{r[n]=c,je(),Y()},idPrefix:`${e.idPrefix||""}${n}-`}));else if(t.list&&(t.type==="string"||!t.type)){const c=Array.isArray(o)?o.join(`
276
276
  `):String(o||"");s.append(k("textarea",{id:l,text:c,placeholder:"One item per line",onInput:u=>{r[n]=u.target.value.split(`
data/studio/index.html CHANGED
@@ -18,7 +18,7 @@
18
18
  rel="stylesheet"
19
19
  href="https://cdn.jsdelivr.net/gh/lipis/flag-icons@7.2.3/css/flag-icons.min.css"
20
20
  />
21
- <script type="module" crossorigin src="/studio/assets/index-OAmrbW7i.js"></script>
21
+ <script type="module" crossorigin src="/studio/assets/index-CMVzh8F1.js"></script>
22
22
  <link rel="stylesheet" crossorigin href="/studio/assets/index-Cd1mlY_H.css">
23
23
  </head>
24
24
  <body>
@@ -949,12 +949,14 @@ function applyPipelinePayload(data) {
949
949
  if (data.state === "unconfigured") {
950
950
  state.pipeline.state = "unconfigured";
951
951
  state.pipeline.message =
952
+ data.message ||
952
953
  "Set pandorga.content.workflow in _config.yml (e.g. content-pipeline.yml)";
953
954
  return;
954
955
  }
955
956
  state.pipeline.state = data.state || "idle";
956
957
  if (data.state === "error") {
957
- state.pipeline.message = "Content pipeline failed for this commit.";
958
+ state.pipeline.message =
959
+ data.message || "Content pipeline failed for this commit.";
958
960
  }
959
961
  }
960
962
 
@@ -966,12 +968,9 @@ async function refreshPipelineStatus(sha = null) {
966
968
  applyPipelinePayload(data);
967
969
  renderShell();
968
970
  } catch (err) {
969
- const code = err?.code || "";
970
- if (code === "actions_forbidden" || code === "github_unconfigured") {
971
- state.pipeline.state = "error";
972
- state.pipeline.message = String(err.message || err);
973
- renderShell();
974
- }
971
+ state.pipeline.state = "error";
972
+ state.pipeline.message = String(err.message || err);
973
+ renderShell();
975
974
  }
976
975
  }
977
976
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandorga
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Pandorga contributors
@@ -412,6 +412,7 @@ files:
412
412
  - scripts/test/test-studio-api-contract.rb
413
413
  - scripts/test/test-studio-content-files.rb
414
414
  - scripts/test/test-studio-liquid-roundtrip.mjs
415
+ - scripts/test/test-studio-pipeline-config.mjs
415
416
  - scripts/test/test-studio-rate-limit.mjs
416
417
  - scripts/test/test-studio-rewrite-api-contract.rb
417
418
  - scripts/test/test-studio-rewrite-sanitize.mjs
@@ -449,8 +450,8 @@ files:
449
450
  - studio-app/src/preview/render.js
450
451
  - studio-app/src/styles/studio.css
451
452
  - studio-app/vite.config.js
453
+ - studio/assets/index-CMVzh8F1.js
452
454
  - studio/assets/index-Cd1mlY_H.css
453
- - studio/assets/index-OAmrbW7i.js
454
455
  - studio/index.html
455
456
  - studio/schema.yml
456
457
  - templates/articles/README.md