@ziteh/yangchun-comment-client 0.1.0 → 0.2.0-alpha.1

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 (50) hide show
  1. package/README.md +6 -0
  2. package/dist/src/api/apiService.d.ts +22 -0
  3. package/dist/src/api/globalApiService.d.ts +10 -0
  4. package/dist/src/components/comment-admin.d.ts +25 -0
  5. package/dist/src/components/comment-dialog.d.ts +18 -0
  6. package/dist/src/components/comment-info.d.ts +14 -0
  7. package/dist/src/components/comment-input.d.ts +31 -0
  8. package/dist/src/components/list/comment-list-item.d.ts +19 -0
  9. package/dist/src/components/list/comment-list.d.ts +9 -0
  10. package/dist/src/components/yangchun-comment.d.ts +58 -0
  11. package/dist/src/components/yangchun-comment.styles.d.ts +2 -0
  12. package/dist/src/index.d.ts +1 -0
  13. package/dist/src/utils/comment.d.ts +6 -0
  14. package/dist/src/utils/format.d.ts +2 -0
  15. package/dist/src/utils/i18n.d.ts +46 -0
  16. package/dist/src/utils/pow.d.ts +9 -0
  17. package/dist/{utils → src/utils}/pseudonym.d.ts +0 -1
  18. package/dist/src/utils/sanitize.d.ts +1 -0
  19. package/dist/test/sanitize.test.d.ts +1 -0
  20. package/dist/yangchun-comment.js +962 -0
  21. package/dist/yangchun-comment.js.map +1 -0
  22. package/dist/yangchun-comment.umd.cjs +962 -0
  23. package/dist/yangchun-comment.umd.cjs.map +1 -0
  24. package/package.json +17 -13
  25. package/dist/element.d.ts +0 -97
  26. package/dist/element.js +0 -680
  27. package/dist/index.d.ts +0 -9
  28. package/dist/index.js +0 -23
  29. package/dist/types.d.ts +0 -3
  30. package/dist/utils/apiService.d.ts +0 -15
  31. package/dist/utils/apiService.js +0 -118
  32. package/dist/utils/format.d.ts +0 -1
  33. package/dist/utils/format.js +0 -14
  34. package/dist/utils/i18n.d.ts +0 -51
  35. package/dist/utils/i18n.js +0 -98
  36. package/dist/utils/pseudonym.js +0 -34
  37. package/dist/utils/sanitize.d.ts +0 -4
  38. package/dist/utils/sanitize.js +0 -59
  39. package/dist/utils/wordBank.js +0 -692
  40. package/dist/views/comments.d.ts +0 -3
  41. package/dist/views/comments.js +0 -119
  42. package/dist/views/preview.d.ts +0 -3
  43. package/dist/views/preview.js +0 -53
  44. package/dist/yangchun-comment.css +0 -1
  45. package/dist/yangchun-comment.es.js +0 -317
  46. package/dist/yangchun-comment.es.js.map +0 -1
  47. package/dist/yangchun-comment.umd.js +0 -317
  48. package/dist/yangchun-comment.umd.js.map +0 -1
  49. /package/dist/{types.js → src/utils/pow.worker.d.ts} +0 -0
  50. /package/dist/{utils → src/utils}/wordBank.d.ts +0 -0
