@tryghost/comments-ui 1.5.20 → 1.5.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tryghost/comments-ui",
3
3
  "type": "module",
4
- "version": "1.5.20",
4
+ "version": "1.5.22",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -116,4 +116,3 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
116
116
  `)+" "+G[1]:G[0]+L+" "+N.join(", ")+" "+G[1]}function k(N){return Array.isArray(N)}n.isArray=k;function S(N){return typeof N=="boolean"}n.isBoolean=S;function R(N){return N===null}n.isNull=R;function O(N){return N==null}n.isNullOrUndefined=O;function U(N){return typeof N=="number"}n.isNumber=U;function _(N){return typeof N=="string"}n.isString=_;function Q(N){return typeof N=="symbol"}n.isSymbol=Q;function oe(N){return N===void 0}n.isUndefined=oe;function Z(N){return Y(N)&&X(N)==="[object RegExp]"}n.isRegExp=Z;function Y(N){return typeof N=="object"&&N!==null}n.isObject=Y;function ae(N){return Y(N)&&X(N)==="[object Date]"}n.isDate=ae;function pe(N){return Y(N)&&(X(N)==="[object Error]"||N instanceof Error)}n.isError=pe;function B(N){return typeof N=="function"}n.isFunction=B;function V(N){return N===null||typeof N=="boolean"||typeof N=="number"||typeof N=="string"||typeof N=="symbol"||typeof N>"u"}n.isPrimitive=V,n.isBuffer=DA();function X(N){return Object.prototype.toString.call(N)}function me(N){return N<10?"0"+N.toString(10):N.toString(10)}var he=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ne(){var N=new Date,L=[me(N.getHours()),me(N.getMinutes()),me(N.getSeconds())].join(":");return[N.getDate(),he[N.getMonth()],L].join(" ")}n.log=function(){console.log("%s - %s",Ne(),n.format.apply(n,arguments))},n.inherits=AA(),n._extend=function(N,L){if(!L||!Y(L))return N;for(var G=Object.keys(L),ke=G.length;ke--;)N[G[ke]]=L[G[ke]];return N};function Le(N,L){return Object.prototype.hasOwnProperty.call(N,L)}})(wm)),wm}var V0;function TA(){if(V0)return Td.exports;V0=1;var n=NA()();function e(B,V){if(B===V)return 0;for(var X=B.length,me=V.length,he=0,Ne=Math.min(X,me);he<Ne;++he)if(B[he]!==V[he]){X=B[he],me=V[he];break}return X<me?-1:me<X?1:0}function t(B){return oi.Buffer&&typeof oi.Buffer.isBuffer=="function"?oi.Buffer.isBuffer(B):!!(B!=null&&B._isBuffer)}var o=OA(),r=Object.prototype.hasOwnProperty,s=Array.prototype.slice,l=(function(){return(function(){}).name==="foo"})();function c(B){return Object.prototype.toString.call(B)}function d(B){return t(B)||typeof oi.ArrayBuffer!="function"?!1:typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(B):B?!!(B instanceof DataView||B.buffer&&B.buffer instanceof ArrayBuffer):!1}var m=Td.exports=R,f=/\s*function\s+([^\(\s]*)\s*/;function h(B){if(o.isFunction(B)){if(l)return B.name;var V=B.toString(),X=V.match(f);return X&&X[1]}}m.AssertionError=function(V){this.name="AssertionError",this.actual=V.actual,this.expected=V.expected,this.operator=V.operator,V.message?(this.message=V.message,this.generatedMessage=!1):(this.message=k(this),this.generatedMessage=!0);var X=V.stackStartFunction||S;if(Error.captureStackTrace)Error.captureStackTrace(this,X);else{var me=new Error;if(me.stack){var he=me.stack,Ne=h(X),Le=he.indexOf(`
117
117
  `+Ne);if(Le>=0){var N=he.indexOf(`
