@tryghost/sodo-search 1.8.24 → 1.8.25

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/sodo-search",
3
3
  "type": "module",
4
- "version": "1.8.24",
4
+ "version": "1.8.25",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -70,7 +70,7 @@
70
70
  "scripts": {
71
71
  "dev": "pnpm build && concurrently --kill-others --names preview,build,tailwind \"vite preview -l silent\" \"pnpm build:watch\" \"pnpm tailwind\"",
72
72
  "build": "vite build && pnpm tailwind:base",
73
- "build:watch": "vite build --watch",
73
+ "build:watch": "vite build --watch --mode development",
74
74
  "tailwind": "pnpm tailwind:base --watch ",
75
75
  "tailwind:base": "tailwindcss -i ./src/index.css -o ./umd/main.css --minify",
76
76
  "test": "vitest run",
@@ -26,5 +26,5 @@ Add a <Suspense fallback=...> component higher in the tree to provide a loading
26
26
  `)+" "+S.join(`,
27
27
  `)+" "+W[1]:W[0]+O+" "+S.join(", ")+" "+W[1]}function z(S){return Array.isArray(S)}r.isArray=z;function _(S){return typeof S=="boolean"}r.isBoolean=_;function R(S){return S===null}r.isNull=R;function q(S){return S==null}r.isNullOrUndefined=q;function Q(S){return typeof S=="number"}r.isNumber=Q;function ue(S){return typeof S=="string"}r.isString=ue;function pe(S){return typeof S=="symbol"}r.isSymbol=pe;function ce(S){return S===void 0}r.isUndefined=ce;function ae(S){return ne(S)&&K(S)==="[object RegExp]"}r.isRegExp=ae;function ne(S){return typeof S=="object"&&S!==null}r.isObject=ne;function re(S){return ne(S)&&K(S)==="[object Date]"}r.isDate=re;function fe(S){return ne(S)&&(K(S)==="[object Error]"||S instanceof Error)}r.isError=fe;function b(S){return typeof S=="function"}r.isFunction=b;function M(S){return S===null||typeof S=="boolean"||typeof S=="number"||typeof S=="string"||typeof S=="symbol"||typeof S>"u"}r.isPrimitive=M,r.isBuffer=Lg();function K(S){return Object.prototype.toString.call(S)}function se(S){return S<10?"0"+S.toString(10):S.toString(10)}var he=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Se(){var S=new Date,O=[se(S.getHours()),se(S.getMinutes()),se(S.getSeconds())].join(":");return[S.getDate(),he[S.getMonth()],O].join(" ")}r.log=function(){console.log("%s - %s",Se(),r.format.apply(r,arguments))},r.inherits=bg(),r._extend=function(S,O){if(!O||!ne(O))return S;for(var W=Object.keys(O),ge=W.length;ge--;)S[W[ge]]=O[W[ge]];return S};function Te(S,O){return Object.prototype.hasOwnProperty.call(S,O)}})(Xi)),Xi}var gc;function Fg(){if(gc)return ui.exports;gc=1;var r=_g()();function s(b,M){if(b===M)return 0;for(var K=b.length,se=M.length,he=0,Se=Math.min(K,se);he<Se;++he)if(b[he]!==M[he]){K=b[he],se=M[he];break}return K<se?-1:se<K?1:0}function i(b){return Er.Buffer&&typeof Er.Buffer.isBuffer=="function"?Er.Buffer.isBuffer(b):!!(b!=null&&b._isBuffer)}var l=Ig(),a=Object.prototype.hasOwnProperty,h=Array.prototype.slice,p=(function(){return(function(){}).name==="foo"})();function v(b){return Object.prototype.toString.call(b)}function g(b){return i(b)||typeof Er.ArrayBuffer!="function"?!1:typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(b):b?!!(b instanceof DataView||b.buffer&&b.buffer instanceof ArrayBuffer):!1}var w=ui.exports=R,k=/\s*function\s+([^\(\s]*)\s*/;function $(b){if(l.isFunction(b)){if(p)return b.name;var M=b.toString(),K=M.match(k);return K&&K[1]}}w.AssertionError=function(M){this.name="AssertionError",this.actual=M.actual,this.expected=M.expected,this.operator=M.operator,M.message?(this.message=M.message,this.generatedMessage=!1):(this.message=z(this),this.generatedMessage=!0);var K=M.stackStartFunction||_;if(Error.captureStackTrace)Error.captureStackTrace(this,K);else{var se=new Error;if(se.stack){var he=se.stack,Se=$(K),Te=he.indexOf(`
28
28
  `+Se);if(Te>=0){var S=he.indexOf(`
29
- `,Te+1);he=he.substring(S+1)}this.stack=he}}},l.inherits(w.AssertionError,Error);function j(b,M){return typeof b=="string"?b.length<M?b:b.slice(0,M):b}function A(b){if(p||!l.isFunction(b))return l.inspect(b);var M=$(b),K=M?": "+M:"";return"[Function"+K+"]"}function z(b){return j(A(b.actual),128)+" "+b.operator+" "+j(A(b.expected),128)}function _(b,M,K,se,he){throw new w.AssertionError({message:K,actual:b,expected:M,operator:se,stackStartFunction:he})}w.fail=_;function R(b,M){b||_(b,!0,M,"==",w.ok)}w.ok=R,w.equal=function(M,K,se){M!=K&&_(M,K,se,"==",w.equal)},w.notEqual=function(M,K,se){M==K&&_(M,K,se,"!=",w.notEqual)},w.deepEqual=function(M,K,se){q(M,K,!1)||_(M,K,se,"deepEqual",w.deepEqual)},w.deepStrictEqual=function(M,K,se){q(M,K,!0)||_(M,K,se,"deepStrictEqual",w.deepStrictEqual)};function q(b,M,K,se){if(b===M)return!0;if(i(b)&&i(M))return s(b,M)===0;if(l.isDate(b)&&l.isDate(M))return b.getTime()===M.getTime();if(l.isRegExp(b)&&l.isRegExp(M))return b.source===M.source&&b.global===M.global&&b.multiline===M.multiline&&b.lastIndex===M.lastIndex&&b.ignoreCase===M.ignoreCase;if((b===null||typeof b!="object")&&(M===null||typeof M!="object"))return K?b===M:b==M;if(g(b)&&g(M)&&v(b)===v(M)&&!(b instanceof Float32Array||b instanceof Float64Array))return s(new Uint8Array(b.buffer),new Uint8Array(M.buffer))===0;if(i(b)!==i(M))return!1;se=se||{actual:[],expected:[]};var he=se.actual.indexOf(b);return he!==-1&&he===se.expected.indexOf(M)?!0:(se.actual.push(b),se.expected.push(M),ue(b,M,K,se))}function Q(b){return Object.prototype.toString.call(b)=="[object Arguments]"}function ue(b,M,K,se){if(b==null||M===null||M===void 0)return!1;if(l.isPrimitive(b)||l.isPrimitive(M))return b===M;if(K&&Object.getPrototypeOf(b)!==Object.getPrototypeOf(M))return!1;var he=Q(b),Se=Q(M);if(he&&!Se||!he&&Se)return!1;if(he)return b=h.call(b),M=h.call(M),q(b,M,K);var Te=fe(b),S=fe(M),O,W;if(Te.length!==S.length)return!1;for(Te.sort(),S.sort(),W=Te.length-1;W>=0;W--)if(Te[W]!==S[W])return!1;for(W=Te.length-1;W>=0;W--)if(O=Te[W],!q(b[O],M[O],K,se))return!1;return!0}w.notDeepEqual=function(M,K,se){q(M,K,!1)&&_(M,K,se,"notDeepEqual",w.notDeepEqual)},w.notDeepStrictEqual=pe;function pe(b,M,K){q(b,M,!0)&&_(b,M,K,"notDeepStrictEqual",pe)}w.strictEqual=function(M,K,se){M!==K&&_(M,K,se,"===",w.strictEqual)},w.notStrictEqual=function(M,K,se){M===K&&_(M,K,se,"!==",w.notStrictEqual)};function ce(b,M){if(!b||!M)return!1;if(Object.prototype.toString.call(M)=="[object RegExp]")return M.test(b);try{if(b instanceof M)return!0}catch{}return Error.isPrototypeOf(M)?!1:M.call({},b)===!0}function ae(b){var M;try{b()}catch(K){M=K}return M}function ne(b,M,K,se){var he;if(typeof M!="function")throw new TypeError('"block" argument must be a function');typeof K=="string"&&(se=K,K=null),he=ae(M),se=(K&&K.name?" ("+K.name+").":".")+(se?" "+se:"."),b&&!he&&_(he,K,"Missing expected exception"+se);var Se=typeof se=="string",Te=!b&&l.isError(he),S=!b&&he&&!K;if((Te&&Se&&ce(he,K)||S)&&_(he,K,"Got unwanted exception"+se),b&&he&&K&&!ce(he,K)||!b&&he)throw he}w.throws=function(b,M,K){ne(!0,b,M,K)},w.doesNotThrow=function(b,M,K){ne(!1,b,M,K)},w.ifError=function(b){if(b)throw b};function re(b,M){b||_(b,!0,M,"==",re)}w.strict=r(re,w,{equal:w.strictEqual,deepEqual:w.deepStrictEqual,notEqual:w.notStrictEqual,notDeepEqual:w.notDeepStrictEqual}),w.strict.strict=w.strict;var fe=Object.keys||function(b){var M=[];for(var K in b)a.call(b,K)&&M.push(K);return M};return ui.exports}var el,mc;function Mg(){if(mc)return el;mc=1;var r=Fg();return el=function(s){var i,l,a,h,p;for(i=Error.prepareStackTrace,Error.prepareStackTrace=function(v,g){return Error.prepareStackTrace=i,g},l=new Error().stack,p=0;p<l.length&&l[p].getFileName()!==__filename;)p++;r(p<l.length,"Unexpected: unable to find caller/index.js in the stack"),s=!s||isNaN(s)?1:s>l.length-2?l.length-2:s,l=l.slice(p+s+1);do h=l.shift(),a=h&&h.getFileName();while(l.length&&a==="module.js");return a},el}var yc;function zg(){if(yc)return _s;yc=1;const r=Zn,s=Zn,i=sg(),l=Mg();return _s.getCallerRoot=function(){try{return i(l(2))}catch{return}},_s.getProcessRoot=function(){let h=process.cwd();const p=s.join(h,"current");try{r.statSync(p).isDirectory()&&(h=p)}catch{}try{return i(h)}catch{return}},_s}var tl,vc;function Dg(){return vc||(vc=1,tl=zg()),tl}var Is={exports:{}},nl,wc;function Ug(){if(wc)return nl;wc=1;var r=1e3,s=r*60,i=s*60,l=i*24,a=l*7,h=l*365.25;nl=function(k,$){$=$||{};var j=typeof k;if(j==="string"&&k.length>0)return p(k);if(j==="number"&&isFinite(k))return $.long?g(k):v(k);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(k))};function p(k){if(k=String(k),!(k.length>100)){var $=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(k);if($){var j=parseFloat($[1]),A=($[2]||"ms").toLowerCase();switch(A){case"years":case"year":case"yrs":case"yr":case"y":return j*h;case"weeks":case"week":case"w":return j*a;case"days":case"day":case"d":return j*l;case"hours":case"hour":case"hrs":case"hr":case"h":return j*i;case"minutes":case"minute":case"mins":case"min":case"m":return j*s;case"seconds":case"second":case"secs":case"sec":case"s":return j*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return j;default:return}}}}function v(k){var $=Math.abs(k);return $>=l?Math.round(k/l)+"d":$>=i?Math.round(k/i)+"h":$>=s?Math.round(k/s)+"m":$>=r?Math.round(k/r)+"s":k+"ms"}function g(k){var $=Math.abs(k);return $>=l?w(k,$,l,"day"):$>=i?w(k,$,i,"hour"):$>=s?w(k,$,s,"minute"):$>=r?w(k,$,r,"second"):k+" ms"}function w(k,$,j,A){var z=$>=j*1.5;return Math.round(k/j)+" "+A+(z?"s":"")}return nl}var rl,Sc;function Bg(){if(Sc)return rl;Sc=1;function r(s){l.debug=l,l.default=l,l.coerce=w,l.disable=v,l.enable=h,l.enabled=g,l.humanize=Ug(),l.destroy=k,Object.keys(s).forEach($=>{l[$]=s[$]}),l.names=[],l.skips=[],l.formatters={};function i($){let j=0;for(let A=0;A<$.length;A++)j=(j<<5)-j+$.charCodeAt(A),j|=0;return l.colors[Math.abs(j)%l.colors.length]}l.selectColor=i;function l($){let j,A=null,z,_;function R(...q){if(!R.enabled)return;const Q=R,ue=Number(new Date),pe=ue-(j||ue);Q.diff=pe,Q.prev=j,Q.curr=ue,j=ue,q[0]=l.coerce(q[0]),typeof q[0]!="string"&&q.unshift("%O");let ce=0;q[0]=q[0].replace(/%([a-zA-Z%])/g,(ne,re)=>{if(ne==="%%")return"%";ce++;const fe=l.formatters[re];if(typeof fe=="function"){const b=q[ce];ne=fe.call(Q,b),q.splice(ce,1),ce--}return ne}),l.formatArgs.call(Q,q),(Q.log||l.log).apply(Q,q)}return R.namespace=$,R.useColors=l.useColors(),R.color=l.selectColor($),R.extend=a,R.destroy=l.destroy,Object.defineProperty(R,"enabled",{enumerable:!0,configurable:!1,get:()=>A!==null?A:(z!==l.namespaces&&(z=l.namespaces,_=l.enabled($)),_),set:q=>{A=q}}),typeof l.init=="function"&&l.init(R),R}function a($,j){const A=l(this.namespace+(typeof j>"u"?":":j)+$);return A.log=this.log,A}function h($){l.save($),l.namespaces=$,l.names=[],l.skips=[];const j=(typeof $=="string"?$:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const A of j)A[0]==="-"?l.skips.push(A.slice(1)):l.names.push(A)}function p($,j){let A=0,z=0,_=-1,R=0;for(;A<$.length;)if(z<j.length&&(j[z]===$[A]||j[z]==="*"))j[z]==="*"?(_=z,R=A,z++):(A++,z++);else if(_!==-1)z=_+1,R++,A=R;else return!1;for(;z<j.length&&j[z]==="*";)z++;return z===j.length}function v(){const $=[...l.names,...l.skips.map(j=>"-"+j)].join(",");return l.enable(""),$}function g($){for(const j of l.skips)if(p($,j))return!1;for(const j of l.names)if(p($,j))return!0;return!1}function w($){return $ instanceof Error?$.stack||$.message:$}function k(){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 l.enable(l.load()),l}return rl=r,rl}var xc;function Vg(){return xc||(xc=1,(function(r,s){s.formatArgs=l,s.save=a,s.load=h,s.useColors=i,s.storage=p(),s.destroy=(()=>{let g=!1;return()=>{g||(g=!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`."))}})(),s.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 i(){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 g;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&&(g=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(g[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function l(g){if(g[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+g[0]+(this.useColors?"%c ":" ")+"+"+r.exports.humanize(this.diff),!this.useColors)return;const w="color: "+this.color;g.splice(1,0,w,"color: inherit");let k=0,$=0;g[0].replace(/%[a-zA-Z%]/g,j=>{j!=="%%"&&(k++,j==="%c"&&($=k))}),g.splice($,0,w)}s.log=console.debug||console.log||(()=>{});function a(g){try{g?s.storage.setItem("debug",g):s.storage.removeItem("debug")}catch{}}function h(){let g;try{g=s.storage.getItem("debug")||s.storage.getItem("DEBUG")}catch{}return!g&&typeof process<"u"&&"env"in process&&(g=process.env.DEBUG),g}function p(){try{return localStorage}catch{}}r.exports=Bg()(s);const{formatters:v}=r.exports;v.j=function(g){try{return JSON.stringify(g)}catch(w){return"[UnexpectedJSONParseError]: "+w.message}}})(Is,Is.exports)),Is.exports}var Cc;function Hg(){if(Cc)return Rs.exports;Cc=1;const r=Dg(),s=Vg();return Rs.exports=function(l){const a=r.getCallerRoot();let h;try{const p=Nn("/node_modules/.pnpm/@tryghost+debug@2.2.3/node_modules/@tryghost/debug/lib")(a+"/package.json");p.alias?h=p.alias:h=p.name}catch{h="undefined"}return s(h+":"+l)},Rs.exports._base=s,Rs.exports}var sl,kc;function qg(){return kc||(kc=1,sl=Hg()),sl}const Wg=[{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 Pc;function Kg(){if(Pc)return Xn.exports;Pc=1;const r=rg(),s=Zn,i=Zn,l=qg()("i18n"),a=Wg,h=a.map(g=>g.code);function p(g,w){return g.reduce((k,$)=>{let j;try{j=Nn("/ghost/i18n/lib")(`../locales/${$}/${w}.json`)}catch{j=Nn("/ghost/i18n/lib")(`../locales/en/${w}.json`)}return k[$]={[w]:{...j,...j.default&&typeof j.default=="object"?j.default:{}}},k},{})}function v(g,w){if(!w)return{[g]:{theme:{}}};let k=[];try{k=i.readdirSync(w).filter(A=>A.endsWith(".json")).map(A=>A.replace(".json",""))}catch{k=[g,"en"]}return[...new Set([g,...k,"en"])].reduce((j,A)=>{let z,_=!1;const R=s.join(w,`${A}.json`);if(i.existsSync(R))try{delete require.cache[Nn("/ghost/i18n/lib").resolve(R)],z=Nn("/ghost/i18n/lib")(R)}catch{l(`Error loading theme locale file: ${A}`),_=!0}else _=!0;if(_)if(A!=="en")try{const q=s.join(w,"en.json");i.existsSync(q)?(delete require.cache[Nn("/ghost/i18n/lib").resolve(q)],z=Nn("/ghost/i18n/lib")(q)):z={}}catch{z={}}else l("Theme en.json file not found"),z={};return j[A]={theme:{...z,...z.default&&typeof z.default=="object"?z.default:{}}},j},{})}return Xn.exports=(g="en",w="portal",k={})=>{const $=r.createInstance(),j={prefix:"{",suffix:"}"};(w==="theme"||w==="portal")&&(j.escapeValue=!1);let A;return w!=="theme"?A=p(h,w):(l(`generateThemeResources: ${g}, ${k.themePath}`),A=v(g,k.themePath)),$.init({lng:g,nsSeparator:!1,keySeparator:!1,returnEmptyString:!1,fallbackLng:{no:["nb","en"],default:["en"]},ns:w,defaultNS:w,interpolation:j,resources:A}),$},Xn.exports.SUPPORTED_LOCALES=h,Xn.exports.LOCALE_DATA=a,Xn.exports.generateResources=p,Xn.exports}var $c;function Gg(){if($c)return On.exports;$c=1;const r=Kg();return On.exports=r,On.exports.default=r,On.exports.LOCALE_DATA=r.LOCALE_DATA,On.exports.SUPPORTED_LOCALES=r.SUPPORTED_LOCALES,On.exports.generateResources=r.generateResources,On.exports}var Qg=Gg();const Jg=Io(Qg);class Yg extends en.Component{constructor(s){super(s);const i=this.props.locale||"en",l=Jg(i,"search"),a=l.dir()||"ltr",h=new Kd({adminUrl:s.adminUrl,apiKey:s.apiKey,dir:a});this.state={searchIndex:h,showPopup:!1,indexStarted:!1,indexComplete:!1,t:l.t,dir:a,scrollbarWidth:0},this.inputRef=en.createRef()}componentDidMount(){const s=this.getScrollbarWidth();this.setState({scrollbarWidth:s}),this.initSetup()}componentDidUpdate(s,i){if(i.showPopup!==this.state.showPopup)try{this.state.showPopup?(this.bodyScroll=window.document?.body?.style?.overflow,this.bodyMargin=window.getComputedStyle(document.body).getPropertyValue("margin-right"),window.document.body.style.overflow="hidden",this.state.scrollbarWidth&&document.body.scrollHeight>window.innerHeight&&(window.document.body.style.marginRight=`calc(${this.bodyMargin} + ${this.state.scrollbarWidth}px)`)):(window.document.body.style.overflow=this.bodyScroll||"",!this.bodyMargin||this.bodyMargin==="0px"?window.document.body.style.marginRight="":window.document.body.style.marginRight=this.bodyMargin)}catch{}this.state.showPopup!==i?.showPopup&&!this.state.showPopup&&this.setState({searchValue:""}),this.state.showPopup&&!this.state.indexStarted&&this.setupSearchIndex()}async setupSearchIndex(){this.setState({indexStarted:!0}),await this.state.searchIndex.init(),this.setState({indexComplete:!0})}componentWillUnmount(){window.removeEventListener("hashchange",this.hashHandler,!1),window.removeEventListener("keydown",this.handleKeyDown,!1)}initSetup(){this.handleSearchUrl(),this.addKeyboardShortcuts(),this.setupCustomTriggerButton(),this.hashHandler=()=>{this.handleSearchUrl()},window.addEventListener("hashchange",this.hashHandler,!1)}getScrollbarWidth(){const s=document.createElement("div");s.style.visibility="hidden",s.style.overflow="scroll",document.body.appendChild(s);const i=s.offsetWidth-s.clientWidth;return document.body.removeChild(s),i}setupCustomTriggerButton(){this.clickHandler=s=>{s.preventDefault(),this.setState({showPopup:!0});const i=document.createElement("input");i.style.opacity="0",i.style.position="fixed",i.style.top="0",document.body.appendChild(i),i.focus(),setTimeout(()=>{this.inputRef.current.focus(),document.body.removeChild(i)},150)},this.customTriggerButtons=this.getCustomTriggerButtons(),this.customTriggerButtons.forEach(s=>{s.removeEventListener("click",this.clickHandler),s.addEventListener("click",this.clickHandler)})}getCustomTriggerButtons(){return document.querySelectorAll("[data-ghost-search]")||[]}handleSearchUrl(){const[s]=window.location.hash.substr(1).split("?");(s==="/search"||s==="/search/")&&(this.setState({showPopup:!0}),window.history.replaceState("",document.title,window.location.pathname))}addKeyboardShortcuts(){this.getCustomTriggerButtons()?.length&&(this.handleKeyDown=i=>{if(i.key==="k"&&i.metaKey)return this.setState({showPopup:!0}),i.preventDefault(),i.stopPropagation(),!1},document.addEventListener("keydown",this.handleKeyDown))}render(){return le.jsx(ut.Provider,{value:{page:"search",showPopup:this.state.showPopup,adminUrl:this.props.adminUrl,stylesUrl:this.props.stylesUrl,searchIndex:this.state.searchIndex,indexComplete:this.state.indexComplete,searchValue:this.state.searchValue,inputRef:this.inputRef,onAction:()=>{},dispatch:(s,i)=>{s==="update"&&this.setState({...this.state,...i})},t:this.state.t,dir:this.state.dir},children:le.jsx($d,{})})}}const Ec="sodo-search-root";function Xg(){const r=document.createElement("div");r.id=Ec,document.body.appendChild(r)}function Zg(){const r=document.querySelector("script[data-sodo-search]");if(r){const s=r.dataset.sodoSearch,i=r.dataset.key,l=r.dataset.styles,a=r.dataset.locale||"en";return{adminUrl:s,apiKey:i,stylesUrl:l,locale:a}}return{}}function em(){Xg()}function tm(){const{adminUrl:r,apiKey:s,stylesUrl:i,locale:l}=Zg(),a=(r||window.location.origin)?.replace(/\/+$/,"");em(),Zh.render(le.jsx(en.StrictMode,{children:le.jsx(Yg,{adminUrl:a,apiKey:s,stylesUrl:i,locale:l})}),document.getElementById(Ec))}tm()}));
29
+ `,Te+1);he=he.substring(S+1)}this.stack=he}}},l.inherits(w.AssertionError,Error);function j(b,M){return typeof b=="string"?b.length<M?b:b.slice(0,M):b}function A(b){if(p||!l.isFunction(b))return l.inspect(b);var M=$(b),K=M?": "+M:"";return"[Function"+K+"]"}function z(b){return j(A(b.actual),128)+" "+b.operator+" "+j(A(b.expected),128)}function _(b,M,K,se,he){throw new w.AssertionError({message:K,actual:b,expected:M,operator:se,stackStartFunction:he})}w.fail=_;function R(b,M){b||_(b,!0,M,"==",w.ok)}w.ok=R,w.equal=function(M,K,se){M!=K&&_(M,K,se,"==",w.equal)},w.notEqual=function(M,K,se){M==K&&_(M,K,se,"!=",w.notEqual)},w.deepEqual=function(M,K,se){q(M,K,!1)||_(M,K,se,"deepEqual",w.deepEqual)},w.deepStrictEqual=function(M,K,se){q(M,K,!0)||_(M,K,se,"deepStrictEqual",w.deepStrictEqual)};function q(b,M,K,se){if(b===M)return!0;if(i(b)&&i(M))return s(b,M)===0;if(l.isDate(b)&&l.isDate(M))return b.getTime()===M.getTime();if(l.isRegExp(b)&&l.isRegExp(M))return b.source===M.source&&b.global===M.global&&b.multiline===M.multiline&&b.lastIndex===M.lastIndex&&b.ignoreCase===M.ignoreCase;if((b===null||typeof b!="object")&&(M===null||typeof M!="object"))return K?b===M:b==M;if(g(b)&&g(M)&&v(b)===v(M)&&!(b instanceof Float32Array||b instanceof Float64Array))return s(new Uint8Array(b.buffer),new Uint8Array(M.buffer))===0;if(i(b)!==i(M))return!1;se=se||{actual:[],expected:[]};var he=se.actual.indexOf(b);return he!==-1&&he===se.expected.indexOf(M)?!0:(se.actual.push(b),se.expected.push(M),ue(b,M,K,se))}function Q(b){return Object.prototype.toString.call(b)=="[object Arguments]"}function ue(b,M,K,se){if(b==null||M===null||M===void 0)return!1;if(l.isPrimitive(b)||l.isPrimitive(M))return b===M;if(K&&Object.getPrototypeOf(b)!==Object.getPrototypeOf(M))return!1;var he=Q(b),Se=Q(M);if(he&&!Se||!he&&Se)return!1;if(he)return b=h.call(b),M=h.call(M),q(b,M,K);var Te=fe(b),S=fe(M),O,W;if(Te.length!==S.length)return!1;for(Te.sort(),S.sort(),W=Te.length-1;W>=0;W--)if(Te[W]!==S[W])return!1;for(W=Te.length-1;W>=0;W--)if(O=Te[W],!q(b[O],M[O],K,se))return!1;return!0}w.notDeepEqual=function(M,K,se){q(M,K,!1)&&_(M,K,se,"notDeepEqual",w.notDeepEqual)},w.notDeepStrictEqual=pe;function pe(b,M,K){q(b,M,!0)&&_(b,M,K,"notDeepStrictEqual",pe)}w.strictEqual=function(M,K,se){M!==K&&_(M,K,se,"===",w.strictEqual)},w.notStrictEqual=function(M,K,se){M===K&&_(M,K,se,"!==",w.notStrictEqual)};function ce(b,M){if(!b||!M)return!1;if(Object.prototype.toString.call(M)=="[object RegExp]")return M.test(b);try{if(b instanceof M)return!0}catch{}return Error.isPrototypeOf(M)?!1:M.call({},b)===!0}function ae(b){var M;try{b()}catch(K){M=K}return M}function ne(b,M,K,se){var he;if(typeof M!="function")throw new TypeError('"block" argument must be a function');typeof K=="string"&&(se=K,K=null),he=ae(M),se=(K&&K.name?" ("+K.name+").":".")+(se?" "+se:"."),b&&!he&&_(he,K,"Missing expected exception"+se);var Se=typeof se=="string",Te=!b&&l.isError(he),S=!b&&he&&!K;if((Te&&Se&&ce(he,K)||S)&&_(he,K,"Got unwanted exception"+se),b&&he&&K&&!ce(he,K)||!b&&he)throw he}w.throws=function(b,M,K){ne(!0,b,M,K)},w.doesNotThrow=function(b,M,K){ne(!1,b,M,K)},w.ifError=function(b){if(b)throw b};function re(b,M){b||_(b,!0,M,"==",re)}w.strict=r(re,w,{equal:w.strictEqual,deepEqual:w.deepStrictEqual,notEqual:w.notStrictEqual,notDeepEqual:w.notDeepStrictEqual}),w.strict.strict=w.strict;var fe=Object.keys||function(b){var M=[];for(var K in b)a.call(b,K)&&M.push(K);return M};return ui.exports}var el,mc;function Mg(){if(mc)return el;mc=1;var r=Fg();return el=function(s){var i,l,a,h,p;for(i=Error.prepareStackTrace,Error.prepareStackTrace=function(v,g){return Error.prepareStackTrace=i,g},l=new Error().stack,p=0;p<l.length&&l[p].getFileName()!==__filename;)p++;r(p<l.length,"Unexpected: unable to find caller/index.js in the stack"),s=!s||isNaN(s)?1:s>l.length-2?l.length-2:s,l=l.slice(p+s+1);do h=l.shift(),a=h&&h.getFileName();while(l.length&&a==="module.js");return a},el}var yc;function zg(){if(yc)return _s;yc=1;const r=Zn,s=Zn,i=sg(),l=Mg();return _s.getCallerRoot=function(){try{return i(l(2))}catch{return}},_s.getProcessRoot=function(){let h=process.cwd();const p=s.join(h,"current");try{r.statSync(p).isDirectory()&&(h=p)}catch{}try{return i(h)}catch{return}},_s}var tl,vc;function Dg(){return vc||(vc=1,tl=zg()),tl}var Is={exports:{}},nl,wc;function Ug(){if(wc)return nl;wc=1;var r=1e3,s=r*60,i=s*60,l=i*24,a=l*7,h=l*365.25;nl=function(k,$){$=$||{};var j=typeof k;if(j==="string"&&k.length>0)return p(k);if(j==="number"&&isFinite(k))return $.long?g(k):v(k);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(k))};function p(k){if(k=String(k),!(k.length>100)){var $=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(k);if($){var j=parseFloat($[1]),A=($[2]||"ms").toLowerCase();switch(A){case"years":case"year":case"yrs":case"yr":case"y":return j*h;case"weeks":case"week":case"w":return j*a;case"days":case"day":case"d":return j*l;case"hours":case"hour":case"hrs":case"hr":case"h":return j*i;case"minutes":case"minute":case"mins":case"min":case"m":return j*s;case"seconds":case"second":case"secs":case"sec":case"s":return j*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return j;default:return}}}}function v(k){var $=Math.abs(k);return $>=l?Math.round(k/l)+"d":$>=i?Math.round(k/i)+"h":$>=s?Math.round(k/s)+"m":$>=r?Math.round(k/r)+"s":k+"ms"}function g(k){var $=Math.abs(k);return $>=l?w(k,$,l,"day"):$>=i?w(k,$,i,"hour"):$>=s?w(k,$,s,"minute"):$>=r?w(k,$,r,"second"):k+" ms"}function w(k,$,j,A){var z=$>=j*1.5;return Math.round(k/j)+" "+A+(z?"s":"")}return nl}var rl,Sc;function Bg(){if(Sc)return rl;Sc=1;function r(s){l.debug=l,l.default=l,l.coerce=w,l.disable=v,l.enable=h,l.enabled=g,l.humanize=Ug(),l.destroy=k,Object.keys(s).forEach($=>{l[$]=s[$]}),l.names=[],l.skips=[],l.formatters={};function i($){let j=0;for(let A=0;A<$.length;A++)j=(j<<5)-j+$.charCodeAt(A),j|=0;return l.colors[Math.abs(j)%l.colors.length]}l.selectColor=i;function l($){let j,A=null,z,_;function R(...q){if(!R.enabled)return;const Q=R,ue=Number(new Date),pe=ue-(j||ue);Q.diff=pe,Q.prev=j,Q.curr=ue,j=ue,q[0]=l.coerce(q[0]),typeof q[0]!="string"&&q.unshift("%O");let ce=0;q[0]=q[0].replace(/%([a-zA-Z%])/g,(ne,re)=>{if(ne==="%%")return"%";ce++;const fe=l.formatters[re];if(typeof fe=="function"){const b=q[ce];ne=fe.call(Q,b),q.splice(ce,1),ce--}return ne}),l.formatArgs.call(Q,q),(Q.log||l.log).apply(Q,q)}return R.namespace=$,R.useColors=l.useColors(),R.color=l.selectColor($),R.extend=a,R.destroy=l.destroy,Object.defineProperty(R,"enabled",{enumerable:!0,configurable:!1,get:()=>A!==null?A:(z!==l.namespaces&&(z=l.namespaces,_=l.enabled($)),_),set:q=>{A=q}}),typeof l.init=="function"&&l.init(R),R}function a($,j){const A=l(this.namespace+(typeof j>"u"?":":j)+$);return A.log=this.log,A}function h($){l.save($),l.namespaces=$,l.names=[],l.skips=[];const j=(typeof $=="string"?$:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const A of j)A[0]==="-"?l.skips.push(A.slice(1)):l.names.push(A)}function p($,j){let A=0,z=0,_=-1,R=0;for(;A<$.length;)if(z<j.length&&(j[z]===$[A]||j[z]==="*"))j[z]==="*"?(_=z,R=A,z++):(A++,z++);else if(_!==-1)z=_+1,R++,A=R;else return!1;for(;z<j.length&&j[z]==="*";)z++;return z===j.length}function v(){const $=[...l.names,...l.skips.map(j=>"-"+j)].join(",");return l.enable(""),$}function g($){for(const j of l.skips)if(p($,j))return!1;for(const j of l.names)if(p($,j))return!0;return!1}function w($){return $ instanceof Error?$.stack||$.message:$}function k(){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 l.enable(l.load()),l}return rl=r,rl}var xc;function Vg(){return xc||(xc=1,(function(r,s){s.formatArgs=l,s.save=a,s.load=h,s.useColors=i,s.storage=p(),s.destroy=(()=>{let g=!1;return()=>{g||(g=!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`."))}})(),s.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 i(){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 g;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&&(g=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(g[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function l(g){if(g[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+g[0]+(this.useColors?"%c ":" ")+"+"+r.exports.humanize(this.diff),!this.useColors)return;const w="color: "+this.color;g.splice(1,0,w,"color: inherit");let k=0,$=0;g[0].replace(/%[a-zA-Z%]/g,j=>{j!=="%%"&&(k++,j==="%c"&&($=k))}),g.splice($,0,w)}s.log=console.debug||console.log||(()=>{});function a(g){try{g?s.storage.setItem("debug",g):s.storage.removeItem("debug")}catch{}}function h(){let g;try{g=s.storage.getItem("debug")||s.storage.getItem("DEBUG")}catch{}return!g&&typeof process<"u"&&"env"in process&&(g=process.env.DEBUG),g}function p(){try{return localStorage}catch{}}r.exports=Bg()(s);const{formatters:v}=r.exports;v.j=function(g){try{return JSON.stringify(g)}catch(w){return"[UnexpectedJSONParseError]: "+w.message}}})(Is,Is.exports)),Is.exports}var Cc;function Hg(){if(Cc)return Rs.exports;Cc=1;const r=Dg(),s=Vg();return Rs.exports=function(l){const a=r.getCallerRoot();let h;try{const p=Nn("/node_modules/.pnpm/@tryghost+debug@2.2.3_supports-color@5.5.0/node_modules/@tryghost/debug/lib")(a+"/package.json");p.alias?h=p.alias:h=p.name}catch{h="undefined"}return s(h+":"+l)},Rs.exports._base=s,Rs.exports}var sl,kc;function qg(){return kc||(kc=1,sl=Hg()),sl}const Wg=[{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 Pc;function Kg(){if(Pc)return Xn.exports;Pc=1;const r=rg(),s=Zn,i=Zn,l=qg()("i18n"),a=Wg,h=a.map(g=>g.code);function p(g,w){return g.reduce((k,$)=>{let j;try{j=Nn("/ghost/i18n/lib")(`../locales/${$}/${w}.json`)}catch{j=Nn("/ghost/i18n/lib")(`../locales/en/${w}.json`)}return k[$]={[w]:{...j,...j.default&&typeof j.default=="object"?j.default:{}}},k},{})}function v(g,w){if(!w)return{[g]:{theme:{}}};let k=[];try{k=i.readdirSync(w).filter(A=>A.endsWith(".json")).map(A=>A.replace(".json",""))}catch{k=[g,"en"]}return[...new Set([g,...k,"en"])].reduce((j,A)=>{let z,_=!1;const R=s.join(w,`${A}.json`);if(i.existsSync(R))try{delete require.cache[Nn("/ghost/i18n/lib").resolve(R)],z=Nn("/ghost/i18n/lib")(R)}catch{l(`Error loading theme locale file: ${A}`),_=!0}else _=!0;if(_)if(A!=="en")try{const q=s.join(w,"en.json");i.existsSync(q)?(delete require.cache[Nn("/ghost/i18n/lib").resolve(q)],z=Nn("/ghost/i18n/lib")(q)):z={}}catch{z={}}else l("Theme en.json file not found"),z={};return j[A]={theme:{...z,...z.default&&typeof z.default=="object"?z.default:{}}},j},{})}return Xn.exports=(g="en",w="portal",k={})=>{const $=r.createInstance(),j={prefix:"{",suffix:"}"};(w==="theme"||w==="portal")&&(j.escapeValue=!1);let A;return w!=="theme"?A=p(h,w):(l(`generateThemeResources: ${g}, ${k.themePath}`),A=v(g,k.themePath)),$.init({lng:g,nsSeparator:!1,keySeparator:!1,returnEmptyString:!1,fallbackLng:{no:["nb","en"],default:["en"]},ns:w,defaultNS:w,interpolation:j,resources:A}),$},Xn.exports.SUPPORTED_LOCALES=h,Xn.exports.LOCALE_DATA=a,Xn.exports.generateResources=p,Xn.exports}var $c;function Gg(){if($c)return On.exports;$c=1;const r=Kg();return On.exports=r,On.exports.default=r,On.exports.LOCALE_DATA=r.LOCALE_DATA,On.exports.SUPPORTED_LOCALES=r.SUPPORTED_LOCALES,On.exports.generateResources=r.generateResources,On.exports}var Qg=Gg();const Jg=Io(Qg);class Yg extends en.Component{constructor(s){super(s);const i=this.props.locale||"en",l=Jg(i,"search"),a=l.dir()||"ltr",h=new Kd({adminUrl:s.adminUrl,apiKey:s.apiKey,dir:a});this.state={searchIndex:h,showPopup:!1,indexStarted:!1,indexComplete:!1,t:l.t,dir:a,scrollbarWidth:0},this.inputRef=en.createRef()}componentDidMount(){const s=this.getScrollbarWidth();this.setState({scrollbarWidth:s}),this.initSetup()}componentDidUpdate(s,i){if(i.showPopup!==this.state.showPopup)try{this.state.showPopup?(this.bodyScroll=window.document?.body?.style?.overflow,this.bodyMargin=window.getComputedStyle(document.body).getPropertyValue("margin-right"),window.document.body.style.overflow="hidden",this.state.scrollbarWidth&&document.body.scrollHeight>window.innerHeight&&(window.document.body.style.marginRight=`calc(${this.bodyMargin} + ${this.state.scrollbarWidth}px)`)):(window.document.body.style.overflow=this.bodyScroll||"",!this.bodyMargin||this.bodyMargin==="0px"?window.document.body.style.marginRight="":window.document.body.style.marginRight=this.bodyMargin)}catch{}this.state.showPopup!==i?.showPopup&&!this.state.showPopup&&this.setState({searchValue:""}),this.state.showPopup&&!this.state.indexStarted&&this.setupSearchIndex()}async setupSearchIndex(){this.setState({indexStarted:!0}),await this.state.searchIndex.init(),this.setState({indexComplete:!0})}componentWillUnmount(){window.removeEventListener("hashchange",this.hashHandler,!1),window.removeEventListener("keydown",this.handleKeyDown,!1)}initSetup(){this.handleSearchUrl(),this.addKeyboardShortcuts(),this.setupCustomTriggerButton(),this.hashHandler=()=>{this.handleSearchUrl()},window.addEventListener("hashchange",this.hashHandler,!1)}getScrollbarWidth(){const s=document.createElement("div");s.style.visibility="hidden",s.style.overflow="scroll",document.body.appendChild(s);const i=s.offsetWidth-s.clientWidth;return document.body.removeChild(s),i}setupCustomTriggerButton(){this.clickHandler=s=>{s.preventDefault(),this.setState({showPopup:!0});const i=document.createElement("input");i.style.opacity="0",i.style.position="fixed",i.style.top="0",document.body.appendChild(i),i.focus(),setTimeout(()=>{this.inputRef.current.focus(),document.body.removeChild(i)},150)},this.customTriggerButtons=this.getCustomTriggerButtons(),this.customTriggerButtons.forEach(s=>{s.removeEventListener("click",this.clickHandler),s.addEventListener("click",this.clickHandler)})}getCustomTriggerButtons(){return document.querySelectorAll("[data-ghost-search]")||[]}handleSearchUrl(){const[s]=window.location.hash.substr(1).split("?");(s==="/search"||s==="/search/")&&(this.setState({showPopup:!0}),window.history.replaceState("",document.title,window.location.pathname))}addKeyboardShortcuts(){this.getCustomTriggerButtons()?.length&&(this.handleKeyDown=i=>{if(i.key==="k"&&i.metaKey)return this.setState({showPopup:!0}),i.preventDefault(),i.stopPropagation(),!1},document.addEventListener("keydown",this.handleKeyDown))}render(){return le.jsx(ut.Provider,{value:{page:"search",showPopup:this.state.showPopup,adminUrl:this.props.adminUrl,stylesUrl:this.props.stylesUrl,searchIndex:this.state.searchIndex,indexComplete:this.state.indexComplete,searchValue:this.state.searchValue,inputRef:this.inputRef,onAction:()=>{},dispatch:(s,i)=>{s==="update"&&this.setState({...this.state,...i})},t:this.state.t,dir:this.state.dir},children:le.jsx($d,{})})}}const Ec="sodo-search-root";function Xg(){const r=document.createElement("div");r.id=Ec,document.body.appendChild(r)}function Zg(){const r=document.querySelector("script[data-sodo-search]");if(r){const s=r.dataset.sodoSearch,i=r.dataset.key,l=r.dataset.styles,a=r.dataset.locale||"en";return{adminUrl:s,apiKey:i,stylesUrl:l,locale:a}}return{}}function em(){Xg()}function tm(){const{adminUrl:r,apiKey:s,stylesUrl:i,locale:l}=Zg(),a=(r||window.location.origin)?.replace(/\/+$/,"");em(),Zh.render(le.jsx(en.StrictMode,{children:le.jsx(Yg,{adminUrl:a,apiKey:s,stylesUrl:i,locale:l})}),document.getElementById(Ec))}tm()}));
30
30
  //# sourceMappingURL=sodo-search.min.js.map