@@ -1,317 +0,0 @@
1
- var e,t={"":["<em>","</em>"],_:["<strong>","</strong>"],"*":["<strong>","</strong>"],"~":["<s>","</s>"],"\n":["<br />"]," ":["<br />"],"-":["<hr />"]};function n(e){return e.replace(RegExp("^"+(e.match(/^(\t| )+/)||"")[0],"gm"),"")}function i(e){return(e+"").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function o(e,r){var a,s,l,c,m,d=/((?:^|\n+)(?:\n---+|\* \*(?: \*)+)\n)|(?:^``` *(\w*)\n([\s\S]*?)\n```$)|((?:(?:^|\n+)(?:\t| {2,}).+)+\n*)|((?:(?:^|\n)([>*+-]|\d+\.)\s+.*)+)|(?:!\[([^\]]*?)\]\(([^)]+?)\))|(\[)|(\](?:\(([^)]+?)\))?)|(?:(?:^|\n+)([^\s].*)\n(-{3,}|={3,})(?:\n+|$))|(?:(?:^|\n+)(#{1,6})\s*(.+)(?:\n+|$))|(?:`([^`].*?)`)|( \n\n*|\n{2,}|__|\*\*|[_*]|~~)/gm,p=[],u="",h=r||{},g=0;function f(e){var n=t[e[1]||""],i=p[p.length-1]==e;return n?n[1]?(i?p.pop():p.push(e),n[0|i]):n[0]:e}function y(){for(var e="";p.length;)e+=f(p[p.length-1]);return e}for(e=e.replace(/^\[(.+?)\]:\s*(.+)$/gm,function(e,t,n){return h[t.toLowerCase()]=n,""}).replace(/^\n+|\n+$/g,"");l=d.exec(e);)s=e.substring(g,l.index),g=d.lastIndex,a=l[0],s.match(/[^\\](\\\\)*\\$/)||((m=l[3]||l[4])?a='<pre class="code '+(l[4]?"poetry":l[2].toLowerCase())+'"><code'+(l[2]?' class="language-'+l[2].toLowerCase()+'"':"")+">"+n(i(m).replace(/^\n+|\n+$/g,""))+"</code></pre>":(m=l[6])?(m.match(/\./)&&(l[5]=l[5].replace(/^\d+/gm,"")),c=o(n(l[5].replace(/^\s*[>*+.-]/gm,""))),">"==m?m="blockquote":(m=m.match(/\./)?"ol":"ul",c=c.replace(/^(.*)(\n|$)/gm,"<li>$1</li>")),a="<"+m+">"+c+"</"+m+">"):l[8]?a='<img src="'+i(l[8])+'" alt="'+i(l[7])+'">':l[10]?(u=u.replace("<a>",'<a href="'+i(l[11]||h[s.toLowerCase()])+'">'),a=y()+"</a>"):l[9]?a="<a>":l[12]||l[14]?a="<"+(m="h"+(l[14]?l[14].length:l[13]>"="?1:2))+">"+o(l[12]||l[15],h)+"</"+m+">":l[16]?a="<code>"+i(l[16])+"</code>":(l[17]||l[1])&&(a=f(l[17]||"--"))),u+=s,u+=a;return(u+e.substring(g)+y()).replace(/^\n+|\n+$/g,"")}
2
- /**
3
- * @license
4
- * Copyright 2019 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */const r=globalThis,a=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),l=new WeakMap;let c=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(a&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=l.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&l.set(t,e))}return e}toString(){return this.cssText}};const m=a?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new c("string"==typeof e?e:e+"",void 0,s))(t)})(e):e,{is:d,defineProperty:p,getOwnPropertyDescriptor:u,getOwnPropertyNames:h,getOwnPropertySymbols:g,getPrototypeOf:f}=Object,y=globalThis,v=y.trustedTypes,b=v?v.emptyScript:"",w=y.reactiveElementPolyfillSupport,A=(e,t)=>e,_={toAttribute(e,t){switch(t){case Boolean:e=e?b:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},S=(e,t)=>!d(e,t),T={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:S};
7
- /**
8
- * @license
9
- * Copyright 2017 Google LLC
10
- * SPDX-License-Identifier: BSD-3-Clause
11
- */Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;let $=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=T){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);void 0!==i&&p(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:o}=u(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){const r=i?.call(this);o?.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??T}static _$Ei(){if(this.hasOwnProperty(A("elementProperties")))return;const e=f(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(A("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(A("properties"))){const e=this.properties,t=[...h(e),...g(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(m(e))}else void 0!==e&&t.push(m(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(a)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const n of t){const t=document.createElement("style"),i=r.litNonce;void 0!==i&&t.setAttribute("nonce",i),t.textContent=n.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(void 0!==i&&!0===n.reflect){const o=(void 0!==n.converter?.toAttribute?n.converter:_).toAttribute(t,n.type);this._$Em=e,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(void 0!==i&&this._$Em!==i){const e=n.getPropertyOptions(i),o="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:_;this._$Em=i;const r=o.fromAttribute(t,e.type);this[i]=r??this._$Ej?.get(i)??r,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const i=this.constructor,o=this[e];if(n??=i.getPropertyOptions(e),!((n.hasChanged??S)(o,t)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:o},r){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),!0!==o||void 0!==r)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,n,i)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[A("elementProperties")]=new Map,$[A("finalized")]=new Map,w?.({ReactiveElement:$}),(y.reactiveElementVersions??=[]).push("2.1.1");
12
- /**
13
- * @license
14
- * Copyright 2017 Google LLC
15
- * SPDX-License-Identifier: BSD-3-Clause
16
- */
17
- const E=globalThis,C=E.trustedTypes,k=C?C.createPolicy("lit-html",{createHTML:e=>e}):void 0,M="$lit$",N=`lit$${Math.random().toFixed(9).slice(2)}$`,x="?"+N,L=`<${x}>`,P=document,R=()=>P.createComment(""),D=e=>null===e||"object"!=typeof e&&"function"!=typeof e,O=Array.isArray,H="[ \t\n\f\r]",I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,U=/-->/g,B=/>/g,F=RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),z=/'/g,G=/"/g,W=/^(?:script|style|textarea|title)$/i,j=(K=1,(e,...t)=>({_$litType$:K,strings:e,values:t})),q=Symbol.for("lit-noChange"),Y=Symbol.for("lit-nothing"),X=new WeakMap,V=P.createTreeWalker(P,129);var K;function J(e,t){if(!O(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==k?k.createHTML(t):t}class Z{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,r=0;const a=e.length-1,s=this.parts,[l,c]=((e,t)=>{const n=e.length-1,i=[];let o,r=2===t?"<svg>":3===t?"<math>":"",a=I;for(let t=0;t<n;t++){const n=e[t];let s,l,c=-1,m=0;for(;m<n.length&&(a.lastIndex=m,l=a.exec(n),null!==l);)m=a.lastIndex,a===I?"!--"===l[1]?a=U:void 0!==l[1]?a=B:void 0!==l[2]?(W.test(l[2])&&(o=RegExp("</"+l[2],"g")),a=F):void 0!==l[3]&&(a=F):a===F?">"===l[0]?(a=o??I,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,s=l[1],a=void 0===l[3]?F:'"'===l[3]?G:z):a===G||a===z?a=F:a===U||a===B?a=I:(a=F,o=void 0);const d=a===F&&e[t+1].startsWith("/>")?" ":"";r+=a===I?n+L:c>=0?(i.push(s),n.slice(0,c)+M+n.slice(c)+N+d):n+N+(-2===c?t:d)}return[J(e,r+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(e,t);if(this.el=Z.createElement(l,n),V.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=V.nextNode())&&s.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(M)){const t=c[r++],n=i.getAttribute(e).split(N),a=/([.?@])?(.*)/.exec(t);s.push({type:1,index:o,name:a[2],strings:n,ctor:"."===a[1]?ie:"?"===a[1]?oe:"@"===a[1]?re:ne}),i.removeAttribute(e)}else e.startsWith(N)&&(s.push({type:6,index:o}),i.removeAttribute(e));if(W.test(i.tagName)){const e=i.textContent.split(N),t=e.length-1;if(t>0){i.textContent=C?C.emptyScript:"";for(let n=0;n<t;n++)i.append(e[n],R()),V.nextNode(),s.push({type:2,index:++o});i.append(e[t],R())}}}else if(8===i.nodeType)if(i.data===x)s.push({type:2,index:o});else{let e=-1;for(;-1!==(e=i.data.indexOf(N,e+1));)s.push({type:7,index:o}),e+=N.length-1}o++}}static createElement(e,t){const n=P.createElement("template");return n.innerHTML=e,n}}function Q(e,t,n=e,i){if(t===q)return t;let o=void 0!==i?n._$Co?.[i]:n._$Cl;const r=D(t)?void 0:t._$litDirective$;return o?.constructor!==r&&(o?._$AO?.(!1),void 0===r?o=void 0:(o=new r(e),o._$AT(e,n,i)),void 0!==i?(n._$Co??=[])[i]=o:n._$Cl=o),void 0!==o&&(t=Q(e,o._$AS(e,t.values),o,i)),t}class ee{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??P).importNode(t,!0);V.currentNode=i;let o=V.nextNode(),r=0,a=0,s=n[0];for(;void 0!==s;){if(r===s.index){let t;2===s.type?t=new te(o,o.nextSibling,this,e):1===s.type?t=new s.ctor(o,s.name,s.strings,this,e):6===s.type&&(t=new ae(o,this,e)),this._$AV.push(t),s=n[++a]}r!==s?.index&&(o=V.nextNode(),r++)}return V.currentNode=P,i}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class te{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=Y,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Q(this,e,t),D(e)?e===Y||null==e||""===e?(this._$AH!==Y&&this._$AR(),this._$AH=Y):e!==this._$AH&&e!==q&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>O(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Y&&D(this._$AH)?this._$AA.nextSibling.data=e:this.T(P.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=Z.createElement(J(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new ee(i,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=X.get(e.strings);return void 0===t&&X.set(e.strings,t=new Z(e)),t}k(e){O(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const o of e)i===t.length?t.push(n=new te(this.O(R()),this.O(R()),this,this.options)):n=t[i],n._$AI(o),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class ne{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,o){this.type=1,this._$AH=Y,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Y}_$AI(e,t=this,n,i){const o=this.strings;let r=!1;if(void 0===o)e=Q(this,e,t,0),r=!D(e)||e!==this._$AH&&e!==q,r&&(this._$AH=e);else{const i=e;let a,s;for(e=o[0],a=0;a<o.length-1;a++)s=Q(this,i[n+a],t,a),s===q&&(s=this._$AH[a]),r||=!D(s)||s!==this._$AH[a],s===Y?e=Y:e!==Y&&(e+=(s??"")+o[a+1]),this._$AH[a]=s}r&&!i&&this.j(e)}j(e){e===Y?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ie extends ne{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Y?void 0:e}}class oe extends ne{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Y)}}class re extends ne{constructor(e,t,n,i,o){super(e,t,n,i,o),this.type=5}_$AI(e,t=this){if((e=Q(this,e,t,0)??Y)===q)return;const n=this._$AH,i=e===Y&&n!==Y||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==Y&&(n===Y||i);i&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ae{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Q(this,e)}}const se=E.litHtmlPolyfillSupport;se?.(Z,te),(E.litHtmlVersions??=[]).push("3.3.1");const le=globalThis;
18
- /**
19
- * @license
20
- * Copyright 2017 Google LLC
21
- * SPDX-License-Identifier: BSD-3-Clause
22
- */let ce=class extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const i=n?.renderBefore??t;let o=i._$litPart$;if(void 0===o){const e=n?.renderBefore??null;i._$litPart$=o=new te(t.insertBefore(R(),e),e,void 0,n??{})}return o._$AI(e),o})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return q}};ce._$litElement$=!0,ce.finalized=!0,le.litElementHydrateSupport?.({LitElement:ce});const me=le.litElementPolyfillSupport;me?.({LitElement:ce}),(le.litElementVersions??=[]).push("4.2.1");
23
- /**
24
- * @license
25
- * Copyright 2017 Google LLC
26
- * SPDX-License-Identifier: BSD-3-Clause
27
- */
28
- const de={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:S},pe=(e=de,t,n)=>{const{kind:i,metadata:o}=n;let r=globalThis.litPropertyMetadata.get(o);if(void 0===r&&globalThis.litPropertyMetadata.set(o,r=new Map),"setter"===i&&((e=Object.create(e)).wrapped=!0),r.set(n.name,e),"accessor"===i){const{name:i}=n;return{set(n){const o=t.get.call(this);t.set.call(this,n),this.requestUpdate(i,o,e)},init(t){return void 0!==t&&this.C(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=n;return function(n){const o=this[i];t.call(this,n),this.requestUpdate(i,o,e)}}throw Error("Unsupported decorator location: "+i)};function ue(e){return(t,n)=>"object"==typeof n?pe(e,t,n):((e,t,n)=>{const i=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),i?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}
29
- /**
30
- * @license
31
- * Copyright 2017 Google LLC
32
- * SPDX-License-Identifier: BSD-3-Clause
33
- */function he(e){return ue({...e,state:!0,attribute:!1})}
34
- /**
35
- * @license
36
- * Copyright 2017 Google LLC
37
- * SPDX-License-Identifier: BSD-3-Clause
38
- */const ge=2;class fe{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}
39
- /**
40
- * @license
41
- * Copyright 2017 Google LLC
42
- * SPDX-License-Identifier: BSD-3-Clause
43
- */class ye extends fe{constructor(e){if(super(e),this.it=Y,e.type!==ge)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Y||null==e)return this._t=void 0,this.it=e;if(e===q)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}ye.directiveName="unsafeHTML",ye.resultType=1;const ve=(e=>(...t)=>({_$litDirective$:e,values:t}))(ye),be=e=>{const t=new Map,n=(e,n,i)=>{t.set(e,{timestamp:n,token:i});const o=btoa(JSON.stringify({timestamp:n}));sessionStorage.setItem(`comment_auth_${e}`,o)},i=e=>{const n=t.get(e);return n?{id:e,...n}:null},o=e=>{t.delete(e),sessionStorage.removeItem(`comment_auth_${e}`)};return{getComments:async t=>{const n=new URL("/api/comments",e);n.searchParams.append("post",t);const i=await fetch(n);return await i.json()},addComment:async(t,i,o,r,a)=>{try{const s=new URL("/api/comments",e);s.searchParams.append("post",t);const l=document.querySelector('input[name="website"]'),c=l?l.value:"",m=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pseudonym:i,nameHash:o,msg:r,replyTo:a,website:c})});if(m.ok){const e=await m.json();return n(e.id,e.timestamp,e.token),e.id}return null}catch{return null}},updateComment:async(t,n,o,r,a)=>{const s=i(n);if(!s)return!1;try{const n=new URL("/api/comments",e);n.searchParams.append("post",t);return(await fetch(n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:s.id,timestamp:s.timestamp,token:s.token,pseudonym:o,nameHash:r,msg:a})})).ok}catch{return!1}},deleteComment:async(t,n)=>{const r=i(n);if(!r)return!1;try{const i=new URL("/api/comments",e);i.searchParams.append("post",t);return!!(await fetch(i,{method:"DELETE",headers:{"Content-Type":"application/json","X-Comment-ID":r.id,"X-Comment-Token":r.token,"X-Comment-Timestamp":r.timestamp.toString()}})).ok&&(o(n),!0)}catch{return!1}},saveAuthInfo:n,getAuthInfo:i,removeAuthInfo:o,canEditComment:e=>!!i(e)}},we={anonymous:"Anonymous",replyTo:"Reply to",edit:"Edit",delete:"Delete",reply:"Reply",replyingTo:"Replying to: ",modified:"Modified on",cancelReply:"Cancel",editing:"Editing: ",cancelEdit:"Cancel",updateComment:"Update",submitComment:"Submit",namePlaceholder:"Name (optional)",messagePlaceholder:"Your comment...\nSupports Markdown syntax",loading:"Loading...",confirmDelete:"Are you sure you want to delete this comment?",editFailed:"Failed to edit comment. Permission may have expired.",submitFailed:"Failed to submit comment.",deleteFailed:"Failed to delete comment. Permission may have expired.",nameTooLong:"Name is too long",messageTooLong:"Message is too long",write:"Write",preview:"Preview",emptyPreview:"Nothing to preview",markdownHelp:"Help",commentSystemTitle:"Comments",commentSystemDesc:'This is a simple comment system. You can post your opinions or respond to other comments. Click "Preview" to see how your comment looks before posting.',commentTimeLimit:"After posting a comment, you can edit or delete it within two minutes, as long as you don't leave or refresh the page.",markdownSyntax:"Syntax",markdownBasicSupport:"Basic Markdown syntax is supported. HTML is not supported.",markdownLinkExample:"[Link](https://www.example.com)",markdownImageExample:"![Image](https://www.example.com/sample.jpg)",markdownItalicExample:"*Italic* or _Italic_",markdownBoldExample:"**Bold** or __Bold__",markdownListExample:"- List item",markdownOrderedListExample:"1. Ordered list item",markdownInlineCodeExample:"`Inline code`",markdownCodeBlockExample:"```\nCode block\n```",pseudonymNotice:"Will be converted to a unique pseudonym, longer names help avoid impersonation",editingPseudonymNotice:"Cannot be changed when editing",author:"Author",noComments:"No comments yet"},Ae={anonymous:"匿名",replyTo:"回覆給",edit:"編輯",delete:"刪除",reply:"回覆",modified:"修改於",replyingTo:"回覆給:",cancelReply:"取消",editing:"編輯中:",cancelEdit:"取消",updateComment:"更新",submitComment:"發送",namePlaceholder:"名稱 (選填)",messagePlaceholder:"留言內容...\n支援 Markdown 語法",loading:"載入中...",confirmDelete:"確定要刪除此留言嗎?",editFailed:"編輯留言失敗,可能權限已過期",submitFailed:"發送留言失敗",deleteFailed:"刪除留言失敗,可能權限已過期",nameTooLong:"暱稱過長",messageTooLong:"留言內容過長",write:"編輯",preview:"預覽",emptyPreview:"沒有內容可供預覽",markdownHelp:"說明",commentSystemTitle:"留言",commentSystemDesc:"這是一個簡單的留言系統,你可以發表意見或回應其他留言。發佈前可點擊「預覽」查看留言樣式。",commentTimeLimit:"發佈留言後,在不離開或重新整理頁面的情況下,你可以編輯或刪除兩分鐘內的留言。",markdownSyntax:"語法",markdownBasicSupport:"支援基本 Markdown 語法,不支援 HTML。",markdownLinkExample:"[連結](https://www.example.com)",markdownImageExample:"![圖片](https://www.example.com/sample.jpg)",markdownItalicExample:"*斜體* 或 _斜體_",markdownBoldExample:"**粗體** 或 __粗體__",markdownListExample:"- 清單",markdownOrderedListExample:"1. 編號清單",markdownInlineCodeExample:"`行內程式碼`",markdownCodeBlockExample:"```\n程式碼區塊\n```",pseudonymNotice:"名稱將被轉換為化名,使用較長的名稱有助於避免被冒充",editingPseudonymNotice:"編輯時無法更改",author:"作者",noComments:"尚未有留言"},_e=(e=we)=>{let t=e;return{t:e=>t[e],setLanguage:e=>{t=e},getLanguage:()=>t}},Se=["Brilliant","Elegant","Majestic","Serene","Vibrant","Graceful","Radiant","Mystical","Noble","Charming","Delicate","Gentle","Luminous","Peaceful","Quick","Resilient","Sparkling","Tranquil","Vivid","Wise","Brave","Creative","Dynamic","Enigmatic","Fantastic","Golden","Harmonious","Inspiring","Joyful","Keen","Lively","Magnificent","Natural","Optimistic","Precious","Quiet","Remarkable","Stunning","Thoughtful","Uplifting","Wonderful","Adventurous","Balanced","Confident","Determined","Energetic","Fearless","Gracious","Innovative","Jubilant","Kind","Loyal","Marvelous","Amazing","Bright","Cheerful","Curious","Excited","Fresh","Happy","Intelligent","Jovial","Lovely","Merry","Nimble","Pleasant","Resourceful","Spirited","Talented","Versatile","Warm","Youthful","Active","Agile","Alert","Artistic","Athletic","Authentic","Blissful","Buoyant","Calm","Capable","Caring","Clever","Compassionate","Cool","Courageous","Dazzling","Dedicated","Diligent","Earnest","Efficient","Enthusiastic","Exceptional","Expressive","Fabulous","Faithful","Focused","Friendly","Generous","Gifted","Glorious","Helpful","Honest","Hopeful","Humorous","Independent","Inventive","Lighthearted","Lucky","Mindful","Modest","Motivating","Nurturing","Original","Outgoing","Patient","Playful","Polite","Positive","Proud","Pure","Reliable","Responsible","Sincere","Smart","Smooth","Sociable","Spontaneous","Successful","Sweet","Tender","Trusting","Understanding","Unique","Valuable","Virtuous","Wholesome","Witty"],Te=["Falcon","Phoenix","Dragon","Eagle","Tiger","Lion","Wolf","Bear","Deer","Fox","Hawk","Raven","Swan","Dove","Owl","Butterfly","Rose","Lily","Orchid","Jasmine","Cedar","Oak","Pine","Willow","Maple","Mountain","River","Ocean","Moon","Sun","Cloud","Thunder","Rainbow","Diamond","Ruby","Emerald","Sapphire","Pearl","Crystal","Gold","Silver","Amber","Flame","Breeze","Storm","Mist","Dawn","Dusk","Aurora","Comet","Galaxy","Nebula","Shield","Crown","Gem","Prism","Panda","Koala","Giraffe","Zebra","Leopard","Cheetah","Otter","Dolphin","Whale","Penguin","Rabbit","Squirrel","Hedgehog","Badger","Moose","Camel","Horse","Donkey","Sheep","Goat","Cow","Chicken","Duck","Goose","Turkey","Peacock","Parrot","Canary","Finch","Sparrow","Crane","Stork","Flamingo","Pelican","Shrimp","Crab","Lobster","Octopus","Squid","Walrus","Mole","Ferret","Hamster","Chinchilla","GuineaPig","Lemur","Tapir","Buffalo","Bison","Yak","Ibex","Gazelle","Porcupine","Armadillo","Sloth","Opossum","Platypus","Wombat","Kangaroo","Wallaby","Emu","Cassowary","Orangutan","Gibbon","Chimpanzee","Baboon","Macaque","Lynx","Puma","Jaguar","Cougar","Bobcat","Ocelot","RedPanda","Raccoon","Weasel","Stoat","Ermine","Wolverine","Marten","Jay","Magpie","Rook","Swallow","Swift","Cuckoo","Coot","Grebe","Heron","Egret","Ibis","Gull","Tern","Salmon","Trout","Bass","Cod","Tuna","Ray","Carp","Perch","Catfish","Eel","Pike","Snapper","Bream","Tilapia","Goby","Mullet","Loach","Bamboo","Cactus","Fern","Moss","Palm","Birch","Aspen","Beech","Hazel","Elm","Poplar","Magnolia","Azalea","Gardenia","Hibiscus","Wisteria","Dahlia","Peony","Marigold","Sunflower","Daisy","Violet","Pansy","Begonia","Petunia","Zinnia","Cosmos","Aster","Bluebell","Foxglove","Primrose","Buttercup","Clover","Heather","Lavender","Basil","Rosemary","Thyme","Sage","Parsley","Dill","Fennel","Chive","Oregano","Lotus","Taro","Mushroom","Truffle","Morel","Shiitake","Moth","Dragonfly","Bee","Ant","Termite","Beetle","Ladybug","Firefly","Cicada","Grasshopper","Cricket","Katydid","Locust","Mantis","Earwig","Silverfish","Mayfly","Stonefly","Aphid","Whitefly","Apple","Banana","Orange","Lemon","Lime","Grape","Cherry","Peach","Plum","Pear","Mango","Papaya","Pineapple","Guava","Lychee","Longan","Rambutan","Coconut","Date","Fig","Gooseberry","Blackberry","Blueberry","Raspberry","Strawberry","Cranberry","Currant","Melon","Pumpkin","Squash","Zucchini","Bread","Bagel","Baguette","Croissant","Pretzel","Bun","Roll","Muffin","Cake","Pie","Tart","Cookie","Biscuit","Doughnut","Pancake","Waffle","Crepe","Sandwich","Burger","Pizza","Pasta","Spaghetti","Macaroni","Lasagna","Ravioli","Noodle","Ramen","Udon","Soba","Pho","Dumpling","Wonton","Bao","Sushi","Tempura","Rice","Soup","Stew","Curry","Grill","Roast","Fry","Steam","Boil","Jam","Honey","Butter","Cheese","Cream","Custard","Pudding","IceCream","Sorbet","Milk","Juice","Tea","Coffee","Cocoa","Candy","Mint","Gum","Book","Pen","Pencil","Eraser","Ruler","Scissors","Glue","Paper","Notebook","Bag","Wallet","Key","Lock","Watch","Lamp","Mirror","Brush","Comb","Towel","Soap","Cup","Mug","Bottle","Glass","Plate","Bowl","Spoon","Fork","Tray","Box","Can","Jar","Bin","Pan","Pot","Kettle","Oven","Fan","Phone","Tablet","Laptop","Keyboard","Camera","Radio","TV","Charger","Cable","Plug","Adapter","Battery","Umbrella","Hat","Cap","Scarf","Glove","Sock","Shoe","Boot","Belt","Coat","Jacket","Shirt","Pants","Shorts","Skirt","Dress","Suit","Tie","Mask","Apron","Blanket","Pillow","Chair","Table","Desk","Shelf","Drawer","Cabinet","Door","Window","Wall","Floor","Roof","Stair","Road","Park","Garden","Fence","Gate","Mailbox","Sign","Poster","Flag","Balloon","Kite","Toy","Puzzle","Game","Dice","Card","Coin","Medal","Trophy","Badge","Sticker","Patch","Pin","Ring","Necklace","Bracelet","Earring","Charm","Pendant","Chain","Clip","Hook","Button","Zip","String","Rope","Wire","Band","Tape","Ribbon","Thread","Needle","Thimble","Wrench","Pliers","Level","Map","Globe","Chart","Graph","List","Note","Memo","Label","Tag","Ticket","Pass","Receipt","Bill","Form","Report","File","Folder","Envelope","Stamp","Seal","Circle","Oval","Square","Star","Heart","Arrow","Dot","Line","Wave","Curve","Point","Edge","Corner","Block","Brick","Tile","Panel","Board","Beam","Pole","Rod","Bar","Tube","Pipe","Valve","Tap","Pump","Motor","Gear","Wheel","Axle","Spring","Lever","Handle","Knob","Switch","Dial","Latch","Bolt","Hinge","Frame","Base","Stand","Holder","Mount","Elastic","Rubber","Plastic","Metal","Wood","Stone","Clay","Sand","Soil","Mud","Dust","Salt","Sugar","Oil","Vinegar","Sauce","Paste","Syrup","Fudge","Toffee","Marshmallow","Nougat","Lollipop","Popsicle","Slush","Jellybean"];async function $e(e){const t=(e||"").trim();if(0===t.length)return{pseudonym:"",hash:""};const n=await async function(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")}(t),{adjective:i,noun:o}=function(e){const t=parseInt(e.substring(0,8),16)%Se.length,n=parseInt(e.substring(8,16),16)%Te.length;return{adjective:Se[t],noun:Te[n]}}(n);return{pseudonym:`${i} ${o}`,hash:n}}
44
- /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:Ee,setPrototypeOf:Ce,isFrozen:ke,getPrototypeOf:Me,getOwnPropertyDescriptor:Ne}=Object;let{freeze:xe,seal:Le,create:Pe}=Object,{apply:Re,construct:De}="undefined"!=typeof Reflect&&Reflect;xe||(xe=function(e){return e}),Le||(Le=function(e){return e}),Re||(Re=function(e,t,n){return e.apply(t,n)}),De||(De=function(e,t){return new e(...t)});const Oe=Je(Array.prototype.forEach),He=Je(Array.prototype.lastIndexOf),Ie=Je(Array.prototype.pop),Ue=Je(Array.prototype.push),Be=Je(Array.prototype.splice),Fe=Je(String.prototype.toLowerCase),ze=Je(String.prototype.toString),Ge=Je(String.prototype.match),We=Je(String.prototype.replace),je=Je(String.prototype.indexOf),qe=Je(String.prototype.trim),Ye=Je(Object.prototype.hasOwnProperty),Xe=Je(RegExp.prototype.test),Ve=(Ke=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return De(Ke,t)});var Ke;function Je(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return Re(e,t,i)}}function Ze(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Fe;Ce&&Ce(e,null);let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(ke(t)||(t[i]=e),o=e)}e[o]=!0}return e}function Qe(e){for(let t=0;t<e.length;t++){Ye(e,t)||(e[t]=null)}return e}function et(e){const t=Pe(null);for(const[n,i]of Ee(e)){Ye(e,n)&&(Array.isArray(i)?t[n]=Qe(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=et(i):t[n]=i)}return t}function tt(e,t){for(;null!==e;){const n=Ne(e,t);if(n){if(n.get)return Je(n.get);if("function"==typeof n.value)return Je(n.value)}e=Me(e)}return function(){return null}}const nt=xe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),it=xe(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ot=xe(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),rt=xe(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),at=xe(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),st=xe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),lt=xe(["#text"]),ct=xe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),mt=xe(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),dt=xe(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),pt=xe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ut=Le(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ht=Le(/<%[\w\W]*|[\w\W]*%>/gm),gt=Le(/\$\{[\w\W]*/gm),ft=Le(/^data-[\-\w.\u00B7-\uFFFF]+$/),yt=Le(/^aria-[\-\w]+$/),vt=Le(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),bt=Le(/^(?:\w+script|data):/i),wt=Le(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),At=Le(/^html$/i),_t=Le(/^[a-z][.\w]*(-[.\w]+)+$/i);var St=Object.freeze({__proto__:null,ARIA_ATTR:yt,ATTR_WHITESPACE:wt,CUSTOM_ELEMENT:_t,DATA_ATTR:ft,DOCTYPE_NAME:At,ERB_EXPR:ht,IS_ALLOWED_URI:vt,IS_SCRIPT_OR_DATA:bt,MUSTACHE_EXPR:ut,TMPLIT_EXPR:gt});const Tt=1,$t=3,Et=7,Ct=8,kt=9;var Mt=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window;const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==kt||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const o=i,r=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:m,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:u,trustedTypes:h}=t,g=c.prototype,f=tt(g,"cloneNode"),y=tt(g,"remove"),v=tt(g,"nextSibling"),b=tt(g,"childNodes"),w=tt(g,"parentNode");if("function"==typeof s){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let A,_="";const{implementation:S,createNodeIterator:T,createDocumentFragment:$,getElementsByTagName:E}=i,{importNode:C}=o;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Ee&&"function"==typeof w&&S&&void 0!==S.createHTMLDocument;const{MUSTACHE_EXPR:M,ERB_EXPR:N,TMPLIT_EXPR:x,DATA_ATTR:L,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:D,CUSTOM_ELEMENT:O}=St;let{IS_ALLOWED_URI:H}=St,I=null;const U=Ze({},[...nt,...it,...ot,...at,...lt]);let B=null;const F=Ze({},[...ct,...mt,...dt,...pt]);let z=Object.seal(Pe(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),G=null,W=null,j=!0,q=!0,Y=!1,X=!0,V=!1,K=!0,J=!1,Z=!1,Q=!1,ee=!1,te=!1,ne=!1,ie=!0,oe=!1,re=!0,ae=!1,se={},le=null;const ce=Ze({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let me=null;const de=Ze({},["audio","video","img","source","image","track"]);let pe=null;const ue=Ze({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),he="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";let ye=fe,ve=!1,be=null;const we=Ze({},[he,ge,fe],ze);let Ae=Ze({},["mi","mo","mn","ms","mtext"]),_e=Ze({},["annotation-xml"]);const Se=Ze({},["title","style","font","a","script"]);let Te=null;const $e=["application/xhtml+xml","text/html"];let Ce=null,ke=null;const Me=i.createElement("form"),Ne=function(e){return e instanceof RegExp||e instanceof Function},Le=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ke||ke!==e){if(e&&"object"==typeof e||(e={}),e=et(e),Te=-1===$e.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ce="application/xhtml+xml"===Te?ze:Fe,I=Ye(e,"ALLOWED_TAGS")?Ze({},e.ALLOWED_TAGS,Ce):U,B=Ye(e,"ALLOWED_ATTR")?Ze({},e.ALLOWED_ATTR,Ce):F,be=Ye(e,"ALLOWED_NAMESPACES")?Ze({},e.ALLOWED_NAMESPACES,ze):we,pe=Ye(e,"ADD_URI_SAFE_ATTR")?Ze(et(ue),e.ADD_URI_SAFE_ATTR,Ce):ue,me=Ye(e,"ADD_DATA_URI_TAGS")?Ze(et(de),e.ADD_DATA_URI_TAGS,Ce):de,le=Ye(e,"FORBID_CONTENTS")?Ze({},e.FORBID_CONTENTS,Ce):ce,G=Ye(e,"FORBID_TAGS")?Ze({},e.FORBID_TAGS,Ce):et({}),W=Ye(e,"FORBID_ATTR")?Ze({},e.FORBID_ATTR,Ce):et({}),se=!!Ye(e,"USE_PROFILES")&&e.USE_PROFILES,j=!1!==e.ALLOW_ARIA_ATTR,q=!1!==e.ALLOW_DATA_ATTR,Y=e.ALLOW_UNKNOWN_PROTOCOLS||!1,X=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,V=e.SAFE_FOR_TEMPLATES||!1,K=!1!==e.SAFE_FOR_XML,J=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,Q=e.FORCE_BODY||!1,ie=!1!==e.SANITIZE_DOM,oe=e.SANITIZE_NAMED_PROPS||!1,re=!1!==e.KEEP_CONTENT,ae=e.IN_PLACE||!1,H=e.ALLOWED_URI_REGEXP||vt,ye=e.NAMESPACE||fe,Ae=e.MATHML_TEXT_INTEGRATION_POINTS||Ae,_e=e.HTML_INTEGRATION_POINTS||_e,z=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ne(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ne(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(z.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),V&&(q=!1),te&&(ee=!0),se&&(I=Ze({},lt),B=[],!0===se.html&&(Ze(I,nt),Ze(B,ct)),!0===se.svg&&(Ze(I,it),Ze(B,mt),Ze(B,pt)),!0===se.svgFilters&&(Ze(I,ot),Ze(B,mt),Ze(B,pt)),!0===se.mathMl&&(Ze(I,at),Ze(B,dt),Ze(B,pt))),e.ADD_TAGS&&(I===U&&(I=et(I)),Ze(I,e.ADD_TAGS,Ce)),e.ADD_ATTR&&(B===F&&(B=et(B)),Ze(B,e.ADD_ATTR,Ce)),e.ADD_URI_SAFE_ATTR&&Ze(pe,e.ADD_URI_SAFE_ATTR,Ce),e.FORBID_CONTENTS&&(le===ce&&(le=et(le)),Ze(le,e.FORBID_CONTENTS,Ce)),re&&(I["#text"]=!0),J&&Ze(I,["html","head","body"]),I.table&&(Ze(I,["tbody"]),delete G.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Ve('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Ve('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=e.TRUSTED_TYPES_POLICY,_=A.createHTML("")}else void 0===A&&(A=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(h,r)),null!==A&&"string"==typeof _&&(_=A.createHTML(""));xe&&xe(e),ke=e}},Re=Ze({},[...it,...ot,...rt]),De=Ze({},[...at,...st]),Ke=function(e){Ue(n.removed,{element:e});try{w(e).removeChild(e)}catch(t){y(e)}},Je=function(e,t){try{Ue(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Ue(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Ke(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Qe=function(e){let t=null,n=null;if(Q)e="<remove></remove>"+e;else{const t=Ge(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Te&&ye===fe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=A?A.createHTML(e):e;if(ye===fe)try{t=(new u).parseFromString(o,Te)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(ye,"template",null);try{t.documentElement.innerHTML=ve?_:o}catch(e){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(i.createTextNode(n),r.childNodes[0]||null),ye===fe?E.call(t,J?"html":"body")[0]:J?t.documentElement:r},ut=function(e){return T.call(e.ownerDocument||e,e,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT|m.SHOW_PROCESSING_INSTRUCTION|m.SHOW_CDATA_SECTION,null)},ht=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},gt=function(e){return"function"==typeof l&&e instanceof l};function ft(e,t,i){Oe(e,e=>{e.call(n,t,i,ke)})}const yt=function(e){let t=null;if(ft(k.beforeSanitizeElements,e,null),ht(e))return Ke(e),!0;const i=Ce(e.nodeName);if(ft(k.uponSanitizeElement,e,{tagName:i,allowedTags:I}),K&&e.hasChildNodes()&&!gt(e.firstElementChild)&&Xe(/<[/\w!]/g,e.innerHTML)&&Xe(/<[/\w!]/g,e.textContent))return Ke(e),!0;if(e.nodeType===Et)return Ke(e),!0;if(K&&e.nodeType===Ct&&Xe(/<[/\w]/g,e.data))return Ke(e),!0;if(!I[i]||G[i]){if(!G[i]&&wt(i)){if(z.tagNameCheck instanceof RegExp&&Xe(z.tagNameCheck,i))return!1;if(z.tagNameCheck instanceof Function&&z.tagNameCheck(i))return!1}if(re&&!le[i]){const t=w(e)||e.parentNode,n=b(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const o=f(n[i],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,v(e))}}}return Ke(e),!0}return e instanceof c&&!function(e){let t=w(e);t&&t.tagName||(t={namespaceURI:ye,tagName:"template"});const n=Fe(e.tagName),i=Fe(t.tagName);return!!be[e.namespaceURI]&&(e.namespaceURI===ge?t.namespaceURI===fe?"svg"===n:t.namespaceURI===he?"svg"===n&&("annotation-xml"===i||Ae[i]):Boolean(Re[n]):e.namespaceURI===he?t.namespaceURI===fe?"math"===n:t.namespaceURI===ge?"math"===n&&_e[i]:Boolean(De[n]):e.namespaceURI===fe?!(t.namespaceURI===ge&&!_e[i])&&!(t.namespaceURI===he&&!Ae[i])&&!De[n]&&(Se[n]||!Re[n]):!("application/xhtml+xml"!==Te||!be[e.namespaceURI]))}(e)?(Ke(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!Xe(/<\/no(script|embed|frames)/i,e.innerHTML)?(V&&e.nodeType===$t&&(t=e.textContent,Oe([M,N,x],e=>{t=We(t,e," ")}),e.textContent!==t&&(Ue(n.removed,{element:e.cloneNode()}),e.textContent=t)),ft(k.afterSanitizeElements,e,null),!1):(Ke(e),!0)},bt=function(e,t,n){if(ie&&("id"===t||"name"===t)&&(n in i||n in Me))return!1;if(q&&!W[t]&&Xe(L,t));else if(j&&Xe(P,t));else if(!B[t]||W[t]){if(!(wt(e)&&(z.tagNameCheck instanceof RegExp&&Xe(z.tagNameCheck,e)||z.tagNameCheck instanceof Function&&z.tagNameCheck(e))&&(z.attributeNameCheck instanceof RegExp&&Xe(z.attributeNameCheck,t)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(t))||"is"===t&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&Xe(z.tagNameCheck,n)||z.tagNameCheck instanceof Function&&z.tagNameCheck(n))))return!1}else if(pe[t]);else if(Xe(H,We(n,D,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==je(n,"data:")||!me[e]){if(Y&&!Xe(R,We(n,D,"")));else if(n)return!1}else;return!0},wt=function(e){return"annotation-xml"!==e&&Ge(e,O)},_t=function(e){ft(k.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||ht(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0};let o=t.length;for(;o--;){const r=t[o],{name:a,namespaceURI:s,value:l}=r,c=Ce(a),m=l;let d="value"===a?m:qe(m);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,ft(k.uponSanitizeAttribute,e,i),d=i.attrValue,!oe||"id"!==c&&"name"!==c||(Je(a,e),d="user-content-"+d),K&&Xe(/((--!?|])>)|<\/(style|title)/i,d)){Je(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){Je(a,e);continue}if(!X&&Xe(/\/>/i,d)){Je(a,e);continue}V&&Oe([M,N,x],e=>{d=We(d,e," ")});const p=Ce(e.nodeName);if(bt(p,c,d)){if(A&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(p,c)){case"TrustedHTML":d=A.createHTML(d);break;case"TrustedScriptURL":d=A.createScriptURL(d)}if(d!==m)try{s?e.setAttributeNS(s,a,d):e.setAttribute(a,d),ht(e)?Ke(e):Ie(n.removed)}catch(t){Je(a,e)}}else Je(a,e)}ft(k.afterSanitizeAttributes,e,null)},Mt=function e(t){let n=null;const i=ut(t);for(ft(k.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)ft(k.uponSanitizeShadowNode,n,null),yt(n),_t(n),n.content instanceof a&&e(n.content);ft(k.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,r=null,s=null,c=null;if(ve=!e,ve&&(e="\x3c!--\x3e"),"string"!=typeof e&&!gt(e)){if("function"!=typeof e.toString)throw Ve("toString is not a function");if("string"!=typeof(e=e.toString()))throw Ve("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Z||Le(t),n.removed=[],"string"==typeof e&&(ae=!1),ae){if(e.nodeName){const t=Ce(e.nodeName);if(!I[t]||G[t])throw Ve("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=Qe("\x3c!----\x3e"),r=i.ownerDocument.importNode(e,!0),r.nodeType===Tt&&"BODY"===r.nodeName||"HTML"===r.nodeName?i=r:i.appendChild(r);else{if(!ee&&!V&&!J&&-1===e.indexOf("<"))return A&&ne?A.createHTML(e):e;if(i=Qe(e),!i)return ee?null:ne?_:""}i&&Q&&Ke(i.firstChild);const m=ut(ae?e:i);for(;s=m.nextNode();)yt(s),_t(s),s.content instanceof a&&Mt(s.content);if(ae)return e;if(ee){if(te)for(c=$.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(B.shadowroot||B.shadowrootmode)&&(c=C.call(o,c,!0)),c}let d=J?i.outerHTML:i.innerHTML;return J&&I["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Xe(At,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),V&&Oe([M,N,x],e=>{d=We(d,e," ")}),A&&ne?A.createHTML(d):d},n.setConfig=function(){Le(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Z=!0},n.clearConfig=function(){ke=null,Z=!1},n.isValidAttribute=function(e,t,n){ke||Le({});const i=Ce(e),o=Ce(t);return bt(i,o,n)},n.addHook=function(e,t){"function"==typeof t&&Ue(k[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=He(k[e],t);return-1===n?void 0:Be(k[e],n,1)[0]}return Ie(k[e])},n.removeHooks=function(e){k[e]=[]},n.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const Nt={ALLOWED_TAGS:["a","b","i","em","strong","s","p","ul","ol","li","code","pre","blockquote","h6","hr","br","img"],ALLOWED_ATTR:["href","src","alt"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1};function xt(e){const t=new Date(e),n=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");let r=t.getHours();const a=String(t.getMinutes()).padStart(2,"0"),s=r>=12?"PM":"AM";r%=12,0===r&&(r=12);return`${n}/${i}/${o} ${String(r).padStart(2,"0")}:${a} ${s}`}function Lt(e,t,n=!1,i=null,o=null,r=null){const a=function(e){const t=e?"comment":"reply";return{item:t,header:`${t}-header ycc-flex ycc-flex-wrap`,name:`${t}-name`,time:`${t}-time`,content:`${t}-content`}}(n),s=e.canEditComment(t.id);return j` <div class="${a.item}" ${n?`data-id="${t.id}"`:""}>
45
- ${function(e,t,n,i,o){const r=e.isMyComment(t),a=t.isAdmin;return j` <div class="${n.header}">
46
- <span class="${n.name}" title="${t.id}">
47
- ${e.getDisplayName(t)}
48
- ${a?j`<span class="author-badge">${e.i18n$.t("author")}</span>`:r?j`<span class="my-comment-badge">Me</span>`:""}
49
- </span>
50
- <span
51
- class="${n.time}"
52
- title="${t.modDate?e.formatDate(t.pubDate):void 0}"
53
- >
54
- ${t.modDate?e.i18n$.t("modified")+" "+e.formatDate(t.modDate):e.formatDate(t.pubDate)}
55
- </span>
56
- ${i?j`<span class="reply-to"
57
- >${e.i18n$.t("replyTo")}<span title="${t.replyTo??""}"
58
- >${i}</span
59
- ></span
60
- >`:""}
61
- ${o?j`<span class="comment-controls ycc-flex ycc-gap-xs">
62
- <button
63
- class="edit-button ycc-clickable ycc-transition ycc-transparent-bg ycc-reset-button"
64
- @click=${()=>e.handleEdit(t)}
65
- >
66
- ${e.i18n$.t("edit")}
67
- </button>
68
- <button
69
- class="delete-button ycc-clickable ycc-transition ycc-transparent-bg ycc-reset-button"
70
- @click=${()=>e.handleDelete(t.id)}
71
- >
72
- ${e.i18n$.t("delete")}
73
- </button>
74
- </span>`:""}
75
- </div>`}(e,t,a,i,s)}
76
- ${function(e,t,n){return j`<div class="${n}">${e.renderMarkdown(t.msg)}</div>`}(e,t,a.content)} ${function(e,t){return j`<button
77
- class="reply-button ycc-clickable ycc-transition ycc-transparent-bg ycc-reset-button"
78
- @click=${()=>e.setReplyTo(t.id)}
79
- >
80
- ${e.i18n$.t("reply")}
81
- </button>`}(e,t)}
82
- ${n?j`<div class="replies">
83
- ${o?o.map(t=>{const n=t.replyTo&&r?r[t.replyTo]:void 0,i=n?e.getDisplayName(n):"";return Lt(e,t,!1,i)}):""}
84
- </div>`:""}
85
- </div>`}function Pt(e,t,n){const i=t.filter(e=>!e.replyTo),o={};t.forEach(e=>{e.replyTo&&(o[e.replyTo]||=[]).push(e)});return i.map(t=>Lt(e,t,!0,null,(e=>{const t=[],n=[...o[e]||[]];for(;n.length;){const e=n.shift();if(!e)break;t.push(e);const i=o[e.id]||[];i.length&&n.push(...i)}return t})(t.id),n))}var Rt=Object.defineProperty,Dt=(e,t,n,i)=>{for(var o,r=void 0,a=e.length-1;a>=0;a--)(o=e[a])&&(r=o(t,n,r)||r);return r&&Rt(t,n,r),r};const Ot=((e=class extends ce{constructor(){super(...arguments),this.post="/blog/my-post",this.apiUrl="http://localhost:8787/",this.authorName=void 0,this.language="en",this.apiService=be(this.apiUrl),this.i18n=_e(we),this.commentMap={},this.comments=[],this.currentReplyTo=null,this.previewText="",this.previewName="",this.previewPseudonym="",this.editingComment=null,this.activeTab="write",this.showMarkdownHelp=!1,this.showAdminLogin=!1}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.syncI18n(),this.apiService=be(this.apiUrl),Mt.addHook("afterSanitizeAttributes",e=>{"A"===e.tagName&&(e.setAttribute("rel","noopener noreferrer"),e.setAttribute("target","_blank")),"IMG"===e.tagName&&e.setAttribute("loading","lazy")}),Mt.addHook("uponSanitizeAttribute",(e,t)=>{if("href"===t.attrName||"src"===t.attrName)try{const e=new URL(t.attrValue||"");"http:"!==e.protocol&&"https:"!==e.protocol&&(t.keepAttr=!1)}catch{t.keepAttr=!1}}),this.reloadComments()}disconnectedCallback(){document.body.classList.remove("ycc-modal-open"),super.disconnectedCallback()}updated(e){e.has("apiUrl")&&(this.apiService=be(this.apiUrl)),e.has("language")&&this.syncI18n(),e.has("post")&&this.reloadComments()}syncI18n(){let e=we;const t=this.language;"string"==typeof t?e="zh-Hant"===t?Ae:we:t&&"object"==typeof t&&(e=t),this.i18n=_e(e)}renderMarkdown(e){return ve((t=o(e||""),Mt.sanitize(t,Nt)));var t}getDisplayName(e){if(e?.isAdmin&&this.authorName)return this.authorName;const t=e?.pseudonym??"";return t.trim()?t:this.i18n.t("anonymous")}canEditComment(e){return this.apiService.canEditComment(e)}saveMyNameHash(t){try{const n=this.getMyNameHashes();t&&!n.includes(t)&&(n.push(t),localStorage.setItem(e.MY_NAME_HASHES_KEY,JSON.stringify(n)))}catch(e){console.warn("Failed to save name hash:",e)}}getMyNameHashes(){try{const t=localStorage.getItem(e.MY_NAME_HASHES_KEY);return t?JSON.parse(t):[]}catch(e){return console.warn("Failed to get name hashes:",e),[]}}isMyComment(e){return!!e.nameHash&&this.getMyNameHashes().includes(e.nameHash)}async loadComments(){return await this.apiService.getComments(this.post)}async reloadComments(){this.comments=await this.loadComments(),this.buildCommentMap()}switchTab(e){this.activeTab=e,"preview"===e&&this.saveCurrentFormInputs()}saveCurrentFormInputs(){const e=document.querySelector('#comment-form input[name="name"]');e&&(this.previewName=e.value)}async renderCommentsList(){0===this.comments.length&&await this.reloadComments()}buildCommentMap(){this.commentMap={},this.comments.forEach(e=>{this.commentMap[e.id]=e})}createCommentsTemplate(){return function(e){const t=e.comments$;return 0===t.length?j`<div id="comments">
86
- <div class="no-comments-message">${e.i18n$.t("noComments")}</div>
87
- </div>`:j`<div id="comments">${Pt(e,t,e.commentMap$)}</div>`}(this)}setReplyTo(e){this.editingComment&&(this.editingComment=null,this.previewText="",this.previewName="",this.previewPseudonym=""),this.currentReplyTo=e;const t=this.querySelector("#comment-form-container");t&&t.scrollIntoView({behavior:"smooth"})}cancelReply(){this.currentReplyTo=null}handleInputChange(e){this.previewText=e.target.value}async handleNameInputChange(e){const t=e.target;if(this.previewName=t.value,t.value.trim())try{const{pseudonym:e}=await $e(t.value);this.previewPseudonym=e}catch{this.previewPseudonym=""}else this.previewPseudonym=""}async handleSubmit(t){t.preventDefault();const n=new FormData(t.target),i=n.get("name"),o=n.get("message");if(i&&i.length>e.MAX_NAME_LENGTH)return void alert(`${this.i18n.t("nameTooLong")} (${i.length}/${e.MAX_NAME_LENGTH})`);if(o.length>e.MAX_MESSAGE_LENGTH)return void alert(`${this.i18n.t("messageTooLong")} (${o.length}/${e.MAX_MESSAGE_LENGTH})`);let r,a;if(this.editingComment)r=this.editingComment.pseudonym||"",a=this.editingComment.nameHash||"";else{const e=await $e(i||"");r=e.pseudonym,a=e.hash}await this.processSubmission(r,a,o)&&(this.resetFormState(),this.comments.length=0,await this.renderCommentsList())}async processSubmission(e,t,n){if(this.editingComment){const e=await this.apiService.updateComment(this.post,this.editingComment.id,this.editingComment.pseudonym||"",this.editingComment.nameHash||"",n);return e||alert(this.i18n.t("editFailed")),e}return await this.apiService.addComment(this.post,e,t,n,this.currentReplyTo)?(this.saveMyNameHash(t),!0):(alert(this.i18n.t("submitFailed")),!1)}resetFormState(){const e=document.querySelector("#comment-form");e&&e.reset(),this.previewText="",this.previewName="",this.previewPseudonym="",this.editingComment=null,this.currentReplyTo=null}async handlePreviewSubmit(){if(this.previewName&&this.previewName.length>e.MAX_NAME_LENGTH)return void alert(`${this.i18n.t("nameTooLong")} (${this.previewName.length}/${e.MAX_NAME_LENGTH})`);if(this.previewText.length>e.MAX_MESSAGE_LENGTH)return void alert(`${this.i18n.t("messageTooLong")} (${this.previewText.length}/${e.MAX_MESSAGE_LENGTH})`);let t,n;if(this.editingComment)t=this.editingComment.pseudonym||"",n=this.editingComment.nameHash||"";else{const e=await $e(this.previewName);t=e.pseudonym,n=e.hash}await this.processSubmission(t,n,this.previewText)&&(this.resetPreviewState(),this.comments.length=0,await this.renderCommentsList())}resetPreviewState(){this.previewText="",this.previewName="",this.previewPseudonym="",this.editingComment=null,this.currentReplyTo=null,this.switchTab("write");const e=document.querySelector("#comment-form");e&&e.reset()}async handleDelete(e){if(!confirm(this.i18n.t("confirmDelete")))return;await this.apiService.deleteComment(this.post,e)?(this.comments.length=0,await this.renderCommentsList()):alert(this.i18n.t("deleteFailed"))}handleEdit(e){this.clearReplyState(),this.setEditingState(e),this.populateFormWithComment(e),this.scrollToForm()}clearReplyState(){this.currentReplyTo&&(this.currentReplyTo=null)}setEditingState(e){this.editingComment=e,this.previewText=e.msg||"",this.previewName=e.pseudonym||"",this.previewPseudonym=e.pseudonym||""}populateFormWithComment(e){const t=document.querySelector('#comment-form input[name="name"]'),n=document.querySelector('#comment-form textarea[name="message"]');t&&(t.value=e.pseudonym||"",this.previewName=e.pseudonym||"",this.previewPseudonym=e.pseudonym||""),n&&(n.value=e.msg||"",this.previewText=e.msg||"")}scrollToForm(){const e=document.querySelector("#comment-form-container");e&&e.scrollIntoView({behavior:"smooth"})}cancelEdit(){this.editingComment=null,this.clearFormAndPreview()}clearFormAndPreview(){const e=document.querySelector("#comment-form");e&&e.reset(),this.previewText="",this.previewName="",this.previewPseudonym=""}toggleMarkdownHelp(){this.showMarkdownHelp=!this.showMarkdownHelp,this.updateBodyScrollLock()}createMarkdownHelpTemplate(){return j` <div id="markdown-help-modal" class="active">
88
- <div class="markdown-help-container ycc-flex">
89
- <div
90
- class="markdown-help-backdrop ycc-clickable"
91
- @click=${()=>this.toggleMarkdownHelp()}
92
- ></div>
93
- <div class="markdown-help-content" role="dialog" aria-modal="true">
94
- <button
95
- class="markdown-help-close ycc-clickable ycc-reset-button"
96
- @click=${()=>this.toggleMarkdownHelp()}
97
- aria-label="Close"
98
- >
99
- ×
100
- </button>
101
- <h4>${this.i18n.t("commentSystemTitle")}</h4>
102
- <p>${this.i18n.t("commentSystemDesc")}</p>
103
- <p>${this.i18n.t("commentTimeLimit")}</p>
104
- <p>
105
- Powered by&nbsp;<a
106
- href="https://github.com/ziteh/yangchun-comment"
107
- target="_blank"
108
- rel="noopener noreferrer"
109
- >Yang Chun Comment</a
110
- >
111
- </p>
112
- <h4>${this.i18n.t("markdownSyntax")}</h4>
113
- <p>${this.i18n.t("markdownBasicSupport")}</p>
114
- <div class="markdown-examples">
115
- <code>
116
- <pre>
117
- ${this.i18n.t("markdownLinkExample")}
118
-
119
- ${this.i18n.t("markdownImageExample")}
120
-
121
- ${this.i18n.t("markdownItalicExample")}
122
-
123
- ${this.i18n.t("markdownBoldExample")}
124
-
125
- ${this.i18n.t("markdownListExample")}
126
-
127
- ${this.i18n.t("markdownOrderedListExample")}
128
-
129
- ${this.i18n.t("markdownInlineCodeExample")}
130
-
131
- ${this.i18n.t("markdownCodeBlockExample")}</pre
132
- >
133
- </code>
134
- </div>
135
- </div>
136
- </div>
137
- </div>`}createFormTemplate(){return j`
138
- ${"preview"===this.activeTab?function(e){const t=Date.now(),n=e.previewPseudonym$??"";return j` <div class="comment-box preview-mode">
139
- <div id="preview">
140
- ${e.previewText$?j` <div class="preview-comment">
141
- <div class="comment-header">
142
- <span class="comment-name">${n||e.i18n$.t("anonymous")}</span>
143
- <span class="comment-time">${xt(t)}</span>
144
- ${e.currentReplyTo$&&e.commentMap$[e.currentReplyTo$]?j`<span class="reply-to"
145
- >${e.i18n$.t("replyTo")}<span
146
- >${e.getDisplayName(e.commentMap$[e.currentReplyTo$])}</span
147
- ></span
148
- >`:""}
149
- </div>
150
- <div class="comment-content">${e.renderMarkdown(e.previewText$)}</div>
151
- </div>`:j`<div class="empty-preview">${e.i18n$.t("emptyPreview")}</div>`}
152
- </div>
153
- <div class="comment-footer ycc-flex ycc-gap-xs">
154
- <span style="flex: 1;"></span>
155
- <div class="ycc-flex ycc-gap-xs">
156
- <button
157
- type="button"
158
- class="help-btn ycc-clickable ycc-reset-button"
159
- title="${e.i18n$.t("markdownHelp")}"
160
- @click=${()=>e.toggleMarkdownHelp()}
161
- >
162
- ?
163
- </button>
164
- <button
165
- type="button"
166
- class="preview-btn ycc-clickable ycc-transition ycc-transparent-bg active ycc-reset-button"
167
- @click=${()=>e.switchTab("write")}
168
- >
169
- ${e.i18n$.t("write")}
170
- </button>
171
- <button
172
- type="button"
173
- class="submit-btn ycc-clickable ycc-transition ycc-reset-button"
174
- @click=${()=>e.handlePreviewSubmit()}
175
- >
176
- ${e.editingComment$?e.i18n$.t("updateComment"):e.i18n$.t("submitComment")}
177
- </button>
178
- </div>
179
- </div>
180
- </div>`}(this):this.createFormContent()}
181
- ${this.createStatusIndicators()}
182
- ${this.showMarkdownHelp?this.createMarkdownHelpTemplate():Y}
183
- ${this.showAdminLogin?this.createAdminLoginTemplate():Y}
184
- `}createFormContent(){return j` <div class="comment-box">
185
- <div id="form-content" class="${"write"===this.activeTab?"active":""}">
186
- <form
187
- id="comment-form"
188
- class="ycc-reset-form"
189
- @submit=${e=>this.handleSubmit(e)}
190
- >
191
- <div class="honeypot-field">
192
- <input type="text" name="website" tabindex="-1" autocomplete="off" aria-hidden="true" />
193
- </div>
194
- ${this.createTextareaSection()} ${this.createFormFooter()}
195
- </form>
196
- </div>
197
- </div>`}createTextareaSection(){return j` <div class="comment-input">
198
- <textarea
199
- name="message"
200
- placeholder="${this.i18n.t("messagePlaceholder")}"
201
- maxlength="${e.MAX_MESSAGE_LENGTH}"
202
- required
203
- .value=${this.previewText}
204
- @input=${e=>this.handleInputChange(e)}
205
- ></textarea>
206
- <div class="char-count">
207
- <span
208
- id="message-char-count"
209
- class="${this.previewText.length>e.MAX_MESSAGE_LENGTH?"over-limit":""}"
210
- >${this.previewText.length}</span
211
- >/${e.MAX_MESSAGE_LENGTH}
212
- </div>
213
- </div>`}createFormFooter(){return j` <div class="comment-footer ycc-flex ycc-flex-wrap ycc-gap-xs">
214
- <div class="name-input-container">
215
- <input
216
- type="text"
217
- name="name"
218
- autocomplete="name"
219
- placeholder="${this.i18n.t("namePlaceholder")}"
220
- maxlength="${e.MAX_NAME_LENGTH}"
221
- ?disabled=${null!==this.editingComment}
222
- .value=${this.previewName}
223
- @input=${e=>this.handleNameInputChange(e)}
224
- />
225
- <div class="char-count" style="margin-top: 4px;">
226
- <span
227
- id="name-char-count"
228
- class="${this.previewName.length>e.MAX_NAME_LENGTH?"over-limit":""}"
229
- >${this.previewName.length}</span
230
- >/${e.MAX_NAME_LENGTH}
231
- </div>
232
- <div class="pseudonym-notice" style="font-size: 0.8em; color: #666; margin-top: 4px;">
233
- ${this.editingComment?this.i18n.t("editingPseudonymNotice"):this.i18n.t("pseudonymNotice")}
234
- </div>
235
- </div>
236
- <div class="ycc-flex ycc-gap-xs">${this.createFormButtons()}</div>
237
- </div>`}createFormButtons(){return j` <button
238
- type="button"
239
- class="help-btn ycc-clickable ycc-reset-button"
240
- title="${this.i18n.t("markdownHelp")}"
241
- @click=${()=>this.toggleMarkdownHelp()}
242
- >
243
- ?
244
- </button>
245
- <button
246
- type="button"
247
- class="preview-btn ycc-clickable ycc-transition ycc-transparent-bg ycc-reset-button ${"preview"===this.activeTab?"active":""}"
248
- @click=${()=>this.switchTab("preview"===this.activeTab?"write":"preview")}
249
- >
250
- ${"preview"===this.activeTab?this.i18n.t("write"):this.i18n.t("preview")}
251
- </button>
252
- <button type="submit" class="submit-btn ycc-clickable ycc-transition ycc-reset-button">
253
- ${this.editingComment?this.i18n.t("updateComment"):this.i18n.t("submitComment")}
254
- </button>`}createAdminButton(){return j`<button
255
- type="button"
256
- class="admin-btn ycc-clickable ycc-reset-button"
257
- title="Admin"
258
- @click=${()=>this.showAdminModal()}
259
- >
260
-
261
- </button>`}showAdminModal(){this.showAdminLogin=!0,this.updateBodyScrollLock()}hideAdminModal(){this.showAdminLogin=!1,this.updateBodyScrollLock()}updateBodyScrollLock(){const e=this.showMarkdownHelp||this.showAdminLogin;document.body.classList.toggle("ycc-modal-open",e)}createAdminLoginTemplate(){return j`<div
262
- class="admin-modal-backdrop ycc-clickable"
263
- @click=${()=>this.hideAdminModal()}
264
- >
265
- <div class="admin-modal-content" @click=${e=>e.stopPropagation()}>
266
- <button
267
- class="admin-modal-close ycc-clickable ycc-reset-button"
268
- @click=${()=>this.hideAdminModal()}
269
- >
270
- ×
271
- </button>
272
- <h3>Admin Login</h3>
273
- <form @submit=${e=>this.handleAdminLogin(e)}>
274
- <div class="admin-form-group">
275
- <label for="admin-username">Username:</label
276
- ><input type="text" id="admin-username" name="username" required autocomplete="off" />
277
- </div>
278
- <div class="admin-form-group">
279
- <label for="admin-password">Password:</label
280
- ><input
281
- type="password"
282
- id="admin-password"
283
- name="password"
284
- required
285
- autocomplete="off"
286
- />
287
- </div>
288
- <button type="submit" class="admin-login-btn ycc-clickable ycc-reset-button">
289
- Login
290
- </button>
291
- </form>
292
- </div>
293
- </div>`}async handleAdminLogin(e){e.preventDefault();const t=new FormData(e.target),n=t.get("username"),i=t.get("password");try{const e=await fetch(`${this.apiUrl}admin/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:i})});e.ok?(await e.text(),alert("Admin login successful!"),this.hideAdminModal()):alert("Admin login failed!")}catch(e){console.error("Admin login error:",e),alert("Admin login error!")}}createStatusIndicators(){const e=this.createReplyIndicator(),t=this.createEditIndicator();return""!==e||""!==t?j`${e}${t}`:Y}createReplyIndicator(){return this.currentReplyTo&&this.commentMap[this.currentReplyTo]?j`<div class="info ycc-flex ycc-gap-md">
294
- ${this.i18n.t("replyingTo")}
295
- ${this.getDisplayName(this.commentMap[this.currentReplyTo])}<button
296
- type="button"
297
- class="cancel-link ycc-clickable ycc-transition ycc-reset-button"
298
- @click=${()=>this.cancelReply()}
299
- >
300
- ${this.i18n.t("cancelReply")}
301
- </button>
302
- </div>`:""}createEditIndicator(){return this.editingComment?j`<div class="info ycc-flex ycc-gap-md">
303
- ${this.i18n.t("editing")} ${this.editingComment.id}<button
304
- type="button"
305
- class="cancel-link ycc-clickable ycc-transition ycc-reset-button"
306
- @click=${()=>this.cancelEdit()}
307
- >
308
- ${this.i18n.t("cancelEdit")}
309
- </button>
310
- </div>`:""}render(){return j` <div class="ycc-container">
311
- <div class="comment-box-container">
312
- <div id="comment-form-container" class="form-content">${this.createFormTemplate()}</div>
313
- <!-- <div class="admin-btn-wrapper">${this.createAdminButton()}</div> -->
314
- </div>
315
- <div id="comments-container">${this.createCommentsTemplate()}</div>
316
- </div>`}async refresh(){await this.reloadComments()}get i18n$(){return this.i18n}get commentMap$(){return this.commentMap}get currentReplyTo$(){return this.currentReplyTo}get previewText$(){return this.previewText}get previewPseudonym$(){return this.previewPseudonym}get editingComment$(){return this.editingComment}get comments$(){return this.comments}formatDate(e){return xt(e)}}).MAX_NAME_LENGTH=25,e.MAX_MESSAGE_LENGTH=1e3,e.MY_NAME_HASHES_KEY="ycc_my_name_hashes",e);Dt([ue({type:String})],Ot.prototype,"post"),Dt([ue({type:String})],Ot.prototype,"apiUrl"),Dt([ue({type:String})],Ot.prototype,"authorName"),Dt([ue({attribute:!1})],Ot.prototype,"language"),Dt([he()],Ot.prototype,"commentMap"),Dt([he()],Ot.prototype,"comments"),Dt([he()],Ot.prototype,"currentReplyTo"),Dt([he()],Ot.prototype,"previewText"),Dt([he()],Ot.prototype,"previewName"),Dt([he()],Ot.prototype,"previewPseudonym"),Dt([he()],Ot.prototype,"editingComment"),Dt([he()],Ot.prototype,"activeTab"),Dt([he()],Ot.prototype,"showMarkdownHelp"),Dt([he()],Ot.prototype,"showAdminLogin");let Ht=Ot;function It(e="ycc-app",t={}){const n=document.getElementById(e);if(!n)throw new Error(`Container #${e} not found`);const i=document.createElement("yangchun-comment");return t.post&&(i.post=t.post),t.apiUrl&&(i.apiUrl=t.apiUrl),t.authorName&&(i.authorName=t.authorName),t.language&&(i.language=t.language),n.innerHTML="",n.appendChild(i),i}customElements.get("yangchun-comment")||customElements.define("yangchun-comment",Ht);export{It as default,It as initYangchunComment};
317
- //# sourceMappingURL=yangchun-comment.es.js.map