@wukazis/euphony 0.1.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +13 -0
  3. package/README.md +266 -0
  4. package/bin/euphony.js +4 -0
  5. package/dist/apple-touch-icon.png +0 -0
  6. package/dist/assets/harmony-render-5ErAOXX9.js +3285 -0
  7. package/dist/assets/local-data-worker-CHLGzNeW.js +2 -0
  8. package/dist/assets/main-CmldcHcT.js +4047 -0
  9. package/dist/examples/euphony-convo-100.jsonl +8 -0
  10. package/dist/examples/simple-harmony-convos.jsonl +8 -0
  11. package/dist/favicon-48x48.png +0 -0
  12. package/dist/favicon.ico +0 -0
  13. package/dist/favicon.svg +3 -0
  14. package/dist/global.css +38 -0
  15. package/dist/index.html +22 -0
  16. package/dist/web-app-manifest-192x192.png +0 -0
  17. package/dist/web-app-manifest-512x512.png +0 -0
  18. package/lib/chunks/conversation.js +612 -0
  19. package/lib/chunks/css/codex.js +1 -0
  20. package/lib/chunks/css/confirm-dialog.js +1 -0
  21. package/lib/chunks/css/conversation.js +1 -0
  22. package/lib/chunks/css/floating-toolbar.js +1 -0
  23. package/lib/chunks/css/input-dialog.js +1 -0
  24. package/lib/chunks/css/json-viewer.js +1 -0
  25. package/lib/chunks/css/menu.js +1 -0
  26. package/lib/chunks/css/message-code.js +1 -0
  27. package/lib/chunks/css/message-developer-content.js +1 -0
  28. package/lib/chunks/css/message-editor-popover.js +1 -0
  29. package/lib/chunks/css/message-hidden.js +1 -0
  30. package/lib/chunks/css/message-system-content.js +1 -0
  31. package/lib/chunks/css/message-text.js +1 -0
  32. package/lib/chunks/css/message-unsupported.js +1 -0
  33. package/lib/chunks/css/pagination.js +1 -0
  34. package/lib/chunks/css/preference-window.js +1 -0
  35. package/lib/chunks/css/search-window.js +1 -0
  36. package/lib/chunks/css/toast.js +1 -0
  37. package/lib/chunks/css/token-window.js +1 -0
  38. package/lib/chunks/css-inline.js +1 -0
  39. package/lib/chunks/dompurify.js +1 -0
  40. package/lib/chunks/harmony-types.js +1 -0
  41. package/lib/chunks/icon-cross.js +1 -0
  42. package/lib/chunks/icon-play.js +1 -0
  43. package/lib/chunks/marked.js +1 -0
  44. package/lib/chunks/prismjs.js +1 -0
  45. package/lib/chunks/shoelace.js +1131 -0
  46. package/lib/chunks/third-party.js +1 -0
  47. package/lib/chunks/utils.js +16 -0
  48. package/lib/components/app/app.d.ts +192 -0
  49. package/lib/components/app/local-data-worker.d.ts +35 -0
  50. package/lib/components/app/request-worker.d.ts +45 -0
  51. package/lib/components/app/url-manager.d.ts +25 -0
  52. package/lib/components/codex/codex.d.ts +50 -0
  53. package/lib/components/codex/codex.js +36 -0
  54. package/lib/components/confirm-dialog/confirm-dialog.d.ts +42 -0
  55. package/lib/components/confirm-dialog/confirm-dialog.js +41 -0
  56. package/lib/components/conversation/conversation.d.ts +259 -0
  57. package/lib/components/conversation/conversation.js +1 -0
  58. package/lib/components/floating-toolbar/floating-toolbar.d.ts +47 -0
  59. package/lib/components/floating-toolbar/floating-toolbar.js +32 -0
  60. package/lib/components/input-dialog/input-dialog.d.ts +43 -0
  61. package/lib/components/input-dialog/input-dialog.js +51 -0
  62. package/lib/components/json-viewer/json-viewer.d.ts +33 -0
  63. package/lib/components/json-viewer/json-viewer.js +8 -0
  64. package/lib/components/menu/menu.d.ts +38 -0
  65. package/lib/components/menu/menu.js +9 -0
  66. package/lib/components/message-code/message-code.d.ts +20 -0
  67. package/lib/components/message-code/message-code.js +10 -0
  68. package/lib/components/message-developer-content/message-developer-content.d.ts +45 -0
  69. package/lib/components/message-developer-content/message-developer-content.js +72 -0
  70. package/lib/components/message-editor-popover/message-editor-popover.d.ts +36 -0
  71. package/lib/components/message-editor-popover/message-editor-popover.js +85 -0
  72. package/lib/components/message-hidden/message-hidden.d.ts +38 -0
  73. package/lib/components/message-hidden/message-hidden.js +10 -0
  74. package/lib/components/message-system-content/message-system-content.d.ts +52 -0
  75. package/lib/components/message-system-content/message-system-content.js +74 -0
  76. package/lib/components/message-text/message-text.d.ts +36 -0
  77. package/lib/components/message-text/message-text.js +14 -0
  78. package/lib/components/message-unsupported/message-unsupported.d.ts +19 -0
  79. package/lib/components/message-unsupported/message-unsupported.js +26 -0
  80. package/lib/components/pagination/pagination.d.ts +29 -0
  81. package/lib/components/pagination/pagination.js +35 -0
  82. package/lib/components/preference-window/preference-window.d.ts +107 -0
  83. package/lib/components/preference-window/preference-window.js +319 -0
  84. package/lib/components/search-window/search-window.d.ts +44 -0
  85. package/lib/components/search-window/search-window.js +71 -0
  86. package/lib/components/toast/toast.d.ts +34 -0
  87. package/lib/components/toast/toast.js +77 -0
  88. package/lib/components/token-window/token-window.d.ts +96 -0
  89. package/lib/components/token-window/token-window.js +1 -0
  90. package/lib/config/config.d.ts +273 -0
  91. package/lib/euphony.d.ts +11 -0
  92. package/lib/euphony.js +1 -0
  93. package/lib/types/common-types.d.ts +176 -0
  94. package/lib/types/harmony-types.d.ts +72 -0
  95. package/lib/utils/api-manager.d.ts +42 -0
  96. package/lib/utils/codex-session.d.ts +7 -0
  97. package/lib/utils/dompurify-configs.d.ts +2 -0
  98. package/lib/utils/harmony-render.d.ts +4 -0
  99. package/lib/utils/marked-katex-extension.d.ts +22 -0
  100. package/lib/utils/patch-preview.d.ts +2 -0
  101. package/lib/utils/utils.d.ts +80 -0
  102. package/package.json +84 -0
  103. package/server-dist/node-main.js +1273 -0
