@pi-outpost/embed 0.48.0 → 0.50.0
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/dist/{conversationExport-CXmq8l0b.cjs → conversationExport-CxRhxbfS.cjs} +2 -2
- package/dist/{conversationExport-BZ08h6Er.js → conversationExport-DFrrfjnb.js} +53 -53
- package/dist/{conversationHistory-iHvZAmNN.cjs → conversationHistory-DuKHGllw.cjs} +1 -1
- package/dist/{conversationHistory-D4iAdrF9.js → conversationHistory-Dy4nNb-F.js} +1 -1
- package/dist/pi-outpost-embed.cjs +100 -31
- package/dist/pi-outpost-embed.js +4176 -3882
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./conversationHistory-
|
|
1
|
+
const e=require("./conversationHistory-DuKHGllw.cjs"),t=require("./lib-CRTt_FoR.cjs"),n=require("./download-U7JEZ6c9.cjs"),r=require("./mermaidToImage-Ckx06W6z.cjs"),i=require("./loadReferencedImage-RUfxAG0o.cjs");var a=/["&'<>`]/g,o=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,s=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,c=/[|\\{}()[\]^$+*?.]/g,l=new WeakMap;function u(e,t){return e=e.replace(t.subset?d(t.subset):a,r),t.subset||t.escapeOnly?e:e.replace(o,n).replace(s,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function d(e){let t=l.get(e);return t||(t=ee(e),l.set(e,t)),t}function ee(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(c,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var f=/[\dA-Fa-f]/;function p(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!f.test(String.fromCharCode(t))?r:r+`;`}var m=/\d/;function te(e,t,n){let r=`&#`+String(e);return n&&t&&!m.test(String.fromCharCode(t))?r:r+`;`}var ne=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),h={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},re=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],g={}.hasOwnProperty,_={},v;for(v in h)g.call(h,v)&&(_[h[v]]=v);var y=/[^\dA-Za-z]/;function b(e,t,n,r){let i=String.fromCharCode(e);if(g.call(_,i)){let e=_[i],a=`&`+e;return n&&ne.includes(e)&&!re.includes(e)&&(!r||t&&t!==61&&y.test(String.fromCharCode(t)))?a:a+`;`}return``}function ie(e,t,n){let r=p(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=b(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=te(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function x(e,t){return u(e,Object.assign({format:ie},t))}var ae=/^>|^->|<!--|-->|--!>|<!-$/g,oe=[`>`],se=[`<`,`>`];function ce(e,t,n,r){return r.settings.bogusComments?`<?`+x(e.value,Object.assign({},r.settings.characterReferences,{subset:oe}))+`>`:`<!--`+e.value.replace(ae,i)+`-->`;function i(e){return x(e,Object.assign({},r.settings.characterReferences,{subset:se}))}}function le(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}var S=w(1),C=w(-1),ue=[];function w(t){return n;function n(n,r,i){let a=n?n.children:ue,o=(r||0)+t,s=a[o];if(!i)for(;s&&e.C(s);)o+=t,s=a[o];return s}}var T={}.hasOwnProperty;function E(e){return t;function t(t,n,r){return T.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var D=E({body:A,caption:O,colgroup:O,dd:P,dt:N,head:O,html:k,li:M,optgroup:I,option:L,p:j,rp:F,rt:F,tbody:z,td:H,tfoot:B,th:H,thead:R,tr:V});function O(t,n,r){let i=S(r,n,!0);return!i||i.type!==`comment`&&!(i.type===`text`&&e.C(i.value.charAt(0)))}function k(e,t,n){let r=S(n,t);return!r||r.type!==`comment`}function A(e,t,n){let r=S(n,t);return!r||r.type!==`comment`}function j(e,t,n){let r=S(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function M(e,t,n){let r=S(n,t);return!r||r.type===`element`&&r.tagName===`li`}function N(e,t,n){let r=S(n,t);return!(!r||r.type!==`element`||r.tagName!==`dt`&&r.tagName!==`dd`)}function P(e,t,n){let r=S(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function F(e,t,n){let r=S(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function I(e,t,n){let r=S(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function L(e,t,n){let r=S(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function R(e,t,n){let r=S(n,t);return!(!r||r.type!==`element`||r.tagName!==`tbody`&&r.tagName!==`tfoot`)}function z(e,t,n){let r=S(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function B(e,t,n){return!S(n,t)}function V(e,t,n){let r=S(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function H(e,t,n){let r=S(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var U=E({body:pe,colgroup:me,head:fe,html:de,tbody:he});function de(e){let t=S(e,-1);return!t||t.type!==`comment`}function fe(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function pe(t){let n=S(t,-1,!0);return!n||n.type!==`comment`&&!(n.type===`text`&&e.C(n.value.charAt(0)))&&(n.type!==`element`||n.tagName!==`meta`&&n.tagName!==`link`&&n.tagName!==`script`&&n.tagName!==`style`&&n.tagName!==`template`)}function me(e,t,n){let r=C(n,t),i=S(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&D(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function he(e,t,n){let r=C(n,t),i=S(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&D(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var W={name:[[`
|
|
2
2
|
\f\r &/=>`.split(``),`
|
|
3
3
|
\f\r "&'/=>\``.split(``)],[`\0
|
|
4
4
|
\f\r "&'/<=>`.split(``),`\0
|
|
@@ -6,7 +6,7 @@ const e=require("./conversationHistory-iHvZAmNN.cjs"),t=require("./lib-CRTt_FoR.
|
|
|
6
6
|
\f\r &>`.split(``),`\0
|
|
7
7
|
\f\r "&'<=>\``.split(``)],[`\0
|
|
8
8
|
\f\r "&'<=>\``.split(``),`\0
|
|
9
|
-
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function ge(t,n,r,i){let a=i.schema,o=a.space!==`svg`&&i.settings.omitOptionalTags,s=a.space===`svg`?i.settings.closeEmptyElements:i.settings.voids.includes(t.tagName.toLowerCase()),c=[],l;a.space===`html`&&t.tagName===`svg`&&(i.schema=e.
|
|
9
|
+
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function ge(t,n,r,i){let a=i.schema,o=a.space!==`svg`&&i.settings.omitOptionalTags,s=a.space===`svg`?i.settings.closeEmptyElements:i.settings.voids.includes(t.tagName.toLowerCase()),c=[],l;a.space===`html`&&t.tagName===`svg`&&(i.schema=e.x);let u=_e(i,t.properties),d=i.all(a.space===`html`&&t.tagName===`template`?t.content:t);return i.schema=a,d&&(s=!1),(u||!o||!U(t,n,r))&&(c.push(`<`,t.tagName,u?` `+u:``),s&&(a.space===`svg`||i.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!i.settings.tightSelfClosing||l===`/`||l&&l!==`"`&&l!==`'`)&&c.push(` `),c.push(`/`)),c.push(`>`)),c.push(d),!s&&(!o||!D(t,n,r))&&c.push(`</`+t.tagName+`>`),c.join(``)}function _e(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=ve(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function ve(n,r,i){let a=e.S(n.schema,r),o=n.settings.allowParseErrors&&n.schema.space===`html`?0:1,s=+!n.settings.allowDangerousCharacters,c=n.quote,l;if(a.overloadedBoolean&&(i===a.attribute||i===``)?i=!0:(a.boolean||a.overloadedBoolean)&&(typeof i!=`string`||i===a.attribute||i===``)&&(i=!!i),i==null||i===!1||typeof i==`number`&&Number.isNaN(i))return``;let u=x(a.attribute,Object.assign({},n.settings.characterReferences,{subset:W.name[o][s]}));return i===!0||(i=Array.isArray(i)?(a.commaSeparated?e.w:e.y)(i,{padLeft:!n.settings.tightCommaSeparatedLists}):String(i),n.settings.collapseEmptyAttributes&&!i)?u:(n.settings.preferUnquoted&&(l=x(i,Object.assign({},n.settings.characterReferences,{attribute:!0,subset:W.unquoted[o][s]}))),l!==i&&(n.settings.quoteSmart&&t.r(i,c)>t.r(i,n.alternative)&&(c=n.alternative),l=c+x(i,Object.assign({},n.settings.characterReferences,{subset:(c===`'`?W.single:W.double)[o][s],attribute:!0}))+c),u+(l&&`=`+l))}var ye=[`<`,`&`];function G(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:x(e.value,Object.assign({},r.settings.characterReferences,{subset:ye}))}function be(e,t,n,r){return r.settings.allowDangerousHtml?e.value:G(e,t,n,r)}function xe(e,t,n,r){return r.all(e)}var Se=e.h(`type`,{invalid:Ce,unknown:we,handlers:{comment:ce,doctype:le,element:ge,raw:be,root:xe,text:G}});function Ce(e){throw Error("Expected node, not `"+e+"`")}function we(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var Te={},Ee={},De=[];function Oe(t,n){let r=n||Te,i=r.quote||`"`,a=i===`"`?`'`:`"`;if(i!==`"`&&i!==`'`)throw Error("Invalid quote `"+i+"`, expected `'` or `\"`");return{one:ke,all:Ae,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||e.m,characterReferences:r.characterReferences||Ee,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:r.space===`svg`?e.x:e.b,quote:i,alternative:a}.one(Array.isArray(t)?{type:`root`,children:t}:t,void 0,void 0)}function ke(e,t,n){return Se(e,t,n,this)}function Ae(e){let t=[],n=e&&e.children||De,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var je=class extends Error{bytes;budgetBytes;constructor(e,t){super(`the conversation's images come to ${Math.round(e/1024)} kB, over the ${Math.round(t/1024)} kB this export embeds`),this.name=`ExportBudgetError`,this.bytes=e,this.budgetBytes=t}},K=t.i().use(t.u).use(t.n).use(t.t).use(e.v,{allowDangerousHtml:!0}).use(e.p).use(e.f,e.o).use(e.g,{output:`mathml`});function Me(e){let t=e.properties?.className;return(Array.isArray(t)?t.map(String):typeof t==`string`?[t]:[]).find(e=>e.startsWith(`language-`))?.slice(9)}async function q(e,t,n){if(e.tagName===`img`){let i=typeof e.properties?.src==`string`?e.properties.src:``;if(r.u(i)){let t=typeof e.properties?.alt==`string`?e.properties.alt:``;return{type:`element`,tagName:`a`,properties:{href:i},children:[{type:`text`,value:r.l(i,t)}]}}let a=i?await t.loadImage(i):void 0;if(!a)return{type:`element`,tagName:`em`,properties:{},children:[{type:`text`,value:`[image: ${typeof e.properties?.alt==`string`?e.properties.alt:i}]`}]};n.bytes+=a.bytes;let o=t.budgetBytes??41943040;if(n.bytes>o)throw new je(n.bytes,o);return{...e,properties:{...e.properties,src:a.dataUrl,loading:`lazy`}}}if(e.tagName===`pre`&&e.children?.length===1&&e.children[0].tagName===`code`){let r=e.children[0];if(Me(r)===`mermaid`&&t.renderDiagram){let e=J(r);n.diagrams+=1;let i=await t.renderDiagram(e,`pi-export-diagram-${n.diagrams}`);if(i)return{type:`element`,tagName:`figure`,properties:{className:[`diagram`]},children:[{type:`raw`,value:i}]}}}if(!e.children)return e;let i=[];for(let r of e.children)i.push(await q(r,t,n));return{...e,children:i}}function J(e){return e.type===`text`?e.value??``:(e.children??[]).map(J).join(``)}async function Y(e,n,r){return Oe(await q(await K.run(K.parse(t.g(e))),n,r),{allowDangerousHtml:!0})}function X(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}var Z=`:root {
|
|
10
10
|
--bg: #ffffff; --fg: #18181b; --muted: #71717a; --line: #e4e4e7;
|
|
11
11
|
--user-bg: #eff6ff; --tool-bg: #fafafa; --mark-bg: #fffbeb; --mark-fg: #92400e;
|
|
12
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as e, S as t,
|
|
2
|
-
import { g as m, i as
|
|
3
|
-
import { t as
|
|
4
|
-
import { a as
|
|
1
|
+
import { C as e, S as t, b as n, f as r, g as i, h as a, m as o, n as s, o as c, p as l, v as u, w as d, x as f, y as p } from "./conversationHistory-Dy4nNb-F.js";
|
|
2
|
+
import { g as m, i as ee, n as te, r as h, t as ne, u as re } from "./lib-CSMo4o20.js";
|
|
3
|
+
import { t as ie } from "./download-DVJ5QY85.js";
|
|
4
|
+
import { a as ae, l as oe, n as se, o as ce, s as le, u as g } from "./mermaidToImage-knc9XzLd.js";
|
|
5
5
|
import { n as _ } from "./loadReferencedImage-LF2DEOPa.js";
|
|
6
6
|
//#region ../node_modules/stringify-entities/lib/core.js
|
|
7
7
|
var ue = /["&'<>`]/g, de = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, fe = /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g, pe = /[|\\{}()[\]^$+*?.]/g, v = /* @__PURE__ */ new WeakMap();
|
|
@@ -344,11 +344,11 @@ function F(e, t, n, r) {
|
|
|
344
344
|
//#endregion
|
|
345
345
|
//#region ../node_modules/hast-util-to-html/lib/omission/util/siblings.js
|
|
346
346
|
var I = R(1), L = R(-1), ye = [];
|
|
347
|
-
function R(
|
|
347
|
+
function R(t) {
|
|
348
348
|
return n;
|
|
349
349
|
function n(n, r, i) {
|
|
350
|
-
let a = n ? n.children : ye, o = (r || 0) +
|
|
351
|
-
if (!i) for (; s &&
|
|
350
|
+
let a = n ? n.children : ye, o = (r || 0) + t, s = a[o];
|
|
351
|
+
if (!i) for (; s && e(s);) o += t, s = a[o];
|
|
352
352
|
return s;
|
|
353
353
|
}
|
|
354
354
|
}
|
|
@@ -373,7 +373,7 @@ var B = z({
|
|
|
373
373
|
html: xe,
|
|
374
374
|
li: we,
|
|
375
375
|
optgroup: De,
|
|
376
|
-
option:
|
|
376
|
+
option: U,
|
|
377
377
|
p: Ce,
|
|
378
378
|
rp: H,
|
|
379
379
|
rt: H,
|
|
@@ -381,12 +381,12 @@ var B = z({
|
|
|
381
381
|
td: W,
|
|
382
382
|
tfoot: Ae,
|
|
383
383
|
th: W,
|
|
384
|
-
thead:
|
|
384
|
+
thead: Oe,
|
|
385
385
|
tr: je
|
|
386
386
|
});
|
|
387
|
-
function V(
|
|
387
|
+
function V(t, n, r) {
|
|
388
388
|
let i = I(r, n, !0);
|
|
389
|
-
return !i || i.type !== "comment" && !(i.type === "text" &&
|
|
389
|
+
return !i || i.type !== "comment" && !(i.type === "text" && e(i.value.charAt(0)));
|
|
390
390
|
}
|
|
391
391
|
function xe(e, t, n) {
|
|
392
392
|
let r = I(n, t);
|
|
@@ -420,11 +420,11 @@ function De(e, t, n) {
|
|
|
420
420
|
let r = I(n, t);
|
|
421
421
|
return !r || r.type === "element" && r.tagName === "optgroup";
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function U(e, t, n) {
|
|
424
424
|
let r = I(n, t);
|
|
425
425
|
return !r || r.type === "element" && (r.tagName === "option" || r.tagName === "optgroup");
|
|
426
426
|
}
|
|
427
|
-
function
|
|
427
|
+
function Oe(e, t, n) {
|
|
428
428
|
let r = I(n, t);
|
|
429
429
|
return !(!r || r.type !== "element" || r.tagName !== "tbody" && r.tagName !== "tfoot");
|
|
430
430
|
}
|
|
@@ -465,9 +465,9 @@ function Pe(e) {
|
|
|
465
465
|
let n = e.children[0];
|
|
466
466
|
return !n || n.type === "element";
|
|
467
467
|
}
|
|
468
|
-
function Fe(
|
|
469
|
-
let n = I(
|
|
470
|
-
return !n || n.type !== "comment" && !(n.type === "text" &&
|
|
468
|
+
function Fe(t) {
|
|
469
|
+
let n = I(t, -1, !0);
|
|
470
|
+
return !n || n.type !== "comment" && !(n.type === "text" && e(n.value.charAt(0))) && (n.type !== "element" || n.tagName !== "meta" && n.tagName !== "link" && n.tagName !== "script" && n.tagName !== "style" && n.tagName !== "template");
|
|
471
471
|
}
|
|
472
472
|
function Ie(e, t, n) {
|
|
473
473
|
let r = L(n, t), i = I(e, -1, !0);
|
|
@@ -485,11 +485,11 @@ var G = {
|
|
|
485
485
|
single: [["&'".split(""), "\"&'`".split("")], ["\0&'".split(""), "\0\"&'`".split("")]],
|
|
486
486
|
double: [["\"&".split(""), "\"&'`".split("")], ["\0\"&".split(""), "\0\"&'`".split("")]]
|
|
487
487
|
};
|
|
488
|
-
function Re(e, t, n,
|
|
489
|
-
let
|
|
490
|
-
|
|
491
|
-
let
|
|
492
|
-
return
|
|
488
|
+
function Re(e, t, n, r) {
|
|
489
|
+
let i = r.schema, a = i.space !== "svg" && r.settings.omitOptionalTags, o = i.space === "svg" ? r.settings.closeEmptyElements : r.settings.voids.includes(e.tagName.toLowerCase()), s = [], c;
|
|
490
|
+
i.space === "html" && e.tagName === "svg" && (r.schema = f);
|
|
491
|
+
let l = ze(r, e.properties), u = r.all(i.space === "html" && e.tagName === "template" ? e.content : e);
|
|
492
|
+
return r.schema = i, u && (o = !1), (l || !a || !Me(e, t, n)) && (s.push("<", e.tagName, l ? " " + l : ""), o && (i.space === "svg" || r.settings.closeSelfClosing) && (c = l.charAt(l.length - 1), (!r.settings.tightSelfClosing || c === "/" || c && c !== "\"" && c !== "'") && s.push(" "), s.push("/")), s.push(">")), s.push(u), !o && (!a || !B(e, t, n)) && s.push("</" + e.tagName + ">"), s.join("");
|
|
493
493
|
}
|
|
494
494
|
function ze(e, t) {
|
|
495
495
|
let n = [], r = -1, i;
|
|
@@ -505,14 +505,14 @@ function ze(e, t) {
|
|
|
505
505
|
}
|
|
506
506
|
return n.join("");
|
|
507
507
|
}
|
|
508
|
-
function Be(
|
|
509
|
-
let i =
|
|
508
|
+
function Be(e, n, r) {
|
|
509
|
+
let i = t(e.schema, n), a = e.settings.allowParseErrors && e.schema.space === "html" ? 0 : 1, o = +!e.settings.allowDangerousCharacters, s = e.quote, c;
|
|
510
510
|
if (i.overloadedBoolean && (r === i.attribute || r === "") ? r = !0 : (i.boolean || i.overloadedBoolean) && (typeof r != "string" || r === i.attribute || r === "") && (r = !!r), r == null || r === !1 || typeof r == "number" && Number.isNaN(r)) return "";
|
|
511
|
-
let l = A(i.attribute, Object.assign({},
|
|
512
|
-
return r === !0 || (r = Array.isArray(r) ? (i.commaSeparated ?
|
|
511
|
+
let l = A(i.attribute, Object.assign({}, e.settings.characterReferences, { subset: G.name[a][o] }));
|
|
512
|
+
return r === !0 || (r = Array.isArray(r) ? (i.commaSeparated ? d : p)(r, { padLeft: !e.settings.tightCommaSeparatedLists }) : String(r), e.settings.collapseEmptyAttributes && !r) ? l : (e.settings.preferUnquoted && (c = A(r, Object.assign({}, e.settings.characterReferences, {
|
|
513
513
|
attribute: !0,
|
|
514
514
|
subset: G.unquoted[a][o]
|
|
515
|
-
}))), c !== r && (
|
|
515
|
+
}))), c !== r && (e.settings.quoteSmart && h(r, s) > h(r, e.alternative) && (s = e.alternative), c = s + A(r, Object.assign({}, e.settings.characterReferences, {
|
|
516
516
|
subset: (s === "'" ? G.single : G.double)[a][o],
|
|
517
517
|
attribute: !0
|
|
518
518
|
})) + s), l + (c && "=" + c));
|
|
@@ -535,7 +535,7 @@ function Ue(e, t, n, r) {
|
|
|
535
535
|
}
|
|
536
536
|
//#endregion
|
|
537
537
|
//#region ../node_modules/hast-util-to-html/lib/handle/index.js
|
|
538
|
-
var We =
|
|
538
|
+
var We = a("type", {
|
|
539
539
|
invalid: Ge,
|
|
540
540
|
unknown: Ke,
|
|
541
541
|
handlers: {
|
|
@@ -557,31 +557,31 @@ function Ke(e) {
|
|
|
557
557
|
//#region ../node_modules/hast-util-to-html/lib/index.js
|
|
558
558
|
var qe = {}, Je = {}, Ye = [];
|
|
559
559
|
function Xe(e, t) {
|
|
560
|
-
let
|
|
560
|
+
let r = t || qe, i = r.quote || "\"", a = i === "\"" ? "'" : "\"";
|
|
561
561
|
if (i !== "\"" && i !== "'") throw Error("Invalid quote `" + i + "`, expected `'` or `\"`");
|
|
562
562
|
return {
|
|
563
563
|
one: Ze,
|
|
564
564
|
all: Qe,
|
|
565
565
|
settings: {
|
|
566
|
-
omitOptionalTags:
|
|
567
|
-
allowParseErrors:
|
|
568
|
-
allowDangerousCharacters:
|
|
569
|
-
quoteSmart:
|
|
570
|
-
preferUnquoted:
|
|
571
|
-
tightAttributes:
|
|
572
|
-
upperDoctype:
|
|
573
|
-
tightDoctype:
|
|
574
|
-
bogusComments:
|
|
575
|
-
tightCommaSeparatedLists:
|
|
576
|
-
tightSelfClosing:
|
|
577
|
-
collapseEmptyAttributes:
|
|
578
|
-
allowDangerousHtml:
|
|
579
|
-
voids:
|
|
580
|
-
characterReferences:
|
|
581
|
-
closeSelfClosing:
|
|
582
|
-
closeEmptyElements:
|
|
566
|
+
omitOptionalTags: r.omitOptionalTags || !1,
|
|
567
|
+
allowParseErrors: r.allowParseErrors || !1,
|
|
568
|
+
allowDangerousCharacters: r.allowDangerousCharacters || !1,
|
|
569
|
+
quoteSmart: r.quoteSmart || !1,
|
|
570
|
+
preferUnquoted: r.preferUnquoted || !1,
|
|
571
|
+
tightAttributes: r.tightAttributes || !1,
|
|
572
|
+
upperDoctype: r.upperDoctype || !1,
|
|
573
|
+
tightDoctype: r.tightDoctype || !1,
|
|
574
|
+
bogusComments: r.bogusComments || !1,
|
|
575
|
+
tightCommaSeparatedLists: r.tightCommaSeparatedLists || !1,
|
|
576
|
+
tightSelfClosing: r.tightSelfClosing || !1,
|
|
577
|
+
collapseEmptyAttributes: r.collapseEmptyAttributes || !1,
|
|
578
|
+
allowDangerousHtml: r.allowDangerousHtml || !1,
|
|
579
|
+
voids: r.voids || o,
|
|
580
|
+
characterReferences: r.characterReferences || Je,
|
|
581
|
+
closeSelfClosing: r.closeSelfClosing || !1,
|
|
582
|
+
closeEmptyElements: r.closeEmptyElements || !1
|
|
583
583
|
},
|
|
584
|
-
schema:
|
|
584
|
+
schema: r.space === "svg" ? f : n,
|
|
585
585
|
quote: i,
|
|
586
586
|
alternative: a
|
|
587
587
|
}.one(Array.isArray(e) ? {
|
|
@@ -605,7 +605,7 @@ var $e = class extends Error {
|
|
|
605
605
|
constructor(e, t) {
|
|
606
606
|
super(`the conversation's images come to ${Math.round(e / 1024)} kB, over the ${Math.round(t / 1024)} kB this export embeds`), this.name = "ExportBudgetError", this.bytes = e, this.budgetBytes = t;
|
|
607
607
|
}
|
|
608
|
-
}, q =
|
|
608
|
+
}, q = ee().use(re).use(te).use(ne).use(u, { allowDangerousHtml: !0 }).use(l).use(r, c).use(i, { output: "mathml" });
|
|
609
609
|
function et(e) {
|
|
610
610
|
let t = e.properties?.className;
|
|
611
611
|
return (Array.isArray(t) ? t.map(String) : typeof t == "string" ? [t] : []).find((e) => e.startsWith("language-"))?.slice(9);
|
|
@@ -613,7 +613,7 @@ function et(e) {
|
|
|
613
613
|
async function J(e, t, n) {
|
|
614
614
|
if (e.tagName === "img") {
|
|
615
615
|
let r = typeof e.properties?.src == "string" ? e.properties.src : "";
|
|
616
|
-
if (
|
|
616
|
+
if (g(r)) {
|
|
617
617
|
let t = typeof e.properties?.alt == "string" ? e.properties.alt : "";
|
|
618
618
|
return {
|
|
619
619
|
type: "element",
|
|
@@ -621,7 +621,7 @@ async function J(e, t, n) {
|
|
|
621
621
|
properties: { href: r },
|
|
622
622
|
children: [{
|
|
623
623
|
type: "text",
|
|
624
|
-
value:
|
|
624
|
+
value: oe(r, t)
|
|
625
625
|
}]
|
|
626
626
|
};
|
|
627
627
|
}
|
|
@@ -781,8 +781,8 @@ function at(e) {
|
|
|
781
781
|
}
|
|
782
782
|
async function ot(e, t) {
|
|
783
783
|
try {
|
|
784
|
-
let { svg: n } = await
|
|
785
|
-
return
|
|
784
|
+
let { svg: n } = await ae(e, t), { width: r, height: i } = ce(n);
|
|
785
|
+
return se(le(n, r, i));
|
|
786
786
|
} catch {
|
|
787
787
|
return;
|
|
788
788
|
}
|
|
@@ -797,7 +797,7 @@ async function ct(e) {
|
|
|
797
797
|
if (e.olderItems > 0) {
|
|
798
798
|
if (!e.fetchOlderItems) throw new $("this conversation has been compacted and the agent runtime cannot read back what it removed, so it cannot be exported in full");
|
|
799
799
|
try {
|
|
800
|
-
t = await
|
|
800
|
+
t = await s(e.fetchOlderItems, (t) => e.onProgress?.("collecting", t, e.olderItems));
|
|
801
801
|
} catch (e) {
|
|
802
802
|
throw new $(`the earlier part of the conversation could not be read back, so nothing was exported: ${e instanceof Error ? e.message : String(e)}`);
|
|
803
803
|
}
|
|
@@ -812,7 +812,7 @@ async function ct(e) {
|
|
|
812
812
|
}
|
|
813
813
|
async function lt(e) {
|
|
814
814
|
let t = await ct(e);
|
|
815
|
-
|
|
815
|
+
ie(new Blob([t], { type: "text/html;charset=utf-8" }), st(e.meta.session, e.meta.exportedAt));
|
|
816
816
|
}
|
|
817
817
|
//#endregion
|
|
818
818
|
export { lt as exportConversation };
|
|
@@ -339,4 +339,4 @@ div.mxRubberband { position: absolute; overflow: hidden; border: 1px solid #29b6
|
|
|
339
339
|
`).join(r)+e.slice(o)}let a=i[t];if(a===void 0)throw new yT(`the file has no page ${t+1}`);let o=xT(e,a.start),s=ST(n,o+` `).split(`
|
|
340
340
|
`).join(r),c=e.slice(a.start,a.innerStart).replace(/\s*\/>$/,`>`);return e.slice(0,a.start)+c+r+s+r+o+`</diagram>`+e.slice(a.end)}var wT={dirty:!1,canUndo:!1,canRedo:!1},TT=`Discard the unsaved touch-ups to this diagram?`;function ET(e){return e.slice(e.lastIndexOf(`/`)+1).replace(/\.(drawio|dio)$/i,``)||`diagram`}function DT(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:n}));try{let t=document.createElement(`a`);t.href=r,t.download=e,t.click()}finally{URL.revokeObjectURL(r)}}function OT(e,t){let n=t?.trim().replace(/[^\p{L}\p{N}._-]+/gu,`-`).replace(/^-+|-+$/g,``);return`${ET(e)}${n?`-${n}`:``}.svg`}function kT(e,t,n){let{fileIo:r}=_T(),[i,o]=(0,a.useState)({status:`loading`}),s=(0,a.useRef)(0),c=(0,a.useCallback)(()=>{if(!t)return;if(r===void 0){o({status:`failed`,message:`files cannot be read here`});return}let n=++s.current;r.read(e).then(({content:e})=>{n===s.current&&o({status:`loaded`,content:e})},e=>{n===s.current&&o({status:`failed`,message:e instanceof Error?e.message:String(e)})})},[t,r,e]);return(0,a.useEffect)(()=>{n&&c()},[c,n]),(0,a.useEffect)(()=>{if(t&&n&&r!==void 0)return r.onChanged(e,c)},[t,n,r,e,c]),i}function AT(e,t){let[n,r]=(0,a.useState)(!t||typeof IntersectionObserver>`u`);return(0,a.useEffect)(()=>{if(n||e.current===null)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&r(!0)},{rootMargin:`600px 0px`});return t.observe(e.current),()=>t.disconnect()},[n,e]),n}function jT({path:e,xml:t,variant:n,fallback:r,onTouchUpDirtyChange:i}){let{serverUrl:s,fileIo:c,onOpenFile:l}=_T(),u=(0,a.useRef)(null),d=AT(u,n===`reply`),p=kT(e,t===void 0,d),m=t??(p.status===`loaded`?p.content:null),h=(0,a.useRef)(null),g=(0,a.useRef)(null),[_,v]=(0,a.useState)(!1),[y,b]=(0,a.useState)(null),[x,S]=(0,a.useState)(null),[T,ee]=(0,a.useState)(null),te=(0,a.useRef)(null),[E,D]=(0,a.useState)(wT),[ne,re]=(0,a.useState)(!1),ie=(0,a.useRef)(!1),[ae,oe]=(0,a.useState)(null),[se,ce]=(0,a.useState)(null),le=e=>e===`inline`?h:g,ue=e=>T===e&&te.current!==null?te.current.content:m,de=c!==void 0,O=T!==null&&E.dirty;(0,a.useEffect)(()=>{i?.(O)},[O,i]),(0,a.useEffect)(()=>()=>i?.(!1),[i]);async function fe(t){if(c!==void 0&&T===null){oe(null),ce(null);try{te.current=await c.read(e),D(wT),ee(t)}catch(e){oe({message:e instanceof Error?e.message:String(e),conflict:!1})}}}function pe(){return O&&!window.confirm(TT)?!1:(ee(null),D(wT),oe(null),ce(null),te.current=null,!0)}async function me(){let t=T,n=te.current;if(!(t===null||n===null||c===void 0||ie.current)){ie.current=!0,re(!0),oe(null);try{let r=await le(t).current.save(),i=CT(n.content,r.page,r.xml),{mtimeMs:a}=await c.write(e,i,n.mtimeMs);te.current={content:i,mtimeMs:a},le(t).current?.markClean()}catch(e){let t=e instanceof vT&&e.reason===`conflict`;oe({message:t?`The file changed on disk, or was removed, since this touch-up began, so it was not saved. Leave without saving to see what is there now.`:`Could not save: ${e instanceof Error?e.message:String(e)}`,conflict:t})}finally{ie.current=!1,re(!1)}}}async function he(t){S(null);try{let n=await le(t).current.exportSvg();DT(OT(e,n.name),n.svg,`image/svg+xml;charset=utf-8`)}catch(e){S(e instanceof Error?e.message:String(e))}}function ge(){(T!==`enlarged`||pe())&&v(!1)}let _e=(0,a.useCallback)(()=>ce(`Save or undo the touch-ups on this page before turning to another.`),[]),ve=(0,a.useRef)(pe);ve.current=pe;let ye=(0,a.useRef)(ge);ye.current=ge;let be=(0,a.useRef)(T);be.current=T;let xe=(0,a.useRef)(_);xe.current=_;let Se=(0,a.useCallback)(()=>{be.current===null?xe.current&&ye.current():ve.current()},[]);(0,a.useEffect)(()=>{if(T===null)return;function e(e){e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),ve.current())}return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[T]);function Ce(t){return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`button`,{type:`button`,className:C,disabled:m===null||y!==null,onClick:()=>void he(t),title:`Save the page shown as .svg — insert it as a picture in a document`,children:`⤓ download SVG`}),(0,o.jsx)(`button`,{type:`button`,className:C,disabled:m===null,onClick:()=>m!==null&&DT(e.slice(e.lastIndexOf(`/`)+1),m,`application/xml;charset=utf-8`),title:`Save the .drawio file, to open or share it`,children:`⤓ download .drawio`})]})}function we(e){return T===e?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`button`,{type:`button`,className:C,disabled:!E.dirty||ne,onClick:()=>void me(),children:ne?`saving…`:`✓ save`}),(0,o.jsx)(`button`,{type:`button`,className:C,disabled:!E.canUndo,onClick:()=>le(e).current?.undo(),title:`Undo (⌘Z / Ctrl+Z)`,children:`↶ undo`}),(0,o.jsx)(`button`,{type:`button`,className:C,disabled:!E.canRedo,onClick:()=>le(e).current?.redo(),title:`Redo (⇧⌘Z / Ctrl+Y)`,children:`↷ redo`}),(0,o.jsx)(`button`,{type:`button`,className:C,onClick:()=>pe(),title:`Leave touch-up (Escape); unsaved touch-ups are asked about first`,children:`done`}),(0,o.jsx)(`span`,{className:`text-xs text-zinc-400`,"data-testid":`drawio-touchup-status`,children:E.dirty?`● unsaved`:`touching up — drag boxes and wire ends, double-click a label`})]}):de&&T===null&&y===null?(0,o.jsx)(`button`,{type:`button`,className:C,disabled:m===null,onClick:()=>void fe(e),title:`Move boxes, re-attach wires and fix labels here; anything more in draw.io`,children:`✎ touch up`}):null}function Te(e){return(0,o.jsxs)(o.Fragment,{children:[T===e&&ae&&(0,o.jsx)(`span`,{role:`alert`,"data-testid":`drawio-touchup-problem`,className:`text-red-600 dark:text-red-400`,children:ae.message}),T===e&&se&&(0,o.jsx)(`span`,{role:`status`,className:`text-amber-700 dark:text-amber-300`,children:se}),T===null&&ae&&(0,o.jsxs)(`span`,{role:`alert`,className:`text-red-600 dark:text-red-400`,children:[`Could not start touch-up: `,ae.message]}),x&&(0,o.jsxs)(`span`,{role:`alert`,className:`text-red-600 dark:text-red-400`,children:[`Could not download SVG: `,x]})]})}if(n===`reply`&&p.status===`failed`)return(0,o.jsxs)(`div`,{ref:u,role:`alert`,"data-testid":`drawio-block-missing`,className:`my-2 rounded-lg border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-200`,children:[`The diagram `,(0,o.jsx)(`code`,{children:e}),` could not be shown: `,p.message]});let Ee=r??(0,o.jsxs)(`p`,{className:`px-3 py-2 text-xs text-zinc-500`,children:[`The diagram `,(0,o.jsx)(`code`,{children:e}),` could not be drawn.`]}),De=(0,o.jsxs)(`div`,{className:`${w} ${n===`reply`?`order-3`:`shrink-0 px-3 py-1.5`}`,children:[T!==`inline`&&(0,o.jsx)(`button`,{type:`button`,className:`text-xs text-zinc-500 underline hover:text-zinc-800 dark:hover:text-zinc-200 disabled:opacity-50`,disabled:m===null||T!==null,onClick:()=>v(!0),"aria-label":`Show diagram at full size`,children:`⤢ enlarge`}),T!==`inline`&&Ce(`inline`),n===`reply`&&l&&(0,o.jsx)(`button`,{type:`button`,className:`text-xs text-zinc-500 underline hover:text-zinc-800 dark:hover:text-zinc-200 disabled:opacity-50`,onClick:()=>l(e),title:`Open the file in the file viewer`,children:`↗ open`}),n===`viewer`&&we(`inline`),Te(`inline`)]});return(0,o.jsxs)(`div`,{ref:u,"data-testid":n===`reply`?`drawio-block-reply`:`drawio-block-viewer`,className:n===`reply`?`my-2 flex flex-col gap-2 rounded-lg border border-zinc-200 bg-zinc-50 p-3 dark:border-zinc-800 dark:bg-zinc-900`:`flex h-full flex-col`,children:[n===`viewer`&&De,m===null||!d?(0,o.jsx)(`div`,{className:`h-80 animate-pulse rounded bg-zinc-100 dark:bg-zinc-800/60`,"data-testid":`drawio-block-loading`,"aria-label":`Loading ${e}`}):(0,o.jsx)(hT,{ref:h,xml:ue(`inline`),serverUrl:s,title:e,fallback:Ee,editing:T===`inline`,onTouchUpChange:D,onPageLocked:_e,onEscape:Se,onRendered:b,className:n===`reply`?`flex h-80 flex-col`:`flex min-h-[24rem] flex-1 flex-col`}),n===`reply`&&De,(0,o.jsx)(f,{label:e,testId:`drawio-enlarged`,open:_,onClose:ge,anchorRef:u,actions:(0,o.jsxs)(o.Fragment,{children:[Ce(`enlarged`),we(`enlarged`),Te(`enlarged`)]}),children:m!==null&&(0,o.jsx)(`div`,{style:{width:`90vw`,height:`75vh`},children:(0,o.jsx)(hT,{ref:g,xml:ue(`enlarged`),serverUrl:s,title:`${e}, full size`,fallback:Ee,editing:T===`enlarged`,onTouchUpChange:D,onPageLocked:_e,onEscape:Se,className:`flex h-full flex-col`})})})]})}function MT(e){return e===`className`||Array.isArray(e)&&e[0]===`className`}function NT(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r.filter(e=>!MT(e));return t[`*`]=[...t[`*`]??[],`className`],t}var PT={...Ww,tagNames:[...new Set([...Ww.tagNames??[],`details`,`summary`])],attributes:NT(Ww.attributes??{})},FT=[Hw,[sT,PT],tb],IT=[t.n,t.t];function LT(e){let t=n.c(``,e);try{return decodeURIComponent(t)}catch{return t}}function RT(e){return typeof e==`string`&&e!==``&&!n.r(e)&&n.n(e.split(/[?#]/)[0])}function zT({text:e}){let[t,n]=(0,a.useState)(!1);return(0,o.jsxs)(`div`,{className:`my-1 rounded-lg border border-zinc-200 bg-zinc-50 text-sm dark:border-zinc-800/80 dark:bg-zinc-900/40`,children:[(0,o.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs text-zinc-500`,children:[(0,o.jsx)(`span`,{className:`italic`,children:`thinking`}),(0,o.jsx)(`span`,{className:`ml-auto`,children:t?`▾`:`▸`})]}),t&&(0,o.jsx)(`div`,{className:`whitespace-pre-wrap border-t border-zinc-200 px-3 py-2 text-xs italic text-zinc-500 dark:border-zinc-800/80`,children:e})]})}function BT({item:e,serverUrl:r=``,token:i=null,workspace:s,onOpenFile:c,hideReasoning:l=!1}){let d=l?e.blocks.filter(e=>e.type!==`thinking`):e.blocks,f=e.blocks.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
341
341
|
|
|
342
|
-
`).trim(),p=(0,a.useRef)(c);p.current=c;let m=(0,a.useMemo)(()=>{function e({src:e,alt:t,...a}){if(RT(e))return(0,o.jsx)(jT,{path:LT(e),variant:`reply`});let c=typeof e==`string`&&e!==``&&!n.r(e)?n.o(r,n.c(``,e),i,void 0,s):e;return(0,o.jsx)(`img`,{...a,src:c,alt:t??``,loading:`lazy`,className:`max-h-96 max-w-full rounded-lg object-contain`})}function t({href:e,children:t,...r}){if(typeof e==`string`&&e!==``&&!n.r(e)&&p.current){let i=n.c(``,e);return(0,o.jsx)(`a`,{...r,href:e,onClick:e=>{e.preventDefault(),p.current?.(i)},children:t})}return(0,o.jsx)(`a`,{...r,href:e,target:`_blank`,rel:`noreferrer`,children:t})}function a({node:e,children:t,...n}){let r=(e?.children??[]).filter(e=>e.type!==`text`||(e.value??``).trim()!==``);return r.length>0&&r.every(e=>e.type===`element`&&e.tagName===`img`&&RT(e.properties?.src))?(0,o.jsx)(`div`,{className:`my-2`,children:t}):(0,o.jsx)(`p`,{...n,children:t})}return{pre:Gd,img:e,a:t,p:a}},[r,i,s]);return d.length===0&&!e.errorMessage?null:(0,o.jsxs)(`div`,{className:`group max-w-none`,children:[f&&!e.streaming&&(0,o.jsx)(`div`,{className:`flex justify-end opacity-0 transition-opacity group-hover:opacity-100`,children:(0,o.jsx)(u,{text:f})}),d.map((e,n)=>e.type===`thinking`?(0,o.jsx)(zT,{text:e.text},e.contentIndex??n):(0,o.jsx)(`div`,{className:`prose-chat`,children:(0,o.jsx)(Mm,{remarkPlugins:IT,rehypePlugins:FT,components:m,children:t.g(e.text)})},e.contentIndex??n)),e.errorMessage&&(0,o.jsx)(`div`,{className:`mt-2 rounded-lg border border-red-300 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300`,children:e.errorMessage})]})}var VT=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`],HT=`worktree`,UT=class extends Error{kind;constructor(e,t){super(e),this.name=`HistoryError`,this.kind=t}};async function WT(e,t){let n=[];for(;;){let r=await e(n.length,50);if(r.items.length===0||(n.unshift(...r.items),t?.(n.length),r.remaining===0))return n}}Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return
|
|
342
|
+
`).trim(),p=(0,a.useRef)(c);p.current=c;let m=(0,a.useMemo)(()=>{function e({src:e,alt:t,...a}){if(RT(e))return(0,o.jsx)(jT,{path:LT(e),variant:`reply`});let c=typeof e==`string`&&e!==``&&!n.r(e)?n.o(r,n.c(``,e),i,void 0,s):e;return(0,o.jsx)(`img`,{...a,src:c,alt:t??``,loading:`lazy`,className:`max-h-96 max-w-full rounded-lg object-contain`})}function t({href:e,children:t,...r}){if(typeof e==`string`&&e!==``&&!n.r(e)&&p.current){let i=n.c(``,e);return(0,o.jsx)(`a`,{...r,href:e,onClick:e=>{e.preventDefault(),p.current?.(i)},children:t})}return(0,o.jsx)(`a`,{...r,href:e,target:`_blank`,rel:`noreferrer`,children:t})}function a({node:e,children:t,...n}){let r=(e?.children??[]).filter(e=>e.type!==`text`||(e.value??``).trim()!==``);return r.length>0&&r.every(e=>e.type===`element`&&e.tagName===`img`&&RT(e.properties?.src))?(0,o.jsx)(`div`,{className:`my-2`,children:t}):(0,o.jsx)(`p`,{...n,children:t})}return{pre:Gd,img:e,a:t,p:a}},[r,i,s]);return d.length===0&&!e.errorMessage?null:(0,o.jsxs)(`div`,{className:`group max-w-none`,children:[f&&!e.streaming&&(0,o.jsx)(`div`,{className:`flex justify-end opacity-0 transition-opacity group-hover:opacity-100`,children:(0,o.jsx)(u,{text:f})}),d.map((e,n)=>e.type===`thinking`?(0,o.jsx)(zT,{text:e.text},e.contentIndex??n):(0,o.jsx)(`div`,{className:`prose-chat`,children:(0,o.jsx)(Mm,{remarkPlugins:IT,rehypePlugins:FT,components:m,children:t.g(e.text)})},e.contentIndex??n)),e.errorMessage&&(0,o.jsx)(`div`,{className:`mt-2 rounded-lg border border-red-300 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300`,children:e.errorMessage})]})}var VT=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`],HT=`worktree`,UT=class extends Error{kind;constructor(e,t){super(e),this.name=`HistoryError`,this.kind=t}};async function WT(e,t){let n=[];for(;;){let r=await e(n.length,50);if(r.items.length===0||(n.unshift(...r.items),t?.(n.length),r.remaining===0))return n}}Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Sl}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return tf}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return Bd}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return Ud}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Hd}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return jf}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return Wd}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Mm}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return BT}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Pf}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return vT}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return hT}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return sT}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return tb}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return rb}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return HT}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return vd}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return gT}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return _b}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return WT}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return PT}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Hw}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return VT}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return jT}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return UT}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return _T}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Dm}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return Yd}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return Ff}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return Lf}});
|
|
@@ -22633,4 +22633,4 @@ async function xE(e, t) {
|
|
|
22633
22633
|
}
|
|
22634
22634
|
}
|
|
22635
22635
|
//#endregion
|
|
22636
|
-
export {
|
|
22636
|
+
export { Zl as A, Mf as C, _f as D, bf as E, de as M, le as N, yf as O, ue as P, cp as S, xf as T, lh as _, _E as a, dp as b, YT as c, KT as d, RT as f, Mb as g, Pb as h, yE as i, Ae as j, Jd as k, qT as l, Jb as m, xE as n, dE as o, yT as p, vE as r, cE as s, bE as t, JT as u, ih as v, Ef as w, fp as x, mp as y };
|