118
118
  `,Le+1);he=he.substring(N+1)}this.stack=he}}},o.inherits(m.AssertionError,Error);function g(B,V){return typeof B=="string"?B.length<V?B:B.slice(0,V):B}function b(B){if(l||!o.isFunction(B))return o.inspect(B);var V=h(B),X=V?": "+V:"";return"[Function"+X+"]"}function k(B){return g(b(B.actual),128)+" "+B.operator+" "+g(b(B.expected),128)}function S(B,V,X,me,he){throw new m.AssertionError({message:X,actual:B,expected:V,operator:me,stackStartFunction:he})}m.fail=S;function R(B,V){B||S(B,!0,V,"==",m.ok)}m.ok=R,m.equal=function(V,X,me){V!=X&&S(V,X,me,"==",m.equal)},m.notEqual=function(V,X,me){V==X&&S(V,X,me,"!=",m.notEqual)},m.deepEqual=function(V,X,me){O(V,X,!1)||S(V,X,me,"deepEqual",m.deepEqual)},m.deepStrictEqual=function(V,X,me){O(V,X,!0)||S(V,X,me,"deepStrictEqual",m.deepStrictEqual)};function O(B,V,X,me){if(B===V)return!0;if(t(B)&&t(V))return e(B,V)===0;if(o.isDate(B)&&o.isDate(V))return B.getTime()===V.getTime();if(o.isRegExp(B)&&o.isRegExp(V))return B.source===V.source&&B.global===V.global&&B.multiline===V.multiline&&B.lastIndex===V.lastIndex&&B.ignoreCase===V.ignoreCase;if((B===null||typeof B!="object")&&(V===null||typeof V!="object"))return X?B===V:B==V;if(d(B)&&d(V)&&c(B)===c(V)&&!(B instanceof Float32Array||B instanceof Float64Array))return e(new Uint8Array(B.buffer),new Uint8Array(V.buffer))===0;if(t(B)!==t(V))return!1;me=me||{actual:[],expected:[]};var he=me.actual.indexOf(B);return he!==-1&&he===me.expected.indexOf(V)?!0:(me.actual.push(B),me.expected.push(V),_(B,V,X,me))}function U(B){return Object.prototype.toString.call(B)=="[object Arguments]"}function _(B,V,X,me){if(B==null||V===null||V===void 0)return!1;if(o.isPrimitive(B)||o.isPrimitive(V))return B===V;if(X&&Object.getPrototypeOf(B)!==Object.getPrototypeOf(V))return!1;var he=U(B),Ne=U(V);if(he&&!Ne||!he&&Ne)return!1;if(he)return B=s.call(B),V=s.call(V),O(B,V,X);var Le=pe(B),N=pe(V),L,G;if(Le.length!==N.length)return!1;for(Le.sort(),N.sort(),G=Le.length-1;G>=0;G--)if(Le[G]!==N[G])return!1;for(G=Le.length-1;G>=0;G--)if(L=Le[G],!O(B[L],V[L],X,me))return!1;return!0}m.notDeepEqual=function(V,X,me){O(V,X,!1)&&S(V,X,me,"notDeepEqual",m.notDeepEqual)},m.notDeepStrictEqual=Q;function Q(B,V,X){O(B,V,!0)&&S(B,V,X,"notDeepStrictEqual",Q)}m.strictEqual=function(V,X,me){V!==X&&S(V,X,me,"===",m.strictEqual)},m.notStrictEqual=function(V,X,me){V===X&&S(V,X,me,"!==",m.notStrictEqual)};function oe(B,V){if(!B||!V)return!1;if(Object.prototype.toString.call(V)=="[object RegExp]")return V.test(B);try{if(B instanceof V)return!0}catch{}return Error.isPrototypeOf(V)?!1:V.call({},B)===!0}function Z(B){var V;try{B()}catch(X){V=X}return V}function Y(B,V,X,me){var he;if(typeof V!="function")throw new TypeError('"block" argument must be a function');typeof X=="string"&&(me=X,X=null),he=Z(V),me=(X&&X.name?" ("+X.name+").":".")+(me?" "+me:"."),B&&!he&&S(he,X,"Missing expected exception"+me);var Ne=typeof me=="string",Le=!B&&o.isError(he),N=!B&&he&&!X;if((Le&&Ne&&oe(he,X)||N)&&S(he,X,"Got unwanted exception"+me),B&&he&&X&&!oe(he,X)||!B&&he)throw he}m.throws=function(B,V,X){Y(!0,B,V,X)},m.doesNotThrow=function(B,V,X){Y(!1,B,V,X)},m.ifError=function(B){if(B)throw B};function ae(B,V){B||S(B,!0,V,"==",ae)}m.strict=n(ae,m,{equal:m.strictEqual,deepEqual:m.deepStrictEqual,notEqual:m.notStrictEqual,notDeepEqual:m.notDeepStrictEqual}),m.strict.strict=m.strict;var pe=Object.keys||function(B){var V=[];for(var X in B)r.call(B,X)&&V.push(X);return V};return Td.exports}var xm,Y0;function PA(){if(Y0)return xm;Y0=1;var n=TA();return xm=function(e){var t,o,r,s,l;for(t=Error.prepareStackTrace,Error.prepareStackTrace=function(c,d){return Error.prepareStackTrace=t,d},o=new Error().stack,l=0;l<o.length&&o[l].getFileName()!==__filename;)l++;n(l<o.length,"Unexpected: unable to find caller/index.js in the stack"),e=!e||isNaN(e)?1:e>o.length-2?o.length-2:e,o=o.slice(l+e+1);do s=o.shift(),r=s&&s.getFileName();while(o.length&&r==="module.js");return r},xm}var q0;function jA(){if(q0)return fl;q0=1;const n=Or,e=Or,t=XD(),o=PA();return fl.getCallerRoot=function(){try{return t(o(2))}catch{return}},fl.getProcessRoot=function(){let s=process.cwd();const l=e.join(s,"current");try{n.statSync(l).isDirectory()&&(s=l)}catch{}try{return t(s)}catch{return}},fl}var Sm,J0;function MA(){return J0||(J0=1,Sm=jA()),Sm}var gl={exports:{}},Cm,W0;function LA(){if(W0)return Cm;W0=1;var n=1e3,e=n*60,t=e*60,o=t*24,r=o*7,s=o*365.25;Cm=function(f,h){h=h||{};var g=typeof f;if(g==="string"&&f.length>0)return l(f);if(g==="number"&&isFinite(f))return h.long?d(f):c(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function l(f){if(f=String(f),!(f.length>100)){var h=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(h){var g=parseFloat(h[1]),b=(h[2]||"ms").toLowerCase();switch(b){case"years":case"year":case"yrs":case"yr":case"y":return g*s;case"weeks":case"week":case"w":return g*r;case"days":case"day":case"d":return g*o;case"hours":case"hour":case"hrs":case"hr":case"h":return g*t;case"minutes":case"minute":case"mins":case"min":case"m":return g*e;case"seconds":case"second":case"secs":case"sec":case"s":return g*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}}}function c(f){var h=Math.abs(f);return h>=o?Math.round(f/o)+"d":h>=t?Math.round(f/t)+"h":h>=e?Math.round(f/e)+"m":h>=n?Math.round(f/n)+"s":f+"ms"}function d(f){var h=Math.abs(f);return h>=o?m(f,h,o,"day"):h>=t?m(f,h,t,"hour"):h>=e?m(f,h,e,"minute"):h>=n?m(f,h,n,"second"):f+" ms"}function m(f,h,g,b){var k=h>=g*1.5;return Math.round(f/g)+" "+b+(k?"s":"")}return Cm}var Em,K0;function IA(){if(K0)return Em;K0=1;function n(e){o.debug=o,o.default=o,o.coerce=m,o.disable=c,o.enable=s,o.enabled=d,o.humanize=LA(),o.destroy=f,Object.keys(e).forEach(h=>{o[h]=e[h]}),o.names=[],o.skips=[],o.formatters={};function t(h){let g=0;for(let b=0;b<h.length;b++)g=(g<<5)-g+h.charCodeAt(b),g|=0;return o.colors[Math.abs(g)%o.colors.length]}o.selectColor=t;function o(h){let g,b=null,k,S;function R(...O){if(!R.enabled)return;const U=R,_=Number(new Date),Q=_-(g||_);U.diff=Q,U.prev=g,U.curr=_,g=_,O[0]=o.coerce(O[0]),typeof O[0]!="string"&&O.unshift("%O");let oe=0;O[0]=O[0].replace(/%([a-zA-Z%])/g,(Y,ae)=>{if(Y==="%%")return"%";oe++;const pe=o.formatters[ae];if(typeof pe=="function"){const B=O[oe];Y=pe.call(U,B),O.splice(oe,1),oe--}return Y}),o.formatArgs.call(U,O),(U.log||o.log).apply(U,O)}return R.namespace=h,R.useColors=o.useColors(),R.color=o.selectColor(h),R.extend=r,R.destroy=o.destroy,Object.defineProperty(R,"enabled",{enumerable:!0,configurable:!1,get:()=>b!==null?b:(k!==o.namespaces&&(k=o.namespaces,S=o.enabled(h)),S),set:O=>{b=O}}),typeof o.init=="function"&&o.init(R),R}function r(h,g){const b=o(this.namespace+(typeof g>"u"?":":g)+h);return b.log=this.log,b}function s(h){o.save(h),o.namespaces=h,o.names=[],o.skips=[];const g=(typeof h=="string"?h:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const b of g)b[0]==="-"?o.skips.push(b.slice(1)):o.names.push(b)}function l(h,g){let b=0,k=0,S=-1,R=0;for(;b<h.length;)if(k<g.length&&(g[k]===h[b]||g[k]==="*"))g[k]==="*"?(S=k,R=b,k++):(b++,k++);else if(S!==-1)k=S+1,R++,b=R;else return!1;for(;k<g.length&&g[k]==="*";)k++;return k===g.length}function c(){const h=[...o.names,...o.skips.map(g=>"-"+g)].join(",");return o.enable(""),h}function d(h){for(const g of o.skips)if(l(h,g))return!1;for(const g of o.names)if(l(h,g))return!0;return!1}function m(h){return h instanceof Error?h.stack||h.message:h}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return o.enable(o.load()),o}return Em=n,Em}var G0;function BA(){return G0||(G0=1,(function(n,e){e.formatArgs=o,e.save=r,e.load=s,e.useColors=t,e.storage=l(),e.destroy=(()=>{let d=!1;return()=>{d||(d=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let d;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(d=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(d[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(d){if(d[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+d[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const m="color: "+this.color;d.splice(1,0,m,"color: inherit");let f=0,h=0;d[0].replace(/%[a-zA-Z%]/g,g=>{g!=="%%"&&(f++,g==="%c"&&(h=f))}),d.splice(h,0,m)}e.log=console.debug||console.log||(()=>{});function r(d){try{d?e.storage.setItem("debug",d):e.storage.removeItem("debug")}catch{}}function s(){let d;try{d=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!d&&typeof process<"u"&&"env"in process&&(d=process.env.DEBUG),d}function l(){try{return localStorage}catch{}}n.exports=IA()(e);const{formatters:c}=n.exports;c.j=function(d){try{return JSON.stringify(d)}catch(m){return"[UnexpectedJSONParseError]: "+m.message}}})(gl,gl.exports)),gl.exports}var Q0;function zA(){if(Q0)return ml.exports;Q0=1;const n=MA(),e=BA();return ml.exports=function(o){const r=n.getCallerRoot();let s;try{const l=er("/node_modules/.pnpm/@tryghost+debug@2.2.3/node_modules/@tryghost/debug/lib")(r+"/package.json");l.alias?s=l.alias:s=l.name}catch{s="undefined"}return e(s+":"+o)},ml.exports._base=e,ml.exports}var Rm,X0;function FA(){return X0||(X0=1,Rm=zA()),Rm}const UA=[{code:"af",label:"Afrikaans"},{code:"ar",label:"Arabic"},{code:"bg",label:"Bulgarian"},{code:"bn",label:"Bengali"},{code:"bs",label:"Bosnian"},{code:"ca",label:"Catalan"},{code:"cs",label:"Czech"},{code:"da",label:"Danish"},{code:"de",label:"German"},{code:"de-CH",label:"Swiss German"},{code:"el",label:"Greek"},{code:"en",label:"English"},{code:"eo",label:"Esperanto"},{code:"es",label:"Spanish"},{code:"et",label:"Estonian"},{code:"eu",label:"Basque"},{code:"fa",label:"Persian/Farsi"},{code:"fi",label:"Finnish"},{code:"fr",label:"French"},{code:"gd",label:"Gaelic (Scottish)"},{code:"he",label:"Hebrew"},{code:"hi",label:"Hindi"},{code:"hr",label:"Croatian"},{code:"hu",label:"Hungarian"},{code:"id",label:"Indonesian"},{code:"is",label:"Icelandic"},{code:"it",label:"Italian"},{code:"ja",label:"Japanese"},{code:"ko",label:"Korean"},{code:"kz",label:"Kazakh"},{code:"lt",label:"Lithuanian"},{code:"lv",label:"Latvian"},{code:"mk",label:"Macedonian"},{code:"mn",label:"Mongolian"},{code:"ms",label:"Malay"},{code:"nb",label:"Norwegian Bokmål"},{code:"ne",label:"Nepali"},{code:"nl",label:"Dutch"},{code:"nn",label:"Norwegian Nynorsk"},{code:"pa",label:"Punjabi"},{code:"pl",label:"Polish"},{code:"pt",label:"Portuguese"},{code:"pt-BR",label:"Portuguese (Brazil)"},{code:"ro",label:"Romanian"},{code:"ru",label:"Russian"},{code:"si",label:"Sinhala"},{code:"sk",label:"Slovak"},{code:"sl",label:"Slovenian"},{code:"sq",label:"Albanian"},{code:"sr",label:"Serbian"},{code:"sr-Cyrl",label:"Serbian (Cyrillic)"},{code:"sv",label:"Swedish"},{code:"sw",label:"Swahili"},{code:"ta",label:"Tamil"},{code:"th",label:"Thai"},{code:"tr",label:"Turkish"},{code:"uk",label:"Ukrainian"},{code:"ur",label:"Urdu"},{code:"uz",label:"Uzbek"},{code:"vi",label:"Vietnamese"},{code:"zh",label:"Chinese"},{code:"zh-Hant",label:"Traditional Chinese"}];var Z0;function HA(){if(Z0)return Ar.exports;Z0=1;const n=QD(),e=Or,t=Or,o=FA()("i18n"),r=UA,s=r.map(d=>d.code);function l(d,m){return d.reduce((f,h)=>{let g;try{g=er("/ghost/i18n/lib")(`../locales/${h}/${m}.json`)}catch{g=er("/ghost/i18n/lib")(`../locales/en/${m}.json`)}return f[h]={[m]:{...g,...g.default&&typeof g.default=="object"?g.default:{}}},f},{})}function c(d,m){if(!m)return{[d]:{theme:{}}};let f=[];try{f=t.readdirSync(m).filter(b=>b.endsWith(".json")).map(b=>b.replace(".json",""))}catch{f=[d,"en"]}return[...new Set([d,...f,"en"])].reduce((g,b)=>{let k,S=!1;const R=e.join(m,`${b}.json`);if(t.existsSync(R))try{delete require.cache[er("/ghost/i18n/lib").resolve(R)],k=er("/ghost/i18n/lib")(R)}catch{o(`Error loading theme locale file: ${b}`),S=!0}else S=!0;if(S)if(b!=="en")try{const O=e.join(m,"en.json");t.existsSync(O)?(delete require.cache[er("/ghost/i18n/lib").resolve(O)],k=er("/ghost/i18n/lib")(O)):k={}}catch{k={}}else o("Theme en.json file not found"),k={};return g[b]={theme:{...k,...k.default&&typeof k.default=="object"?k.default:{}}},g},{})}return Ar.exports=(d="en",m="portal",f={})=>{const h=n.createInstance(),g={prefix:"{",suffix:"}"};(m==="theme"||m==="portal")&&(g.escapeValue=!1);let b;return m!=="theme"?b=l(s,m):(o(`generateThemeResources: ${d}, ${f.themePath}`),b=c(d,f.themePath)),h.init({lng:d,nsSeparator:!1,keySeparator:!1,returnEmptyString:!1,fallbackLng:{no:["nb","en"],default:["en"]},ns:m,defaultNS:m,interpolation:g,resources:b}),h},Ar.exports.SUPPORTED_LOCALES=s,Ar.exports.LOCALE_DATA=r,Ar.exports.generateResources=l,Ar.exports}var ek;function _A(){if(ek)return Zo.exports;ek=1;const n=HA();return Zo.exports=n,Zo.exports.default=n,Zo.exports.LOCALE_DATA=n.LOCALE_DATA,Zo.exports.SUPPORTED_LOCALES=n.SUPPORTED_LOCALES,Zo.exports.generateResources=n.generateResources,Zo.exports}var VA=_A();const YA=ri(VA);function qA({siteUrl:n=window.location.origin,apiUrl:e,apiKey:t}){const o="members/api";function r({type:m,resource:f,params:h=""}){return`${n.replace(/\/$/,"")}/${o}/${f}/${h}`}function s({resource:m,params:f={}}){if(e&&t){const h=new URLSearchParams({...f,key:t});return`${e.replace(/\/$/,"")}/${m}/?${h.toString()}`}return""}function l({url:m,method:f="GET",headers:h={},credentials:g=void 0,body:b=void 0}){return fetch(m,{method:f,headers:h,credentials:g,body:b})}let c=null;const d={site:{settings(){const m=s({resource:"settings"});return l({url:m,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(f){if(f.ok)return f.json();throw new Error("Failed to fetch site data")})}},member:{identity(){const m=r({type:"members",resource:"session"});return l({url:m,credentials:"same-origin"}).then(function(f){return!f.ok||f.status===204?null:f.text()})},sessionData(){const m=r({type:"members",resource:"member"});return l({url:m,credentials:"same-origin"}).then(function(f){return!f.ok||f.status===204?null:f.json()})},update({name:m,expertise:f}){const h=r({type:"members",resource:"member"});return l({url:h,method:"PUT",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({name:m,expertise:f})}).then(function(b){return b.ok?b.json():null})}},comments:{async count({postId:m}){const f=m?`?ids=${m}`:"",h=r({type:"members",resource:"comments/counts",params:f}),b=await(await l({url:h,method:"GET",headers:{"Content-Type":"application/json"},credentials:"same-origin"})).json();return m?b[m]:b},browse({page:m,postId:f,order:h}){let g=null;c&&!h&&(g=`created_at:<=${c}`);const b=new URLSearchParams;b.set("limit","20"),g&&b.set("filter",g),b.set("page",m.toString()),h&&b.set("order",h);const k=r({type:"members",resource:`comments/post/${f}`,params:`?${b.toString()}`}),S=l({url:k,method:"GET",headers:{"Content-Type":"application/json"},credentials:"same-origin"}).then(function(R){if(R.ok)return R.json();throw new Error("Failed to fetch comments")});return c||S.then(R=>{const O=R.comments[0];O&&(c=O.created_at)}),S},async replies({commentId:m,afterReplyId:f,limit:h,page:g}){if(h==="all"){const R=[];let O=1,U=!0;for(;U;){const _=await this.replies({commentId:m,limit:100,page:O});R.push(..._.comments),U=!!_.meta?.pagination?.next&&_.comments.length>0,O+=1}return{comments:R,meta:{pagination:{next:!1}}}}const b=new URLSearchParams;b.set("limit",(h??5).toString()),g&&b.set("page",g.toString()),f&&b.set("filter",`id:>'${f}'`);const k=r({type:"members",resource:`comments/${m}/replies`,params:`?${b.toString()}`}),S=await l({url:k,method:"GET",headers:{"Content-Type":"application/json"},credentials:"same-origin"});if(S.ok)return S.json();throw new Error("Failed to fetch replies")},add({comment:m}){const f={comments:[m]},h=r({type:"members",resource:"comments"});return l({url:h,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}).then(function(g){if(g.ok)return g.json();throw new Error("Failed to add comment")})},edit({comment:m}){const f={comments:[m]},h=r({type:"members",resource:`comments/${m.id}`});return l({url:h,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}).then(function(g){if(g.ok)return g.json();throw new Error("Failed to edit comment")})},read(m){const f=r({type:"members",resource:`comments/${m}`});return l({url:f,method:"GET",credentials:"same-origin"}).then(function(h){if(h.ok)return h.json();throw new Error("Failed to read comment")})},like({comment:m}){const f=r({type:"members",resource:`comments/${m.id}/like`});return l({url:f,method:"POST",headers:{"Content-Type":"application/json"}}).then(function(h){if(h.ok)return"Success";throw new Error("Failed to like comment")})},unlike({comment:m}){const f={comments:[m]},h=r({type:"members",resource:`comments/${m.id}/like`});return l({url:h,method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}).then(function(g){if(g.ok)return"Success";throw new Error("Failed to unlike comment")})},dislike({comment:m}){const f=r({type:"members",resource:`comments/${m.id}/dislike`});return l({url:f,method:"POST",headers:{"Content-Type":"application/json"}}).then(function(h){if(h.ok)return"Success";throw new Error("Failed to dislike comment")})},undislike({comment:m}){const f={comments:[m]},h=r({type:"members",resource:`comments/${m.id}/dislike`});return l({url:h,method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}).then(function(g){if(g.ok)return"Success";throw new Error("Failed to undislike comment")})},report({comment:m}){const f=r({type:"members",resource:`comments/${m.id}/report`});return l({url:f,method:"POST",headers:{"Content-Type":"application/json"}}).then(function(h){if(h.ok)return"Success";throw new Error("Failed to report comment")})}},init:(()=>{})};return d.init=async()=>{const[m]=await Promise.all([d.member.sessionData()]);let f={},h=null;try{const g=await d.site.settings();g.settings.labs&&Object.assign(f,g.settings.labs),h=g.settings.support_email_address||null}catch{f={}}return{member:m,labs:f,supportEmail:h}},d}function yl(n,e){for(const t of n){if(t.id===e)return t;for(const o of t.replies||[])if(o.id===e)return o}}async function JA({state:n,api:e,options:t,order:o}){let r=1;n.pagination&&n.pagination.page&&(r=n.pagination.page+1);let s;return n.admin&&n.adminApi?s=await n.adminApi.browse({page:r,postId:t.postId,order:o||n.order,memberUuid:n.member?.uuid}):s=await e.comments.browse({page:r,postId:t.postId,order:o||n.order}),{comments:[...n.comments,...s.comments].filter((d,m,f)=>f.findIndex(h=>h.id===d.id)===m),pagination:s.meta.pagination}}function WA({data:n}){return{commentsIsLoading:n}}async function KA({state:n,data:{order:e},options:t,api:o,dispatchAction:r}){r("setCommentsIsLoading",!0);try{let s;return n.admin&&n.adminApi?s=await n.adminApi.browse({page:1,postId:t.postId,order:e,memberUuid:n.member?.uuid}):s=await o.comments.browse({page:1,postId:t.postId,order:e}),{comments:[...s.comments],pagination:s.meta.pagination,order:e,commentsIsLoading:!1}}catch(s){throw console.error("Failed to set order:",s),n.commentsIsLoading=!1,s}}async function GA({state:n,api:e,data:t}){const r=(await e.comments.add({comment:t})).comments[0];return{comments:[r,...n.comments],commentCount:n.commentCount+1,commentIdToScrollTo:r.id}}async function QA({state:n,api:e,data:{reply:t,parent:o}}){const s=(await e.comments.add({comment:{...t,parent_id:o.id}})).comments[0],l=await e.comments.replies({commentId:o.id,limit:"all"}),c=l.comments.some(d=>d.id===s.id)?l.comments:[...l.comments,s];return{comments:n.comments.map(d=>d.id===o.id?{...d,replies:c,count:{...d.count,replies:c.length}}:d),commentCount:n.commentCount+1,commentIdToScrollTo:s.id}}async function XA({state:n,data:e}){return n.adminApi&&await n.adminApi.hideComment(e.id),{comments:n.comments.map(t=>{const o=t.replies.map(r=>r.id===e.id?{...r,status:"hidden"}:r);return t.id===e.id?{...t,status:"hidden",replies:o}:{...t,replies:o}}),commentCount:n.commentCount-1}}async function ZA({state:n,api:e,data:t}){n.adminApi&&await n.adminApi.showComment({id:t.id});let o;n.admin&&n.adminApi?o=await n.adminApi.read({commentId:t.id,memberUuid:n.member?.uuid}):o=await e.comments.read(t.id);const r=o.comments[0];return{comments:n.comments.map(s=>{const l=s.replies.map(c=>c.id===t.id?r:c);return s.id===t.id?r:{...s,replies:l}}),commentCount:n.commentCount+1}}async function eO({state:n,data:e,dispatchAction:t}){return n.adminApi&&(await n.adminApi.pinComment({id:e.id}),t("setOrder",{order:n.order})),null}async function tO({state:n,data:e,dispatchAction:t}){return n.adminApi&&(await n.adminApi.unpinComment({id:e.id}),t("setOrder",{order:n.order})),null}async function nO({state:n,data:e}){return{comments:n.comments.map(t=>{const o=t.replies.map(r=>r.id===e.id?e.expectedLiked!==void 0&&r.liked!==e.expectedLiked||e.expectedDisliked!==void 0&&!!r.disliked!==e.expectedDisliked||e.expectedVotePending!==void 0&&!!r.votePending!==e.expectedVotePending?r:{...r,liked:e.liked,disliked:e.restoreDisliked??(e.liked?!1:r.disliked),votePending:e.votePending??r.votePending,count:{...r.count,likes:e.liked?r.count.likes+1:r.count.likes-1}}:r);return t.id===e.id?e.expectedLiked!==void 0&&t.liked!==e.expectedLiked?{...t,replies:o}:e.expectedDisliked!==void 0&&!!t.disliked!==e.expectedDisliked?{...t,replies:o}:e.expectedVotePending!==void 0&&!!t.votePending!==e.expectedVotePending?{...t,replies:o}:{...t,liked:e.liked,disliked:e.restoreDisliked??(e.liked?!1:t.disliked),votePending:e.votePending??t.votePending,replies:o,count:{...t.count,likes:e.liked?t.count.likes+1:t.count.likes-1}}:{...t,replies:o}})}}async function oO({state:n,data:e}){const t=o=>e.disliked&&e.wasLiked?o-1:e.restoreLiked?o+1:o;return{comments:n.comments.map(o=>{const r=o.replies.map(s=>s.id===e.id?e.expectedDisliked!==void 0&&s.disliked!==e.expectedDisliked||e.expectedLiked!==void 0&&s.liked!==e.expectedLiked||e.expectedVotePending!==void 0&&!!s.votePending!==e.expectedVotePending?s:{...s,disliked:e.disliked,liked:e.restoreLiked??(e.disliked?!1:s.liked),votePending:e.votePending??s.votePending,count:{...s.count,likes:t(s.count.likes)}}:s);return o.id===e.id?e.expectedDisliked!==void 0&&o.disliked!==e.expectedDisliked?{...o,replies:r}:e.expectedLiked!==void 0&&o.liked!==e.expectedLiked?{...o,replies:r}:e.expectedVotePending!==void 0&&!!o.votePending!==e.expectedVotePending?{...o,replies:r}:{...o,disliked:e.disliked,liked:e.restoreLiked??(e.disliked?!1:o.liked),votePending:e.votePending??o.votePending,replies:r,count:{...o.count,likes:t(o.count.likes)}}:{...o,replies:r}})}}async function rO({state:n,data:e}){return{comments:n.comments.map(t=>{const o=t.replies.map(r=>r.id===e.id?e.expectedVotePending!==void 0&&!!r.votePending!==e.expectedVotePending?r:{...r,votePending:e.votePending}:r);return t.id===e.id?e.expectedVotePending!==void 0&&!!t.votePending!==e.expectedVotePending?{...t,replies:o}:{...t,votePending:e.votePending,replies:o}:{...t,replies:o}})}}async function iO({state:n,api:e,data:t,dispatchAction:o}){const r=yl(n.comments,t.id);if(r?.votePending)return{};const s=r?.disliked??!1;o("updateCommentLikeState",{id:t.id,liked:!0,wasDisliked:s,votePending:!0});try{return await e.comments.like({comment:t}),o("updateCommentVotePendingState",{id:t.id,votePending:!1,expectedVotePending:!0}),{}}catch{o("updateCommentLikeState",{id:t.id,liked:!1,restoreDisliked:s,expectedLiked:!0,expectedVotePending:!0,votePending:!1})}}async function sO({state:n,api:e,data:t,dispatchAction:o}){if(yl(n.comments,t.id)?.votePending)return{};o("updateCommentLikeState",{id:t.id,liked:!1,votePending:!0});try{return await e.comments.unlike({comment:t}),o("updateCommentVotePendingState",{id:t.id,votePending:!1,expectedVotePending:!0}),{}}catch{o("updateCommentLikeState",{id:t.id,liked:!0,expectedLiked:!1,expectedDisliked:!1,expectedVotePending:!0,votePending:!1})}}async function aO({state:n,api:e,data:t,dispatchAction:o}){const r=yl(n.comments,t.id);if(r?.votePending)return{};const s=r?.liked??!1;o("updateCommentDislikeState",{id:t.id,disliked:!0,wasLiked:s,votePending:!0});try{return await e.comments.dislike({comment:t}),o("updateCommentVotePendingState",{id:t.id,votePending:!1,expectedVotePending:!0}),{}}catch{o("updateCommentDislikeState",{id:t.id,disliked:!1,restoreLiked:s,expectedDisliked:!0,expectedVotePending:!0,votePending:!1})}}async function lO({state:n,api:e,data:t,dispatchAction:o}){if(yl(n.comments,t.id)?.votePending)return{};o("updateCommentDislikeState",{id:t.id,disliked:!1,votePending:!0});try{return await e.comments.undislike({comment:t}),o("updateCommentVotePendingState",{id:t.id,votePending:!1,expectedVotePending:!0}),{}}catch{o("updateCommentDislikeState",{id:t.id,disliked:!0,expectedDisliked:!1,expectedLiked:!1,expectedVotePending:!0,votePending:!1})}}async function cO({api:n,data:e}){return await n.comments.report({comment:e}),{}}function tk(n,e){return n.some(t=>t.in_reply_to_id===e)}function uO(n,e){return n.status==="deleted"||!e&&n.status==="hidden"}function dO(n,e){let t=n,o=!1;do o=!1,t=t.filter(r=>!uO(r,e)||tk(t,r.id)?!0:(o=!0,!1));while(o);return t}function nk(n){return Math.max((n||0)-1,0)}async function mO({state:n,api:e,data:t,dispatchAction:o}){await e.comments.edit({comment:{id:t.id,status:"deleted"}});const r=n.comments.find(s=>s.id===t.id);return r&&(!r.replies||r.replies.length===0)?(o("setOrder",{order:n.order}),null):{comments:n.comments.map(s=>{if(s.id===t.id)return s.replies.length>0?{...s,status:"deleted"}:null;const l=s.replies.length,c=s.replies.find(b=>b.id===t.id),d=c?tk(s.replies,c.id):!1,m=s.replies.reduce((b,k)=>k.id!==t.id?(b.push(k),b):(d&&b.push({...k,status:"deleted",html:null}),b),[]),f=dO(m,n.isAdmin),h=l!==f.length||d,g={...s,replies:f};if(h&&c&&!["hidden","deleted"].includes(c.status)){const b=!c.in_reply_to_id||c.in_reply_to_id===s.id;g.count={...g.count,replies:nk(g.count?.replies),direct_replies:b?nk(g.count?.direct_replies):g.count?.direct_replies}}return g}).filter(Boolean),commentCount:n.commentCount-1}}async function fO({state:n,api:e,data:{comment:t,parent:o}}){return t=(await e.comments.edit({comment:t})).comments[0],{comments:n.comments.map(s=>o&&o.id===s.id?{...s,replies:s.replies.map(l=>l.id===t.id?t:l)}:s.id===t.id?t:s)}}async function pO({data:n,state:e,api:t}){const{name:o,expertise:r}=n,s={},l=e?.member?.name;o&&l!==o&&(s.name=o);const c=e?.member?.expertise;if(r!==void 0&&c!==r&&(s.expertise=r),Object.keys(s).length>0)try{const d=await t.member.update(s);if(!d)throw new Error("Failed to update member");return{member:d,success:!0}}catch(d){return{success:!1,error:d}}return null}function hO({data:n}){return{popup:n}}function gO(){return{popup:null}}function yO({data:n,state:e}){const t=e.openCommentForms.filter(r=>r.hasUnsavedChanges),o=t.findIndex(r=>r.id===n.id);return o>-1?(t[o]=n,{openCommentForms:t}):{openCommentForms:[...t,n]}}function bO({data:n}){return{commentIdToHighlight:n}}function kO({data:{commentId:n},dispatchAction:e}){return setTimeout(()=>{e("setHighlightComment",null)},3e3),{commentIdToHighlight:n}}function vO({data:{id:n,hasUnsavedChanges:e},state:t}){return{openCommentForms:t.openCommentForms.map(r=>r.id===n?{...r,hasUnsavedChanges:e}:{...r})}}function wO({data:n,state:e}){return{openCommentForms:e.openCommentForms.filter(t=>t.id!==n)}}function $O({data:n}){return{commentIdToScrollTo:n}}function xO({data:n}){return{commentIdFromHash:n}}const ok={openPopup:hO,closePopup:gO,closeCommentForm:wO,setCommentFormHasUnsavedChanges:vO,setScrollTarget:$O,setHashCommentId:xO},SO={addComment:GA,editComment:fO,hideComment:XA,pinComment:eO,unpinComment:tO,deleteComment:mO,showComment:ZA,likeComment:iO,unlikeComment:sO,dislikeComment:aO,undislikeComment:lO,reportComment:cO,addReply:QA,loadMoreComments:JA,openCommentForm:yO,updateMember:pO,setOrder:KA,highlightComment:kO,setHighlightComment:bO,setCommentsIsLoading:WA,updateCommentLikeState:nO,updateCommentDislikeState:oO,updateCommentVotePendingState:rO};function CO(n){return Object.prototype.hasOwnProperty.call(ok,n)}async function EO({action:n,data:e,state:t,api:o,adminApi:r,options:s,dispatchAction:l}){const c=SO[n];return c?await c({data:e,state:t,api:o,adminApi:r,options:s,dispatchAction:l})||{}:{}}function RO({action:n,data:e,state:t,api:o,adminApi:r,options:s}){const l=ok[n];return l?l({data:e,state:t,api:o,adminApi:r,options:s})||{}:{}}function NO({adminUrl:n}){const e=document.querySelector('iframe[data-frame="admin-auth"]');let t=1;const o={},r=new URL(n).origin;let s=null;window.addEventListener("message",function(d){if(d.origin!==r)return;let m=null;try{m=JSON.parse(d.data)}catch{return}const f=o[m.uid];f&&(delete o[m.uid],f(m.error,m.result))});function l(d,m){return new Promise((f,h)=>{function g(b,k){return b?h(b):f(k)}t+=1,o[t]=g,e.contentWindow.postMessage(JSON.stringify({uid:t,action:d,...m}),r)})}return{async getUser(){const d=await l("getUser");return!d||!d.users?null:d.users[0]},async hideComment(d){return await l("hideComment",{id:d})},async showComment({id:d}){return await l("showComment",{id:d})},async pinComment({id:d}){return await l("pinComment",{id:d})},async unpinComment({id:d}){return await l("unpinComment",{id:d})},async browse({page:d,postId:m,order:f,memberUuid:h}){let g=null;s&&!f&&(g=`created_at:<=${s}`);const b=new URLSearchParams;b.set("limit","20"),g&&b.set("filter",g),b.set("page",d.toString()),f&&b.set("order",f),h&&b.set("impersonate_member_uuid",h);const k=await l("browseComments",{postId:m,params:b.toString()});if(!s){const S=k.comments[0];S&&(s=S.created_at)}return k},async replies({commentId:d,afterReplyId:m,limit:f,memberUuid:h}){const g=new URLSearchParams;return f&&g.set("limit",f.toString()),m&&g.set("filter",`id:>'${m}'`),h&&g.set("impersonate_member_uuid",h),await l("getReplies",{commentId:d,params:g.toString()})},async read({commentId:d,memberUuid:m}){const f=new URLSearchParams;return m&&f.set("impersonate_member_uuid",m),await l("readComment",{commentId:d,...f.toString()&&{params:f.toString()}})}}}function DO(n){const e=Ee.useCallback(()=>{const s=n.dataset,l=s.ghostComments||window.location.origin,c=s.key,d=s.api,m=s.admin,f=s.postId||"",h=s.colorScheme,g=s.avatarSaturation?parseInt(s.avatarSaturation):void 0,b=s.accentColor??"#000000",k=s.commentsEnabled,S=s.title==="null"?null:s.title??"",R=s.count==="true",O=s.publication??"";return{locale:s.locale??"en",siteUrl:l,apiKey:c,apiUrl:d,postId:f,adminUrl:m,colorScheme:h,avatarSaturation:g,accentColor:b,commentsEnabled:k,title:S,showCount:R,publication:O}},[n]),t=P.useMemo(()=>e(),[]),[o,r]=Ee.useState(t);return Ee.useEffect(()=>{const s=new MutationObserver(l=>{l.some(c=>c.type==="attributes")&&r(e())});return s.observe(n,{attributes:!0}),()=>{s.disconnect()}},[n,e]),o}const AO=["Owner","Administrator","Super Editor"],Nm="count__net_score desc, created_at desc";function Dm(n,e){return n.some(t=>t.id===e||t.replies?.some(o=>o.id===e))}const OO=({scriptTag:n,initialCommentId:e})=>{const t=DO(n),[o,r]=P.useState({initStatus:"running",member:null,admin:null,comments:[],pagination:null,commentCount:0,openCommentForms:[],popup:null,labs:{},order:Nm,adminApi:null,commentsIsLoading:!1,commentIdToHighlight:null,commentIdToScrollTo:e,commentIdFromHash:e,showMissingCommentNotice:!1,supportEmail:null,isMember:!1,isAdmin:!1,isPaidOnly:!1,hasRequiredTier:!0,isCommentingDisabled:!1}),s=Ee.createRef(),l=Ee.useMemo(()=>qA({siteUrl:t.siteUrl,apiUrl:t.apiUrl,apiKey:t.apiKey}),[t]),c=P.useCallback(U=>{r(_=>(typeof U=="function"&&(U=U(_)),{..._,...U}))},[r]),d=P.useCallback(async(U,_)=>{if(CO(U)){c(Q=>RO({action:U,data:_,state:Q,api:l,adminApi:Q.adminApi,options:t}));return}return new Promise(Q=>{c(oe=>(EO({action:U,data:_,state:oe,api:l,adminApi:oe.adminApi,options:t,dispatchAction:d}).then(Z=>{const Y={...Z};Q(Y),c(Y)}).catch(console.error),{}))})},[l,t]),m=P.useMemo(()=>YA(t.locale,"comments"),[t.locale]),f={...t,...o,t:m.t,dispatchAction:d,openFormCount:P.useMemo(()=>o.openCommentForms.length,[o.openCommentForms])},h=async()=>{if(!(o.adminApi||!t.adminUrl))try{const U=NO({adminUrl:t.adminUrl});let _=null;try{if(_=await U.getUser(),(!_||!_.roles.some(Q=>AO.includes(Q.name)))&&(_=null),_){const Q=await U.browse({page:1,postId:t.postId,order:o.order,memberUuid:o.member?.uuid});c(oe=>oe.pagination&&oe.pagination.page>1||e?{adminApi:U,admin:_,isAdmin:!0}:{adminApi:U,admin:_,isAdmin:!0,comments:Q.comments,pagination:Q.meta.pagination})}}catch(Q){console.warn("[Comments] Failed to fetch admin endpoint:",Q)}c({adminApi:U,admin:_,isAdmin:!!_})}catch(U){console.error("[Comments] Failed to initialize admin authentication:",U)}},g=async(U=o.order)=>{const _=l.comments.browse({page:1,postId:t.postId,order:U}),Q=l.comments.count({postId:t.postId}),[oe,Z]=await Promise.all([_,Q]);return{comments:oe.comments,pagination:oe.meta.pagination,count:Z}},b=async U=>{try{const Q=(await l.comments.read(U)).comments?.[0];return Q&&Q.status==="published"?Q:null}catch{return null}},k=async(U,_,Q,oe,Z=o.order)=>{let Y=Q,ae=oe;for(;!Dm(Y,U)&&ae.page<ae.pages&&!(_&&Y.some(B=>B.id===_));){const pe=await l.comments.browse({page:ae.page+1,postId:t.postId,order:Z});Y=[...Y,...pe.comments],ae=pe.meta.pagination}return{comments:Y,pagination:ae}},S=async(U,_,Q,oe,Z=o.order)=>{const Y=_.parent_id,{comments:ae,pagination:pe}=await k(U,Y,Q,oe,Z);let B=ae;if(Y&&!Dm(B,U)){const{comments:V}=await l.comments.replies({commentId:Y,limit:"all"});B=B.map(X=>X.id===Y?{...X,replies:V}:X)}return{comments:B,pagination:pe,found:Dm(B,U)}},R=async()=>{try{const{member:U,labs:_,supportEmail:Q}=await l.init(),{count:oe,comments:Z,pagination:Y}=await g(Nm),ae=Nm;let pe=Z,B=Y,V=!1;if(e&&B){const N=await b(e);if(N){const L=await S(e,N,pe,B,ae);pe=L.comments,B=L.pagination,V=L.found}}const me=!!U,he=t.commentsEnabled==="paid",Le=!!U?.paid||!he;c({member:U,initStatus:"success",comments:pe,pagination:B,commentCount:oe,order:ae,labs:_,commentsIsLoading:!1,commentIdToHighlight:null,commentIdToScrollTo:V?e:null,commentIdFromHash:V?e:null,showMissingCommentNotice:!!e&&!V,supportEmail:Q,isMember:me,isPaidOnly:he,hasRequiredTier:Le,isCommentingDisabled:U?.can_comment===!1})}catch(U){console.error("[Comments] Failed to initialize:",U),c({initStatus:"failed"})}};P.useEffect(()=>{if(e){R();return}const U=new IntersectionObserver(_=>{_.forEach(Q=>{Q.isIntersecting&&(R(),s.current&&U.unobserve(s.current))})},{root:null,rootMargin:"0px",threshold:.1});return s.current&&U.observe(s.current),()=>{s.current&&U.unobserve(s.current)}},[s.current,e]);const O=o.initStatus==="success";return x.jsxs($c.Provider,{value:f,children:[x.jsx(jN,{ref:s,children:x.jsx(DN,{done:O})}),O&&t.adminUrl&&x.jsx(Ew,{adminUrl:t.adminUrl,onLoad:h}),x.jsx(UN,{})]})};function TO(){let n=document.currentScript;if(!n)throw new Error("[Comments-UI] Cannot find current script tag");return n}function PO(n){if(n.previousElementSibling&&n.previousElementSibling.id===Dr)return n.previousElementSibling;if(!n.parentElement)throw new Error("[Comments-UI] Script tag does not have a parent element");const e=document.createElement("div");return e.id=Dr,n.parentElement.insertBefore(e,n),e}function jO(){const n=new URL(window.location.href);n.searchParams.get("token")&&(n.searchParams.delete("token"),window.history.replaceState({},document.title,n.href))}function MO(){const n=TO(),e=PO(n),t=wc(window.location.hash);try{jO(),Sy.render(x.jsx(Ee.StrictMode,{children:x.jsx(OO,{initialCommentId:t,scriptTag:n})}),e)}catch(o){console.error(o)}}MO()}));
119
- //# sourceMappingURL=comments-ui.min.js.map