@@ -0,0 +1 @@
1
+ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),i=new WeakMap;let s=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const n=this.t;if(e&&void 0===t){const e=void 0!==n&&1===n.length;e&&(t=i.get(n)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&i.set(n,t))}return t}toString(){return this.cssText}};const o=t=>new s("string"==typeof t?t:t+"",void 0,n),r=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,n,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[i+1],t[0]);return new s(i,t,n)},l=(n,i)=>{if(e)n.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of i){const i=document.createElement("style"),s=t.litNonce;void 0!==s&&i.setAttribute("nonce",s),i.textContent=e.cssText,n.appendChild(i)}},a=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return o(e)})(t):t,{is:c,defineProperty:h,getOwnPropertyDescriptor:u,getOwnPropertyNames:f,getOwnPropertySymbols:d,getPrototypeOf:p}=Object,m=globalThis,g=m.trustedTypes,y=g?g.emptyScript:"",v=m.reactiveElementPolyfillSupport,$=(t,e)=>t,w={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},_=(t,e)=>!c(t,e),A={attribute:!0,type:String,converter:w,reflect:!1,useDefault:!1,hasChanged:_};Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let b=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=A){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(t,n,e);void 0!==i&&h(this.prototype,t,i)}}static getPropertyDescriptor(t,e,n){const{get:i,set:s}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const o=i?.call(this);s?.call(this,e),this.requestUpdate(t,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??A}static _$Ei(){if(this.hasOwnProperty($("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty($("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty($("properties"))){const t=this.properties,e=[...f(t),...d(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return l(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$ET(t,e){const n=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,n);if(void 0!==i&&!0===n.reflect){const s=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(e,n.type);this._$Em=t,null==s?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(t,e){const n=this.constructor,i=n._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=n.getPropertyOptions(i),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:w;this._$Em=i;const o=s.fromAttribute(e,t.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(t,e,n,i=!1,s){if(void 0!==t){const o=this.constructor;if(!1===i&&(s=this[t]),n??=o.getPropertyOptions(t),!((n.hasChanged??_)(s,e)||n.useDefault&&n.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,n))))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:i,wrapped:s},o){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==s||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t){const{wrapped:t}=n,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,n,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[$("elementProperties")]=new Map,b[$("finalized")]=new Map,v?.({ReactiveElement:b}),(m.reactiveElementVersions??=[]).push("2.1.2");const x=globalThis,E=t=>t,S=x.trustedTypes,T=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,R="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,O="?"+C,P=`<${O}>`,L=document,H=()=>L.createComment(""),U=t=>null===t||"object"!=typeof t&&"function"!=typeof t,M=Array.isArray,N=t=>M(t)||"function"==typeof t?.[Symbol.iterator],D="[ \t\n\f\r]",k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,B=/-->/g,j=/>/g,I=RegExp(`>|${D}(?:([^\\s"'>=/]+)(${D}*=${D}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),z=/'/g,W=/"/g,F=/^(?:script|style|textarea|title)$/i,V=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),q=V(1),Y=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),K=new WeakMap,X=L.createTreeWalker(L,129);function Z(t,e){if(!M(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==T?T.createHTML(e):e}const G=(t,e)=>{const n=t.length-1,i=[];let s,o=2===e?"<svg>":3===e?"<math>":"",r=k;for(let e=0;e<n;e++){const n=t[e];let l,a,c=-1,h=0;for(;h<n.length&&(r.lastIndex=h,a=r.exec(n),null!==a);)h=r.lastIndex,r===k?"!--"===a[1]?r=B:void 0!==a[1]?r=j:void 0!==a[2]?(F.test(a[2])&&(s=RegExp("</"+a[2],"g")),r=I):void 0!==a[3]&&(r=I):r===I?">"===a[0]?(r=s??k,c=-1):void 0===a[1]?c=-2:(c=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?I:'"'===a[3]?W:z):r===W||r===z?r=I:r===B||r===j?r=k:(r=I,s=void 0);const u=r===I&&t[e+1].startsWith("/>")?" ":"";o+=r===k?n+P:c>=0?(i.push(l),n.slice(0,c)+R+n.slice(c)+C+u):n+C+(-2===c?e:u)}return[Z(t,o+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class Q{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let s=0,o=0;const r=t.length-1,l=this.parts,[a,c]=G(t,e);if(this.el=Q.createElement(a,n),X.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=X.nextNode())&&l.length<r;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(R)){const e=c[o++],n=i.getAttribute(t).split(C),r=/([.?@])?(.*)/.exec(e);l.push({type:1,index:s,name:r[2],strings:n,ctor:"."===r[1]?st:"?"===r[1]?ot:"@"===r[1]?rt:it}),i.removeAttribute(t)}else t.startsWith(C)&&(l.push({type:6,index:s}),i.removeAttribute(t));if(F.test(i.tagName)){const t=i.textContent.split(C),e=t.length-1;if(e>0){i.textContent=S?S.emptyScript:"";for(let n=0;n<e;n++)i.append(t[n],H()),X.nextNode(),l.push({type:2,index:++s});i.append(t[e],H())}}}else if(8===i.nodeType)if(i.data===O)l.push({type:2,index:s});else{let t=-1;for(;-1!==(t=i.data.indexOf(C,t+1));)l.push({type:7,index:s}),t+=C.length-1}s++}}static createElement(t,e){const n=L.createElement("template");return n.innerHTML=t,n}}function tt(t,e,n=t,i){if(e===Y)return e;let s=void 0!==i?n._$Co?.[i]:n._$Cl;const o=U(e)?void 0:e._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(!1),void 0===o?s=void 0:(s=new o(t),s._$AT(t,n,i)),void 0!==i?(n._$Co??=[])[i]=s:n._$Cl=s),void 0!==s&&(e=tt(t,s._$AS(t,e.values),s,i)),e}class et{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:n}=this._$AD,i=(t?.creationScope??L).importNode(e,!0);X.currentNode=i;let s=X.nextNode(),o=0,r=0,l=n[0];for(;void 0!==l;){if(o===l.index){let e;2===l.type?e=new nt(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new lt(s,this,t)),this._$AV.push(e),l=n[++r]}o!==l?.index&&(s=X.nextNode(),o++)}return X.currentNode=L,i}p(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class nt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,i){this.type=2,this._$AH=J,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=tt(this,t,e),U(t)?t===J||null==t||""===t?(this._$AH!==J&&this._$AR(),this._$AH=J):t!==this._$AH&&t!==Y&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):N(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==J&&U(this._$AH)?this._$AA.nextSibling.data=t:this.T(L.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=Q.createElement(Z(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new et(i,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=K.get(t.strings);return void 0===e&&K.set(t.strings,e=new Q(t)),e}k(t){M(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,i=0;for(const s of t)i===e.length?e.push(n=new nt(this.O(H()),this.O(H()),this,this.options)):n=e[i],n._$AI(s),i++;i<e.length&&(this._$AR(n&&n._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=E(t).nextSibling;E(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class it{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,i,s){this.type=1,this._$AH=J,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=s,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=J}_$AI(t,e=this,n,i){const s=this.strings;let o=!1;if(void 0===s)t=tt(this,t,e,0),o=!U(t)||t!==this._$AH&&t!==Y,o&&(this._$AH=t);else{const i=t;let r,l;for(t=s[0],r=0;r<s.length-1;r++)l=tt(this,i[n+r],e,r),l===Y&&(l=this._$AH[r]),o||=!U(l)||l!==this._$AH[r],l===J?t=J:t!==J&&(t+=(l??"")+s[r+1]),this._$AH[r]=l}o&&!i&&this.j(t)}j(t){t===J?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class st extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===J?void 0:t}}class ot extends it{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==J)}}class rt extends it{constructor(t,e,n,i,s){super(t,e,n,i,s),this.type=5}_$AI(t,e=this){if((t=tt(this,t,e,0)??J)===Y)return;const n=this._$AH,i=t===J&&n!==J||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==J&&(n===J||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class lt{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){tt(this,t)}}const at=x.litHtmlPolyfillSupport;at?.(Q,nt),(x.litHtmlVersions??=[]).push("3.3.2");const ct=(t,e,n)=>{const i=n?.renderBefore??e;let s=i._$litPart$;if(void 0===s){const t=n?.renderBefore??null;i._$litPart$=s=new nt(e.insertBefore(H(),t),t,void 0,n??{})}return s._$AI(t),s},ht=globalThis;let ut=class extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ct(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Y}};ut._$litElement$=!0,ut.finalized=!0,ht.litElementHydrateSupport?.({LitElement:ut});const ft=ht.litElementPolyfillSupport;ft?.({LitElement:ut}),(ht.litElementVersions??=[]).push("4.2.2");const dt=t=>(e,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},pt={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:_},mt=(t=pt,e,n)=>{const{kind:i,metadata:s}=n;let o=globalThis.litPropertyMetadata.get(s);if(void 0===o&&globalThis.litPropertyMetadata.set(s,o=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),o.set(n.name,t),"accessor"===i){const{name:i}=n;return{set(n){const s=e.get.call(this);e.set.call(this,n),this.requestUpdate(i,s,t,!0,n)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=n;return function(n){const s=this[i];e.call(this,n),this.requestUpdate(i,s,t,!0,n)}}throw Error("Unsupported decorator location: "+i)};function gt(t){return(e,n)=>"object"==typeof n?mt(t,e,n):((t,e,n)=>{const i=e.hasOwnProperty(n);return e.constructor.createProperty(n,t),i?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n)}function yt(t){return gt({...t,state:!0,attribute:!1})}function vt(t){return(e,n)=>{const i="function"==typeof e?e:e[n];Object.assign(i,t)}}const $t=(t,e,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,n),n);function wt(t,e){return(e,n,i)=>$t(e,n,{get(){return this.renderRoot?.querySelector(t)??null}})}let _t;function At(t){return(e,n)=>$t(e,n,{get(){return(this.renderRoot??(_t??=document.createDocumentFragment())).querySelectorAll(t)}})}const bt=t=>t??J,xt=["top","right","bottom","left"],Et=Math.min,St=Math.max,Tt=Math.round,Rt=Math.floor,Ct=t=>({x:t,y:t}),Ot={left:"right",right:"left",bottom:"top",top:"bottom"};function Pt(t,e,n){return St(t,Et(e,n))}function Lt(t,e){return"function"==typeof t?t(e):t}function Ht(t){return t.split("-")[0]}function Ut(t){return t.split("-")[1]}function Mt(t){return"x"===t?"y":"x"}function Nt(t){return"y"===t?"height":"width"}function Dt(t){const e=t[0];return"t"===e||"b"===e?"y":"x"}function kt(t){return Mt(Dt(t))}function Bt(t,e,n){void 0===n&&(n=!1);const i=Ut(t),s=kt(t),o=Nt(s);let r="x"===s?i===(n?"end":"start")?"right":"left":"start"===i?"bottom":"top";return e.reference[o]>e.floating[o]&&(r=Jt(r)),[r,Jt(r)]}function jt(t){const e=Jt(t);return[It(t),e,It(e)]}function It(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const zt=["left","right"],Wt=["right","left"],Ft=["top","bottom"],Vt=["bottom","top"];function qt(t,e,n){switch(t){case"top":case"bottom":return n?e?Wt:zt:e?zt:Wt;case"left":case"right":return e?Ft:Vt;default:return[]}}function Yt(t,e,n,i){const s=Ut(t);let o=qt(Ht(t),"start"===n,i);return s&&(o=o.map(t=>t+"-"+s),e&&(o=o.concat(o.map(It)))),o}function Jt(t){const e=Ht(t);return Ot[e]+t.slice(e.length)}function Kt(t){return{top:0,right:0,bottom:0,left:0,...t}}function Xt(t){return"number"!=typeof t?Kt(t):{top:t,right:t,bottom:t,left:t}}function Zt(t){const{x:e,y:n,width:i,height:s}=t;return{width:i,height:s,top:n,left:e,right:e+i,bottom:n+s,x:e,y:n}}function Gt(t,e,n){let{reference:i,floating:s}=t;const o=Dt(e),r=kt(e),l=Nt(r),a=Ht(e),c="y"===o,h=i.x+i.width/2-s.width/2,u=i.y+i.height/2-s.height/2,f=i[l]/2-s[l]/2;let d;switch(a){case"top":d={x:h,y:i.y-s.height};break;case"bottom":d={x:h,y:i.y+i.height};break;case"right":d={x:i.x+i.width,y:u};break;case"left":d={x:i.x-s.width,y:u};break;default:d={x:i.x,y:i.y}}switch(Ut(e)){case"start":d[r]-=f*(n&&c?-1:1);break;case"end":d[r]+=f*(n&&c?-1:1)}return d}async function Qt(t,e){var n;void 0===e&&(e={});const{x:i,y:s,platform:o,rects:r,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:u="floating",altBoundary:f=!1,padding:d=0}=Lt(e,t),p=Xt(d),m=l[f?"floating"===u?"reference":"floating":u],g=Zt(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(m)))||n?m:m.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(l.floating)),boundary:c,rootBoundary:h,strategy:a})),y="floating"===u?{x:i,y:s,width:r.floating.width,height:r.floating.height}:r.reference,v=await(null==o.getOffsetParent?void 0:o.getOffsetParent(l.floating)),$=await(null==o.isElement?void 0:o.isElement(v))&&await(null==o.getScale?void 0:o.getScale(v))||{x:1,y:1},w=Zt(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:v,strategy:a}):y);return{top:(g.top-w.top+p.top)/$.y,bottom:(w.bottom-g.bottom+p.bottom)/$.y,left:(g.left-w.left+p.left)/$.x,right:(w.right-g.right+p.right)/$.x}}const te=50,ee=async(t,e,n)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:r}=n,l=r.detectOverflow?r:{...r,detectOverflow:Qt},a=await(null==r.isRTL?void 0:r.isRTL(e));let c=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:h,y:u}=Gt(c,i,a),f=i,d=0;const p={};for(let n=0;n<o.length;n++){const m=o[n];if(!m)continue;const{name:g,fn:y}=m,{x:v,y:$,data:w,reset:_}=await y({x:h,y:u,initialPlacement:i,placement:f,strategy:s,middlewareData:p,rects:c,platform:l,elements:{reference:t,floating:e}});h=v??h,u=$??u,p[g]={...p[g],...w},_&&d<te&&(d++,"object"==typeof _&&(_.placement&&(f=_.placement),_.rects&&(c=!0===_.rects?await r.getElementRects({reference:t,floating:e,strategy:s}):_.rects),({x:h,y:u}=Gt(c,f,a))),n=-1)}return{x:h,y:u,placement:f,strategy:s,middlewareData:p}},ne=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:i,placement:s,rects:o,platform:r,elements:l,middlewareData:a}=e,{element:c,padding:h=0}=Lt(t,e)||{};if(null==c)return{};const u=Xt(h),f={x:n,y:i},d=kt(s),p=Nt(d),m=await r.getDimensions(c),g="y"===d,y=g?"top":"left",v=g?"bottom":"right",$=g?"clientHeight":"clientWidth",w=o.reference[p]+o.reference[d]-f[d]-o.floating[p],_=f[d]-o.reference[d],A=await(null==r.getOffsetParent?void 0:r.getOffsetParent(c));let b=A?A[$]:0;(!b||!await(null==r.isElement?void 0:r.isElement(A)))&&(b=l.floating[$]||o.floating[p]);const x=w/2-_/2,E=b/2-m[p]/2-1,S=Et(u[y],E),T=Et(u[v],E),R=S,C=b-m[p]-T,O=b/2-m[p]/2+x,P=Pt(R,O,C),L=!a.arrow&&null!=Ut(s)&&O!==P&&o.reference[p]/2-(O<R?S:T)-m[p]/2<0,H=L?O<R?O-R:O-C:0;return{[d]:f[d]+H,data:{[d]:P,centerOffset:O-P-H,...L&&{alignmentOffset:H}},reset:L}}}),ie=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,i;const{placement:s,middlewareData:o,rects:r,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:h=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...g}=Lt(t,e);if(null!=(n=o.arrow)&&n.alignmentOffset)return{};const y=Ht(s),v=Dt(l),$=Ht(l)===l,w=await(null==a.isRTL?void 0:a.isRTL(c.floating)),_=f||($||!m?[Jt(l)]:jt(l)),A="none"!==p;!f&&A&&_.push(...Yt(l,m,p,w));const b=[l,..._],x=await a.detectOverflow(e,g),E=[];let S=(null==(i=o.flip)?void 0:i.overflows)||[];if(h&&E.push(x[y]),u){const t=Bt(s,r,w);E.push(x[t[0]],x[t[1]])}if(S=[...S,{placement:s,overflows:E}],!E.every(t=>t<=0)){var T,R;const t=((null==(T=o.flip)?void 0:T.index)||0)+1,e=b[t];if(e&&("alignment"!==u||v===Dt(e)||S.every(t=>Dt(t.placement)!==v||t.overflows[0]>0)))return{data:{index:t,overflows:S},reset:{placement:e}};let n=null==(R=S.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:R.placement;if(!n)switch(d){case"bestFit":{var C;const t=null==(C=S.filter(t=>{if(A){const e=Dt(t.placement);return e===v||"y"===e}return!0}).map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:C[0];t&&(n=t);break}case"initialPlacement":n=l}if(s!==n)return{reset:{placement:n}}}return{}}}};function se(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function oe(t){return xt.some(e=>t[e]>=0)}const re=function(t){return void 0===t&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:i}=e,{strategy:s="referenceHidden",...o}=Lt(t,e);switch(s){case"referenceHidden":{const t=se(await i.detectOverflow(e,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:t,referenceHidden:oe(t)}}}case"escaped":{const t=se(await i.detectOverflow(e,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:t,escaped:oe(t)}}}default:return{}}}}},le=new Set(["left","top"]);async function ae(t,e){const{placement:n,platform:i,elements:s}=t,o=await(null==i.isRTL?void 0:i.isRTL(s.floating)),r=Ht(n),l=Ut(n),a="y"===Dt(n),c=le.has(r)?-1:1,h=o&&a?-1:1,u=Lt(e,t);let{mainAxis:f,crossAxis:d,alignmentAxis:p}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&"number"==typeof p&&(d="end"===l?-1*p:p),a?{x:d*h,y:f*c}:{x:f*c,y:d*h}}const ce=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,i;const{x:s,y:o,placement:r,middlewareData:l}=e,a=await ae(e,t);return r===(null==(n=l.offset)?void 0:n.placement)&&null!=(i=l.arrow)&&i.alignmentOffset?{}:{x:s+a.x,y:o+a.y,data:{...a,placement:r}}}}},he=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:i,placement:s,platform:o}=e,{mainAxis:r=!0,crossAxis:l=!1,limiter:a={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...c}=Lt(t,e),h={x:n,y:i},u=await o.detectOverflow(e,c),f=Dt(Ht(s)),d=Mt(f);let p=h[d],m=h[f];if(r){const t="y"===d?"bottom":"right";p=Pt(p+u["y"===d?"top":"left"],p,p-u[t])}if(l){const t="y"===f?"bottom":"right";m=Pt(m+u["y"===f?"top":"left"],m,m-u[t])}const g=a.fn({...e,[d]:p,[f]:m});return{...g,data:{x:g.x-n,y:g.y-i,enabled:{[d]:r,[f]:l}}}}}},ue=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){var n,i;const{placement:s,rects:o,platform:r,elements:l}=e,{apply:a=()=>{},...c}=Lt(t,e),h=await r.detectOverflow(e,c),u=Ht(s),f=Ut(s),d="y"===Dt(s),{width:p,height:m}=o.floating;let g,y;"top"===u||"bottom"===u?(g=u,y=f===(await(null==r.isRTL?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(y=u,g="end"===f?"top":"bottom");const v=m-h.top-h.bottom,$=p-h.left-h.right,w=Et(m-h[g],v),_=Et(p-h[y],$),A=!e.middlewareData.shift;let b=w,x=_;if(null!=(n=e.middlewareData.shift)&&n.enabled.x&&(x=$),null!=(i=e.middlewareData.shift)&&i.enabled.y&&(b=v),A&&!f){const t=St(h.left,0),e=St(h.right,0),n=St(h.top,0),i=St(h.bottom,0);d?x=p-2*(0!==t||0!==e?t+e:St(h.left,h.right)):b=m-2*(0!==n||0!==i?n+i:St(h.top,h.bottom))}await a({...e,availableWidth:x,availableHeight:b});const E=await r.getDimensions(l.floating);return p!==E.width||m!==E.height?{reset:{rects:!0}}:{}}}};function fe(){return typeof window<"u"}function de(t){return ge(t)?(t.nodeName||"").toLowerCase():"#document"}function pe(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function me(t){var e;return null==(e=(ge(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function ge(t){return!!fe()&&(t instanceof Node||t instanceof pe(t).Node)}function ye(t){return!!fe()&&(t instanceof Element||t instanceof pe(t).Element)}function ve(t){return!!fe()&&(t instanceof HTMLElement||t instanceof pe(t).HTMLElement)}function $e(t){return!(!fe()||typeof ShadowRoot>"u")&&(t instanceof ShadowRoot||t instanceof pe(t).ShadowRoot)}function we(t){const{overflow:e,overflowX:n,overflowY:i,display:s}=Pe(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&"inline"!==s&&"contents"!==s}function _e(t){return/^(table|td|th)$/.test(de(t))}function Ae(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const be=/transform|translate|scale|rotate|perspective|filter/,xe=/paint|layout|strict|content/,Ee=t=>!!t&&"none"!==t;let Se;function Te(t){const e=ye(t)?Pe(t):t;return Ee(e.transform)||Ee(e.translate)||Ee(e.scale)||Ee(e.rotate)||Ee(e.perspective)||!Ce()&&(Ee(e.backdropFilter)||Ee(e.filter))||be.test(e.willChange||"")||xe.test(e.contain||"")}function Re(t){let e=He(t);for(;ve(e)&&!Oe(e);){if(Te(e))return e;if(Ae(e))return null;e=He(e)}return null}function Ce(){return null==Se&&(Se=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Se}function Oe(t){return/^(html|body|#document)$/.test(de(t))}function Pe(t){return pe(t).getComputedStyle(t)}function Le(t){return ye(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function He(t){if("html"===de(t))return t;const e=t.assignedSlot||t.parentNode||$e(t)&&t.host||me(t);return $e(e)?e.host:e}function Ue(t){const e=He(t);return Oe(e)?t.ownerDocument?t.ownerDocument.body:t.body:ve(e)&&we(e)?e:Ue(e)}function Me(t,e,n){var i;void 0===e&&(e=[]),void 0===n&&(n=!0);const s=Ue(t),o=s===(null==(i=t.ownerDocument)?void 0:i.body),r=pe(s);if(o){const t=Ne(r);return e.concat(r,r.visualViewport||[],we(s)?s:[],t&&n?Me(t):[])}return e.concat(s,Me(s,[],n))}function Ne(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function De(t){const e=Pe(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=ve(t),o=s?t.offsetWidth:n,r=s?t.offsetHeight:i,l=Tt(n)!==o||Tt(i)!==r;return l&&(n=o,i=r),{width:n,height:i,$:l}}function ke(t){return ye(t)?t:t.contextElement}function Be(t){const e=ke(t);if(!ve(e))return Ct(1);const n=e.getBoundingClientRect(),{width:i,height:s,$:o}=De(e);let r=(o?Tt(n.width):n.width)/i,l=(o?Tt(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!l||!Number.isFinite(l))&&(l=1),{x:r,y:l}}const je=Ct(0);function Ie(t){const e=pe(t);return Ce()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:je}function ze(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==pe(t))&&e}function We(t,e,n,i){void 0===e&&(e=!1),void 0===n&&(n=!1);const s=t.getBoundingClientRect(),o=ke(t);let r=Ct(1);e&&(i?ye(i)&&(r=Be(i)):r=Be(t));const l=ze(o,n,i)?Ie(o):Ct(0);let a=(s.left+l.x)/r.x,c=(s.top+l.y)/r.y,h=s.width/r.x,u=s.height/r.y;if(o){const t=pe(o),e=i&&ye(i)?pe(i):i;let n=t,s=Ne(n);for(;s&&i&&e!==n;){const t=Be(s),e=s.getBoundingClientRect(),i=Pe(s),o=e.left+(s.clientLeft+parseFloat(i.paddingLeft))*t.x,r=e.top+(s.clientTop+parseFloat(i.paddingTop))*t.y;a*=t.x,c*=t.y,h*=t.x,u*=t.y,a+=o,c+=r,n=pe(s),s=Ne(n)}}return Zt({width:h,height:u,x:a,y:c})}function Fe(t,e){const n=Le(t).scrollLeft;return e?e.left+n:We(me(t)).left+n}function Ve(t,e){const n=t.getBoundingClientRect();return{x:n.left+e.scrollLeft-Fe(t,n),y:n.top+e.scrollTop}}function qe(t){let{elements:e,rect:n,offsetParent:i,strategy:s}=t;const o="fixed"===s,r=me(i),l=!!e&&Ae(e.floating);if(i===r||l&&o)return n;let a={scrollLeft:0,scrollTop:0},c=Ct(1);const h=Ct(0),u=ve(i);if((u||!u&&!o)&&(("body"!==de(i)||we(r))&&(a=Le(i)),u)){const t=We(i);c=Be(i),h.x=t.x+i.clientLeft,h.y=t.y+i.clientTop}const f=!r||u||o?Ct(0):Ve(r,a);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+h.x+f.x,y:n.y*c.y-a.scrollTop*c.y+h.y+f.y}}function Ye(t){return Array.from(t.getClientRects())}function Je(t){const e=me(t),n=Le(t),i=t.ownerDocument.body,s=St(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=St(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let r=-n.scrollLeft+Fe(t);const l=-n.scrollTop;return"rtl"===Pe(i).direction&&(r+=St(e.clientWidth,i.clientWidth)-s),{width:s,height:o,x:r,y:l}}const Ke=25;function Xe(t,e){const n=pe(t),i=me(t),s=n.visualViewport;let o=i.clientWidth,r=i.clientHeight,l=0,a=0;if(s){o=s.width,r=s.height;const t=Ce();(!t||t&&"fixed"===e)&&(l=s.offsetLeft,a=s.offsetTop)}const c=Fe(i);if(c<=0){const t=i.ownerDocument,e=t.body,n=getComputedStyle(e),s="CSS1Compat"===t.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,r=Math.abs(i.clientWidth-e.clientWidth-s);r<=Ke&&(o-=r)}else c<=Ke&&(o+=c);return{width:o,height:r,x:l,y:a}}function Ze(t,e){const n=We(t,!0,"fixed"===e),i=n.top+t.clientTop,s=n.left+t.clientLeft,o=ve(t)?Be(t):Ct(1);return{width:t.clientWidth*o.x,height:t.clientHeight*o.y,x:s*o.x,y:i*o.y}}function Ge(t,e,n){let i;if("viewport"===e)i=Xe(t,n);else if("document"===e)i=Je(me(t));else if(ye(e))i=Ze(e,n);else{const n=Ie(t);i={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return Zt(i)}function Qe(t,e){const n=He(t);return!(n===e||!ye(n)||Oe(n))&&("fixed"===Pe(n).position||Qe(n,e))}function tn(t,e){const n=e.get(t);if(n)return n;let i=Me(t,[],!1).filter(t=>ye(t)&&"body"!==de(t)),s=null;const o="fixed"===Pe(t).position;let r=o?He(t):t;for(;ye(r)&&!Oe(r);){const e=Pe(r),n=Te(r);!n&&"fixed"===e.position&&(s=null),(o?!n&&!s:!n&&"static"===e.position&&s&&("absolute"===s.position||"fixed"===s.position)||we(r)&&!n&&Qe(t,r))?i=i.filter(t=>t!==r):s=e,r=He(r)}return e.set(t,i),i}function en(t){let{element:e,boundary:n,rootBoundary:i,strategy:s}=t;const o=[..."clippingAncestors"===n?Ae(e)?[]:tn(e,this._c):[].concat(n),i],r=Ge(e,o[0],s);let l=r.top,a=r.right,c=r.bottom,h=r.left;for(let t=1;t<o.length;t++){const n=Ge(e,o[t],s);l=St(n.top,l),a=Et(n.right,a),c=Et(n.bottom,c),h=St(n.left,h)}return{width:a-h,height:c-l,x:h,y:l}}function nn(t){const{width:e,height:n}=De(t);return{width:e,height:n}}function sn(t,e,n){const i=ve(e),s=me(e),o="fixed"===n,r=We(t,!0,o,e);let l={scrollLeft:0,scrollTop:0};const a=Ct(0);function c(){a.x=Fe(s)}if(i||!i&&!o)if(("body"!==de(e)||we(s))&&(l=Le(e)),i){const t=We(e,!0,o,e);a.x=t.x+e.clientLeft,a.y=t.y+e.clientTop}else s&&c();o&&!i&&s&&c();const h=!s||i||o?Ct(0):Ve(s,l);return{x:r.left+l.scrollLeft-a.x-h.x,y:r.top+l.scrollTop-a.y-h.y,width:r.width,height:r.height}}function on(t){return"static"===Pe(t).position}function rn(t,e){if(!ve(t)||"fixed"===Pe(t).position)return null;if(e)return e(t);let n=t.offsetParent;return me(t)===n&&(n=n.ownerDocument.body),n}function ln(t,e){const n=pe(t);if(Ae(t))return n;if(!ve(t)){let e=He(t);for(;e&&!Oe(e);){if(ye(e)&&!on(e))return e;e=He(e)}return n}let i=rn(t,e);for(;i&&_e(i)&&on(i);)i=rn(i,e);return i&&Oe(i)&&on(i)&&!Te(i)?n:i||Re(t)||n}const an=async function(t){const e=this.getOffsetParent||ln,n=this.getDimensions,i=await n(t.floating);return{reference:sn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function cn(t){return"rtl"===Pe(t).direction}const hn={convertOffsetParentRelativeRectToViewportRelativeRect:qe,getDocumentElement:me,getClippingRect:en,getOffsetParent:ln,getElementRects:an,getClientRects:Ye,getDimensions:nn,getScale:Be,isElement:ye,isRTL:cn};function un(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function fn(t,e){let n,i=null;const s=me(t);function o(){var t;clearTimeout(n),null==(t=i)||t.disconnect(),i=null}return function r(l,a){void 0===l&&(l=!1),void 0===a&&(a=1),o();const c=t.getBoundingClientRect(),{left:h,top:u,width:f,height:d}=c;if(l||e(),!f||!d)return;const p={rootMargin:-Rt(u)+"px "+-Rt(s.clientWidth-(h+f))+"px "+-Rt(s.clientHeight-(u+d))+"px "+-Rt(h)+"px",threshold:St(0,Et(1,a))||1};let m=!0;function g(e){const i=e[0].intersectionRatio;if(i!==a){if(!m)return r();i?r(!1,i):n=setTimeout(()=>{r(!1,1e-7)},1e3)}1===i&&!un(c,t.getBoundingClientRect())&&r(),m=!1}try{i=new IntersectionObserver(g,{...p,root:s.ownerDocument})}catch{i=new IntersectionObserver(g,p)}i.observe(t)}(!0),o}function dn(t,e,n,i){void 0===i&&(i={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:r="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:a=!1}=i,c=ke(t),h=s||o?[...c?Me(c):[],...e?Me(e):[]]:[];h.forEach(t=>{s&&t.addEventListener("scroll",n,{passive:!0}),o&&t.addEventListener("resize",n)});const u=c&&l?fn(c,n):null;let f=-1,d=null;r&&(d=new ResizeObserver(t=>{let[i]=t;i&&i.target===c&&d&&e&&(d.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var t;null==(t=d)||t.observe(e)})),n()}),c&&!a&&d.observe(c),e&&d.observe(e));let p,m=a?We(t):null;return a&&function e(){const i=We(t);m&&!un(m,i)&&n(),m=i,p=requestAnimationFrame(e)}(),n(),()=>{var t;h.forEach(t=>{s&&t.removeEventListener("scroll",n),o&&t.removeEventListener("resize",n)}),u?.(),null==(t=d)||t.disconnect(),d=null,a&&cancelAnimationFrame(p)}}const pn=ce,mn=he,gn=ie,yn=ue,vn=re,$n=ne,wn=(t,e,n)=>{const i=new Map,s={platform:hn,...n},o={...s.platform,_c:i};return ee(t,e,{...s,platform:o})},_n=(t,e,n="download.json")=>{const i="data:text/plain;charset=utf-8,"+encodeURIComponent(t);let s=e,o=!1;s=document.createElement("a"),s.style.display="none",o=!0,s?.setAttribute("href",i),s?.setAttribute("download",`${n}`),s?.click(),s?.remove()},An={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4},bn=t=>(...e)=>({_$litDirective$:t,values:e});let xn=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}},En=class extends xn{constructor(t){if(super(t),this.it=J,t.type!==An.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===J||null==t)return this._t=void 0,this.it=t;if(t===Y)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};En.directiveName="unsafeHTML",En.resultType=1;const Sn=bn(En),Tn=bn(class extends xn{constructor(t){if(super(t),t.type!==An.ATTRIBUTE||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const n=t.element.classList;for(const t of this.st)t in e||(n.remove(t),this.st.delete(t));for(const t in e){const i=!!e[t];i===this.st.has(t)||this.nt?.has(t)||(i?(n.add(t),this.st.add(t)):(n.remove(t),this.st.delete(t)))}return Y}}),Rn=(t,e)=>void 0!==t?._$litType$,Cn=t=>void 0===t.strings,On={},Pn=(t,e=On)=>t._$AH=e,Ln=bn(class extends xn{constructor(t){if(super(t),t.type!==An.PROPERTY&&t.type!==An.ATTRIBUTE&&t.type!==An.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Cn(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===Y||e===J)return e;const n=t.element,i=t.name;if(t.type===An.PROPERTY){if(e===n[i])return Y}else if(t.type===An.BOOLEAN_ATTRIBUTE){if(!!e===n.hasAttribute(i))return Y}else if(t.type===An.ATTRIBUTE&&n.getAttribute(i)===e+"")return Y;return Pn(t),e}});function Hn(t){return Mn(t)}function Un(t){return t.assignedSlot?t.assignedSlot:t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}function Mn(t){for(let e=t;e;e=Un(e))if(e instanceof Element&&"none"===getComputedStyle(e).display)return null;for(let e=Un(t);e;e=Un(e)){if(!(e instanceof Element))continue;const t=getComputedStyle(e);if("contents"!==t.display&&("static"!==t.position||Te(t)||"BODY"===e.tagName))return e}return null}export{_n as A,ut as a,q as b,Tn as c,Ln as d,wt as e,dn as f,pn as g,gn as h,r as i,yn as j,$n as k,Rn as l,Hn as m,gt as n,bt as o,hn as p,wn as q,yt as r,mn as s,vt as t,w as u,o as v,dt as w,Sn as x,vn as y,At as z};
@@ -0,0 +1,16 @@
1
+ import{r as t,q as e,b as s,x as r,g as a,h as o,s as n,a as i,j as l,k as d,y as c}from"./third-party.js";import{p as m,a as h,b as p}from"./dompurify.js";import{m as f,a as u}from"./marked.js";var y=Object.defineProperty,g=(t,e,s,r)=>{for(var a,o=void 0,n=t.length-1;n>=0;n--)(a=t[n])&&(o=a(e,s,o)||o);return o&&y(e,s,o),o};const b=p,w=h,S={throwOnError:!1,nonStandard:!0,output:"mathml"},A=(t,s,r,i,m=8,h)=>{const p=t.querySelector(".popper-arrow");if(!p)throw new Error("Arrow element not found");i?(p.classList.remove("hidden"),e(s,t,{placement:r,middleware:[a(m),o(),l({apply({availableWidth:t,elements:e}){h&&Object.assign(e.floating.style,{maxWidth:`${Math.min(h,t)}px`})}}),n({padding:{top:70,bottom:20}}),d({element:p}),c()]}).then(({x:e,y:s,placement:r,middlewareData:a})=>{t.style.left=`${e}px`,t.style.top=`${s}px`;const{x:o,y:n}=a.arrow;let i="bottom";r.includes("top")&&(i="bottom"),r.includes("right")&&(i="left"),r.includes("bottom")&&(i="top"),r.includes("left")&&(i="right"),t.setAttribute("placement",r),p.style.left=o?`${o}px`:"",p.style.top=n?`${n}px`:"",p.style.right="",p.style.bottom="",p.style[i]="-4px",a.hide?.referenceHidden?t.classList.add("no-show"):t.classList.remove("no-show")}).catch(()=>{})):(p.classList.add("hidden"),e(s,t,{placement:r,middleware:[a(6),o(),n(),c()]}).then(({x:e,y:s,middlewareData:r})=>{t.style.left=`${e}px`,t.style.top=`${s}px`,r.hide?.referenceHidden?t.classList.add("hidden"):t.classList.remove("hidden")}).catch(()=>{}))},x=(t,s,r,i=6)=>{e(t,s,{placement:r,middleware:[a(i),o(),n()]}).then(({x:t,y:e,middlewareData:r})=>{s.style.left=`${t}px`,s.style.top=`${e}px`,r.hide?.referenceHidden?s.classList.add("hidden"):s.classList.remove("hidden")}).catch(()=>{})},v=(t,e,a,o)=>{"katex"in window&&f.use(u(S));let n=s``;if(!e)return s`<div class="message-text">${t}</div>`;{const e={ALLOWED_TAGS:b,ALLOWED_ATTR:w};null!==a&&(e.ALLOWED_TAGS=a),null!==o&&(e.ALLOWED_ATTR=o);const i=f(t),l=m.sanitize(i,e),d=window.localStorage.getItem("preference-advanced-settings");if((d?JSON.parse(d):null)?.renderHTMLBlock&&/```html[\s\S]*?```/i.test(t)){const e=Array.from(t.matchAll(/```html\s*([\s\S]*?)```/gi)).map(t=>t[1]).join("\n");n=s`
2
+ <div class="iframe-container">
3
+ <div class="header">HTML Code Block Preview</div>
4
+ <iframe sandbox srcdoc=${e}></iframe>
5
+ </div>
6
+ `}else n=s`<div class="message-text" markdown-rendered="">
7
+ ${r(l)}
8
+ </div>`}return n},L=t=>{const{promise:e,resolve:s,reject:r}=Promise.withResolvers(),a=window.setTimeout(()=>{r("Timeout")},t);return{promise:e,resolve:t=>{clearTimeout(a),s(t)},reject:t=>{clearTimeout(a),r(t)}}},$=async t=>new Promise((e,s)=>{const r=new FileReader;r.onloadend=()=>{e(r.result)},r.onerror=s,r.readAsDataURL(t)}),k=async t=>{const e=(new TextEncoder).encode(t),s=await crypto.subtle.digest("SHA-256",e);return btoa(String.fromCharCode(...new Uint8Array(s)))},C=t=>Object.entries(t).map(([t,e])=>`${t}: ${e};`).join(" "),j=t=>s`
9
+ <table class="array-table">
10
+ ${t.map(t=>s`
11
+ <tr>
12
+ ${t.map(t=>s` <td>${JSON.stringify(t)}</td> `)}
13
+ </tr>
14
+ `)}
15
+ </table>
16
+ `,O=t=>{const e=t=>{let e=null;return 2===t.length?e="number"==typeof t[0]?[Number(t[0]),String(t[1])]:[String(t[0]),String(t[1])]:3===t.length?"number"==typeof t[0]?e=[Number(t[0]),String(t[1]),String(t[2])]:(e=[String(t[0]),String(t[1]),String(t[2])],r.push(e)):4===t.length&&(e="number"==typeof t[0]?[Number(t[0]),String(t[1]),String(t[2]),String(t[3])]:[String(t[0]),String(t[1]),String(t[2]),String(t[3])]),e},s=[],r=[],a={customLabels:s,customMessageLabels:r};if(!t.metadata)return a;const o=t=>{for(const[a,o]of Object.entries(t))if((a.startsWith("euphony-custom-labels")||a.startsWith("euphony_custom_labels"))&&Array.isArray(o)&&o.length>0)for(const t of o)Array.isArray(t)&&t.length>0&&s.push(t.map(String));else if((a.startsWith("euphony-custom-message-labels")||a.startsWith("euphony_custom_message_labels"))&&Array.isArray(o)&&o.length>0)for(const t of o)if(Array.isArray(t)&&t.length>0){const s=e(t);null!==s&&r.push(s)}};return o(t.metadata),"extras"in t.metadata&&o(t.metadata.extras),a};class T extends i{constructor(){super(...arguments),this.blockContents=[]}}g([t()],T.prototype,"blockContents");const W=t=>{if(!t.shadowRoot)throw new Error("Shadow root not initialized");if("blockContents"in t)for(const e of t.blockContents)e.isCollapsed=!1;const e=Array.from(t.shadowRoot.querySelectorAll("*")).filter(t=>t.tagName.startsWith("EUPHONY-")).map(t=>t);for(const t of e)W(t);"blockContents"in t&&t.blockContents.length>0&&t.requestUpdate()},E=t=>{if(!t.shadowRoot)throw new Error("Shadow root not initialized");if("blockContents"in t)for(const e of t.blockContents)e.isCollapsed=!0;const e=Array.from(t.shadowRoot.querySelectorAll("*")).filter(t=>t.tagName.startsWith("EUPHONY-")).map(t=>t);for(const t of e)E(t);"blockContents"in t&&t.blockContents.length>0&&t.requestUpdate()},N=(t,e)=>e.startsWith("data:")?e:`data:${t};base64,${e}`;export{T as E,O as a,x as b,L as c,W as d,E as e,j as f,v as g,$ as h,N as i,k as j,C as s,A as u};
@@ -0,0 +1,192 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import { CodexSessionSummary } from '../../types/common-types';
3
+ import { Conversation } from '../../types/harmony-types';
4
+ import { APIManager, BrowserAPIManager } from '../../utils/api-manager';
5
+ import { EuphonyCodex } from '../codex/codex';
6
+ import { NightjarConfirmDialog } from '../confirm-dialog/confirm-dialog';
7
+ import { EuphonyConversation } from '../conversation/conversation';
8
+ import { NightjarInputDialog } from '../input-dialog/input-dialog';
9
+ import { FocusModeSettings, MessageLabelSettings } from '../preference-window/preference-window';
10
+ import { EuphonySearchWindow } from '../search-window/search-window';
11
+ import { NightjarToast } from '../toast/toast';
12
+ import { EuphonyTokenWindow } from '../token-window/token-window';
13
+ import { LocalDataWorkerMessage } from './local-data-worker';
14
+ import { RequestWorker } from './request-worker';
15
+ import { URLManager } from './url-manager';
16
+ export interface ToastMessage {
17
+ message: string;
18
+ type: 'success' | 'warning' | 'error';
19
+ }
20
+ declare enum DataType {
21
+ CONVERSATION = "conversation",
22
+ CODEX = "codex",
23
+ CODEX_SESSION_INDEX = "codex-session-index",
24
+ JSON = "json"
25
+ }
26
+ type MenuItems = 'Load without cache' | 'Load Codex sessions' | 'Load from clipboard' | 'Load local file' | 'Editor mode' | 'Leave editor mode' | 'Filter data' | 'Preferences' | 'Code';
27
+ type ConversationViewerElement = EuphonyConversation | EuphonyCodex;
28
+ /**
29
+ * App element.
30
+ *
31
+ */
32
+ export declare class EuphonyApp extends LitElement {
33
+ allConversationData: Conversation[];
34
+ conversationData: Conversation[];
35
+ JSONData: Record<string, unknown>[];
36
+ codexSessionData: unknown[][];
37
+ codexSessionSummaries: CodexSessionSummary[];
38
+ dataType: DataType;
39
+ isLoadingData: boolean;
40
+ curPage: number;
41
+ globalIsShowingMetadata: boolean;
42
+ globalShouldRenderMarkdown: boolean;
43
+ jmespathQuery: string;
44
+ focusModeAuthor: string[];
45
+ focusModeRecipient: string[];
46
+ focusModeContentType: string[];
47
+ toastComponent: NightjarToast | undefined;
48
+ toastMessage: string;
49
+ toastType: 'success' | 'warning' | 'error';
50
+ confirmDialogComponent: NightjarConfirmDialog | undefined;
51
+ inputDialogComponent: NightjarInputDialog | undefined;
52
+ searchWindowComponent: EuphonySearchWindow | undefined;
53
+ tokenWindowComponent: EuphonyTokenWindow | undefined;
54
+ conversationGridElement: HTMLElement | undefined | null;
55
+ localFileInputElement: HTMLInputElement | undefined;
56
+ apiManager: APIManager;
57
+ requestWorker: RequestWorker;
58
+ browserAPIManager: BrowserAPIManager;
59
+ private pendingOpenAIKeyPromise;
60
+ euphonyStyleConfig: Record<string, string>;
61
+ appStyleConfig: Record<string, string>;
62
+ itemsPerPage: number;
63
+ _totalConversationSize: number;
64
+ _totalConversationSizeIncludingUnfiltered: number;
65
+ noCacheBlobPaths: Set<string>;
66
+ get totalConversationSize(): number;
67
+ get totalPageNum(): number;
68
+ get totalConversationSizeIncludingUnfiltered(): number;
69
+ isEditorMode: boolean;
70
+ selectedConversationIDs: Set<number>;
71
+ isFrontendOnlyMode: boolean;
72
+ showToolBarMenu: boolean;
73
+ isLoadingFromCache: boolean;
74
+ isLoadingFromClipboard: boolean;
75
+ isGridView: boolean;
76
+ gridViewColumnWidth: number;
77
+ comparisonColumnWidth: number;
78
+ showPreferenceWindow: boolean;
79
+ popperTooltip: HTMLElement | undefined;
80
+ showScrollTopButton: boolean;
81
+ urlManager: URLManager;
82
+ localDataWorker: Worker;
83
+ localDataWorkerRequestCount: number;
84
+ get localDataWorkerRequestID(): number;
85
+ activeLocalDataWorkerRequestID: number | null;
86
+ localDataWorkerPendingRequests: Map<number, {
87
+ resolve: () => void;
88
+ reject: (reason?: unknown) => void;
89
+ }>;
90
+ cacheInfoTooltipDebouncer: number | null;
91
+ constructor();
92
+ disconnectedCallback(): void;
93
+ /**
94
+ * This method is called when the DOM is added for the first time
95
+ */
96
+ firstUpdated(): void;
97
+ /**
98
+ * This method is called before new DOM is updated and rendered
99
+ * @param changedProperties Property that has been changed
100
+ */
101
+ willUpdate(changedProperties: PropertyValues<this>): void;
102
+ initData(): Promise<void>;
103
+ /**
104
+ * Load the JSONL file from the URL provided in the input element
105
+ * @returns
106
+ */
107
+ loadButtonClicked({ noCache }?: {
108
+ noCache?: boolean;
109
+ }): Promise<void>;
110
+ /**
111
+ * Serialize the current data and download it as a JSONL file
112
+ */
113
+ downloadButtonClicked(): void;
114
+ selectAllButtonClicked(): void;
115
+ updatePageNumber(newPageNumber: number, scrollToTop: boolean): Promise<void>;
116
+ loadCodexSessionsClicked(): Promise<void>;
117
+ openCodexSessionSummary(summary: CodexSessionSummary): Promise<void>;
118
+ pageClicked(e: CustomEvent<number>): void;
119
+ itemsPerPageChanged(e: CustomEvent<number>): void;
120
+ hashChanged(): Promise<void>;
121
+ conversationMetadataButtonToggled(e: CustomEvent<boolean>): Promise<void>;
122
+ markdownButtonToggled(e: CustomEvent<boolean>): Promise<void>;
123
+ menuItemClicked(e: CustomEvent<MenuItems>): void;
124
+ cacheInfoMouseEnter(e: MouseEvent): void;
125
+ cacheInfoMouseLeave(useTransition?: boolean): void;
126
+ preferenceWindowMaxMessageHeightChanged(e: CustomEvent<string>): void;
127
+ preferenceWindowMessageLabelChanged(e: CustomEvent<MessageLabelSettings>): void;
128
+ preferenceWindowGridViewColumnWidthChanged(e: CustomEvent<string>): void;
129
+ preferenceWindowComparisonWidthChanged(e: CustomEvent<string>): void;
130
+ preferenceWindowLayoutChanged(e: CustomEvent<string>): void;
131
+ preferenceWindowExpandAllClicked(): void;
132
+ preferenceWindowCollapseAllClicked(): void;
133
+ preferenceWindowTranslateAllClicked(): void;
134
+ preferenceWindowFocusModeSettingsChanged(e: CustomEvent<FocusModeSettings>): void;
135
+ searchWindowQuerySubmitted(e: CustomEvent<string>): Promise<void>;
136
+ /**
137
+ * Show the token window when user clicks on the harmony render button
138
+ * @param e CustomEvent<string> - The custom event containing the conversation string
139
+ */
140
+ harmonyRenderButtonClicked(e: CustomEvent<string>): void;
141
+ /**
142
+ * Ensures an OpenAI API key is available in localStorage.
143
+ * - If present, resolves immediately with the key.
144
+ * - If absent, shows a single input dialog and returns a shared Promise so
145
+ * concurrent requests wait for the same user action.
146
+ * - Resolves to null if the user cancels.
147
+ */
148
+ private ensureOpenAIAPIKey;
149
+ allChildrenUpdateComplete(): Promise<void>;
150
+ scrollToTop: (top?: number, behavior?: "instant" | "smooth") => void;
151
+ scrollToBottom: (behavior?: "instant" | "smooth") => void;
152
+ scrollToConversation: (conversationID: string, behavior?: "instant" | "smooth") => void;
153
+ scrollToMessage: (conversationID: string, messageIndex: number, behavior?: "instant" | "smooth") => void;
154
+ /**
155
+ * Validate and transform the conversations
156
+ * Transform the conversation id from `conversation_id` to `id` if it exists
157
+ *
158
+ * @param conversations - The conversations to validate and transform
159
+ * @returns The validated and transformed conversations
160
+ */
161
+ validateAndTransformConversations: (conversations: (string | Conversation | Record<string, unknown>)[]) => boolean;
162
+ validateConversation: (conversation: string | Conversation | Record<string, unknown>) => boolean;
163
+ validateComparison: (comparison: string | Conversation | Record<string, unknown>) => boolean;
164
+ loadDataFromText: (sourceText: string, sourceName: "clipboard" | "file") => Promise<void>;
165
+ loadDataFromFile: (sourceFile: File) => Promise<void>;
166
+ localDataWorkerMessageHandler(e: MessageEvent<LocalDataWorkerMessage>): void;
167
+ localFileInputChanged(e: Event): void;
168
+ loadData: ({ blobURL, offset, limit, showSuccessToast, noCache, jmespathQuery }: {
169
+ blobURL: string;
170
+ offset: number;
171
+ limit: number;
172
+ showSuccessToast?: boolean;
173
+ noCache?: boolean;
174
+ jmespathQuery?: string;
175
+ }) => Promise<{
176
+ isLoadDataSuccessful: boolean;
177
+ loadDataMessage: string;
178
+ loadedURL: string;
179
+ }>;
180
+ resetFilter: (filter: "jmespath" | "concept") => Promise<void>;
181
+ resetHash: () => void;
182
+ buildEuphonyStyle(styleConfig: Record<string, string>): string;
183
+ getConversationViewerElements(): ConversationViewerElement[];
184
+ render(): import('lit').TemplateResult<1>;
185
+ static styles: import('lit').CSSResult[];
186
+ }
187
+ declare global {
188
+ interface HTMLElementTagNameMap {
189
+ 'euphony-app': EuphonyApp;
190
+ }
191
+ }
192
+ export {};
@@ -0,0 +1,35 @@
1
+ import { Conversation } from '../../types/harmony-types';
2
+ export type LocalDataWorkerMessage = {
3
+ command: 'startParseData';
4
+ payload: {
5
+ requestID: number;
6
+ sourceName: 'clipboard' | 'file';
7
+ sourceText?: string;
8
+ sourceFile?: File;
9
+ };
10
+ } | {
11
+ command: 'finishParseData';
12
+ payload: {
13
+ requestID: number;
14
+ sourceName: 'clipboard' | 'file';
15
+ dataType: 'codex';
16
+ codexSessionData: unknown[];
17
+ } | {
18
+ requestID: number;
19
+ sourceName: 'clipboard' | 'file';
20
+ dataType: 'conversation';
21
+ conversationData: Conversation[];
22
+ } | {
23
+ requestID: number;
24
+ sourceName: 'clipboard' | 'file';
25
+ dataType: 'json';
26
+ jsonData: Record<string, unknown>[];
27
+ };
28
+ } | {
29
+ command: 'error';
30
+ payload: {
31
+ requestID: number;
32
+ sourceName: 'clipboard' | 'file';
33
+ message: string;
34
+ };
35
+ };
@@ -0,0 +1,45 @@
1
+ import { Semaphore } from 'async-mutex';
2
+ import { HarmonyRenderRequest, MessageSharingRequest, RefreshRendererListRequest, TranslationRequest } from '../../types/common-types';
3
+ import { APIManager, BrowserAPIManager } from '../../utils/api-manager';
4
+ import { URLManager } from './url-manager';
5
+ /**
6
+ * A class that handles requests from the euphony-conversation component.
7
+ */
8
+ export declare class RequestWorker {
9
+ apiBaseURL: string;
10
+ apiManager: APIManager;
11
+ browserAPIManager: BrowserAPIManager;
12
+ constructor(apiBaseURL: string);
13
+ static translationSemaphore: Semaphore;
14
+ /**
15
+ * Handles a translation request with max concurrency control using translationSemaphore.
16
+ * @param e The custom event containing the translation request details
17
+ */
18
+ translationRequestHandler(e: CustomEvent<TranslationRequest>): Promise<void>;
19
+ /**
20
+ * Handles a translation request using the OpenAI API directly from browser.
21
+ * @param e The custom event containing the translation request details
22
+ */
23
+ frontendOnlyTranslationRequestHandler(e: CustomEvent<TranslationRequest>, apiKey: string): Promise<void>;
24
+ /**
25
+ * Handles a fetch message sharing URL request.
26
+ * @param e The custom event containing the fetch message sharing URL request details
27
+ */
28
+ fetchMessageSharingURLRequestHandler(e: CustomEvent<MessageSharingRequest>, conversationIndex: number, urlManager: URLManager, blobPath: string | null): void;
29
+ /**
30
+ * Handles a renderer refresh request by calling API
31
+ */
32
+ refreshRendererListRequestHandler(e: CustomEvent<RefreshRendererListRequest>): Promise<void>;
33
+ /**
34
+ * Handles a renderer refresh request in frontend-only mode.
35
+ */
36
+ frontendOnlyRefreshRendererListRequestHandler(e: CustomEvent<RefreshRendererListRequest>): Promise<void>;
37
+ /**
38
+ * Handles a harmony render request by calling API
39
+ */
40
+ harmonyRenderRequestHandler(e: CustomEvent<HarmonyRenderRequest>): Promise<void>;
41
+ /**
42
+ * Handles a harmony render request in frontend-only mode.
43
+ */
44
+ frontendOnlyHarmonyRenderRequestHandler(e: CustomEvent<HarmonyRenderRequest>): Promise<void>;
45
+ }
@@ -0,0 +1,25 @@
1
+ import { EuphonyApp } from './app';
2
+ export declare class URLManager {
3
+ private app;
4
+ constructor(app: EuphonyApp);
5
+ /**
6
+ * Update the URL based on the current configs.
7
+ */
8
+ updateURL(): void;
9
+ /**
10
+ * Update the configs based on the current URL.
11
+ */
12
+ updateConfigsFromURL(): void;
13
+ /**
14
+ * Get the share URL for a conversation.
15
+ * @param conversationID The ID of the conversation to share.
16
+ * @returns The share URL for the conversation.
17
+ */
18
+ getShareURL: (conversationID: number, blobPath: string | null) => string;
19
+ /**
20
+ * Get the share URL for a message.
21
+ * @param conversationID The ID of the conversation to share.
22
+ * @returns The share URL for the message.
23
+ */
24
+ getMessageShareURL: (conversationID: number, messageIndex: number, blobPath: string | null) => string;
25
+ }
@@ -0,0 +1,50 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import { Conversation } from '../../types/harmony-types';
3
+ import { EuphonyConversation } from '../conversation/conversation';
4
+ import { FocusModeSettings, MessageLabelSettings } from '../preference-window/preference-window';
5
+ export declare class EuphonyCodex extends LitElement {
6
+ sessionString: string;
7
+ sessionData: unknown[] | null;
8
+ sharingURL: string | null;
9
+ conversationLabel: string;
10
+ conversationMaxWidth: string | null;
11
+ conversationStyle: string;
12
+ previewMode: boolean;
13
+ shouldRenderMarkdown: boolean;
14
+ isShowingMetadata: boolean;
15
+ focusModeAuthor: string[];
16
+ focusModeRecipient: string[];
17
+ focusModeContentType: string[];
18
+ disableMarkdownButton: boolean;
19
+ disableTranslationButton: boolean;
20
+ disableShareButton: boolean;
21
+ disableMetadataButton: boolean;
22
+ disableMessageMetadata: boolean;
23
+ disableConversationName: boolean;
24
+ disablePreferenceButton: boolean;
25
+ disableImagePreviewWindow: boolean;
26
+ disableTokenWindow: boolean;
27
+ disableEditingModeSaveButton: boolean;
28
+ disableConversationIDCopyButton: boolean;
29
+ disableDownloadConvoButtonTooltip: string;
30
+ disableCopyConvoButtonTooltip: string;
31
+ theme: 'auto' | 'light' | 'dark';
32
+ conversation: Conversation | null;
33
+ parseError: string | null;
34
+ conversationComponent: EuphonyConversation | undefined;
35
+ private parseSessionString;
36
+ private refreshConversationFromSession;
37
+ willUpdate(changedProperties: PropertyValues<this>): void;
38
+ render(): import('lit').TemplateResult<1>;
39
+ static styles: import('lit').CSSResult[];
40
+ preferenceWindowMessageLabelChanged(e: CustomEvent<MessageLabelSettings>): void;
41
+ preferenceWindowFocusModeSettingsChanged(e: CustomEvent<FocusModeSettings>): void;
42
+ expandBlockContents(): void;
43
+ collapseBlockContents(): void;
44
+ translationButtonClicked(): void;
45
+ }
46
+ declare global {
47
+ interface HTMLElementTagNameMap {
48
+ 'euphony-codex': EuphonyCodex;
49
+ }
50
+ }
@@ -0,0 +1,36 @@
1
+ import{v as t,i as e,n as o,r as n,e as s,a,b as i,o as r,w as l}from"../../chunks/third-party.js";import{R as p}from"../../chunks/harmony-types.js";import"../../chunks/conversation.js";import{c as d}from"../../chunks/css/codex.js";import"../message-code/message-code.js";import"../message-developer-content/message-developer-content.js";import"../message-system-content/message-system-content.js";import"../message-text/message-text.js";import"../message-unsupported/message-unsupported.js";import"../../chunks/utils.js";const u={"purple-700":"hsl(282, 67.88%, 37.84%)","blue-700":"hsl(209, 78.72%, 46.08%)","green-700":"hsl(122, 43.43%, 38.82%)","gray-700":"hsl(0, 0.0%, 38.04%)"},c={colors:u},m=new Set(["session_meta","response_item","event_msg","turn_context","compacted"]),y=new Set(["message","function_call","function_call_output","custom_tool_call","custom_tool_call_output","reasoning"]),h=new Set(["user_message","agent_message","agent_reasoning","context_compacted","turn_aborted","token_count"]),g=t=>"object"==typeof t&&null!==t,b=t=>{try{return JSON.parse(t)}catch{return null}},f=t=>{const e=[];for(const o of t){if("string"==typeof o){const t=b(o);g(t)&&e.push(t);continue}g(o)&&e.push(o)}return e},v=t=>{if("string"!=typeof t.type)return!1;if(m.has(t.type)){if("response_item"===t.type){const e=t.payload&&"string"==typeof t.payload.type?t.payload.type:null;return!e||y.has(e)}if("event_msg"===t.type){const e=t.payload&&"string"==typeof t.payload.type?t.payload.type:null;return!e||h.has(e)}return!0}return t.type.startsWith("response_")||t.type.startsWith("event_")},_=t=>{if(!Array.isArray(t)||0===t.length)return!1;const e=f(t).filter(v);return!(0===e.length||e.length/t.length<.6)&&(!!e.some(t=>"session_meta"===t.type)||e.filter(t=>m.has(t.type??"")).length/e.length>=.6)},$=t=>{if(!t)return null;const e=Date.parse(t);return Number.isNaN(e)?null:e/1e3},w=t=>{try{const e=JSON.parse(JSON.stringify(t));return e.payload&&"encrypted_content"in e.payload&&(e.payload.encrypted_content="[omitted]"),e}catch{return t}},x=t=>JSON.stringify(t,null,2),S=t=>"string"==typeof t||"number"==typeof t||"boolean"==typeof t?String(t):null,B=t=>{if("string"==typeof t)return t;if(Array.isArray(t))return t.map(t=>B(t)).filter(t=>""!==t).join("\n");if(g(t))for(const e of["text","content","value"])if(e in t)return B(t[e]);return""},C=t=>g(t)&&"text"in t?B(t.text).trim():B(t).trim(),M=t=>{const e=b(t);return null===e?t:x(e)},k=t=>{if(g(t)&&"string"==typeof t.cmd)return t.cmd;if("string"!=typeof t)return null;const e=b(t);return null===e?t:g(e)&&"string"==typeof e.cmd?e.cmd:null},A=t=>{switch(t){case"assistant":return p.Assistant;case"user":return p.User;case"system":default:return p.System;case"tool":return p.Tool;case"developer":return p.Developer}},T=({id:t,role:e,text:o,timestamp:n,metadata:s,name:a,recipient:i,channel:r})=>({id:t,role:e,name:a,content:[{text:o}],create_time:n??void 0,metadata:s,recipient:i,channel:r}),j=({id:t,instructions:e,timestamp:o,metadata:n,name:s,recipient:a,channel:i})=>({id:t,role:p.Developer,name:s,content:[{instructions:e}],create_time:o??void 0,metadata:n,recipient:a,channel:i}),D=({id:t,role:e,code:o,language:n,timestamp:s,metadata:a,name:i,recipient:r,channel:l})=>({id:t,role:e,name:i,content:[{content_type:"code",text:o,language:n}],create_time:s??void 0,metadata:a,recipient:r,channel:l}),N=t=>{if(!_(t))return null;const e=f(t).filter(v),o=[],n=new Map,s=e.some(t=>"response_item"===t.type&&g(t.payload)&&"message"===t.payload.type&&"user"===t.payload.role),a=e.some(t=>"response_item"===t.type&&g(t.payload)&&"message"===t.payload.type&&"assistant"===t.payload.role),i=e.some(t=>"response_item"===t.type&&g(t.payload)&&"reasoning"===t.payload.type);let r=0,l=0,d=0,u=0;const m=e.find(t=>"session_meta"===t.type),y=m?.payload??{},h=e.find(t=>"turn_context"===t.type)?.payload??{},b=y.id??`codex-session-${Date.now()}`,B="string"==typeof h.model?h.model:null,N="string"==typeof y.cli_version?y.cli_version:null,W="string"==typeof y.timestamp?y.timestamp:null,L=C(y.base_instructions),R=["Codex session"],E=S(y.id);E&&R.push(`id: ${E}`),W&&R.push(`started: ${W}`);const O=S(y.cwd);O&&R.push(`cwd: ${O}`);const I=S(y.originator);if(I&&R.push(`originator: ${I}`),N&&R.push(`cli_version: ${N}`),B&&R.push(`model: ${B}`),y.git&&g(y.git)){const t=y.git,e=S(t.branch)??"unknown",o=S(t.commit_hash)??"unknown";("unknown"!==e||"unknown"!==o)&&R.push(`git: ${e}@${o}`)}if(R.length>1){const t=m??{type:"session_meta",payload:y};o.push(T({id:`${b}-summary`,role:p.System,text:R.join("\n"),timestamp:$(m?.timestamp),metadata:{codex_event_type:"session_meta",codex_event:w(t)},name:"codex"})),r+=1}L&&(o.push(j({id:`${b}-base-instructions`,instructions:L,timestamp:$(m?.timestamp),metadata:{codex_event_type:"session_meta",codex_source:"session_meta.base_instructions.text",codex_event:w(m??{type:"session_meta",payload:y})}})),r+=1);for(const[t,c]of e.entries()){const e=c.type??"unknown",m=c.payload??{},y=$(c.timestamp),h={codex_event_type:e,codex_payload_type:m.type??null,codex_event:w(c),codex_function_name:"string"==typeof m.name?m.name:null};if("response_item"===e){const e=m.type??"unknown";if("message"===e){const e=(Array.isArray(m.content)?m.content:[]).map(t=>"string"==typeof t.text?t.text:"string"==typeof t.type?`[${t.type}]`:"").filter(Boolean);o.push(T({id:`${b}-message-${t}`,role:A(m.role),text:e.length>0?e.join("\n"):"[empty message]",timestamp:y,metadata:h})),r+=1;continue}if("reasoning"===e){const e=(Array.isArray(m.summary)?m.summary:[]).map(t=>"string"==typeof t.text?t.text:"").filter(Boolean).join("\n");e&&(o.push(T({id:`${b}-reasoning-${t}`,role:p.Assistant,text:e,timestamp:y,metadata:h,channel:"analysis"})),u+=1);continue}if("function_call"===e){const e=m.name??"tool",s=m.call_id??`${b}-call-${t}`;n.set(s,e);const a="exec_command"===e?k(m.arguments):null;null!==a?o.push(D({id:`${b}-call-${s}`,role:p.Tool,code:a,language:"bash",timestamp:y,metadata:h,name:e,recipient:e,channel:"call"})):o.push(D({id:`${b}-call-${s}`,role:p.Tool,code:x(m),language:"json",timestamp:y,metadata:h,name:e,recipient:e,channel:"call"})),l+=1;continue}if("custom_tool_call"===e){const s=m.name??"tool",a=m.call_id??`${b}-call-${t}`;if(n.set(a,s),"string"==typeof m.input&&m.input.includes("\n")){o.push(D({id:`${b}-call-${a}`,role:p.Tool,code:`tool: ${s}\ncall_id: ${a}\n\n${m.input}`,language:"text",timestamp:y,metadata:h,name:s,recipient:s,channel:"call"})),l+=1;continue}const i={type:e,name:s,call_id:a};void 0!==m.input&&(i.input=m.input),m.status&&(i.status=m.status),o.push(D({id:`${b}-call-${a}`,role:p.Tool,code:x(i),language:"json",timestamp:y,metadata:h,name:s,recipient:s,channel:"call"})),l+=1;continue}if("function_call_output"===e||"custom_tool_call_output"===e){const e=m.call_id??`${b}-call-${t}`,s=m.name??n.get(e)??"tool",a="string"==typeof m.output?M(m.output):void 0!==m.output?x(m.output):"[empty output]";o.push(D({id:`${b}-output-${e}`,role:p.Tool,code:a,language:"text",timestamp:y,metadata:h,name:s,recipient:s,channel:"output"})),d+=1;continue}o.push(D({id:`${b}-response-${t}`,role:p.System,code:x({type:e,...m}),language:"json",timestamp:y,metadata:h,name:"codex",channel:"response"}));continue}if("event_msg"===e){const e=m.type??"unknown";if(!s&&"user_message"===e){o.push(T({id:`${b}-user-${t}`,role:p.User,text:"string"==typeof m.message?m.message:"[empty message]",timestamp:y,metadata:h})),r+=1;continue}if(!a&&"agent_message"===e){o.push(T({id:`${b}-assistant-${t}`,role:p.Assistant,text:"string"==typeof m.message?m.message:"[empty message]",timestamp:y,metadata:h})),r+=1;continue}if(!i&&"agent_reasoning"===e){o.push(T({id:`${b}-reasoning-${t}`,role:p.Assistant,text:"string"==typeof m.text?m.text:"[empty reasoning]",timestamp:y,metadata:h,channel:"analysis"})),u+=1;continue}"context_compacted"===e&&(o.push(T({id:`${b}-compacted-${t}`,role:p.System,text:"Context compacted",timestamp:y,metadata:h,name:"codex"})),r+=1)}}const P=e.length>0?$(e[0].timestamp):null,J=[];return b&&J.push(["Session",b.slice(0,8),b,c.colors["blue-700"]]),B&&J.push(["Model",B,"From turn_context",c.colors["purple-700"]]),N&&J.push(["CLI",N,"Codex CLI version",c.colors["gray-700"]]),J.push(["Events",String(e.length),"JSONL event count",c.colors["green-700"]]),{conversation:{id:b,create_time:P??Date.now()/1e3,messages:o,metadata:{codex_session_meta:y,codex_turn_context:h,codex_event_counts:{events:e.length,messages:r,tool_calls:l,tool_outputs:d,reasoning:u},"euphony-custom-labels":J}},customLabels:J}};var W=Object.defineProperty,L=Object.getOwnPropertyDescriptor,R=(t,e,o,n)=>{for(var s,a=n>1?void 0:n?L(e,o):e,i=t.length-1;i>=0;i--)(s=t[i])&&(a=(n?s(e,o,a):s(a))||a);return n&&a&&W(e,o,a),a};let E=class extends a{constructor(){super(...arguments),this.sessionString="",this.sessionData=null,this.sharingURL=null,this.conversationLabel="Session",this.conversationMaxWidth=null,this.conversationStyle="",this.previewMode=!1,this.shouldRenderMarkdown=!1,this.isShowingMetadata=!1,this.focusModeAuthor=[],this.focusModeRecipient=[],this.focusModeContentType=[],this.disableMarkdownButton=!1,this.disableTranslationButton=!1,this.disableShareButton=!1,this.disableMetadataButton=!1,this.disableMessageMetadata=!1,this.disableConversationName=!1,this.disablePreferenceButton=!1,this.disableImagePreviewWindow=!1,this.disableTokenWindow=!1,this.disableEditingModeSaveButton=!1,this.disableConversationIDCopyButton=!1,this.disableDownloadConvoButtonTooltip="",this.disableCopyConvoButtonTooltip="",this.theme="light",this.conversation=null,this.parseError=null}parseSessionString(t){const e=t.split("\n").map(t=>t.trim()).filter(t=>""!==t),o=[];for(const t of e)try{o.push(JSON.parse(t))}catch{}return o}refreshConversationFromSession(){const t=Array.isArray(this.sessionData)&&this.sessionData.length>0?this.sessionData??[]:""!==this.sessionString?this.parseSessionString(this.sessionString):[],e=N(t);if(!e)return this.conversation=null,void(this.parseError=0===t.length?"No Codex session data found.":"Unsupported or malformed Codex session JSONL.");this.conversation=e.conversation,this.parseError=null}willUpdate(t){(t.has("sessionString")||t.has("sessionData"))&&this.refreshConversationFromSession()}render(){if(!this.conversation)return i`
2
+ <div class="empty-state">
3
+ ${this.parseError??"No Codex session to display."}
4
+ </div>
5
+ `;const t=this.previewMode&&0===this.focusModeAuthor.length?["user","assistant"]:this.focusModeAuthor;return i`
6
+ <div class="codex-wrapper">
7
+ <euphony-conversation
8
+ .conversationData=${this.conversation}
9
+ sharing-url=${r(this.sharingURL??void 0)}
10
+ conversation-label=${this.conversationLabel}
11
+ conversation-max-width=${r(this.conversationMaxWidth??void 0)}
12
+ ?should-render-markdown=${this.shouldRenderMarkdown}
13
+ ?is-showing-metadata=${this.isShowingMetadata}
14
+ .focusModeAuthor=${t}
15
+ .focusModeRecipient=${this.focusModeRecipient}
16
+ .focusModeContentType=${this.focusModeContentType}
17
+ ?disable-markdown-button=${this.disableMarkdownButton}
18
+ ?disable-translation-button=${this.disableTranslationButton}
19
+ ?disable-share-button=${this.disableShareButton}
20
+ ?disable-metadata-button=${this.disableMetadataButton}
21
+ ?disable-message-metadata=${this.disableMessageMetadata}
22
+ ?disable-conversation-name=${this.disableConversationName}
23
+ ?disable-preference-button=${this.disablePreferenceButton}
24
+ ?disable-image-preview-window=${this.disableImagePreviewWindow}
25
+ ?disable-token-window=${this.disableTokenWindow}
26
+ ?disable-editing-mode-save-button=${this.disableEditingModeSaveButton}
27
+ ?disable-conversation-id-copy-button=${this.disableConversationIDCopyButton}
28
+ disable-download-convo-button-tooltip=${r(this.disableDownloadConvoButtonTooltip||void 0)}
29
+ disable-copy-convo-button-tooltip=${r(this.disableCopyConvoButtonTooltip||void 0)}
30
+ theme=${this.theme}
31
+ style=${this.conversationStyle}
32
+ ></euphony-conversation>
33
+ </div>
34
+ `}preferenceWindowMessageLabelChanged(t){this.conversationComponent?.preferenceWindowMessageLabelChanged(t)}preferenceWindowFocusModeSettingsChanged(t){this.conversationComponent?.preferenceWindowFocusModeSettingsChanged(t)}expandBlockContents(){this.conversationComponent?.expandBlockContents()}collapseBlockContents(){this.conversationComponent?.collapseBlockContents()}translationButtonClicked(){this.conversationComponent?.translationButtonClicked()}};E.styles=[e`
35
+ ${t(d)}
36
+ `],R([o({type:String,attribute:"session-string"})],E.prototype,"sessionString",2),R([o({attribute:!1})],E.prototype,"sessionData",2),R([o({type:String,attribute:"sharing-url"})],E.prototype,"sharingURL",2),R([o({type:String,attribute:"conversation-label"})],E.prototype,"conversationLabel",2),R([o({type:String,attribute:"conversation-max-width"})],E.prototype,"conversationMaxWidth",2),R([o({type:String,attribute:"conversation-style"})],E.prototype,"conversationStyle",2),R([o({type:Boolean,attribute:"preview-mode"})],E.prototype,"previewMode",2),R([o({type:Boolean,attribute:"should-render-markdown"})],E.prototype,"shouldRenderMarkdown",2),R([o({type:Boolean,attribute:"is-showing-metadata"})],E.prototype,"isShowingMetadata",2),R([o({type:Array,attribute:"focus-mode-author"})],E.prototype,"focusModeAuthor",2),R([o({type:Array,attribute:"focus-mode-recipient"})],E.prototype,"focusModeRecipient",2),R([o({type:Array,attribute:"focus-mode-content-type"})],E.prototype,"focusModeContentType",2),R([o({type:Boolean,attribute:"disable-markdown-button"})],E.prototype,"disableMarkdownButton",2),R([o({type:Boolean,attribute:"disable-translation-button"})],E.prototype,"disableTranslationButton",2),R([o({type:Boolean,attribute:"disable-share-button"})],E.prototype,"disableShareButton",2),R([o({type:Boolean,attribute:"disable-metadata-button"})],E.prototype,"disableMetadataButton",2),R([o({type:Boolean,attribute:"disable-message-metadata"})],E.prototype,"disableMessageMetadata",2),R([o({type:Boolean,attribute:"disable-conversation-name"})],E.prototype,"disableConversationName",2),R([o({type:Boolean,attribute:"disable-preference-button"})],E.prototype,"disablePreferenceButton",2),R([o({type:Boolean,attribute:"disable-image-preview-window"})],E.prototype,"disableImagePreviewWindow",2),R([o({type:Boolean,attribute:"disable-token-window"})],E.prototype,"disableTokenWindow",2),R([o({type:Boolean,attribute:"disable-editing-mode-save-button"})],E.prototype,"disableEditingModeSaveButton",2),R([o({type:Boolean,attribute:"disable-conversation-id-copy-button"})],E.prototype,"disableConversationIDCopyButton",2),R([o({type:String,attribute:"disable-download-convo-button-tooltip"})],E.prototype,"disableDownloadConvoButtonTooltip",2),R([o({type:String,attribute:"disable-copy-convo-button-tooltip"})],E.prototype,"disableCopyConvoButtonTooltip",2),R([o({type:String,attribute:"theme"})],E.prototype,"theme",2),R([n()],E.prototype,"conversation",2),R([n()],E.prototype,"parseError",2),R([s("euphony-conversation")],E.prototype,"conversationComponent",2),E=R([l("euphony-codex")],E);export{E as EuphonyCodex,_ as i,N as p};
@@ -0,0 +1,42 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ export interface DialogInfo {
3
+ header: string;
4
+ message: string;
5
+ yesButtonText: string;
6
+ /**
7
+ * Used to identify actions to skip
8
+ */
9
+ actionKey: string;
10
+ }
11
+ /**
12
+ * Confirm dialog element.
13
+ *
14
+ */
15
+ export declare class NightjarConfirmDialog extends LitElement {
16
+ dialogElement: HTMLDialogElement | undefined;
17
+ header: string;
18
+ message: string;
19
+ yesButtonText: string;
20
+ actionKey: string;
21
+ confirmAction: () => void;
22
+ cancelAction: () => void;
23
+ constructor();
24
+ firstUpdated(): void;
25
+ /**
26
+ * This method is called before new DOM is updated and rendered
27
+ * @param changedProperties Property that has been changed
28
+ */
29
+ willUpdate(changedProperties: PropertyValues<this>): void;
30
+ initData: () => Promise<void>;
31
+ show(dialogInfo: DialogInfo, confirmAction: () => void, cancelAction?: () => void): void;
32
+ dialogClicked(e: MouseEvent): void;
33
+ cancelClicked(e: MouseEvent): void;
34
+ confirmClicked(e: MouseEvent): void;
35
+ render(): import('lit').TemplateResult<1>;
36
+ static styles: import('lit').CSSResult[];
37
+ }
38
+ declare global {
39
+ interface HTMLElementTagNameMap {
40
+ 'nightjar-confirm-dialog': NightjarConfirmDialog;
41
+ }
42
+ }
@@ -0,0 +1,41 @@
1
+ import{v as t,i as e,e as i,r as o,a as s,b as a,w as c}from"../../chunks/third-party.js";import{c as n}from"../../chunks/css/confirm-dialog.js";var l=Object.defineProperty,r=Object.getOwnPropertyDescriptor,d=(t,e,i,o)=>{for(var s,a=o>1?void 0:o?r(e,i):e,c=t.length-1;c>=0;c--)(s=t[c])&&(a=(o?s(e,i,a):s(a))||a);return o&&a&&l(e,i,a),a};let h=class extends s{constructor(){super(),this.header="Delete Item",this.message="Are you sure you want to delete this item? This action cannot be undone.",this.yesButtonText="Delete",this.actionKey="deletion",this.initData=async()=>{},this.confirmAction=()=>{},this.cancelAction=()=>{}}firstUpdated(){window.setTimeout(()=>{},1e3)}willUpdate(t){}show(t,e,i){this.header=t.header,this.message=t.message,this.yesButtonText=t.yesButtonText,this.actionKey=t.actionKey,this.confirmAction=e,this.cancelAction=void 0===i?()=>{}:i,"true"===localStorage.getItem(`<skip-confirm>${this.actionKey}`)?this.confirmAction():this.dialogElement&&this.dialogElement.showModal()}dialogClicked(t){t.target===this.dialogElement&&this.dialogElement.close()}cancelClicked(t){t.stopPropagation(),this.dialogElement&&(this.dialogElement.close(),this.cancelAction())}confirmClicked(t){if(t.stopPropagation(),this.dialogElement){if(this.dialogElement.querySelector("#checkbox-skip-confirmation")?.checked){const t=`<skip-confirm>${this.actionKey}`;localStorage.setItem(t,"true")}this.confirmAction(),this.dialogElement.close()}}render(){return a`
2
+ <dialog
3
+ class="confirm-dialog"
4
+ @click=${t=>{this.dialogClicked(t)}}
5
+ >
6
+ <div class="header">
7
+ <div class="header-name">${this.header}</div>
8
+ </div>
9
+
10
+ <div class="content">
11
+ <div class="message">${this.message}</div>
12
+ <div class="skip-bar">
13
+ <input
14
+ type="checkbox"
15
+ id="checkbox-skip-confirmation"
16
+ name="checkbox-skip-confirmation"
17
+ />
18
+ <label for="checkbox-skip-confirmation"
19
+ >Don't ask me again about this action</label
20
+ >
21
+ </div>
22
+ </div>
23
+
24
+ <div class="button-block">
25
+ <button
26
+ class="cancel-button"
27
+ @click=${t=>{this.cancelClicked(t)}}
28
+ >
29
+ Cancel
30
+ </button>
31
+ <button
32
+ class="confirm-button"
33
+ @click=${t=>{this.confirmClicked(t)}}
34
+ >
35
+ ${this.yesButtonText}
36
+ </button>
37
+ </div>
38
+ </dialog>
39
+ `}};h.styles=[e`
40
+ ${t(n)}
41
+ `],d([i("dialog")],h.prototype,"dialogElement",2),d([o()],h.prototype,"header",2),d([o()],h.prototype,"message",2),d([o()],h.prototype,"yesButtonText",2),h=d([c("nightjar-confirm-dialog")],h);export{h as NightjarConfirmDialog};