showai-reader 0.9.0-reader.7lumgn3b → 0.9.0-reader.b6li5g3q

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.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  The [ShowAI](https://showai.renaissancemind.ai) page reader, built from ShowAI 0.9.0 as code-split ES modules. Inline conversation pages written by `render-artifact --cdn` import it and load each component's code only when the page uses it.
4
4
 
5
5
  ```js
6
- const { mount } = await import("https://cdn.jsdelivr.net/npm/showai-reader@0.9.0-reader.7lumgn3b/index.js");
6
+ const { mount } = await import("https://cdn.jsdelivr.net/npm/showai-reader@0.9.0-reader.b6li5g3q/index.js");
7
7
  mount(document.getElementById("page"), { artifact });
8
8
  ```
9
9
 
@@ -1,4 +1,4 @@
1
- import{b as R,c as xe,d as ye}from"./chunk-AD4URO5L.js";import"./chunk-OK4632EO.js";import{b as x,j as Q}from"./chunk-7GHGKKPY.js";import{d as ke,e as Ae}from"./chunk-HIORXCFE.js";import"./chunk-WDYURK6F.js";import{c as Se,e as Le,g as S}from"./chunk-2XAH6DED.js";import{J as me,a as pe,c as dt,eb as ue,hb as ge,kb as ve}from"./chunk-3YAYFUS4.js";import{c as K,d as be,i as we}from"./chunk-DUIGVKKG.js";var u=K(dt(),1);var Ee={html:`<!DOCTYPE html>
1
+ import{b as R,c as we,d as ve}from"./chunk-A3OXCPKD.js";import"./chunk-MGSP3OGB.js";import{b as x,j as Q}from"./chunk-7GHGKKPY.js";import{d as ke,e as Ae}from"./chunk-HIORXCFE.js";import"./chunk-WDYURK6F.js";import{c as Se,e as Le,g as S}from"./chunk-2XAH6DED.js";import{J as me,a as pe,c as dt,eb as ue,hb as ge,kb as be}from"./chunk-3YAYFUS4.js";import{c as K,d as xe,i as ye}from"./chunk-DUIGVKKG.js";var u=K(dt(),1);var Ee={html:`<!DOCTYPE html>
2
2
  <html lang="en" data-theme="dark" data-preset="[VISUAL PRESET]">
3
3
  <head>
4
4
  <meta charset="UTF-8">
@@ -29983,7 +29983,7 @@ ${a.items.map(i=>` <li>${v(i)}</li>`).join(`
29983
29983
  </div>`).join(`
29984
29984
 
29985
29985
  `)}
29986
- </div>`}var De=/ <!-- ARCHIFY:SVG_SLOT_START -->[\s\S]*? <!-- ARCHIFY:SVG_SLOT_END -->/,Ne=/ <!-- ARCHIFY:CARDS_SLOT_START -->[\s\S]*? <!-- ARCHIFY:CARDS_SLOT_END -->/,Fe=/^([ \t]*)<p class="subtitle">\[Subtitle description\]<\/p>[ \t]*(\r?\n)?/m,ae=" <!-- ARCHIFY:SOURCE_EVIDENCE_DATA -->",We=" <!-- ARCHIFY:I18N_DATA -->";function Be(e){return JSON.stringify(e).replaceAll("<","\\u003c").replaceAll(">","\\u003e").replaceAll("&","\\u0026")}var H=['<html lang="en" data-theme="dark" data-preset="[VISUAL PRESET]">',"<title>[PROJECT NAME] Architecture Diagram</title>","<h1>[PROJECT NAME] Architecture</h1>",We];function je(e,{title:t,subtitle:a,svg:i,cards:l,locale:d,visualPreset:n="classic",sourceEvidence:f=null}){if(!De.test(e))throw new Error("applyTemplate: template missing ARCHIFY:SVG_SLOT sentinel");if(!Ne.test(e))throw new Error("applyTemplate: template missing ARCHIFY:CARDS_SLOT sentinel");if(!Fe.test(e))throw new Error("applyTemplate: template missing subtitle placeholder");for(let M of H)if(!e.includes(M))throw new Error(`applyTemplate: template missing placeholder ${JSON.stringify(M)}`);if(f&&!e.includes(ae))throw new Error(`applyTemplate: repository evidence requires placeholder ${JSON.stringify(ae)}`);let p=Be(f),c=te(d),m=Be({locale:c,messages:Ge(c)}),h=typeof a=="string"&&a.trim()?`<p class="subtitle">${v(a)}</p>`:"",w=` <script id="archify-i18n-data" type="application/json">${m}<\/script>`;return Pe(e,c).replace(We,()=>w).replace(H[0],()=>`<html lang="${v(c)}" data-theme="dark" data-preset="${v(n)}">`).replace(H[1],()=>`<title>${v(ne(c,"page.title",{title:t}))}</title>`).replace(H[2],()=>`<h1>${v(t)}</h1>`).replace(Fe,(M,O,G="")=>h?`${O}${h}${G}`:"").replace(De,()=>i).replace(Ne,()=>l).replace(ae,()=>f?` <script id="archify-source-evidence-data" type="application/json">${p}<\/script>`:"")}var W=be("diagram",{"zh-CN":{"family.archify":"Archify \u4EA4\u4E92\u67B6\u6784\u56FE","family.diagramDesign":"Diagram Design \u56FE\u5F62","family.fireworks":"Fireworks \u6280\u672F\u56FE",fileTooLarge:"\u8BF7\u9009\u62E9 8 MiB \u4EE5\u5185\u7684 HTML \u6216 SVG \u6587\u4EF6\u3002",changedElsewhere:"\u56FE\u5F62\u5DF2\u88AB\u5176\u4ED6\u4FEE\u6539\u66F4\u65B0\u3002\u8349\u7A3F\u5DF2\u4FDD\u7559\uFF0C\u8BF7\u91CD\u65B0\u8BFB\u53D6\u5E76\u5408\u5E76\u540E\u4FDD\u5B58\u3002",downloadSvg:"\u4E0B\u8F7D\u56FE\u5F62 SVG",downloadHtml:"\u4E0B\u8F7D\u5B8C\u6574\u56FE\u5F62 HTML",diagram:"\u56FE\u5F62",unlockDescription:"\u64CD\u4F5C\u56FE\u5F62\u5185\u7684\u63A2\u7D22\u3001\u7F29\u653E\u548C\u6EDA\u52A8",template:"\u6A21\u677F",diagramTemplate:"\u56FE\u5F62\u6A21\u677F",customTemplate:"\u5BFC\u5165\u6216\u81EA\u5B9A\u4E49\u56FE\u5F62",title:"\u6807\u9898",diagramTitle:"\u56FE\u5F62\u6807\u9898",height:"\u9AD8\u5EA6",diagramHeight:"\u56FE\u5F62\u9AD8\u5EA6",description:"\u8BF4\u660E",diagramDescription:"\u56FE\u5F62\u8BF4\u660E",labelsSummary:"\u56FE\u4E2D\u6587\u5B57\uFF08{count}\uFF09",labelField:"\u6587\u5B57 {index}",labelInput:"\u56FE\u4E2D\u6587\u5B57 {index}",source:"\u56FE\u5F62\u6E90\u7801",readLabels:"\u8BFB\u53D6\u56FE\u4E2D\u6587\u5B57",importFile:"\u5BFC\u5165 HTML / SVG",importFileInput:"\u5BFC\u5165\u56FE\u5F62\u6587\u4EF6",save:"\u4FDD\u5B58\u56FE\u5F62",cancel:"\u53D6\u6D88","error.missingSvg":"\u56FE\u5F62\u6E90\u7801\u7F3A\u5C11\u5B8C\u6574\u7684 SVG\u3002","error.invalidXml":"SVG \u7684 XML \u7ED3\u6784\u4E0D\u6B63\u786E\u3002","error.structureChanged":"\u56FE\u5F62\u7ED3\u6784\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u8BFB\u53D6\u6587\u5B57\u3002","presentation.notes":"\u8865\u5145\u8BF4\u660E","presentation.label":"\u56FE\u5F62\u5448\u73B0","presentation.compact":"\u7B80\u6D01\uFF1A\u6807\u9898\u4E0E\u8BF4\u660E\u653E\u5728\u56FE\u5916","presentation.original":"\u539F\u7248\uFF1A\u4FDD\u7559\u4E0A\u6E38\u5B8C\u6574\u56FE\u5F62","presentation.custom":"\u81EA\u5B9A\u4E49\u663E\u793A","presentation.titlePosition":"\u6807\u9898\u4F4D\u7F6E","presentation.descriptionPosition":"\u8BF4\u660E\u4F4D\u7F6E","presentation.outside":"\u653E\u5728\u56FE\u5916","presentation.inside":"\u4FDD\u7559\u5728\u56FE\u5185","presentation.hidden":"\u9690\u85CF","presentation.notesDisplay":"\u8865\u5145\u8BF4\u660E\u663E\u793A","presentation.details":"\u6298\u53E0\u5230\u56FE\u5916","presentation.inline":"\u4FDD\u7559\u539F\u4F4D\u7F6E","presentation.legend":"\u663E\u793A\u56FE\u4F8B","presentation.controls":"\u663E\u793A\u9605\u8BFB\u63A7\u4EF6"},en:{"family.archify":"Archify architecture diagram","family.diagramDesign":"Diagram Design graphic","family.fireworks":"Fireworks technical diagram",fileTooLarge:"Choose an HTML or SVG file of 8 MiB or less.",changedElsewhere:"The diagram was updated by another change. Your draft is kept. Reload and merge your changes, then save.",downloadSvg:"Download diagram SVG",downloadHtml:"Download full diagram HTML",diagram:"Diagram",unlockDescription:"Explore, zoom, and scroll inside the diagram",template:"Template",diagramTemplate:"Diagram template",customTemplate:"Import or customize a diagram",title:"Title",diagramTitle:"Diagram title",height:"Height",diagramHeight:"Diagram height",description:"Description",diagramDescription:"Diagram description",labelsSummary:"Text in diagram ({count})",labelField:"Text {index}",labelInput:"Diagram text {index}",source:"Diagram source",readLabels:"Read text from diagram",importFile:"Import HTML / SVG",importFileInput:"Import diagram file",save:"Save diagram",cancel:"Cancel","error.missingSvg":"The diagram source doesn't contain a complete SVG.","error.invalidXml":"The SVG's XML structure is invalid.","error.structureChanged":"The diagram structure has changed. Read the text again.","presentation.notes":"Notes","presentation.label":"Diagram display","presentation.compact":"Compact: title and description outside the diagram","presentation.original":"Original: keep the complete upstream diagram","presentation.custom":"Custom display","presentation.titlePosition":"Title position","presentation.descriptionPosition":"Description position","presentation.outside":"Outside the diagram","presentation.inside":"Inside the diagram","presentation.hidden":"Hidden","presentation.notesDisplay":"Notes display","presentation.details":"Collapsed outside the diagram","presentation.inline":"Keep in place","presentation.legend":"Show legend","presentation.controls":"Show reading controls"}});var j=we(W);function U(e){let t=e.search(/\bclass\s*=\s*["'][^"']*\bdiagram-container\b/i),a=e.slice(t<0?0:t),i=a.search(/<svg\b/i);if(i<0)throw new Error(j("error.missingSvg"));let l=a.slice(i),d=/<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\/?svg\b(?:[^>"']|"[^"]*"|'[^']*')*>/gi,n=0;for(let f of l.matchAll(d))if(!/^<!/.test(f[0])&&(/^<\/svg/i.test(f[0])?n--:/\/\s*>$/.test(f[0])||n++,n===0))return l.slice(0,f.index+f[0].length);throw new Error(j("error.missingSvg"))}function q(e){return U(e).replace(/<svg\b(?:[^>"']|"[^"]*"|'[^']*')*>/i,t=>/\bxmlns\s*=/.test(t)?t:t.replace(/\s*\/?>$/,a=>` xmlns="http://www.w3.org/2000/svg"${a}`))}function re(e){let t=q(e),a=new DOMParser().parseFromString(t,"image/svg+xml");if(a.querySelector("parsererror"))throw new Error(j("error.invalidXml"));return a}function Ue(e){return[...e.querySelectorAll("text")].flatMap(t=>{let a=[...t.querySelectorAll("tspan")];return a.length?a:[t]})}function oe(e){return Ue(re(e)).map(t=>t.textContent??"")}function qe(e,t){let a=U(e),i=re(e),l=Ue(i);if(t.length!==l.length)throw new Error(j("error.structureChanged"));l.forEach((n,f)=>{let p=n.textContent;if(p!==t[f]){n.textContent=t[f];for(let c=n;c&&c!==i.documentElement;c=c.parentElement){for(let h of["data-focus-label","aria-label"])c.getAttribute(h)===p&&c.setAttribute(h,t[f]);let m=["data-node-label","data-node-sublabel","data-node-tag"].filter(h=>p&&c.getAttribute(h)===p);if(m.length){for(let w of m)c.setAttribute(w,t[f]);let h=c.getAttribute("aria-label");h&&c.setAttribute("aria-label",h.replace(p,()=>t[f]));for(let w of c.querySelectorAll(":scope > title"))w.textContent?.includes(p)&&(w.textContent=w.textContent.replace(p,()=>t[f]))}for(let h of c.querySelectorAll(":scope > title"))h.textContent===p&&(h.textContent=t[f])}}});let d=new XMLSerializer().serializeToString(i.documentElement);return e.replace(a,()=>d)}function Ve(e){let t=re(e),a=[...e.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map(d=>d[1]).join(`
29986
+ </div>`}var De=/ <!-- ARCHIFY:SVG_SLOT_START -->[\s\S]*? <!-- ARCHIFY:SVG_SLOT_END -->/,Ne=/ <!-- ARCHIFY:CARDS_SLOT_START -->[\s\S]*? <!-- ARCHIFY:CARDS_SLOT_END -->/,Fe=/^([ \t]*)<p class="subtitle">\[Subtitle description\]<\/p>[ \t]*(\r?\n)?/m,ae=" <!-- ARCHIFY:SOURCE_EVIDENCE_DATA -->",We=" <!-- ARCHIFY:I18N_DATA -->";function Be(e){return JSON.stringify(e).replaceAll("<","\\u003c").replaceAll(">","\\u003e").replaceAll("&","\\u0026")}var H=['<html lang="en" data-theme="dark" data-preset="[VISUAL PRESET]">',"<title>[PROJECT NAME] Architecture Diagram</title>","<h1>[PROJECT NAME] Architecture</h1>",We];function je(e,{title:t,subtitle:a,svg:i,cards:l,locale:d,visualPreset:n="classic",sourceEvidence:f=null}){if(!De.test(e))throw new Error("applyTemplate: template missing ARCHIFY:SVG_SLOT sentinel");if(!Ne.test(e))throw new Error("applyTemplate: template missing ARCHIFY:CARDS_SLOT sentinel");if(!Fe.test(e))throw new Error("applyTemplate: template missing subtitle placeholder");for(let M of H)if(!e.includes(M))throw new Error(`applyTemplate: template missing placeholder ${JSON.stringify(M)}`);if(f&&!e.includes(ae))throw new Error(`applyTemplate: repository evidence requires placeholder ${JSON.stringify(ae)}`);let p=Be(f),c=te(d),m=Be({locale:c,messages:Ge(c)}),h=typeof a=="string"&&a.trim()?`<p class="subtitle">${v(a)}</p>`:"",w=` <script id="archify-i18n-data" type="application/json">${m}<\/script>`;return Pe(e,c).replace(We,()=>w).replace(H[0],()=>`<html lang="${v(c)}" data-theme="dark" data-preset="${v(n)}">`).replace(H[1],()=>`<title>${v(ne(c,"page.title",{title:t}))}</title>`).replace(H[2],()=>`<h1>${v(t)}</h1>`).replace(Fe,(M,O,G="")=>h?`${O}${h}${G}`:"").replace(De,()=>i).replace(Ne,()=>l).replace(ae,()=>f?` <script id="archify-source-evidence-data" type="application/json">${p}<\/script>`:"")}var W=xe("diagram",{"zh-CN":{"family.archify":"Archify \u4EA4\u4E92\u67B6\u6784\u56FE","family.diagramDesign":"Diagram Design \u56FE\u5F62","family.fireworks":"Fireworks \u6280\u672F\u56FE",fileTooLarge:"\u8BF7\u9009\u62E9 8 MiB \u4EE5\u5185\u7684 HTML \u6216 SVG \u6587\u4EF6\u3002",changedElsewhere:"\u56FE\u5F62\u5DF2\u88AB\u5176\u4ED6\u4FEE\u6539\u66F4\u65B0\u3002\u8349\u7A3F\u5DF2\u4FDD\u7559\uFF0C\u8BF7\u91CD\u65B0\u8BFB\u53D6\u5E76\u5408\u5E76\u540E\u4FDD\u5B58\u3002",downloadSvg:"\u4E0B\u8F7D\u56FE\u5F62 SVG",downloadHtml:"\u4E0B\u8F7D\u5B8C\u6574\u56FE\u5F62 HTML",diagram:"\u56FE\u5F62",unlockDescription:"\u64CD\u4F5C\u56FE\u5F62\u5185\u7684\u63A2\u7D22\u3001\u7F29\u653E\u548C\u6EDA\u52A8",template:"\u6A21\u677F",diagramTemplate:"\u56FE\u5F62\u6A21\u677F",customTemplate:"\u5BFC\u5165\u6216\u81EA\u5B9A\u4E49\u56FE\u5F62",title:"\u6807\u9898",diagramTitle:"\u56FE\u5F62\u6807\u9898",height:"\u9AD8\u5EA6",diagramHeight:"\u56FE\u5F62\u9AD8\u5EA6",description:"\u8BF4\u660E",diagramDescription:"\u56FE\u5F62\u8BF4\u660E",labelsSummary:"\u56FE\u4E2D\u6587\u5B57\uFF08{count}\uFF09",labelField:"\u6587\u5B57 {index}",labelInput:"\u56FE\u4E2D\u6587\u5B57 {index}",source:"\u56FE\u5F62\u6E90\u7801",readLabels:"\u8BFB\u53D6\u56FE\u4E2D\u6587\u5B57",importFile:"\u5BFC\u5165 HTML / SVG",importFileInput:"\u5BFC\u5165\u56FE\u5F62\u6587\u4EF6",save:"\u4FDD\u5B58\u56FE\u5F62",cancel:"\u53D6\u6D88","error.missingSvg":"\u56FE\u5F62\u6E90\u7801\u7F3A\u5C11\u5B8C\u6574\u7684 SVG\u3002","error.invalidXml":"SVG \u7684 XML \u7ED3\u6784\u4E0D\u6B63\u786E\u3002","error.structureChanged":"\u56FE\u5F62\u7ED3\u6784\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u8BFB\u53D6\u6587\u5B57\u3002","presentation.notes":"\u8865\u5145\u8BF4\u660E","presentation.label":"\u56FE\u5F62\u5448\u73B0","presentation.compact":"\u7B80\u6D01\uFF1A\u6807\u9898\u4E0E\u8BF4\u660E\u653E\u5728\u56FE\u5916","presentation.original":"\u539F\u7248\uFF1A\u4FDD\u7559\u4E0A\u6E38\u5B8C\u6574\u56FE\u5F62","presentation.custom":"\u81EA\u5B9A\u4E49\u663E\u793A","presentation.titlePosition":"\u6807\u9898\u4F4D\u7F6E","presentation.descriptionPosition":"\u8BF4\u660E\u4F4D\u7F6E","presentation.outside":"\u653E\u5728\u56FE\u5916","presentation.inside":"\u4FDD\u7559\u5728\u56FE\u5185","presentation.hidden":"\u9690\u85CF","presentation.notesDisplay":"\u8865\u5145\u8BF4\u660E\u663E\u793A","presentation.details":"\u6298\u53E0\u5230\u56FE\u5916","presentation.inline":"\u4FDD\u7559\u539F\u4F4D\u7F6E","presentation.legend":"\u663E\u793A\u56FE\u4F8B","presentation.controls":"\u663E\u793A\u9605\u8BFB\u63A7\u4EF6"},en:{"family.archify":"Archify architecture diagram","family.diagramDesign":"Diagram Design graphic","family.fireworks":"Fireworks technical diagram",fileTooLarge:"Choose an HTML or SVG file of 8 MiB or less.",changedElsewhere:"The diagram was updated by another change. Your draft is kept. Reload and merge your changes, then save.",downloadSvg:"Download diagram SVG",downloadHtml:"Download full diagram HTML",diagram:"Diagram",unlockDescription:"Explore, zoom, and scroll inside the diagram",template:"Template",diagramTemplate:"Diagram template",customTemplate:"Import or customize a diagram",title:"Title",diagramTitle:"Diagram title",height:"Height",diagramHeight:"Diagram height",description:"Description",diagramDescription:"Diagram description",labelsSummary:"Text in diagram ({count})",labelField:"Text {index}",labelInput:"Diagram text {index}",source:"Diagram source",readLabels:"Read text from diagram",importFile:"Import HTML / SVG",importFileInput:"Import diagram file",save:"Save diagram",cancel:"Cancel","error.missingSvg":"The diagram source doesn't contain a complete SVG.","error.invalidXml":"The SVG's XML structure is invalid.","error.structureChanged":"The diagram structure has changed. Read the text again.","presentation.notes":"Notes","presentation.label":"Diagram display","presentation.compact":"Compact: title and description outside the diagram","presentation.original":"Original: keep the complete upstream diagram","presentation.custom":"Custom display","presentation.titlePosition":"Title position","presentation.descriptionPosition":"Description position","presentation.outside":"Outside the diagram","presentation.inside":"Inside the diagram","presentation.hidden":"Hidden","presentation.notesDisplay":"Notes display","presentation.details":"Collapsed outside the diagram","presentation.inline":"Keep in place","presentation.legend":"Show legend","presentation.controls":"Show reading controls"}});var j=ye(W);function U(e){let t=e.search(/\bclass\s*=\s*["'][^"']*\bdiagram-container\b/i),a=e.slice(t<0?0:t),i=a.search(/<svg\b/i);if(i<0)throw new Error(j("error.missingSvg"));let l=a.slice(i),d=/<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\/?svg\b(?:[^>"']|"[^"]*"|'[^']*')*>/gi,n=0;for(let f of l.matchAll(d))if(!/^<!/.test(f[0])&&(/^<\/svg/i.test(f[0])?n--:/\/\s*>$/.test(f[0])||n++,n===0))return l.slice(0,f.index+f[0].length);throw new Error(j("error.missingSvg"))}function q(e){return U(e).replace(/<svg\b(?:[^>"']|"[^"]*"|'[^']*')*>/i,t=>/\bxmlns\s*=/.test(t)?t:t.replace(/\s*\/?>$/,a=>` xmlns="http://www.w3.org/2000/svg"${a}`))}function re(e){let t=q(e),a=new DOMParser().parseFromString(t,"image/svg+xml");if(a.querySelector("parsererror"))throw new Error(j("error.invalidXml"));return a}function Ue(e){return[...e.querySelectorAll("text")].flatMap(t=>{let a=[...t.querySelectorAll("tspan")];return a.length?a:[t]})}function oe(e){return Ue(re(e)).map(t=>t.textContent??"")}function qe(e,t){let a=U(e),i=re(e),l=Ue(i);if(t.length!==l.length)throw new Error(j("error.structureChanged"));l.forEach((n,f)=>{let p=n.textContent;if(p!==t[f]){n.textContent=t[f];for(let c=n;c&&c!==i.documentElement;c=c.parentElement){for(let h of["data-focus-label","aria-label"])c.getAttribute(h)===p&&c.setAttribute(h,t[f]);let m=["data-node-label","data-node-sublabel","data-node-tag"].filter(h=>p&&c.getAttribute(h)===p);if(m.length){for(let w of m)c.setAttribute(w,t[f]);let h=c.getAttribute("aria-label");h&&c.setAttribute("aria-label",h.replace(p,()=>t[f]));for(let w of c.querySelectorAll(":scope > title"))w.textContent?.includes(p)&&(w.textContent=w.textContent.replace(p,()=>t[f]))}for(let h of c.querySelectorAll(":scope > title"))h.textContent===p&&(h.textContent=t[f])}}});let d=new XMLSerializer().serializeToString(i.documentElement);return e.replace(a,()=>d)}function Ve(e){let t=re(e),a=[...e.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map(d=>d[1]).join(`
29987
29987
  `),i=t.createElementNS("http://www.w3.org/2000/svg","style");i.textContent=a,t.documentElement.prepend(i);let l=e.match(/<html\b[^>]*>/i)?.[0]??"";for(let d of["data-theme","data-preset"]){let n=l.match(new RegExp(`${d}="([^"]*)"`))?.[1];n&&t.documentElement.setAttribute(d,n)}return new XMLSerializer().serializeToString(t.documentElement)}var L={title:"inside",description:"inside",notes:"inline",legend:!0,controls:!0},se={title:"outside",description:"outside",notes:"hidden",legend:!0,controls:!0};function k(e){return e.presentation?{...L,...e.presentation}:L}function ie(e){return new DOMParser().parseFromString(e.replace(/<[^>]*>/g,""),"text/html").body.textContent?.trim()??""}function Tt(e){let t=e.search(/<div\b[^>]*class=["'][^"']*\bcards\b[^"']*["'][^>]*>/i);if(t<0)return[];let a=e.slice(t),i=0;for(let l of a.matchAll(/<\/?div\b[^>]*>/gi))if(i+=/^<\//.test(l[0])?-1:1,i===0)return[ie(a.slice(0,l.index+l[0].length).replace(/<\/(?:h3|p|li)>/gi,"$& "))].filter(Boolean);return[]}function Ye(e){let t=new DOMParser().parseFromString(q(e),"image/svg+xml"),a=e.match(/<h1\b[^>]*>([\s\S]*?)<\/h1>/i),i=e.match(/<p\b[^>]*class=["'][^"']*\bsubtitle\b[^"']*["'][^>]*>([\s\S]*?)<\/p>/i);return{title:a?ie(a[1]):t.querySelector("svg > text.title, svg > g#title text.title, svg > title")?.textContent?.trim()??"",description:i?ie(i[1]):t.querySelector("svg > text.subtitle, svg > text.title + text.detail, svg > g#title text.subtitle, svg > desc")?.textContent?.trim()??"",notes:[...t.querySelectorAll("svg > text.footnote, svg > g#footer, svg > g.footer, svg > g[data-graph-role=legend] + text.detail")].map(l=>l.textContent?.trim()??"").filter(Boolean).concat(Tt(e))}}function Ke(e,t){if(JSON.stringify(t)===JSON.stringify(L))return e;let a=U(e),i=new DOMParser().parseFromString(q(e),"image/svg+xml"),l=i.documentElement,d=(c,m)=>{if(m)for(let h of i.querySelectorAll(c))h.setAttribute("data-showai-diagram-hidden","true")};d("svg > text.title, svg > g#title > text.title",t.title!=="inside"),d("svg > text.subtitle, svg > text.title + text.detail, svg > g#title > text.subtitle",t.description!=="inside"),d("svg > g#footer, svg > g.footer, svg > text.footnote, svg > g[data-graph-role=legend] + text.detail",t.notes!=="inline"),d("svg > g#legend, svg > g.legend, svg > g[data-graph-role=legend]",!t.legend);let n=i.createElementNS("http://www.w3.org/2000/svg","style");n.textContent="[data-showai-diagram-hidden=true]{display:none!important}",l.prepend(n);let f=[...i.querySelectorAll("svg > text[data-showai-diagram-hidden=true],svg > g#title > text[data-showai-diagram-hidden=true]")].filter(c=>c.matches(".title,.subtitle")||c.matches(".detail")&&c.previousElementSibling?.matches("text.title")),p=l.getAttribute("viewBox")?.split(/[ ,]+/).map(Number);if(p?.length===4&&f.length){let c=Math.max(...f.map(h=>Number(h.getAttribute("y")??0)+12)),m=[...i.querySelectorAll('[data-graph-role="node"],[data-graph-role="container"]')].map(h=>Number(h.getAttribute("data-graph-bounds")?.split(",")[1])).filter(Number.isFinite);if(m.length){let h=Math.min(c,Math.min(...m)-16);h>p[1]&&h<p[1]+p[3]&&l.setAttribute("viewBox",`${p[0]} ${h} ${p[2]} ${p[3]-(h-p[1])}`)}}return e.replace(a,()=>new XMLSerializer().serializeToString(l))}function Qe(e){return`${e.title!=="inside"?".header h1,.frame>h1,.frame>.eyebrow,.header .pulse-dot{display:none!important}":""}
29988
29988
  ${e.description!=="inside"?".header>p.subtitle,.frame>p.subtitle{display:none!important}":""}
29989
29989
  ${e.title!=="inside"&&e.description!=="inside"?".header,.header-row{margin:0!important;padding:0!important;min-height:0!important}.header:has(h1){display:none!important}":""}
@@ -30003,6 +30003,6 @@ ${l}`).join(`
30003
30003
  --><style>${X.css}</style>${t}`}function Je(e,t,a,i){let l=n=>n.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;");if(!t&&!a&&!i.length)return e;let d=`<section style="max-width:1120px;margin:20px auto;font-family:system-ui,sans-serif">${t?`<h2>${l(t)}</h2>`:""}${a?`<p>${l(a)}</p>`:""}${i.length?`<details><summary>\u8865\u5145\u8BF4\u660E</summary>${i.map(n=>`<p>${l(n)}</p>`).join("")}</details>`:""}</section>`;return/<body\b[^>]*>/i.test(e)?e.replace(/<body\b[^>]*>/i,n=>n+d):e.replace(/<style>/i,d+"<style>")}function _e(e,t,a=L){let i="default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; font-src data:; connect-src 'none'; frame-src 'none'; base-uri 'none'; form-action 'none'",l=JSON.stringify(a)!==JSON.stringify(L),d=/<html\b|<body\b/i.test(t)?"":"body{margin:0;padding:12px}body>svg{display:block;width:100%;height:auto}";return`<!doctype html><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${i}"><!--
30004
30004
  ${de(e).replaceAll("--","\u2014")}
30005
30005
  -->${t}<style>${d}${l?Qe(a):""}</style>`}pe(`.sb-external-diagram{min-width:0;position:relative}.sb-diagram-frame{display:block;width:100%;border:0;border-radius:8px;background:var(--paper, #fff)}.sb-diagram-editor{display:grid;gap:12px;width:min(100%,520px);padding:12px}.sb-diagram-fields{display:grid;grid-template-columns:minmax(0,1fr) 100px;gap:10px}.sb-diagram-display-settings{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px}.sb-diagram-editor .sb-diagram-toggle{display:flex;align-items:center;gap:6px}.sb-diagram-editor .sb-diagram-toggle input{width:auto}.sb-diagram-notes{margin:8px 0;color:var(--muted)}.sb-diagram-editor select,.sb-diagram-editor input:not([type=file]),.sb-diagram-editor textarea{width:100%;min-width:0}.sb-diagram-editor details>summary{cursor:pointer;padding:8px 0;color:var(--text)}.sb-diagram-labels>div{display:grid;gap:8px;max-height:320px;overflow:auto;padding:4px}.sb-diagram-source{font-family:ui-monospace,monospace;font-size:12px;resize:vertical;margin-bottom:8px}.sb-diagram-upload{width:fit-content;cursor:pointer}.sb-diagram-upload input{display:none}.sb-diagram-editor .sb-editor-footer{display:flex;gap:8px}@media(max-width:420px){.sb-diagram-fields{grid-template-columns:minmax(0,1fr)}}@media print{.sb-external-diagram .viewport-lock-button{display:none}}
30006
- `);var r=K(ge(),1),It={archify:"family.archify","diagram-design":"family.diagramDesign","fireworks-tech-graph":"family.fireworks"};function ce({family:e,data:t,onChange:a,readOnly:i}){let l=(0,u.useRef)(null),[d]=(0,u.useState)(()=>crypto.randomUUID());ye(l,d);let n=ve(W),f=n(It[e]),p=(0,u.useMemo)(()=>le(e),[e]),c=(0,u.useMemo)(()=>Xe(e,t),[e,t]),m=(0,u.useMemo)(()=>k(t),[t]),h=(0,u.useMemo)(()=>Ye(c),[c]),w=(0,u.useMemo)(()=>Ke(Ze(e,c),m),[e,c,m]),M=(0,u.useMemo)(()=>_e(e,w,m)+`<script>(${xe.toString()})(${JSON.stringify(d)});<\/script>`,[e,w,m,d]),O=m.title==="outside"?x(t.title,h.title):!t.presentation&&m.title==="inside"?x(t.title):"",G=m.description==="outside"?x(t.description,h.description):!t.presentation&&m.description==="inside"?x(t.description):"",T=ke(`diagram-${e}`),he=(0,u.useRef)(""),[P,I]=(0,u.useState)(!1),[g,b]=(0,u.useState)({}),[V,D]=(0,u.useState)([]),[$e,Y]=(0,u.useState)(!1),[N,A]=(0,u.useState)(""),[et,fe]=(0,u.useState)(!1),tt=!!(a&&!i);(0,u.useEffect)(()=>fe(!1),[M]);let F=o=>{try{D(oe(o)),Y(!1),A("")}catch(s){D([]),A(s instanceof Error?s.message:String(s))}},nt=()=>{if(P){I(!1);return}he.current=JSON.stringify(t),b({...t,source:c}),F(c),I(!0)},at=o=>{if(o==="custom"){b(y=>({...y,template:o}));return}let s=p.find(y=>y.id===o);b(y=>({...y,template:o,source:s.source})),F(s.source)},rt=async o=>{if(o.size>8*1024*1024){A(n("fileTooLarge"));return}try{let s=await o.text();R(e,{template:"custom",source:s}),b(y=>({...y,template:"custom",source:s})),F(s)}catch(s){A(s instanceof Error?s.message:String(s))}},ot=()=>{if(JSON.stringify(t)!==he.current){A(n("changedElsewhere"));return}try{let o={...g,source:$e?qe(x(g.source),V):x(g.source)};R(e,o),oe(o.source),a?.(o),I(!1),A("")}catch(o){A(o instanceof Error?o.message:String(o))}},it=()=>{try{let o=Ve(w);Q(`<!--
30006
+ `);var r=K(ge(),1),It={archify:"family.archify","diagram-design":"family.diagramDesign","fireworks-tech-graph":"family.fireworks"};function ce({family:e,data:t,onChange:a,readOnly:i}){let l=(0,u.useRef)(null),[d]=(0,u.useState)(()=>crypto.randomUUID());ve(l,d);let n=be(W),f=n(It[e]),p=(0,u.useMemo)(()=>le(e),[e]),c=(0,u.useMemo)(()=>Xe(e,t),[e,t]),m=(0,u.useMemo)(()=>k(t),[t]),h=(0,u.useMemo)(()=>Ye(c),[c]),w=(0,u.useMemo)(()=>Ke(Ze(e,c),m),[e,c,m]),M=(0,u.useMemo)(()=>_e(e,w,m)+`<script>${we(d)}<\/script>`,[e,w,m,d]),O=m.title==="outside"?x(t.title,h.title):!t.presentation&&m.title==="inside"?x(t.title):"",G=m.description==="outside"?x(t.description,h.description):!t.presentation&&m.description==="inside"?x(t.description):"",T=ke(`diagram-${e}`),he=(0,u.useRef)(""),[P,I]=(0,u.useState)(!1),[g,b]=(0,u.useState)({}),[V,D]=(0,u.useState)([]),[$e,Y]=(0,u.useState)(!1),[N,A]=(0,u.useState)(""),[et,fe]=(0,u.useState)(!1),tt=!!(a&&!i);(0,u.useEffect)(()=>fe(!1),[M]);let F=o=>{try{D(oe(o)),Y(!1),A("")}catch(s){D([]),A(s instanceof Error?s.message:String(s))}},nt=()=>{if(P){I(!1);return}he.current=JSON.stringify(t),b({...t,source:c}),F(c),I(!0)},at=o=>{if(o==="custom"){b(y=>({...y,template:o}));return}let s=p.find(y=>y.id===o);b(y=>({...y,template:o,source:s.source})),F(s.source)},rt=async o=>{if(o.size>8*1024*1024){A(n("fileTooLarge"));return}try{let s=await o.text();R(e,{template:"custom",source:s}),b(y=>({...y,template:"custom",source:s})),F(s)}catch(s){A(s instanceof Error?s.message:String(s))}},ot=()=>{if(JSON.stringify(t)!==he.current){A(n("changedElsewhere"));return}try{let o={...g,source:$e?qe(x(g.source),V):x(g.source)};R(e,o),oe(o.source),a?.(o),I(!1),A("")}catch(o){A(o instanceof Error?o.message:String(o))}},it=()=>{try{let o=Ve(w);Q(`<!--
30007
30007
  ${de(e).replaceAll("--","\u2014")}
30008
30008
  -->${o}`,`${e}.svg`,"image/svg+xml"),A("")}catch(o){A(o instanceof Error?o.message:String(o))}};return(0,r.jsxs)("section",{ref:T.ref,className:"sb-block sb-external-diagram","aria-label":x(t.title,f),"data-diagram-family":e,"data-viewport-lock-scope":`diagram-${e}`,"data-viewport-locked":T.locked,"data-diagram-ready":et,children:[(0,r.jsxs)(Le,{title:O||f,defaultTitle:f,description:G,editable:tt,editing:P,onEdit:nt,children:[(0,r.jsx)("button",{type:"button",className:"sb-icon-button","aria-label":n("downloadSvg"),title:n("downloadSvg"),onClick:it,children:(0,r.jsx)(me,{size:16})}),(0,r.jsx)("button",{type:"button",className:"sb-icon-button","aria-label":n("downloadHtml"),title:n("downloadHtml"),onClick:()=>Q(Je(M,O,G,m.notes==="details"?h.notes:[]),`${e}.html`,"text/html"),children:"HTML"})]}),m.notes==="details"&&h.notes.length>0&&(0,r.jsxs)("details",{className:"sb-diagram-notes",children:[(0,r.jsx)("summary",{children:n("presentation.notes")}),h.notes.map((o,s)=>(0,r.jsx)("p",{children:o},s))]}),(0,r.jsx)(Ae,{...T,label:n("diagram"),unlockDescription:n("unlockDescription")}),(0,r.jsx)("iframe",{ref:l,title:x(t.title,f),className:"sb-diagram-frame",sandbox:"allow-scripts allow-downloads",referrerPolicy:"no-referrer",srcDoc:M,style:{height:Number(t.height??560),pointerEvents:T.locked?"none":"auto"},tabIndex:T.locked?-1:0,onLoad:()=>fe(!0)}),N&&!P&&(0,r.jsx)("p",{className:"sb-error",role:"alert",children:N}),P&&(0,r.jsx)(Se,{children:(0,r.jsxs)("div",{className:"sb-diagram-editor",onKeyDown:o=>{o.stopPropagation(),o.key==="Escape"&&I(!1)},children:[(0,r.jsx)(S,{label:n("presentation.label"),children:(0,r.jsxs)("select",{"aria-label":n("presentation.label"),value:JSON.stringify(k(g))===JSON.stringify(L)?"original":JSON.stringify(k(g))===JSON.stringify(se)?"compact":"custom",onChange:o=>{o.target.value!=="custom"&&b(s=>({...s,presentation:o.target.value==="original"?L:se}))},children:[(0,r.jsx)("option",{value:"compact",children:n("presentation.compact")}),(0,r.jsx)("option",{value:"original",children:n("presentation.original")}),(0,r.jsx)("option",{value:"custom",children:n("presentation.custom")})]})}),(0,r.jsxs)("div",{className:"sb-diagram-display-settings",children:[[["title","presentation.titlePosition"],["description","presentation.descriptionPosition"]].map(([o,s])=>(0,r.jsx)(S,{label:n(s),children:(0,r.jsxs)("select",{"aria-label":n(s),value:k(g)[o],onChange:y=>b(C=>({...C,presentation:{...k(C),[o]:y.target.value}})),children:[(0,r.jsx)("option",{value:"outside",children:n("presentation.outside")}),(0,r.jsx)("option",{value:"inside",children:n("presentation.inside")}),(0,r.jsx)("option",{value:"hidden",children:n("presentation.hidden")})]})},o)),(0,r.jsx)(S,{label:n("presentation.notes"),children:(0,r.jsxs)("select",{"aria-label":n("presentation.notesDisplay"),value:k(g).notes,onChange:o=>b(s=>({...s,presentation:{...k(s),notes:o.target.value}})),children:[(0,r.jsx)("option",{value:"hidden",children:n("presentation.hidden")}),(0,r.jsx)("option",{value:"details",children:n("presentation.details")}),(0,r.jsx)("option",{value:"inline",children:n("presentation.inline")})]})}),[["legend","presentation.legend"],["controls","presentation.controls"]].map(([o,s])=>(0,r.jsxs)("label",{className:"sb-diagram-toggle",children:[(0,r.jsx)("input",{"aria-label":n(s),type:"checkbox",checked:k(g)[o],onChange:y=>b(C=>({...C,presentation:{...k(C),[o]:y.target.checked}}))}),n(s)]},o))]}),(0,r.jsx)(S,{label:n("template"),children:(0,r.jsxs)("select",{"aria-label":n("diagramTemplate"),value:x(g.template),onChange:o=>at(o.target.value),children:[p.map(o=>(0,r.jsx)("option",{value:o.id,children:o.name},o.id)),(0,r.jsx)("option",{value:"custom",children:n("customTemplate")})]})}),(0,r.jsxs)("div",{className:"sb-diagram-fields",children:[(0,r.jsx)(S,{label:n("title"),children:(0,r.jsx)("input",{"aria-label":n("diagramTitle"),value:x(g.title),onChange:o=>b(s=>({...s,title:o.target.value}))})}),(0,r.jsx)(S,{label:n("height"),children:(0,r.jsx)("input",{"aria-label":n("diagramHeight"),type:"number",min:240,max:1200,value:Number(g.height??560),onChange:o=>b(s=>({...s,height:Number(o.target.value)}))})})]}),(0,r.jsx)(S,{label:n("description"),children:(0,r.jsx)("textarea",{"aria-label":n("diagramDescription"),rows:2,value:x(g.description),onChange:o=>b(s=>({...s,description:o.target.value}))})}),(0,r.jsxs)("details",{className:"sb-diagram-labels",children:[(0,r.jsx)("summary",{children:n("labelsSummary",{count:V.length})}),(0,r.jsx)("div",{children:V.map((o,s)=>(0,r.jsx)(S,{label:n("labelField",{index:s+1}),children:(0,r.jsx)("input",{"aria-label":n("labelInput",{index:s+1}),value:o,onChange:y=>{D(C=>C.map((st,lt)=>lt===s?y.target.value:st)),Y(!0)}})},s))})]}),(0,r.jsxs)("details",{children:[(0,r.jsx)("summary",{children:n("source")}),(0,r.jsx)("textarea",{"aria-label":n("source"),className:"sb-diagram-source",rows:12,spellCheck:!1,value:x(g.source),onChange:o=>{b(s=>({...s,source:o.target.value})),D([]),Y(!1)}}),(0,r.jsx)("button",{type:"button",className:"sb-button",onClick:()=>F(x(g.source)),children:n("readLabels")})]}),(0,r.jsxs)("label",{className:"sb-button sb-diagram-upload",children:[(0,r.jsx)(ue,{size:14}),n("importFile"),(0,r.jsx)("input",{type:"file","aria-label":n("importFileInput"),accept:".html,.htm,.svg,text/html,image/svg+xml",onChange:o=>{let s=o.target.files?.[0];s&&rt(s),o.target.value=""}})]}),N&&(0,r.jsx)("p",{className:"sb-error",role:"alert",children:N}),(0,r.jsxs)("div",{className:"sb-editor-footer",children:[(0,r.jsx)("button",{type:"button",className:"sb-button",onClick:ot,children:n("save")}),(0,r.jsx)("button",{type:"button",className:"sb-button",onClick:()=>I(!1),children:n("cancel")})]})]})})]})}function Sn(e){return(0,r.jsx)(ce,{...e,family:"archify"})}function Ln(e){return(0,r.jsx)(ce,{...e,family:"diagram-design"})}function En(e){return(0,r.jsx)(ce,{...e,family:"fireworks-tech-graph"})}export{Sn as ArchifyBlock,Ln as DiagramDesignBlock,En as FireworksTechGraphBlock};