Linux webm002.cluster126.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
/
home
/
a
/
r
/
i
/
ariannadhf
/
www
/
wp-content
/
plugins
/
simple-history
/
build
/
/home/a/r/i/ariannadhf/www/wp-content/plugins/simple-history/build/index.js
(()=>{"use strict";var e,t,n={20:(e,t,n)=>{var a=n(609),r=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),s=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,n){var a,l={},c=null,u=null;for(a in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)i.call(t,a)&&!o.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===l[a]&&(l[a]=t[a]);return{$$typeof:r,type:e,key:c,ref:u,props:l,_owner:s.current}}t.jsx=l,t.jsxs=l},848:(e,t,n)=>{e.exports=n(20)},609:e=>{e.exports=window.React},887:(e,t,n)=>{function a(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function r(){if(typeof navigator>"u")return!1;let e=navigator.userAgent||"",t=e.toLowerCase(),n=t.includes("safari")&&!t.includes("chrome")&&!t.includes("crios")&&!t.includes("fxios")&&!t.includes("android"),a=/applewebkit/i.test(e),r=/mobile/i.test(e),i=!/safari/i.test(e),s=a&&r&&i,o=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),l=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),c=/ipad|iphone|ipod/.test(t)&&a;return n||s||o||l||c}n.d(t,{a:()=>a,b:()=>r})}},a={};function r(e){var t=a[e];if(void 0!==t)return t.exports;var i=a[e]={exports:{}};return n[e](i,i.exports,r),i.exports}r.m=n,r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((t,n)=>(r.f[n](e,t),t)),[])),r.u=e=>e+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="simple-history:",r.l=(n,a,i,s)=>{if(e[n])e[n].push(a);else{var o,l;if(void 0!==i)for(var c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var d=c[u];if(d.getAttribute("src")==n||d.getAttribute("data-webpack")==t+i){o=d;break}}o||(l=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,r.nc&&o.setAttribute("nonce",r.nc),o.setAttribute("data-webpack",t+i),o.src=n),e[n]=[a];var m=(t,a)=>{o.onerror=o.onload=null,clearTimeout(h);var r=e[n];if(delete e[n],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach((e=>e(a))),t)return t(a)},h=setTimeout(m.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=m.bind(null,o.onerror),o.onload=m.bind(null,o.onload),l&&document.head.appendChild(o)}},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var a=n.length-1;a>-1&&(!e||!/^http(s?):/.test(e));)e=n[a--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),(()=>{var e={57:0};r.f.j=(t,n)=>{var a=r.o(e,t)?e[t]:void 0;if(0!==a)if(a)n.push(a[2]);else{var i=new Promise(((n,r)=>a=e[t]=[n,r]));n.push(a[2]=i);var s=r.p+r.u(t),o=new Error;r.l(s,(n=>{if(r.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var i=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;o.message="Loading chunk "+t+" failed.\n("+i+": "+s+")",o.name="ChunkLoadError",o.type=i,o.request=s,a[1](o)}}),"chunk-"+t,t)}};var t=(t,n)=>{var a,i,[s,o,l]=n,c=0;if(s.some((t=>0!==e[t]))){for(a in o)r.o(o,a)&&(r.m[a]=o[a]);l&&l(r)}for(t&&t(n);c<s.length;c++)i=s[c],r.o(e,i)&&e[i]&&e[i][0](),e[i]=0},n=globalThis.webpackChunksimple_history=globalThis.webpackChunksimple_history||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var i=r(609);const s=window.wp.components,o=window.wp.domReady;var l=r.n(o);const c=window.wp.element,u=window.wp.apiFetch;var d=r.n(u);const m=window.wp.compose,h=(0,c.createContext)(null);function p({children:e,value:t}){return(0,i.createElement)(h.Provider,{value:t},e)}function g(){return(0,c.useContext)(h)||{hasExtendedSettingsAddOn:!1,hasPremiumAddOn:!1,hasFailedLoginLimit:!1,experimentalFeaturesEnabled:!1,currentUserId:null}}const f=window.wp.url;var y={303:"Multiple adapter contexts detected. This might happen in monorepos.",404:"nuqs requires an adapter to work with your framework.",409:"Multiple versions of the library are loaded. This may lead to unexpected behavior. Currently using `%s`, but `%s` (via the %s adapter) was about to load on top.",414:"Max safe URL length exceeded. Some browsers may not be able to accept this URL. Consider limiting the amount of state stored in the URL.",429:"URL update rate-limited by the browser. Consider increasing `throttleMs` for key(s) `%s`. %O",500:"Empty search params cache. Search params can't be accessed in Layouts.",501:"Search params cache already populated. Have you called `parse` twice?"};function v(e){return`[nuqs] ${y[e]}\n See https://err.47ng.com/NUQS-${e}`}var _=function(){try{if("undefined"==typeof localStorage)return!1;const e="nuqs-localStorage-test";localStorage.setItem(e,e);const t=localStorage.getItem(e)===e;if(localStorage.removeItem(e),!t)return!1}catch(e){return console.error("[nuqs]: debug mode is disabled (localStorage unavailable).",e),!1}return(localStorage.getItem("debug")??"").includes("nuqs")}();function w(e,...t){if(!_)return;const n=function(e,...t){return e.replace(/%[sfdO]/g,(e=>{const n=t.shift();return"%O"===e&&n?JSON.stringify(n).replace(/"([^"]+)":/g,"$1:"):String(n)}))}(e,...t);performance.mark(n);try{console.log(e,...t)}catch(e){console.log(n)}}var b=(0,i.createContext)({useAdapter(){throw new Error(v(404))}});function I(e,t,n){try{return e(t)}catch(e){return function(e,...t){_&&console.warn(e,...t)}("[nuqs] Error while parsing value `%s`: %O"+(n?" (for key `%s`)":""),t,e,n),null}}b.displayName="NuqsAdapterContext",_&&"undefined"!=typeof window&&(window.__NuqsAdapterContext&&window.__NuqsAdapterContext!==b&&console.error(v(303)),window.__NuqsAdapterContext=b);var x=function(){if("undefined"==typeof window)return 50;if(!Boolean(window.GestureEvent))return 50;try{const e=navigator.userAgent?.match(/version\/([\d\.]+) safari/i);return parseFloat(e[1])>=17?120:320}catch{return 320}}(),S=new Map,E={history:"replace",scroll:!1,shallow:!0,throttleMs:x},C=new Set,k=0,M=null;function N(){return new URLSearchParams(location.search)}function A({getSearchParamsSnapshot:e=N,updateUrl:t,rateLimitFactor:n=1}){return null===M&&(M=new Promise(((a,r)=>{if(!Number.isFinite(E.throttleMs))return w("[nuqs queue] Skipping flush due to throttleMs=Infinity"),a(e()),void setTimeout((()=>{M=null}),0);function i(){k=performance.now();const[n,i]=function({updateUrl:e,getSearchParamsSnapshot:t}){const n=t();if(0===S.size)return[n,null];const a=Array.from(S.entries()),r={...E},i=Array.from(C);S.clear(),C.clear(),E.history="replace",E.scroll=!1,E.shallow=!0,E.throttleMs=x,w("[nuqs queue] Flushing queue %O with options %O",a,r);for(const[e,t]of a)null===t?n.delete(e):n.set(e,t);try{return function(t){const a=i=>{if(i===t.length)return void e(n,{history:r.history,scroll:r.scroll,shallow:r.shallow});const s=t[i];if(!s)throw new Error("Invalid transition function");s((()=>a(i+1)))};a(0)}(i),[n,null]}catch(e){return console.error(v(429),a.map((([e])=>e)).join(),e),[n,e]}}({updateUrl:t,getSearchParamsSnapshot:e});null===i?a(n):r(n),M=null}setTimeout((function(){const e=performance.now()-k,t=E.throttleMs,a=n*Math.max(0,Math.min(t,t-e));w("[nuqs queue] Scheduling flush in %f ms. Throttled at %f ms",a,t),0===a?i():setTimeout(i,a)}),0)}))),M}function P(e){return{all:e=e||new Map,on:function(t,n){var a=e.get(t);a?a.push(n):e.set(t,[n])},off:function(t,n){var a=e.get(t);a&&(n?a.splice(a.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var a=e.get(t);a&&a.slice().map((function(e){e(n)})),(a=e.get("*"))&&a.slice().map((function(e){e(t,n)}))}}}function L(e){function t(t){if(void 0===t)return null;let n="";if(Array.isArray(t)){if(void 0===t[0])return null;n=t[0]}return"string"==typeof t&&(n=t),I(e.parse,n)}return{eq:(e,t)=>e===t,...e,parseServerSide:t,withDefault(e){return{...this,defaultValue:e,parseServerSide:n=>t(n)??e}},withOptions(e){return{...this,...e}}}}var T=L({parse:e=>e,serialize:e=>`${e}`}),j=L({parse:e=>{const t=parseInt(e);return Number.isNaN(t)?null:t},serialize:e=>Math.round(e).toFixed()}),D=(L({parse:e=>{const t=j.parse(e);return null===t?null:t-1},serialize:e=>j.serialize(e+1)}),L({parse:e=>{const t=parseInt(e,16);return Number.isNaN(t)?null:t},serialize:e=>{const t=Math.round(e).toString(16);return t.padStart(t.length+t.length%2,"0")}}),L({parse:e=>{const t=parseFloat(e);return Number.isNaN(t)?null:t},serialize:e=>e.toString()}),L({parse:e=>"true"===e,serialize:e=>e?"true":"false"}));function H(e,t){return e.valueOf()===t.valueOf()}L({parse:e=>{const t=parseInt(e);return Number.isNaN(t)?null:new Date(t)},serialize:e=>e.valueOf().toString(),eq:H}),L({parse:e=>{const t=new Date(e);return Number.isNaN(t.valueOf())?null:t},serialize:e=>e.toISOString(),eq:H});var Z=L({parse:e=>{const t=new Date(e.slice(0,10));return Number.isNaN(t.valueOf())?null:t},serialize:e=>e.toISOString().slice(0,10),eq:H});function F(e){return L({parse:t=>{try{const n=JSON.parse(t);return e(n)}catch{return null}},serialize:e=>JSON.stringify(e),eq:(e,t)=>e===t||JSON.stringify(e)===JSON.stringify(t)})}function O(e,t=","){const n=e.eq??((e,t)=>e===t),a=encodeURIComponent(t);return L({parse:n=>""===n?[]:n.split(t).map(((n,r)=>I(e.parse,n.replaceAll(a,t),`[${r}]`))).filter((e=>null!=e)),serialize:n=>n.map((n=>(e.serialize?e.serialize(n):String(n)).replaceAll(t,a))).join(t),eq:(e,t)=>e===t||e.length===t.length&&e.every(((e,a)=>n(e,t[a])))})}var W,R,B=P();function z(e,{history:t="replace",shallow:n=!0,scroll:a=!1,throttleMs:r=x,parse:s=e=>e,serialize:o=String,eq:l=(e,t)=>e===t,defaultValue:c,clearOnDefault:u=!0,startTransition:d}={history:"replace",scroll:!1,shallow:!0,throttleMs:x,parse:e=>e,serialize:String,eq:(e,t)=>e===t,clearOnDefault:!0,defaultValue:void 0}){const m=function(){const e=(0,i.useContext)(b);if(!("useAdapter"in e))throw new Error(v(404));return e.useAdapter()}(),h=m.searchParams,p=(0,i.useRef)(h?.get(e)??null),[g,f]=(0,i.useState)((()=>{const t=function(e){return S.get(e)}(e),n=void 0===t?h?.get(e)??null:t;return null===n?null:I(s,n,e)})),y=(0,i.useRef)(g);w("[nuqs `%s`] render - state: %O, iSP: %s",e,g,h?.get(e)??null),(0,i.useEffect)((()=>{const t=h?.get(e)??null;if(t===p.current)return;const n=null===t?null:I(s,t,e);w("[nuqs `%s`] syncFromUseSearchParams %O",e,n),y.current=n,p.current=t,f(n)}),[h?.get(e),e]),(0,i.useEffect)((()=>{function t({state:t,query:n}){w("[nuqs `%s`] updateInternalState %O",e,t),y.current=t,p.current=n,f(t)}return w("[nuqs `%s`] subscribing to sync",e),B.on(e,t),()=>{w("[nuqs `%s`] unsubscribing from sync",e),B.off(e,t)}}),[e]);const _=(0,i.useCallback)(((i,s={})=>{let h=function(e){return"function"==typeof e}(i)?i(y.current??c??null):i;(s.clearOnDefault??u)&&null!==h&&void 0!==c&&l(h,c)&&(h=null);const p=function(e,t,n,a){const r=null===t?null:n(t);return w("[nuqs queue] Enqueueing %s=%s %O",e,r,a),S.set(e,r),"push"===a.history&&(E.history="push"),a.scroll&&(E.scroll=!0),!1===a.shallow&&(E.shallow=!1),a.startTransition&&C.add(a.startTransition),E.throttleMs=Math.max(a.throttleMs??x,Number.isFinite(E.throttleMs)?E.throttleMs:0),r}(e,h,o,{history:s.history??t,shallow:s.shallow??n,scroll:s.scroll??a,throttleMs:s.throttleMs??r,startTransition:s.startTransition??d});return B.emit(e,{state:h,query:p}),A(m)}),[e,t,n,a,r,d,m.updateUrl,m.getSearchParamsSnapshot,m.rateLimitFactor]);return[g??c??null,_]}!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(_x){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(W||(W={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(R||(R={}));const $=W.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),U=e=>{switch(typeof e){case"undefined":return $.undefined;case"string":return $.string;case"number":return Number.isNaN(e)?$.nan:$.number;case"boolean":return $.boolean;case"function":return $.function;case"bigint":return $.bigint;case"symbol":return $.symbol;case"object":return Array.isArray(e)?$.array:null===e?$.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?$.promise:"undefined"!=typeof Map&&e instanceof Map?$.map:"undefined"!=typeof Set&&e instanceof Set?$.set:"undefined"!=typeof Date&&e instanceof Date?$.date:$.object;default:return $.unknown}},G=W.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class V extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(a);else if("invalid_return_type"===r.code)a(r.returnTypeError);else if("invalid_arguments"===r.code)a(r.argumentsError);else if(0===r.path.length)n._errors.push(t(r));else{let e=n,a=0;for(;a<r.path.length;){const n=r.path[a];a===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],a++}}};return a(this),n}static assert(e){if(!(e instanceof V))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,W.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}V.create=e=>new V(e);const q=(e,t)=>{let n;switch(e.code){case G.invalid_type:n=e.received===$.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,W.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${W.joinValues(e.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${W.joinValues(e.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${W.joinValues(e.options)}, received '${e.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:W.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case G.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case G.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;default:n=t.defaultError,W.assertNever(e)}return{message:n}};let Y=q;var Q;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(Q||(Q={}));function J(e,t){const n=Y,a=(e=>{const{data:t,path:n,errorMaps:a,issueData:r}=e,i=[...n,...r.path||[]],s={...r,path:i};if(void 0!==r.message)return{...r,path:i,message:r.message};let o="";const l=a.filter((e=>!!e)).slice().reverse();for(const e of l)o=e(s,{data:t,defaultError:o}).message;return{...r,path:i,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===q?void 0:q].filter((e=>!!e))});e.common.issues.push(a)}class K{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return X;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return K.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:r}=a;if("aborted"===t.status)return X;if("aborted"===r.status)return X;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!a.alwaysSet||(n[t.value]=r.value)}return{status:e.value,value:n}}}const X=Object.freeze({status:"aborted"}),ee=e=>({status:"dirty",value:e}),te=e=>({status:"valid",value:e}),ne=e=>"aborted"===e.status,ae=e=>"dirty"===e.status,re=e=>"valid"===e.status,ie=e=>"undefined"!=typeof Promise&&e instanceof Promise;class se{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const oe=(e,t)=>{if(re(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new V(e.common.issues);return this._error=t,this._error}}};function le(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:r}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:r}:{errorMap:(t,r)=>{const{message:i}=e;return"invalid_enum_value"===t.code?{message:i??r.defaultError}:void 0===r.data?{message:i??a??r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:i??n??r.defaultError}},description:r}}class ce{get description(){return this._def.description}_getType(e){return U(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:U(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new K,ctx:{common:e.parent.common,data:e.data,parsedType:U(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ie(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)},a=this._parseSync({data:e,path:n.path,parent:n});return oe(n,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return re(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((e=>re(e)?{value:e.value}:{issues:t.common.issues}))}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(ie(a)?a:Promise.resolve(a));return oe(n,r)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const r=e(t),i=()=>a.addIssue({code:G.custom,...n(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then((e=>!!e||(i(),!1))):!!r||(i(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new it({schema:this,typeName:pt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return st.create(this,this._def)}nullable(){return ot.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $e.create(this)}promise(){return rt.create(this,this._def)}or(e){return Ve.create([this,e],this._def)}and(e){return Ye.create(this,e,this._def)}transform(e){return new it({...le(this._def),schema:this,typeName:pt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new lt({...le(this._def),innerType:this,defaultValue:t,typeName:pt.ZodDefault})}brand(){return new dt({typeName:pt.ZodBranded,type:this,...le(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ct({...le(this._def),innerType:this,catchValue:t,typeName:pt.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return mt.create(this,e)}readonly(){return ht.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ue=/^c[^\s-]{8,}$/i,de=/^[0-9a-z]+$/,me=/^[0-9A-HJKMNP-TV-Z]{26}$/i,he=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,pe=/^[a-z0-9_-]{21}$/i,ge=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ye=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let ve;const _e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,we=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,be=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ie=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Se=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ee="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ce=new RegExp(`^${Ee}$`);function ke(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function Me(e){let t=`${Ee}T${ke(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ne(e,t){if(!ge.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const a=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(a));return!("object"!=typeof r||null===r||"typ"in r&&"JWT"!==r?.typ||!r.alg||t&&r.alg!==t)}catch{return!1}}function Ae(e,t){return!("v4"!==t&&t||!we.test(e))||!("v6"!==t&&t||!Ie.test(e))}class Pe extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==$.string){const t=this._getOrReturnCtx(e);return J(t,{code:G.invalid_type,expected:$.string,received:t.parsedType}),X}const t=new K;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),J(n,{code:G.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("max"===i.kind)e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),J(n,{code:G.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const a=e.data.length>i.value,r=e.data.length<i.value;(a||r)&&(n=this._getOrReturnCtx(e,n),a?J(n,{code:G.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):r&&J(n,{code:G.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)ye.test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"email",code:G.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)ve||(ve=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ve.test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"emoji",code:G.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)he.test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"uuid",code:G.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)pe.test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"nanoid",code:G.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)ue.test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"cuid",code:G.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)de.test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"cuid2",code:G.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)me.test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"ulid",code:G.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),J(n,{validation:"url",code:G.invalid_string,message:i.message}),t.dirty()}else"regex"===i.kind?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"regex",code:G.invalid_string,message:i.message}),t.dirty())):"trim"===i.kind?e.data=e.data.trim():"includes"===i.kind?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),J(n,{code:G.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty()):"toLowerCase"===i.kind?e.data=e.data.toLowerCase():"toUpperCase"===i.kind?e.data=e.data.toUpperCase():"startsWith"===i.kind?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),J(n,{code:G.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty()):"endsWith"===i.kind?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),J(n,{code:G.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty()):"datetime"===i.kind?Me(i).test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{code:G.invalid_string,validation:"datetime",message:i.message}),t.dirty()):"date"===i.kind?Ce.test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{code:G.invalid_string,validation:"date",message:i.message}),t.dirty()):"time"===i.kind?new RegExp(`^${ke(i)}$`).test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{code:G.invalid_string,validation:"time",message:i.message}),t.dirty()):"duration"===i.kind?fe.test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"duration",code:G.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(a=e.data,("v4"!==(r=i.version)&&r||!_e.test(a))&&("v6"!==r&&r||!be.test(a))&&(n=this._getOrReturnCtx(e,n),J(n,{validation:"ip",code:G.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?Ne(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"jwt",code:G.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?Ae(e.data,i.version)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"cidr",code:G.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?xe.test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"base64",code:G.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?Se.test(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{validation:"base64url",code:G.invalid_string,message:i.message}),t.dirty()):W.assertNever(i);var a,r;return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:G.invalid_string,...Q.errToObj(n)})}_addCheck(e){return new Pe({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Q.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Q.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Q.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Q.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Q.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Q.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Q.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...Q.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Q.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Q.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Q.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Q.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Q.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Q.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Q.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Q.errToObj(t)})}nonempty(e){return this.min(1,Q.errToObj(e))}trim(){return new Pe({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Pe({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Pe({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function Le(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,r=n>a?n:a;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}Pe.create=e=>new Pe({checks:[],typeName:pt.ZodString,coerce:e?.coerce??!1,...le(e)});class Te extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==$.number){const t=this._getOrReturnCtx(e);return J(t,{code:G.invalid_type,expected:$.number,received:t.parsedType}),X}let t;const n=new K;for(const a of this._def.checks)"int"===a.kind?W.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),J(t,{code:G.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),J(t,{code:G.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),J(t,{code:G.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"multipleOf"===a.kind?0!==Le(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),J(t,{code:G.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),J(t,{code:G.not_finite,message:a.message}),n.dirty()):W.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Q.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Q.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Q.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Q.toString(t))}setLimit(e,t,n,a){return new Te({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Q.toString(a)}]})}_addCheck(e){return new Te({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&W.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Te.create=e=>new Te({checks:[],typeName:pt.ZodNumber,coerce:e?.coerce||!1,...le(e)});class je extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==$.bigint)return this._getInvalidInput(e);let t;const n=new K;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),J(t,{code:G.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),J(t,{code:G.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),J(t,{code:G.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):W.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return J(t,{code:G.invalid_type,expected:$.bigint,received:t.parsedType}),X}gte(e,t){return this.setLimit("min",e,!0,Q.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Q.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Q.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Q.toString(t))}setLimit(e,t,n,a){return new je({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Q.toString(a)}]})}_addCheck(e){return new je({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}je.create=e=>new je({checks:[],typeName:pt.ZodBigInt,coerce:e?.coerce??!1,...le(e)});class De extends ce{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==$.boolean){const t=this._getOrReturnCtx(e);return J(t,{code:G.invalid_type,expected:$.boolean,received:t.parsedType}),X}return te(e.data)}}De.create=e=>new De({typeName:pt.ZodBoolean,coerce:e?.coerce||!1,...le(e)});class He extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==$.date){const t=this._getOrReturnCtx(e);return J(t,{code:G.invalid_type,expected:$.date,received:t.parsedType}),X}if(Number.isNaN(e.data.getTime()))return J(this._getOrReturnCtx(e),{code:G.invalid_date}),X;const t=new K;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),J(n,{code:G.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),J(n,{code:G.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):W.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new He({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Q.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Q.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}He.create=e=>new He({checks:[],coerce:e?.coerce||!1,typeName:pt.ZodDate,...le(e)});class Ze extends ce{_parse(e){if(this._getType(e)!==$.symbol){const t=this._getOrReturnCtx(e);return J(t,{code:G.invalid_type,expected:$.symbol,received:t.parsedType}),X}return te(e.data)}}Ze.create=e=>new Ze({typeName:pt.ZodSymbol,...le(e)});class Fe extends ce{_parse(e){if(this._getType(e)!==$.undefined){const t=this._getOrReturnCtx(e);return J(t,{code:G.invalid_type,expected:$.undefined,received:t.parsedType}),X}return te(e.data)}}Fe.create=e=>new Fe({typeName:pt.ZodUndefined,...le(e)});class Oe extends ce{_parse(e){if(this._getType(e)!==$.null){const t=this._getOrReturnCtx(e);return J(t,{code:G.invalid_type,expected:$.null,received:t.parsedType}),X}return te(e.data)}}Oe.create=e=>new Oe({typeName:pt.ZodNull,...le(e)});class We extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return te(e.data)}}We.create=e=>new We({typeName:pt.ZodAny,...le(e)});class Re extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return te(e.data)}}Re.create=e=>new Re({typeName:pt.ZodUnknown,...le(e)});class Be extends ce{_parse(e){const t=this._getOrReturnCtx(e);return J(t,{code:G.invalid_type,expected:$.never,received:t.parsedType}),X}}Be.create=e=>new Be({typeName:pt.ZodNever,...le(e)});class ze extends ce{_parse(e){if(this._getType(e)!==$.undefined){const t=this._getOrReturnCtx(e);return J(t,{code:G.invalid_type,expected:$.void,received:t.parsedType}),X}return te(e.data)}}ze.create=e=>new ze({typeName:pt.ZodVoid,...le(e)});class $e extends ce{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==$.array)return J(t,{code:G.invalid_type,expected:$.array,received:t.parsedType}),X;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&(J(t,{code:e?G.too_big:G.too_small,minimum:r?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(J(t,{code:G.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(J(t,{code:G.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new se(t,e,t.path,n))))).then((e=>K.mergeArray(n,e)));const r=[...t.data].map(((e,n)=>a.type._parseSync(new se(t,e,t.path,n))));return K.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new $e({...this._def,minLength:{value:e,message:Q.toString(t)}})}max(e,t){return new $e({...this._def,maxLength:{value:e,message:Q.toString(t)}})}length(e,t){return new $e({...this._def,exactLength:{value:e,message:Q.toString(t)}})}nonempty(e){return this.min(1,e)}}function Ue(e){if(e instanceof Ge){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=st.create(Ue(a))}return new Ge({...e._def,shape:()=>t})}return e instanceof $e?new $e({...e._def,type:Ue(e.element)}):e instanceof st?st.create(Ue(e.unwrap())):e instanceof ot?ot.create(Ue(e.unwrap())):e instanceof Qe?Qe.create(e.items.map((e=>Ue(e)))):e}$e.create=(e,t)=>new $e({type:e,minLength:null,maxLength:null,exactLength:null,typeName:pt.ZodArray,...le(t)});class Ge extends ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=W.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==$.object){const t=this._getOrReturnCtx(e);return J(t,{code:G.invalid_type,expected:$.object,received:t.parsedType}),X}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof Be&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||i.push(e);const s=[];for(const e of r){const t=a[e],r=n.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new se(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Be){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)s.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)i.length>0&&(J(n,{code:G.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const a=n.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new se(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of s){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>K.mergeObjectSync(t,e))):K.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return Q.errToObj,new Ge({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{const a=this._def.errorMap?.(t,n).message??n.defaultError;return"unrecognized_keys"===t.code?{message:Q.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Ge({...this._def,unknownKeys:"strip"})}passthrough(){return new Ge({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ge({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ge({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:pt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ge({...this._def,catchall:e})}pick(e){const t={};for(const n of W.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new Ge({...this._def,shape:()=>t})}omit(e){const t={};for(const n of W.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new Ge({...this._def,shape:()=>t})}deepPartial(){return Ue(this)}partial(e){const t={};for(const n of W.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()}return new Ge({...this._def,shape:()=>t})}required(e){const t={};for(const n of W.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof st;)e=e._def.innerType;t[n]=e}return new Ge({...this._def,shape:()=>t})}keyof(){return tt(W.objectKeys(this.shape))}}Ge.create=(e,t)=>new Ge({shape:()=>e,unknownKeys:"strip",catchall:Be.create(),typeName:pt.ZodObject,...le(t)}),Ge.strictCreate=(e,t)=>new Ge({shape:()=>e,unknownKeys:"strict",catchall:Be.create(),typeName:pt.ZodObject,...le(t)}),Ge.lazycreate=(e,t)=>new Ge({shape:e,unknownKeys:"strip",catchall:Be.create(),typeName:pt.ZodObject,...le(t)});class Ve extends ce{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new V(e.ctx.common.issues)));return J(t,{code:G.invalid_union,unionErrors:n}),X}));{let e;const a=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},i=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=a.map((e=>new V(e)));return J(t,{code:G.invalid_union,unionErrors:r}),X}}get options(){return this._def.options}}function qe(e,t){const n=U(e),a=U(t);if(e===t)return{valid:!0,data:e};if(n===$.object&&a===$.object){const n=W.objectKeys(t),a=W.objectKeys(e).filter((e=>-1!==n.indexOf(e))),r={...e,...t};for(const n of a){const a=qe(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(n===$.array&&a===$.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=qe(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===$.date&&a===$.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}Ve.create=(e,t)=>new Ve({options:e,typeName:pt.ZodUnion,...le(t)});class Ye extends ce{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(ne(e)||ne(a))return X;const r=qe(e.value,a.value);return r.valid?((ae(e)||ae(a))&&t.dirty(),{status:t.value,value:r.data}):(J(n,{code:G.invalid_intersection_types}),X)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Ye.create=(e,t,n)=>new Ye({left:e,right:t,typeName:pt.ZodIntersection,...le(n)});class Qe extends ce{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.array)return J(n,{code:G.invalid_type,expected:$.array,received:n.parsedType}),X;if(n.data.length<this._def.items.length)return J(n,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X;!this._def.rest&&n.data.length>this._def.items.length&&(J(n,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new se(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>K.mergeArray(t,e))):K.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Qe({...this._def,rest:e})}}Qe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qe({items:e,typeName:pt.ZodTuple,rest:null,...le(t)})};class Je extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.map)return J(n,{code:G.invalid_type,expected:$.map,received:n.parsedType}),X;const a=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map((([e,t],i)=>({key:a._parse(new se(n,e,n.path,[i,"key"])),value:r._parse(new se(n,t,n.path,[i,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of i){const a=await n.key,r=await n.value;if("aborted"===a.status||"aborted"===r.status)return X;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of i){const a=n.key,r=n.value;if("aborted"===a.status||"aborted"===r.status)return X;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}}Je.create=(e,t,n)=>new Je({valueType:t,keyType:e,typeName:pt.ZodMap,...le(n)});class Ke extends ce{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.set)return J(n,{code:G.invalid_type,expected:$.set,received:n.parsedType}),X;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(J(n,{code:G.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(J(n,{code:G.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const r=this._def.valueType;function i(e){const n=new Set;for(const a of e){if("aborted"===a.status)return X;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const s=[...n.data.values()].map(((e,t)=>r._parse(new se(n,e,n.path,t))));return n.common.async?Promise.all(s).then((e=>i(e))):i(s)}min(e,t){return new Ke({...this._def,minSize:{value:e,message:Q.toString(t)}})}max(e,t){return new Ke({...this._def,maxSize:{value:e,message:Q.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ke.create=(e,t)=>new Ke({valueType:e,minSize:null,maxSize:null,typeName:pt.ZodSet,...le(t)});class Xe extends ce{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Xe.create=(e,t)=>new Xe({getter:e,typeName:pt.ZodLazy,...le(t)});class et extends ce{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return J(t,{received:t.data,code:G.invalid_literal,expected:this._def.value}),X}return{status:"valid",value:e.data}}get value(){return this._def.value}}function tt(e,t){return new nt({values:e,typeName:pt.ZodEnum,...le(t)})}et.create=(e,t)=>new et({value:e,typeName:pt.ZodLiteral,...le(t)});class nt extends ce{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return J(t,{expected:W.joinValues(n),received:t.parsedType,code:G.invalid_type}),X}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return J(t,{received:t.data,code:G.invalid_enum_value,options:n}),X}return te(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return nt.create(e,{...this._def,...t})}exclude(e,t=this._def){return nt.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}nt.create=tt;class at extends ce{_parse(e){const t=W.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==$.string&&n.parsedType!==$.number){const e=W.objectValues(t);return J(n,{expected:W.joinValues(e),received:n.parsedType,code:G.invalid_type}),X}if(this._cache||(this._cache=new Set(W.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=W.objectValues(t);return J(n,{received:n.data,code:G.invalid_enum_value,options:e}),X}return te(e.data)}get enum(){return this._def.values}}at.create=(e,t)=>new at({values:e,typeName:pt.ZodNativeEnum,...le(t)});class rt extends ce{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==$.promise&&!1===t.common.async)return J(t,{code:G.invalid_type,expected:$.promise,received:t.parsedType}),X;const n=t.parsedType===$.promise?t.data:Promise.resolve(t.data);return te(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}rt.create=(e,t)=>new rt({type:e,typeName:pt.ZodPromise,...le(t)});class it extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===pt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,r={addIssue:e=>{J(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===a.type){const e=a.transform(n.data,r);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return X;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?X:"dirty"===a.status||"dirty"===t.value?ee(a.value):a}));{if("aborted"===t.value)return X;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?X:"dirty"===a.status||"dirty"===t.value?ee(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,r);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?X:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?X:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!re(e))return X;const i=a.transform(e.value,r);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>re(e)?Promise.resolve(a.transform(e.value,r)).then((e=>({status:t.value,value:e}))):X))}W.assertNever(a)}}it.create=(e,t,n)=>new it({schema:e,typeName:pt.ZodEffects,effect:t,...le(n)}),it.createWithPreprocess=(e,t,n)=>new it({schema:t,effect:{type:"preprocess",transform:e},typeName:pt.ZodEffects,...le(n)});class st extends ce{_parse(e){return this._getType(e)===$.undefined?te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}st.create=(e,t)=>new st({innerType:e,typeName:pt.ZodOptional,...le(t)});class ot extends ce{_parse(e){return this._getType(e)===$.null?te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ot.create=(e,t)=>new ot({innerType:e,typeName:pt.ZodNullable,...le(t)});class lt extends ce{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===$.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}lt.create=(e,t)=>new lt({innerType:e,typeName:pt.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...le(t)});class ct extends ce{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ie(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new V(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new V(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ct.create=(e,t)=>new ct({innerType:e,typeName:pt.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...le(t)});class ut extends ce{_parse(e){if(this._getType(e)!==$.nan){const t=this._getOrReturnCtx(e);return J(t,{code:G.invalid_type,expected:$.nan,received:t.parsedType}),X}return{status:"valid",value:e.data}}}ut.create=e=>new ut({typeName:pt.ZodNaN,...le(e)}),Symbol("zod_brand");class dt extends ce{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class mt extends ce{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?X:"dirty"===e.status?(t.dirty(),ee(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?X:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new mt({in:e,out:t,typeName:pt.ZodPipeline})}}class ht extends ce{_parse(e){const t=this._def.innerType._parse(e),n=e=>(re(e)&&(e.value=Object.freeze(e.value)),e);return ie(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}var pt;ht.create=(e,t)=>new ht({innerType:e,typeName:pt.ZodReadonly,...le(t)}),Ge.lazycreate,function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(pt||(pt={}));const gt=Pe.create,ft=(Te.create,ut.create,je.create,De.create,He.create,Ze.create,Fe.create,Oe.create,We.create,Re.create,Be.create,ze.create,$e.create),yt=Ge.create,vt=(Ge.strictCreate,Ve.create,Ye.create,Qe.create,Je.create,Ke.create,Xe.create,et.create,nt.create,at.create,rt.create,it.create,st.create,ot.create,it.createWithPreprocess,mt.create,window.wp.i18n),_t={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function wt(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const bt={date:wt({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:wt({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:wt({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},It={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function xt(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;a=e.formattingValues[r]||e.formattingValues[t]}else{const t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;a=e.values[r]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function St(e){return(t,n={})=>{const a=n.width,r=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],i=t.match(r);if(!i)return null;const s=i[0],o=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(o)?function(e){for(let t=0;t<e.length;t++)if(e[t].test(s))return t}(o):function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].test(s))return t}(o);let c;return c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c,{value:c,rest:t.slice(s.length)}}}var Et;const Ct={code:"en-US",formatDistance:(e,t,n)=>{let a;const r=_t[e];return a="string"==typeof r?r:1===t?r.one:r.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:bt,formatRelative:(e,t,n,a)=>It[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:xt({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:xt({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:xt({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:xt({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:xt({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(Et={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(Et.matchPattern);if(!n)return null;const a=n[0],r=e.match(Et.parsePattern);if(!r)return null;let i=Et.valueCallback?Et.valueCallback(r[0]):r[0];return i=t.valueCallback?t.valueCallback(i):i,{value:i,rest:e.slice(a.length)}}),era:St({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:St({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:St({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:St({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:St({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};let kt={};function Mt(){return kt}Math.pow(10,8);const Nt=6048e5,At=Symbol.for("constructDateFrom");function Pt(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&At in e?e[At](t):e instanceof Date?new e.constructor(t):new Date(t)}function Lt(e,t){return Pt(t||e,e)}function Tt(e){const t=Lt(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function jt(e,t){const n=Lt(e,t?.in);return n.setHours(0,0,0,0),n}function Dt(e,t){const n=Lt(e,t?.in);return function(e,t,n){const[a,r]=function(e,...t){const n=Pt.bind(null,e||t.find((e=>"object"==typeof e)));return t.map(n)}(n?.in,e,t),i=jt(a),s=jt(r),o=+i-Tt(i),l=+s-Tt(s);return Math.round((o-l)/864e5)}(n,function(e,t){const n=Lt(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}(n))+1}function Ht(e,t){const n=Mt(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=Lt(e,t?.in),i=r.getDay(),s=(i<a?7:0)+i-a;return r.setDate(r.getDate()-s),r.setHours(0,0,0,0),r}function Zt(e,t){return Ht(e,{...t,weekStartsOn:1})}function Ft(e,t){const n=Lt(e,t?.in),a=n.getFullYear(),r=Pt(n,0);r.setFullYear(a+1,0,4),r.setHours(0,0,0,0);const i=Zt(r),s=Pt(n,0);s.setFullYear(a,0,4),s.setHours(0,0,0,0);const o=Zt(s);return n.getTime()>=i.getTime()?a+1:n.getTime()>=o.getTime()?a:a-1}function Ot(e,t){const n=Lt(e,t?.in),a=+Zt(n)-+function(e,t){const n=Ft(e,t),a=Pt(t?.in||e,0);return a.setFullYear(n,0,4),a.setHours(0,0,0,0),Zt(a)}(n);return Math.round(a/Nt)+1}function Wt(e,t){const n=Lt(e,t?.in),a=n.getFullYear(),r=Mt(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=Pt(t?.in||e,0);s.setFullYear(a+1,0,i),s.setHours(0,0,0,0);const o=Ht(s,t),l=Pt(t?.in||e,0);l.setFullYear(a,0,i),l.setHours(0,0,0,0);const c=Ht(l,t);return+n>=+o?a+1:+n>=+c?a:a-1}function Rt(e,t){const n=Lt(e,t?.in),a=+Ht(n,t)-+function(e,t){const n=Mt(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,r=Wt(e,t),i=Pt(t?.in||e,0);return i.setFullYear(r,0,a),i.setHours(0,0,0,0),Ht(i,t)}(n,t);return Math.round(a/Nt)+1}function Bt(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const zt={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return Bt("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):Bt(n+1,2)},d:(e,t)=>Bt(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>Bt(e.getHours()%12||12,t.length),H:(e,t)=>Bt(e.getHours(),t.length),m:(e,t)=>Bt(e.getMinutes(),t.length),s:(e,t)=>Bt(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return Bt(Math.trunc(a*Math.pow(10,n-3)),t.length)}},$t={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return zt.y(e,t)},Y:function(e,t,n,a){const r=Wt(e,a),i=r>0?r:1-r;return"YY"===t?Bt(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):Bt(i,t.length)},R:function(e,t){return Bt(Ft(e),t.length)},u:function(e,t){return Bt(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return Bt(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return Bt(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return zt.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return Bt(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const r=Rt(e,a);return"wo"===t?n.ordinalNumber(r,{unit:"week"}):Bt(r,t.length)},I:function(e,t,n){const a=Ot(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):Bt(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):zt.d(e,t)},D:function(e,t,n){const a=Dt(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):Bt(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const r=e.getDay(),i=(r-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Bt(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const r=e.getDay(),i=(r-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Bt(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),r=0===a?7:a;switch(t){case"i":return String(r);case"ii":return Bt(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let r;switch(r=12===a?"noon":0===a?"midnight":a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let r;switch(r=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return zt.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):zt.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):Bt(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):Bt(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):zt.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):zt.s(e,t)},S:function(e,t){return zt.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return Gt(a);case"XXXX":case"XX":return Vt(a);default:return Vt(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return Gt(a);case"xxxx":case"xx":return Vt(a);default:return Vt(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ut(a,":");default:return"GMT"+Vt(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ut(a,":");default:return"GMT"+Vt(a,":")}},t:function(e,t,n){return Bt(Math.trunc(+e/1e3),t.length)},T:function(e,t,n){return Bt(+e,t.length)}};function Ut(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),r=Math.trunc(a/60),i=a%60;return 0===i?n+String(r):n+String(r)+t+Bt(i,2)}function Gt(e,t){return e%60==0?(e>0?"-":"+")+Bt(Math.abs(e)/60,2):Vt(e,t)}function Vt(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+Bt(Math.trunc(a/60),2)+t+Bt(a%60,2)}const qt=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Yt=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Qt={p:Yt,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],r=n[2];if(!r)return qt(e,t);let i;switch(a){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;default:i=t.dateTime({width:"full"})}return i.replace("{{date}}",qt(a,t)).replace("{{time}}",Yt(r,t))}},Jt=/^D+$/,Kt=/^Y+$/,Xt=["D","DD","YY","YYYY"];function en(e){return!(!((t=e)instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t))&&"number"!=typeof e||isNaN(+Lt(e)));var t}const tn=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,nn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,an=/^'([^]*?)'?$/,rn=/''/g,sn=/[a-zA-Z]/;function on(e,t,n){const a=Mt(),r=n?.locale??a.locale??Ct,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,o=Lt(e,n?.in);if(!en(o))throw new RangeError("Invalid time value");let l=t.match(nn).map((e=>{const t=e[0];return"p"===t||"P"===t?(0,Qt[t])(e,r.formatLong):e})).join("").match(tn).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:ln(e)};if($t[t])return{isToken:!0,value:e};if(t.match(sn))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));r.localize.preprocessor&&(l=r.localize.preprocessor(o,l));const c={firstWeekContainsDate:i,weekStartsOn:s,locale:r};return l.map((a=>{if(!a.isToken)return a.value;const i=a.value;return(!n?.useAdditionalWeekYearTokens&&function(e){return Kt.test(e)}(i)||!n?.useAdditionalDayOfYearTokens&&function(e){return Jt.test(e)}(i))&&function(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Xt.includes(e))throw new RangeError(a)}(i,t,String(e)),(0,$t[i[0]])(o,i,r.localize,c)})).join("")}function ln(e){const t=e.match(an);return t?t[1].replace(rn,"'"):e}const cn=[{label:(0,vt.__)("Recent","simple-history"),options:[{label:(0,vt.__)("Today","simple-history"),value:"lastdays:1"},{label:(0,vt.__)("Yesterday","simple-history"),value:"yesterday"},{label:(0,vt.__)("Last 7 days","simple-history"),value:"lastdays:7"},{label:(0,vt.__)("Last 14 days","simple-history"),value:"lastdays:14"},{label:(0,vt.__)("Last 30 days","simple-history"),value:"lastdays:30"},{label:(0,vt.__)("Last 60 days","simple-history"),value:"lastdays:60"},{label:(0,vt.__)("Custom range…","simple-history"),value:"customRange"}]}],un=[{label:"",options:[{label:(0,vt.__)("Loading…","simple-history"),value:""}]}],dn=[{label:(0,vt._x)("Debug","Log level in gui","simple-history"),value:"debug"},{label:(0,vt._x)("Info","Log level in gui","simple-history"),value:"info"},{label:(0,vt._x)("Notice","Log level in gui","simple-history"),value:"notice"},{label:(0,vt._x)("Warning","Log level in gui","simple-history"),value:"warning"},{label:(0,vt._x)("Error","Log level in gui","simple-history"),value:"error"},{label:(0,vt._x)("Critical","Log level in gui","simple-history"),value:"critical"},{label:(0,vt._x)("Alert","Log level in gui","simple-history"),value:"alert"},{label:(0,vt._x)("Emergency","Log level in gui","simple-history"),value:"emergency"}],mn="yyyy-MM-dd'T'HH:mm:ss",hn=" - ",pn=on(jt(new Date),mn),gn=on(function(e,t){const n=Lt(e,t?.in);return n.setHours(23,59,59,999),n}(new Date),mn),fn=["id","logger","date_local","date_gmt","message","message_html","message_key","details_data","details_html","loglevel","occasions_id","subsequent_occasions_count","initiator","initiator_data","ip_addresses","via","ai_origin","permalink","sticky","sticky_appended","backfilled","action_links","reactions"];function yn({event:e}){window.location.hash=`#simple-history/event/${e.id}`}function vn(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function wn(e,t,n="wpadmin",a="plugin",r=""){const{addQueryArgs:i}=wp.url,s={utm_source:n,utm_medium:a,utm_campaign:t};return r&&(s.utm_content=r),i(e,s)}async function bn(e){const t={code:null,statusText:null,bodyJson:null,bodyText:null};if(e.headers&&e.status&&e.statusText){const n=e.headers.get("Content-Type");t.code=e.status,t.statusText=e.statusText,n&&n.includes("application/json")?t.bodyJson=await e.json():t.bodyText=await e.text()}else t.bodyText=(0,vt.__)("Unknown error","simple-history");return t}const In=window.wp.hooks,xn=window.wp.primitives;var Sn=r(848);const En=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})});function Cn(e){const{eventsQueryParams:t,eventsTotal:n}=e,a=(0,In.applyFilters)("SimpleHistory.EventsControlBar.showOverflowMenu",!0);return!1===(0,In.applyFilters)("SimpleHistory.showPremiumAddonsMenuGroup",!0)&&!0===a?(0,i.createElement)(s.DropdownMenu,{label:(0,vt.__)("More actions","simple-history"),icon:En,toggleProps:{variant:"tertiary",size:"compact"},className:"sh-ControlBarOverflowMenu"},(({onClose:e})=>(0,i.createElement)(s.Slot,{name:"SimpleHistorySlotEventsControlBarMenu",fillProps:{onClose:e,eventsQueryParams:t,eventsTotal:n}}))):null}const kn=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"})});function Mn(){return(0,i.createElement)("span",{className:"sh-PremiumIndicator","aria-label":(0,vt.__)("Premium feature","simple-history")},"✦")}const Nn=e=>{const{premiumFeatureModalTitle:t,premiumFeatureDescription:n,icon:a,image:r,handleModalClose:o}=e;return(0,i.createElement)(s.Modal,{onRequestClose:o,className:"sh-PremiumFeatureModal",__experimentalHideHeader:!0},(0,i.createElement)("div",{className:"sh-PremiumFeatureModal-icon"},(0,i.createElement)(s.Icon,{icon:a,size:48})),(0,i.createElement)("h2",{className:"sh-PremiumFeatureModal-title"},t),(0,i.createElement)("p",{className:"sh-PremiumFeatureModal-description"},n),(0,i.createElement)("div",{className:"sh-PremiumFeatureModal-imageContainer"},(0,i.createElement)("img",{src:r,alt:t,className:"sh-PremiumFeatureModal-image"})),(0,i.createElement)("div",{className:"sh-PremiumFeatureModal-actions"},(0,i.createElement)(s.Button,{variant:"primary",onClick:()=>{window.open(wn("https://simple-history.com/add-ons/premium/","premium_global_modal")),o()},className:"sh-PremiumFeatureModal-upgradeButton"},(0,vt.__)("Get Premium","simple-history")),(0,i.createElement)("button",{className:"sh-PremiumFeatureModal-later",onClick:o},(0,vt.__)("Maybe later","simple-history"))))},An=(0,c.createContext)(null),Pn=({children:e})=>{const[t,n]=(0,c.useState)(!1),[a,r]=(0,c.useState)({premiumFeatureModalTitle:"",premiumFeatureDescription:"",icon:null,image:""});return(0,i.createElement)(An.Provider,{value:{showModal:(e,t,a,i)=>{r({premiumFeatureModalTitle:e,premiumFeatureDescription:t,icon:a,image:i}),n(!0)}}},e,t&&(0,i.createElement)(Nn,{...a,handleModalClose:()=>{n(!1)}}))},Ln=()=>{const e=(0,c.useContext)(An);if(!e)throw new Error("usePremiumFeaturesModal must be used within a PremiumFeaturesModalProvider");return e};function Tn(){const{showModal:e}=Ln();return(0,i.createElement)(s.Tooltip,{text:(0,vt.__)("Export events to CSV or JSON","simple-history"),delay:400},(0,i.createElement)(s.Button,{icon:kn,variant:"tertiary",size:"compact",onClick:()=>{e((0,vt.__)("Export to CSV or JSON","simple-history"),(0,vt.__)("Export your current log selection to CSV or JSON. Your active filters are applied, so you get exactly the events you need.","simple-history"),kn,"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NTAgMjAwIj4KICA8IS0tIFRhYmxlIHBhbmVsIC0tPgogIDxyZWN0IHg9IjMwIiB5PSIxMCIgd2lkdGg9IjM0MCIgaGVpZ2h0PSIxNDUiIHJ4PSI2IiBmaWxsPSIjZmZmIiBmaWx0ZXI9ImRyb3Atc2hhZG93KDAgMnB4IDRweCByZ2JhKDAsMCwwLDAuMDgpKSIvPgogIDwhLS0gR3JlZW4gaGVhZGVyIGJhciAtLT4KICA8cmVjdCB4PSIzMCIgeT0iMTAiIHdpZHRoPSIzNDAiIGhlaWdodD0iOCIgcng9IjYiIGZpbGw9IiMzZjkzNDkiLz4KICA8cmVjdCB4PSIzMCIgeT0iMTQiIHdpZHRoPSIzNDAiIGhlaWdodD0iNCIgZmlsbD0iIzNmOTM0OSIvPgogIDwhLS0gUm93IDEgLS0+CiAgPHJlY3QgeD0iNDQiIHk9IjI4IiB3aWR0aD0iNTUiIGhlaWdodD0iNiIgcng9IjMiIGZpbGw9IiM2YjcyODAiLz4KICA8cmVjdCB4PSIxMTAiIHk9IjI4IiB3aWR0aD0iNDAiIGhlaWdodD0iNiIgcng9IjMiIGZpbGw9IiM2YjcyODAiLz4KICA8cmVjdCB4PSIxNjIiIHk9IjI4IiB3aWR0aD0iMTAwIiBoZWlnaHQ9IjYiIHJ4PSIzIiBmaWxsPSIjNmI3MjgwIi8+CiAgPHJlY3QgeD0iMjc1IiB5PSIyOCIgd2lkdGg9IjM1IiBoZWlnaHQ9IjYiIHJ4PSIzIiBmaWxsPSIjNmI3MjgwIi8+CiAgPGxpbmUgeDE9IjQ0IiB5MT0iNDIiIHgyPSIzNTUiIHkyPSI0MiIgc3Ryb2tlPSIjZTVlN2ViIiBzdHJva2Utd2lkdGg9IjEiLz4KICA8IS0tIFJvdyAyIC0tPgogIDxyZWN0IHg9IjQ0IiB5PSI1MCIgd2lkdGg9IjU1IiBoZWlnaHQ9IjYiIHJ4PSIzIiBmaWxsPSIjZDFkNWRiIi8+CiAgPHJlY3QgeD0iMTEwIiB5PSI1MCIgd2lkdGg9IjM1IiBoZWlnaHQ9IjYiIHJ4PSIzIiBmaWxsPSIjZDFkNWRiIi8+CiAgPHJlY3QgeD0iMTYyIiB5PSI1MCIgd2lkdGg9IjgwIiBoZWlnaHQ9IjYiIHJ4PSIzIiBmaWxsPSIjZDFkNWRiIi8+CiAgPHJlY3QgeD0iMjc1IiB5PSI1MCIgd2lkdGg9IjMwIiBoZWlnaHQ9IjYiIHJ4PSIzIiBmaWxsPSIjZDFkNWRiIi8+CiAgPCEtLSBSb3cgMiBzdHJpcGUgLS0+CiAgPHJlY3QgeD0iMzAiIHk9IjYzIiB3aWR0aD0iMzQwIiBoZWlnaHQ9IjIyIiBmaWxsPSIjZjBmZGY0Ii8+CiAgPCEtLSBSb3cgMyAtLT4KICA8cmVjdCB4PSI0NCIgeT0iNzAiIHdpZHRoPSI1NSIgaGVpZ2h0PSI2IiByeD0iMyIgZmlsbD0iI2QxZDVkYiIvPgogIDxyZWN0IHg9IjExMCIgeT0iNzAiIHdpZHRoPSI0NSIgaGVpZ2h0PSI2IiByeD0iMyIgZmlsbD0iI2QxZDVkYiIvPgogIDxyZWN0IHg9IjE2MiIgeT0iNzAiIHdpZHRoPSIxMTAiIGhlaWdodD0iNiIgcng9IjMiIGZpbGw9IiNkMWQ1ZGIiLz4KICA8cmVjdCB4PSIyNzUiIHk9IjcwIiB3aWR0aD0iMjUiIGhlaWdodD0iNiIgcng9IjMiIGZpbGw9IiNkMWQ1ZGIiLz4KICA8bGluZSB4MT0iNDQiIHkxPSI4NSIgeDI9IjM1NSIgeTI9Ijg1IiBzdHJva2U9IiNlNWU3ZWIiIHN0cm9rZS13aWR0aD0iMSIvPgogIDwhLS0gUm93IDQgLS0+CiAgPHJlY3QgeD0iNDQiIHk9IjkzIiB3aWR0aD0iNTUiIGhlaWdodD0iNiIgcng9IjMiIGZpbGw9IiNkMWQ1ZGIiLz4KICA8cmVjdCB4PSIxMTAiIHk9IjkzIiB3aWR0aD0iMzAiIGhlaWdodD0iNiIgcng9IjMiIGZpbGw9IiNkMWQ1ZGIiLz4KICA8cmVjdCB4PSIxNjIiIHk9IjkzIiB3aWR0aD0iOTAiIGhlaWdodD0iNiIgcng9IjMiIGZpbGw9IiNkMWQ1ZGIiLz4KICA8cmVjdCB4PSIyNzUiIHk9IjkzIiB3aWR0aD0iNDAiIGhlaWdodD0iNiIgcng9IjMiIGZpbGw9IiNkMWQ1ZGIiLz4KICA8IS0tIFJvdyA0IHN0cmlwZSAtLT4KICA8cmVjdCB4PSIzMCIgeT0iMTA2IiB3aWR0aD0iMzQwIiBoZWlnaHQ9IjIyIiBmaWxsPSIjZjBmZGY0Ii8+CiAgPCEtLSBSb3cgNSAoZmFkZWQpIC0tPgogIDxyZWN0IHg9IjQ0IiB5PSIxMTMiIHdpZHRoPSI1NSIgaGVpZ2h0PSI2IiByeD0iMyIgZmlsbD0iI2U1ZTdlYiIvPgogIDxyZWN0IHg9IjExMCIgeT0iMTEzIiB3aWR0aD0iMzgiIGhlaWdodD0iNiIgcng9IjMiIGZpbGw9IiNlNWU3ZWIiLz4KICA8cmVjdCB4PSIxNjIiIHk9IjExMyIgd2lkdGg9IjcwIiBoZWlnaHQ9IjYiIHJ4PSIzIiBmaWxsPSIjZTVlN2ViIi8+CiAgPHJlY3QgeD0iMjc1IiB5PSIxMTMiIHdpZHRoPSIzMCIgaGVpZ2h0PSI2IiByeD0iMyIgZmlsbD0iI2U1ZTdlYiIvPgogIDwhLS0gRXhwb3J0IGFycm93IC0tPgogIDxsaW5lIHgxPSIzNTAiIHkxPSIxNDAiIHgyPSIzNTAiIHkyPSIxNjUiIHN0cm9rZT0iIzNmOTM0OSIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgPHBvbHlsaW5lIHBvaW50cz0iMzQzLDE1OCAzNTAsMTY4IDM1NywxNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzNmOTM0OSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KICA8IS0tIEZvcm1hdCBjaGlwcyAtLT4KICA8cmVjdCB4PSIzMjAiIHk9IjE3NSIgd2lkdGg9IjQwIiBoZWlnaHQ9IjIwIiByeD0iMTAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzNmOTM0OSIgc3Ryb2tlLXdpZHRoPSIxLjUiLz4KICA8dGV4dCB4PSIzNDAiIHk9IjE4OSIgZm9udC1mYW1pbHk9InN5c3RlbS11aSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxMSIgZmlsbD0iIzNmOTM0OSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC13ZWlnaHQ9IjYwMCI+Q1NWPC90ZXh0PgogIDxyZWN0IHg9IjM2OCIgeT0iMTc1IiB3aWR0aD0iNDgiIGhlaWdodD0iMjAiIHJ4PSIxMCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMjI3MWIxIiBzdHJva2Utd2lkdGg9IjEuNSIvPgogIDx0ZXh0IHg9IjM5MiIgeT0iMTg5IiBmb250LWZhbWlseT0ic3lzdGVtLXVpLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjExIiBmaWxsPSIjMjI3MWIxIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LXdlaWdodD0iNjAwIj5KU09OPC90ZXh0Pgo8L3N2Zz4K")},className:"sh-ControlBarButton sh-ControlBarButton--export"},(0,vt.__)("Export","simple-history"),(0,i.createElement)(Mn,null)))}const jn=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),Dn=(0,Sn.jsx)(xn.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,Sn.jsx)(xn.Path,{d:"M9 11.8l6.1-4.5c.1.4.4.7.9.7h2c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-2c-.6 0-1 .4-1 1v.4l-6.4 4.8c-.2-.1-.4-.2-.6-.2H6c-.6 0-1 .4-1 1v2c0 .6.4 1 1 1h2c.2 0 .4-.1.6-.2l6.4 4.8v.4c0 .6.4 1 1 1h2c.6 0 1-.4 1-1v-2c0-.6-.4-1-1-1h-2c-.5 0-.8.3-.9.7L9 12.2v-.4z"})}),Hn=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})});function Zn(){const[e,t]=(0,c.useState)(!1),[n,a]=(0,c.useState)(!1),[r,o]=(0,c.useState)(!1),l=(0,c.useRef)(null),u=(0,c.useRef)(null),d=(0,c.useCallback)((()=>{t(!1),a(!1),o(!1)}),[]);return(0,c.useEffect)((()=>(e&&!r&&(u.current=setTimeout(d,5e3)),()=>{u.current&&clearTimeout(u.current)})),[e,r,d]),(0,i.createElement)(i.Fragment,null,(0,i.createElement)(s.Tooltip,{text:(0,vt.__)("Copy a link to this filtered view","simple-history"),delay:400},(0,i.createElement)(s.Button,{ref:l,icon:n?jn:Dn,variant:"tertiary",size:"compact",onClick:()=>{(e=>{if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e).then((()=>!0),(()=>!1));try{const t=document.createElement("input");t.value=e,document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),Promise.resolve(n)}catch{return Promise.resolve(!1)}})(window.location.href).then((e=>{a(e),o(!e),t(!0)}))},className:"sh-ControlBarButton sh-ControlBarButton--share"+(n?" is-copied":"")},(0,vt.__)("Share view","simple-history"))),e&&(0,i.createElement)(s.Popover,{anchor:l.current,noArrow:!1,offset:8,placement:"bottom",shift:!0,animate:!0,className:"sh-SharePopover",onFocusOutside:d,onClose:d},(0,i.createElement)("div",{className:"sh-SharePopover-content",role:"status","aria-live":"polite"},(0,i.createElement)(s.Button,{icon:Hn,label:(0,vt.__)("Close","simple-history"),onClick:d,size:"small",className:"sh-SharePopover-close"}),(0,i.createElement)(s.__experimentalVStack,{spacing:2},(0,i.createElement)(s.__experimentalText,{weight:600,size:13},r?(0,vt.__)("Could not copy automatically","simple-history"):(0,vt.__)("Link copied to clipboard!","simple-history")),(0,i.createElement)(s.__experimentalText,{size:12,color:"var(--sh-color-black-2, #50575e)"},r?(0,vt.__)("Copy the link below and share it to show your current log view.","simple-history"):(0,vt.__)("Paste it in an email or chat to share your current log view.","simple-history")),r&&(0,i.createElement)(s.__experimentalInputControl,{value:window.location.href,readOnly:!0,size:"small",className:"sh-SharePopover-url","aria-label":(0,vt.__)("Shareable link","simple-history"),onClick:e=>e.target.select()})))))}const Fn=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M17 11.5c0 1.353.17 2.368.976 3 .266.209.602.376 1.024.5v1H5v-1c.422-.124.757-.291 1.024-.5.806-.632.976-1.647.976-3V9c0-2.8 2.2-5 5-5s5 2.2 5 5v2.5ZM15.5 9v2.5c0 .93.066 1.98.515 2.897l.053.103H7.932a4.018 4.018 0 0 0 .053-.103c.449-.917.515-1.967.515-2.897V9c0-1.972 1.528-3.5 3.5-3.5s3.5 1.528 3.5 3.5Zm-5.492 9.008c0-.176.023-.346.065-.508h3.854A1.996 1.996 0 0 1 12 20c-1.1 0-1.992-.892-1.992-1.992Z"})});function On({hasActiveFilters:e}){const{showModal:t}=Ln(),n=e?(0,vt.__)("Get alerts when events like these happen","simple-history"):(0,vt.__)("Get alerts via email, Slack, and more","simple-history");return(0,i.createElement)(s.Tooltip,{text:n,delay:400},(0,i.createElement)(s.Button,{icon:Fn,variant:"tertiary",size:"compact",onClick:()=>{const n=e?(0,vt.__)("Get notified when events like these happen. Receive instant alerts via email, Slack, Discord, or Telegram — based on the filters you just set.","simple-history"):(0,vt.__)("Get notified when important events happen. Set up filters to target specific activity — like failed logins or plugin changes — then receive instant alerts via email, Slack, Discord, or Telegram.","simple-history");t((0,vt.__)("Get Instant Alerts","simple-history"),n,Fn,"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NTAgMjAwIj4KICA8IS0tIEV2ZW50IGNhcmQgLS0+CiAgPHJlY3QgeD0iNzUiIHk9IjE1IiB3aWR0aD0iMzAwIiBoZWlnaHQ9IjUwIiByeD0iNiIgZmlsbD0iI2ZmZiIgZmlsdGVyPSJkcm9wLXNoYWRvdygwIDJweCA0cHggcmdiYSgwLDAsMCwwLjA4KSkiLz4KICA8IS0tIEV2ZW50IHR5cGUgaW5kaWNhdG9yIC0tPgogIDxyZWN0IHg9IjkwIiB5PSIzMCIgd2lkdGg9IjgiIGhlaWdodD0iMjAiIHJ4PSIyIiBmaWxsPSIjM2Y5MzQ5Ii8+CiAgPCEtLSBFdmVudCB0ZXh0IGJhcnMgLS0+CiAgPHJlY3QgeD0iMTA4IiB5PSIzMCIgd2lkdGg9IjE0MCIgaGVpZ2h0PSI3IiByeD0iMyIgZmlsbD0iIzZiNzI4MCIvPgogIDxyZWN0IHg9IjEwOCIgeT0iNDQiIHdpZHRoPSI4MCIgaGVpZ2h0PSI2IiByeD0iMyIgZmlsbD0iI2QxZDVkYiIvPgogIDwhLS0gVGltZXN0YW1wIC0tPgogIDxyZWN0IHg9IjMxMCIgeT0iMzQiIHdpZHRoPSI1MCIgaGVpZ2h0PSI2IiByeD0iMyIgZmlsbD0iI2QxZDVkYiIvPgogIDwhLS0gQ29ubmVjdGluZyBsaW5lcyBmcm9tIGNhcmQgdG8gY2hhbm5lbHMgLS0+CiAgPGxpbmUgeDE9IjIyNSIgeTE9IjY1IiB4Mj0iMjI1IiB5Mj0iOTAiIHN0cm9rZT0iI2QxZDVkYiIgc3Ryb2tlLXdpZHRoPSIxLjUiLz4KICA8bGluZSB4MT0iMjI1IiB5MT0iOTAiIHgyPSIxMTAiIHkyPSIxMTUiIHN0cm9rZT0iI2QxZDVkYiIgc3Ryb2tlLXdpZHRoPSIxLjUiLz4KICA8bGluZSB4MT0iMjI1IiB5MT0iOTAiIHgyPSIyMjUiIHkyPSIxMTUiIHN0cm9rZT0iI2QxZDVkYiIgc3Ryb2tlLXdpZHRoPSIxLjUiLz4KICA8bGluZSB4MT0iMjI1IiB5MT0iOTAiIHgyPSIzNDAiIHkyPSIxMTUiIHN0cm9rZT0iI2QxZDVkYiIgc3Ryb2tlLXdpZHRoPSIxLjUiLz4KICA8IS0tIEVtYWlsIGNoaXAgLS0+CiAgPHJlY3QgeD0iNjUiIHk9IjExNSIgd2lkdGg9IjkwIiBoZWlnaHQ9IjM2IiByeD0iNiIgZmlsbD0iI2ZmZiIgZmlsdGVyPSJkcm9wLXNoYWRvdygwIDJweCA0cHggcmdiYSgwLDAsMCwwLjA4KSkiLz4KICA8IS0tIEVudmVsb3BlIGljb24gLS0+CiAgPHJlY3QgeD0iNzgiIHk9IjEyNiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjEyIiByeD0iMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNmI3MjgwIiBzdHJva2Utd2lkdGg9IjEuNSIvPgogIDxwb2x5bGluZSBwb2ludHM9Ijc4LDEyNiA4NiwxMzMgOTQsMTI2IiBmaWxsPSJub25lIiBzdHJva2U9IiM2YjcyODAiIHN0cm9rZS13aWR0aD0iMS41Ii8+CiAgPHJlY3QgeD0iMTAwIiB5PSIxMzAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI2IiByeD0iMyIgZmlsbD0iI2QxZDVkYiIvPgogIDwhLS0gRW1haWwgbm90aWZpY2F0aW9uIGRvdCAtLT4KICA8Y2lyY2xlIGN4PSIxNTAiIGN5PSIxMTkiIHI9IjUiIGZpbGw9IiMyMjcxYjEiLz4KICA8IS0tIFNsYWNrIGNoaXAgLS0+CiAgPHJlY3QgeD0iMTgwIiB5PSIxMTUiIHdpZHRoPSI5MCIgaGVpZ2h0PSIzNiIgcng9IjYiIGZpbGw9IiNmZmYiIGZpbHRlcj0iZHJvcC1zaGFkb3coMCAycHggNHB4IHJnYmEoMCwwLDAsMC4wOCkpIi8+CiAgPCEtLSBIYXNoIGljb24gZm9yIFNsYWNrIC0tPgogIDx0ZXh0IHg9IjE5OCIgeT0iMTM5IiBmb250LWZhbWlseT0ic3lzdGVtLXVpLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE1IiBmaWxsPSIjNmI3MjgwIiBmb250LXdlaWdodD0iNzAwIj4jPC90ZXh0PgogIDxyZWN0IHg9IjIxMiIgeT0iMTMwIiB3aWR0aD0iNDIiIGhlaWdodD0iNiIgcng9IjMiIGZpbGw9IiNkMWQ1ZGIiLz4KICA8IS0tIFNsYWNrIG5vdGlmaWNhdGlvbiBkb3QgLS0+CiAgPGNpcmNsZSBjeD0iMjY1IiBjeT0iMTE5IiByPSI1IiBmaWxsPSIjMjI3MWIxIi8+CiAgPCEtLSBUZWxlZ3JhbS9EaXNjb3JkIGNoaXAgLS0+CiAgPHJlY3QgeD0iMjk1IiB5PSIxMTUiIHdpZHRoPSI5MCIgaGVpZ2h0PSIzNiIgcng9IjYiIGZpbGw9IiNmZmYiIGZpbHRlcj0iZHJvcC1zaGFkb3coMCAycHggNHB4IHJnYmEoMCwwLDAsMC4wOCkpIi8+CiAgPCEtLSBQYXBlciBwbGFuZSBpY29uIC0tPgogIDxwb2x5Z29uIHBvaW50cz0iMzEwLDEyNSAzMjYsMTMzIDMxMCwxNDEgMzE0LDEzMyIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNmI3MjgwIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgogIDxyZWN0IHg9IjMzMiIgeT0iMTMwIiB3aWR0aD0iMzgiIGhlaWdodD0iNiIgcng9IjMiIGZpbGw9IiNkMWQ1ZGIiLz4KICA8IS0tIFRlbGVncmFtIG5vdGlmaWNhdGlvbiBkb3QgLS0+CiAgPGNpcmNsZSBjeD0iMzgwIiBjeT0iMTE5IiByPSI1IiBmaWxsPSIjMjI3MWIxIi8+CiAgPCEtLSBTbWFsbCBsYWJlbHMgdW5kZXIgY2hpcHMgLS0+CiAgPHRleHQgeD0iMTEwIiB5PSIxNjYiIGZvbnQtZmFtaWx5PSJzeXN0ZW0tdWksIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iOSIgZmlsbD0iIzZiNzI4MCIgdGV4dC1hbmNob3I9Im1pZGRsZSI+RW1haWw8L3RleHQ+CiAgPHRleHQgeD0iMjI1IiB5PSIxNjYiIGZvbnQtZmFtaWx5PSJzeXN0ZW0tdWksIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iOSIgZmlsbD0iIzZiNzI4MCIgdGV4dC1hbmNob3I9Im1pZGRsZSI+U2xhY2s8L3RleHQ+CiAgPHRleHQgeD0iMzQwIiB5PSIxNjYiIGZvbnQtZmFtaWx5PSJzeXN0ZW0tdWksIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iOSIgZmlsbD0iIzZiNzI4MCIgdGV4dC1hbmNob3I9Im1pZGRsZSI+VGVsZWdyYW08L3RleHQ+Cjwvc3ZnPgo=")},className:"sh-ControlBarButton sh-ControlBarButton--alert"},(0,vt.__)("Create alert","simple-history"),(0,i.createElement)(Mn,null)))}const Wn=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6zM10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6z"})});function Rn(){const{showModal:e}=Ln(),{userCanManageOptions:t}=g();return t?(0,i.createElement)(s.Tooltip,{text:(0,vt.__)("Add a custom note to the activity log","simple-history"),delay:400},(0,i.createElement)(s.Button,{icon:Wn,variant:"tertiary",size:"compact",onClick:()=>{e((0,vt.__)("Add Custom Log Entries","simple-history"),(0,vt.__)("Add custom events to your activity log with a simple form. Perfect for noting important changes or decisions that happen outside WordPress.","simple-history"),Wn,"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NTAgMjAwIj4KICA8IS0tIEJhY2tncm91bmQgbG9nIGxpc3QgKHBhcnRpYWxseSB2aXNpYmxlIGJlaGluZCBmb3JtKSAtLT4KICA8cmVjdCB4PSI0MCIgeT0iNSIgd2lkdGg9IjMwMCIgaGVpZ2h0PSI4MCIgcng9IjYiIGZpbGw9IiNmZmYiIGZpbHRlcj0iZHJvcC1zaGFkb3coMCAxcHggMnB4IHJnYmEoMCwwLDAsMC4wNikpIi8+CiAgPCEtLSBOZXcgZW50cnkgaW5kaWNhdG9yIGRvdCAtLT4KICA8Y2lyY2xlIGN4PSI1NiIgY3k9IjIyIiByPSI1IiBmaWxsPSIjM2Y5MzQ5Ii8+CiAgPHJlY3QgeD0iNjgiIHk9IjE4IiB3aWR0aD0iMTIwIiBoZWlnaHQ9IjciIHJ4PSIzIiBmaWxsPSIjNmI3MjgwIi8+CiAgPHJlY3QgeD0iNjgiIHk9IjMyIiB3aWR0aD0iNzAiIGhlaWdodD0iNiIgcng9IjMiIGZpbGw9IiNkMWQ1ZGIiLz4KICA8bGluZSB4MT0iNTAiIHkxPSI0NiIgeDI9IjMzMCIgeTI9IjQ2IiBzdHJva2U9IiNlNWU3ZWIiIHN0cm9rZS13aWR0aD0iMSIvPgogIDwhLS0gRXhpc3Rpbmcgcm93IC0tPgogIDxjaXJjbGUgY3g9IjU2IiBjeT0iNTgiIHI9IjUiIGZpbGw9IiNkMWQ1ZGIiLz4KICA8cmVjdCB4PSI2OCIgeT0iNTQiIHdpZHRoPSIxMDAiIGhlaWdodD0iNyIgcng9IjMiIGZpbGw9IiNkMWQ1ZGIiLz4KICA8cmVjdCB4PSI2OCIgeT0iNjgiIHdpZHRoPSI2MCIgaGVpZ2h0PSI2IiByeD0iMyIgZmlsbD0iI2U1ZTdlYiIvPgoKICA8IS0tIEZvcm0gcGFuZWwgKGZvcmVncm91bmQsIG92ZXJsYXBwaW5nKSAtLT4KICA8cmVjdCB4PSI4MCIgeT0iNTUiIHdpZHRoPSIzMTAiIGhlaWdodD0iMTM4IiByeD0iNiIgZmlsbD0iI2ZmZiIgZmlsdGVyPSJkcm9wLXNoYWRvdygwIDJweCA2cHggcmdiYSgwLDAsMCwwLjEyKSkiLz4KICA8IS0tIFRpdGxlIGxhYmVsIC0tPgogIDxyZWN0IHg9IjEwMCIgeT0iNzIiIHdpZHRoPSI1MCIgaGVpZ2h0PSI2IiByeD0iMyIgZmlsbD0iIzZiNzI4MCIvPgogIDwhLS0gVGl0bGUgaW5wdXQgLS0+CiAgPHJlY3QgeD0iMTAwIiB5PSI4NCIgd2lkdGg9IjI3MCIgaGVpZ2h0PSIyNiIgcng9IjQiIGZpbGw9IiNmZmYiIHN0cm9rZT0iI2U1ZTdlYiIgc3Ryb2tlLXdpZHRoPSIxLjUiLz4KICA8cmVjdCB4PSIxMTAiIHk9Ijk0IiB3aWR0aD0iMTAwIiBoZWlnaHQ9IjYiIHJ4PSIzIiBmaWxsPSIjZTVlN2ViIi8+CiAgPCEtLSBEZXNjcmlwdGlvbiBsYWJlbCAtLT4KICA8cmVjdCB4PSIxMDAiIHk9IjEyMCIgd2lkdGg9IjcwIiBoZWlnaHQ9IjYiIHJ4PSIzIiBmaWxsPSIjNmI3MjgwIi8+CiAgPCEtLSBEZXNjcmlwdGlvbiB0ZXh0YXJlYSAtLT4KICA8cmVjdCB4PSIxMDAiIHk9IjEzMiIgd2lkdGg9IjI3MCIgaGVpZ2h0PSI0MCIgcng9IjQiIGZpbGw9IiNmZmYiIHN0cm9rZT0iI2U1ZTdlYiIgc3Ryb2tlLXdpZHRoPSIxLjUiLz4KICA8cmVjdCB4PSIxMTAiIHk9IjE0MyIgd2lkdGg9IjIwMCIgaGVpZ2h0PSI1IiByeD0iMiIgZmlsbD0iI2U1ZTdlYiIvPgogIDxyZWN0IHg9IjExMCIgeT0iMTU1IiB3aWR0aD0iMTQwIiBoZWlnaHQ9IjUiIHJ4PSIyIiBmaWxsPSIjZTVlN2ViIi8+CiAgPCEtLSBTdWJtaXQgYnV0dG9uIC0tPgogIDxyZWN0IHg9IjMwNiIgeT0iMTc4IiB3aWR0aD0iNjQiIGhlaWdodD0iMjQiIHJ4PSI0IiBmaWxsPSIjM2Y5MzQ5Ii8+CiAgPHJlY3QgeD0iMzE4IiB5PSIxODciIHdpZHRoPSI0MCIgaGVpZ2h0PSI2IiByeD0iMyIgZmlsbD0iI2ZmZiIvPgo8L3N2Zz4K")},className:"sh-ControlBarButton sh-ControlBarButton--createEntry"},(0,vt.__)("Add log entry","simple-history"),(0,i.createElement)(Mn,null))):null}function Bn(e){const{eventsIsLoading:t,eventsTotal:n,eventsQueryParams:a,hasAnyActiveFilters:r,newEventsNotifier:o}=e,{alertsPageURL:l,userCanManageOptions:c,searchOptionsLoaded:u}=g(),d=(0,In.applyFilters)("SimpleHistory.EventsControlBar.showPromoButtons",!0),m=(0,In.applyFilters)("SimpleHistory.showPremiumAddonsMenuGroup",!0),h=d&&!1!==m,p=t?(0,i.createElement)(i.Fragment,null,(0,i.createElement)(s.Spinner,{style:{margin:0}}),!n&&(0,i.createElement)(s.__experimentalText,{as:"span"},(0,vt._x)("Loading…","Message visible while waiting for log to load from server the first time","simple-history"))):null,f=n?(0,i.createElement)(s.__experimentalText,{as:"span"},r?(0,vt.sprintf)(/* translators: %s: number of matching events */ /* translators: %s: number of matching events */ (0,vt._n)("%s matching event","%s matching events",n,"simple-history"),n):(0,vt.sprintf)(/* translators: %s: number of events. Events are grouped so similar events are counted as one. */ /* translators: %s: number of events. Events are grouped so similar events are counted as one. */ (0,vt._n)("%s event","%s events",n,"simple-history"),n)):null;return(0,i.createElement)("div",{className:"sh-EventsControlBar-actions"},(0,i.createElement)(s.Flex,{gap:2,justify:"space-between",align:"center",wrap:!1},(0,i.createElement)(s.FlexItem,null,(0,i.createElement)(s.__experimentalHStack,{spacing:2,wrap:!1},f,p,o)),(0,i.createElement)(s.FlexItem,null,(0,i.createElement)(s.__experimentalHStack,{spacing:1,wrap:!1,className:"sh-ControlBarButtons",style:{opacity:u?1:0,transition:"opacity 0.15s ease-in"}},h&&(0,i.createElement)(Tn,null),h&&(0,i.createElement)(On,{hasActiveFilters:r}),h&&(0,i.createElement)(Rn,null),(0,i.createElement)(s.Slot,{name:"SimpleHistorySlotControlBarButtons",fillProps:{eventsQueryParams:a,eventsTotal:n,hasAnyActiveFilters:r,alertsPageURL:l,userCanManageOptions:c}}),(0,i.createElement)(Zn,null))),(0,i.createElement)(Cn,{eventsQueryParams:a,eventsTotal:n})))}function zn(e){var t,n,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=zn(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function $n(){for(var e,t,n=0,a="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=zn(e))&&(a&&(a+=" "),a+=t);return a}const Un=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z"})}),Gn=(0,Sn.jsxs)(xn.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,Sn.jsx)(xn.Path,{d:"M7.5 12C7.5 11.1716 6.82843 10.5 6 10.5C5.17157 10.5 4.5 11.1716 4.5 12C4.5 12.8284 5.17157 13.5 6 13.5C6.82843 13.5 7.5 12.8284 7.5 12Z"}),(0,Sn.jsx)(xn.Path,{d:"M13.5 12C13.5 11.1716 12.8284 10.5 12 10.5C11.1716 10.5 10.5 11.1716 10.5 12C10.5 12.8284 11.1716 13.5 12 13.5C12.8284 13.5 13.5 12.8284 13.5 12Z"}),(0,Sn.jsx)(xn.Path,{d:"M19.5 12C19.5 11.1716 18.8284 10.5 18 10.5C17.1716 10.5 16.5 11.1716 16.5 12C16.5 12.8284 17.1716 13.5 18 13.5C18.8284 13.5 19.5 12.8284 19.5 12Z"})]}),Vn=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"})});function qn({icon:e,label:t,labelCopied:n,payload:a}){const[r,o]=(0,c.useState)(!1),l=(0,m.useCopyToClipboard)(a,(()=>{o(!0),setTimeout((()=>o(!1)),2e3)}));return(0,i.createElement)(s.MenuItem,{icon:r?jn:e,ref:l},(0,i.createElement)("span",{style:r?{color:"#00a32a"}:void 0},r?n:t))}const Yn=new Map,Qn=new Map;function Jn(e){const[t,n]=(0,c.useState)((()=>{var t,n;return null!==(t=null!==(n=e.context)&&void 0!==n?n:Yn.get(e.id))&&void 0!==t?t:null}));return(0,c.useEffect)((()=>{if(t)return;let a=!1;return function(e){if(Qn.has(e))return Qn.get(e);const t=d()({path:(0,f.addQueryArgs)(`/simple-history/v1/events/${e}`,{_fields:"context"})}).then((t=>{var n;const a=null!==(n=t?.context)&&void 0!==n?n:{};return function(e,t){Yn.size>=50&&!Yn.has(e)&&Yn.delete(Yn.keys().next().value),Yn.set(e,t)}(e,a),a})).finally((()=>{Qn.delete(e)}));return Qn.set(e,t),t}(e.id).then((e=>{a||n(e)})).catch((()=>{})),()=>{a=!0}}),[e.id,t]),(0,c.useMemo)((()=>t?{...e,context:t}:e),[e,t])}function Kn(e){return null==e?"":String(e).replace(/\|/g,"\\|").replace(/\n/g," ")}function Xn({event:e}){const t=(0,c.useMemo)((()=>function(e){const t=e.initiator_data||{},n=t.user_display_name||t.user_login||"",a=t.user_email?`(${t.user_email})`:"";let r="";if(e.date_local){const t=new Date(e.date_local.replace(" ","T")),n=t.getFullYear(),a=t.toLocaleString("default",{month:"long"}),i=t.getDate(),s=t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});r=`${n}-${String(t.getMonth()+1).padStart(2,"0")}-${String(i).padStart(2,"0")} (${a.toLowerCase()} ${i} ${n}) at ${s}`}const i=e.via?`• Via ${e.via}`:"";return`${[n,a].filter(Boolean).join(" ")+(r?` • ${r}`:"")+(i?` ${i}`:"")}\n${e.message||""}`}(e)),[e]);return(0,i.createElement)(qn,{icon:Vn,label:(0,vt.__)("Copy event message","simple-history"),labelCopied:(0,vt.__)("Event message copied","simple-history"),payload:t})}function ea({event:e}){const t=Jn(e),n=(0,c.useMemo)((()=>function(e){const t=e.initiator_data||{},n=t.user_display_name||t.user_login||"",a=t.user_email||"",r=[n,a?`(${a})`:""].filter(Boolean).join(" "),i=e.message||"",s=i?i.replace(/\n/g," "):"Event",o=[];e.date_local&&o.push(["When",e.date_local]),r&&o.push(["Who",r]),e.via&&o.push(["Via",e.via]),e.logger&&o.push(["Logger",e.logger]),e.loglevel&&o.push(["Level",e.loglevel]),e.id&&o.push(["Event ID",e.id]),e.permalink&&o.push(["Permalink",e.permalink]);let l=`**${s}**\n\n`;o.length&&(l+="| Field | Value |\n| --- | --- |\n",l+=o.map((([e,t])=>`| ${Kn(e)} | ${Kn(t)} |`)).join("\n"),l+="\n");const c=function(e){if(!Array.isArray(e)||0===e.length)return"";const t=[];for(const n of e){if(!n||!Array.isArray(n.items)||0===n.items.length)continue;const e=[];if(n.title&&(e.push(`### ${n.title}`),e.push("")),n.items.some((e=>void 0!==e.prev_value&&null!==e.prev_value&&""!==e.prev_value))){e.push("| Field | Previous | New |"),e.push("| --- | --- | --- |");for(const t of n.items)e.push(`| ${Kn(t.name)} | ${Kn(t.prev_value)} | ${Kn(t.new_value)} |`)}else{e.push("| Field | Value |"),e.push("| --- | --- |");for(const t of n.items)e.push(`| ${Kn(t.name)} | ${Kn(t.new_value)} |`)}t.push(e.join("\n"))}return t.join("\n\n")}(e.details_data);if(c)l+="\n**Details**\n\n"+c+"\n";else if(e.details_html){const t=function(e){if(!e||"string"!=typeof e)return"";const t=document.createElement("div");return t.innerHTML=e,(t.textContent||t.innerText||"").replace(/\n{3,}/g,"\n\n").trim()}(e.details_html);t&&(l+="\n**Details**\n\n"+t+"\n")}const u=function(e){if(!e||"object"!=typeof e||0===Object.keys(e).length)return"";let t="\n\n| Key | Value |\n| --- | ----- |";for(const[n,a]of Object.entries(e))t+=`\n| ${n} | ${a} |`;return t}(e.context);return u&&(l+=`\n**Context**${u}\n`),l}(t)),[t]);return(0,i.createElement)(qn,{icon:Vn,label:(0,vt.__)("Copy as Markdown","simple-history"),labelCopied:(0,vt.__)("Copied as Markdown","simple-history"),payload:n})}function ta({event:e}){const t=Jn(e),n=(0,c.useMemo)((()=>JSON.stringify(t,null,2)),[t]);return(0,i.createElement)(qn,{icon:Vn,label:(0,vt.__)("Copy as JSON","simple-history"),labelCopied:(0,vt.__)("Copied as JSON","simple-history"),payload:n})}const na=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})});function aa({event:e}){return(0,i.createElement)(qn,{icon:na,label:(0,vt.__)("Copy link to event details","simple-history"),labelCopied:(0,vt.__)("Link copied to clipboard","simple-history"),payload:e.permalink})}const ra=window.wp.date,ia=(0,Sn.jsx)(xn.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,Sn.jsx)(xn.Path,{d:"M12 9.2c-2.2 0-3.9 1.8-3.9 4s1.8 4 3.9 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.4-1.1-2.4-2.5s1.1-2.5 2.4-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM20.2 8c-.1 0-.3 0-.5-.1l-2.5-.8c-.4-.1-.8-.4-1.1-.8l-1-1.5c-.4-.5-1-.9-1.7-.9h-2.9c-.6.1-1.2.4-1.6 1l-1 1.5c-.3.3-.6.6-1.1.7l-2.5.8c-.2.1-.4.1-.6.1-1 .2-1.7.9-1.7 1.9v8.3c0 1 .9 1.9 2 1.9h16c1.1 0 2-.8 2-1.9V9.9c0-1-.7-1.7-1.8-1.9zm.3 10.1c0 .2-.2.4-.5.4H4c-.3 0-.5-.2-.5-.4V9.9c0-.1.2-.3.5-.4.2 0 .5-.1.8-.2l2.5-.8c.7-.2 1.4-.6 1.8-1.3l1-1.5c.1-.1.2-.2.4-.2h2.9c.2 0 .3.1.4.2l1 1.5c.4.7 1.1 1.1 1.9 1.4l2.5.8c.3.1.6.1.8.2.3 0 .4.2.4.4v8.1z"})});var sa={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function oa(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith("#")?null:n}function la(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}var ca=function(e="[snapDOM]",{ttlMs:t=3e5,maxEntries:n=12}={}){let a=new Map,r=0;function i(i,s,o){if(r>=n)return;let l=Date.now();(a.get(s)||0)>l||(a.set(s,l+t),r++,"warn"===i&&console&&console.warn?console.warn(`${e} ${o}`):console&&console.error&&console.error(`${e} ${o}`))}return{warnOnce(e,t){i("warn",e,t)},errorOnce(e,t){i("error",e,t)},reset(){a.clear(),r=0}}}("[snapDOM]",{ttlMs:18e4,maxEntries:10}),ua=new Map,da=new Map;function ma(e){return new Promise(((t,n)=>{let a=new FileReader;a.onload=()=>t(String(a.result||"")),a.onerror=()=>n(new Error("read_failed")),a.readAsDataURL(e)}))}async function ha(e,t={}){let n=t.as??"blob",a=t.timeout??3e3,r=t.useProxy||"",i=t.errorTTL??8e3,s=t.headers||{},o=!!t.silent;if(/^data:/i.test(e))try{if("text"===n)return{ok:!0,data:String(e),status:200,url:e,fromCache:!1};if("dataURL"===n)return{ok:!0,data:String(e),status:200,url:e,fromCache:!1,mime:String(e).slice(5).split(";")[0]||""};let[,t="",a=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],r=/;base64/i.test(t)?atob(a):decodeURIComponent(a),i=new Uint8Array([...r].map((e=>e.charCodeAt(0)))),s=new Blob([i],{type:(t||"").split(";")[0]||""});return{ok:!0,data:s,status:200,url:e,fromCache:!1,mime:s.type||""}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(e))try{let t=await fetch(e);if(!t.ok)return{ok:!1,data:null,status:t.status,url:e,fromCache:!1,reason:"http_error"};let a=await t.blob(),r=a.type||t.headers.get("content-type")||"";return"dataURL"===n?{ok:!0,data:await ma(a),status:t.status,url:e,fromCache:!1,mime:r}:"text"===n?{ok:!0,data:await a.text(),status:t.status,url:e,fromCache:!1,mime:r}:{ok:!0,data:a,status:t.status,url:e,fromCache:!1,mime:r}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(e))return"dataURL"===n?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:e,fromCache:!1,mime:"image/png"}:{ok:!0,data:"text"===n?"":new Blob([]),status:200,url:e,fromCache:!1};let l=function(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}(e,{as:n,timeout:a,useProxy:r,errorTTL:i}),c=da.get(l);if(c&&c.until>Date.now())return{...c.result,fromCache:!0};c&&da.delete(l);let u=ua.get(l);if(u)return u;let d=function(e,t){if(!t||function(e){return/^data:|^blob:|^about:blank$/i.test(e)}(e)||function(e,t){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",a=t.includes("{url}")?t.split("{url}")[0]:t,r=new URL(a||".",n),i=new URL(e,n);if(i.origin===r.origin)return!0;let s=i.searchParams;if(s&&(s.has("url")||s.has("target")))return!0}catch{}return!1}(e,t))return!1;try{let t=typeof location<"u"&&location.href?location.href:"http://localhost/",n=new URL(e,t);return!(typeof location<"u")||n.origin!==location.origin}catch{return!!t}}(e,r)?function(e,t){if(!t)return e;if(t.includes("{url}"))return t.replace("{urlRaw}",la(e)).replace("{url}",encodeURIComponent(e));if(/[?&]url=?$/.test(t))return`${t}${encodeURIComponent(e)}`;if(t.endsWith("?"))return`${t}url=${encodeURIComponent(e)}`;if(t.endsWith("/"))return`${t}${la(e)}`;let n=t.includes("?")?"&":"?";return`${t}${n}url=${encodeURIComponent(e)}`}(e,r):e,m=t.credentials;if(!m)try{let t=typeof location<"u"&&location.href?location.href:"http://localhost/",n=new URL(e,t);m=typeof location<"u"&&n.origin===location.origin?"include":"omit"}catch{m="omit"}let h=new AbortController,p=setTimeout((()=>h.abort("timeout")),a),g=(async()=>{try{let a=await fetch(d,{signal:h.signal,credentials:m,headers:s});if(!a.ok){let r={ok:!1,data:null,status:a.status,url:d,fromCache:!1,reason:"http_error"};if(i>0&&da.set(l,{until:Date.now()+i,result:r}),!o){let t=`${a.status} ${a.statusText||""}`.trim();ca.warnOnce(`http:${a.status}:${n}:${new URL(e,location?.href??"http://localhost/").origin}`,`HTTP error ${t} while fetching ${n} ${e}`)}return t.onError&&t.onError(r),r}if("text"===n)return{ok:!0,data:await a.text(),status:a.status,url:d,fromCache:!1};let r=await a.blob(),c=r.type||a.headers.get("content-type")||"";return"dataURL"===n?{ok:!0,data:await ma(r),status:a.status,url:d,fromCache:!1,mime:c}:{ok:!0,data:r,status:a.status,url:d,fromCache:!1,mime:c}}catch(r){let s=r&&"object"==typeof r&&"name"in r&&"AbortError"===r.name?String(r.message||"").includes("timeout")?"timeout":"abort":"network",c={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:s};if(!/^blob:/i.test(e)&&i>0&&da.set(l,{until:Date.now()+i,result:c}),!o){let t=`${s}:${n}:${new URL(e,location?.href??"http://localhost/").origin}`,r="timeout"===s?`Timeout after ${a}ms. Consider increasing timeout or using a proxy for ${e}`:"abort"===s?`Request aborted while fetching ${n} ${e}`:`Network/CORS issue while fetching ${n} ${e}. A proxy may be required`;ca.errorOnce(t,r)}return t.onError&&t.onError(c),c}finally{clearTimeout(p),ua.delete(l)}})();return ua.set(l,g),g}async function pa(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||"none"===e.trim())return e;let n=oa(e);if(!n)return e;let a=la(n);if(sa.background.has(a)){let e=sa.background.get(a);return e?`url("${e}")`:"none"}try{let e=await ha(a,{as:"dataURL",useProxy:t.useProxy});return e.ok?(sa.background.set(a,e.data),`url("${e.data}")`):(sa.background.set(a,null),"none")}catch{return sa.background.set(a,null),"none"}}var ga=new Set(["meta","script","noscript","title","link","template"]),fa=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]);var ya=/(?:^|-)(animation|transition)(?:-|$)/i,va=/^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,_a=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"]);function wa(e){let t=String(e).toLowerCase();return!!(_a.has(t)||va.test(t)||ya.test(t))}function ba(e,t){if(t=String(t||"").toLowerCase(),fa.has(t))return"";let n=[],a=function(e){if(e=String(e).toLowerCase(),fa.has(e)){let t={};return sa.defaultStyle.set(e,t),t}if(sa.defaultStyle.has(e))return sa.defaultStyle.get(e);let t=document.getElementById("snapdom-sandbox");t||(t=document.createElement("div"),t.id="snapdom-sandbox",t.setAttribute("data-snapdom-sandbox","true"),t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.width="0px",t.style.height="0px",t.style.overflow="hidden",document.body.appendChild(t));let n=document.createElement(e);n.style.all="initial",t.appendChild(n);let a=getComputedStyle(n),r={};for(let e of a){if(wa(e))continue;let t=a.getPropertyValue(e);r[e]=t}return t.removeChild(n),sa.defaultStyle.set(e,r),r}(t);for(let[t,r]of Object.entries(e)){if(wa(t))continue;let e=a[t];r&&r!==e&&n.push(`${t}:${r}`)}return n.sort(),n.join(";")}function Ia(e,t=null){if(!(e instanceof Element))return window.getComputedStyle(e,t);let n=sa.computedStyle.get(e);if(n||(n=new Map,sa.computedStyle.set(e,n)),!n.has(t)){let a=window.getComputedStyle(e,t);n.set(t,a)}return n.get(t)}function xa(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);return t}function Sa(e){let t=[],n=0,a=0;for(let r=0;r<e.length;r++){let i=e[r];"("===i&&n++,")"===i&&n--,","===i&&0===n&&(t.push(e.slice(a,r).trim()),a=r+1)}return t.push(e.slice(a).trim()),t}var Ea=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],Ca=Object.assign({materialIconsFilled:"https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",materialIconsOutlined:"https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",materialIconsRound:"https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",materialIconsSharp:"https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"},typeof window<"u"&&window.__SNAPDOM_ICON_FONTS__||{}),ka=[];function Ma(e){let t="string"==typeof e?e:"",n=[...Ea,...ka];for(let e of n)if(e instanceof RegExp&&e.test(t))return!0;return!!(/icon/i.test(t)||/glyph/i.test(t)||/symbols/i.test(t)||/feather/i.test(t)||/fontawesome/i.test(t))}function Na(e=""){let t=String(e).toLowerCase();return/\bmaterial\s*icons\b/.test(t)||/\bmaterial\s*symbols\b/.test(t)}var Aa=new Map;function Pa(e){let t=e.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(t)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t);if(t&&!n&&"currentcolor"!==t.toLowerCase())return t;let a=e.color?.trim();return a&&"inherit"!==a?a:"#000"}async function La(e,{family:t="Material Icons",weight:n="normal",fontSize:a=32,color:r="#000",variation:i="",className:s=""}={}){let o=String(t||"").replace(/^['"]+|['"]+$/g,""),l=window.devicePixelRatio||1,c=function(e=""){let t,n=Object.create(null),a=String(e||""),r=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g;for(;t=r.exec(a);)n[t[1].toUpperCase()]=Number(t[2]);return n}(i),{familyForMeasure:u,familyForCanvas:d}=await async function(e,t,n){let a=String(e||""),r=a.toLowerCase(),i=String(t||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(r)&&!/\bsymbols\b/.test(r))return{familyForMeasure:a,familyForCanvas:a};if(!/\bmaterial\s*symbols\b/.test(r))return{familyForMeasure:a,familyForCanvas:a};let s=n&&(n.FILL??n.fill),o="outlined";/\brounded\b/.test(i)||/\bround\b/.test(i)?o="rounded":/\bsharp\b/.test(i)?o="sharp":/\boutlined\b/.test(i)&&(o="outlined");let l=null;if(1===s&&("outlined"===o&&Ca.materialIconsFilled?l={url:Ca.materialIconsFilled,alias:"snapdom-mi-filled"}:"rounded"===o&&Ca.materialIconsRound?l={url:Ca.materialIconsRound,alias:"snapdom-mi-round"}:"sharp"===o&&Ca.materialIconsSharp&&(l={url:Ca.materialIconsSharp,alias:"snapdom-mi-sharp"})),!l)return{familyForMeasure:a,familyForCanvas:a};if(!Aa.has(l.alias))try{let e=new FontFace(l.alias,`url(${l.url})`,{style:"normal",weight:"400"});document.fonts.add(e),await e.load(),Aa.set(l.alias,!0)}catch{return{familyForMeasure:a,familyForCanvas:a}}let c=`"${l.alias}"`;return{familyForMeasure:c,familyForCanvas:c}}(o,s,c);await async function(e="Material Icons",t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}(d.replace(/^["']+|["']+$/g,""),a);let m=document.createElement("span");m.textContent=e,m.style.position="absolute",m.style.visibility="hidden",m.style.left="-99999px",m.style.whiteSpace="nowrap",m.style.fontFamily=u,m.style.fontWeight=String(n||"normal"),m.style.fontSize=`${a}px`,m.style.lineHeight="1",m.style.margin="0",m.style.padding="0",m.style.fontFeatureSettings="'liga' 1",m.style.fontVariantLigatures="normal",m.style.color=r,document.body.appendChild(m);let h=m.getBoundingClientRect(),p=Math.max(1,Math.ceil(h.width)),g=Math.max(1,Math.ceil(h.height));document.body.removeChild(m);let f=document.createElement("canvas");f.width=p*l,f.height=g*l;let y=f.getContext("2d");y.scale(l,l),y.font=`${n?`${n} `:""}${a}px ${d}`,y.textAlign="left",y.textBaseline="top",y.fillStyle=r;try{y.fontKerning="normal"}catch{}return y.fillText(e,0,0),{dataUrl:f.toDataURL(),width:p,height:g}}async function Ta(e,t,n,a=32,r="#000"){t=t.replace(/^['"]+|['"]+$/g,"");let i=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let s=document.createElement("span");s.textContent=e,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${t}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${a}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let o=s.getBoundingClientRect(),l=Math.ceil(o.width),c=Math.ceil(o.height);document.body.removeChild(s);let u=document.createElement("canvas");u.width=Math.max(1,l*i),u.height=Math.max(1,c*i);let d=u.getContext("2d");return d.scale(i,i),d.font=n?`${n} ${a}px "${t}"`:`${a}px "${t}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=r,d.fillText(e,0,0),{dataUrl:u.toDataURL(),width:l,height:c}}var ja=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Da(e){if(!e)return"";for(let t of e.split(",")){let e=t.trim().replace(/^['"]+|['"]+$/g,"");if(e&&!ja.has(e.toLowerCase()))return e}return""}function Ha(e){let t=String(e??"400").trim().toLowerCase();if("normal"===t)return 400;if("bold"===t)return 700;let n=parseInt(t,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function Za(e){let t=String(e??"normal").trim().toLowerCase();return t.startsWith("italic")?"italic":t.startsWith("oblique")?"oblique":"normal"}function Fa(e,t){if(!e)return!1;try{let n=new URL(e,location.href);if(n.origin===location.origin)return!0;let a=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some((e=>a.endsWith(e))))return!0;let r=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(r)||/\.woff2?(\b|$)/.test(r))return!0;for(let e of t){let t=e.toLowerCase().replace(/\s+/g,"+"),n=e.toLowerCase().replace(/\s+/g,"-");if(r.includes(t)||r.includes(n))return!0}return!1}catch{return!1}}function Oa(e,t){return e&&e.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,((e,n,a)=>{let r=(a||"").trim();if(!r||/^data:|^blob:|^https?:|^file:|^about:/i.test(r))return e;let i=r;try{i=new URL(r,t||location.href).href}catch{}return`url("${i}")`}))}var Wa=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g;async function Ra(e,t,n){if(!e)return e;let a=new Set;function r(e,t){try{return new URL(e,t||location.href).href}catch{return e}}let i=Oa(e,t||location.href);return i=await async function e(t,i,s=0){if(s>4)return console.warn(`[snapDOM] @import depth exceeded (4) at ${i}`),t;let o,l="",c=0;for(;o=Wa.exec(t);){l+=t.slice(c,o.index),c=Wa.lastIndex;let u=r((o[2]||o[4]||"").trim(),i);if(a.has(u)){console.warn(`[snapDOM] Skipping circular @import: ${u}`);continue}a.add(u);let d="";try{let e=await ha(u,{as:"text",useProxy:n,silent:!0});e.ok&&"string"==typeof e.data&&(d=e.data)}catch{}d?(d=Oa(d,u),d=await e(d,u,s+1),l+=`\n/* inlined: ${u} */\n${d}\n`):l+=o[0]}return l+=t.slice(c),l}(i,t||location.href,0),i}var Ba=/url\((["']?)([^"')]+)\1\)/g,za=/@font-face[^{}]*\{[^}]*\}/g;function $a(e){if(!e)return[];let t=[],n=e.split(",").map((e=>e.trim())).filter(Boolean);for(let e of n){let n=e.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!n)continue;let a=n[1],r=n[2],i=e=>e.includes("?")?[parseInt(e.replace(/\?/g,"0"),16),parseInt(e.replace(/\?/g,"F"),16)]:parseInt(e,16);if(r){let e=i(a),n=i(r),s=Array.isArray(e)?e[0]:e,o=Array.isArray(n)?n[1]:n;t.push([Math.min(s,o),Math.max(s,o)])}else{let e=i(a);Array.isArray(e)?t.push([e[0],e[1]]):t.push([e,e])}}return t}function Ua(e,t){if(!t.length||!e||0===e.size)return!0;for(let n of e)for(let[e,a]of t)if(n>=e&&n<=a)return!0;return!1}function Ga(e,t){let n=[];if(!e)return n;for(let a of e.matchAll(Ba)){let e=(a[2]||"").trim();if(e&&!e.startsWith("data:")){if(!/^https?:/i.test(e))try{e=new URL(e,t||location.href).href}catch{}n.push(e)}}return n}async function Va(e,t,n=""){let a=e;for(let r of e.matchAll(Ba)){let e=oa(r[0]);if(!e)continue;let i=e;if(!i.startsWith("http")&&!i.startsWith("data:"))try{i=new URL(i,t||location.href).href}catch{}if(!Ma(i)){if(sa.resource?.has(i)){sa.font?.add(i),a=a.replace(r[0],`url(${sa.resource.get(i)})`);continue}if(!sa.font?.has(i))try{let e=await ha(i,{as:"dataURL",useProxy:n,silent:!0});if(e.ok&&"string"==typeof e.data){let t=e.data;sa.resource?.set(i,t),sa.font?.add(i),a=a.replace(r[0],`url(${t})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",i)}}}return a}function qa(e={}){let t=new Set((e.families||[]).map((e=>String(e).toLowerCase()))),n=new Set((e.domains||[]).map((e=>String(e).toLowerCase()))),a=new Set((e.subsets||[]).map((e=>String(e).toLowerCase())));return(e,r)=>{if(t.size&&t.has(e.family.toLowerCase()))return!0;if(n.size)for(let t of e.srcUrls)try{if(n.has(new URL(t).host.toLowerCase()))return!0}catch{}if(a.size){let e=function(e){if(!e.length)return null;let t=(t,n)=>e.some((([e,a])=>!(a<t||e>n))),n=t(0,255)||t(305,305),a=t(256,591)||t(7680,7935),r=t(880,1023),i=t(1024,1279);return t(7840,7929)||t(258,259)||t(416,417)||t(431,432)?"vietnamese":i?"cyrillic":r?"greek":a?"latin-ext":n?"latin":null}(r);if(e&&a.has(e))return!0}return!1}}async function Ya(e,t,n,a){let r;try{r=e.cssRules||[]}catch{return}let i=(e,t)=>{try{return new URL(e,t||location.href).href}catch{return e}};for(let e of r)if(e.type===CSSRule.IMPORT_RULE&&e.styleSheet){let r=e.href?i(e.href,t):t;if(a.depth>=4){console.warn(`[snapDOM] CSSOM import depth exceeded (4) at ${r}`);continue}if(r&&a.visitedSheets.has(r)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${r}`);continue}r&&a.visitedSheets.add(r);let s={...a,depth:(a.depth||0)+1};await Ya(e.styleSheet,r,n,s)}else if(e.type===CSSRule.FONT_FACE_RULE){let r=Da((e.style.getPropertyValue("font-family")||"").trim());if(!r||Ma(r))continue;let i=(e.style.getPropertyValue("font-weight")||"400").trim(),s=(e.style.getPropertyValue("font-style")||"normal").trim(),o=(e.style.getPropertyValue("font-stretch")||"100%").trim(),l=(e.style.getPropertyValue("src")||"").trim(),c=(e.style.getPropertyValue("unicode-range")||"").trim();if(!a.faceMatchesRequired(r,s,i,o))continue;let u=$a(c);if(!Ua(a.usedCodepoints,u))continue;let d={family:r,weightSpec:i,styleSpec:s,stretchSpec:o,unicodeRange:c,srcRaw:l,srcUrls:Ga(l,t||location.href),href:t||location.href};if(a.simpleExcluder&&a.simpleExcluder(d,u))continue;if(/url\(/i.test(l)){let e=await Va(l,t||location.href,a.useProxy);await n(`@font-face{font-family:${r};src:${e};font-style:${s};font-weight:${i};font-stretch:${o};${c?`unicode-range:${c};`:""}}`)}else await n(`@font-face{font-family:${r};src:${l};font-style:${s};font-weight:${i};font-stretch:${o};${c?`unicode-range:${c};`:""}}`)}}var Qa=[];function Ja(e){if(!e)return null;if(Array.isArray(e)){let[t,n]=e;return"function"==typeof t?t(n):t}if("object"==typeof e&&"plugin"in e){let{plugin:t,options:n}=e;return"function"==typeof t?t(n):t}return"function"==typeof e?e():e}function Ka(e){return(e&&Array.isArray(e.plugins)?e.plugins:Qa)||Qa}async function Xa(e,t,n){let a=n,r=Ka(t);for(let n of r){let r=n&&"function"==typeof n[e]?n[e]:null;if(!r)continue;let i=await r(t,a);typeof i<"u"&&(a=i)}return a}async function er(e,t,n){let a=[],r=Ka(t);for(let i of r){let r=i&&"function"==typeof i[e]?i[e]:null;if(!r)continue;let s=await r(t,n);typeof s<"u"&&a.push(s)}return a}var tr=r(887),nr=new WeakMap,ar=new Map,rr=0;function ir(){rr++}var sr=!1,or=new WeakMap;async function lr(e,t,n,a){if("STYLE"===e.tagName)return;let r=function(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:ar,defaultStyle:sa.defaultStyle,baseStyle:sa.baseStyle,image:sa.image,resource:sa.resource,background:sa.background,font:sa.font},options:t||{}}:{session:sa.session,persist:{snapshotKeyCache:ar,defaultStyle:sa.defaultStyle,baseStyle:sa.baseStyle,image:sa.image,resource:sa.resource,background:sa.background,font:sa.font},options:e||t||{}}}(n,a),i=r.options&&r.options.cache||"auto";if("disabled"!==i&&function(e=document.documentElement){if(!sr){sr=!0;try{new MutationObserver((()=>ir())).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver((()=>ir())).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",ir),e.ready?.then((()=>ir())).catch((()=>{})))}catch{}}}(document.documentElement),"disabled"===i&&!r.session.__bumpedForDisabled&&(ir(),ar.clear(),r.session.__bumpedForDisabled=!0),fa.has(e.tagName?.toLowerCase())){let n=e.getAttribute?.("style");n&&t.setAttribute("style",n)}let{session:s,persist:o}=r;s.styleCache.has(e)||s.styleCache.set(e,getComputedStyle(e));let l=function(e,t=null,n={}){let a=nr.get(e);if(a&&a.epoch===rr)return a.snapshot;let r=t||getComputedStyle(e),i=function(e,t={}){let n={},a=e.getPropertyValue("visibility");for(let t=0;t<e.length;t++){let a=e[t],r=e.getPropertyValue(a);("background-image"===a||"content"===a)&&r.includes("url(")&&!r.includes("data:")&&(r="none"),n[a]=r}let r=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let t of r)if(!n[t])try{let a=e.getPropertyValue(t);a&&(n[t]=a)}catch{}if(t.embedFonts){let t=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let a of t)if(!n[a])try{let t=e.getPropertyValue(a);t&&(n[a]=t)}catch{}}return"hidden"===a&&(n.opacity="0"),n}(r,n);return function(e,t,n){if(e instanceof HTMLElement&&e.style&&e.style.height)return;let a=e.tagName&&e.tagName.toLowerCase();if(!a||"div"!==a&&"section"!==a&&"article"!==a&&"main"!==a&&"aside"!==a&&"header"!==a&&"footer"!==a&&"nav"!==a&&"ol"!==a&&"ul"!==a&&"li"!==a)return;let r=t.display||"";if(r.includes("flex")||r.includes("grid")||function(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}(e))return;let i=t.position;if("absolute"===i||"fixed"===i||"sticky"===i||"none"!==t.transform||function(e){return!!(e.backgroundImage&&"none"!==e.backgroundImage||e.backgroundColor&&"rgba(0, 0, 0, 0)"!==e.backgroundColor&&"transparent"!==e.backgroundColor||(parseFloat(e.borderTopWidth)||0)>0||(parseFloat(e.borderBottomWidth)||0)>0||(parseFloat(e.paddingTop)||0)>0||(parseFloat(e.paddingBottom)||0)>0)||"visible"!==(e.overflowBlock||e.overflowY||"visible")}(t)||function(e){let t=e.parentElement;if(!t)return!1;let n=getComputedStyle(t).display||"";return n.includes("flex")||n.includes("grid")}(e))return;let s=t.overflowX||t.overflow||"visible",o=t.overflowY||t.overflow||"visible";if("visible"!==s||"visible"!==o)return;let l=t.clip;l&&"auto"!==l&&"rect(auto, auto, auto, auto)"!==l||"hidden"===t.visibility||"0"===t.opacity||function(e,t){if(e.textContent&&/\S/.test(e.textContent))return!0;let n=e.firstElementChild,a=e.lastElementChild;if(n&&"BR"===n.tagName||a&&"BR"===a.tagName)return!0;let r=e.scrollHeight;return 0!==r&&r>(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}(e,t)&&(delete n.height,delete n["block-size"])}(e,r,i),nr.set(e,{epoch:rr,snapshot:i}),i}(e,s.styleCache.get(e),r.options),c=function(e){let t=or.get(e);return t||(t=Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0)).map((([e,t])=>`${e}:${t}`)).join(";"),or.set(e,t),t)}(l),u=o.snapshotKeyCache.get(c);u||(u=ba(l,e.tagName?.toLowerCase()||"div"),o.snapshotKeyCache.set(c,u)),s.styleMap.set(t,u)}var cr=["fill","stroke","color","background-color","stop-color"],ur=new Map;function dr(e,t,n){return Promise.all(e.map((e=>new Promise((a=>{!function r(){(0,tr.a)((n=>{!n||"function"!=typeof n.timeRemaining||n.timeRemaining()>0?t(e,a):r()}),{fast:n})}()})))))}function mr(e,t){try{let n=getComputedStyle(e).getPropertyValue(t).trim();if(n)return n}catch{}try{let e=getComputedStyle(document.documentElement).getPropertyValue(t).trim();if(e)return e}catch{}return""}var hr=new Map;async function pr(e){if(sa.resource?.has(e))return sa.resource.get(e);if(hr.has(e))return hr.get(e);let t=(async()=>{let t=await ha(e,{as:"dataURL",silent:!0});if(!t.ok||"string"!=typeof t.data)throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return sa.resource?.set(e,t.data),t.data})();hr.set(e,t);try{let n=await t;return hr.set(e,n),n}catch(t){throw hr.delete(e),t}}var gr=/\bblob:[^)"'\s]+/g;async function fr(e){if(!e||-1===e.indexOf("blob:"))return e;let t=Array.from(new Set(e.match(gr)||[]));if(0===t.length)return e;let n=e;for(let e of t)try{let t=await pr(e);n=n.split(e).join(t)}catch{}return n}function yr(e){return"string"==typeof e&&e.startsWith("blob:")}function vr(e){return(e||"").split(",").map((e=>e.trim())).filter(Boolean).map((e=>{let t=e.match(/^(\S+)(\s+.+)?$/);return t?{url:t[1],desc:t[2]||""}:null})).filter(Boolean)}function _r(e){return e.map((e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url)).join(", ")}async function wr(e,t,n){if(!e)throw new Error("Invalid node");let a,r=new Set,i=null,s=null;if(e.nodeType===Node.ELEMENT_NODE){let t=(e.localName||e.tagName||"").toLowerCase();if("snapdom-sandbox"===e.id||e.hasAttribute("data-snapdom-sandbox")||ga.has(t))return null}if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return e.cloneNode(!0);if("exclude"===e.getAttribute("data-capture")){if("hide"===n.excludeMode){let t=document.createElement("div"),n=e.getBoundingClientRect();return t.style.cssText=`display:inline-block;width:${n.width}px;height:${n.height}px;visibility:hidden;`,t}if("remove"===n.excludeMode)return null}if(n.exclude&&Array.isArray(n.exclude))for(let t of n.exclude)try{if(e.matches?.(t)){if("hide"===n.excludeMode){let t=document.createElement("div"),n=e.getBoundingClientRect();return t.style.cssText=`display:inline-block;width:${n.width}px;height:${n.height}px;visibility:hidden;`,t}if("remove"===n.excludeMode)return null}}catch(e){console.warn(`Invalid selector in exclude option: ${t}`,e)}if("function"==typeof n.filter)try{if(!n.filter(e)){if("hide"===n.filterMode){let t=document.createElement("div"),n=e.getBoundingClientRect();return t.style.cssText=`display:inline-block;width:${n.width}px;height:${n.height}px;visibility:hidden;`,t}if("remove"===n.filterMode)return null}}catch(e){console.warn("Error in filter function:",e)}if("IFRAME"===e.tagName){let a=!1;try{a=!(!e.contentDocument&&!e.contentWindow?.document)}catch{a=!1}if(a)try{return await async function(e,t,n){let a=await async function(e,t=3){let n=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},a=n(),r=0;for(;r<t&&(!a||!a.body&&!a.documentElement);)await new Promise((e=>setTimeout(e,0))),a=n(),r++;return a&&(a.body||a.documentElement)?a:null}(e,3);if(!a)throw new Error("iframe document not accessible/ready");let{contentWidth:r,contentHeight:i,rect:s}=function(e){let t=e.getBoundingClientRect(),n=0,a=0,r=0,i=0;try{let t=getComputedStyle(e);n=parseFloat(t.borderLeftWidth)||0,a=parseFloat(t.borderRightWidth)||0,r=parseFloat(t.borderTopWidth)||0,i=parseFloat(t.borderBottomWidth)||0}catch{}return{contentWidth:Math.max(0,Math.round(t.width-(n+a))),contentHeight:Math.max(0,Math.round(t.height-(r+i))),rect:t}}(e),o=n?.snap;if(!o||"function"!=typeof o.toPng)throw new Error("snapdom.toPng not available in iframe or window");let l,c={...n,scale:1},u=function(e,t,n){let a=e.createElement("style");return a.setAttribute("data-sd-iframe-pin",""),a.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${t}px !important;height: ${n}px !important;min-width: ${t}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(e.head||e.documentElement).appendChild(a),()=>{try{a.remove()}catch{}}}(a,r,i);try{l=await o.toPng(a.documentElement,c)}finally{u()}l.style.display="block",l.style.width=`${r}px`,l.style.height=`${i}px`;let d=document.createElement("div");return t.nodeMap.set(d,e),lr(e,d,t,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(s.width)}px`),d.style.height||(d.style.height=`${Math.round(s.height)}px`),d.appendChild(l),d}(e,t,n)}catch(e){console.warn("[SnapDOM] iframe rasterization failed, fallback:",e)}if(n.placeholders){let a=document.createElement("div");return a.style.cssText=`width:${e.offsetWidth}px;height:${e.offsetHeight}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,lr(e,a,t,n),a}{let a=e.getBoundingClientRect(),r=document.createElement("div");return r.style.cssText=`display:inline-block;width:${a.width}px;height:${a.height}px;visibility:hidden;`,lr(e,r,t,n),r}}if("placeholder"===e.getAttribute("data-capture")){let a=e.cloneNode(!1);t.nodeMap.set(a,e),lr(e,a,t,n);let r=document.createElement("div");return r.textContent=e.getAttribute("data-placeholder-text")||"",r.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",a.appendChild(r),a}if("CANVAS"===e.tagName){let a="";try{let t=e.getContext("2d",{willReadFrequently:!0});try{t&&t.getImageData(0,0,1,1)}catch{}if(await new Promise((e=>requestAnimationFrame(e))),a=e.toDataURL("image/png"),!a||"data:,"===a){try{t&&t.getImageData(0,0,1,1)}catch{}if(await new Promise((e=>requestAnimationFrame(e))),a=e.toDataURL("image/png"),!a||"data:,"===a){let t=document.createElement("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n&&(n.drawImage(e,0,0),a=t.toDataURL("image/png"))}}}catch{}let r=document.createElement("img");try{r.decoding="sync",r.loading="eager"}catch{}a&&(r.src=a),r.width=e.width,r.height=e.height;try{let t=getComputedStyle(e);t.width&&(r.style.width=t.width),t.height&&(r.style.height=t.height)}catch{}return t.nodeMap.set(r,e),lr(e,r,t,n),r}try{if(a=e.cloneNode(!1),function(e,t){if(!(e instanceof Element&&t instanceof Element))return;let n=e.getAttribute?.("style"),a=!(!n||!n.includes("var("));if(!a&&e.attributes?.length){let t=e.attributes;for(let e=0;e<t.length;e++){let n=t[e];if(n&&"string"==typeof n.value&&n.value.includes("var(")){a=!0;break}}}let r=null;if(a)try{r=getComputedStyle(e)}catch{}if(a){let n=e.style;if(n&&n.length)for(let e=0;e<n.length;e++){let a=n[e],i=n.getPropertyValue(a);if(!i||!i.includes("var("))continue;let s=r&&r.getPropertyValue(a);if(s)try{t.style.setProperty(a,s.trim(),n.getPropertyPriority(a))}catch{}}}if(a&&e.attributes?.length){let n=e.attributes;for(let e=0;e<n.length;e++){let a=n[e];if(!a||"string"!=typeof a.value||!a.value.includes("var("))continue;let i=a.name,s=r&&r.getPropertyValue(i);if(s)try{t.style.setProperty(i,s.trim())}catch{}}}if(!a){if(!r)try{r=getComputedStyle(e)}catch{r=null}if(!r)return;let n=e.namespaceURI||"html",a=function(e,t){let n=t+"::"+e.toLowerCase(),a=ur.get(n);if(a)return a;let r=document,i="http://www.w3.org/2000/svg"===t?r.createElementNS(t,e):r.createElement(e),s=r.createElement("div");s.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",s.appendChild(i),r.documentElement.appendChild(s);let o=getComputedStyle(i),l={};for(let e of cr)l[e]=o.getPropertyValue(e)||"";return s.remove(),ur.set(n,l),l}(e.tagName,n);for(let e of cr){let n=r.getPropertyValue(e)||"",i=a[e]||"";if(n&&n!==i)try{t.style.setProperty(e,n.trim())}catch{}}}}(e,a),t.nodeMap.set(a,e),"IMG"===e.tagName){!function(e,t){try{let n=e.currentSrc||e.src||"";if(!n)return;t.setAttribute("src",n),t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.loading="eager",t.decoding="sync"}catch{}}(e,a);try{let t=e.getBoundingClientRect(),n=Math.round(t.width||0),r=Math.round(t.height||0);if(!n||!r){let t=window.getComputedStyle(e),a=parseFloat(t.width)||0,i=parseFloat(t.height)||0,s=parseInt(e.getAttribute("width")||"",10)||0,o=parseInt(e.getAttribute("height")||"",10)||0,l=e.width||e.naturalWidth||0,c=e.height||e.naturalHeight||0;n=Math.round(n||a||s||l||0),r=Math.round(r||i||o||c||0)}n&&(a.dataset.snapdomWidth=String(n)),r&&(a.dataset.snapdomHeight=String(r))}catch{}try{let t=e.getAttribute("style")||"",n=window.getComputedStyle(e),r=e=>{let a=t.match(new RegExp(`${e}\\s*:\\s*([^;]+)`,"i")),r=a?a[1].trim():n.getPropertyValue(e);return/%|auto/i.test(String(r||""))},i=parseInt(a.dataset.snapdomWidth||"0",10),s=parseInt(a.dataset.snapdomHeight||"0",10),o=r("width")||!i,l=r("height")||!s;o&&i&&(a.style.width=`${i}px`),l&&s&&(a.style.height=`${s}px`),i&&(a.style.minWidth=`${i}px`),s&&(a.style.minHeight=`${s}px`)}catch{}}}catch(t){throw console.error("[Snapdom] Failed to clone node:",e,t),t}if(e instanceof HTMLTextAreaElement){let t=e.getBoundingClientRect();a.style.width=`${t.width}px`,a.style.height=`${t.height}px`}if(e instanceof HTMLInputElement&&(a.value=e.value,a.setAttribute("value",e.value),void 0!==e.checked&&(a.checked=e.checked,e.checked&&a.setAttribute("checked",""),e.indeterminate&&(a.indeterminate=e.indeterminate))),e instanceof HTMLSelectElement&&(i=e.value),e instanceof HTMLTextAreaElement&&(s=e.value),lr(e,a,t,n),e.shadowRoot){let i=function(e,a){if(e.nodeType===Node.ELEMENT_NODE&&"STYLE"===e.tagName)return a(null);wr(e,t,n).then((e=>{a(e||null)})).catch((()=>{a(null)}))};try{let t=e.shadowRoot.querySelectorAll("slot");for(let e of t){let t=[];try{t=e.assignedNodes?.({flatten:!0})||e.assignedNodes?.()||[]}catch{t=e.assignedNodes?.()||[]}for(let e of t)r.add(e)}}catch{}let s=function(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}(t),o=`[data-sd="${s}"]`;try{a.setAttribute("data-sd",s)}catch{}let l=function(e){let t="";try{e.querySelectorAll("style").forEach((e=>{t+=(e.textContent||"")+"\n"}));let n=e.adoptedStyleSheets||[];for(let e of n)try{if(e&&e.cssRules)for(let n of e.cssRules)t+=n.cssText+"\n"}catch{}}catch{}return t}(e.shadowRoot),c=function(e,t){return e?(e=e.replace(/:host\(([^)]+)\)/g,((e,n)=>`:where(${t}:is(${n.trim()}))`)),e=(e=e.replace(/:host\b/g,`:where(${t})`)).replace(/:host-context\(([^)]+)\)/g,((e,n)=>`:where(:where(${n.trim()}) ${t})`)),e=e.replace(/::slotted\(([^)]+)\)/g,((e,n)=>`:where(${t} ${n.trim()})`)),e=e.replace(/(^|})(\s*)([^@}{]+){/g,((e,n,a,r)=>{let i=function(e,t,n=!0){return e.split(",").map((e=>e.trim())).filter(Boolean).map((e=>{if(e.startsWith(":where(")||e.startsWith("@"))return e;let a=n?function(e){return!(e=e.trim())||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}(e):e;return`:where(${t} ${a})`})).join(", ")}(r,t,!0);return`${n}${a}${i}{`})),e):""}(l,o),u=function(e){let t=new Set;if(!e)return t;let n,a=/var\(\s*(--[A-Za-z0-9_-]+)\b/g;for(;n=a.exec(e);)t.add(n[1]);return t}(l),d=function(e,t,n){let a=[];for(let n of t){let t=mr(e,n);t&&a.push(`${n}: ${t};`)}return a.length?`${n}{${a.join("")}}\n`:""}(e,u,o);!function(e,t,n){if(!t)return;let a=document.createElement("style");a.setAttribute("data-sd",n),a.textContent=t,e.insertBefore(a,e.firstChild||null)}(a,d+c,s);let m=document.createDocumentFragment(),h=await dr(Array.from(e.shadowRoot.childNodes),i,n.fast);m.append(...h.filter((e=>!!e))),a.appendChild(m)}if("SLOT"===e.tagName){let a=function(e,a){wr(e,t,n).then((e=>{e&&function(e){e&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute("data-sd-slotted",""),e.querySelectorAll&&e.querySelectorAll("*").forEach((e=>e.setAttribute("data-sd-slotted",""))))}(e),a(e||null)})).catch((()=>{a(null)}))},r=e.assignedNodes?.({flatten:!0})||[],i=r.length>0?r:Array.from(e.childNodes),s=document.createDocumentFragment(),o=await dr(Array.from(i),a,n.fast);return s.append(...o.filter((e=>!!e))),s}let o=await dr(Array.from(e.childNodes),(function(e,a){if(r.has(e))return a(null);wr(e,t,n).then((e=>{a(e||null)})).catch((()=>{a(null)}))}),n.fast);if(a.append(...o.filter((e=>!!e))),null!==i&&a instanceof HTMLSelectElement){a.value=i;for(let e of a.options)e.value===i?e.setAttribute("selected",""):e.removeAttribute("selected")}return null!==s&&a instanceof HTMLTextAreaElement&&(a.textContent=s),a}function br(e,t=!1){let n="",a=Math.max(1,e);for(;a>0;)a--,n=String.fromCharCode(97+a%26)+n,a=Math.floor(a/26);return t?n.toUpperCase():n}function Ir(e,t=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],a=Math.max(1,Math.min(3999,e)),r="";for(let[e,t]of n)for(;a>=e;)r+=t,a-=e;return t?r:r.toLowerCase()}function xr(e,t){switch((t||"decimal").toLowerCase()){case"decimal":default:return String(Math.max(0,e));case"decimal-leading-zero":return(e<10?"0":"")+String(Math.max(0,e));case"lower-alpha":return br(e,!1);case"upper-alpha":return br(e,!0);case"lower-roman":return Ir(e,!1);case"upper-roman":return Ir(e,!0)}}function Sr(e){let t=()=>sa?.session?.__counterEpoch??0,n=t(),a=new WeakMap,r=e instanceof Document?e.documentElement:e,i=e=>{let t=0,n=e?.parentElement;if(!n)return 0;for(let a of n.children){if(a===e)break;"LI"===a.tagName&&t++}return t},s=(e,t,n)=>{let r=((e,t,n)=>{let a,r,s=(e=>{let t=new Map;for(let[n,a]of e)t.set(n,a.slice());return t})(e);try{a=n.style?.counterReset||getComputedStyle(n).counterReset}catch{}if(a&&"none"!==a)for(let e of a.split(",")){let n=e.trim().split(/\s+/),a=n[0],r=Number.isFinite(Number(n[1]))?Number(n[1]):0;if(!a)continue;let i=t.get(a);if(i&&i.length){let e=i.slice();e.push(r),s.set(a,e)}else s.set(a,[r])}try{r=n.style?.counterIncrement||getComputedStyle(n).counterIncrement}catch{}if(r&&"none"!==r)for(let e of r.split(",")){let t=e.trim().split(/\s+/),n=t[0],a=Number.isFinite(Number(t[1]))?Number(t[1]):1;if(!n)continue;let r=s.get(n)||[];0===r.length&&r.push(0),r[r.length-1]+=a,s.set(n,r)}try{if("list-item"===getComputedStyle(n).display&&(e=>e&&"LI"===e.tagName)(n)){let e=n.parentElement,t=1;if(e&&"OL"===e.tagName){let a=e.getAttribute("start"),r=Number.isFinite(Number(a))?Number(a):1,s=i(n),o=n.getAttribute("value");t=Number.isFinite(Number(o))?Number(o):r+s}else t=1+i(n);let a=s.get("list-item")||[];0===a.length&&a.push(0),a[a.length-1]=t,s.set("list-item",a)}}catch{}return s})(n,t,e);a.set(e,r);let o=r;for(let t of e.children)o=s(t,r,o);return r},o=new Map;function l(){let e=t();if(e!==n){n=e;let t=new Map;s(r,t,t)}}return s(r,o,o),{get(e,t){l();let n=a.get(e)?.get(t);return n&&n.length?n[n.length-1]:0},getStack(e,t){l();let n=a.get(e)?.get(t);return n?n.slice():[]}}}var Er=new WeakMap;function Cr(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function kr(e){let t=e.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${t.length}|`,a=0;for(let e=0;e<t.length;e++){let r=t[e];if("STYLE"===r.tagName){n+=`S${r.textContent?r.textContent.length:0}|`;let e=r.sheet,t=e?Cr(e):null;t&&(a+=t.length)}else{n+=`L${r.getAttribute("href")||""}|m:${r.getAttribute("media")||"all"}|`;let e=r.sheet,t=e?Cr(e):null;t&&(a+=t.length)}}let r=e.adoptedStyleSheets;return n+=`ass:${Array.isArray(r)?r.length:0}|tr:${a}`,n}function Mr(e,t,n){let a=Cr(e);if(!a)return!1;for(let e=0;e<a.length;e++){if(n.budget<=0)return!1;let r=a[e],i=r&&r.cssText?r.cssText:"";n.budget--;for(let e of t)if(i.includes(e))return!0;if(r&&r.cssRules&&r.cssRules.length)for(let e=0;e<r.cssRules.length&&n.budget>0;e++){let a=r.cssRules[e],i=a&&a.cssText?a.cssText:"";n.budget--;for(let e of t)if(i.includes(e))return!0}if(n.budget<=0)return!1}return!1}function Nr(e=document){let t=kr(e),n=Er.get(e);if(n&&n.fingerprint===t)return n.result;let a=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],r=e.querySelectorAll("style");for(let n=0;n<r.length;n++){let i=r[n].textContent||"";for(let n of a)if(i.includes(n))return Er.set(e,{fingerprint:t,result:!0}),!0}let i=e.adoptedStyleSheets;if(Array.isArray(i)&&i.length){let n={budget:300};try{for(let r of i)if(Mr(r,a,n))return Er.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let n=e.querySelectorAll('style,link[rel~="stylesheet"]'),r={budget:300};for(let i=0;i<n.length&&r.budget>0;i++){let s=n[i],o=null;if(s.tagName,o=s.sheet||null,o&&Mr(o,a,r))return Er.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector('[style*="counter("], [style*="counters("]')?(Er.set(e,{fingerprint:t,result:!0}),!0):(Er.set(e,{fingerprint:t,result:!1}),!1)}var Ar=new WeakMap,Pr=-1;function Lr(e){if(!e)return"";let t,n=[],a=/"([^"]*)"/g;for(;t=a.exec(e);)n.push(t[1]);return n.length?n.join(""):function(e){return(e||"").replace(/"([^"]*)"/g,"$1")}(e)}function Tr(e,t){let n=e.parentElement,a=n?Ar.get(n):null;return a?{get(e,n){let r=t.get(e,n),i=a.get(n);return"number"==typeof i?Math.max(r,i):r},getStack(e,n){let r=t.getStack(e,n);if(!r.length)return r;let i=a.get(n);if("number"==typeof i){let e=r.slice();return e[e.length-1]=Math.max(e[e.length-1],i),e}return r}}:t}function jr(e,t,n){let a=new Map;function r(e){let t=[];if(!e||"none"===e)return t;for(let n of String(e).split(",")){let e=n.trim().split(/\s+/),a=e[0],r=Number.isFinite(Number(e[1]))?Number(e[1]):void 0;a&&t.push({name:a,num:r})}return t}let i=r(t?.counterReset),s=r(t?.counterIncrement);function o(t){if(a.has(t))return a.get(t).slice();let r=n.getStack(e,t);r=r.length?r.slice():[];let o=i.find((e=>e.name===t));if(o){let e=Number.isFinite(o.num)?o.num:0;r=r.length?[...r,e]:[e]}let l=s.find((e=>e.name===t));if(l){let e=Number.isFinite(l.num)?l.num:1;0===r.length&&(r=[0]),r[r.length-1]+=e}return a.set(t,r.slice()),r}return{get(e,t){let n=o(t);return n.length?n[n.length-1]:0},getStack:(e,t)=>o(t),__incs:s}}function Dr(e,t,n){let a;try{a=getComputedStyle(e,t)}catch{}let r=a?.content;if(!r||"none"===r||"normal"===r)return{text:"",incs:[]};let i=jr(e,a,Tr(e,n)),s=function(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||"")}(r)?function(e,t,n){if(!e||"none"===e)return e;try{let a=/\b(counter|counters)\s*\(([^)]+)\)/g,r=e.replace(a,((e,a,r)=>{let i=String(r).split(",").map((e=>e.trim()));if("counter"===a){let e=i[0]?.replace(/^["']|["']$/g,""),a=(i[1]||"decimal").toLowerCase();return xr(n.get(t,e),a)}{let e=i[0]?.replace(/^["']|["']$/g,""),a=i[1]?.replace(/^["']|["']$/g,"")??"",r=(i[2]||"decimal").toLowerCase(),s=n.getStack(t,e);return s.length?s.map((e=>xr(e,r))).join(a):""}}));return function(e){return(e||"").replace(/"([^"]*)"/g,"$1")}(r)}catch{return"- "}}(r,e,i):r;return{text:Lr(s),incs:i.__incs||[]}}async function Hr(e,t,n,a){if(!(e instanceof Element&&t instanceof Element))return;if(!function(e,t){let n=kr(e);return t?(t.__pseudoPreflightFp!==n&&(t.__pseudoPreflight=Nr(e),t.__pseudoPreflightFp=n),!!t.__pseudoPreflight):Nr(e)}(e.ownerDocument||document,n))return;let r=sa?.session?.__counterEpoch??0;if(Pr!==r&&(Ar=new WeakMap,n&&(n.__counterCtx=null),Pr=r),!n.__counterCtx)try{n.__counterCtx=Sr(e.ownerDocument||document)}catch{}let i=n.__counterCtx;for(let r of["::before","::after","::first-letter"])try{let s=Ia(e,r);if(!s||!("none"!==s.content||"none"!==s.backgroundImage||"transparent"!==s.backgroundColor||"none"!==s.borderStyle&&0!==parseFloat(s.borderWidth)||s.transform&&"none"!==s.transform||"inline"!==s.display))continue;if("::first-letter"===r){let a=getComputedStyle(e);if(s.color===a.color&&s.fontSize===a.fontSize&&s.fontWeight===a.fontWeight)continue;let r=Array.from(t.childNodes).find((e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim().length>0));if(!r)continue;let i=r.textContent,o=i.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],l=i.slice(o?.length||0);if(!o||/[\uD800-\uDFFF]/.test(o))continue;let c=document.createElement("span");c.textContent=o,c.dataset.snapdomPseudo="::first-letter";let u=ba(xa(s),"span");n.styleMap.set(c,u);let d=document.createTextNode(l);t.replaceChild(d,r),t.insertBefore(c,d);continue}let o=s.content??"",l=""===o||"none"===o||"normal"===o,{text:c,incs:u}=Dr(e,r,i),d=s.backgroundImage,m=s.backgroundColor,h=s.fontFamily,p=parseInt(s.fontSize)||32,g=parseInt(s.fontWeight)||!1,f=s.color||"#000",y=s.borderStyle,v=parseFloat(s.borderWidth),_=s.transform,w=Ma(h),b=!l&&""!==c,I=d&&"none"!==d,x=m&&"transparent"!==m&&"rgba(0, 0, 0, 0)"!==m,S=y&&"none"!==y&&v>0,E=_&&"none"!==_;if(!(b||I||x||S||E)){if(u&&u.length&&e.parentElement){let t=Ar.get(e.parentElement)||new Map;for(let{name:n}of u){if(!n)continue;let a=Tr(e,i),s=jr(e,getComputedStyle(e,r),a).get(e,n);t.set(n,s)}Ar.set(e.parentElement,t)}continue}let C=document.createElement("span");C.dataset.snapdomPseudo=r,C.style.pointerEvents="none";let k=ba(xa(s),"span");if(n.styleMap.set(C,k),w&&c&&1===c.length){let{dataUrl:e,width:n,height:a}=await Ta(c,h,g,p,f),r=document.createElement("img");r.src=e,r.style=`height:${p}px;width:${n/a*p}px;object-fit:contain;`,C.appendChild(r),t.dataset.snapdomHasIcon="true"}else if(c&&c.startsWith("url(")){let t=oa(c);if(t?.trim())try{let e=document.createElement("img"),n=await ha(la(t),{as:"dataURL",useProxy:a.useProxy});e.src=n.data,e.style=`width:${p}px;height:auto;object-fit:contain;`,C.appendChild(e)}catch(t){console.error(`[snapdom] Error in pseudo ${r} for`,e,t)}}else!w&&b&&(C.textContent=c);C.style.backgroundImage="none","maskImage"in C.style&&(C.style.maskImage="none"),"webkitMaskImage"in C.style&&(C.style.webkitMaskImage="none");try{C.style.backgroundRepeat=s.backgroundRepeat,C.style.backgroundSize=s.backgroundSize,s.backgroundPositionX&&s.backgroundPositionY?(C.style.backgroundPositionX=s.backgroundPositionX,C.style.backgroundPositionY=s.backgroundPositionY):C.style.backgroundPosition=s.backgroundPosition,C.style.backgroundOrigin=s.backgroundOrigin,C.style.backgroundClip=s.backgroundClip,C.style.backgroundAttachment=s.backgroundAttachment,C.style.backgroundBlendMode=s.backgroundBlendMode}catch{}if(I)try{let e=Sa(d),t=await Promise.all(e.map(pa));C.style.backgroundImage=t.join(", ")}catch(e){console.warn(`[snapdom] Failed to inline background-image for ${r}`,e)}x&&(C.style.backgroundColor=m);let M=C.childNodes.length>0||""!==C.textContent?.trim()||I||x||S||E;if(u&&u.length&&e.parentElement){let t=Ar.get(e.parentElement)||new Map,n=Tr(e,i),a=jr(e,getComputedStyle(e,r),n);for(let{name:n}of u){if(!n)continue;let r=a.get(e,n);t.set(n,r)}Ar.set(e.parentElement,t)}if(!M)continue;"::before"===r?t.insertBefore(C,t.firstChild):t.appendChild(C)}catch(t){console.warn(`[snapdom] Failed to capture ${r} for`,e,t)}let s=Array.from(e.children),o=Array.from(t.children).filter((e=>!e.dataset.snapdomPseudo));for(let e=0;e<Math.min(s.length,o.length);e++)await Hr(s[e],o[e],n,a)}function Zr(e){if(!e||"auto"===e)return null;let t=Number.parseFloat(e);return Number.isFinite(t)?t:null}function Fr(e,t){let n=[];for(let a=e;a&&a!==t;){let e=a.parentElement;if(!e)break;n.push(Array.prototype.indexOf.call(e.children,a)),a=e}return n.reverse()}function Or(e,t,n){let a=e;for(let e=0;e<t.length;e++)if(a=Wr(a,n)[t[e]],!a)return null;return a instanceof HTMLElement?a:null}function Wr(e,t){let n=[],a=e.children;for(let e=0;e<a.length;e++){let r=a[e];r.hasAttribute(t)||n.push(r)}return n}async function Rr(e,t={}){let n,a={styleMap:sa.session.styleMap,styleCache:sa.session.styleCache,nodeMap:sa.session.nodeMap},r="",i="";!function(e){let t=getComputedStyle(e),n=t.outlineStyle,a=t.outlineWidth,r=t.borderStyle,i=t.borderWidth,s="none"!==n&&parseFloat(a)>0,o="none"===r||0===parseFloat(i);s&&o&&(e.style.border=`${a} solid transparent`)}(e);try{!function(e,t){if(!(e&&e instanceof Element))return;let n=e.ownerDocument||document,a=t||n,r=e instanceof SVGSVGElement?[e]:Array.from(e.querySelectorAll("svg"));if(0===r.length)return;let i=/url\(\s*#([^)]+)\)/g,s=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],o=e=>{if(!e||!e.getAttribute)return null;let t=e.getAttribute("href")||e.getAttribute("xlink:href")||("function"==typeof e.getAttributeNS?e.getAttributeNS("http://www.w3.org/1999/xlink","href"):null);if(t)return t;let n=e.attributes;if(!n)return null;for(let e=0;e<n.length;e++){let t=n[e];if(!t||!t.name)continue;if("href"===t.name)return t.value;let a=t.name.indexOf(":");if(-1!==a&&"href"===t.name.slice(a+1))return t.value}return null},l=new Set(Array.from(e.querySelectorAll("[id]")).map((e=>e.id))),c=new Set,u=!1,d=(e,t=null)=>{if(!e)return;let n;for(i.lastIndex=0;n=i.exec(e);){u=!0;let e=(n[1]||"").trim();e&&(l.has(e)||(c.add(e),t&&!t.has(e)&&t.add(e)))}},m=e=>{let t=e.querySelectorAll("use");for(let e of t){let t=o(e);if(!t||!t.startsWith("#"))continue;u=!0;let n=t.slice(1).trim();n&&!l.has(n)&&c.add(n)}let n=e.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let e of n){d(e.getAttribute("style")||"");for(let t of s)d(e.getAttribute(t))}};for(let e of r)m(e);if(!u)return;let h=e.querySelector("svg.inline-defs-container");h||(h=n.createElementNS("http://www.w3.org/2000/svg","svg"),h.classList.add("inline-defs-container"),h.setAttribute("aria-hidden","true"),h.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),e.insertBefore(h,e.firstChild||null));let p=h.querySelector("defs")||null,g=t=>{if(!t||l.has(t))return null;let n=(e=>window.CSS&&CSS.escape?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,"\\$&"))(t),r=t=>{let n=a.querySelector(t);return n&&!e.contains(n)?n:null};return r(`svg defs > *#${n}`)||r(`svg > symbol#${n}`)||r(`*#${n}`)};if(!c.size)return;let f=new Set(c),y=new Set;for(;f.size;){let e=f.values().next().value;if(f.delete(e),!e||l.has(e)||y.has(e))continue;let t=g(e);if(!t){y.add(e);continue}p||(p=n.createElementNS("http://www.w3.org/2000/svg","defs"),h.appendChild(p));let a=t.cloneNode(!0);a.id||a.setAttribute("id",e),p.appendChild(a),y.add(e),l.add(e);let r=[a,...a.querySelectorAll("*")];for(let e of r){let t=o(e);if(t&&t.startsWith("#")){let e=t.slice(1).trim();e&&!l.has(e)&&!y.has(e)&&f.add(e)}let n=e.getAttribute?.("style")||"";n&&d(n,f);for(let t of s){let n=e.getAttribute?.(t);n&&d(n,f)}}}}(e)}catch(e){console.warn("inlineExternal defs or symbol failed:",e)}try{n=await wr(e,a,t)}catch(e){throw console.warn("deepClone failed:",e),e}try{await Hr(e,n,a,t)}catch(e){console.warn("inlinePseudoElements failed:",e)}await async function(e){if(!e)return;let t=e.querySelectorAll?e.querySelectorAll("img"):[];for(let e of t)try{let t=e.getAttribute("src")||e.currentSrc||"";if(yr(t)){let n=await pr(t);e.setAttribute("src",n)}let n=e.getAttribute("srcset");if(n&&n.includes("blob:")){let t=vr(n),a=!1;for(let e of t)if(yr(e.url))try{e.url=await pr(e.url),a=!0}catch{}a&&e.setAttribute("srcset",_r(t))}}catch{}let n=e.querySelectorAll?e.querySelectorAll("image"):[];for(let e of n)try{let t="http://www.w3.org/1999/xlink",n=e.getAttribute("href")||e.getAttributeNS?.(t,"href");if(yr(n)){let a=await pr(n);e.setAttribute("href",a),e.removeAttributeNS?.(t,"href")}}catch{}let a=e.querySelectorAll?e.querySelectorAll("[style*='blob:']"):[];for(let e of a)try{let t=e.getAttribute("style");if(t&&t.includes("blob:")){let n=await fr(t);e.setAttribute("style",n)}}catch{}let r=e.querySelectorAll?e.querySelectorAll("style"):[];for(let e of r)try{let t=e.textContent||"";t.includes("blob:")&&(e.textContent=await fr(t))}catch{}let i=["poster"];for(let t of i){let n=e.querySelectorAll?e.querySelectorAll(`[${t}^='blob:']`):[];for(let e of n)try{let n=e.getAttribute(t);yr(n)&&e.setAttribute(t,await pr(n))}catch{}}}(n);try{let e=n.querySelectorAll("style[data-sd]");for(let t of e)i+=t.textContent||"",t.remove()}catch{}let s=function(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),n=new Map,a=1;for(let e of t)n.set(e,"c"+a++);return n}(a.styleMap);r=Array.from(s.entries()).map((([e,t])=>`.${t}{${e}}`)).join(""),r=i+r;for(let[e,t]of a.styleMap.entries()){if("STYLE"===e.tagName)continue;if(e.getRootNode&&e.getRootNode()instanceof ShadowRoot){e.setAttribute("style",t.replace(/;/g,"; "));continue}let n=s.get(t);n&&e.classList.add(n);let a=e.style?.backgroundImage,r=e.dataset?.snapdomHasIcon;a&&"none"!==a&&(e.style.backgroundImage=a),r&&(e.style.verticalAlign="middle",e.style.display="inline")}for(let[e,t]of a.nodeMap.entries()){let n=t.scrollLeft,a=t.scrollTop;if((n||a)&&e instanceof HTMLElement){e.style.overflow="hidden",e.style.scrollbarWidth="none",e.style.msOverflowStyle="none";let t=document.createElement("div");for(t.style.transform=`translate(${-n}px, ${-a}px)`,t.style.willChange="transform",t.style.display="inline-block",t.style.width="100%";e.firstChild;)t.appendChild(e.firstChild);e.appendChild(t)}}if(function(e,t){if(!e||!t)return;let n=e.scrollTop||0;if(!n)return;"static"===getComputedStyle(t).position&&(t.style.position="relative");let a=e.getBoundingClientRect(),r=e.clientHeight,i="data-snap-ph",s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let o=s.currentNode,l=getComputedStyle(o),c=l.position;if("sticky"!==c&&"-webkit-sticky"!==c)continue;let u=Zr(l.top),d=Zr(l.bottom);if(null==u&&null==d)continue;let m=Or(t,Fr(o,e),i);if(!m)continue;let h=o.getBoundingClientRect(),p=h.width,g=h.height,f=h.left-a.left;if(!(p>0&&g>0&&Number.isFinite(f)))continue;let y=null!=u?u+n:n+(r-g-d);if(!Number.isFinite(y))continue;let v=Number.parseInt(l.zIndex,10),_=Number.isFinite(v),w=_?Math.max(v,1)+1:2,b=_?v-1:0,I=m.cloneNode(!1);I.setAttribute(i,"1"),I.style.position="sticky",I.style.left=`${f}px`,I.style.top=`${y}px`,I.style.width=`${p}px`,I.style.height=`${g}px`,I.style.visibility="hidden",I.style.zIndex=String(b),I.style.overflow="hidden",I.style.background="transparent",I.style.boxShadow="none",I.style.filter="none",m.parentElement?.insertBefore(I,m),m.style.position="absolute",m.style.left=`${f}px`,m.style.top=`${y}px`,m.style.bottom="auto",m.style.zIndex=String(w),m.style.pointerEvents="none"}}(e,n instanceof HTMLElement&&n.firstElementChild instanceof HTMLElement?n.firstElementChild:n),e===a.nodeMap.get(n)){let t=a.styleCache.get(e)||window.getComputedStyle(e);a.styleCache.set(e,t);let r=function(e){if(!e||"none"===e)return"";let t=e.replace(/translate[XY]?\([^)]*\)/g,"");return t=t.replace(/matrix\(([^)]+)\)/g,((e,t)=>{let n=t.split(",").map((e=>e.trim()));return 6!==n.length?`matrix(${t})`:(n[4]="0",n[5]="0",`matrix(${n.join(", ")})`)})),t=t.replace(/matrix3d\(([^)]+)\)/g,((e,t)=>{let n=t.split(",").map((e=>e.trim()));return 16!==n.length?`matrix3d(${t})`:(n[12]="0",n[13]="0",`matrix3d(${n.join(", ")})`)})),t.trim().replace(/\s{2,}/g," ")}(t.transform);n.style.margin="0",n.style.top="auto",n.style.left="auto",n.style.right="auto",n.style.bottom="auto",n.style.animation="none",n.style.transition="none",n.style.willChange="auto",n.style.float="none",n.style.clear="none",n.style.transform=r||""}for(let[e,t]of a.nodeMap.entries())"PRE"===t.tagName&&(e.style.marginTop="0",e.style.marginBlockStart="0");return{clone:n,classCSS:r,styleCache:a.styleCache}}function Br(e){let t=getComputedStyle(e);return!("none"===t.display||"absolute"===t.position||"fixed"===t.position||"sticky"===t.position||"none"!==(t.cssFloat||t.float||"none")||t.transform&&"none"!==t.transform)}function zr(e,t){if(!(e instanceof Element))return!1;if("exclude"===e.getAttribute("data-capture")&&"remove"===t?.excludeMode)return!0;if(Array.isArray(t?.exclude))for(let n of t.exclude)try{if(e.matches(n))return"remove"===t.excludeMode}catch{}return!1}var $r=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e;function Ur(e,t,n,a,r){let i=n.a,s=n.b,o=n.c,l=n.d,c=n.e||0,u=n.f||0;function d(e,t){let n=e-a,d=t-r,m=i*n+o*d,h=s*n+l*d;return m+=a+c,h+=r+u,[m,h]}let m=[d(0,0),d(e,0),d(0,t),d(e,t)],h=1/0,p=1/0,g=-1/0,f=-1/0;for(let[e,t]of m)e<h&&(h=e),t<p&&(p=t),e>g&&(g=e),t>f&&(f=t);return{minX:h,minY:p,maxX:g,maxY:f,width:g-h,height:f-p}}var Gr=null;function Vr(e){let t=getComputedStyle(e).transform;if(!t||"none"===t)return new DOMMatrix;try{return new DOMMatrix(t)}catch{return new WebKitCSSMatrix(t)}}async function qr(e,t){if(!e)throw new Error("Element cannot be null or undefined");!function(e="soft"){switch(sa.session.__counterEpoch=(sa.session.__counterEpoch||0)+1,e){case"auto":return sa.session.styleMap=new Map,void(sa.session.nodeMap=new Map);case"soft":default:return sa.session.styleMap=new Map,sa.session.nodeMap=new Map,void(sa.session.styleCache=new WeakMap);case"full":return;case"disabled":sa.session.styleMap=new Map,sa.session.nodeMap=new Map,sa.session.styleCache=new WeakMap,sa.computedStyle=new WeakMap,sa.baseStyle=new Map,sa.defaultStyle=new Map,sa.image=new Map,sa.background=new Map,sa.resource=new Map,sa.font=new Set}}(t.cache);let n,a,r,i,s,o=t.fast,l=!1!==t.outerTransforms,c=!!t.outerShadows,u={element:e,options:t,plugins:t.plugins},d="",m="",h=null;await Xa("beforeSnap",u),await Xa("beforeClone",u);let p=function(e){if(!e)return()=>{};let t=function(e){let t=getComputedStyle(e),n=t.getPropertyValue("-webkit-line-clamp")||t.getPropertyValue("line-clamp");n=(n||"").trim();let a=parseInt(n,10);return Number.isFinite(a)&&a>0?a:0}(e);if(t<=0)return()=>{};if(!function(e){return!(e.childElementCount>0)&&Array.from(e.childNodes).some((e=>e.nodeType===Node.TEXT_NODE))}(e))return()=>{};let n=getComputedStyle(e),a=Math.round(function(e){let t=(e.lineHeight||"").trim(),n=parseFloat(e.fontSize)||16;return t&&"normal"!==t?t.endsWith("px")?parseFloat(t):/^\d+(\.\d+)?$/.test(t)?Math.round(parseFloat(t)*n):t.endsWith("%")?Math.round(parseFloat(t)/100*n):Math.round(1.2*n):Math.round(1.2*n)}(n)*t+function(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}(n)),r=e.textContent??"",i=r;if(e.scrollHeight<=a+.5)return()=>{};let s=0,o=r.length,l=-1;for(;s<=o;){let t=s+o>>1;e.textContent=r.slice(0,t)+"…",e.scrollHeight<=a+.5?(l=t,s=t+1):o=t-1}return e.textContent=(l>=0?r.slice(0,l):"")+"…",()=>{e.textContent=i}}(u.element);try{({clone:n,classCSS:a,styleCache:r}=await Rr(u.element,u.options)),!l&&n&&(h=function(e,t){if(!e||!t||!t.style)return null;let n=getComputedStyle(e);try{t.style.transformOrigin="0 0"}catch{}try{"translate"in t.style&&(t.style.translate="none"),"rotate"in t.style&&(t.style.rotate="none")}catch{}let a=n.transform||"none";if(!a||"none"===a)try{let n=Vr(e);if(1===n.a&&0===n.b&&0===n.c&&1===n.d)return t.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let r=a.match(/^matrix\(\s*([^)]+)\)$/i);if(r){let e=r[1].split(",").map((e=>parseFloat(e.trim())));if(6===e.length&&e.every(Number.isFinite)){let[n,a,r,i]=e,s=Math.sqrt(n*n+a*a)||0,o=0,l=0,c=0,u=0,d=0,m=0;s>0&&(o=n/s,l=a/s,c=o*r+l*i,u=r-o*c,d=i-l*c,m=Math.sqrt(u*u+d*d)||0,m>0?c/=m:c=0);let h=s,p=0,g=c*m,f=m;try{t.style.transform=`matrix(${h}, ${p}, ${g}, ${f}, 0, 0)`}catch{}return{a:h,b:p,c:g,d:f}}}try{let e=String(a).trim();return t.style.transform=e+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}(u.element,n)),!c&&n&&function(e,t){if(!e||!t||!t.style)return;let n=getComputedStyle(e);try{t.style.boxShadow="none"}catch{}try{t.style.textShadow="none"}catch{}try{t.style.outline="none"}catch{}let a=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{t.style.filter=a.length?a:"none"}catch{}}(u.element,n)}finally{p()}if(u={clone:n,classCSS:a,styleCache:r,...u},await Xa("afterClone",u),function(e,t={}){e&&(function(e,t={}){let{stripFrameworkDirectives:n=!0}=t,a=new Set(["xml","xlink"]),r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;r.nextNode();){let e=r.currentNode;for(let t of Array.from(e.attributes)){let r=t.name;if(r.includes("@"))e.removeAttribute(r);else{if(r.includes(":")){let t=r.split(":",1)[0];if(!a.has(t)){e.removeAttribute(r);continue}}n&&(r.startsWith("x-")||r.startsWith("v-")||r.startsWith(":")||r.startsWith("on:")||r.startsWith("bind:")||r.startsWith("let:")||r.startsWith("class:"))&&e.removeAttribute(r)}}}}(e,t),function(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);for(let e of n)e.remove()}(e))}(u.clone),"remove"===u.options?.excludeMode)try{!function(e,t,n=new Map){!function e(t,a){if(!(t instanceof Element&&a instanceof Element))return;let r=t.childElementCount>a.childElementCount,i=n.get(t)||getComputedStyle(t);if(n.has(t)||n.set(t,i),r&&function(e,t){if(!(e instanceof Element)||function(e){try{let t=e.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}(e)||function(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}(e))return!1;let n=t.position;if("absolute"===n||"fixed"===n||"sticky"===n)return!1;let a=t.display||"";return!(a.includes("flex")||a.includes("grid")||a.startsWith("table")||t.transform&&"none"!==t.transform)}(t,i)){a.style.height||(a.style.height="auto"),a.style.width||(a.style.width="auto"),a.style.removeProperty("block-size"),a.style.removeProperty("inline-size"),a.style.minHeight||(a.style.minHeight="0"),a.style.minWidth||(a.style.minWidth="0"),a.style.maxHeight||(a.style.maxHeight="none"),a.style.maxWidth||(a.style.maxWidth="none");let e=i.overflowY||i.overflowBlock||"visible",t=i.overflowX||i.overflowInline||"visible";("visible"!==e||"visible"!==t)&&(a.style.overflow="visible")}let s=Array.from(t.children),o=Array.from(a.children);for(let t=0;t<Math.min(s.length,o.length);t++)e(s[t],o[t])}(e,t)}(u.element,u.clone,u.styleCache)}catch(e){console.warn("[snapdom] shrink pass failed:",e)}try{await async function(e,t){if(!(e instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',a=Array.from(e.querySelectorAll(n)).filter((e=>e&&e.textContent&&e.textContent.trim()));if(0===a.length)return 0;let r=t instanceof Element?Array.from(t.querySelectorAll(n)).filter((e=>e&&e.textContent&&e.textContent.trim())):[],i=0;for(let e=0;e<a.length;e++){let t=a[e],n=r[e]||null;try{let e=getComputedStyle(n||t),a=e.fontFamily||"Material Icons";if(!Na(a))continue;let r=(n||t).textContent.trim();if(!r)continue;let s=parseInt(e.fontSize,10)||24,o=e.fontWeight&&"normal"!==e.fontWeight?e.fontWeight:"normal",l=Pa(e),c=e.fontVariationSettings&&"normal"!==e.fontVariationSettings?e.fontVariationSettings:"",u=(n||t).className||"",{dataUrl:d,width:m,height:h}=await La(r,{family:a,weight:o,fontSize:s,color:l,variation:c,className:u});t.textContent="";let p=t.ownerDocument.createElement("img");p.src=d,p.alt=r,p.style.height=`${s}px`,p.style.width=`${Math.max(1,Math.round(m/h*s))}px`,p.style.objectFit="contain",p.style.verticalAlign=getComputedStyle(t).verticalAlign||"baseline",t.appendChild(p),i++}catch{}}return i}(u.clone,u.element)}catch{}await new Promise((e=>{(0,tr.a)((async()=>{await async function(e,t={}){let n=Array.from(e.querySelectorAll("img")),a=async e=>{if(!e.getAttribute("src")){let t=e.currentSrc||e.src||"";t&&e.setAttribute("src",t)}e.removeAttribute("srcset"),e.removeAttribute("sizes");let n=e.src||"";if(!n)return;let a=await ha(n,{as:"dataURL",useProxy:t.useProxy});if(a.ok&&"string"==typeof a.data&&a.data.startsWith("data:"))return e.src=a.data,e.width||(e.width=e.naturalWidth||100),void(e.height||(e.height=e.naturalHeight||100));let{width:r,height:i}=function(e){let t=parseInt(e.dataset?.snapdomWidth||"",10)||0,n=parseInt(e.dataset?.snapdomHeight||"",10)||0,a=parseInt(e.getAttribute("width")||"",10)||0,r=parseInt(e.getAttribute("height")||"",10)||0,i=parseFloat(e.style?.width||"")||0,s=parseFloat(e.style?.height||"")||0;return{width:t||i||a||e.width||e.naturalWidth||100,height:n||s||r||e.height||e.naturalHeight||100}}(e),{fallbackURL:s}=t||{};if(s)try{let a="function"==typeof s?await s({width:r,height:i,src:n,element:e}):s;if(a){let n=await ha(a,{as:"dataURL",useProxy:t.useProxy});return e.src=n.data,e.width||(e.width=r),void(e.height||(e.height=i))}}catch{}if(!1!==t.placeholders){let t=document.createElement("div");t.style.cssText=[`width:${r}px`,`height:${i}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${i}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),t.textContent="img",e.replaceWith(t)}else{let t=document.createElement("div");t.style.cssText=`display:inline-block;width:${r}px;height:${i}px;visibility:hidden;`,e.replaceWith(t)}};for(let e=0;e<n.length;e+=4){let t=n.slice(e,e+4).map(a);await Promise.allSettled(t)}}(u.clone,u.options),e()}),{fast:o})})),await new Promise((e=>{(0,tr.a)((async()=>{await async function(e,t,n,a={}){let r=[[e,t]],i=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],s=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],o=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;r.length;){let[e,t]=r.shift(),c=n.get(e)||Ia(e);n.has(e)||n.set(e,c);let u=(()=>{let e=c.getPropertyValue("border-image"),t=c.getPropertyValue("border-image-source");return e&&"none"!==e||t&&"none"!==t})();for(let e of o){let n=c.getPropertyValue(e);n&&t.style.setProperty(e,n)}for(let e of i){let n=c.getPropertyValue(e);if(!n||"none"===n)continue;let r=Sa(n),i=await Promise.all(r.map((e=>pa(e,a))));i.some((e=>e&&"none"!==e&&!/^url\(undefined/.test(e)))&&t.style.setProperty(e,i.join(", "))}for(let e of s){let n=c.getPropertyValue(e);!n||"initial"===n||t.style.setProperty(e,n)}if(u)for(let e of l){let n=c.getPropertyValue(e);!n||"initial"===n||t.style.setProperty(e,n)}let d=Array.from(e.children),m=Array.from(t.children).filter((e=>!(e.dataset&&e.dataset.snapdomPseudo)));for(let e=0;e<Math.min(d.length,m.length);e++)r.push([d[e],m[e]])}}(u.element,u.clone,u.styleCache,u.options),e()}),{fast:o})})),t.embedFonts&&await new Promise((e=>{(0,tr.a)((async()=>{let t=function(e){let t=new Set;if(!e)return t;let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),a=e=>{let n=Da(e.fontFamily);var a,r,i;n&&t.add((a=e.fontWeight,r=e.fontStyle,i=e.fontStretch,`${n}__${Ha(a)}__${Za(r)}__${function(e){let t=String(e??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}(i)}`))};a(getComputedStyle(e));let r=getComputedStyle(e,"::before");r&&r.content&&"none"!==r.content&&a(r);let i=getComputedStyle(e,"::after");for(i&&i.content&&"none"!==i.content&&a(i);n.nextNode();){let e=n.currentNode;a(getComputedStyle(e));let t=getComputedStyle(e,"::before");t&&t.content&&"none"!==t.content&&a(t);let r=getComputedStyle(e,"::after");r&&r.content&&"none"!==r.content&&a(r)}return t}(u.element),n=function(e){let t=new Set,n=e=>{if(e)for(let n of e)t.add(n.codePointAt(0))},a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;a.nextNode();){let e=a.currentNode;if(e.nodeType===Node.TEXT_NODE)n(e.nodeValue||"");else if(e.nodeType===Node.ELEMENT_NODE){let a=e;for(let e of["::before","::after"]){let r=getComputedStyle(a,e)?.getPropertyValue("content");if(r&&"none"!==r)if(/^"/.test(r)||/^'/.test(r))n(r.slice(1,-1));else{let e=r.match(/\\[0-9A-Fa-f]{1,6}/g);if(e)for(let n of e)try{t.add(parseInt(n.slice(1),16))}catch{}}}}}return t}(u.element);if((0,tr.b)()){let e=new Set(Array.from(t).map((e=>String(e).split("__")[0])).filter(Boolean));await async function(e,t=2){try{await document.fonts.ready}catch{}let n=Array.from(e||[]).filter(Boolean);if(0===n.length)return;let a=()=>{let e=document.createElement("div");e.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let t of n){let n=document.createElement("span");n.textContent="AaBbGg1234ÁÉÍÓÚçñ—∞",n.style.fontFamily=`"${t}"`,n.style.fontWeight="700",n.style.fontStyle="italic",n.style.fontSize="32px",n.style.lineHeight="1",n.style.whiteSpace="nowrap",n.style.margin="0",n.style.padding="0",e.appendChild(n)}document.body.appendChild(e),e.offsetWidth,document.body.removeChild(e)};for(let e=0;e<Math.max(1,t);e++)a(),await new Promise((e=>requestAnimationFrame((()=>requestAnimationFrame(e)))))}(e,1)}d=await async function({required:e,usedCodepoints:t,exclude:n,localFonts:a=[],useProxy:r=""}={}){e instanceof Set||(e=new Set),t instanceof Set||(t=new Set);let i=new Map;for(let t of e){let[e,n,a,r]=String(t).split("__");if(!e)continue;let s=i.get(e)||[];s.push({w:parseInt(n,10),s:a,st:parseInt(r,10)}),i.set(e,s)}function s(e,t,n,a){if(!i.has(e))return!1;let r=i.get(e),s=function(e){let t=String(e||"400").trim(),n=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let e=Ha(n[1]),t=Ha(n[2]);return{min:Math.min(e,t),max:Math.max(e,t)}}let a=Ha(t);return{min:a,max:a}}(n),o=function(e){let t=String(e||"normal").trim().toLowerCase();return"italic"===t?{kind:"italic"}:t.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}(t),l=function(e){let t=String(e||"100%").trim(),n=t.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let e=parseFloat(n[1]),t=parseFloat(n[2]);return{min:Math.min(e,t),max:Math.max(e,t)}}let a=t.match(/(\d+(?:\.\d+)?)\s*%/),r=a?parseFloat(a[1]):100;return{min:r,max:r}}(a),c=s.min!==s.max,u=s.min,d=e=>"normal"===o.kind&&"normal"===e||"normal"!==o.kind&&("italic"===e||"oblique"===e),m=!1;for(let e of r){let t=c?e.w>=s.min&&e.w<=s.max:e.w===u,n=d(Za(e.s)),a=e.st>=l.min&&e.st<=l.max;if(t&&n&&a){m=!0;break}}if(m)return!0;if(!c)for(let e of r){let t=d(Za(e.s)),n=e.st>=l.min&&e.st<=l.max;if(Math.abs(u-e.w)<=300&&t&&n)return!0}if(!c&&"normal"===o.kind&&r.some((e=>"normal"!==Za(e.s))))for(let e of r){let t=Math.abs(u-e.w)<=300,n=e.st>=l.min&&e.st<=l.max;if(t&&n)return!0}return!1}let o=qa(n),l=function(e,t,n,a){let r=Array.from(e||[]).sort().join("|"),i=t?JSON.stringify({families:(t.families||[]).map((e=>String(e).toLowerCase())).sort(),domains:(t.domains||[]).map((e=>String(e).toLowerCase())).sort(),subsets:(t.subsets||[]).map((e=>String(e).toLowerCase())).sort()}):"",s=(n||[]).map((e=>`${(e.family||"").toLowerCase()}::${e.weight||"normal"}::${e.style||"normal"}::${e.src||""}`)).sort().join("|");return`fonts-embed-css::req=${r}::ex=${i}::lf=${s}::px=${a||""}`}(e,n,a,r);if(sa.resource?.has(l))return sa.resource.get(l);let c=function(e){let t=new Set;for(let n of e||[]){let e=String(n).split("__")[0]?.trim();e&&t.add(e)}return t}(e),u=[],d=Wa;for(let e of document.querySelectorAll("style")){let t=e.textContent||"";for(let e of t.matchAll(d)){let t=(e[2]||e[4]||"").trim();t&&!Ma(t)&&(document.querySelector(`link[rel="stylesheet"][href="${t}"]`)||u.push(t))}}u.length&&await Promise.all(u.map((e=>new Promise((t=>{if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return t(null);let n=document.createElement("link");n.rel="stylesheet",n.href=e,n.setAttribute("data-snapdom","injected-import"),n.onload=()=>t(n),n.onerror=()=>t(null),document.head.appendChild(n)})))));let m="",h=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter((e=>!!e.href));for(let e of h)try{if(Ma(e.href))continue;let a="",i=!1;try{i=new URL(e.href,location.href).origin===location.origin}catch{}if(!i&&!Fa(e.href,c))continue;if(i){let t=Array.from(document.styleSheets).find((t=>t.href===e.href));if(t)try{let e=t.cssRules||[];a=Array.from(e).map((e=>e.cssText)).join("")}catch{}}if(!a&&(a=(await ha(e.href,{as:"text",useProxy:r})).data,Ma(e.href)))continue;a=await Ra(a,e.href,r);let l="";for(let i of a.match(za)||[]){let a=Da((i.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim());if(!a||Ma(a))continue;let c=(i.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),u=(i.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),d=(i.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),m=(i.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),h=(i.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),p=Ga(h,e.href);if(!s(a,u,c,d))continue;let g=$a(m);if(!Ua(t,g))continue;let f={family:a,weightSpec:c,styleSpec:u,stretchSpec:d,unicodeRange:m,srcRaw:h,srcUrls:p,href:e.href};n&&o(f,g)||(l+=/url\(/i.test(h)?await Va(i,e.href,r):i)}l.trim()&&(m+=l)}catch{console.warn("[snapDOM] Failed to process stylesheet:",e.href)}let p={requiredIndex:i,usedCodepoints:t,faceMatchesRequired:s,simpleExcluder:n?qa(n):null,useProxy:r,visitedSheets:new Set,depth:0};for(let e of document.styleSheets)if(!e.href||!h.some((t=>t.href===e.href)))try{let t=e.href||location.href;t&&p.visitedSheets.add(t),await Ya(e,t,(async e=>{m+=e}),p)}catch{}try{for(let e of document.fonts||[]){if(!e||!e.family||"loaded"!==e.status||!e._snapdomSrc)continue;let t=String(e.family).replace(/^['"]+|['"]+$/g,"");if(Ma(t)||!i.has(t)||n?.families&&n.families.some((e=>String(e).toLowerCase()===t.toLowerCase())))continue;let a=e._snapdomSrc;if(!String(a).startsWith("data:"))if(sa.resource?.has(e._snapdomSrc))a=sa.resource.get(e._snapdomSrc),sa.font?.add(e._snapdomSrc);else if(!sa.font?.has(e._snapdomSrc))try{let t=await ha(e._snapdomSrc,{as:"dataURL",useProxy:r,silent:!0});if(!t.ok||"string"!=typeof t.data)continue;a=t.data,sa.resource?.set(e._snapdomSrc,a),sa.font?.add(e._snapdomSrc)}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",e._snapdomSrc);continue}m+=`@font-face{font-family:'${t}';src:url(${a});font-style:${e.style||"normal"};font-weight:${e.weight||"normal"};}`}}catch{}for(let e of a){if(!e||"object"!=typeof e)continue;let t=String(e.family||"").replace(/^['"]+|['"]+$/g,"");if(!t||Ma(t)||!i.has(t)||n?.families&&n.families.some((e=>String(e).toLowerCase()===t.toLowerCase())))continue;let a=null!=e.weight?String(e.weight):"normal",s=null!=e.style?String(e.style):"normal",o=null!=e.stretchPct?`${e.stretchPct}%`:"100%",l=String(e.src||""),c=l;if(!c.startsWith("data:"))if(sa.resource?.has(l))c=sa.resource.get(l),sa.font?.add(l);else if(!sa.font?.has(l))try{let e=await ha(l,{as:"dataURL",useProxy:r,silent:!0});if(!e.ok||"string"!=typeof e.data)continue;c=e.data,sa.resource?.set(l,c),sa.font?.add(l)}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",l);continue}m+=`@font-face{font-family:'${t}';src:url(${c});font-style:${s};font-weight:${a};font-stretch:${o};}`}return m&&(m=function(e){if(!e)return e;let t=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,a=[];for(let r of e.match(t)||[]){let e=Da(r.match(/font-family:\s*([^;]+);/i)?.[1]||""),t=(r.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),i=(r.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),s=(r.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),o=(r.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),l=(r.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),c=Ga(l,location.href),u=c.length?c.map((e=>String(e).toLowerCase())).sort().join("|"):l.toLowerCase(),d=[String(e||"").toLowerCase(),t,i,s,o.toLowerCase(),u].join("|");n.has(d)||(n.add(d),a.push(r))}if(0===a.length)return e;let r=0;return e.replace(t,(()=>a[r++]||""))}(m),sa.resource?.set(l,m)),m}({required:t,usedCodepoints:n,preCached:!1,exclude:u.options.excludeFonts,useProxy:u.options.useProxy}),e()}),{fast:o})}));let g=function(e){let t=new Set;return e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(e.tagName&&t.add(e.tagName.toLowerCase()),"function"==typeof e.querySelectorAll&&e.querySelectorAll("*").forEach((e=>t.add(e.tagName.toLowerCase()))),Array.from(t))}(u.clone).sort(),f=g.join(",");sa.baseStyle.has(f)?m=sa.baseStyle.get(f):await new Promise((e=>{(0,tr.a)((()=>{m=function(e){let t=new Map;for(let n of e){let e=sa.defaultStyle.get(n);if(!e)continue;let a=Object.entries(e).map((([e,t])=>`${e}:${t};`)).sort().join("");a&&(t.has(a)||t.set(a,[]),t.get(a).push(n))}let n="";for(let[e,a]of t.entries())n+=`${a.join(",")} { ${e} }\n`;return n}(g),sa.baseStyle.set(f,m),e()}),{fast:o})})),u={fontsCSS:d,baseCSS:m,...u},await Xa("beforeRender",u),await new Promise((e=>{(0,tr.a)((()=>{let n=getComputedStyle(u.element),a=u.element.getBoundingClientRect(),r=Math.max(1,$r(u.element.offsetWidth||parseFloat(n.width)||a.width||1)),o=Math.max(1,$r(u.element.offsetHeight||parseFloat(n.height)||a.height||1));if("remove"===u.options?.excludeMode){let e=function(e,t){let n=getComputedStyle(e),a=e.getBoundingClientRect(),r=1/0,i=-1/0,s=!1,o=Array.from(e.children);for(let e of o){if(zr(e,t)||!Br(e))continue;let n=e.getBoundingClientRect(),o=n.top-a.top,l=n.bottom-a.top;l<=o||(o<r&&(r=o),l>i&&(i=l),s=!0)}let l=s?Math.max(0,i-r):0;return(parseFloat(n.borderTopWidth)||0)+(parseFloat(n.borderBottomWidth)||0)+(parseFloat(n.paddingTop)||0)+(parseFloat(n.paddingBottom)||0)+l}(u.element,u.options);Number.isFinite(e)&&e>0&&(o=Math.max(1,Math.min(o,$r(e+1))))}let d=(e,t=NaN)=>{let n="string"==typeof e?parseFloat(e):e;return Number.isFinite(n)?n:t},m=d(u.options.width),p=d(u.options.height),g=r,f=o,y=Number.isFinite(m),v=Number.isFinite(p),_=o>0?r/o:1;y&&v?(g=Math.max(1,$r(m)),f=Math.max(1,$r(p))):y?(g=Math.max(1,$r(m)),f=Math.max(1,$r(g/(_||1)))):v?(f=Math.max(1,$r(p)),g=Math.max(1,$r(f*(_||1)))):(g=r,f=o);let w=0,b=0,I=r,x=o;if(!l&&h&&Number.isFinite(h.a)){let e=Ur(r,o,{a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},0,0);w=$r(e.minX),b=$r(e.minY),I=$r(e.maxX),x=$r(e.maxY)}else if(l&&function(e){return function(e){let t=getComputedStyle(e),n=t.transform||"none";if("none"!==n&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let a=t.rotate&&"none"!==t.rotate&&"0deg"!==t.rotate,r=t.scale&&"none"!==t.scale&&"1"!==t.scale,i=t.translate&&"none"!==t.translate&&"0px 0px"!==t.translate;return!!(a||r||i)}(e)}(u.element)){let e=n.transform&&"none"!==n.transform?n.transform:"",t=function(e){let t={rotate:"0deg",scale:null,translate:null},n="function"==typeof e.computedStyleMap?e.computedStyleMap():null;if(n){let a=e=>{try{return"function"==typeof n.has&&!n.has(e)||"function"!=typeof n.get?null:n.get(e)}catch{return null}},r=a("rotate");if(r)if(r.angle){let e=r.angle;t.rotate="rad"===e.unit?180*e.value/Math.PI+"deg":e.value+e.unit}else r.unit?t.rotate="rad"===r.unit?180*r.value/Math.PI+"deg":r.value+r.unit:t.rotate=String(r);else{let n=getComputedStyle(e);t.rotate=n.rotate&&"none"!==n.rotate?n.rotate:"0deg"}let i=a("scale");if(i){let e="x"in i&&null!=i.x?.value?i.x.value:Array.isArray(i)?i[0]?.value:Number(i)||1,n="y"in i&&null!=i.y?.value?i.y.value:Array.isArray(i)?i[1]?.value:e;t.scale=`${e} ${n}`}else{let n=getComputedStyle(e);t.scale=n.scale&&"none"!==n.scale?n.scale:null}let s=a("translate");if(s){let e="x"in s&&"value"in s.x?s.x.value:Array.isArray(s)?s[0]?.value:0,n="y"in s&&"value"in s.y?s.y.value:Array.isArray(s)?s[1]?.value:0,a="x"in s&&s.x?.unit?s.x.unit:"px",r="y"in s&&s.y?.unit?s.y.unit:"px";t.translate=`${e}${a} ${n}${r}`}else{let n=getComputedStyle(e);t.translate=n.translate&&"none"!==n.translate?n.translate:null}return t}let a=getComputedStyle(e);return t.rotate=a.rotate&&"none"!==a.rotate?a.rotate:"0deg",t.scale=a.scale&&"none"!==a.scale?a.scale:null,t.translate=a.translate&&"none"!==a.translate?a.translate:null,t}(u.element),a=function(e){let t=function(){if(Gr)return Gr;let e=document.createElement("div");return e.id="snapdom-measure-slot",e.setAttribute("aria-hidden","true"),Object.assign(e.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(e),Gr=e,e}(),n=document.createElement("div");n.style.transformOrigin="0 0",e.baseTransform&&(n.style.transform=e.baseTransform),e.rotate&&(n.style.rotate=e.rotate),e.scale&&(n.style.scale=e.scale),e.translate&&(n.style.translate=e.translate),t.appendChild(n);let a=Vr(n);return t.removeChild(n),a}({baseTransform:e,rotate:t.rotate||"0deg",scale:t.scale,translate:t.translate}),{ox:i,oy:s}=function(e,t,n){let a=(e.transformOrigin||"0 0").trim().split(/\s+/),[r,i]=[a[0]||"0",a[1]||"0"],s=(e,t)=>{let n=e.toLowerCase();return"left"===n||"top"===n?0:"center"===n?t/2:"right"===n||"bottom"===n?t:n.endsWith("px")?parseFloat(n)||0:n.endsWith("%")?(parseFloat(n)||0)*t/100:/^-?\d+(\.\d+)?$/.test(n)&&parseFloat(n)||0};return{ox:s(r,t),oy:s(i,n)}}(n,r,o),l=Ur(r,o,a.is2D?a:new DOMMatrix(a.toString()),i,s);w=$r(l.minX),b=$r(l.minY),I=$r(l.maxX),x=$r(l.maxY)}let S=function(e){let t=e.boxShadow||"";if(!t||"none"===t)return{top:0,right:0,bottom:0,left:0};let n=t.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map((e=>e.trim())),a=0,r=0,i=0,s=0;for(let e of n){let t=e.match(/-?\d+(\.\d+)?px/g)?.map((e=>parseFloat(e)))||[];if(t.length<2)continue;let[n,o,l=0,c=0]=t,u=Math.abs(n)+l+c,d=Math.abs(o)+l+c;r=Math.max(r,u+Math.max(n,0)),s=Math.max(s,u+Math.max(-n,0)),i=Math.max(i,d+Math.max(o,0)),a=Math.max(a,d+Math.max(-o,0))}return{top:Math.ceil(a),right:Math.ceil(r),bottom:Math.ceil(i),left:Math.ceil(s)}}(n),E=function(e){let t=(e.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=t?Math.ceil(parseFloat(t[1])||0):0;return{top:n,right:n,bottom:n,left:n}}(n),C=function(e){if("none"===(e.outlineStyle||"none"))return{top:0,right:0,bottom:0,left:0};let t=Math.ceil(parseFloat(e.outlineWidth||"0")||0);return{top:t,right:t,bottom:t,left:t}}(n),k=function(e){let t=`${e.filter||""} ${e.webkitFilter||""}`.trim();if(!t||"none"===t)return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=t.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],a=0,r=0,i=0,s=0,o=!1;for(let e of n){o=!0;let t=e.match(/-?\d+(?:\.\d+)?px/gi)?.map((e=>parseFloat(e)))||[],[n=0,l=0,c=0]=t,u=Math.abs(n)+c,d=Math.abs(l)+c;r=Math.max(r,u+Math.max(n,0)),s=Math.max(s,u+Math.max(-n,0)),i=Math.max(i,d+Math.max(l,0)),a=Math.max(a,d+Math.max(-l,0))}return{bleed:{top:$r(a),right:$r(r),bottom:$r(i),left:$r(s)},has:o}}(n),M=c?{top:$r(S.top+E.top+C.top+k.bleed.top),right:$r(S.right+E.right+C.right+k.bleed.right),bottom:$r(S.bottom+E.bottom+C.bottom+k.bleed.bottom),left:$r(S.left+E.left+C.left+k.bleed.left)}:{top:0,right:0,bottom:0,left:0};w=$r(w-M.left),b=$r(b-M.top),I=$r(I+M.right),x=$r(x+M.bottom);let N=Math.max(1,$r(I-w)),A=Math.max(1,$r(x-b)),P=y||v?$r(g/r):1,L=v||y?$r(f/o):1,T=Math.max(1,$r(N*P)),j=Math.max(1,$r(A*L)),D="http://www.w3.org/2000/svg",H=(0,tr.b)()?1:0,Z=$r(H+(l?0:1)),F=document.createElementNS(D,"foreignObject"),O=$r(w),W=$r(b);F.setAttribute("x",String($r(-(O-Z)))),F.setAttribute("y",String($r(-(W-Z)))),F.setAttribute("width",String($r(r+2*Z))),F.setAttribute("height",String($r(o+2*Z))),F.style.overflow="visible";let R=document.createElement("style");R.textContent=u.baseCSS+u.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+u.classCSS,F.appendChild(R);let B=document.createElement("div");B.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),B.style.width=`${$r(r)}px`,B.style.height=`${$r(o)}px`,B.style.overflow="visible",B.appendChild(u.clone),F.appendChild(B);let z=(new XMLSerializer).serializeToString(F),$=$r(N+2*Z),U=$r(A+2*Z),G=y||v;t.meta={w0:r,h0:o,vbW:$,vbH:U,targetW:g,targetH:f};let V=(0,tr.b)()&&G?$:$r(T+2*Z),q=(0,tr.b)()&&G?U:$r(j+2*Z);s=`<svg xmlns="${D}" width="${V}" height="${q}" viewBox="0 0 ${$} ${U}">`+z+"</svg>",i=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`,u={svgString:s,dataURL:i,...u},e()}),{fast:o})})),await Xa("afterRender",u);let y=document.getElementById("snapdom-sandbox");return y&&"absolute"===y.style.position&&y.remove(),u.dataURL}var Yr=Object.assign((async function(e,t){if(!e)throw new Error("Element cannot be null or undefined");let n=function(e={}){let t=e.format??"png";"jpg"===t&&(t="jpeg");let n=function(e){if("string"==typeof e){let t=e.toLowerCase().trim();if("disabled"===t||"full"===t||"auto"===t||"soft"===t)return t}return"soft"}(e.cache);return{debug:e.debug??!1,fast:e.fast??!0,scale:e.scale??1,exclude:e.exclude??[],excludeMode:e.excludeMode??"hide",filter:e.filter??null,filterMode:e.filterMode??"hide",placeholders:!1!==e.placeholders,embedFonts:e.embedFonts??!1,iconFonts:Array.isArray(e.iconFonts)?e.iconFonts:e.iconFonts?[e.iconFonts]:[],localFonts:Array.isArray(e.localFonts)?e.localFonts:[],excludeFonts:e.excludeFonts??void 0,fallbackURL:e.fallbackURL??void 0,cache:n,useProxy:"string"==typeof e.useProxy?e.useProxy:"",width:e.width??null,height:e.height??null,format:t,type:e.type??"svg",quality:e.quality??.92,dpr:e.dpr??(window.devicePixelRatio||1),backgroundColor:e.backgroundColor??(["jpeg","webp"].includes(t)?"#ffffff":null),filename:e.filename??"snapDOM",outerTransforms:e.outerTransforms??!0,outerShadows:e.outerShadows??!1}}(t);if(function(e,t,n=!1){!e||e.plugins&&!n||(e.plugins=function(e){let t=[];if(Array.isArray(e))for(let n of e){let e=Ja(n);if(!e||!e.name)continue;let a=t.findIndex((t=>t&&t.name===e.name));a>=0&&t.splice(a,1),t.push(e)}for(let e of Qa)e&&e.name&&!t.some((t=>t.name===e.name))&&t.push(e);return Object.freeze(t)}(t))}(n,t&&t.plugins),(0,tr.b)()&&(!0===n.embedFonts||function(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;t.nextNode();){let e=t.currentNode,n=getComputedStyle(e),a=n.backgroundImage&&"none"!==n.backgroundImage,r=n.maskImage&&"none"!==n.maskImage||n.webkitMaskImage&&"none"!==n.webkitMaskImage;if(a||r||"CANVAS"===e.tagName)return!0}return!1}(e)))for(let n=0;n<3;n++)try{await Xr(e,t),Kr=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&function(e){let t=Array.isArray(e)?e:[e];for(let e of t)e instanceof RegExp?ka.push(e):"string"==typeof e?ka.push(new RegExp(e,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",e)}(n.iconFonts),n.snap||(n.snap={toPng:(e,t)=>Yr.toPng(e,t),toSvg:(e,t)=>Yr.toSvg(e,t)}),Yr.capture(e,n,Qr)}),{plugins:function(...e){return function(...e){let t=e.flat();for(let e of t){let t=Ja(e);t&&(Qa.some((e=>e&&e.name&&t.name&&e.name===t.name))||Qa.push(t))}}(...e),Yr}}),Qr=Symbol("snapdom.internal"),Jr=Symbol("snapdom.internal.silent"),Kr=!1;async function Xr(e,t){if(Kr)return;let n,a={...t,fast:!0,embedFonts:!0,scale:.2};try{n=await qr(e,a)}catch{}await new Promise((e=>requestAnimationFrame((()=>requestAnimationFrame(e))))),n&&await new Promise((e=>{let t=new Image;try{t.decoding="sync",t.loading="eager"}catch{}t.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",t.src=n,document.body.appendChild(t),(async()=>{try{"function"==typeof t.decode&&await t.decode()}catch{}let n=performance.now();for(;!(t.complete&&t.naturalWidth>0)&&performance.now()-n<900;)await new Promise((e=>setTimeout(e,200)));await new Promise((e=>requestAnimationFrame(e)));try{t.remove()}catch{}e()})()})),e.querySelectorAll("canvas").forEach((e=>{try{let t=e.getContext("2d",{willReadFrequently:!0});t&&t.getImageData(0,0,1,1)}catch{}})),Kr=!0}Yr.capture=async(e,t,n)=>{if(n!==Qr)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let a=await qr(e,t),i={img:async(e,t)=>{let{toImg:n}=await r.e(580).then(r.bind(r,580));return n(a,{...e,...t||{}})},svg:async(e,t)=>{let{toSvg:n}=await r.e(580).then(r.bind(r,580));return n(a,{...e,...t||{}})},canvas:async(e,t)=>{let{toCanvas:n}=await r.e(313).then(r.bind(r,313));return n(a,{...e,...t||{}})},blob:async(e,t)=>{let{toBlob:n}=await r.e(658).then(r.bind(r,658));return n(a,{...e,...t||{}})},png:async(e,t)=>{let{rasterize:n}=await r.e(272).then(r.bind(r,272));return n(a,{...e,...t||{},format:"png"})},jpeg:async(e,t)=>{let{rasterize:n}=await r.e(272).then(r.bind(r,272));return n(a,{...e,...t||{},format:"jpeg"})},webp:async(e,t)=>{let{rasterize:n}=await r.e(272).then(r.bind(r,272));return n(a,{...e,...t||{},format:"webp"})},download:async(e,t)=>{let{download:n}=await r.e(600).then(r.bind(r,600));return n(a,{...e,...t||{}})}},s={...t,export:{url:a},exports:{svg:async e=>{let{toSvg:n}=await r.e(580).then(r.bind(r,580));return n(a,{...t,...e||{},[Jr]:!0})},canvas:async e=>{let{toCanvas:n}=await r.e(313).then(r.bind(r,313));return n(a,{...t,...e||{},[Jr]:!0})},png:async e=>{let{rasterize:n}=await r.e(272).then(r.bind(r,272));return n(a,{...t,...e||{},format:"png",[Jr]:!0})},jpeg:async e=>{let{rasterize:n}=await r.e(272).then(r.bind(r,272));return n(a,{...t,...e||{},format:"jpeg",[Jr]:!0})},jpg:async e=>{let{rasterize:n}=await r.e(272).then(r.bind(r,272));return n(a,{...t,...e||{},format:"jpeg",[Jr]:!0})},webp:async e=>{let{rasterize:n}=await r.e(272).then(r.bind(r,272));return n(a,{...t,...e||{},format:"webp",[Jr]:!0})},blob:async e=>{let{toBlob:n}=await r.e(658).then(r.bind(r,658));return n(a,{...t,...e||{},[Jr]:!0})},img:async e=>{let{toImg:n}=await r.e(580).then(r.bind(r,580));return n(a,{...t,...e||{},[Jr]:!0})}}},o=await er("defineExports",s),l={...i,...Object.assign({},...o.filter((e=>e&&"object"==typeof e)))};l.jpeg&&!l.jpg&&(l.jpg=(e,t)=>l.jpeg(e,t));let c=!1,u=Promise.resolve();async function d(e,n){return u=u.then((async()=>{let r=l[e];if(!r)throw new Error(`[snapdom] Unknown export type: ${e}`);let i=function(e,n){let a={...t,...n||{}};return("jpeg"===e||"jpg"===e)&&(null==a.backgroundColor||"transparent"===a.backgroundColor)&&(a.backgroundColor="#ffffff"),a}(e,n),s={...t,export:{type:e,options:i,url:a}};await Xa("beforeExport",s);let o=await r(s,i);return await Xa("afterExport",s,o),c||(c=!0,await Xa("afterSnap",t)),o}))}let m={url:a,toRaw:()=>a,to:(e,t)=>d(e,t),toImg:e=>d("img",e),toSvg:e=>d("svg",e),toCanvas:e=>d("canvas",e),toBlob:e=>d("blob",e),toPng:e=>d("png",e),toJpg:e=>d("jpg",e),toWebp:e=>d("webp",e),download:e=>d("download",e)};for(let e of Object.keys(l)){let t="to"+e.charAt(0).toUpperCase()+e.slice(1);m[t]||(m[t]=t=>d(e,t))}return m},Yr.toRaw=(e,t)=>Yr(e,t).then((e=>e.toRaw())),Yr.toImg=(e,t)=>Yr(e,t).then((e=>e.toImg())),Yr.toSvg=(e,t)=>Yr(e,t).then((e=>e.toSvg())),Yr.toCanvas=(e,t)=>Yr(e,t).then((e=>e.toCanvas())),Yr.toBlob=(e,t)=>Yr(e,t).then((e=>e.toBlob())),Yr.toPng=(e,t)=>Yr(e,{...t,format:"png"}).then((e=>e.toPng())),Yr.toJpg=(e,t)=>Yr(e,{...t,format:"jpeg"}).then((e=>e.toJpg())),Yr.toWebp=(e,t)=>Yr(e,{...t,format:"webp"}).then((e=>e.toWebp())),Yr.download=(e,t)=>Yr(e,t).then((e=>e.download()));const ei=(0,vt.__)("Capturing…","simple-history"),ti=(0,vt.__)("Image copied!","simple-history"),ni=(0,vt.__)("Image downloaded!","simple-history");function ai({event:e,actionsRef:t}){const n=(0,vt.__)("Copy as image","simple-history"),[a,r]=(0,c.useState)(n),[o,l]=(0,c.useState)(!1),u=(0,c.useCallback)((async()=>{if(o)return;l(!0),r(ei);const a=t.current?.closest(".SimpleHistoryLogitem");if(!a)return r(n),void l(!1);const{wrapper:i,restore:s}=function(e,t){const n=[],a=document.createElement("div");Object.assign(a.style,{width:"460px",backgroundColor:"#fff",borderRadius:"12px",boxShadow:"0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06)",overflow:"hidden"});const r=e.parentNode,i=e.nextSibling;r.insertBefore(a,e),a.appendChild(e),n.push((()=>{r.insertBefore(e,i),a.remove()}));const s=document.createElement("div");Object.assign(s.style,{backgroundColor:"#fcf9ec",padding:"14px 20px",display:"flex",alignItems:"center",gap:"10px"});const o=function(){const e=document.querySelector("img.sh-PageHeader-logo");return e?e.src:""}();if(o){const e=document.createElement("img");e.src=o,e.alt="Simple History",Object.assign(e.style,{height:"18px",width:"auto"}),s.appendChild(e)}const l=document.createElement("span");Object.assign(l.style,{color:"#646970",fontSize:"11px",fontWeight:"400",fontFamily:"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif"}),l.textContent="WordPress Activity Log · simple-history.com",s.appendChild(l),a.appendChild(s),n.push((()=>s.remove())),[".SimpleHistoryLogitem__actions",".SimpleHistoryEventSeparator",".SimpleHistoryLogitem__actionLinks"].forEach((t=>{e.querySelectorAll(t).forEach((e=>{const t=e.style.display;e.style.display="none",n.push((()=>{e.style.display=t}))}))}));const c=e.querySelector(".SimpleHistoryLogitem__header .components-button.is-link");if(c){const e=c.querySelector("strong + span");if(e){const t=e.style.display;e.style.display="none",n.push((()=>{e.style.display=t}))}}e.querySelectorAll(".components-button.is-link, a").forEach((e=>{const t=e.style.color,a=e.style.textDecoration,r=e.style.cursor;e.style.color="inherit",e.style.textDecoration="none",e.style.cursor="default",n.push((()=>{e.style.color=t,e.style.textDecoration=a,e.style.cursor=r}))}));const u=e.querySelector(".SimpleHistoryLogitem__when__liveRelative");if(u&&t.date_gmt){const e=u.textContent,a=(0,ra.getSettings)(),r=Intl.DateTimeFormat().resolvedOptions().timeZone;u.textContent=(0,ra.dateI18n)(a.formats.datetimeAbbreviated,t.date_gmt+"+0000",r),n.push((()=>{u.textContent=e}))}return{wrapper:a,restore:()=>{for(let e=n.length-1;e>=0;e--)n[e]()}}}(a,e);try{const t=await Yr.toBlob(i,{scale:2,type:"png"});s();const n=await async function(e,t){return"undefined"!=typeof ClipboardItem&&navigator.clipboard&&navigator.clipboard.write?(await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),ti):(function(e,t){const n=URL.createObjectURL(e),a=document.createElement("a");a.href=n,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(n)}(e,`${function(e){const t=[],n=e.initiator_data?.user_display_name;if(n&&t.push(n),e.message){const n=document.createElement("div");n.innerHTML=e.message,t.push(n.textContent||"")}return t.join(" ").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,80).replace(/-$/,"")||`event-${e.id}`}(t)}.png`),ni)}(t,e);r(n)}catch{s(),r(n)}l(!1),setTimeout((()=>r(n)),2e3)}),[e,t,o,n]);return(0,i.createElement)(s.MenuItem,{icon:ia,onClick:u},a)}function ri({event:e,onClose:t}){return(0,i.createElement)(s.MenuItem,{icon:Vn,onClick:()=>{yn({event:e}),t()}},(0,vt.__)("View event details","simple-history"))}const ii=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"})});function si({event:e,eventsAdminPageURL:t}){const n="wp_user"===e?.initiator&&e?.initiator_data?.user_id&&e?.initiator_data?.user_email,a=e?.logger&&e?.message_key;return(0,i.createElement)(i.Fragment,null,n?(0,i.createElement)(s.MenuItem,{icon:ii,onClick:()=>{const n=JSON.stringify([{id:e.initiator_data.user_id,value:e.initiator_data.user_email}]),a=(0,f.addQueryArgs)(t,{users:n});window.location.href=a}},(0,vt.__)("Find events by the same user","simple-history")):null,a?(0,i.createElement)(s.MenuItem,{icon:ii,onClick:()=>{const n=JSON.stringify([{value:e.message_key,search_options:[`${e.logger}:${e.message_key}`]}]),a=(0,f.addQueryArgs)(t,{messages:n});window.location.href=a}},(0,vt.__)("Filter event by this event type","simple-history")):null)}const oi=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})});function li({event:e,eventsAdminPageURL:t,userCanManageOptions:n}){return n&&e?.id?(0,i.createElement)(s.MenuItem,{icon:oi,onClick:()=>{const n=(0,f.addQueryArgs)(t,{surrounding_event_id:e.id,surrounding_count:5});window.open(n,"_blank","noopener,noreferrer")}},(0,vt.__)("Show surrounding events","simple-history")):null}const ci=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z"})});function ui({event:e,onClose:t,hasPremiumAddOn:n}){const{showModal:a}=Ln();return n||e.sticky?null:(0,i.createElement)(s.MenuItem,{onClick:()=>{a((0,vt.__)("Unlock Sticky Events","simple-history"),(0,vt.__)("Pin important events to the top of your log. Great for keeping critical changes visible, like security incidents or major updates.","simple-history"),ci,"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDAgMjAwIj4KICA8cmVjdCB3aWR0aD0iNDAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iI2YwZjBmMCIvPgogIDxyZWN0IHg9IjIwIiB5PSIyMCIgd2lkdGg9IjM2MCIgaGVpZ2h0PSIxNjAiIHJ4PSI4IiBmaWxsPSIjZmZmIiBzdHJva2U9IiNkZGQiLz4KICA8dGV4dCB4PSI0MCIgeT0iNTAiIGZvbnQtZmFtaWx5PSJzYW5zLXNlcmlmIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzMzIj5TdGljayBldmVudCB0byB0b3A8L3RleHQ+CiAgPHJlY3QgeD0iNDAiIHk9IjY1IiB3aWR0aD0iMzIwIiBoZWlnaHQ9IjQwIiByeD0iNCIgZmlsbD0iI2ZmZjhlMSIgc3Ryb2tlPSIjZmZjMTA3Ii8+CiAgPGNpcmNsZSBjeD0iNjAiIGN5PSI4NSIgcj0iMTAiIGZpbGw9IiNmZmMxMDciLz4KICA8cmVjdCB4PSI4MCIgeT0iNzUiIHdpZHRoPSIyNjAiIGhlaWdodD0iOCIgcng9IjIiIGZpbGw9IiNlMGUwZTAiLz4KICA8cmVjdCB4PSI4MCIgeT0iODgiIHdpZHRoPSIyMDAiIGhlaWdodD0iNiIgcng9IjIiIGZpbGw9IiNmMGYwZjAiLz4KICA8cmVjdCB4PSI0MCIgeT0iMTE1IiB3aWR0aD0iMzIwIiBoZWlnaHQ9IjMwIiByeD0iNCIgZmlsbD0iI2Y1ZjVmNSIgc3Ryb2tlPSIjZTBlMGUwIi8+CiAgPHJlY3QgeD0iNDAiIHk9IjE1MCIgd2lkdGg9IjMyMCIgaGVpZ2h0PSIyNSIgcng9IjQiIGZpbGw9IiNmNWY1ZjUiIHN0cm9rZT0iI2UwZTBlMCIvPgo8L3N2Zz4K"),t()},icon:ci},(0,vt.__)("Stick event to top…","simple-history"))}function di({event:e,onClose:t,userCanManageOptions:n}){const[a,r]=(0,c.useState)(!1);return e.sticky&&n?(0,i.createElement)(i.Fragment,null,(0,i.createElement)(s.MenuItem,{onClick:()=>{r(!0)},icon:ci},(0,vt.__)("Unstick event…","simple-history")),a?(0,i.createElement)(s.__experimentalConfirmDialog,{cancelButtonText:(0,vt.__)("Nope","simple-history"),confirmButtonText:(0,vt.__)("Yes, unstick it","simple-history"),onConfirm:async()=>{try{await d()({path:`/simple-history/v1/events/${e.id}/unstick`,method:"POST"})}catch(e){}finally{t()}},onCancel:()=>r(!1)},(0,vt.sprintf)(/* translators: %s: The message of the event. */ /* translators: %s: The message of the event. */ (0,vt.__)('Unstick event "%s"?',"simple-history"),e.message)):null):null}const mi=(0,i.createElement)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -960 960 960"},(0,i.createElement)(xn.Path,{d:"M480-480Zm.07 380q-78.84 0-148.21-29.92t-120.68-81.21q-51.31-51.29-81.25-120.63Q100-401.1 100-479.93q0-78.84 29.93-148.21 29.92-69.37 81.22-120.68t120.65-81.25Q401.15-860 480-860q41.46 0 80.31 8.31 38.84 8.31 74.3 24.31v67.3q-34.23-18.84-73.23-29.38Q522.38-800 480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-30.46-5.73-59.12-5.73-28.65-15.96-55.49h64.46q8.61 27.46 12.92 55.71Q860-510.65 860-480q0 78.85-29.92 148.2t-81.21 120.65q-51.29 51.3-120.63 81.22Q558.9-100 480.07-100ZM810-690v-80h-80v-60h80v-80h60v80h80v60h-80v80h-60ZM616.24-527.69q21.84 0 37.03-15.29 15.19-15.28 15.19-37.11t-15.28-37.02q-15.28-15.2-37.12-15.2-21.83 0-37.02 15.29-15.19 15.28-15.19 37.11t15.28 37.02q15.28 15.2 37.11 15.2Zm-272.3 0q21.83 0 37.02-15.29 15.19-15.28 15.19-37.11t-15.28-37.02q-15.28-15.2-37.11-15.2-21.84 0-37.03 15.29-15.19 15.28-15.19 37.11t15.28 37.02q15.28 15.2 37.12 15.2Zm250.71 220.34q51.66-35.04 76.27-92.65H289.08q24.61 57.61 76.27 92.65Q417-272.31 480-272.31q63 0 114.65-35.04Z"})),hi=(0,In.applyFilters)("SimpleHistory.reactions.types",[{type:"thumbsup",emoji:"👍",label:"Thumbs up",premium:!1},{type:"heart",emoji:"❤️",label:"Heart",premium:!0},{type:"smile",emoji:"😄",label:"Funny",premium:!0},{type:"tada",emoji:"🎉",label:"Celebrate",premium:!0},{type:"eyes",emoji:"👀",label:"Looking into this",premium:!0},{type:"rocket",emoji:"🚀",label:"Rocket",premium:!0},{type:"clap",emoji:"👏",label:"Well done",premium:!0},{type:"fire",emoji:"🔥",label:"Fire",premium:!0}]),pi=hi.filter((e=>!e.premium)),gi=hi.filter((e=>e.premium)),fi=Object.fromEntries(hi.map((e=>[e.type,e.emoji])));function yi({type:e,data:t,isUpdating:n,toggleReaction:a,currentUserId:r}){const o=(0,c.useRef)(null),l=fi[e]||e,u=(0,vt.__)("You","simple-history"),d=t.user_ids||[],m=[...(t.user_names||[]).map(((e,t)=>d[t]===r?u:e))].sort(((e,t)=>e===u?-1:t===u?1:0)),h=m.length>0?m.join(", "):"";return(0,i.createElement)(s.Tooltip,{text:h,placement:"top"},(0,i.createElement)(s.Button,{ref:o,className:"SimpleHistoryLogitem__reactionButton "+(t.reacted?"SimpleHistoryLogitem__reactionButton--active":""),onClick:()=>{!function(e,t){const n=e.current;n&&(n.classList.remove(t),n.offsetWidth,n.classList.add(t))}(o,"SimpleHistoryLogitem__reactionButton--animating"),a(e)},disabled:!r,"aria-pressed":t.reacted,size:"small"},(0,i.createElement)("span",{className:"SimpleHistoryLogitem__reactionEmoji"},l),(0,i.createElement)("span",{className:"SimpleHistoryLogitem__reactionCount"},t.count)))}function vi({anchor:e,placement:t,isUpdating:n,onEmojiClick:a,onClose:r}){const{hasPremiumAddOn:o}=g(),l=!o&&gi.length>0;return(0,i.createElement)(s.Popover,{anchor:e,noArrow:!1,offset:8,placement:t,shift:!0,animate:!0,className:"sh-ReactionPicker",onFocusOutside:r,onClose:r},(0,i.createElement)("div",{className:"sh-ReactionPicker__content"},(0,i.createElement)("div",{className:"sh-ReactionPicker__freeSection"},pi.map((e=>(0,i.createElement)("button",{key:e.type,className:"sh-ReactionPicker__emoji",onClick:()=>a(e.type),disabled:n,title:e.label,type:"button"},(0,i.createElement)("span",null,e.emoji))))),l&&(0,i.createElement)("a",{href:wn("https://simple-history.com/add-ons/premium/","premium_reactions"),className:"sh-ReactionPicker__premiumSection",target:"_blank",rel:"noopener noreferrer"},(0,i.createElement)("span",{className:"sh-ReactionPicker__premiumEmojis"},gi.map((e=>(0,i.createElement)("span",{key:e.type,className:"sh-ReactionPicker__premiumEmoji"},e.emoji)))),(0,i.createElement)("span",{className:"sh-ReactionPicker__premiumText"},(0,vt.__)("More with Premium →","simple-history")))))}function _i({isUpdating:e,toggleReaction:t}){const{currentUserId:n}=g(),[a,r]=(0,c.useState)(!1),s=(0,c.useRef)(null);return(0,i.createElement)(i.Fragment,null,(0,i.createElement)("button",{ref:s,className:"SimpleHistoryLogitem__reactionAddInline",onClick:()=>r(!a),disabled:!n,"aria-expanded":a?"true":"false","aria-label":(0,vt.__)("Add reaction…","simple-history"),type:"button"},(0,i.createElement)("span",{"aria-hidden":"true"},"+")),a&&(0,i.createElement)(vi,{anchor:s.current,placement:"bottom-start",isUpdating:e,onEmojiClick:e=>{t(e),r(!1)},onClose:()=>r(!1)}))}function wi({reactions:e,isUpdating:t,toggleReaction:n}){const{experimentalFeaturesEnabled:a,currentUserId:r}=g();if(!a)return null;const s=Object.entries(e).filter((([,e])=>e.count>0));return 0===s.length?null:(0,i.createElement)("div",{className:"SimpleHistoryLogitem__reactions"},s.map((([e,a])=>(0,i.createElement)(yi,{key:e,type:e,data:a,isUpdating:t,toggleReaction:n,currentUserId:r}))),(0,i.createElement)(_i,{isUpdating:t,toggleReaction:n}))}function bi({isUpdating:e,toggleReaction:t}){const{experimentalFeaturesEnabled:n,currentUserId:a}=g(),[r,o]=(0,c.useState)(!1),l=(0,c.useRef)(null);return n?(0,i.createElement)(i.Fragment,null,(0,i.createElement)(s.Button,{ref:l,className:"SimpleHistoryLogitem__reactionQuickButton",icon:mi,label:(0,vt.__)("Add reaction…","simple-history"),size:"small",onClick:()=>o(!r),disabled:!a,"aria-expanded":r?"true":"false"}),r&&(0,i.createElement)(vi,{anchor:l.current,placement:"bottom-end",isUpdating:e,onEmojiClick:e=>{t(e),o(!1)},onClose:()=>o(!1)})):null}function Ii({event:e,eventVariant:t,reactionState:n}){const{eventsAdminPageURL:a,hasPremiumAddOn:r,userCanManageOptions:o}=g(),l=(0,c.useRef)(null);return"modal"===t||"dashboard"===t?null:(0,i.createElement)("div",{ref:l,className:"SimpleHistoryLogitem__actions"},n&&(0,i.createElement)(bi,{isUpdating:n.isUpdating,toggleReaction:n.toggleReaction}),(0,i.createElement)(s.Button,{icon:Un,label:(0,vt.__)("Event details","simple-history"),size:"small",onClick:()=>yn({event:e})}),(0,i.createElement)(s.DropdownMenu,{label:(0,vt.__)("Actions…","simple-history"),icon:Gn,popoverProps:{placement:"left-start",inline:!0}},(({onClose:n})=>(0,i.createElement)(i.Fragment,null,(0,i.createElement)(s.MenuGroup,null,(0,i.createElement)(ri,{event:e,eventVariant:t,onClose:n}),(0,i.createElement)(aa,{event:e})),(0,i.createElement)(s.MenuGroup,null,(0,i.createElement)(Xn,{event:e}),(0,i.createElement)(ea,{event:e}),(0,i.createElement)(ta,{event:e}),(0,i.createElement)(ai,{event:e,actionsRef:l})),(0,i.createElement)(s.MenuGroup,null,(0,i.createElement)(si,{event:e,eventsAdminPageURL:a}),(0,i.createElement)(li,{event:e,eventsAdminPageURL:a,userCanManageOptions:o})),(0,i.createElement)(s.MenuGroup,null,(0,i.createElement)(di,{event:e,onClose:n,userCanManageOptions:o}),(0,i.createElement)(ui,{event:e,onClose:n,hasPremiumAddOn:r})),(0,i.createElement)(s.MenuGroup,null,(0,i.createElement)(s.Slot,{name:"SimpleHistorySlotEventActionsMenu",fillProps:{onClose:n,event:e,eventVariant:t,userCanManageOptions:o}}))))))}const xi={view:"sh-Icon--visibility",edit:"sh-Icon--edit",preview:"sh-Icon--preview",revisions:"sh-Icon--history",details:"sh-Icon--details"};function Si({event:e}){const t=e.action_links;return t&&0!==t.length?(0,i.createElement)("div",{className:"SimpleHistoryLogitem__actionLinks"},t.map((e=>(0,i.createElement)("a",{key:e.action,href:e.url,title:e.description||void 0,className:"SimpleHistoryLogitem__actionLinks__link"},xi[e.action]&&(0,i.createElement)("span",{className:`sh-Icon ${xi[e.action]}`}),e.label)))):null}function Ei(e){const{event:t}=e,{details_html:n}=t;return(0,i.createElement)("div",{className:"SimpleHistoryLogitem__details",dangerouslySetInnerHTML:{__html:n}})}function Ci(e){const{children:t,className:n}=e,a=$n("SimpleHistoryLogitem__inlineDivided",n);return(0,i.createElement)(i.Fragment,null," ",(0,i.createElement)("span",{className:a},t))}function ki(e){const{event:t,eventVariant:n}=e,{eventsAdminPageURL:a}=g(),r=(0,ra.getSettings)(),o=r.formats.datetimeAbbreviated,l=r.formats.time,u=r.timezone.string,d=Intl.DateTimeFormat().resolvedOptions().timeZone,m=t.date_gmt+"+0000";let h;h=(0,ra.date)("Y-m-d",m)===(0,ra.date)("Y-m-d",void 0,"GMT")?(0,vt.sprintf)( // translators: %s is the time, like 8:36 pm. // translators: %s is the time, like 8:36 pm. (0,vt.__)("Today %s","simple-history"),(0,ra.dateI18n)(l,m,d)):(0,ra.dateI18n)(o,m,d);const[p,f]=(0,c.useState)((()=>(0,ra.humanTimeDiff)(t.date_local)));(0,c.useEffect)((()=>{const e=setInterval((()=>{f((0,ra.humanTimeDiff)(t.date_local))}),1e3);return()=>{clearInterval(e)}}),[t.date_local]);const y=(0,i.createElement)(i.Fragment,null,(0,i.createElement)("table",null,(0,i.createElement)("thead",null,(0,i.createElement)("tr",null,(0,i.createElement)("th",null,(0,vt.__)("Date","simple-history")),(0,i.createElement)("th",null,(0,vt.__)("Description","simple-history")))),(0,i.createElement)("tbody",null,(0,i.createElement)("tr",null,(0,i.createElement)("td",null,t.date_gmt),(0,i.createElement)("td",null,(0,vt.__)("GMT time","simple-history"))),(0,i.createElement)("tr",null,(0,i.createElement)("td",null,t.date_local),(0,i.createElement)("td",null,(0,vt.sprintf)(/* translators: 1: timezone string */ /* translators: 1: timezone string */ (0,vt.__)("Website timezone (%1$s)","simple-history"),u))),u!==d&&(0,i.createElement)("tr",null,(0,i.createElement)("td",null,(0,ra.dateI18n)("Y-m-d H:i:s",m,d)),(0,i.createElement)("td",null,(0,vt.sprintf)(/* translators: 1: browser timezone */ /* translators: 1: browser timezone */ (0,vt.__)("Browser local time (%1$s)","simple-history"),d)))))),v=(0,i.createElement)("time",{dateTime:t.date_gmt,className:"SimpleHistoryLogitem__when__liveRelative"},h," (",p,")");let _;if("compact"===n)_=(0,i.createElement)("span",null,p);else if("dashboard"===n){const e=a?`${a}#simple-history/event/${t.id}`:void 0;_=e?(0,i.createElement)("a",{href:e,title:h},p):(0,i.createElement)("span",{title:h},p)}else _=(0,i.createElement)(s.Tooltip,{text:y,delay:500},"modal"===n?(0,i.createElement)(s.__experimentalText,null,v):(0,i.createElement)(s.Button,{variant:"link",onClick:()=>{yn({event:t})}},v));return(0,i.createElement)(Ci,{className:"SimpleHistoryLogitem__permalink SimpleHistoryLogitem__when"},_)}const Mi=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})}),Ni=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})}),Ai=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"})}),Pi=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z"})});let Li=null;const Ti={},ji={},Di=(0,i.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24","aria-hidden":"true"},(0,i.createElement)("path",{d:"M6 7l5 5-5 5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,i.createElement)("path",{d:"M13 17h5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}));function Hi(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Zi(e){return"date"===e.type?(0,ra.humanTimeDiff)(e.value):e.value}function Fi(){return wn("https://simple-history.com/add-ons/premium/","premium_user_card")}function Oi(){return(0,i.createElement)("div",{className:"sh-UserCard__premiumTeaser sh-UserCard__premiumTeaser--blurred",role:"group","aria-label":(0,vt.__)("Premium features","simple-history")},(0,i.createElement)("a",{href:Fi(),className:"sh-UserCard__blurredPreview",target:"_blank",rel:"noopener noreferrer"},(0,i.createElement)("ul",{className:"sh-UserCard__meta","aria-hidden":"true"},(0,i.createElement)("li",{className:"sh-UserCard__detail sh-UserCard__detail--blurred"},(0,vt.__)("Logged in","simple-history")," ",(0,i.createElement)("span",{className:"sh-UserCard__blurredValue"},"3")," ",(0,vt.__)("hours ago","simple-history")),(0,i.createElement)("li",{className:"sh-UserCard__detail sh-UserCard__detail--blurred"},(0,vt.__)("Last activity","simple-history")," ",(0,i.createElement)("span",{className:"sh-UserCard__blurredValue"},"12")," ",(0,vt.__)("minutes ago","simple-history"))),(0,i.createElement)("div",{className:"sh-UserCard__stats","aria-hidden":"true"},(0,i.createElement)("div",{className:"sh-UserCard__stat"},(0,i.createElement)("span",{className:"sh-UserCard__statValue sh-UserCard__blurredValue"},"8"),(0,i.createElement)("span",{className:"sh-UserCard__statLabel"},(0,vt.__)("Today","simple-history"))),(0,i.createElement)("div",{className:"sh-UserCard__stat"},(0,i.createElement)("span",{className:"sh-UserCard__statValue sh-UserCard__blurredValue"},"34"),(0,i.createElement)("span",{className:"sh-UserCard__statLabel"},(0,vt.__)("Last 7 days","simple-history"))),(0,i.createElement)("div",{className:"sh-UserCard__stat"},(0,i.createElement)("span",{className:"sh-UserCard__statValue sh-UserCard__blurredValue"},"847"),(0,i.createElement)("span",{className:"sh-UserCard__statLabel"},(0,vt.__)("Total","simple-history")))),(0,i.createElement)("span",{className:"sh-UserCard__blurredAction","aria-hidden":"true"},(0,i.createElement)(s.Icon,{icon:Mi,size:16}),(0,vt.__)("View all user activity","simple-history")),(0,i.createElement)("span",{className:"sh-UserCard__premiumBadge"},(0,vt.__)("Available with Premium","simple-history"))))}function Wi({event:e,cardData:t,isLoading:n}){const{initiator_data:a}=e,r=a?.user_id,o=t?.display_name||a.user_display_name||a.user_login,l=t?.user_email||a.user_email,c=t?.avatar_url||a.user_avatar_url,u=t?.roles,d=t?.has_premium_add_on,m=t?.details||[],h=m.filter((e=>"stat"!==e.type)),p=m.filter((e=>"stat"===e.type)),g=t?.actions||[];return(0,i.createElement)("div",{className:"sh-UserCard__content"},(0,i.createElement)("div",{className:"sh-UserCard__identity"},c&&(0,i.createElement)("img",{className:"sh-UserCard__avatar",src:c,alt:""}),(0,i.createElement)("div",{className:"sh-UserCard__info"},(0,i.createElement)("h4",{className:"sh-UserCard__name"},o,r&&(0,i.createElement)("span",{className:"sh-UserCard__userId","aria-label":(0,vt.sprintf)(/* translators: %s: user ID number */ /* translators: %s: user ID number */ (0,vt.__)("User ID %s","simple-history"),r)},`#${r}`)),(0,i.createElement)("ul",{className:"sh-UserCard__meta"},u&&u.length>0&&(0,i.createElement)("li",{className:"sh-UserCard__role"},u.map(Hi).join(", ")),l&&(0,i.createElement)("li",null,(0,i.createElement)("a",{href:`mailto:${l}`,className:"sh-UserCard__email"},l)),!n&&h.map((e=>(0,i.createElement)("li",{key:e.key,className:"sh-UserCard__detail"},e.label?(0,vt.sprintf)("%s %s",e.label,Zi(e)):Zi(e))))))),n&&(0,i.createElement)("div",{className:"sh-UserCard__loading"},(0,i.createElement)(s.Spinner,null)),!n&&p.length>0&&(0,i.createElement)("div",{className:"sh-UserCard__stats"},(0,i.createElement)("h5",{className:"sh-UserCard__statsHeading"},(0,vt.__)("Events","simple-history")),p.map((e=>(0,i.createElement)("div",{key:e.key,className:"sh-UserCard__stat"},(0,i.createElement)("span",{className:"sh-UserCard__statValue"},e.value),(0,i.createElement)("span",{className:"sh-UserCard__statLabel"},e.label))))),!n&&t&&!d&&(0,i.createElement)(Oi,null),g.length>0&&(0,i.createElement)("nav",{className:"sh-UserCard__actions","aria-label":(0,vt.__)("User actions","simple-history")},(0,i.createElement)("ul",null,g.map((e=>(0,i.createElement)("li",{key:e.key},(0,i.createElement)("a",{href:e.url,className:"sh-UserCard__actionLink"},(0,i.createElement)(s.Icon,{icon:"view_profile"===e.key?Ni:Mi,size:16}),e.label)))))))}function Ri({event:e,cardData:t,isLoading:n}){const{initiator:a,initiator_data:r}=e,o=t?.has_premium_add_on,l=t?.actions||[],c=(t?.details||[]).filter((e=>"stat"===e.type));let u,d,m;switch(a){case"web_user":u=(0,vt.__)("Anonymous web user","simple-history"),d=(0,vt.__)("A visitor to your site who was not logged in.","simple-history"),m=(0,vt.__)("View all anonymous activity","simple-history");break;case"wp_cli":u=(0,vt.__)("WP-CLI","simple-history"),d=(0,vt.__)("Action performed via the WP-CLI command line tool.","simple-history"),m=(0,vt.__)("View all WP-CLI activity","simple-history");break;case"wp":u=(0,vt.__)("WordPress","simple-history"),d=(0,vt.__)("An automatic action by WordPress, such as a scheduled task or auto-update.","simple-history"),m=(0,vt.__)("View all WordPress activity","simple-history");break;case"other":u=(0,vt.__)("Other","simple-history"),d=(0,vt.__)("Action triggered by a plugin, theme, or external process.","simple-history"),m=(0,vt.__)("View all activity from other sources","simple-history");break;default:u=a,d=null,m=null}return(0,i.createElement)("div",{className:"sh-UserCard__content"},(0,i.createElement)("div",{className:"sh-UserCard__identity"},"wp"===a?(0,i.createElement)("div",{className:"sh-UserCard__avatar sh-UserCard__avatar--placeholder sh-UserCard__avatar--wp"},(0,i.createElement)(s.Icon,{icon:Ai,size:36})):"wp_cli"===a?(0,i.createElement)("div",{className:"sh-UserCard__avatar sh-UserCard__avatar--placeholder sh-UserCard__avatar--cli"},Di):r?.user_avatar_url?(0,i.createElement)("img",{className:"sh-UserCard__avatar",src:r.user_avatar_url,alt:""}):(0,i.createElement)("div",{className:"sh-UserCard__avatar sh-UserCard__avatar--placeholder"}),(0,i.createElement)("div",{className:"sh-UserCard__info"},(0,i.createElement)("h4",{className:"sh-UserCard__name"},u),d&&(0,i.createElement)("p",{className:"sh-UserCard__description"},d))),n&&(0,i.createElement)("div",{className:"sh-UserCard__loading"},(0,i.createElement)(s.Spinner,null)),!n&&c.length>0&&(0,i.createElement)("div",{className:"sh-UserCard__stats"},(0,i.createElement)("h5",{className:"sh-UserCard__statsHeading"},(0,vt.__)("Events","simple-history")),c.map((e=>(0,i.createElement)("div",{key:e.key,className:"sh-UserCard__stat"},(0,i.createElement)("span",{className:"sh-UserCard__statValue"},e.value),(0,i.createElement)("span",{className:"sh-UserCard__statLabel"},e.label))))),l.length>0&&(0,i.createElement)("nav",{className:"sh-UserCard__actions","aria-label":(0,vt.__)("User actions","simple-history")},(0,i.createElement)("ul",null,l.map((e=>(0,i.createElement)("li",{key:e.key},(0,i.createElement)("a",{href:e.url,className:"sh-UserCard__actionLink"},(0,i.createElement)(s.Icon,{icon:Mi,size:16}),e.label)))))),!n&&t&&m&&!o&&(0,i.createElement)("div",{className:"sh-UserCard__premiumTeaser sh-UserCard__premiumTeaser--blurred"},(0,i.createElement)("a",{href:Fi(),className:"sh-UserCard__blurredPreview",target:"_blank",rel:"noopener noreferrer"},(0,i.createElement)("span",{className:"sh-UserCard__blurredAction"},(0,i.createElement)(s.Icon,{icon:Mi,size:16}),m),(0,i.createElement)("span",{className:"sh-UserCard__premiumBadge"},(0,vt.__)("Available with Premium","simple-history")))))}function Bi({event:e,children:t}){const[n,a]=(0,c.useState)(!1),[r,o]=(0,c.useState)(!1),[l,u]=(0,c.useState)(null),m=(0,c.useRef)(null),h="wp_user"===e.initiator,p=e.initiator_data?.user_id,g=()=>a(!1);return(0,c.useEffect)((()=>{if(!n)return;const e=e=>{"Escape"===e.key&&(a(!1),m.current?.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[n]),(0,c.useEffect)((()=>()=>{Li===g&&(Li=null)}),[]),(0,i.createElement)("span",{style:{position:"relative",display:"inline-block"}},(0,i.createElement)(s.Button,{ref:m,onClick:t=>{if(t.target.closest(".sh-UserCard__popover"))return;if(n)return void a(!1);if(Li&&Li(),Li=g,a(!0),l)return;let r;if(h){if(!p)return;if(Ti[p])return void u(Ti[p]);r=`/simple-history/v1/users/${p}/card`}else{if(ji[e.initiator])return void u(ji[e.initiator]);r=`/simple-history/v1/initiators/${e.initiator}/card`}o(!0),d()({path:r}).then((t=>{h?Ti[p]=t:ji[e.initiator]=t,u(t),o(!1)})).catch((()=>{o(!1)}))},variant:"link",className:"sh-UserCard__trigger"},t),n&&(0,i.createElement)(s.Popover,{anchorRef:m,noArrow:!1,offset:10,placement:"top",animate:!1,shift:!0,className:"sh-UserCard__popover",onFocusOutside:()=>a(!1)},(0,i.createElement)("div",{className:"sh-UserCard"},(0,i.createElement)(s.Button,{icon:Pi,iconSize:20,size:"small",onClick:()=>a(!1),label:(0,vt.__)("Close","simple-history"),className:"sh-UserCard__close"}),h?(0,i.createElement)(Wi,{event:e,cardData:l,isLoading:r}):(0,i.createElement)(Ri,{event:e,cardData:l,isLoading:r}))))}function zi(e){const{event:t,eventVariant:n}=e,{initiator_data:a}=t;switch(t.initiator){case"wp_user":const e=a.user_display_name||a.user_login;let r;return r="compact"===n?(0,i.createElement)("strong",null,e):"dashboard"===n?(0,i.createElement)(Bi,{event:t},(0,i.createElement)("strong",null,e)):"modal"===n?(0,i.createElement)("strong",null,e):(0,i.createElement)(Bi,{event:t},(0,i.createElement)(i.Fragment,null,(0,i.createElement)("strong",null,e)," ",(0,i.createElement)("span",null,"(",a.user_email,")"))),(0,i.createElement)(Ci,null,r);case"web_user":return(0,i.createElement)(Ci,null,(0,i.createElement)(Bi,{event:t},(0,i.createElement)("strong",null,(0,vt.__)("Anonymous web user","simple-history"))));case"wp_cli":return(0,i.createElement)(Ci,null,(0,i.createElement)(Bi,{event:t},(0,i.createElement)("strong",null,(0,vt.__)("WP-CLI","simple-history"))));case"wp":return(0,i.createElement)(Ci,null,(0,i.createElement)(Bi,{event:t},(0,i.createElement)("strong",null,(0,vt.__)("WordPress","simple-history"))));case"other":return(0,i.createElement)(Ci,null,(0,i.createElement)(Bi,{event:t},(0,i.createElement)("strong",null,(0,vt.__)("Other","simple-history"))));default:return(0,i.createElement)(Ci,null,"Unknown initiator: ",(0,i.createElement)("code",null,t.initiator))}}const $i=[{key:"hostname",label:(0,vt.__)("Hostname:","simple-history")},{key:"org",label:(0,vt.__)("Org:","simple-history"),render:e=>{const t=e.match(/^(AS\d+)\s+(.+)$/);return t?(0,i.createElement)(c.Fragment,null,(0,i.createElement)(s.ExternalLink,{href:`https://ipinfo.io/${t[1]}`},t[1])," ",t[2]):e}},{key:"city",label:(0,vt.__)("City:","simple-history")},{key:"region",label:(0,vt.__)("Region:","simple-history")},{key:"country",label:(0,vt.__)("Country:","simple-history")},{key:"loc",label:(0,vt.__)("Location:","simple-history"),render:e=>(0,i.createElement)(c.Fragment,null,e,(0,i.createElement)("br",null),(0,i.createElement)(s.ExternalLink,{href:`https://www.google.com/maps/place/${e}`},"Google Maps")," | ",(0,i.createElement)(s.ExternalLink,{href:`https://www.openstreetmap.org/?mlat=${e.split(",")[0]}&mlon=${e.split(",")[1]}#map=10/${e.split(",")[0]}/${e.split(",")[1]}`},"OpenStreetMap"))}];let Ui=null;function Gi(e){const{header:t,ipAddress:n}=e,{mapsApiKey:a,hasPremiumAddOn:r,eventsSettingsPageURL:o}=g(),[l,u]=(0,c.useState)(!1),[d,m]=(0,c.useState)(!1),[h,p]=(0,c.useState)(),f=(0,c.useRef)(null);(0,c.useEffect)((()=>{if(!l)return;const e=e=>{"Escape"===e.key&&(u(!1),f.current?.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[l]);const y=`https://ipinfo.io/${n.replace(/\.x$/,".0")}`;(0,c.useEffect)((()=>{d&&async function(){const e=await fetch(y,{method:"GET",headers:{Accept:"application/json"}}),t=await e.json();p(t),m(!1)}()}),[d,n,y]);const v=(0,c.createInterpolateElement)((0,vt.__)("That IP address does not seem like a public one. It is probably a <a>bogon ip address</a>.","simple-history"),{a:(0,i.createElement)(s.ExternalLink,{href:"https://ipinfo.io/bogon",target:"_blank",rel:"noopener noreferrer"})}),_=a&&!h?.bogon&&h?.loc?(0,i.createElement)("a",{href:`https://www.google.com/maps/place/${h.loc}/@${h.loc},6z`,target:"_blank",rel:"noopener noreferrer"},(0,i.createElement)("img",{src:`https://maps.googleapis.com/maps/api/staticmap?center=${h.loc}&zoom=7&size=350x150&scale=2&sensor=false&key=${a}`,width:"350",height:"150",alt:"Google Map"})):null,w=r&&!a?(0,i.createElement)("div",{style:{display:"grid",placeItems:"center",width:"100%",paddingRight:"40px",paddingLeft:"20px",height:100,backgroundImage:'url("/wp-content/plugins/simple-history/assets/images/map-img-blur.jpg")',backgroundSize:"cover"}},(0,i.createElement)(s.__experimentalText,null,(0,c.createInterpolateElement)((0,vt.__)("Add a Google Maps API key in <a>Settings</a> to show a map of this location.","simple-history"),{a:o?(0,i.createElement)("a",{href:`${o}#simple-history-premium-settings`}):(0,i.createElement)("span",null)}))):null,b=r?null:(0,i.createElement)(c.Fragment,null,(0,i.createElement)("div",{style:{display:"grid",placeItems:"center",width:"100%",paddingRight:"40px",paddingLeft:"20px",height:100,backgroundImage:'url("/wp-content/plugins/simple-history/assets/images/map-img-blur.jpg")',backgroundSize:"cover"}},(0,i.createElement)(s.__experimentalText,null,(0,c.createInterpolateElement)((0,vt.__)("See the location of the IP address on a map with <a>Simple History Premium</a> add-on.","simple-history"),{a:(0,i.createElement)(s.ExternalLink,{href:wn("https://simple-history.com/add-ons/premium/#GoogleMaps","premium_events_ipaddress"),target:"_blank",rel:"noopener noreferrer"})})))),I=(0,i.createElement)("p",{style:{textAlign:"center",height:150,lineHeight:"150px",background:"var(--sh-color-gray-4)",margin:0}},(0,vt.__)("Getting IP info…","simple-history")),x=e=>{window.dispatchEvent(new CustomEvent("SimpleHistory:filterByIPAddress",{detail:{ipAddress:e}})),u(!1)},S=n.replace(/\.\d+$/,".x"),E=h?(0,i.createElement)(c.Fragment,null,b,_,w,(0,i.createElement)("div",{style:{padding:"var(--sh-spacing-medium)"}},(0,i.createElement)(s.__experimentalText,{variant:"muted",size:"small"},(0,vt.__)("IP address","simple-history")," ",(0,i.createElement)("code",{style:{fontSize:"11px"}},t)),(0,i.createElement)("div",{style:{fontSize:"1.5em",fontWeight:700,fontFamily:"monospace",lineHeight:1.3}},n)),(0,i.createElement)("div",{style:{}},(0,i.createElement)("table",{className:"SimpleHistoryIpInfoDropin__ipInfoTable"},(0,i.createElement)("tbody",null,h.bogon?(0,i.createElement)("tr",null,(0,i.createElement)("td",{className:"SimpleHistoryIpInfoDropin__ipInfoTable__key"},(0,vt.__)("Error:","simple-history")),(0,i.createElement)("td",null,v)):null,$i.map((e=>{const{key:t,label:n}=e,a=h[t];return a?(0,i.createElement)("tr",{key:t},(0,i.createElement)("td",{className:"SimpleHistoryIpInfoDropin__ipInfoTable__key"},n),(0,i.createElement)("td",null,e.render?e.render(a):a)):null})),(0,i.createElement)("tr",null,(0,i.createElement)("td",{className:"SimpleHistoryIpInfoDropin__ipInfoTable__key"},(0,vt.__)("Filter events:","simple-history")),(0,i.createElement)("td",null,(0,i.createElement)(s.Button,{variant:"link",onClick:()=>x(n),style:{fontSize:"inherit"}},(0,vt.__)("This IP","simple-history")),!n.endsWith(".x")&&(0,i.createElement)(c.Fragment,null," | ",(0,i.createElement)(s.Button,{variant:"link",onClick:()=>x(S),style:{fontSize:"inherit"}},(0,vt.__)("This subnet","simple-history"),` (${S})`))))))),(0,i.createElement)(s.__experimentalText,{isBlock:!0,variant:"muted",style:{padding:"var(--sh-spacing-medium)"}},(0,c.createInterpolateElement)((0,vt.__)("IP info provided by <a>ipinfo.io</a>","simple-history"),{a:(0,i.createElement)(s.ExternalLink,{href:"https://ipinfo.io/",target:"_blank",rel:"noopener noreferrer"})}))):null;return(0,i.createElement)("div",{style:{position:"relative",display:"inline-block"}},(0,i.createElement)(s.Button,{ref:f,title:t,onClick:e=>{"BUTTON"!==e.target.nodeName||(l?u(!1):(Ui&&Ui(),Ui=()=>u(!1),u(!0),m(!0)))},variant:"link"},n),l?(0,i.createElement)(s.Popover,{anchorRef:f,noArrow:!1,offset:10,placement:"top",animate:!1,shift:!0,onFocusOutside:()=>u(!1)},(0,i.createElement)("div",{style:{minWidth:350,minHeight:300,overflow:"hidden"}},(0,i.createElement)(s.Button,{icon:Pi,onClick:()=>u(!1),style:{position:"absolute",top:0,right:0}}),(0,i.createElement)("div",null,d?(0,i.createElement)(c.Fragment,null,I):(0,i.createElement)(c.Fragment,null,E)))):null)}function Vi(e){const{event:t,eventVariant:n}=e,{ip_addresses:a}=t;if(!a)return null;const r=Object.keys(a).length;if(0===r)return null;const s="dashboard"===n?"":(0,vt._n)("IP address:","IP addresses:",r,"simple-history"),o=[];let l=0;for(const[e,t]of Object.entries(a))o.push((0,i.createElement)(c.Fragment,{key:e},(0,i.createElement)(Gi,{header:e,ipAddress:t})," ",l<r-1?", ":"")),l++;return(0,i.createElement)(Ci,null,s," ",o)}function qi(e){const{event:t}=e,{via:n}=t;return n?(0,i.createElement)(Ci,null,n):null}const Yi=(0,c.forwardRef)((function({icon:e,size:t=24,...n},a){return(0,c.cloneElement)(e,{width:t,height:t,...n,ref:a})})),Qi=(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false"},(0,i.createElement)("path",{fill:"currentColor",d:"M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25L19 9zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12z"})),Ji={verticalAlign:"text-bottom",marginInlineEnd:"4px"};function Ki(e){const{event:t}=e,n=t?.ai_origin;if(!n||!n.agent_name)return null;const a=(0,vt.sprintf)(/* translators: %s: AI agent name (e.g. "Claude Code"). */ /* translators: %s: AI agent name (e.g. "Claude Code"). */ (0,vt.__)("AI agent: %s","simple-history"),n.agent_name),r=wn("https://simple-history.com/docs/ai-agent-detection/","ai-agent-detection","plugin","tooltip"),o=(0,i.createElement)(i.Fragment,null,(0,i.createElement)("p",null,(0,vt.__)("This event looks like it was made by an AI tool acting on behalf of a logged-in user.","simple-history")),(0,i.createElement)("p",null,(0,vt.sprintf)(/* translators: %s: explanation of how the AI agent was detected. */ /* translators: %s: explanation of how the AI agent was detected. */ (0,vt.__)("Detected from %s.","simple-history"),function(e){switch(e){case"abilities-api":return(0,vt.__)("a WordPress API designed for AI integrations","simple-history");case"signature-agent":return(0,vt.__)("a verified signature the AI agent attached to its request","simple-history");case"header":return(0,vt.__)("a special request marker used by AI coding tools","simple-history");case"user-agent":return(0,vt.__)("the name the AI tool reported in its request","simple-history");case"wp-cli-env":return(0,vt.__)("an environment marker the AI tool left when running command-line tasks","simple-history");default:return(0,vt.__)("signals in the request","simple-history")}}(n.detected_via))),(0,i.createElement)("p",null,(0,i.createElement)("a",{href:r,target:"_blank",rel:"noopener noreferrer"},(0,vt.__)("Learn how AI detection works","simple-history"))));return(0,i.createElement)(Ci,{className:"SimpleHistoryLogitem__aiOrigin"},(0,i.createElement)(s.Tooltip,{text:o},(0,i.createElement)("span",{role:"img","aria-label":a,tabIndex:0},(0,i.createElement)(Yi,{icon:Qi,size:12,style:Ji}),n.agent_name)))}function Xi(e){const{event:t}=e;if(!t.backfilled)return null;const n=(0,vt.__)("Backfilled entry","simple-history");return(0,i.createElement)(Ci,{className:"SimpleHistoryLogitem__backfilledEvent"},n)}function es(e){const{event:t,eventVariant:n,isSurroundingEventsMode:a}=e;return(0,i.createElement)("div",{className:"SimpleHistoryLogitem__header"},a&&(0,i.createElement)("span",{className:"SimpleHistoryLogitem__eventId"},"#",t.id),(0,i.createElement)(zi,{event:t,eventVariant:n}),(0,i.createElement)(Ki,{event:t}),(0,i.createElement)(ki,{event:t,eventVariant:n}),(0,i.createElement)(Vi,{event:t,eventVariant:n}),(0,i.createElement)(qi,{event:t}),(0,i.createElement)(Xi,{event:t}))}function ts(e){const{event:t}=e,{initiator_data:n}=t;return(0,i.createElement)("img",{className:"SimpleHistoryLogitem__senderImage",src:n.user_avatar_url,alt:""})}function ns(e){const{event:t}=e,{initiator_data:n}=t;return(0,i.createElement)("img",{className:"SimpleHistoryLogitem__senderImage",src:n.user_avatar_url,alt:""})}function as(){return(0,i.createElement)("div",{className:"SimpleHistoryLogitem__senderImage"})}function rs(e){const{event:t}=e,{initiator:n}=t;let a;switch(n){case"wp_user":a=(0,i.createElement)(ts,{event:t});break;case"web_user":a=(0,i.createElement)(ns,{event:t});break;case"wp_cli":case"wp":case"other":a=(0,i.createElement)(as,{event:t});break;default:return(0,i.createElement)("p",null,'Add image for initiator "',n,'"')}return(0,i.createElement)(Bi,{event:t},a)}function is(e){const{occasions:t,parentEvent:n,eventVariant:a,isLoadingOccasions:r,subsequent_occasions_count:s,occasionsCountMaxReturn:o}=e,l="dashboard"===a,c=$n({SimpleHistoryLogitems:!0,SimpleHistoryLogitem__occasionsItems:!0,haveOccasionsAdded:!1===r}),u=$n("SimpleHistoryLogitem__occasionsItemsWrap",{"is-dashboard":l});return(0,i.createElement)("div",{className:u,style:l?{marginTop:"0.5rem"}:{marginTop:"1rem",marginLeft:"-4.5rem",marginRight:"-1.5rem"}},(0,i.createElement)("ul",{className:c},t.map(((e,r)=>(0,i.createElement)(ps,{key:e.id,event:e,variant:a,loopIndex:r,prevEvent:0===r?n:t[r-1]}))),s>o?(0,i.createElement)("li",{className:"SimpleHistoryLogitem SimpleHistoryLogitem--occasion SimpleHistoryLogitem--occasion-tooMany"},(0,i.createElement)("div",{className:"SimpleHistoryLogitem__firstcol"}),(0,i.createElement)("div",{className:"SimpleHistoryLogitem__secondcol"},(0,i.createElement)("div",{className:"SimpleHistoryLogitem__text"},(0,vt.__)("Sorry, but there are too many similar events to show.","simple-history")))):null))}function ss(e){const{event:t}=e,{hasExtendedSettingsAddOn:n,hasPremiumAddOn:a,hasFailedLoginLimit:r,eventsSettingsPageURL:o}=g();if("SimpleUserLogger"!==t.logger)return null;if("user_login_failed"!==t.message_key&&"user_unknown_login_failed"!==t.message_key)return null;let l;return n||a?l=(0,i.createElement)("a",{href:`${o}&selected-tab=general_settings_subtab_general&selected-sub-tab=failed-login-attempts`},(0,vt.__)("Configure failed login attempts","simple-history")):r||(l=(0,i.createElement)(s.ExternalLink,{href:wn("https://simple-history.com/add-ons/premium/#limit-number-of-failed-login-attempts","premium_events_loginlimit")},(0,vt.__)("Limit logged login attempts (Premium)","simple-history"))),l?(0,i.createElement)("div",{className:"SimpleHistoryLogitem__occasionsAddOns"},(0,i.createElement)("p",{className:"SimpleHistoryLogitem__occasionsAddOnsText"},l)):null}function os(e){const{event:t,eventVariant:n}=e,{subsequent_occasions_count:a}=t,[r,o]=(0,c.useState)(!1),[l,u]=(0,c.useState)(!1),[m,h]=(0,c.useState)([]);if(1===a)return null;if("modal"===n)return null;const p=(0,i.createElement)("div",{className:"SimpleHistoryLogitem__occasions"},(0,i.createElement)(s.Button,{variant:"link","aria-expanded":!1,onClick:e=>{(async()=>{o(!0);const e={type:"occasions",logRowID:t.id,occasionsID:t.occasions_id,occasionsCount:a-1,occasionsCountMaxReturn:15,per_page:5,_fields:["id","date_local","date_gmt","message","message_html","details_data","details_html","loglevel","occasions_id","subsequent_occasions_count","initiator","initiator_data","ip_addresses","via"]};try{const t=await d()({path:(0,f.addQueryArgs)("/simple-history/v1/events",e),parse:!1}),n=await t.json();h(n),u(!0)}catch(e){console.error("Simple History: Failed to load occasions",e)}finally{o(!1)}})(),e.preventDefault()}},(0,vt.sprintf)(/* translators: %s: number of similar events */ /* translators: %s: number of similar events */ (0,vt._n)("+%1$s similar event","+%1$s similar events",a-1,"simple-history"),a-1)),(0,i.createElement)(ss,{event:t}));return(0,i.createElement)("div",null,l||r?null:p,r?(0,i.createElement)("div",{className:"SimpleHistoryLogitem__occasions"},(0,vt.__)("Loading…","simple-history")):null,l?(0,i.createElement)(i.Fragment,null,(0,i.createElement)("div",{className:"SimpleHistoryLogitem__occasions"},(0,i.createElement)(s.Button,{variant:"link","aria-expanded":!0,onClick:()=>u(!1)},(0,vt.sprintf)(/* translators: %s: number of similar events */ /* translators: %s: number of similar events */ (0,vt.__)("Showing %1$s more","simple-history"),a-1))),(0,i.createElement)(is,{isLoadingOccasions:r,isShowingOccasions:l,occasions:m,parentEvent:t,eventVariant:n,subsequent_occasions_count:a,occasionsCountMaxReturn:15})):null)}const ls=(0,Sn.jsx)(xn.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,Sn.jsx)(xn.Path,{d:"M10.97 10.159a3.382 3.382 0 0 0-2.857.955l1.724 1.723-2.836 2.913L7 17h1.25l2.913-2.837 1.723 1.723a3.38 3.38 0 0 0 .606-.825c.33-.63.446-1.343.35-2.032L17 10.695 13.305 7l-2.334 3.159Z"})});function cs({event:e}){const t=$n("SimpleHistoryLogitem--logleveltag",`SimpleHistoryLogitem--logleveltag-${e.loglevel}`);return(0,i.createElement)("div",{className:"SimpleHistoryLogitem__text"},(0,i.createElement)(us,{event:e}),(0,i.createElement)("span",{dangerouslySetInnerHTML:{__html:e.message_html}})," ",(0,i.createElement)("span",{className:t},e.loglevel))}function us({event:e}){const t=$n("SimpleHistoryLogitem--sticky");return e.sticky?(0,i.createElement)(s.Tooltip,{text:(0,vt.__)("Sticky","simple-history")},(0,i.createElement)("span",{className:t},(0,i.createElement)(s.VisuallyHidden,{as:"span"},(0,vt.__)("Sticky","simple-history")),(0,i.createElement)(s.Icon,{icon:ls}))):null}function ds(e){if(!e)return"";if(e.sticky_appended)return"sticky";const t=new Date(e.date_local).toISOString().split("T")[0],n=(new Date).toISOString().split("T")[0],a=new Date((new Date).setDate((new Date).getDate()-1)).toISOString().split("T")[0];return t===n?"today":t===a?"yesterday":(0,ra.dateI18n)((0,ra.__experimentalGetSettings)().formats.date,e.date_local)}function ms({event:e}){return ds(e)}function hs({event:e,eventVariant:t,prevEvent:n,loopIndex:a}){if("modal"===t)return null;const r=function({event:e}){if(!e)return"";const t=ds(e);return"sticky"===t?(0,i.createElement)(i.Fragment,null,(0,i.createElement)(s.Icon,{icon:ls}),(0,vt.__)("Sticky","simple-history")):"today"===t?(0,vt.__)("Today","simple-history"):"yesterday"===t?(0,vt.__)("Yesterday","simple-history"):t}({event:e,loopIndex:a}),o=ms({event:e,loopIndex:a})!==ms({event:n,loopIndex:a-1}),l=$n({SimpleHistoryEventSeparator:!0,"SimpleHistoryEventSeparator--hasLabel":o}),c="dashboard"===t?"h3":"span";return(0,i.createElement)("div",{className:l},o?(0,i.createElement)(c,{className:"SimpleHistoryEventSeparator__label"},r):null)}function ps(e){const{event:t,variant:n="normal",isNewAfterFetchNewEvents:a,prevEvent:r,nextEvent:s,loopIndex:o,isCenterEvent:l,isSurroundingEventsMode:u}=e,m=function(e){const[t,n]=(0,c.useState)(e.reactions||{}),[a,r]=(0,c.useState)(!1),i=(0,c.useRef)(e.reactions||{}),s=(0,c.useCallback)((async(s="thumbsup")=>{var o;if(a)return;r(!0);const l=null!==(o=t[s]?.reacted)&&void 0!==o&&o?"unreact":"react";n((e=>{const t=e[s]||{count:0,reacted:!1};return{...e,[s]:{...t,count:t.reacted?t.count-1:t.count+1,reacted:!t.reacted}}}));try{const t=await d()({path:`/simple-history/v1/events/${e.id}/${l}`,method:"POST",data:{type:s}});t.reactions&&n(t.reactions)}catch(e){n(i.current)}finally{r(!1)}}),[e.id,a,t]);return{reactions:t,isUpdating:a,toggleReaction:s}}(t),h=$n("SimpleHistoryLogitem",`SimpleHistoryLogitem--variant-${n}`,`SimpleHistoryLogitem--loglevel-${t.loglevel}`,`SimpleHistoryLogitem--logger-${t.logger}`,`SimpleHistoryLogitem--initiator-${t.initiator}`,{"SimpleHistoryLogitem--is-sticky":t.sticky,"SimpleHistoryLogitem--newRowSinceReload":a,"SimpleHistoryLogitem--is-center-event":l});return(0,i.createElement)("li",{className:h},(0,i.createElement)(hs,{event:t,eventVariant:n,prevEvent:r,nextEvent:s,loopIndex:o}),(0,i.createElement)("div",{className:"SimpleHistoryLogitem__firstcol"},(0,i.createElement)(rs,{event:t})),(0,i.createElement)("div",{className:"SimpleHistoryLogitem__secondcol"},(0,i.createElement)(es,{event:t,eventVariant:n,isSurroundingEventsMode:u}),(0,i.createElement)(cs,{event:t,eventVariant:n}),"dashboard"!==n&&(0,i.createElement)(Ei,{event:t,eventVariant:n}),(0,i.createElement)(Si,{event:t}),(0,i.createElement)(wi,{...m}),(0,i.createElement)(os,{event:t,eventVariant:n}),(0,i.createElement)(Ii,{event:t,eventVariant:n,reactionState:m})))}function gs(e){const{events:t,prevEventsMaxId:n,eventsIsLoading:a,surroundingEventId:r}=e;if(!t||0===t.length)return null;const s=Boolean(r),o=$n({SimpleHistoryLogitems:!0,"is-loading":a,"is-loaded":!a});return(0,i.createElement)("ul",{className:o},t.map(((e,a)=>(0,i.createElement)(ps,{key:`${e.id}-${a}`,event:e,loopIndex:a,prevEvent:t[a-1],nextEvent:t[a+1],isNewAfterFetchNewEvents:e.id>n,isCenterEvent:e.id===r,isSurroundingEventsMode:s}))))}function fs(e){const{index:t}=e,n={backgroundColor:"var(--sh-color-gray-4)",width:vn(40,50)+"%",height:"1rem"},a={backgroundColor:"var(--sh-color-gray-4)",width:vn(55,75)+"%",height:"1.25rem"},r={backgroundColor:"var(--sh-color-gray-4)",width:vn(50,60)+"%",height:"3rem"};return(0,i.createElement)("li",{key:t,className:"SimpleHistoryLogitem SimpleHistoryLogitem--variant-normal SimpleHistoryLogitem--loglevel-debug SimpleHistoryLogitem--logger-WPHTTPRequestsLogger SimpleHistoryLogitem--initiator-wp_user"},(0,i.createElement)("div",{className:"SimpleHistoryLogitem__firstcol",style:{width:32,height:32,borderRadius:"50%",backgroundColor:"var(--sh-color-gray-4)"}}),(0,i.createElement)("div",{className:"SimpleHistoryLogitem__secondcol"},(0,i.createElement)("div",{className:"SimpleHistoryLogitem__header",style:n}),(0,i.createElement)("div",{className:"SimpleHistoryLogitem__text",style:a}),(0,i.createElement)("div",{className:"SimpleHistoryLogitem__details",style:r})))}function ys(e){var t;const{eventsIsLoading:n,events:a,pagerSize:r}=e;if(!n||a.length>0)return null;const s=null!==(t=r.page)&&void 0!==t?t:0;return(0,i.createElement)("div",null,(0,i.createElement)("ul",{className:"SimpleHistoryLogitems"},Array.from({length:s}).map(((e,t)=>(0,i.createElement)(fs,{key:t,index:t})))))}const vs=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})}),_s=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})}),ws=(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 -960 960 960",width:"24px",fill:"#5f6368"},(0,i.createElement)("path",{d:"M250-250v-460h60v460h-60Zm430-3.85L453.85-480 680-706.15 722.15-664l-184 184 184 184L680-253.85Z"})),bs=(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 -960 960 960",width:"24px",fill:"#5f6368"},(0,i.createElement)("path",{d:"M280-253.85 237.85-296l184-184-184-184L280-706.15 506.15-480 280-253.85ZM650-250v-460h60v460h-60Z"}));function Is(e){const{page:t,totalPages:n,setPage:a}=e;if(!t||!n)return null;const r=[{label:(0,vt.__)("…","simple-history"),value:"custom"},...[...Array(n)].map(((e,t)=>({label:t+1,value:t+1})))];return(0,i.createElement)("div",null,(0,i.createElement)(s.__experimentalHStack,{spacing:4,justify:"center"},(0,i.createElement)(s.Button,{label:(0,vt.__)("First page","simple-history"),size:"compact",onClick:()=>a(1),disabled:1===t,accessibleWhenDisabled:!0,icon:ws}),(0,i.createElement)(s.Button,{label:(0,vt.__)("Previous page","simple-history"),size:"compact",onClick:()=>a(t-1),disabled:1===t,accessibleWhenDisabled:!0,icon:vs}),(0,i.createElement)(s.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:2},(0,c.createInterpolateElement)((0,vt.sprintf)( // translators: %s: Total number of pages. // translators: %s: Total number of pages. (0,vt._x)("Page <CurrentPageControl /> of %s","paging","simple-history"),n),{CurrentPageControl:(0,i.createElement)(s.SelectControl,{"aria-label":(0,vt.__)("Current page","simple-history"),value:t,options:r,onChange:e=>{let t;t="custom"===e?prompt("Enter page number",1):e,t=parseInt(t,10),isNaN(t)||t<1?t=1:t>n&&(t=n),a(t)},size:"compact",__nextHasNoMarginBottom:!0})})),(0,i.createElement)(s.Button,{label:(0,vt.__)("Next page","simple-history"),size:"compact",onClick:()=>a(t+1),disabled:t===n,accessibleWhenDisabled:!0,icon:_s}),(0,i.createElement)(s.Button,{label:(0,vt.__)("Last page","simple-history"),size:"compact",onClick:()=>a(n),disabled:t===n,accessibleWhenDisabled:!0,icon:bs})))}function xs(e){const{failedLoginLimitThreshold:t,failedLoginSuppressedCount:n,eventsIsLoading:a}=e,{hasFailedLoginLimit:r,hasPremiumAddOn:o}=g();return!new URLSearchParams(window.location.search).has("sh_preview_failed_login_notice")&&(!r||n<=0||o||a)?null:(0,i.createElement)("div",{className:"sh-FailedLoginLimitNotice"},(0,i.createElement)("div",{className:"sh-FailedLoginLimitNotice-icon"},(0,i.createElement)("span",{className:"dashicons dashicons-info","aria-hidden":"true"})),(0,i.createElement)("div",{className:"sh-FailedLoginLimitNotice-content"},(0,i.createElement)("p",{className:"sh-FailedLoginLimitNotice-heading"},(0,i.createElement)("strong",null,(0,vt.__)("Failed login throttling active:","simple-history"))," ",(0,vt.sprintf)(/* translators: 1: number of logged attempts, 2: number of suppressed attempts */ /* translators: 1: number of logged attempts, 2: number of suppressed attempts */ (0,vt.__)("Simple History logged the first %1$s failed attempts, then skipped %2$s more to keep your database size down. Successful logins are unaffected.","simple-history"),t.toLocaleString(),n.toLocaleString())),(0,i.createElement)("details",{className:"sh-FailedLoginLimitNotice-details"},(0,i.createElement)("summary",null,(0,vt.__)("Why were some attempts not logged?","simple-history")),(0,i.createElement)("p",null,(0,vt.__)("When consecutive failed logins exceed the threshold, Simple History logs the first batch and skips the rest. You still get the usernames, IP addresses, and timing you need — without thousands of duplicate rows in your database.","simple-history")),(0,i.createElement)("p",null,(0,c.createInterpolateElement)((0,vt.__)("Need to log every attempt or adjust the threshold? Upgrade to <PremiumLink>Simple History Premium</PremiumLink>.","simple-history"),{PremiumLink:(0,i.createElement)(s.ExternalLink,{href:wn("https://simple-history.com/add-ons/premium/#limit-number-of-failed-login-attempts","premium_events_loginlimit_notice")})})))))}function Ss(e){const{eventsLoadingHasErrors:t,eventsLoadingErrorDetails:n}=e;if(!t)return null;const a=wn("https://simple-history.com/support/load-events-error/","support_error_loadevents"),r=(0,f.addQueryArgs)(a,{error:JSON.stringify(n)});return(0,i.createElement)("div",{style:{margin:"1rem"}},(0,i.createElement)(s.Notice,{status:"warning",isDismissible:!1},(0,i.createElement)(s.__experimentalVStack,{spacing:2},(0,i.createElement)(s.__experimentalText,{as:"p"},(0,vt.__)("There was an error loading the events.","simple-history")),(0,i.createElement)(s.__experimentalText,{as:"p"},(0,vt.__)("This can often be resolved by refreshing your browser. If the problem persists, please try again later.","simple-history")),(0,i.createElement)(s.__experimentalText,{as:"p"},(0,i.createElement)(s.Button,{variant:"secondary",onClick:()=>window.location.reload()},(0,vt.__)("Reload page","simple-history"))),(0,i.createElement)("details",null,(0,i.createElement)("summary",null,(0,vt.__)("View error details","simple-history")),(0,i.createElement)(s.__experimentalText,{as:"pre",style:{padding:"1rem"}},JSON.stringify(n,null,2)),(0,i.createElement)(s.__experimentalText,{as:"p"},(0,i.createElement)(s.ExternalLink,{href:r},"Search for error and solutions online.")),(0,i.createElement)(s.__experimentalText,{variant:"muted",as:"p"},"Error above will be sent to simple-history.com. Make sure it don't contain any personal or sensitive information.")))))}function Es(e){const{eventsIsLoading:t,events:n,hasActiveFilters:a,onClearFilters:r}=e;if(t)return null;if(n.length&&n.length>0)return null;const o=(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 -960 960 960",width:"24px"},(0,i.createElement)("path",{d:"M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"}));return(0,i.createElement)("div",{style:{margin:"1.5rem 0 2rem 1.5rem",display:"flex",flexDirection:"row",alignItems:"flex-start",gap:"0.75rem"},role:"status","aria-live":"polite"},(0,i.createElement)(s.Icon,{icon:o,fill:"var(--sh-color-gray-3)",size:32,style:{flexShrink:0,marginTop:"2px"}}),(0,i.createElement)("div",null,(0,i.createElement)(s.__experimentalText,{as:"p",style:{fontSize:"1rem",fontWeight:"600",marginBlock:"0 .25rem",color:"var(--sh-color-gray-3)"}},(0,vt.__)("No matching events","simple-history")),(0,i.createElement)(s.__experimentalText,{as:"p",style:{fontSize:"0.9rem",fontWeight:"400",marginBlock:".25rem",color:"var(--sh-color-gray-3)"}},(0,vt.__)("Adjust the date range or search terms, or clear all filters to see everything.","simple-history")),a&&r&&(0,i.createElement)(s.Button,{variant:"secondary",onClick:r,style:{marginTop:"0.5rem"}},(0,vt.__)("Clear filters","simple-history"))))}function Cs(){const[e,t]=(0,c.useState)(null);(0,c.useEffect)((()=>{d()({path:"/simple-history/v1/backfill-status"}).then((e=>{var n;return t(null!==(n=e.type_stats)&&void 0!==n?n:null)})).catch((()=>{}))}),[]);const n=e?Object.entries(e).filter((([,e])=>e.available>e.imported)):[];if(e&&0===n.length)return null;let a;if(e&&0!==n.length){const e=n.map((([,e])=>e.missed_label)),t=document.documentElement.lang||"en",r=new Intl.ListFormat(t,{style:"long",type:"conjunction"}).format(e);a=(0,vt.sprintf)( // translators: %s: list of content types with counts, e.g. "147 more posts and 12 more pages". // translators: %s: list of content types with counts, e.g. "147 more posts and 12 more pages". (0,vt.__)("Backfill %s into your history.","simple-history"),r)}else a=(0,vt.__)("Your site has even more history to explore.","simple-history");return(0,i.createElement)(s.Notice,{status:"info",isDismissible:!1,className:"sh-BackfilledNotice"},(0,i.createElement)("p",null,(0,i.createElement)("strong",null,a)),(0,i.createElement)("p",null,(0,c.createInterpolateElement)((0,vt.__)("When first installed, Simple History backfilled up to 100 existing items per content type to give you a head start. All new activity is logged automatically — this only affects older content created before the plugin was active. <PremiumLink>Upgrade to Premium</PremiumLink> to backfill your complete history with no limits.","simple-history"),{PremiumLink:(0,i.createElement)(s.ExternalLink,{href:wn("https://simple-history.com/add-ons/premium/","premium_events_backfill")})})))}function ks(e){const{events:t,page:n,pagerSize:a,setPage:r,eventsIsLoading:o,eventsMeta:l,prevEventsMaxId:c,failedLoginLimitThreshold:u,failedLoginSuppressedCount:d,eventsLoadingHasErrors:m,eventsLoadingErrorDetails:h,surroundingEventId:p,surroundingCount:f,hasActiveFilters:y,onClearFilters:v}=e,{hasPremiumAddOn:_,hasFailedLoginLimit:w}=g(),b=l.totalPages,I=Boolean(p),x=t?.length?t[t.length-1]:null,S=!o&&!_&&!I&&n===b&&b>0&&x?.backfilled;return(0,i.createElement)("div",{style:{minHeight:"300px",display:"flex",flexDirection:"column"}},I&&(0,i.createElement)(s.Notice,{status:"info",isDismissible:!1},(0,vt.sprintf)(/* translators: 1: event ID, 2: number of surrounding events */ /* translators: 1: event ID, 2: number of surrounding events */ (0,vt.__)("Viewing #%1$d with %2$d surrounding events","simple-history"),p,f||5)),(0,i.createElement)(ys,{eventsIsLoading:o,pagerSize:a,events:t}),(0,i.createElement)(xs,{failedLoginLimitThreshold:u,failedLoginSuppressedCount:d,eventsIsLoading:o}),(0,i.createElement)(Es,{eventsIsLoading:o,events:t,hasActiveFilters:y,onClearFilters:v}),(0,i.createElement)(Ss,{eventsLoadingHasErrors:m,eventsLoadingErrorDetails:h}),(0,i.createElement)(gs,{eventsIsLoading:o,events:t,prevEventsMaxId:c,surroundingEventId:p}),S&&(0,i.createElement)(Cs,null),(0,i.createElement)(s.__experimentalSpacer,{margin:4}),!I&&(0,i.createElement)(Is,{page:n,totalPages:b,setPage:r}),(0,i.createElement)(s.__experimentalSpacer,{paddingBottom:4}))}function Ms(e){const{eventId:t,closeModal:n=null}=e,[a,r]=(0,c.useState)(null),[o,l]=(0,c.useState)(!0),[u,m]=(0,c.useState)(null);return(0,c.useEffect)((()=>{(async()=>{try{l(!0);const e={_fields:["id","logger","occasions_id","subsequent_occasions_count","initiator_data","loglevel","message","message_html","message_key","details_data","details_html","message_uninterpolated","date_local","date_gmt","message","context","ip_addresses","details_data","via","initiator"]},n=await d()({path:(0,f.addQueryArgs)("/simple-history/v1/events/"+t,e),parse:!1}),a=await n.json();r(a)}catch(e){404===e.status?m((0,vt.__)("Event not found.","simple-history")):m((0,vt.__)("An error occurred while fetching the event.","simple-history"))}finally{l(!1)}})()}),[t]),(0,i.createElement)(s.Modal,{title:(0,vt.__)("Event details","simple-history"),onRequestClose:n},(0,i.createElement)("div",{className:"SimpleHistory__modal"},o&&(0,i.createElement)("p",null,(0,vt.__)("Loading detailed events data…","simple-history")),!o&&u&&(0,i.createElement)("p",null,u),!o&&!u&&a&&(0,i.createElement)(i.Fragment,null,(0,i.createElement)(ps,{event:a,variant:"modal"}),(0,i.createElement)("p",null,(0,i.createElement)(s.__experimentalText,null,(0,vt.__)("This is potentially useful information and meta data that a logger has saved.","simple-history"))),(0,i.createElement)("h2",null,(0,vt.__)("Event details","simple-history")),(0,i.createElement)("table",{className:"SimpleHistoryLogitem__moreDetailsContext"},(0,i.createElement)("thead",null,(0,i.createElement)("tr",null,(0,i.createElement)("th",null,(0,vt.__)("Key","simple-history")),(0,i.createElement)("th",null,(0,vt.__)("Value","simple-history")))),(0,i.createElement)("tbody",null,(0,i.createElement)("tr",null,(0,i.createElement)("td",null,"id"),(0,i.createElement)("td",null,a.id)),(0,i.createElement)("tr",null,(0,i.createElement)("td",null,"logger"),(0,i.createElement)("td",null,a.logger)),(0,i.createElement)("tr",null,(0,i.createElement)("td",null,"level"),(0,i.createElement)("td",null,a.loglevel)),(0,i.createElement)("tr",null,(0,i.createElement)("td",null,"date_local"),(0,i.createElement)("td",null,a.date_local)),(0,i.createElement)("tr",null,(0,i.createElement)("td",null,"date_gmt"),(0,i.createElement)("td",null,a.date_gmt)),(0,i.createElement)("tr",null,(0,i.createElement)("td",null,"message"),(0,i.createElement)("td",null,a.message)),(0,i.createElement)("tr",null,(0,i.createElement)("td",null,"message_uninterpolated"),(0,i.createElement)("td",null,a.message_uninterpolated)),(0,i.createElement)("tr",null,(0,i.createElement)("td",null,"initiator"),(0,i.createElement)("td",null,a.initiator)),(0,i.createElement)("tr",null,(0,i.createElement)("td",null,"occasions_id"),(0,i.createElement)("td",null,a.occasions_id)),(0,i.createElement)("tr",null,(0,i.createElement)("td",null,"subsequent_occasions_count"),(0,i.createElement)("td",null,a.subsequent_occasions_count)),(0,i.createElement)("tr",null,(0,i.createElement)("td",null,"via"),(0,i.createElement)("td",null,a.via)))),(0,i.createElement)("h2",null,(0,vt.__)("Event context","simple-history")),(0,i.createElement)("table",{className:"SimpleHistoryLogitem__moreDetailsContext"},(0,i.createElement)("thead",null,(0,i.createElement)("tr",null,(0,i.createElement)("th",null,(0,vt.__)("Key","simple-history")),(0,i.createElement)("th",null,(0,vt.__)("Value","simple-history")))),(0,i.createElement)("tbody",null,Object.entries(a.context||{}).map((([e,t])=>(0,i.createElement)("tr",{key:e},(0,i.createElement)("td",null,e),(0,i.createElement)("td",null,t)))))))))}function Ns(){const e=(()=>{const[e,t]=(0,c.useState)(window.location.hash),n=()=>{t(window.location.hash)};return(0,c.useEffect)((()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)})),[]),e})(),[t,n]=(0,c.useState)(!1),[a,r]=(0,c.useState)(null);(0,c.useEffect)((()=>{const t=e.match(/^#simple-history\/event\/(\d+)/);null!==t?(r(parseInt(t[1],10)),n(!0)):n(!1)}),[e]);return t?(0,i.createElement)(Ms,{eventId:a,closeModal:()=>{n(!1),window.location.hash=""}}):null}const As=(0,Sn.jsxs)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,Sn.jsx)(xn.Path,{d:"m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"}),(0,Sn.jsx)(xn.Path,{d:"m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"})]}),Ps=(0,Sn.jsx)(xn.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,Sn.jsx)(xn.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})});function Ls(e){const{dateOptionGroups:t,selectedDateOption:n,setSelectedDateOption:a,searchText:r,setSearchText:o,selectedCustomDateFrom:l,setSelectedCustomDateFrom:u,selectedCustomDateTo:d,setSelectedCustomDateTo:m,onReload:h,children:p}=e,g=(0,c.useRef)(null),f=(0,c.useRef)(null),y=(0,c.useRef)(!1);(0,c.useEffect)((()=>{function e(e){if("Escape"===e.key)return void(document.activeElement===g.current&&(y.current&&f.current&&f.current!==document.body?f.current.focus():g.current.blur(),f.current=null,y.current=!1));if("/"!==e.key)return;const t=e.target.tagName;"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||e.target.isContentEditable||(e.preventDefault(),f.current=document.activeElement,y.current=!0,g.current?.focus())}function t(e){e.target===g.current&&(f.current=null,y.current=!1)}return document.addEventListener("keydown",e),document.addEventListener("focusout",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("focusout",t)}}),[]);const v=e=>e>new Date;return(0,c.useEffect)((()=>{l&&d&&l>d&&m(l)}),[l,d,m]),(0,i.createElement)(c.Fragment,null,(0,i.createElement)("div",{className:"SimpleHistory-filters__defaultRow"},(0,i.createElement)(s.__experimentalInputControl,{ref:g,type:"search",value:r,onChange:e=>o(e||""),placeholder:(0,vt.__)("Search events","simple-history"),"aria-label":(0,vt.__)("Search events","simple-history"),prefix:(0,i.createElement)(s.__experimentalInputControlPrefixWrapper,null,(0,i.createElement)(Yi,{icon:ii,size:20,style:{color:"#646970"}})),suffix:(0,i.createElement)("kbd",{className:"SimpleHistory-filters__searchShortcut",title:(0,vt.__)("Press / to search","simple-history"),"aria-hidden":"true"},"/"),__next40pxDefaultSize:!0,className:"SimpleHistory-filters__searchControl"}),(0,i.createElement)(s.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:n,onChange:e=>a(e),className:"SimpleHistory-filters__dateSelect"},t.map(((e,t)=>{const n=e.label||`__ungrouped_${t}`,a=e.options.map((e=>(0,i.createElement)("option",{key:e.value,value:e.value},e.label)));return e.label?(0,i.createElement)("optgroup",{key:n,label:e.label},a):(0,i.createElement)(c.Fragment,{key:n},a)}))),(0,i.createElement)(s.Button,{variant:"secondary",onClick:h,__next40pxDefaultSize:!0},(0,vt.__)("Search events","simple-history")),p),"customRange"===n?(0,i.createElement)((function(){const e=(0,ra.getSettings)().l10n.startOfWeek;return(0,i.createElement)(s.Flex,{justify:"start",gap:"15"},(0,i.createElement)(s.FlexItem,{style:{width:"95px"}}),(0,i.createElement)(s.FlexItem,null,(0,i.createElement)(s.BaseControl,{label:(0,vt.__)("From date","simple-history")},(0,i.createElement)(s.DatePicker,{id:"simple-history-datepicker-from",startOfWeek:e,onChange:e=>{const t=new Date(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()));u(n)},currentDate:l,isInvalidDate:v}))),(0,i.createElement)(s.FlexItem,null,(0,i.createElement)(s.BaseControl,{label:(0,vt.__)("To date","simple-history")},(0,i.createElement)(s.DatePicker,{startOfWeek:e,onChange:e=>{const t=new Date(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()));m(n)},currentDate:d,isInvalidDate:v}))))}),null):null)}const Ts=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"})});function js(e){const{selectedLogLevels:t,setSelectedLogLevels:n,selectedMessageTypes:a,setSelectedMessageTypes:r,selectedUsersWithId:o,setSelectedUsersWithId:l,selectedInitiator:u,setSelectedInitiator:m,selectedContextFilters:h,setSelectedContextFilters:p,enteredMetadataSearch:g,setEnteredMetadataSearch:y,showAIOnly:v,setShowAIOnly:_,searchOptions:w,hideOwnEvents:b,setHideOwnEvents:I}=e,[x,S]=(0,c.useState)([]),[E,C]=(0,c.useState)([]),[k,M]=(0,c.useState)([]);(0,c.useEffect)((()=>{if(w?.initiators){const e=w.initiators.filter(Boolean).map((e=>({value:e.label,initiator_key:e.value,search_options:[e.label]})));M(e)}}),[w]);const N=dn.map((e=>e.label));(0,c.useEffect)((()=>{if(!w?.loggers)return;const e=[];w.loggers.forEach((t=>{const n=t.search_data||{};n.search&&(e.push({value:n.search.label,search_options:n.search.options}),n?.search_all?.label&&e.push({value:hn+n.search_all.label,search_options:n.search_all.options}),n?.search_options&&n.search_options.forEach((t=>{e.push({value:hn+t.label,search_options:t.options})})))})),S(e)}),[w]);const A="8px",P={maxWidth:"310px",backgroundColor:"white"},L={margin:`${A} 0`},T={margin:`${A} 0`};return(0,i.createElement)("div",null,(0,i.createElement)(s.Flex,{align:"top",gap:"0",style:L},(0,i.createElement)(s.FlexItem,{style:T},(0,i.createElement)("div",{className:"SimpleHistory__filters__filterLabel"},(0,vt.__)("Users","simple-history"))),(0,i.createElement)(s.FlexBlock,null,(0,i.createElement)("div",{className:"SimpleHistory__filters__loglevels__select",style:P},(0,i.createElement)(s.FormTokenField,{__experimentalAutoSelectFirstMatch:!0,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,label:(0,vt.__)("Users","simple-history"),placeholder:(0,vt.__)("All users","simple-history"),onChange:e=>{e.map(((t,n)=>{if("string"==typeof t){const a=E.find((e=>e.value===t));a&&(e[n]=a)}return t})),l(e)},onInputChange:async e=>{e.length<2||d()({path:(0,f.addQueryArgs)("/simple-history/v1/search-user",{q:e})}).then((e=>{const t=[];e.forEach((e=>{t.push({id:e.id,value:e.display_name+" ("+e.user_email+")"})})),C(t)})).catch((e=>{console.error("Simple History: Failed to search users",e)}))},suggestions:E.map((e=>e.value)),value:o})),(0,i.createElement)("div",{style:{marginTop:`calc(${A} / 2)`,marginBottom:`calc(${A} / 2 + 4px)`,paddingLeft:"1px"}},(0,i.createElement)(s.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,vt.__)("Hide my own events","simple-history"),checked:b,onChange:I})))),(0,i.createElement)(s.Flex,{align:"top",gap:"0",style:L},(0,i.createElement)(s.FlexItem,{style:T},(0,i.createElement)("div",{className:"SimpleHistory__filters__filterLabel"},(0,vt.__)("Message types","simple-history"))),(0,i.createElement)(s.FlexBlock,null,(0,i.createElement)("div",{className:"SimpleHistory__filters__loglevels__select",style:P},(0,i.createElement)(s.FormTokenField,{__experimentalAutoSelectFirstMatch:!0,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,label:(0,vt.__)("Message types","simple-history"),placeholder:(0,vt.__)("All message types","simple-history"),onChange:e=>{e.map(((t,n)=>{if("string"==typeof t){const a=x.find((e=>e.value.trim()===t.trim()));a&&(e[n]=a)}return t})),r(e)},value:a.map((e=>({...e,value:e.value.replace(hn,"")}))),suggestions:x.map((e=>e.value)),__experimentalRenderItem:e=>e.item.startsWith(hn)?e.item:(0,i.createElement)("strong",null,e.item)})))),(0,i.createElement)(s.Flex,{align:"top",gap:"0",style:L},(0,i.createElement)(s.FlexItem,{style:T},(0,i.createElement)("div",{className:"SimpleHistory__filters__filterLabel"},(0,vt.__)("Log levels","simple-history"))),(0,i.createElement)(s.FlexBlock,null,(0,i.createElement)("div",{className:"SimpleHistory__filters__loglevels__select",style:P},(0,i.createElement)(s.FormTokenField,{__experimentalAutoSelectFirstMatch:!0,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,placeholder:(0,vt.__)("All log levels","simple-history"),onChange:n,suggestions:N,value:t})))),(0,i.createElement)(s.Flex,{align:"top",gap:"0",style:L},(0,i.createElement)(s.FlexItem,{style:T},(0,i.createElement)("div",{className:"SimpleHistory__filters__filterLabel"},(0,vt.__)("Initiators","simple-history")," ",(0,i.createElement)("a",{href:wn("https://simple-history.com/support/what-is-an-initiator/","docs_filters_initiator"),target:"_blank",rel:"noopener noreferrer","aria-label":(0,vt.__)("About initiators and how they work (opens in new tab)","simple-history"),style:{color:"currentColor",verticalAlign:"middle"}},(0,i.createElement)(s.Icon,{icon:Ts,size:16})))),(0,i.createElement)(s.FlexBlock,null,(0,i.createElement)("div",{className:"SimpleHistory__filters__loglevels__select",style:P},(0,i.createElement)(s.FormTokenField,{__experimentalAutoSelectFirstMatch:!0,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,label:(0,vt.__)("Initiators","simple-history"),placeholder:(0,vt.__)("All initiators","simple-history"),onChange:e=>{e.map(((t,n)=>{if("string"==typeof t){const a=k.find((e=>e.value.trim()===t.trim()));a&&(e[n]=a)}return t})),m(e)},value:u,suggestions:k.map((e=>e.value))})))),(0,i.createElement)(s.Flex,{align:"top",gap:"0",style:L},(0,i.createElement)(s.FlexItem,{style:T},(0,i.createElement)("div",{className:"SimpleHistory__filters__filterLabel"},(0,vt.__)("AI-initiated","simple-history"))),(0,i.createElement)(s.FlexBlock,null,(0,i.createElement)("div",{style:{marginTop:`calc(${A} / 2 + 4px)`,paddingLeft:"1px"}},(0,i.createElement)(s.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,vt.__)("AI-initiated events only","simple-history"),help:(0,vt.__)("Events where an AI tool or agent acted on behalf of a user.","simple-history"),checked:v,onChange:_})))),(0,i.createElement)(s.Flex,{align:"top",gap:"0",style:L},(0,i.createElement)(s.FlexItem,{style:T},(0,i.createElement)("div",{className:"SimpleHistory__filters__filterLabel"},(0,vt.__)("Event metadata","simple-history"))),(0,i.createElement)(s.FlexBlock,null,(0,i.createElement)("div",{style:{maxWidth:"310px"}},(0,i.createElement)(s.__experimentalInputControl,{value:g,onChange:e=>y(e||""),placeholder:(0,vt.__)("IP address, email, username…","simple-history"),help:(0,vt.__)("Searches IP addresses, emails, and hidden metadata. May be slower on large sites.","simple-history")})))),(0,i.createElement)(s.Flex,{align:"top",gap:"0",style:L},(0,i.createElement)(s.FlexItem,{style:T},(0,i.createElement)("div",{className:"SimpleHistory__filters__filterLabel"},(0,vt.__)("Context","simple-history"))),(0,i.createElement)(s.FlexBlock,null,(0,i.createElement)("div",{style:{maxWidth:"310px"}},(0,i.createElement)(s.TextareaControl,{__nextHasNoMarginBottom:!0,value:h,onChange:e=>p(e),placeholder:(0,vt.__)("_user_id:1","simple-history"),rows:2,help:(0,vt.__)("Advanced: filter by raw event context. One key:value pair per line.","simple-history"),style:{fontFamily:"monospace",fieldSizing:"content"}})))))}function Ds(e){const{onReload:t,selectedLogLevels:n,setSelectedLogLevels:a,selectedMessageTypes:r,setSelectedMessageTypes:o,selectedDateOption:l,setSelectedDateOption:u,enteredSearchText:m,setEnteredSearchText:h,selectedCustomDateFrom:p,setSelectedCustomDateFrom:g,selectedCustomDateTo:y,setSelectedCustomDateTo:v,selectedUsersWithId:_,setSelectedUsersWithId:w,selectedInitiator:b,setSelectedInitiator:I,enteredIPAddress:x,setEnteredIPAddress:S,selectedContextFilters:E,setSelectedContextFilters:C,enteredMetadataSearch:k,setEnteredMetadataSearch:M,showAIOnly:N,setShowAIOnly:A,searchOptionsLoaded:P,setSearchOptionsLoaded:L,setPagerSize:T,setMapsApiKey:j,setHasExtendedSettingsAddOn:D,setHasPremiumAddOn:H,setHasFailedLoginLimit:Z,setFailedLoginLimitThreshold:F,setFailedLoginSuppressedCount:O,isExperimentalFeaturesEnabled:W,setIsExperimentalFeaturesEnabled:R,setEventsAdminPageURL:B,setEventsSettingsPageURL:z,setAlertsPageURL:$,setCurrentUserId:U,setUserCanManageOptions:G,hideOwnEvents:V,setHideOwnEvents:q,defaultDateOptionRef:Y,handleClearFilters:Q,hasAnyActiveFilters:J}=e,K=(0,c.useMemo)((()=>{let e=0;return n.length>0&&e++,r.length>0&&e++,_.length>0&&e++,b.length>0&&e++,x.trim().length>0&&e++,E.trim().length>0&&e++,k.trim().length>0&&e++,N&&e++,V&&e++,e}),[n,r,_,b,x,E,k,N,V]),[X,ee]=(0,c.useState)((()=>{const e=new URLSearchParams(window.location.search);return K>0||"1"===e.get("show-filters")})),[te,ne]=(0,c.useState)(null),ae=null!==te?te:X,[re,ie]=(0,c.useState)(un),[se,oe]=(0,c.useState)(null);(0,c.useEffect)((()=>{K>0&&!X&&ee(!0)}),[K,X]),(0,c.useEffect)((()=>{(async()=>{try{const e=await d()({path:(0,f.addQueryArgs)("/simple-history/v1/search-options",{})});oe(e);const t={label:"",options:[{label:(0,vt.__)("All dates","simple-history"),value:"allDates"}]},n=e.dates.result_months.map((e=>({label:(0,ra.dateI18n)("F Y",e.yearMonth),value:`month:${e.yearMonth}`}))),a={label:(0,vt.__)("By month","simple-history"),options:n};ie([t,...cn,a]);const r=`lastdays:${e.dates.daysToShow}`;Y.current=r,l||u(r),T(e.pager_size),j(e.maps_api_key),D(e.addons.has_extended_settings_add_on),H(e.addons.has_premium_add_on),R(e.experimental_features_enabled),Z(e.has_failed_login_limit),F(e.failed_login_limit_threshold||0),O(e.failed_login_suppressed_count||0),B(e.events_admin_page_url),z(e.settings_page_url),e.alerts_page_url&&$(e.alerts_page_url),e.current_user_id&&U(e.current_user_id),e.current_user_can_manage_options&&G(e.current_user_can_manage_options)}catch(e){console.error("Simple History: Failed to load search options",e)}finally{L(!0)}})()}),[T,L,u,j,D,H,Z,F,O,R,B,z,$,U,G,l]);const le=K>0?(0,vt.sprintf)(/* translators: %d: number of active filters */ /* translators: %d: number of active filters */ (0,vt.__)("Filters (%d)","simple-history"),K):(0,vt.__)("Filters","simple-history"),ce=P?c.Fragment:s.Disabled;return(0,i.createElement)(ce,null,(0,i.createElement)("div",{className:"SimpleHistory-filters"},(0,i.createElement)("div",{className:"SimpleHistory-filters__searchRow"},(0,i.createElement)(Ls,{dateOptionGroups:re,selectedDateOption:l,setSelectedDateOption:u,searchText:m,setSearchText:h,selectedCustomDateFrom:p,setSelectedCustomDateFrom:g,selectedCustomDateTo:y,setSelectedCustomDateTo:v,onReload:t},(0,i.createElement)(s.Button,{variant:"secondary",__next40pxDefaultSize:!0,onClick:()=>{ne(!(null!==te?te:X))},className:"SimpleHistory-filters__filtersToggle"+(K>0?" has-active-filters":""),"aria-expanded":ae,"aria-controls":"SimpleHistory-expandedFilters"},(0,i.createElement)(s.Icon,{icon:As,size:16}),le,(0,i.createElement)(s.Icon,{icon:Ps,size:20,className:"SimpleHistory-filters__filtersToggleChevron","aria-hidden":"true"})),J&&(0,i.createElement)(s.Button,{variant:"tertiary",__next40pxDefaultSize:!0,onClick:()=>{Q(),ne(null),ee(!1)},className:"SimpleHistoryFilterDropin-clearFilters"},(0,vt.__)("Clear filters","simple-history")))),ae?(0,i.createElement)("div",{className:"SimpleHistory-filters__expandedFilters",id:"SimpleHistory-expandedFilters"},(0,i.createElement)(js,{selectedLogLevels:n,setSelectedLogLevels:a,selectedMessageTypes:r,setSelectedMessageTypes:o,setSelectedUsersWithId:w,selectedUsersWithId:_,selectedInitiator:b,setSelectedInitiator:I,selectedContextFilters:E,setSelectedContextFilters:C,enteredMetadataSearch:k,setEnteredMetadataSearch:M,showAIOnly:N,setShowAIOnly:A,isExperimentalFeaturesEnabled:W,searchOptions:se,hideOwnEvents:V,setHideOwnEvents:q})):null))}const Hs=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{d:"m11.3 17.2-5-5c-.1-.1-.1-.3 0-.4l2.3-2.3-1.1-1-2.3 2.3c-.7.7-.7 1.8 0 2.5l5 5H7.5v1.5h5.3v-5.2h-1.5v2.6zm7.5-6.4-5-5h2.7V4.2h-5.2v5.2h1.5V6.8l5 5c.1.1.1.3 0 .4l-2.3 2.3 1.1 1.1 2.3-2.3c.6-.7.6-1.9-.1-2.5z"})});function Zs(e){const{eventsQueryParams:t,eventsMaxId:n,eventsMaxDate:a,onReload:r}=e,[o,l]=(0,c.useState)(0),[u,m]=(0,c.useState)(!0);(0,c.useEffect)((()=>{if(!t||!n||!a)return;if(!u)return;const e=setInterval((async()=>{const e={...t,since_id:n,since_date:a,_fields:null};try{const t=await d()({path:(0,f.addQueryArgs)("/simple-history/v1/events/has-updates",e),parse:!1}),n=(await t.json()).new_events_count;n>0&&(n>=10?(l(10),m(!1)):l(n))}catch(e){console.error("Error when checking for new events:",e)}}),3e4);return()=>{clearInterval(e)}}),[t,n,a,u]);const h=!u&&o>=10,p=h?(0,vt.sprintf)( // translators: %d: maximum number of events shown before stopping polling // translators: %d: maximum number of events shown before stopping polling (0,vt.__)("%d+ new events","simple-history"),10):(0,vt.sprintf)( // translators: %s: number of new events // translators: %s: number of new events (0,vt._n)("%s new event","%s new events",o,"simple-history"),o);return(0,c.useEffect)((()=>{!function(e){let t=document.title;t=t.replace(/^\([\d!+]+\) /,""),e&&(t="("+e+") "+t),document.title=t}(h?"10+":o)}),[h,o]),(0,i.createElement)("div",{className:$n({SimpleHistoryDropin__NewRowsNotifier:!0,"SimpleHistoryDropin__NewRowsNotifier--haveNewRows":o>0})},(0,i.createElement)(s.Button,{icon:Hs,onClick:()=>{r(),l(0),m(!0)},label:(0,vt.__)("Click to load new events","simple-history"),showTooltip:!0,variant:"tertiary"},p))}const Fs=ft(yt({id:gt(),value:gt()})),Os=ft(yt({value:gt(),search_options:ft(gt())})),Ws=ft(yt({value:gt(),initiator_key:gt().optional(),search_options:ft(gt())})),Rs=function(){const[e,t]=(0,c.useState)(!0),[n,a]=(0,c.useState)(!1),[r,s]=(0,c.useState)({errorCode:void 0,errorMessage:void 0}),[o,l]=(0,c.useState)([]),[u,h]=(0,c.useState)({}),[g,y]=(0,c.useState)(Date.now()),[v,_]=(0,c.useState)(),[w,b]=(0,c.useState)(),[I,x]=(0,c.useState)(),[S,E]=(0,c.useState)(!1),[C,k]=(0,c.useState)(1),[M,N]=(0,c.useState)({}),[A,P]=(0,c.useState)(""),[L,H]=(0,c.useState)(!1),[W,R]=(0,c.useState)(!1),[B,$]=(0,c.useState)(!1),[U,G]=(0,c.useState)(0),[V,q]=(0,c.useState)(0),[Y,Q]=(0,c.useState)(!1),[J,K]=(0,c.useState)(),[X,ee]=(0,c.useState)(),[te,ne]=(0,c.useState)(),[ae,re]=(0,c.useState)(null),[ie,se]=(0,c.useState)(!1),oe={throttleMs:50},[le,ce]=z("date",T.withDefault("").withOptions(oe)),[ue,de]=z("from",Z.withDefault(pn).withOptions(oe)),[me,he]=z("to",Z.withDefault(gn).withOptions(oe)),[pe,ge]=z("q",T.withDefault("").withOptions(oe)),fe=(0,c.useMemo)((()=>[]),[]),[ye,ve]=z("levels",O(T).withDefault(fe).withOptions(oe)),[_e,we]=z("messages",F(Os.parse).withDefault(fe).withOptions(oe)),[be,Ie]=z("users",F(Fs.parse).withDefault(fe).withOptions(oe)),[xe,Se]=z("initiator",F(Ws.parse).withDefault(fe).withOptions(oe)),[Ee,Ce]=z("ip",T.withDefault("").withOptions(oe)),[ke,Me]=z("context",T.withDefault("").withOptions(oe)),[Ne,Ae]=z("metadata",T.withDefault("").withOptions(oe)),[Pe,Le]=z("ai-only",D.withDefault(!1).withOptions(oe)),[Te]=z("exclude-search",T.withDefault("").withOptions(oe)),[je]=z("exclude-levels",O(T).withDefault(fe).withOptions(oe)),[De]=z("exclude-loggers",O(T).withDefault(fe).withOptions(oe)),[He]=z("exclude-messages",F(Os.parse).withDefault(fe).withOptions(oe)),[Ze,Fe]=z("exclude-users",F(Fs.parse).withDefault(fe).withOptions(oe)),[Oe]=z("exclude-initiator",F(Ws.parse).withDefault(fe).withOptions(oe)),[We]=z("exclude-context",T.withDefault("").withOptions(oe)),[Re]=z("surrounding_event_id",j.withOptions(oe)),[Be]=z("surrounding_count",j.withOptions(oe)),ze=(0,c.useMemo)((()=>!!ae&&Ze.some((e=>String(e.id)===String(ae)))),[Ze,ae]),$e=(0,c.useCallback)((e=>{ae&&(e?Ze.some((e=>String(e.id)===String(ae)))||Fe([...Ze,{id:String(ae),value:"Me"}]):Fe(Ze.filter((e=>String(e.id)!==String(ae)))))}),[ae,Ze,Fe]),Ue=(0,c.useRef)(""),Ge=(0,c.useMemo)((()=>{const e=ye.length>0||_e.length>0||be.length>0||xe.length>0||Ee.trim().length>0||ke.trim().length>0||Ne.trim().length>0||Pe||ze,t=pe.trim().length>0,n=Ue.current&&le!==Ue.current;return e||t||n}),[ye,_e,be,xe,Ee,ke,Ne,Pe,ze,pe,le]),Ve=(0,c.useCallback)((()=>{ce(Ue.current),ge(""),de(pn),he(gn),ve([]),we([]),Ie([]),Se([]),Ce(""),Me(""),Ae(""),Le(!1),$e(!1)}),[ce,ge,de,he,ve,we,Ie,Se,Ce,Me,Ae,Le,$e]),qe=(0,c.useMemo)((()=>function(e){const{selectedLogLevels:t,selectedMessageTypes:n,selectedUsersWithId:a,selectedInitiator:r,enteredIPAddress:i,selectedContextFilters:s,enteredMetadataSearch:o,showAIOnly:l,enteredSearchText:c,selectedDateOption:u,selectedCustomDateFrom:d,selectedCustomDateTo:m,page:h,pagerSize:p,excludeSearch:g,excludeLogLevels:f,excludeLoggers:y,excludeMessages:v,excludeUsers:_,excludeInitiator:w,excludeContextFilters:b,surroundingEventId:I,surroundingCount:x}=e;if(I){const e={surrounding_event_id:I,_fields:fn};return x&&(e.surrounding_count=x),e}const S={page:h,per_page:p.page,_fields:fn};if(c&&(S.search=c),u&&("customRange"===u?(S.date_from=on(d,"yyyy-MM-dd"),S.date_to=on(m,"yyyy-MM-dd")):S.dates=u),t.length){const e=[];t.forEach((t=>{const n=dn.find((e=>e.label===t));n&&e.push(n.value)})),e.length&&(S.loglevels=e)}if(n.length){const e=[];n.forEach((t=>{t.search_options.forEach((t=>{e.push(t)}))})),S.messages=e.join(",")}if(a.length){const e=a.map((e=>e.id));S.users=e}if(r.length>0){const e=r.map((e=>e.initiator_key||e.value));S.initiator=e}if(i&&i.trim().length>0&&(S.ip_address=i.trim()),s&&s.trim().length>0){const e={};s.split("\n").map((e=>e.trim())).filter((e=>e.length>0)).forEach((t=>{const n=t.indexOf(":");if(n>0){const a=t.substring(0,n).trim(),r=t.substring(n+1).trim();a&&r&&(e[a]=r)}})),Object.keys(e).length>0&&(S.context_filters=e)}if(o&&o.trim().length>0&&(S.metadata_search=o.trim()),l&&(S.ai_only=!0),g&&g.trim().length>0&&(S.exclude_search=g),f&&f.length>0&&(S.exclude_loglevels=f),y&&y.length>0&&(S.exclude_loggers=y),v&&v.length>0){const e=v.map((e=>`${e.logger_slug}:${e.message}`));S.exclude_messages=e}if(_&&_.length>0){const e=_.map((e=>parseInt(e.id,10)));S.exclude_users=e}if(w&&w.length>0){const e=w.map((e=>e.initiator_key||e.value));S.exclude_initiator=e}if(b&&b.trim().length>0){const e={};b.split("\n").map((e=>e.trim())).filter((e=>e.length>0)).forEach((t=>{const n=t.indexOf(":");if(n>0){const a=t.substring(0,n).trim(),r=t.substring(n+1).trim();a&&r&&(e[a]=r)}})),Object.keys(e).length>0&&(S.exclude_context_filters=e)}const E=c||t.length||n.length||a.length||r.length>0||i&&i.trim().length>0||s&&s.trim().length>0||g&&g.trim().length>0||f&&f.length>0||y&&y.length>0||v&&v.length>0||_&&_.length>0||w&&w.length>0||b&&b.trim().length>0;return 1!==h||E||(S.include_sticky=!0),S}({selectedLogLevels:ye,selectedMessageTypes:_e,selectedUsersWithId:be,selectedInitiator:xe,enteredIPAddress:Ee,selectedContextFilters:ke,enteredMetadataSearch:Ne,showAIOnly:Pe,enteredSearchText:pe,selectedDateOption:le,selectedCustomDateFrom:ue,selectedCustomDateTo:me,page:C,pagerSize:M,excludeSearch:Te,excludeLogLevels:je,excludeLoggers:De,excludeMessages:He,excludeUsers:Ze,excludeInitiator:Oe,excludeContextFilters:We,surroundingEventId:Re,surroundingCount:Be})),[le,pe,ye,_e,be,xe,Ee,ke,Ne,Pe,ue,me,C,M,Te,je,De,He,Ze,Oe,We,Re,Be]);(0,c.useEffect)((()=>{k(1)}),[le,pe,ye,_e,xe,Ee,ke,Ne,Pe,ue,me,Ze]);const Ye=(0,c.useCallback)((async()=>{t(!0);try{const e=await d()({path:(0,f.addQueryArgs)("/simple-history/v1/events",qe),parse:!1}),t=await e.json();if(h({total:parseInt(e.headers.get("X-Wp-Total"),10),totalPages:parseInt(e.headers.get("X-Wp-Totalpages"),10),link:e.headers.get("Link")}),t&&t.length&&1===C){const t=e.headers.get("X-SimpleHistory-MaxId"),n=e.headers.get("X-SimpleHistory-MaxDate");t&&_(parseInt(t,10)),n&&b(n)}l(t)}catch(e){a(!0),s(await bn(e))}finally{t(!1)}}),[qe,C]),Qe=(0,m.useDebounce)(Ye,500);(0,c.useEffect)((()=>{(S||Re)&&Qe()}),[Qe,S,g,Re]);const Je=()=>{k(1),x(v),y(Date.now())};(0,c.useEffect)((()=>{window.scrollTo({top:0,behavior:"smooth"})}),[C]),(0,c.useEffect)((()=>{const e=e=>{const{date:t}=e.detail,n=new Date(t+"T00:00:00Z");ce("customRange"),de(n),he(n)};return window.addEventListener("SimpleHistory:chartDateClick",e),()=>{window.removeEventListener("SimpleHistory:chartDateClick",e)}}),[ce,de,he]),(0,c.useEffect)((()=>{const e=()=>{Je()};return window.addEventListener("SimpleHistory:eventCreated",e),()=>{window.removeEventListener("SimpleHistory:eventCreated",e)}}),[Je]),(0,c.useEffect)((()=>{const e=e=>{const{ipAddress:t}=e.detail;Ce(t)};return window.addEventListener("SimpleHistory:filterByIPAddress",e),()=>{window.removeEventListener("SimpleHistory:filterByIPAddress",e)}}),[Ce]);const Ke=(0,c.useMemo)((()=>({mapsApiKey:A,hasExtendedSettingsAddOn:L,hasPremiumAddOn:W,hasFailedLoginLimit:B,experimentalFeaturesEnabled:Y,eventsSettingsPageURL:X,alertsPageURL:te,eventsAdminPageURL:J,userCanManageOptions:ie,searchOptionsLoaded:S,currentUserId:ae})),[A,L,W,B,Y,X,te,J,ie,S,ae]);return(0,i.createElement)(p,{value:Ke},!Re&&(0,i.createElement)(Ds,{selectedLogLevels:ye,setSelectedLogLevels:ve,selectedMessageTypes:_e,setSelectedMessageTypes:we,selectedDateOption:le,setSelectedDateOption:ce,enteredSearchText:pe,setEnteredSearchText:ge,selectedCustomDateFrom:ue,setSelectedCustomDateFrom:de,selectedCustomDateTo:me,setSelectedCustomDateTo:he,selectedUsersWithId:be,setSelectedUsersWithId:Ie,selectedInitiator:xe,setSelectedInitiator:Se,enteredIPAddress:Ee,setEnteredIPAddress:Ce,selectedContextFilters:ke,setSelectedContextFilters:Me,enteredMetadataSearch:Ne,setEnteredMetadataSearch:Ae,showAIOnly:Pe,setShowAIOnly:Le,searchOptionsLoaded:S,setSearchOptionsLoaded:E,setPagerSize:N,setMapsApiKey:P,setHasExtendedSettingsAddOn:H,setHasPremiumAddOn:R,setHasFailedLoginLimit:$,setFailedLoginLimitThreshold:G,setFailedLoginSuppressedCount:q,isExperimentalFeaturesEnabled:Y,setIsExperimentalFeaturesEnabled:Q,eventsAdminPageURL:J,setEventsAdminPageURL:K,setEventsSettingsPageURL:ee,setAlertsPageURL:ne,setPage:k,onReload:Je,setCurrentUserId:re,setUserCanManageOptions:se,hideOwnEvents:ze,setHideOwnEvents:$e,defaultDateOptionRef:Ue,handleClearFilters:Ve,hasAnyActiveFilters:Ge}),!Re&&(0,i.createElement)(Bn,{eventsIsLoading:e,eventsTotal:u.total,eventsQueryParams:qe,hasAnyActiveFilters:Ge,newEventsNotifier:(0,i.createElement)(Zs,{eventsQueryParams:qe,eventsMaxId:v,eventsMaxDate:w,onReload:Je})}),(0,i.createElement)(ks,{eventsIsLoading:e,events:o,eventsMeta:u,page:C,pagerSize:M,setPage:k,prevEventsMaxId:I,failedLoginLimitThreshold:U,failedLoginSuppressedCount:V,eventsLoadingHasErrors:n,eventsLoadingErrorDetails:r,surroundingEventId:Re,surroundingCount:Be,hasActiveFilters:Ge,onClearFilters:Ve}),(0,i.createElement)(Ns,null))},Bs=(0,Sn.jsx)(xn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Sn.jsx)(xn.Path,{fillRule:"evenodd",d:"M11.25 5h1.5v15h-1.5V5zM6 10h1.5v10H6V10zm12 4h-1.5v6H18v-6z",clipRule:"evenodd"})});function zs(e){const{events:t,eventsIsLoading:n}=e;if(!t||0===t.length)return null;const a=$n({SimpleHistoryLogitems:!0,"is-loading":n,"is-loaded":!n});return(0,i.createElement)("ul",{className:a},t.map(((e,n)=>(0,i.createElement)(ps,{key:`${e.id}-${n}`,event:e,variant:"dashboard",loopIndex:n,prevEvent:t[n-1],nextEvent:t[n+1]}))))}function $s({count:e=5}){return(0,i.createElement)("ul",{className:"sh-DashboardWidget-skeleton"},Array.from({length:e}).map(((e,t)=>(0,i.createElement)("li",{key:t,className:"sh-DashboardWidget-skeleton__row"},(0,i.createElement)("div",{className:"sh-DashboardWidget-skeleton__avatar"}),(0,i.createElement)("div",{className:"sh-DashboardWidget-skeleton__content"},(0,i.createElement)("div",{className:"sh-DashboardWidget-skeleton__line sh-DashboardWidget-skeleton__line--short"}),(0,i.createElement)("div",{className:"sh-DashboardWidget-skeleton__line sh-DashboardWidget-skeleton__line--long"}))))))}function Us({stats:e}){return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(Yi,{icon:Bs,size:16}),(0,i.createElement)("span",null,(0,c.createInterpolateElement)((0,vt.sprintf)(/* translators: 1: number of events today */ /* translators: 1: number of events today */ (0,vt._n)("<strong>%s</strong> event logged today","<strong>%s</strong> events logged today",e.num_events_today,"simple-history"),e.num_events_today),{strong:(0,i.createElement)("strong",null)})),(0,i.createElement)("span",{className:"sh-DashboardWidget-stats__separator"},"·"),(0,i.createElement)("span",null,(0,c.createInterpolateElement)((0,vt.sprintf)(/* translators: 1: number of events last 7 days */ /* translators: 1: number of events last 7 days */ (0,vt._n)("<strong>%s</strong> event last 7 days","<strong>%s</strong> events last 7 days",e.num_events_last_7_days,"simple-history"),e.num_events_last_7_days),{strong:(0,i.createElement)("strong",null)})))}function Gs(){const[e,t]=(0,c.useState)([]),[n,a]=(0,c.useState)(!0),[r,s]=(0,c.useState)(!1),[o,l]=(0,c.useState)(null),[u,m]=(0,c.useState)(""),[h,g]=(0,c.useState)(""),[y,v]=(0,c.useState)(""),[_,w]=(0,c.useState)(""),[b,I]=(0,c.useState)(null),[x,S]=(0,c.useState)(!1),[E,C]=(0,c.useState)(!1),[k,M]=(0,c.useState)(0),[N,A]=(0,c.useState)(null),P=(0,c.useRef)(null),L=(0,c.useRef)(0),T=(0,c.useRef)(null),j=(0,c.useRef)(Math.random()),D=(0,c.useMemo)((()=>{const e=window.simpleHistoryTips?.dashboard||[];return 0===e.length?null:e[Math.floor(j.current*e.length)]}),[]);(0,c.useLayoutEffect)((()=>{const e=P.current;if(!e)return;T.current&&(e.removeEventListener("transitionend",T.current),T.current=null);const t=e.scrollHeight,n=L.current;if(L.current=t,!n||Math.abs(n-t)<1)return;e.style.transition="none",e.style.height=n+"px",e.style.overflow="hidden",e.offsetHeight,e.style.transition="height 0.3s ease",e.style.height=t+"px";const a=()=>{e.style.height="",e.style.overflow="",e.style.transition="",T.current=null};return T.current=a,e.addEventListener("transitionend",a),()=>{T.current&&(e.removeEventListener("transitionend",T.current),T.current=null)}})),(0,c.useEffect)((()=>{d()({path:"/simple-history/v1/search-options"}).then((e=>{I(e.pager_size),m(e.events_admin_page_url||""),g(e.settings_page_url||""),v(e.stats_page_url||""),w(e.maps_api_key||""),S(e.addons?.has_premium_add_on||!1),C(e.has_failed_login_limit||!1),M(e.failed_login_suppressed_count||0),e.stats&&A(e.stats)})).catch((()=>{}))}),[]);const H=(0,c.useCallback)((async()=>{if(b){a(!0);try{const e=await d()({path:(0,f.addQueryArgs)("/simple-history/v1/events",{per_page:b.dashboard,skip_count_query:!0,dates:"lastdays:7",_fields:fn}),parse:!1}),n=await e.json();t(n)}catch(e){s(!0),l(await bn(e))}finally{a(!1)}}}),[b]);(0,c.useEffect)((()=>{H()}),[H]);const Z=(0,c.useMemo)((()=>({mapsApiKey:_,hasExtendedSettingsAddOn:!1,hasPremiumAddOn:x,hasFailedLoginLimit:E,eventsSettingsPageURL:h,eventsAdminPageURL:u,userCanManageOptions:!1})),[_,x,E,h,u]);return(0,i.createElement)(p,{value:Z},(0,i.createElement)("div",{className:"sh-DashboardWidget"},N?y?(0,i.createElement)("a",{href:y,className:"sh-DashboardWidget-stats sh-DashboardWidget-stats--link"},(0,i.createElement)(Us,{stats:N})):(0,i.createElement)("div",{className:"sh-DashboardWidget-stats"},(0,i.createElement)(Us,{stats:N})):(0,i.createElement)("div",{className:"sh-DashboardWidget-stats"},(0,i.createElement)("div",{className:"sh-DashboardWidget-skeleton__line sh-DashboardWidget-skeleton__line--stats"})),(0,i.createElement)("div",{className:"sh-DashboardWidget-searchRow"},(0,i.createElement)("div",{className:"sh-DashboardWidget-searchRow__row"},(0,i.createElement)("form",{className:"sh-DashboardWidget-search",onSubmit:e=>{e.preventDefault();const t=e.target.elements["sh-dashboard-search"].value.trim();t&&u?window.location.href=(0,f.addQueryArgs)(u,{q:t}):u&&(window.location.href=u)}},(0,i.createElement)("input",{type:"search",name:"sh-dashboard-search","aria-label":(0,vt.__)("Search events","simple-history"),placeholder:(0,vt.__)("Search events","simple-history"),className:"sh-DashboardWidget-search__input"}),(0,i.createElement)("button",{type:"submit",className:"button"},(0,vt.__)("Search all events","simple-history"))),u?(0,i.createElement)("a",{href:(0,f.addQueryArgs)(u,{"show-filters":1}),className:"sh-DashboardWidget-searchRow__filtersLink"},(0,vt.__)("More filters","simple-history")):(0,i.createElement)("span",{className:"sh-DashboardWidget-searchRow__filtersLink is-placeholder"},(0,vt.__)("More filters","simple-history")))),!n&&E&&k>0&&!x&&(0,i.createElement)("div",{className:"sh-DashboardWidget-throttleNotice"},(0,i.createElement)("span",{className:"dashicons dashicons-info","aria-hidden":"true"}),(0,i.createElement)("p",null,(0,i.createElement)("strong",null,(0,vt.__)("Failed login throttling active","simple-history"))," — ",(0,vt.sprintf)(/* translators: %s: number of skipped attempts */ /* translators: %s: number of skipped attempts */ (0,vt.__)("%s attempts skipped to reduce database bloat.","simple-history"),k.toLocaleString())," ",u&&(0,i.createElement)("a",{href:u},(0,vt.__)("View details →","simple-history")))),(0,i.createElement)("div",{className:"sh-DashboardWidget-content",ref:P},(0,i.createElement)(Es,{eventsIsLoading:n,events:e}),(0,i.createElement)(Ss,{eventsLoadingHasErrors:r,eventsLoadingErrorDetails:o}),n&&(0,i.createElement)($s,{count:b?.dashboard||5}),(0,i.createElement)(zs,{eventsIsLoading:n,events:e})),!n&&e.length>0&&e.length<3&&u&&(0,i.createElement)("p",{className:"sh-DashboardWidget-sparseNotice"},(0,c.createInterpolateElement)((0,vt.__)("Only a few events in the past 7 days. Visit the <a>activity log</a> to search your full history.","simple-history"),{a:(0,i.createElement)("a",{href:u})})),(0,i.createElement)("div",{className:"sh-DashboardWidget-viewAll"},u?(0,i.createElement)("a",{href:u},(0,vt.__)("View full activity log →","simple-history")):(0,i.createElement)("span",{className:"sh-DashboardWidget-viewAll__placeholder"},(0,vt.__)("View full activity log →","simple-history"))),!n&&e.length>0&&D&&(0,i.createElement)("p",{className:"sh-DashboardWidget-tip"},(0,i.createElement)("strong",null,(0,vt.__)("Tip:","simple-history"))," ",D)))}var Vs,qs=P(),Ys=(0,i.createContext)({fullPageNavigationOnShallowFalseUpdates:!1}),Qs=(Vs=function(){const{fullPageNavigationOnShallowFalseUpdates:e}=(0,i.useContext)(Ys),[t,n]=(0,i.useState)((()=>"undefined"==typeof location?new URLSearchParams:new URLSearchParams(location.search)));(0,i.useEffect)((()=>{const e=()=>{n(new URLSearchParams(location.search))};return qs.on("update",n),window.addEventListener("popstate",e),()=>{qs.off("update",n),window.removeEventListener("popstate",e)}}),[]);return{searchParams:t,updateUrl:(0,i.useMemo)((()=>function(e){return function(t,n){const a=new URL(location.href);a.search=function(e){if(0===e.size)return"";const t=[];for(const[a,r]of e.entries()){const e=a.replace(/#/g,"%23").replace(/&/g,"%26").replace(/\+/g,"%2B").replace(/=/g,"%3D").replace(/\?/g,"%3F");t.push(`${e}=${n=r,n.replace(/%/g,"%25").replace(/\+/g,"%2B").replace(/ /g,"+").replace(/#/g,"%23").replace(/&/g,"%26").replace(/"/g,"%22").replace(/'/g,"%27").replace(/`/g,"%60").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/[\x00-\x1F]/g,(e=>encodeURIComponent(e)))}`)}var n;return"?"+t.join("&")}(t),e&&!1===n.shallow?("push"===n.history?location.assign:location.replace).call(location,a):("push"===n.history?history.pushState:history.replaceState).call(history,history.state,"",a),qs.emit("update",t),!0===n.scroll&&window.scrollTo({top:0})}}(e)),[e])}},({children:e,...t})=>(0,i.createElement)(b.Provider,{...t,value:{useAdapter:Vs}},e));function Js({children:e,fullPageNavigationOnShallowFalseUpdates:t=!1}){return(0,i.createElement)(Ys.Provider,{value:{fullPageNavigationOnShallowFalseUpdates:t}},(0,i.createElement)(Qs,null,e))}const Ks=(0,s.withFilters)("SimpleHistory.FilteredComponent")((e=>(0,i.createElement)(i.Fragment,null))),Xs="dashboard"===window.pagenow;l()((()=>{const e=document.getElementById("simple-history-react-root");e&&c.createRoot&&(Xs?(0,c.createRoot)(e).render((0,i.createElement)(Gs,null)):(0,c.createRoot)(e).render((0,i.createElement)(Js,null,(0,i.createElement)(Pn,null,(0,i.createElement)(s.SlotFillProvider,null,(0,i.createElement)(Ks,null),(0,i.createElement)(Rs,null))))))}))})();