assets/js
analytics.js
91.8 KB
1 month ago
analytics.js.LICENSE.txt
258 B
7 months ago
bwip.js
1.1 MB
1 month ago
consent.js
104.5 KB
1 month ago
indexeddb.worker.js
86.5 KB
9 months ago
opfs.worker.js
92.0 KB
4 months ago
settings.js
397.7 KB
1 month ago
template-editor.js
738.4 KB
1 month ago
template-gallery.js
289.8 KB
1 month ago
settings.js in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.9.17, at assets/js/settings.js
| 1 | (function(e,t,n,r,i,a){var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),p=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e},m=(e,t,n)=>(n=e==null?{}:o(u(e)),p(t||!e||!e.__esModule||!d.call(e,`default`)?s(n,`default`,{value:e,enumerable:!0}):n,e));let h=m(e,1);e=m(e),t=m(t),i=m(i);var g=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_=new class extends g{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},v={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},y=new class{#e=v;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function b(e){setTimeout(e,0)}var x=typeof window>`u`||`Deno`in globalThis;function S(){}function C(e,t){return typeof e==`function`?e(t):e}function w(e){return typeof e==`number`&&e>=0&&e!==1/0}function T(e,t){return Math.max(e+(t||0)-Date.now(),0)}function E(e,t){return typeof e==`function`?e(t):e}function D(e,t){return typeof e==`function`?e(t):e}function O(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==A(o,t.options))return!1}else if(!M(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function k(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(j(t.options.mutationKey)!==j(a))return!1}else if(!M(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function A(e,t){return(t?.queryKeyHashFn||j)(e)}function j(e){return JSON.stringify(e,(e,t)=>ne(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function M(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!M(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!M(e[r],t[r]))return!1;return!0}return!1}var N=Object.prototype.hasOwnProperty;function ee(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=P(e)&&P(t);if(!r&&!(ne(e)&&ne(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:N.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ee(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function te(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function P(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ne(e){if(!re(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!re(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function re(e){return Object.prototype.toString.call(e)===`[object Object]`}function ie(e){return new Promise(t=>{y.setTimeout(t,e)})}function ae(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ee(e,t)}function oe(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function se(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var F=Symbol();function ce(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===F?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function le(e,t){return typeof e==`function`?e(...t):!!e}function ue(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var de=(()=>{let e=()=>x;return{isServer(){return e()},setIsServer(t){e=t}}})();function fe(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var pe=b;function me(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=pe,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var I=me(),he=new class extends g{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ge(e){return Math.min(1e3*2**e,3e4)}function _e(e){return(e??`online`)!==`online`||he.isOnline()}var ve=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ye(e){let t=!1,n=0,r,i=fe(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ve(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>_.isFocused()&&(e.networkMode===`always`||he.isOnline())&&e.canRun(),u=()=>_e(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(de.isServer()?0:3),o=e.retryDelay??ge,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),ie(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var be=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),w(this.gcTime)&&(this.#e=y.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(de.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(y.clearTimeout(this.#e),this.#e=void 0)}};function xe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ue(e,()=>t.signal,()=>n=!0)},u=ce(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?se:oe;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ce:Se,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Se(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Se(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ce(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var we=class extends be{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=De(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=De(this.options);e.data!==void 0&&(this.setState(Ee(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ae(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(S).catch(S):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>D(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===F||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>E(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!T(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ce(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?xe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=ye({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ve&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ve){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Te(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ee(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),I.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Te(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:_e(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ee(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function De(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Oe=class extends g{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=fe(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ae(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return je(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return je(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof D(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!te(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Me(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||D(this.options.enabled,this.#t)!==D(t.enabled,this.#t)||E(this.options.staleTime,this.#t)!==E(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||D(this.options.enabled,this.#t)!==D(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Pe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(S)),t}#g(){this.#b();let e=E(this.options.staleTime,this.#t);if(de.isServer()||this.#r.isStale||!w(e))return;let t=T(this.#r.dataUpdatedAt,e)+1;this.#d=y.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(de.isServer()||D(this.options.enabled,this.#t)===!1||!w(this.#p)||this.#p===0)&&(this.#f=y.setInterval(()=>{(this.options.refetchIntervalInBackground||_.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(y.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(y.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ae(e,t),o=i&&Me(e,n,t,r);(a||o)&&(l={...l,...Te(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=ae(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=ae(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ne(e,t),refetch:this.refetch,promise:this.#o,isEnabled:D(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=fe();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a()}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!te(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){I.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ke(e,t){return D(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||D(t.retryOnMount,e)!==!1)}function Ae(e,t){return ke(e,t)||e.state.data!==void 0&&je(e,t,t.refetchOnMount)}function je(e,t,n){if(D(t.enabled,e)!==!1&&E(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ne(e,t)}return!1}function Me(e,t,n,r){return(e!==t||D(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ne(e,n)}function Ne(e,t){return D(t.enabled,e)!==!1&&e.isStaleByTime(E(t.staleTime,e))}function Pe(e,t){return!te(e.getCurrentResult(),t)}var Fe=class extends be{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ie(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=ye({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),I.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ie(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Le=class extends g{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Fe({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Re(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Re(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Re(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Re(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){I.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>k(t,e))}findAll(e={}){return this.getAll().filter(t=>k(e,t))}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return I.batch(()=>Promise.all(e.map(e=>e.continue().catch(S))))}};function Re(e){return e.options.scope?.id}var ze=class extends g{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),te(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&j(t.mutationKey)!==j(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Ie();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){I.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Be=class extends g{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??A(r,t),a=this.get(i);return a||(a=new we({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){I.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>O(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>O(e,t)):t}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){I.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){I.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ve=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Be,this.#t=e.mutationCache||new Le,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=_.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=he.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(E(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=C(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return I.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;I.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return I.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=I.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(S).catch(S)}invalidateQueries(e,t={}){return I.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=I.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(S)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(S)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(E(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(S).catch(S)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(S).catch(S)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return he.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(j(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{M(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(j(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{M(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=A(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===F&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},He=f((e=>{var t=globalThis.React,n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),L=f(((e,t)=>{t.exports=He()}))(),Ue=h.createContext(void 0),We=e=>{let t=h.useContext(Ue);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ge=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,L.jsx)(Ue.Provider,{value:e,children:t})),Ke=h.createContext(!1),qe=()=>h.useContext(Ke);Ke.Provider;function Je(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ye=h.createContext(Je()),Xe=()=>h.useContext(Ye),Ze=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?le(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Qe=e=>{h.useEffect(()=>{e.clearReset()},[e])},$e=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||le(n,[e.error,r])),et=(e,t)=>t.state.data===void 0,tt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},nt=(e,t)=>e.isLoading&&e.isFetching&&!t,rt=(e,t)=>e?.suspense&&t.isPending,it=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function at(e,t,n){let r=qe(),i=Xe(),a=We(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,tt(o),Ze(o,i,s),Qe(i);let l=!a.getQueryCache().get(o.queryHash),[u]=h.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(h.useSyncExternalStore(h.useCallback(e=>{let t=f?u.subscribe(I.batchCalls(e)):S;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),h.useEffect(()=>{u.setOptions(o)},[o,u]),rt(o,d))throw it(o,u,i);if($e({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!de.isServer()&&nt(d,r)&&(l?it(o,u,i):s?.promise)?.catch(S).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function ot(e,t){return at(e,Oe,t)}function st(e,t){return at({...e,enabled:!0,suspense:!0,throwOnError:et,placeholderData:void 0},Oe,t)}function ct(e,t){let n=We(t),[r]=h.useState(()=>new ze(n,e));h.useEffect(()=>{r.setOptions(e)},[r,e]);let i=h.useSyncExternalStore(h.useCallback(e=>r.subscribe(I.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=h.useCallback((e,t)=>{r.mutate(e,t).catch(S)},[r]);if(i.error&&le(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var lt=function(){return null},ut=h.useLayoutEffect;function dt(e,t,n={},r){h.useEffect(()=>{if(!e.current||r||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,r,n,e])}function ft(e){let t=h.useRef(null);return h.useImperativeHandle(e,()=>t.current,[]),t}function pt(e){return e[e.length-1]}function mt(e){return typeof e==`function`}function ht(e,t){return mt(e)?e(t):e}var gt=Object.prototype.hasOwnProperty,_t=Object.prototype.propertyIsEnumerable;function vt(e){for(let t in e)if(gt.call(e,t))return!0;return!1}var yt=()=>Object.create(null),bt=(e,t)=>xt(e,t,yt);function xt(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=Tt(e)&&Tt(i);if(!a&&!(Ct(e)&&Ct(i)))return i;let o=a?e:St(e);if(!o)return i;let s=a?i:St(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:gt.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=xt(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function St(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!_t.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!_t.call(e,t))return!1;r.push(t)}return r}function Ct(e){if(!wt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!wt(n)||!n.hasOwnProperty(`isPrototypeOf`))}function wt(e){return Object.prototype.toString.call(e)===`[object Object]`}function Tt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Et(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!Et(e[r],t[r],n))return!1;return!0}if(Ct(e)&&Ct(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!Et(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!Et(e[o],t[o],n)))return!1;return i===a}return!1}var Dt=/[\x00-\x1f\x7f"<>`{}]/g;function Ot(e){return e.replace(Dt,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function kt(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Ot(t)}var At=[`http:`,`https:`,`mailto:`,`tel:`];function jt(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Mt(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=kt(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=kt(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Nt(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Pt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ft(){throw Error(`Invariant failed`)}function It(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var Lt=4,Rt=5;function zt(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function Bt(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=zt(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function Vt(e,t,n,r,i,a,o,s){s?.(n);let c=r;{let r=n.fullPath??n.from,s=n.options,l=r.length,u=s?.caseSensitive??e,d=s?.params?.parse??s?.parseParams;for(;c<l;){let e=Bt(r,c,t),n,s=c,l=e[5];c=l+1,a++;let f=e[0];switch(f){case 0:{let t=r.substring(e[2],e[3]),o=t,s;u?s=i.static??=new Map:(o=t.toLowerCase(),s=i.staticInsensitive??=new Map);let c=s.get(o);if(c)n=c;else{let e=Ut(r);e.parent=i,e.depth=a,n=e,s.set(o,e)}break}case 1:case 3:case 2:{let t=r.substring(s,e[1]),c=r.substring(e[4],l),p=u&&!!(t||c),m=t?p?t:t.toLowerCase():void 0,h=c?p?c:c.toLowerCase():void 0,g=f===1?i.dynamic:f===3?i.optional:i.wildcard,_=f!==2&&!d&&g?.find(e=>!e.parse&&e.caseSensitive===p&&e.prefix===m&&e.suffix===h);if(_)n=_;else{let e=Wt(f,r,p,m,h);n=e,e.parent=i,e.depth=a;let t;t=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],t.push(e),t.length===2&&o?.push(t)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Ut(r);e.kind=Rt,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=Ut(r);e.kind=Lt,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)Vt(e,t,r,c,i,a,o,s)}function Ht(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Ut(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Wt(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Gt(e,t){let n=Ut(`/`),r=new Uint16Array(6),i=[];for(let t of e)Vt(!1,r,t,1,n,0,i);for(let e of i)e.sort(Ht);t.masksTree=n,t.flatCache=It(1e3)}function Kt(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=Zt(e,t.masksTree);return t.flatCache.set(e,r),r}function qt(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Ut(`/`),Vt(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),Zt(r,o,n)}function Jt(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=Zt(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=$t(a.route)),t.matchCache.set(r,a),a}function Yt(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Xt(e,t=!1,n){let r=Ut(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;Vt(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&Ft(),o[e.id]=e,c!==0&&e.path){let t=Yt(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(Ht);return{processedTree:{segmentTree:r,singleCache:It(1e3),matchCache:It(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function Zt(e,t,n=!1){let r=e.split(`/`),i=tn(e,r,t,n);if(!i)return null;let[a]=Qt(e,r,i);return{route:i.node.route,rawParams:a}}function Qt(e,t,n){let r=en(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===Lt)break;if(u.kind===Rt){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function $t(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function en(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function tn(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!pt(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!on(l,n))continue;if(i.parse){if(!an(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==Lt&&on(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===Lt||i.kind===2)&&on(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(an(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&rn(f,o))return n;on(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(_||!(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)))){if(a){if(_)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+nn(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+nn(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+nn(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+nn(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function nn(e,t){return 2**(e-t-1)}function rn(e,t){return e===2**(t-1)-1}function an(e,t,n){let r,i;try{[r,i]=Qt(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function on(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Lt)>(e.node.kind===Lt)||t.node.kind===Lt==(e.node.kind===Lt)&&t.node.depth>e.node.depth)))}function sn(e){return cn(e.filter(e=>e!==void 0).join(`/`))}function cn(e){return e.replace(/\/{2,}/g,`/`)}function ln(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function un(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function dn(e){return un(ln(e))}function fn(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function pn(e,t,n){return fn(e,n)===fn(t,n)}function mn({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&pt(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(pt(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=cn(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function hn(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function gn(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>vn(e,n)).join(`/`):vn(r,n):r}function _n({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=Bt(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=gn(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=gn(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=gn(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function vn(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function yn(e){return e?.isNotFound===!0}function bn(){try{return sessionStorage}catch{return}}var xn=`tsr-scroll-restoration-v1_3`,Sn=bn();function Cn(){try{return JSON.parse(Sn?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function wn(){try{Sn?.setItem(xn,JSON.stringify(Tn))}catch{}}var Tn=Cn(),En=`data-scroll-restoration-id`,Dn=e=>e.state.__TSR_key||e.href;function On(e){let t=e.getAttribute(En);if(t)return`[${En}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var kn=!1,An=`window`;function jn(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Mn(e){let t=new Set;for(let n of e){if(n===An)continue;let e=jn(n);e&&t.add(e)}return t}function Nn(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Dn,a=new Set,o=e=>{let t=Tn[e]||={};for(let e of a)e===document?t[An]={scrollX,scrollY}:e.isConnected&&(t[On(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,kn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{kn||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),wn()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=Tn[d];if(e){let t=Tn[u];for(let n in e){if(n===An){if(s)continue}else{let e=jn(n);if(!e||s&&o&&(l??=Mn(o),l.has(e)))continue}t||=Tn[u]={},t[n]??=e[n]}}}kn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Mn(o));let t=e&&i&&c,s=r.restoring?Tn[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===An){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=jn(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{kn=!1}}))}function Pn(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Fn(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function In(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Fn(r):Array.isArray(t)?t.push(Fn(r)):n[e]=[t,Fn(r)]}return n}var Ln=zn(JSON.parse),Rn=Bn(JSON.stringify,JSON.parse);function zn(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=In(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Bn(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=Pn(e,r);return t?`?${t}`:``}}var Vn=`__root__`;function Hn(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Un(e){return e instanceof Response&&!!e.options}function Wn(e){return{input:({url:t})=>{for(let n of e)t=Kn(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=qn(e[n],t);return t}}}function Gn(e){let t=dn(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=sn([`/`,t,e.pathname]),e)}}function Kn(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function qn(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Jn(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{Pt(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var Yn=`__TSR_index`,Xn=`popstate`,Zn=`beforeunload`;function Qn(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=rr(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Yn];i=$n(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Yn];i=$n(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Yn]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function $n(e,t){t||={};let n=ir();return{...t,key:n,__TSR_key:n,[Yn]:e}}function er(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>rr(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=ir();t.history.replaceState({[Yn]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=rr(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[Yn]-l.state[Yn],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=Qn({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Zn,x,{capture:!0}),t.removeEventListener(Xn,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Zn,x,{capture:!0}),t.addEventListener(Xn,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function tr(e){let t=e?.window??(typeof document<`u`?window:void 0);return er({window:t,parseLocation:()=>{let e=t.location.hash.split(`#`).slice(1),n=e[0]??`/`,r=t.location.search,i=e.slice(1);return rr(`${n}${r}${i.length===0?``:`#${i.join(`#`)}`}`,t.history.state)},createHref:e=>`${t.location.pathname}${t.location.search}#${e}`})}function nr(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function rr(e,t){let n=nr(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=ir();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[Yn]:0,key:a,__TSR_key:a}}}function ir(){return(Math.random()+1).toString(36).substring(7)}function ar(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function or(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function sr({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function cr(e,t,n,r){for(let i of t){if(r?.()===!1)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r?.()===!1)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var lr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=hn(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:er()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=It(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Jn(this.latestLocation,e),Nn(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=dn(a);t&&t!==`/`&&e.push(Gn({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Wn(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Xt(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Gt(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Mt(e).path,external:!1,searchStr:o,search:bt(t?.search,i),hash:Mt(r.slice(1)).path,state:xt(t?.state,a)}}let o=new URL(i,this.origin),s=Kn(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Mt(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:bt(t?.search,c),hash:Mt(s.hash.slice(1)).path,state:xt(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>mn({base:e,to:t.includes(`//`)?cn(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=Jt(un(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this._pendingLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r[1],a=t.to?`${t.to}`:void 0,o=r[2],s=Object.assign(Object.create(null),r[3]),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=hr(t.params,s),d=this.routesByPath[un(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let[e,t,n]=this.getMatchedRoutes(l);f=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&vt(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:Mt(_n({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,fr(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=pr(m,t,f,e._includeValidateSearch),m=bt(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?ht(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?ht(t.state,n.state):{};v=xt(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=qn(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=Nt(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=Kt(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=hr(s,n);r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=un(this.latestLocation.href)===un(n.href)&&Et(sr(n.state),sr(this.latestLocation.state)),a=this._commitPromise,o,s=new Promise(e=>{o=e});if(s.resolve=()=>{o(),a?.resolve()},this._commitPromise=s,i)this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:r}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,_redirects:a,href:o,...s}={})=>{if(o){let t=this.history.location.state.__TSR_index,n=rr(o,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);s.to=Kn(this.rewrite,r).pathname,s.search=this.options.parseSearch(n.search),s.hash=n.hash.slice(1)}let c=this.buildLocation({...s,_includeValidateSearch:!0});a&&(c._redirects=a),this._pendingLocation=c;let l=this.commitLocation({...c,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===c&&(this._pendingLocation=void 0)}),l},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(jt(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await ci(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(or(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&ar(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=(e.options._builtLocation??this.buildLocation(e.options)).publicHref||`/`;e.options.href=t,e.headers.set(`Location`,t)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&jt(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=yr,this.preloadRoute=e=>li(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=qt(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!Et(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?Et(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Rn,parseSearch:e.parseSearch??Ln,protocolAllowlist:e.protocolAllowlist??At}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=$t(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:un(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?mr(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],l,f,p;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=fr(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof ur||(r=new ur(e.message,{cause:e})),t?.throwOnError)throw r;l=n,f={},p=r}}let m=``,h=``;try{m=i.options.loaderDeps?.({search:l})??``,h=m&&JSON.stringify(m)||``}catch(e){if(t?.throwOnError)throw e;p??=e}let{interpolatedPath:g,usedParams:_}=_n({path:i.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),v=i.id+g+h,y=u(i,n),b=this._cache.get(v)??(y?.id===v?y:void 0);d=b?._strictParams??Object.assign(_,d);let x;if(!b)try{gr(i,d)}catch(e){if(x=yn(e)||Un(e)?e:new dr(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:bt(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=ar(i)?`pending`:`success`;C={id:v,ssr:i.options.ssr,index:n,routeId:i.id,params:y?.params??d,_strictParams:d,pathname:g,updatedAt:Date.now(),search:y?bt(y.search,l):l,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:x,context:{},abortController:t?._controller??new AbortController,cause:S,loaderDeps:y?xt(y.loaderDeps,m):m,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let w=s===i.id;C._notFound&&!w&&(C.error=void 0),C._notFound=w,c[n]=C}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?bt(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=pt(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[a,o]=this.getMatchedRoutes(e.pathname),s=pt(a),c={...e.search};for(let e of a)try{Object.assign(c,fr(e.options.validateSearch,c))}catch{}let l=n&&n.routeId===s.id&&n.pathname===e.pathname,u;if(l)u=n.params;else{let e=Object.assign(Object.create(null),o);for(let t of a)try{gr(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}},ur=class extends Error{},dr=class extends Error{};function fr(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new ur(`Async validation not supported`);if(n.issues)throw new ur(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function pr(e,t,n,r){let i=[];for(let e of n){let t=e.options;`search`in t?t.search?.middlewares&&i.push(...t.search.middlewares):(t.preSearchFilters||t.postSearchFilters)&&i.push(({search:e,next:n})=>{let r=n(t.preSearchFilters?t.preSearchFilters.reduce((e,t)=>t(e),e):e);return t.postSearchFilters?t.postSearchFilters.reduce((e,t)=>t(e),r):r});let n=t.validateSearch;n&&i.push(({search:e,next:t,meta:i})=>{let a=t(e);if(r)try{let e=fr(n,a);if(i&&e)for(let t in e)t in a||(i.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=ht(t.search,n);return r&&(r.explicit=e),e}return i[e]({search:n,next:(t,n)=>{if(n){let n=r||{};return{search:a(e+1,t,n),meta:n}}return a(e+1,t,r)},meta:r})};return a(0,e)}function mr(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return Vn}function hr(e,t){return e===!1||e===null?Object.create(null):(e??!0)===!0?t:Object.assign(t,ht(e,t))}function gr(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function _r(e,t){return e.options[t]?.preload?.()}function vr(e,t){let n=_r(e,`component`),r=_r(e,`pendingComponent`),i=t&&r?r.then(t):r;return t&&!r&&t(),n&&i?Promise.all([n,i]).then(()=>{}):n??i}function yr(e,t,n){let r=()=>t===!1?void 0:t?_r(e,t):vr(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function br(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var xr=0,Sr=1,Cr=2,R=3,wr=4;function Tr(e){return typeof e[0]==`number`}function Er(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener(`abort`,i))})}function Dr(e,t){return e.routesById[t.routeId]}function Or(e,t,n){return Un(e)?[R,e]:yn(e)?(e.routeId||=n,[Cr,e]):(t&&typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),t?[Sr,e]:[xr,e])}function kr(e,t){let n=Or(t,!0,e.id);if(n[0]!==Sr)return n;try{e.options.onError?.(n[1])}catch(t){n=Or(t,!0,e.id)}return n}function Ar(e,t,n){return n[0].signal.aborted||!n[2]()?(n[0].abort(),[wr]):kr(e,t)}function jr(e,t){return n=>e.navigate({...n,_fromLocation:t})}async function Mr(e,t,n,r,i){let[a,o]=t,s=n[0].signal,c=!!n[4];for(let t=n[7]??0;t<r;t++){let r=o[t],i=Dr(e,r);r.abortController=n[0];let l=o[t-1]?.context??e.options.context??{},u={params:r.params,location:a,navigate:jr(e,a),buildLocation:e.buildLocation,cause:c?`preload`:r.cause,abortController:n[0],preload:c,matches:o,routeId:i.id},d=l;try{let e=r._ctx;!e&&i.options.context&&(e=r._ctx=i.options.context({...u,deps:r.loaderDeps,context:l})||{}),d={...l,...e},r.context=d}catch(a){return Pr(e,r),[t,Ar(i,a,n)]}if(s.aborted||!n[2]())return n[0].abort(),[t,[wr]];let f=r.paramsError??r.searchError;if(f!==void 0)return Pr(e,r),[t,Ar(i,f,n)];let p=i.options.beforeLoad;if(!p)continue;let m={...u,search:r.search,context:d,...e.options.additionalContext},h=r.status;h===`success`&&(r.status=`pending`),n[8]?.();try{Rr(e,r,`beforeLoad`,n[0]);let a=await Er(p(m),s);if(!n[2]())return n[0].abort(),[t,[wr]];let o=Or(a,!1,i.id);if(o[0]!==xr)return Pr(e,r),[t,o];r.context={...d,...a}}catch(a){return Pr(e,r),[t,Ar(i,a,n)]}finally{h===`success`&&r.status===`pending`&&(r.status=`success`),Rr(e,r,!1,n[0])}}i()}function Nr(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function Pr(e,t){let n=t._flight;t._flight=void 0,Nr(e,t,n)?.abort()}function z(e,t,n){let r=[];for(let i of t)if(!n?.includes(i)){let t=i._flight;i._flight=void 0;let n=Nr(e,i,t);n&&r.push(n)}for(let e of r)e.abort()}function Fr(e,t,n){let r=[];for(let i of t)if(!n.includes(i)){let t=i._flight;if(i._flight=void 0,t?.[2]===1&&e._flights?.get(i.id)===t&&n.some(e=>e.id===i.id))t[2]=0;else{let n=Nr(e,i,t);n&&r.push(n)}}for(let e of r)e.abort()}function Ir(e){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}function Lr(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Rr(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function zr(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:jr(e,s),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function Br(e,t,n,r,i,a,o,s){let c=s.signal;if(c.aborted)return[wr];if(!i)return[xr,void 0];let l=n._flight;Rr(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(zr(e,t,n,r,s,a,o))).then(e=>Or(e,!1,r.id),e=>Or(e,!0,r.id)).then(t=>(t[0]!==xr&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===Sr&&l[2]?kr(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],await Er(l[0],c)}catch(t){if(t!==c)throw t;return Pr(e,n),[wr]}finally{Rr(e,n,!1,s)}}function Vr(e,t,n){t[0]===xr?(e.loaderData=t[1],e.error=void 0,e.status=`success`,e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==R&&(e.status=`success`,e.error=void 0,e.invalid=!0)}function Hr(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&Pr(e,r)}function Ur(e,t){return t[0]===Sr||t[0]===Cr?{...e,status:t[0]===Sr?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Wr(e,t,n,r,i,a){let o=t[1][n],s=Dr(e,o),c=!!a[4],l=c?e._cache.get(o.id):void 0,u,d=!1,f;try{if(o.status===`success`&&(u=s.options.shouldReload,typeof u==`function`&&(u=u(zr(e,t,o,s,a[0],i,c))),a[2]()||(a[0].abort(),f=[wr])),!f){if(o.status!==`success`)d=!0;else{let t=a[4]||o.preload?s.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:s.options.staleTime??e.options.defaultStaleTime??0;d=!!(o.invalid||u||u===void 0&&Date.now()-o.updatedAt>=t&&(a[6]||o.cause===`enter`||a[3].some(e=>e.routeId===o.routeId&&e.id!==o.id)))}}}catch(t){o.invalid=!0,Pr(e,o),f=Ar(s,t,a)}let p=s.options.loader,m=typeof p==`function`?p:p?.handler,h=(!c||s.options.preload!==!1)&&p?e._flights?.get(o.id):void 0;h===o._flight||f?h=void 0:h&&!d&&!c&&u===void 0?d=!0:d||(h=void 0);let g=!!(p&&d&&o.status===`success`&&!c&&!a[5]&&((typeof p==`function`?void 0:p?.staleReloadMode)??e.options.defaultStaleReloadMode)!==`blocking`),_=d&&(!c||s.options.preload!==!1),v=_&&!g&&(o.status!==`success`||!!p),y=s.lazyFn&&s._lazy!==!0?a[8]:void 0;if(_&&!p&&(o.invalid=!1,o.updatedAt=Date.now()),h&&h[2]++,v){let t=o._flight;o._flight=h,Nr(e,o,t)?.abort(),o.status===`success`&&(o.status=`pending`),a[8]?.()}_||(o.isFetching=!1);let b=(f?Promise.resolve(f):v?Br(e,t,o,s,m,i,c,a[0]):Promise.resolve([xr,o.loaderData])).then(t=>(v&&(Vr(o,t,c),t[0]===xr&&(c&&p&&!a[0].signal.aborted&&Hr(e,o,l),o.status=`pending`)),t)),x=Er(Promise.resolve().then(()=>yr(s,void 0,y)),a[0].signal).then(()=>void 0,e=>[n,Ar(s,e,a)]).then(e=>b.then(t=>(v&&!e&&t[0]===xr&&o.status===`pending`&&a[2]()&&(o.status=`success`,a[8]?.()),e)));if(r.push([n,b,x]),!g)return b.then(e=>Ur(o,e));let S={...o,status:`pending`,preload:!1,_flight:h};o.invalid=!1,o.isFetching=`loader`;let C=Br(e,t,S,s,m,i,!1,a[0]).then(e=>(o.isFetching=!1,Vr(S,e,!1),e));return(t[2]??=[]).push([n,C,x,S]),C.then(e=>Ur(S,e))}async function Gr(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=Dr(e,t[n]),a=yr(i,!1);if(a)try{await Er(a,r)}catch(e){if(e===r)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Kr(e,t){t[2]&&=(z(e,t[2].map(e=>e[3])),void 0)}async function qr(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=R)throw[a,t];!i&&t[0]!==xr&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===R)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}async function Jr(e,t,n,r,i,a,o){let s=t[1],c=await a,l=!1,u=s.findIndex(e=>e._notFound),d=t=>t[1][0]===Cr?Gr(e,s,t,r.signal):t[0],f=u<0?s.length:u;if((c?.[1][0]??0)>=R)f=0;else if(c){f=c[2]??=await d(c);for(let e of n){if(e[0]>=f)break;let t=await e[1];if(t[0]!==xr&&t[0]<R&&!(`loaderData`in s[e[0]])){c=[e[0],t],f=c[2]=await d(c);break}}}for(let e of n){if(e[0]>=f)break;let t=await e[2];if(t){c=t;break}}if((c?.[1][0]??0)>=R){let n=c[1];if(n[0]!==R||n[1].options.reloadDocument||i<20)return Kr(e,t),n;l=!0,c=[0,[Sr,Error(`Too many redirects`)]]}let p=c?c[2]??await d(c):u;if(p>=0){let i=c?.[1],a=i?.[0],u=s[p],d=i?.[1],f=()=>{i&&(u._notFound=void 0,a===Sr?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};f();try{await Er(i?Promise.resolve().then(()=>yr(Dr(e,u),a===Sr?`errorComponent`:`notFoundComponent`)):Promise.all([yr(Dr(e,u)),yr(Dr(e,u),`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal)return Kr(e,t),[wr]}i?l&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Kr(e,t),z(e,s),f()):(u.status=`success`,o?.())}return t}async function Yr(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=Dr(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await Er(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function Xr(e,t,n,r){let i=[t,n],a=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&a>=0){let t=await Gr(e,i[1],void 0,r[0].signal,a);t!==a&&(n[a]._notFound=void 0,n[t]._notFound=!0),a=t}let o=a<0?n.length:a+1,s=[],c=r[7]??0,l=c?Promise.resolve(i[1][c-1]):void 0,u=()=>{for(let t=c;t<o&&!r[0].signal.aborted;t++)l=Wr(e,i,t,s,l,r)},d=await Mr(e,i,r,o,u);d&&(r[5]=!0,o=d[0],d[1][0]===Cr?(d[2]=await Gr(e,i[1],d,r[0].signal),o=Math.min(o,d[2]+1)):d[1][0]>=R&&(o=0),u()),r[2]()&&!r[4]&&Ir(e);let f;try{let t=Jr(e,i,s,r[0],r[1],qr(s,d,i[2]),r[8]);i[2]?.length&&(i[3]=qr(i[2],void 0,void 0,t.then(e=>Tr(e)?0:br(e[1]).length,()=>0))),f=await t}catch(t){throw Kr(e,i),t}return Tr(f)?f:Yr(e,f,r[0].signal,r[7]===f[1].length?r[7]:0)}function Zr(e,t){let n=e.stores.matches.get();for(let r=0;r<t.length;r++){let i=t[r],a=i.status===`success`,o=a&&n[r]?.id===i.id&&n[r]?.status===`pending`;if(a&&!o)continue;let s=Dr(e,i),c=o||i.invalid?0:s.options.pendingMs??e.options.defaultPendingMs,l=s.options.pendingComponent??e.options.defaultPendingComponent;return l&&typeof c==`number`&&c!==1/0?[c,r,s.options.pendingMinMs??e.options.defaultPendingMinMs??0,l]:void 0}}function Qr(e,t){if(e._tx!==t)return;let n=e._pending,r=!1,i=n?.[0][3][n[1]]?.id;n?.[0]!==t&&(n&&t[3][n[1]]?.id===i?(n[0]=t,r=!0):(clearTimeout(n?.[3]),e._pending=n=void 0));let a=Zr(e,t[3]);if(!a)return;let[o,s,c,l]=a,u=t[3][s].id;if(!n||n[1]!==s||i!==u){clearTimeout(n?.[3]);let r=e.stores.matches.get()[s],i=r?.id===u&&r.status===`pending`;e._pending=n=[t,s,i?Date.now()+c:t[4]+o,void 0,i?Promise.resolve(!0):void 0,l]}if(n[4]&&!r&&n[5]===l)return;if(n[5]=l,!n[4]){clearTimeout(n[3]);let r=n[2]-Date.now();if(r>0){n[3]=setTimeout(()=>{Qr(e,t)},r);return}n[2]=0}let d=t[3].map(e=>({...e,_flight:void 0}));d[s].status=`pending`;let f=e.startTransition(()=>e.stores.setMatches(d),d).then(t=>(t&&e._pending===n&&n[4]===f&&!n[2]&&(n[2]=Date.now()+c),t));n[4]=f}function $r(e,t){let n=e._pending;n?.[0]===t&&(clearTimeout(n[3]),e._pending=void 0)}function ei(e,t){e._committed=t,e.stores.setMatches(t)}function ti(e,t){z(e,t[1]),Kr(e,t)}function ni(e,t,n,r){let i=e._committed,a=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let o=br(n).length,s=new Map,c=Date.now();for(let t of[...i,...a.values()]){if(t.status!==`success`||n.some((e,n)=>e.id===t.id&&(n<o||e.status===`success`)))continue;let r=Dr(e,t);!r.options.loader||c-t.updatedAt>=(t.preload?r.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:r.options.gcTime??e.options.defaultGcTime??3e5)||s.set(t.id,a.get(t.id)===t?t:{...t,_flight:void 0,isFetching:!1,context:{}})}t[3]=[],e._cache=s,ei(e,n),z(e,[...a.values(),...i],[...n,...s.values()]),cr(e,i,n,()=>e._tx===t)}async function ri(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function ii(e,t,n){await e.navigate({...n.options,replace:!0,ignoreBlocker:!0,_redirects:t[1]+1})}function ai(e,t){$r(e,t),t[0].abort(),z(e,t[3]),t[3]=[],e._tx===t&&(e.batch(()=>{e.stores.status.set(`idle`),e.stores.setMatches(e._committed)}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0))}async function oi(e,t,n,r,i){let a=n.map(e=>({...e}));Lr(a);for(let t of r)Pr(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Jr(e,o,r,t[0],t[1],i)}catch(t){throw z(e,a),t}if(Tr(s)){z(e,a),s[0]===R&&e._tx===t&&e._committed===n&&await ii(e,t,s[1]);return}let c=await Yr(e,s,t[0].signal);if(e._tx!==t||e._committed!==n){z(e,c[1]);return}for(let t of c[1]){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),Pr(e,n))}ei(e,c[1]),z(e,n,c[1])}async function si(e,t,n,r,i,a){let o=[t[0],t[1],()=>e._tx===t&&!!t[3].length,e._committed,void 0,i,n,a,r],s=await Xr(e,t[2],t[3],o);if(Tr(s)){s[0]===R&&e._tx===t?($r(e,t),z(e,t[3]),t[3]=[],e._tx===t&&await ii(e,t,s[1])):ai(e,t);return}let c=e._pending;if(c?.[0]===t&&(clearTimeout(c[3]),c[4])){let n=t[0].signal,r=!1;try{r=await Er(c[4],n)}catch(e){if(e!==n)throw e}if(r&&e._pending===c&&c[0]===t){let e=c[2]-Date.now();if(e>0){try{await Er(new Promise(t=>{c[3]=setTimeout(t,e)}),n)}catch{}clearTimeout(c[3])}}}if(e._tx!==t){$r(e,t),ti(e,s);return}let l=t[2],u=or(l,e.stores.resolvedLocation.get()),d=s[2];await e.startViewTransition(async()=>{if(e._tx!==t){ti(e,s);return}let n=await e.startTransition(()=>{$r(e,t),ni(e,t,s[1],a),e._tx===t&&(e.emit({type:`onLoad`,...u}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...u}))},s[1]);if(e._tx!==t){Kr(e,s);return}d?.length&&oi(e,t,s[1],d,s[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(l),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...u}),n&&e._tx===t&&e.emit({type:`onRendered`,...u})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function ci(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),u.signal.aborted){await ri(e,n);return}let f=or(a,r);if(e.emit({type:`onBeforeNavigate`,...f}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...f}),u.signal.aborted){await ri(e,n);return}let p=i.href===a.href,m,h=u;try{m=e.matchRoutes(a,{_controller:u}),Lr(m)}catch(t){if(u.abort(),!Un(t)){await ri(e),e._commitPromise?.resolve(),e._commitPromise=void 0;return}await e.navigate({...t.options,replace:!0,ignoreBlocker:!0}),await ri(e,n);return}let g=l?c[1](m):void 0;if(g?h=l:l?.abort(),u.signal.aborted){z(e,m),await ri(e,n);return}e._preflight=void 0;let _=[h,s,a,m,Date.now(),Promise.resolve().then(()=>si(e,_,p,()=>Qr(e,_),t?.sync,g)).catch(()=>{e._tx===_&&ai(e,_)})];if(e._tx=_,n){for(let t of e.stores.matches.get()){if(e._tx!==_)break;t.isFetching&&Rr(e,t,!1)}n[0].abort(),Fr(e,n[3],_[3])}if(e._tx!==_){z(e,_[3]),_[3]=[],await ri(e,_);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),Qr(e,_);try{await _[5]}finally{await ri(e,_)}}async function li(e,t,n=0){if(n>20)return;let r=t._builtLocation??e.buildLocation(t),i=e._committed,a=new AbortController,o;try{o=e.matchRoutes(r,{_controller:a}),Lr(o)}catch(e){a.abort(),yn(e)||console.error(e);return}(e._preloads??=new Map).set(a,o);let s;try{let t;try{t=await Xr(e,r,o,[a,n,()=>!0,i,!0])}finally{s=e._preloads.delete(a),z(e,o),a.abort()}if(!Tr(t))return t[1];if(s&&t[0]===R&&!t[1].options.reloadDocument)return li(e,{...t[1].options,_fromLocation:r},n+1)}catch(e){yn(e)||console.error(e)}}var ui=`Error preloading route! ☝️`,di=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Vn:this.parentRoute||Ft();let r=n?Vn:t?.path;r&&r!==`/`&&(r=ln(r));let i=t?.id||r,a=n?Vn:sn([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=sn([`/`,a]));let o=a===`__root__`?`/`:sn([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=un(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Hn({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},fi=class extends di{constructor(e){super(e)}};function pi(e){return(0,L.jsx)(mi,{...e})}var mi=class extends h.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?h.createElement(this.props.errorComponent??hi,{error:e,reset:this.reset}):this.props.children}};function hi({error:e}){let[t,n]=h.useState(!1);return(0,L.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,L.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,L.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,L.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,L.jsx)(`div`,{children:(0,L.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,L.jsx)(`code`,{children:e.message}):null})}):null]})}function gi({children:e,fallback:t=null}){return(0,L.jsx)(h.default.Fragment,{children:_i()?e:t})}function _i(){return h.default.useSyncExternalStore(vi,()=>!0,()=>!1)}function vi(){return()=>{}}var yi=h.createContext(null);function B(e){return h.useContext(yi)}var bi=h.createContext(void 0),xi=h.createContext(void 0),V=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(V||{});function Si({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Ci(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var wi=[],Ti=0,{link:Ei,unlink:Di,propagate:Oi,checkDirty:ki,shallowPropagate:Ai}=Si({update(e){return e._update()},notify(e){wi[Mi++]=e,e.flags&=~V.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=V.Mutable|V.Dirty,Ii(e))}}),ji=0,Mi=0,Ni,Pi=0;function Fi(e){try{++Pi,e()}finally{--Pi||Li()}}function Ii(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Di(n,e)}function Li(){if(!(Pi>0)){for(;ji<Mi;){let e=wi[ji];wi[ji++]=void 0,e.notify()}ji=0,Mi=0}}function Ri(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?V.None:V.Mutable,get(){return Ni!==void 0&&Ei(i,Ni,Ti),i._snapshot},subscribe(e){let t=Ci(e),n={current:!1},r=zi(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Ni,o=t?.compare??Object.is;if(n)Ni=i,++Ti,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=V.Mutable|V.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Ni=a,n&&(i.flags&=~V.RecursedCheck),Ii(i)}}};return n?(i.flags=V.Mutable|V.Dirty,i.get=function(){let e=i.flags;if(e&V.Dirty||e&V.Pending&&ki(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Ai(e)}}else e&V.Pending&&(i.flags=e&~V.Pending);return Ni!==void 0&&Ei(i,Ni,Ti),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Oi(e),Ai(e),Li())}},i}function zi(e){let t=()=>{let t=Ni;Ni=n,++Ti,n.depsTail=void 0,n.flags=V.Watching|V.RecursedCheck;try{return e()}finally{Ni=t,n.flags&=~V.RecursedCheck,Ii(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:V.Watching|V.RecursedCheck,notify(){let e=this.flags;e&V.Dirty||e&V.Pending&&ki(this.deps,this)?t():this.flags=V.Watching},stop(){this.flags=V.None,this.depsTail=void 0,Ii(this)}};return t(),n}var Bi=f((e=>{var t=globalThis.React;function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Vi=f(((e,t)=>{t.exports=Bi()})),Hi=f((e=>{var t=globalThis.React,n=Vi();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Ui=f(((e,t)=>{t.exports=Hi()}))();function Wi(e,t){return e===t}function H(e,t,n=Wi){let r=(0,h.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,h.useCallback)(()=>e?.get(),[e]);return(0,Ui.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Gi={};function Ki(e,t){let n=h.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=xt(n.current,i):i}}function qi(e){let t=B(),n=h.useContext(e.from?xi:bi),r=e.from??n,i=t.stores.getMatchStore(r),a=Ki(e,t),o=H(i,e=>e?a(e):Gi);if(o!==Gi)return o;(e.shouldThrow??!0)&&Ft()}function Ji(e){return qi({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Yi(e){let{select:t,...n}=e;return qi({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Xi(e){return qi({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Zi(e){return qi({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Qi(e){let t=B();return h.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function $i(e){return qi({...e,select:t=>e.select?e.select(t.context):t.context})}function ea(e,n){let r=B(),i=ft(n),{activeProps:a,inactiveProps:o,activeOptions:s,to:c,preload:l,preloadDelay:u,preloadIntentProximity:d,hashScrollIntoView:f,replace:p,startTransition:m,resetScroll:g,viewTransition:_,children:v,target:y,disabled:b,style:x,className:S,onClick:C,onBlur:w,onFocus:T,onMouseEnter:E,onMouseLeave:D,onTouchStart:O,ignoreBlocker:k,params:A,search:j,hash:M,state:N,mask:ee,reloadDocument:te,unsafeRelative:P,from:ne,_fromLocation:re,...ie}=e,ae=_i(),oe=h.useMemo(()=>e,[r,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),se=H(r.stores.location,e=>e,(e,t)=>e.href===t.href),F=h.useMemo(()=>{let e={_fromLocation:se,...oe};return r.buildLocation(e)},[r,se,oe]),ce=F.maskedLocation?F.maskedLocation.publicHref:F.publicHref,le=F.maskedLocation?F.maskedLocation.external:F.external,ue=h.useMemo(()=>la(ce,le,r.history,b),[b,le,ce,r.history]),de=h.useMemo(()=>{if(ue?.external)return jt(ue.href,r.protocolAllowlist)?void 0:ue.href;if(!ua(c)&&typeof c==`string`&&c.indexOf(`:`)!==-1)try{return new URL(c),jt(c,r.protocolAllowlist)?void 0:c}catch{}},[c,ue,r.protocolAllowlist]),fe=h.useMemo(()=>{if(de)return!1;if(s?.exact){if(!pn(se.pathname,F.pathname,r.basepath))return!1}else{let e=fn(se.pathname,r.basepath),t=fn(F.pathname,r.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(s?.includeSearch??!0)&&!Et(se.search,F.search,{partial:!s?.exact,ignoreUndefined:!s?.explicitUndefined})?!1:!s?.includeHash||ae&&se.hash===F.hash},[s?.exact,s?.explicitUndefined,s?.includeHash,s?.includeSearch,se,de,ae,F.hash,F.pathname,F.search,r.basepath]),pe=fe?ht(a,{})??na:ta,me=fe?ta:ht(o,{})??ta,I=[S,pe.className,me.className].filter(Boolean).join(` `),he=(x||pe.style||me.style)&&{...x,...pe.style,...me.style},[ge,_e]=h.useState(!1),ve=h.useRef(!1),ye=e.reloadDocument||de?!1:l??r.options.defaultPreload,be=u??r.options.defaultPreloadDelay??0,xe=h.useCallback(()=>{r.preloadRoute({...oe,_builtLocation:F}).catch(e=>{console.warn(e),console.warn(ui)})},[r,oe,F]);dt(i,h.useCallback(e=>{e?.isIntersecting&&xe()},[xe]),sa,!!b||ye!==`viewport`),h.useEffect(()=>{ve.current||!b&&ye===`render`&&(xe(),ve.current=!0)},[b,xe,ye]);let Se=e=>{let n=e.currentTarget.getAttribute(`target`),i=y===void 0?n:y;if(!b&&!fa(e)&&!e.defaultPrevented&&(!i||i===`_self`)&&e.button===0){e.preventDefault(),(0,t.flushSync)(()=>{_e(!0)});let n=r.subscribe(`onResolved`,()=>{n(),_e(!1)});r.navigate({...oe,replace:p,resetScroll:g,hashScrollIntoView:f,startTransition:m,viewTransition:_,ignoreBlocker:k})}};if(de)return{...ie,ref:i,href:de,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},...S&&{className:S},...C&&{onClick:C},...w&&{onBlur:w},...T&&{onFocus:T},...E&&{onMouseEnter:E},...D&&{onMouseLeave:D},...O&&{onTouchStart:O}};let Ce=e=>{if(b||ye!==`intent`)return;if(!be){xe();return}let t=e.currentTarget;if(oa.has(t))return;let n=setTimeout(()=>{oa.delete(t),xe()},be);oa.set(t,n)},we=e=>{b||ye!==`intent`||xe()},Te=e=>{if(b||!ye||!be)return;let t=e.currentTarget,n=oa.get(t);n&&(clearTimeout(n),oa.delete(t))};return{...ie,...pe,...me,href:ue?.href,ref:i,onClick:ca([C,Se]),onBlur:ca([w,Te]),onFocus:ca([T,Ce]),onMouseEnter:ca([E,Ce]),onMouseLeave:ca([D,Te]),onTouchStart:ca([O,we]),disabled:!!b,target:y,...he&&{style:he},...I&&{className:I},...b&&ra,...fe&&ia,...ae&&ge&&aa}}var ta={},na={className:`active`},ra={role:`link`,"aria-disabled":!0},ia={"data-status":`active`,"aria-current":`page`},aa={"data-transitioning":`transitioning`},oa=new WeakMap,sa={rootMargin:`100px`},ca=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function la(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function ua(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var da=h.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=ea(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return h.createElement(`a`,t,o)}return h.createElement(n,a,o)});function fa(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var pa=class extends di{constructor(e){super(e),this.useMatch=e=>qi({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>$i({...e,from:this.id}),this.useSearch=e=>Zi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Xi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Yi({...e,from:this.id}),this.useLoaderData=e=>Ji({...e,from:this.id}),this.useNavigate=()=>Qi({from:this.fullPath}),this.Link=h.default.forwardRef((e,t)=>(0,L.jsx)(da,{ref:t,from:this.fullPath,...e}))}};function ma(e){return new pa(e)}var ha=class extends fi{constructor(e){super(e),this.useMatch=e=>qi({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>$i({...e,from:this.id}),this.useSearch=e=>Zi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Xi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Yi({...e,from:this.id}),this.useLoaderData=e=>Ji({...e,from:this.id}),this.useNavigate=()=>Qi({from:this.fullPath}),this.Link=h.default.forwardRef((e,t)=>(0,L.jsx)(da,{ref:t,from:this.fullPath,...e}))}};function ga(e){return new ha(e)}function _a(e){let t=B(),n=`not-found-${H(t.stores.location,e=>e.pathname)}-${H(t.stores.status,e=>e)}`;return(0,L.jsx)(pi,{getResetKey:()=>n,onCatch:(t,n)=>{if(yn(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(yn(t))return e.fallback?.(t);throw t},children:e.children})}function va(){return(0,L.jsx)(`p`,{children:`Not Found`})}function ya(e){return(0,L.jsx)(L.Fragment,{children:e.children})}function ba(e,t,n){return t.options.notFoundComponent?(0,L.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,L.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,L.jsx)(va,{})}function xa(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,L.jsx)(n,{}):null}var Sa=(e,t)=>e[0]===t[0]&&e[1]===t[1],Ca=h.memo(function({routeId:e}){let t=B();return(0,L.jsx)(wa,{router:t,match:H(t.stores.getMatchStore(e),e=>e)})});function wa({router:e,match:t}){let n=e.routesById[t.routeId],r=xa(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s)?h.Suspense:ya,l=i?pi:ya,u=o?_a:ya;return(0,L.jsxs)(n.isRoot?n.options.shellComponent??ya:ya,{children:[(0,L.jsx)(bi.Provider,{value:t.routeId,children:(0,L.jsx)(c,{fallback:r,children:(0,L.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(yn(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,L.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return h.createElement(o,e)},children:s?(0,L.jsx)(gi,{fallback:r,children:(0,L.jsx)(Ta,{match:t})}):(0,L.jsx)(Ta,{match:t})})})})}),null]})}var Ta=h.memo(function({match:e}){let t=B(),n=e.routeId,r=t.routesById[n],i=h.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=h.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,L.jsx)(e,{},i):(0,L.jsx)(Ea,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t._tx)throw t._tx[5];return xa(t,r)}if(e.status===`notFound`)return ba(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Ea=h.memo(function(){let e=B(),t=h.useContext(bi),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=H(a,e=>[!!e._notFound,e.error],Sa),i=H(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return ba(e,e.routesById[t],r);if(!i)return null;let a=(0,L.jsx)(Ca,{routeId:i});return t===`__root__`?(0,L.jsx)(h.Suspense,{fallback:xa(e),children:a}):a});function Da(e,t){let n=e[1];e.length=0,n?.(t)}function Oa({t:e}){let t=B(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise((a,o)=>{Da(n,!1),n.push(i,a),e(t),h.startTransition(()=>{try{r()}catch(e){n[1]===a&&(n.length=0),o(e)}})}),ut(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(un(r.publicHref)!==un(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...or(a,a)})}):t._tx||t.load().catch(console.error),e},[t,t.history]),null}function ka(){let e=B(),t=e.routesById[Vn],n=xa(e,t),r=e.ssr?ya:h.Suspense,i=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Oa,{t:h.useState()[1]}),(0,L.jsx)(r,{fallback:n,children:(0,L.jsx)(Aa,{})})]});return e.options.InnerWrap?(0,L.jsx)(e.options.InnerWrap,{children:i}):i}function Aa(){let e=B(),t=e._rendered,n=H(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;ut(()=>{t[0]===n&&Da(t,!0)},[t,n]);let a=i?(0,L.jsx)(Ca,{routeId:i}):null;return(0,L.jsx)(bi.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,L.jsx)(pi,{getResetKey:()=>r,onCatch:void 0,children:a})})}function ja(){let e=B();return H(e.stores.location,e=>e.href),H(e.stores.resolvedLocation,e=>e?.href),H(e.stores.status,e=>e),h.useCallback(t=>{let{pending:n,caseSensitive:r,fuzzy:i,includeSearch:a,...o}=t;return e.matchRoute(o,{pending:n,caseSensitive:r,fuzzy:i,includeSearch:a})},[e])}var Ma=e=>({createMutableStore:Ri,createReadonlyStore:Ri,batch:Fi}),Na=e=>new Pa(e),Pa=class extends lr{constructor(e){super(e,Ma)}};function Fa({router:e,children:t,...n}){vt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,L.jsx)(yi.Provider,{value:e,children:t});return e.options.Wrap?(0,L.jsx)(e.options.Wrap,{children:r}):r}function Ia({router:e,...t}){return(0,L.jsx)(Fa,{router:e,...t,children:(0,L.jsx)(ka,{})})}function La(e){let t=B();return H(t.stores.location,Ki(e,t))}var Ra=(0,h.createContext)(null),za={didCatch:!1,error:null},Ba=class extends h.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=za}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(za))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&Va(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(za))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,h.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,h.createElement)(Ra.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function Va(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}var U=m(f(((e,t)=>{(function(){"use strict";var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}))()),Ha={primary:`wcpos:bg-wp-admin-theme-color wcpos:text-white wcpos:hover:bg-wp-admin-theme-color-darker-10 wcpos:focus:ring-wp-admin-theme-color`,secondary:`wcpos:bg-white wcpos:text-gray-700 wcpos:border wcpos:border-gray-300 wcpos:hover:bg-gray-50 wcpos:focus:ring-wp-admin-theme-color`,destructive:`wcpos:bg-red-600 wcpos:text-white wcpos:hover:bg-red-700 wcpos:focus:ring-red-500`,outline:`wcpos:bg-transparent wcpos:text-wp-admin-theme-color wcpos:border wcpos:border-wp-admin-theme-color wcpos:hover:bg-wp-admin-theme-color-lightest wcpos:focus:ring-wp-admin-theme-color`,ghost:`wcpos:bg-transparent wcpos:text-gray-700 wcpos:hover:bg-gray-100 wcpos:focus:ring-wp-admin-theme-color`,"ghost-destructive":`wcpos:bg-transparent wcpos:text-red-600 wcpos:hover:bg-red-50 wcpos:focus:ring-red-500`,text:`wcpos:bg-transparent wcpos:text-wp-admin-theme-color wcpos:hover:underline wcpos:focus:ring-wp-admin-theme-color`};function Ua(e){return e===`danger`?`destructive`:e}function W({variant:e=`secondary`,loading:t=!1,disabled:n,className:r,children:i,type:a=`button`,...o}){let s=n||t,c=Ua(e);return(0,L.jsxs)(`button`,{type:a,disabled:s,className:(0,U.default)(`wcpos:inline-flex wcpos:items-center wcpos:justify-center wcpos:rounded-md wcpos:text-sm wcpos:font-medium wcpos:transition-colors wcpos:duration-150`,`wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-offset-2`,c===`text`?`wcpos:px-0 wcpos:py-0`:`wcpos:px-3 wcpos:py-1.5`,Ha[c],s?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`,r),...o,children:[t&&(0,L.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,className:`wcpos:mr-2 wcpos:h-4 wcpos:w-4 wcpos:animate-spin`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,L.jsx)(`circle`,{className:`wcpos:opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,L.jsx)(`path`,{className:`wcpos:opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),i]})}function Wa({checked:t,onChange:n,label:r,description:i,disabled:a,className:o,labelClassName:s,"aria-label":c}){let l=e.useId(),u=r?`${l}-label`:void 0,d=i?`${l}-description`:void 0,f=e.useCallback(()=>{a||n(!t)},[t,a,n]);return(0,L.jsxs)(`div`,{className:(0,U.default)(`wcpos:flex wcpos:items-center wcpos:gap-3`,o),children:[(0,L.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":r?void 0:c,"aria-labelledby":u,"aria-describedby":d,disabled:a,onClick:f,className:(0,U.default)(`wcpos:relative wcpos:inline-flex wcpos:items-center wcpos:h-5 wcpos:w-9 wcpos:shrink-0 wcpos:rounded-full wcpos:border-2 wcpos:border-transparent wcpos:p-0 wcpos:m-0 wcpos:align-middle wcpos:transition-colors wcpos:duration-200 wcpos:ease-in-out wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-wp-admin-theme-color wcpos:focus:ring-offset-2`,t?`wcpos:bg-wp-admin-theme-color`:`wcpos:bg-gray-200`,a?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`),children:(0,L.jsx)(`span`,{className:(0,U.default)(`wcpos:pointer-events-none wcpos:block wcpos:h-4 wcpos:w-4 wcpos:transform wcpos:rounded-full wcpos:bg-white wcpos:shadow wcpos:ring-0 wcpos:transition wcpos:duration-200 wcpos:ease-in-out`,t?`wcpos:translate-x-4`:`wcpos:translate-x-0`)})}),r&&(0,L.jsxs)(`div`,{onClick:f,children:[(0,L.jsx)(`label`,{id:u,className:(0,U.default)(a?`wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`,s??`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`),children:r}),i&&(0,L.jsx)(`p`,{id:d,className:`wcpos:text-sm wcpos:text-gray-500`,children:i})]})]})}function Ga({label:t,className:n,id:r,disabled:i,...a}){let o=e.useId(),s=r||o;return(0,L.jsxs)(`div`,{className:(0,U.default)(`wcpos:flex wcpos:items-center wcpos:gap-2`,n),children:[(0,L.jsx)(`input`,{id:s,type:`checkbox`,className:(0,U.default)(`wcpos:h-4 wcpos:w-4 wcpos:rounded wcpos:border-gray-300 wcpos:text-wp-admin-theme-color wcpos:focus:ring-wp-admin-theme-color`,i?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`),disabled:i,...a}),t&&(0,L.jsx)(`label`,{htmlFor:s,className:(0,U.default)(`wcpos:text-sm wcpos:text-gray-700`,i?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`),children:t})]})}var G=e.forwardRef(({error:e,className:t,type:n=`text`,...r},i)=>(0,L.jsx)(`input`,{ref:i,type:n,"aria-invalid":e||void 0,className:(0,U.default)(`wcpos:block wcpos:w-full wcpos:rounded-md wcpos:border wcpos:px-2.5 wcpos:py-1.5 wcpos:text-sm wcpos:shadow-xs`,`wcpos:transition-colors wcpos:duration-150`,`wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-offset-0`,e?`wcpos:border-red-300 wcpos:focus:border-red-500 wcpos:focus:ring-red-500`:`wcpos:border-gray-300 wcpos:focus:border-wp-admin-theme-color wcpos:focus:ring-wp-admin-theme-color`,r.disabled&&`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`,t),...r}));G.displayName=`TextInput`;var Ka=e.forwardRef(({error:e,className:t,...n},r)=>(0,L.jsx)(`textarea`,{ref:r,"aria-invalid":e||void 0,className:(0,U.default)(`wcpos:block wcpos:w-full wcpos:rounded-md wcpos:border wcpos:px-2.5 wcpos:py-1.5 wcpos:text-sm wcpos:shadow-xs`,`wcpos:transition-colors wcpos:duration-150`,`wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-offset-0`,e?`wcpos:border-red-300 wcpos:focus:border-red-500 wcpos:focus:ring-red-500`:`wcpos:border-gray-300 wcpos:focus:border-wp-admin-theme-color wcpos:focus:ring-wp-admin-theme-color`,n.disabled&&`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`,t),...n}));Ka.displayName=`TextArea`;function qa({value:e,options:t,onChange:n,placeholder:r,disabled:i,className:a,inline:o,...s}){return(0,L.jsxs)(`select`,{value:String(e),onChange:e=>{let r=t.find(t=>String(t.value)===e.target.value);r&&n(r)},disabled:i,className:(0,U.default)(o?`wcpos:inline-block`:`wcpos:block wcpos:w-full`,`wcpos:rounded-md wcpos:border wcpos:border-gray-300 wcpos:bg-white wcpos:px-2.5 wcpos:py-1.5 wcpos:text-sm wcpos:shadow-xs`,`wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-wp-admin-theme-color wcpos:focus:border-wp-admin-theme-color`,i&&`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`,a),...s,children:[r&&(0,L.jsx)(`option`,{value:``,disabled:!0,children:r}),t.map(e=>(0,L.jsx)(`option`,{value:String(e.value),disabled:!!e.disabled,children:e.label},String(e.value)))]})}var Ja=`wcpos:flex wcpos:w-full wcpos:items-center wcpos:justify-between wcpos:gap-2 wcpos:rounded-md wcpos:border wcpos:border-gray-300 wcpos:bg-white wcpos:px-2.5 wcpos:py-1.5 wcpos:text-left wcpos:text-sm wcpos:shadow-xs wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-wp-admin-theme-color wcpos:focus:border-wp-admin-theme-color`,Ya=`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`;function Xa(e){return e.toLowerCase()}function Za({countries:n,value:r,onChange:i,placeholder:a,searchPlaceholder:o,noResultsLabel:s,clearable:c=!1,clearLabel:l,disabled:u,className:d,id:f,"aria-label":p}){let m=e.useRef(null),h=e.useRef(null),g=e.useRef(null),_=e.useRef(null),[v,y]=e.useState(!1),[b,x]=e.useState(``),[S,C]=e.useState(0),[w,T]=e.useState({top:0,left:0,width:0}),E=e.useId(),D=e.useMemo(()=>Object.entries(n).map(([e,t])=>({value:e,label:t})).sort((e,t)=>e.label.localeCompare(t.label)),[n]),O=e.useMemo(()=>{let e=Xa(b.trim());return e?D.filter(t=>Xa(t.label).includes(e)||Xa(t.value).includes(e)):D},[D,b]),k=e.useMemo(()=>c?[{value:``,label:l??`—`,isClear:!0},...O]:O,[c,l,O]),A=r?n[r]:``,j=e.useCallback(()=>{if(!m.current)return;let e=m.current.getBoundingClientRect();T({top:e.bottom+4,left:e.left,width:e.width})},[]),M=e.useCallback(()=>{y(!1),x(``)},[]),N=e.useCallback(()=>{if(u)return;y(!0);let e=r?Math.max(0,k.findIndex(e=>!e.isClear&&e.value===r)):+!!c;C(Math.min(e,Math.max(0,k.length-1)))},[c,u,k,r]),ee=e.useCallback(e=>{i(e),M(),m.current?.focus()},[M,i]);e.useLayoutEffect(()=>{if(!v)return;j();let e=requestAnimationFrame(()=>g.current?.focus());return()=>cancelAnimationFrame(e)},[v,j]),e.useEffect(()=>{if(!v)return;let e=e=>{let t=e.target;m.current?.contains(t)||h.current?.contains(t)||M()};return document.addEventListener(`mousedown`,e),window.addEventListener(`scroll`,j,!0),window.addEventListener(`resize`,j),()=>{document.removeEventListener(`mousedown`,e),window.removeEventListener(`scroll`,j,!0),window.removeEventListener(`resize`,j)}},[v,M,j]),e.useEffect(()=>{v&&C(e=>k.length===0?0:e>=k.length?k.length-1:e)},[v,k]),e.useEffect(()=>{!v||!_.current||_.current.querySelector(`[data-index="${S}"]`)?.scrollIntoView?.({block:`nearest`})},[v,S]);let te=e=>{u||(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),N())},P=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),C(e=>k.length===0?0:(e+1)%k.length);break;case`ArrowUp`:e.preventDefault(),C(e=>k.length===0?0:(e-1+k.length)%k.length);break;case`Home`:e.preventDefault(),C(0);break;case`End`:e.preventDefault(),C(Math.max(0,k.length-1));break;case`Enter`:e.preventDefault(),k[S]&&ee(k[S].value);break;case`Escape`:e.preventDefault(),M(),m.current?.focus();break;case`Tab`:M()}},ne=k.length>0?`${E}-option-${S}`:void 0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{ref:m,id:f,type:`button`,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":v,"aria-controls":v?E:void 0,"aria-label":p,disabled:u,onClick:()=>v?M():N(),onKeyDown:te,className:(0,U.default)(Ja,u&&Ya,d),children:[(0,L.jsx)(`span`,{className:(0,U.default)(`wcpos:truncate`,!A&&`wcpos:text-gray-500`),children:A||a||``}),(0,L.jsx)(`svg`,{"aria-hidden":`true`,className:`wcpos:h-4 wcpos:w-4 wcpos:text-gray-400 wcpos:shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`,children:(0,L.jsx)(`path`,{fillRule:`evenodd`,d:`M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 011.08 1.04l-4.24 4.38a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z`,clipRule:`evenodd`})})]}),v&&t.createPortal((0,L.jsxs)(`div`,{ref:h,className:`wcpos:fixed wcpos:z-[99999] wcpos:rounded-md wcpos:border wcpos:border-gray-200 wcpos:bg-white wcpos:shadow-lg`,style:{top:w.top,left:w.left,width:w.width},children:[(0,L.jsx)(`div`,{className:`wcpos:p-2 wcpos:border-b wcpos:border-gray-100`,children:(0,L.jsx)(`input`,{ref:g,type:`text`,role:`searchbox`,"aria-autocomplete":`list`,"aria-controls":E,"aria-activedescendant":ne,value:b,onChange:e=>x(e.target.value),onKeyDown:P,placeholder:o,className:`wcpos:block wcpos:w-full wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:bg-white wcpos:px-2 wcpos:py-1 wcpos:text-sm wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-wp-admin-theme-color wcpos:focus:border-wp-admin-theme-color`})}),(0,L.jsxs)(`ul`,{ref:_,id:E,role:`listbox`,"aria-label":p,className:`wcpos:m-0 wcpos:max-h-60 wcpos:list-none wcpos:overflow-auto wcpos:p-1`,children:[k.map((e,t)=>{let n=t===S,i=e.isClear?r===``:e.value===r;return(0,L.jsx)(`li`,{id:`${E}-option-${t}`,"data-index":t,role:`option`,"aria-selected":i,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>C(t),onClick:()=>ee(e.value),className:(0,U.default)(`wcpos:flex wcpos:cursor-pointer wcpos:items-center wcpos:gap-2 wcpos:rounded wcpos:px-2 wcpos:py-1 wcpos:text-sm`,e.isClear?`wcpos:text-gray-500`:`wcpos:justify-between wcpos:text-gray-700`,n&&`wcpos:bg-gray-100`,i&&(e.isClear?`wcpos:font-medium wcpos:text-gray-700`:`wcpos:font-medium`)),children:e.isClear?(0,L.jsx)(`span`,{className:`wcpos:truncate`,children:e.label}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`wcpos:truncate`,children:e.label}),(0,L.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-400`,children:e.value})]})},e.isClear?`__clear__`:e.value)}),O.length===0&&(0,L.jsx)(`li`,{role:`presentation`,className:`wcpos:px-2 wcpos:py-2 wcpos:text-sm wcpos:text-gray-500`,children:s??`No results`})]})]}),document.body)]})}var Qa=`wcpos:relative wcpos:flex wcpos:w-full wcpos:items-center wcpos:rounded-md wcpos:border wcpos:border-gray-300 wcpos:bg-white wcpos:text-sm wcpos:shadow-xs wcpos:transition-colors wcpos:duration-150 wcpos:focus-within:border-wp-admin-theme-color wcpos:focus-within:ring-2 wcpos:focus-within:ring-wp-admin-theme-color`,$a=`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`,eo=`wcpos:block wcpos:w-full wcpos:flex-1 wcpos:border-0 wcpos:bg-transparent wcpos:px-2.5 wcpos:py-1.5 wcpos:pr-0 wcpos:text-inherit wcpos:focus:outline-none wcpos:focus:ring-0`,to=`wcpos:flex wcpos:h-full wcpos:items-center wcpos:px-1.5 wcpos:text-gray-400 wcpos:hover:text-gray-600 wcpos:focus:outline-none wcpos:disabled:cursor-not-allowed wcpos:disabled:hover:text-gray-400`;function no(e){return e.toLowerCase()}function ro(e,t,n){let r=t.find(t=>t.value===e);return r?r.label:n?e:``}function io({value:n,options:r,onChange:i,allowCustomValue:a=!1,createLabel:o,onQuery:s,placeholder:c,noResultsLabel:l,loading:u=!1,loadingLabel:d,disabled:f,className:p,id:m,"aria-label":h,"aria-labelledby":g}){let _=e.useRef(null),v=e.useRef(null),y=e.useRef(null),b=e.useRef(null),[x,S]=e.useState(!1),[C,w]=e.useState(()=>ro(n,r,a)),[T,E]=e.useState(-1),[D,O]=e.useState({top:0,left:0,width:0}),k=e.useId(),A=s!==void 0;e.useEffect(()=>{x||w(ro(n,r,a))},[n,r,x,a]);let j=e.useMemo(()=>{let e=C.trim(),t=no(e),n=!A&&x&&t?r.filter(e=>no(e.label).includes(t)||no(e.value).includes(t)):r.slice();return x&&a&&o&&e&&(r.some(e=>no(e.label)===t||no(e.value)===t)||n.push({value:e,label:o(e),isCreate:!0})),n},[a,o,C,x,r,A]),M=e.useCallback(()=>{if(!_.current)return;let e=_.current.getBoundingClientRect();O({top:e.bottom+4,left:e.left,width:e.width})},[]),N=e.useCallback(()=>{S(!1)},[]),ee=e.useCallback(()=>{f||(S(!0),E(-1))},[f]),te=e.useCallback(e=>{let t=e.isCreate?e.value:e.label;w(t),N(),i(e.value)},[N,i]),P=e.useCallback(()=>{let e=C.trim(),t=r.find(t=>no(t.label)===no(e));if(t){w(t.label),N(),t.value!==n&&i(t.value);return}if(a){w(e),N(),e!==n&&i(e);return}w(ro(n,r,a)),N()},[a,N,C,i,r,n]),ne=e.useRef(P);e.useEffect(()=>{ne.current=P},[P]),e.useLayoutEffect(()=>{x&&M()},[x,M]),e.useEffect(()=>{if(!x)return;let e=e=>{let t=e.target;_.current?.contains(t)||y.current?.contains(t)||ne.current()};return document.addEventListener(`mousedown`,e),window.addEventListener(`scroll`,M,!0),window.addEventListener(`resize`,M),()=>{document.removeEventListener(`mousedown`,e),window.removeEventListener(`scroll`,M,!0),window.removeEventListener(`resize`,M)}},[x,M]),e.useEffect(()=>{x&&E(e=>j.length===0?-1:e>=j.length?j.length-1:e)},[x,j]),e.useEffect(()=>{!x||!b.current||b.current.querySelector(`[data-index="${T}"]`)?.scrollIntoView?.({block:`nearest`})},[x,T]);let re=e=>{let t=e.target.value;w(t),x||S(!0),E(t.trim()===``?-1:0),s?.(t)},ie=()=>{if(f)return;S(!0);let e=v.current;e&&requestAnimationFrame(()=>e.select())},ae=e=>{let t=e.relatedTarget;t&&(_.current?.contains(t)||y.current?.contains(t))||ne.current()},oe=e=>{if(!f)switch(e.key){case`ArrowDown`:if(e.preventDefault(),!x){ee();return}E(e=>j.length===0?-1:e===-1?0:(e+1)%j.length);break;case`ArrowUp`:if(e.preventDefault(),!x){ee();return}E(e=>j.length===0?-1:e===-1?j.length-1:(e-1+j.length)%j.length);break;case`Home`:x&&j.length>0&&(e.preventDefault(),E(0));break;case`End`:x&&j.length>0&&(e.preventDefault(),E(j.length-1));break;case`Enter`:if(x&&T>=0&&j[T]){e.preventDefault(),te(j[T]);return}e.preventDefault(),P();break;case`Escape`:x&&(e.preventDefault(),w(ro(n,r,a)),N());break;case`Tab`:x&&P()}},se=e=>{e.preventDefault(),!f&&(x?N():(ee(),v.current?.focus()))},F=x&&T>=0&&j.length>0?`${k}-option-${T}`:void 0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{ref:_,className:(0,U.default)(Qa,f&&$a,p),children:[(0,L.jsx)(`input`,{ref:v,id:m,type:`text`,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":x,"aria-controls":x?k:void 0,"aria-autocomplete":`list`,"aria-activedescendant":F,"aria-label":h,"aria-labelledby":g,autoComplete:`off`,"data-1p-ignore":!0,"data-lpignore":`true`,disabled:f,value:C,placeholder:c,onChange:re,onFocus:ie,onBlur:ae,onKeyDown:oe,className:eo}),(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-hidden":`true`,disabled:f,onMouseDown:se,className:to,children:(0,L.jsx)(`svg`,{className:`wcpos:h-4 wcpos:w-4`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{fillRule:`evenodd`,d:`M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 011.08 1.04l-4.24 4.38a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z`,clipRule:`evenodd`})})})]}),x&&t.createPortal((0,L.jsx)(`div`,{ref:y,className:`wcpos:fixed wcpos:z-[99999] wcpos:rounded-md wcpos:border wcpos:border-gray-200 wcpos:bg-white wcpos:shadow-lg`,style:{top:D.top,left:D.left,width:D.width},children:(0,L.jsx)(`ul`,{ref:b,id:k,role:`listbox`,"aria-label":h,className:`wcpos:m-0 wcpos:max-h-60 wcpos:list-none wcpos:overflow-auto wcpos:p-1`,children:u?(0,L.jsx)(`li`,{role:`presentation`,className:`wcpos:px-2 wcpos:py-2 wcpos:text-sm wcpos:text-gray-500`,children:d??`Loading…`}):j.length===0?(0,L.jsx)(`li`,{role:`presentation`,className:`wcpos:px-2 wcpos:py-2 wcpos:text-sm wcpos:text-gray-500`,children:l??`No results`}):j.map((e,t)=>{let r=t===T,i=!e.isCreate&&e.value===n;return(0,L.jsx)(`li`,{id:`${k}-option-${t}`,"data-index":t,role:`option`,"aria-selected":i,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>E(t),onClick:()=>te(e),className:(0,U.default)(`wcpos:flex wcpos:cursor-pointer wcpos:items-center wcpos:rounded wcpos:px-2 wcpos:py-1 wcpos:text-sm`,e.isCreate?`wcpos:text-wp-admin-theme-color`:`wcpos:text-gray-700`,r&&`wcpos:bg-gray-100`,i&&`wcpos:font-medium`),children:(0,L.jsx)(`span`,{className:`wcpos:truncate`,children:e.label})},e.isCreate?`__create__-${k}`:e.value)})})}),document.body)]})}function ao({open:t,onClose:n,title:r,"aria-label":i,description:a,children:o,className:s}){let c=e.useId(),l=e.useId();return e.useEffect(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[t,n]),t?(0,L.jsxs)(`div`,{className:`wcpos:relative wcpos:z-50`,children:[(0,L.jsx)(`div`,{className:`wcpos:fixed wcpos:inset-0 wcpos:bg-black/30`,"aria-hidden":`true`}),(0,L.jsx)(`div`,{className:`wcpos:fixed wcpos:inset-0 wcpos:flex wcpos:items-center wcpos:justify-center wcpos:p-4`,onClick:()=>n(!1),children:(0,L.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":r?c:void 0,"aria-label":r?void 0:i,"aria-describedby":a?l:void 0,onClick:e=>e.stopPropagation(),className:(0,U.default)(`wcpos:mx-auto wcpos:max-w-lg wcpos:w-full wcpos:rounded-lg wcpos:bg-white wcpos:p-6 wcpos:shadow-xl`,s),children:[r&&(0,L.jsx)(`h2`,{id:c,className:`wcpos:text-lg wcpos:font-semibold wcpos:text-gray-900 wcpos:mb-2`,children:r}),a&&(0,L.jsx)(`p`,{id:l,className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-4`,children:a}),o]})})]}):null}function oo({text:n,children:r,className:i}){let a=e.useRef(null),[o,s]=e.useState(!1),[c,l]=e.useState({top:0,left:0}),u=e.useId(),d=e.useCallback(()=>{if(!a.current)return;let e=a.current.getBoundingClientRect();l({top:e.top-4,left:e.left+e.width/2})},[]),f=e.useCallback(()=>{d(),s(!0)},[d]),p=e.useCallback(()=>s(!1),[]);return e.useEffect(()=>{if(o)return window.addEventListener(`scroll`,d,!0),window.addEventListener(`resize`,d),()=>{window.removeEventListener(`scroll`,d,!0),window.removeEventListener(`resize`,d)}},[o,d]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{ref:a,className:(0,U.default)(`wcpos:inline-flex`,i),onMouseEnter:f,onMouseLeave:p,onFocus:f,onBlur:p,"aria-describedby":o?u:void 0,tabIndex:0,children:r}),o&&t.createPortal((0,L.jsx)(`span`,{id:u,role:`tooltip`,className:`wcpos:fixed wcpos:z-[99999] wcpos:whitespace-nowrap wcpos:rounded wcpos:bg-gray-900 wcpos:px-2 wcpos:py-1 wcpos:text-xs wcpos:text-white wcpos:shadow-lg wcpos:pointer-events-none wcpos:-translate-x-1/2 wcpos:-translate-y-full`,style:{top:c.top,left:c.left},children:n}),document.body)]})}var so=e.createContext(null);function co({trigger:n,children:r,align:i=`end`,offset:a=4,className:o,label:s}){let c=e.useRef(null),l=e.useRef(null),[u,d]=e.useState(!1),[f,p]=e.useState({top:0,left:0}),m=e.useId(),h=e.useCallback(()=>{if(!c.current)return;let e=c.current.getBoundingClientRect(),t=l.current?.offsetWidth??0,n=i===`end`?e.right-t:e.left;p({top:e.bottom+a,left:n})},[i,a]),g=e.useCallback(()=>d(!1),[]),_=e.useCallback(()=>{d(e=>!e)},[]);e.useLayoutEffect(()=>{u&&h()},[u,h]),e.useEffect(()=>{if(!u)return;let e=e=>{let t=e.target;c.current?.contains(t)||l.current?.contains(t)||g()},t=e=>{e.key===`Escape`&&(g(),c.current?.focus())};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`scroll`,h,!0),window.addEventListener(`resize`,h),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`scroll`,h,!0),window.removeEventListener(`resize`,h)}},[u,g,h]);let v=e.useMemo(()=>({close:g}),[g]);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{ref:c,className:(0,U.default)(`wcpos:inline-flex`,o),onClick:_,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_())},role:`button`,tabIndex:0,"aria-haspopup":`menu`,"aria-expanded":u,"aria-controls":u?m:void 0,children:n}),u&&t.createPortal((0,L.jsx)(`div`,{ref:l,id:m,role:`menu`,"aria-label":s,className:`wcpos:fixed wcpos:z-[99999] wcpos:min-w-[180px] wcpos:rounded-md wcpos:border wcpos:border-gray-200 wcpos:bg-white wcpos:py-1 wcpos:shadow-lg`,style:{top:f.top,left:f.left},children:(0,L.jsx)(so.Provider,{value:v,children:r})}),document.body)]})}function lo({children:t,onSelect:n,href:r,disabled:i,target:a,rel:o,destructive:s}){let c=e.useContext(so),l=(0,U.default)(`wcpos:flex wcpos:w-full wcpos:items-center wcpos:px-3 wcpos:py-1.5 wcpos:text-sm wcpos:text-left wcpos:no-underline wcpos:bg-transparent wcpos:border-0 wcpos:cursor-pointer wcpos:focus:outline-none`,s?`wcpos:text-red-600 wcpos:hover:bg-red-50 wcpos:focus:bg-red-50`:`wcpos:text-gray-700 wcpos:hover:bg-gray-100 wcpos:focus:bg-gray-100`,i&&`wcpos:opacity-50 wcpos:cursor-not-allowed wcpos:hover:bg-transparent`),u=e=>{if(i){e.preventDefault();return}n?.(),c?.close()};return r?(0,L.jsx)(`a`,{href:i?void 0:r,target:a,rel:o,role:`menuitem`,className:l,"aria-disabled":i,onClick:u,children:t}):(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,className:l,disabled:i,onClick:u,children:t})}co.Item=lo;function uo({active:e=!1,className:t,children:n,...r}){return(0,L.jsx)(`div`,{className:(0,U.default)(`wcpos:bg-white wcpos:border wcpos:rounded-lg wcpos:overflow-hidden wcpos:flex wcpos:flex-col`,e?`wcpos:border-wp-admin-theme-color wcpos:ring-1 wcpos:ring-wp-admin-theme-color`:`wcpos:border-gray-200`,t),...r,children:n})}function fo({noPadding:e=!1,className:t,children:n,...r}){return(0,L.jsx)(`div`,{className:(0,U.default)(`wcpos:flex-1`,!e&&`wcpos:p-4`,t),...r,children:n})}function po({className:e,children:t,...n}){return(0,L.jsx)(`div`,{className:(0,U.default)(`wcpos:border-t wcpos:border-gray-200 wcpos:bg-gray-50 wcpos:px-4 wcpos:py-2.5`,e),...n,children:t})}uo.Body=fo,uo.Footer=po;var mo={info:`wcpos:bg-blue-50 wcpos:border-blue-200 wcpos:text-blue-800 wcpos:border-l-blue-500`,warning:`wcpos:bg-yellow-50 wcpos:border-yellow-200 wcpos:text-yellow-800 wcpos:border-l-yellow-500`,error:`wcpos:bg-red-50 wcpos:border-red-200 wcpos:text-red-800 wcpos:border-l-red-500`,success:`wcpos:bg-green-50 wcpos:border-green-200 wcpos:text-green-800 wcpos:border-l-green-500`};function ho(){return(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,className:`wcpos:h-4 wcpos:w-4`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{fillRule:`evenodd`,d:`M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z`,clipRule:`evenodd`})})}function go({status:e=`info`,children:t,onRemove:n,isDismissible:r=!0,className:i,dismissLabel:a=`Dismiss`}){return(0,L.jsxs)(`div`,{className:(0,U.default)(`wcpos:flex wcpos:items-start wcpos:gap-2 wcpos:rounded-md wcpos:border wcpos:border-l-4 wcpos:px-3 wcpos:py-2.5 wcpos:text-sm`,mo[e],i),children:[(0,L.jsx)(`div`,{className:`wcpos:flex-1`,children:t}),r&&n&&(0,L.jsx)(`button`,{type:`button`,"aria-label":a,onClick:n,className:`wcpos:shrink-0 wcpos:bg-transparent wcpos:border-0 wcpos:cursor-pointer wcpos:p-0.5 wcpos:rounded wcpos:hover:bg-black/5`,children:(0,L.jsx)(ho,{})})]})}var _o={info:`wcpos:bg-blue-50 wcpos:border-blue-200 wcpos:text-blue-800 wcpos:border-l-blue-500`,success:`wcpos:bg-green-50 wcpos:border-green-200 wcpos:text-green-800 wcpos:border-l-green-500`,warning:`wcpos:bg-yellow-50 wcpos:border-yellow-200 wcpos:text-yellow-800 wcpos:border-l-yellow-500`,error:`wcpos:bg-red-50 wcpos:border-red-200 wcpos:text-red-800 wcpos:border-l-red-500`},vo={info:`i`,success:`✓`,warning:`!`,error:`!`};function yo({status:e=`info`,title:t,icon:n,children:r,className:i}){let a=n===void 0?vo[e]:n;return(0,L.jsxs)(`div`,{className:(0,U.default)(`wcpos:flex wcpos:items-start wcpos:gap-2.5 wcpos:rounded-md wcpos:border wcpos:border-l-4 wcpos:px-3 wcpos:py-2.5 wcpos:text-sm`,_o[e],i),children:[a!==null&&(0,L.jsx)(`span`,{className:`wcpos:inline-flex wcpos:items-center wcpos:justify-center wcpos:flex-shrink-0 wcpos:font-bold wcpos:leading-none wcpos:mt-0.5`,"aria-hidden":`true`,children:a}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[t&&(0,L.jsx)(`div`,{className:`wcpos:font-semibold wcpos:mb-0.5`,children:t}),(0,L.jsx)(`div`,{children:r})]})]})}function K({className:e,width:t,height:n,style:r,...i}){return(0,L.jsx)(`div`,{className:(0,U.default)(`wcpos:animate-pulse wcpos:rounded wcpos:bg-gray-200`,e),style:{width:t,height:n,...r},...i})}function q({label:e,htmlFor:t,description:n,children:r,className:i}){return(0,L.jsxs)(`div`,{className:(0,U.default)(`wcpos:flex wcpos:flex-col wcpos:sm:flex-row wcpos:sm:items-start wcpos:gap-1 wcpos:sm:gap-3 wcpos:py-2.5`,i),children:[e&&(0,L.jsx)(`div`,{className:`wcpos:sm:w-[30%] wcpos:sm:max-w-[200px] wcpos:shrink-0 wcpos:sm:pt-0.5`,children:(0,L.jsx)(`label`,{htmlFor:t,className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-700`,children:e})}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[r,n&&(0,L.jsx)(`p`,{className:`wcpos:mt-1 wcpos:text-xs wcpos:text-gray-500`,children:n})]})]})}function bo({title:e,description:t,headerRight:n,divider:r,children:i,className:a}){let o=!!(e||t),s=n!=null&&n!==!1,c=o||s;return(0,L.jsxs)(`div`,{className:(0,U.default)(r?`wcpos:border-b wcpos:border-gray-200 wcpos:pb-6 wcpos:pt-4`:`wcpos:pb-4 wcpos:mb-4`,a),children:[c&&(0,L.jsxs)(`div`,{className:(0,U.default)(`wcpos:mb-3`,s&&(0,U.default)(`wcpos:flex wcpos:items-center`,o?`wcpos:justify-between`:`wcpos:justify-end`)),children:[o&&(0,L.jsxs)(`div`,{children:[e&&(0,L.jsx)(`h3`,{className:`wcpos:text-base wcpos:font-semibold wcpos:text-gray-900 wcpos:m-0`,children:e}),t&&(0,L.jsx)(`p`,{className:(0,U.default)(`wcpos:text-sm wcpos:text-gray-500`,e&&`wcpos:mt-1`),children:t})]}),s&&(0,L.jsx)(`div`,{className:`wcpos:flex-shrink-0`,children:n})]}),(0,L.jsx)(`div`,{children:i})]})}function xo({items:t,value:n,onChange:r,className:i,...a}){let o=e.useRef(null),s=e.useRef(new Map),[c,l]=e.useState(null),u=e.useCallback(()=>{let e=o.current,t=s.current.get(n);if(!e||!t){l(null);return}let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();l({left:i.left-r.left,width:i.width})},[n]);e.useLayoutEffect(()=>{u()},[u,t]),e.useEffect(()=>{let e=o.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>u());return t.observe(e),()=>t.disconnect()},[u]);let d=e=>t=>{t?s.current.set(e,t):s.current.delete(e)};return(0,L.jsxs)(`div`,{ref:o,className:(0,U.default)(`wcpos:relative wcpos:inline-flex wcpos:items-center wcpos:gap-1 wcpos:rounded-full wcpos:bg-gray-100 wcpos:p-1`,i),...a,children:[c&&(0,L.jsx)(`div`,{"data-testid":`filter-tabs-indicator`,"aria-hidden":`true`,className:`wcpos:absolute wcpos:top-1 wcpos:bottom-1 wcpos:rounded-full wcpos:bg-wp-admin-theme-color wcpos:transition-all wcpos:duration-200 wcpos:ease-out`,style:{transform:`translateX(${c.left-4}px)`,width:c.width}}),t.map(e=>{let t=n===e.key;return(0,L.jsx)(`button`,{ref:d(e.key),type:`button`,disabled:e.disabled,"aria-pressed":t,onClick:()=>r(e.key),className:(0,U.default)(`wcpos:relative wcpos:z-10 wcpos:px-3 wcpos:py-1 wcpos:rounded-full wcpos:text-sm wcpos:font-medium wcpos:transition-colors wcpos:bg-transparent wcpos:border-0`,e.disabled?`wcpos:cursor-not-allowed wcpos:opacity-50`:`wcpos:cursor-pointer`,t?`wcpos:text-white`:`wcpos:text-gray-600 wcpos:hover:text-gray-900`),children:e.label},e.key)})]})}var So={neutral:`wcpos:bg-gray-100 wcpos:text-gray-700`,info:`wcpos:bg-blue-50 wcpos:text-blue-700`,success:`wcpos:bg-green-50 wcpos:text-green-700`,warning:`wcpos:bg-amber-50 wcpos:text-amber-700`,error:`wcpos:bg-red-50 wcpos:text-red-700`,critical:`wcpos:bg-red-100 wcpos:text-red-800`,debug:`wcpos:bg-gray-100 wcpos:text-gray-600`,brand:`wcpos:bg-wp-admin-theme-color wcpos:text-white wcpos:uppercase wcpos:font-semibold wcpos:tracking-wide`},Co={sm:`wcpos:text-xs wcpos:px-2 wcpos:py-0.5`,xs:`wcpos:text-[10px] wcpos:px-1.5 wcpos:py-0.5`},wo={pill:`wcpos:rounded-full`,round:`wcpos:rounded-full wcpos:min-w-5 wcpos:justify-center`};function J({variant:e=`neutral`,shape:t=`pill`,size:n=`sm`,icon:r,className:i,children:a,...o}){return(0,L.jsxs)(`span`,{className:(0,U.default)(`wcpos:inline-flex wcpos:items-center wcpos:gap-1 wcpos:font-medium wcpos:leading-none wcpos:shrink-0`,So[e],Co[n],wo[t],i),...o,children:[r,a]})}var To={sm:`wcpos:w-8 wcpos:h-8 wcpos:text-xs`,md:`wcpos:w-10 wcpos:h-10 wcpos:text-sm`,lg:`wcpos:w-12 wcpos:h-12 wcpos:text-base`},Eo={sm:`wcpos:w-2.5 wcpos:h-2.5`,md:`wcpos:w-3 wcpos:h-3`,lg:`wcpos:w-3.5 wcpos:h-3.5`},Do={none:`wcpos:ring-1 wcpos:ring-gray-200`,brand:`wcpos:ring-2 wcpos:ring-wp-admin-theme-color`};function Oo(e){let t=(e||``).trim();if(!t)return`?`;let n=t.split(/\s+/);return n.length===1?n[0].charAt(0).toUpperCase():(n[0].charAt(0)+n[n.length-1].charAt(0)).toUpperCase()}function ko({name:t,src:n,size:r=`md`,ring:i=`none`,status:a=`none`,statusLabel:o,className:s}){let[c,l]=e.useState(!1),u=!!n&&!c,d=t.trim()||`Avatar`;return e.useEffect(()=>{l(!1)},[n]),(0,L.jsxs)(`span`,{className:(0,U.default)(`wcpos:relative wcpos:inline-flex wcpos:shrink-0`,s),children:[(0,L.jsx)(`span`,{className:(0,U.default)(`wcpos:inline-flex wcpos:items-center wcpos:justify-center`,`wcpos:rounded-full wcpos:overflow-hidden wcpos:select-none`,`wcpos:bg-gray-100 wcpos:text-gray-700 wcpos:font-semibold`,To[r],Do[i]),role:u?void 0:`img`,"aria-label":u?void 0:d,children:u?(0,L.jsx)(`img`,{src:n,alt:t,className:`wcpos:w-full wcpos:h-full wcpos:object-cover`,onError:()=>l(!0)}):(0,L.jsx)(`span`,{"aria-hidden":`true`,children:Oo(t)})}),a===`active`&&(0,L.jsx)(`span`,{className:(0,U.default)(`wcpos:absolute wcpos:-bottom-0.5 wcpos:-right-0.5`,`wcpos:rounded-full wcpos:bg-green-500 wcpos:ring-2 wcpos:ring-white`,Eo[r]),role:`status`,"aria-label":o||`Active now`,title:o||`Active now`})]})}var Ao={saving:`wcpos:bg-gray-900 wcpos:text-white`,success:`wcpos:bg-green-600 wcpos:text-white`,error:`wcpos:bg-red-600 wcpos:text-white`,info:`wcpos:bg-gray-700 wcpos:text-white`};function jo({message:t,status:n=`saving`,onRemove:r,timeout:i=!0}){let[a,o]=e.useState(!1);return e.useEffect(()=>{if(!t)return;let e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[t]),e.useEffect(()=>{if(!t||n===`saving`||!i)return;let e=setTimeout(()=>{o(!1),setTimeout(()=>r?.(),300)},2e3);return()=>clearTimeout(e)},[t,n,r,i]),t?(0,L.jsx)(`div`,{className:(0,U.default)(`wcpos:w-full wcpos:px-4 wcpos:py-2 wcpos:text-sm wcpos:text-center wcpos:transition-all wcpos:duration-300 wcpos:ease-out`,Ao[n],a?`wcpos:translate-y-0 wcpos:opacity-100`:`wcpos:-translate-y-full wcpos:opacity-0`),children:t}):null}var Mo=e.createContext(null),No=0;function Po(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():(No+=1,`snackbar-${Date.now()}-${No}`)}function Fo({children:t,boundsElement:n}){let[r,i]=e.useState([]),a=e.useRef(null),[o,s]=e.useState(null);e.useEffect(()=>{let e=a.current;if(!e)return;let t=n??e,r=()=>{let e=t.getBoundingClientRect();s({left:e.left,width:e.width})};r();let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;return i?.observe(t),window.addEventListener(`resize`,r),()=>{i?.disconnect(),window.removeEventListener(`resize`,r)}},[n]);let c=e.useCallback(e=>{let t=e.id??Po();i([{...e,id:t}])},[]),l=e.useCallback(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=o?{left:o.left,width:o.width}:{left:0,right:0};return(0,L.jsx)(Mo.Provider,{value:{addSnackbar:c},children:(0,L.jsxs)(`div`,{ref:a,className:`wcpos:relative wcpos:flex-1 wcpos:flex wcpos:flex-col`,children:[(0,L.jsx)(`div`,{className:`wcpos:fixed wcpos:top-[var(--wp-admin--admin-bar--height,32px)] wcpos:z-50 wcpos:overflow-hidden`,style:u,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:r.map(e=>(0,L.jsx)(jo,{...e,onRemove:()=>{try{e.onRemove?.()}finally{l(e.id)}}},e.id))}),t]})})}function Io(){let t=e.useContext(Mo);if(!t)throw Error(`useSnackbar must be called within SnackbarProvider`);return t}function Lo({className:e,tableClassName:t,children:n,...r}){return(0,L.jsx)(`div`,{className:(0,U.default)(`wcpos:overflow-x-auto wcpos:rounded-md wcpos:border wcpos:border-gray-200`,e),...r,children:(0,L.jsx)(`table`,{className:(0,U.default)(`wcpos:w-full wcpos:text-sm`,t),children:n})})}function Ro({className:e,children:t,...n}){return(0,L.jsx)(`thead`,{className:e,...n,children:t})}function zo({className:e,children:t,...n}){return(0,L.jsx)(`tbody`,{className:e,...n,children:t})}var Bo=e.forwardRef(function({className:e,children:t,...n},r){return(0,L.jsx)(`tr`,{ref:r,className:(0,U.default)(`wcpos:bg-gray-50 wcpos:text-left wcpos:text-xs wcpos:uppercase wcpos:tracking-wide wcpos:text-gray-500`,e),...n,children:t})}),Vo=e.forwardRef(function({className:e,children:t,...n},r){return(0,L.jsx)(`tr`,{ref:r,className:(0,U.default)(`wcpos:border-t wcpos:border-gray-100`,e),...n,children:t})}),Y=e.forwardRef(function({className:e,children:t,...n},r){return(0,L.jsx)(`th`,{ref:r,className:(0,U.default)(`wcpos:px-3 wcpos:py-2 wcpos:font-medium`,e),...n,children:t})}),X=e.forwardRef(function({className:e,children:t,...n},r){return(0,L.jsx)(`td`,{ref:r,className:(0,U.default)(`wcpos:px-3 wcpos:py-2 wcpos:align-middle`,e),...n,children:t})});Lo.Header=Ro,Lo.HeaderRow=Bo,Lo.Body=zo,Lo.Row=Vo,Lo.Head=Y,Lo.Cell=X;var Ho=[{value:`eu_vat`,label:`EU VAT`},{value:`gb_vat`,label:`GB VAT`},{value:`au_abn`,label:`AU ABN`},{value:`br_cpf`,label:`BR CPF`},{value:`br_cnpj`,label:`BR CNPJ`},{value:`in_gst`,label:`IN GSTIN`},{value:`it_cf`,label:`IT Codice Fiscale`},{value:`it_piva`,label:`IT Partita IVA`},{value:`es_nif`,label:`ES NIF`},{value:`ar_cuit`,label:`AR CUIT`},{value:`sa_vat`,label:`SA VAT`},{value:`ca_gst_hst`,label:`CA GST/HST`},{value:`us_ein`,label:`US EIN`},{value:`de_ust_id`,label:`DE USt-IdNr.`},{value:`de_steuernummer`,label:`DE Steuernummer`},{value:`de_hrb`,label:`DE HRB`},{value:`nl_kvk`,label:`NL KVK`},{value:`fr_siret`,label:`FR SIRET`},{value:`fr_siren`,label:`FR SIREN`},{value:`gb_company`,label:`GB Company number`},{value:`ch_uid`,label:`CH UID`},{value:`other`,label:`Other`}],Uo={eu_vat:`DE123456789`,gb_vat:`GB123456789`,au_abn:`12345678901`,br_cpf:`123.456.789-09`,br_cnpj:`12.345.678/0001-95`,in_gst:`22AAAAA0000A1Z5`,it_cf:`RSSMRA80A01H501U`,it_piva:`12345678901`,es_nif:`B12345674`,ar_cuit:`20-12345678-3`,sa_vat:`300123456700003`,ca_gst_hst:`123456789RT0001`,us_ein:`12-3456789`,de_ust_id:`DE123456789`,de_steuernummer:`12/345/67890`,de_hrb:`HRB 12345`,nl_kvk:`12345678`,fr_siret:`12345678901234`,fr_siren:`123456789`,gb_company:`12345678`,ch_uid:`CHE-123.456.789`},Wo={AR:`ar_cuit`,AU:`au_abn`,BR:`br_cnpj`,CA:`ca_gst_hst`,CH:`ch_uid`,DE:`de_ust_id`,ES:`es_nif`,FR:`fr_siret`,GB:`gb_vat`,IN:`in_gst`,IT:`it_piva`,NL:`nl_kvk`,SA:`sa_vat`,US:`us_ein`},Go={ar_cuit:`AR`,au_abn:`AU`,br_cpf:`BR`,br_cnpj:`BR`,ca_gst_hst:`CA`,ch_uid:`CH`,de_hrb:`DE`,de_steuernummer:`DE`,de_ust_id:`DE`,es_nif:`ES`,fr_siren:`FR`,fr_siret:`FR`,gb_company:`GB`,gb_vat:`GB`,in_gst:`IN`,it_cf:`IT`,it_piva:`IT`,nl_kvk:`NL`,sa_vat:`SA`,us_ein:`US`},Ko=new Set(`AT.BE.BG.CY.CZ.DE.DK.EE.ES.FI.FR.GR.HR.HU.IE.IT.LT.LU.LV.MT.NL.PL.PT.RO.SE.SI.SK`.split(`.`));function qo(e){if(!e)return`other`;let t=e.toUpperCase();return Wo[t]?Wo[t]:Ko.has(t)?`eu_vat`:`other`}function Jo(e,t){if(e===`eu_vat`){let e=t?.toUpperCase();if(e&&Ko.has(e))return e;let n=window?.wcpos?.settings?.storeCountry?.toUpperCase();return n&&Ko.has(n)?n:void 0}return Go[e]}function Yo(e,t){return Uo[e]??t}var Xo=e=>{let t={type:e.type||`other`,value:e.value||``};return e.country&&(t.country=e.country),e.label&&(t.label=e.label),t},Zo=(e,t)=>{if(typeof t.country==`string`&&t.country)return{...t,type:qo(t.country)};if(typeof t.type==`string`){let n=Jo(t.type,e.country);if(n)return{...t,country:n};if(t.type===`eu_vat`)return{...t,country:void 0}}return t},Qo=0,$o=()=>`tax-id-row-${++Qo}`;function es({taxId:t,labels:n,onChangeField:r,onRemove:i}){let[a,o]=e.useState(t.value),[s,c]=e.useState(t.label??``),l=window?.wcpos?.settings?.countries??{};return e.useEffect(()=>{o(t.value)},[t.value]),e.useEffect(()=>{c(t.label??``)},[t.label]),(0,L.jsxs)(Vo,{children:[(0,L.jsx)(X,{children:(0,L.jsx)(qa,{"aria-label":n.type,value:t.type,options:Ho,onChange:({value:e})=>r({type:String(e)})})}),(0,L.jsx)(X,{children:(0,L.jsx)(G,{"aria-label":n.value,placeholder:Yo(t.type,n.value),value:a,onChange:e=>o(e.target.value),onBlur:()=>{let e=a.trim();e!==t.value&&r({value:e})}})}),(0,L.jsx)(X,{children:(0,L.jsx)(Za,{"aria-label":n.country,countries:l,value:t.country??``,onChange:e=>r({country:e}),placeholder:n.countryPlaceholder??n.country,searchPlaceholder:n.countrySearchPlaceholder,noResultsLabel:n.countryNoResults,clearable:!0,clearLabel:n.countryClear})}),(0,L.jsx)(X,{children:(0,L.jsx)(G,{"aria-label":n.label,placeholder:n.label,value:s,onChange:e=>c(e.target.value),onBlur:()=>{let e=s.trim();e!==(t.label??``)&&r({label:e})}})}),(0,L.jsx)(X,{className:`wcpos:text-right`,children:(0,L.jsx)(W,{variant:`ghost-destructive`,onMouseDown:e=>e.preventDefault(),onClick:i,children:n.remove})})]})}var ts=e.forwardRef(function({value:t,onChange:n,labels:r},i){let a=e.useMemo(()=>Array.isArray(t)?t.map(Xo):[],[t]),[o,s]=e.useState(()=>a.map(()=>$o())),[c,l]=e.useState(null);e.useEffect(()=>{s(e=>{if(e.length===a.length)return e;if(e.length<a.length){let t=Array.from({length:a.length-e.length},()=>$o());return[...e,...t]}return e.slice(0,a.length)})},[a.length]);let u=e.useCallback((e,t)=>{if(e>=a.length&&c){let e=Zo(c.taxId,t),r=Xo({...c.taxId,...e});if(t.value&&r.value){s(e=>[...e,c.id]),l(null),n([...a,r]);return}l({id:c.id,taxId:r});return}n(a.map((n,r)=>{if(r!==e)return n;let i=Zo(n,t);return Xo({...n,...i})}))},[c,n,a]),d=e.useCallback(e=>{if(e>=a.length){l(null);return}s(t=>t.filter((t,n)=>n!==e)),n(a.filter((t,n)=>n!==e))},[n,a]),f=e.useCallback(()=>{l(e=>{if(e)return e;let t=window?.wcpos?.settings?.storeCountry,n={type:qo(t),value:``};return t&&(n.country=t),{id:$o(),taxId:n}})},[]);e.useImperativeHandle(i,()=>({addRow:f}),[f]);let p=e.useMemo(()=>{let e=a.map((e,t)=>({id:o[t]??`tax-id-row-fallback-${t}`,taxId:e}));return c&&e.push({id:c.id,taxId:c.taxId}),e},[a,o,c]);return p.length===0?(0,L.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,L.jsx)(`p`,{className:`wcpos:rounded-md wcpos:border wcpos:border-dashed wcpos:border-gray-300 wcpos:bg-gray-50 wcpos:px-3 wcpos:py-4 wcpos:text-center wcpos:text-sm wcpos:text-gray-500`,children:r.empty}),(0,L.jsx)(W,{variant:`outline`,onClick:f,children:r.add})]}):(0,L.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,L.jsxs)(Lo,{children:[(0,L.jsx)(Ro,{children:(0,L.jsxs)(Bo,{children:[(0,L.jsx)(Y,{style:{width:`11rem`},children:r.type}),(0,L.jsx)(Y,{children:r.value}),(0,L.jsx)(Y,{style:{width:`12rem`},children:r.country}),(0,L.jsx)(Y,{children:r.label}),(0,L.jsx)(Y,{className:`wcpos:text-right`,style:{width:`1%`},children:(0,L.jsx)(`span`,{className:`wcpos:sr-only`,children:r.remove})})]})}),(0,L.jsx)(zo,{children:p.map((e,t)=>(0,L.jsx)(es,{taxId:e.taxId,labels:r,onChangeField:e=>u(t,e),onRemove:()=>d(t)},e.id))})]}),(0,L.jsx)(W,{variant:`outline`,onClick:f,children:r.add})]})}),Z=e=>typeof e==`string`,ns=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},rs=e=>e==null?``:String(e),is=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},as=/###/g,os=e=>e&&e.includes(`###`)?e.replace(as,`.`):e,ss=e=>!e||Z(e),cs=(e,t,n)=>{let r=Z(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(ss(e))return{};let t=os(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return ss(e)?{}:{obj:e,k:os(r[i])}},ls=(e,t,n)=>{let{obj:r,k:i}=cs(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=cs(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=cs(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},us=(e,t,n,r)=>{let{obj:i,k:a}=cs(e,t,Object);i[a]=i[a]||[],i[a].push(n)},ds=(e,t)=>{let{obj:n,k:r}=cs(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},fs=(e,t,n)=>{let r=ds(e,n);return r===void 0?ds(t,n):r},ps=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(Object.prototype.hasOwnProperty.call(e,r)?Z(e[r])||e[r]instanceof String||Z(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):ps(e[r],t[r],n):e[r]=t[r]);return e},ms=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),hs={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"/":`/`},gs=e=>Z(e)?e.replace(/[&<>"'\/]/g,e=>hs[e]):e,_s=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},vs=[` `,`,`,`?`,`!`,`;`],ys=new _s(20),bs=(e,t,n)=>{t||=``,n||=``;let r=vs.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=ys.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},xs=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},Ss=e=>e?.replace(/_/g,`-`),Cs={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},ws=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||Cs,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(e=e.map(e=>Z(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),Z(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},Ts=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n(e,...t)})}},Es=class extends Ts{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.includes(`.`)?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):Z(n)&&i?o.push(...n.split(i)):o.push(n)));let s=ds(this.data,o);return!s&&!t&&!n&&e.includes(`.`)&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!Z(n)?s:xs(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),ls(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(Z(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=ds(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?ps(s,n,i):s={...s,...n},ls(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},Ds={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},Os=Symbol(`i18next/PATH_KEY`);function ks(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Os?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function As(e,t){let{[Os]:n}=e(ks()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`,a=t?.enableSelector===`strict`;if(n.length>1&&i){let e=t?.ns,o=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(o&&(a?o:o.length>1?o.slice(1):[]).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var js=e=>!Z(e)&&typeof e!=`boolean`&&typeof e!=`number`,Ms=class e extends Ts{constructor(e,t={}){super(),is([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=ws.create(`translator`),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=js(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.includes(n),o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!bs(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Z(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:Z(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=As(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?As(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!Z(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=js(E),O=Object.prototype.toString.apply(E);if(y&&E&&D&&!_.includes(O)&&!(Z(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;t[e]=x&&!m?this.translate(r,{...i,defaultValue:js(T)?T[e]:void 0,joinArrays:!1,ns:c}):this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&Z(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,b&&!c?`${s}${this.pluralResolver.getSuffix(d,i.count,i)}`:s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=Z(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!Z(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=Z(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=Ds.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return Z(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?As(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!Z(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(Z(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!this.checkedLoadedFor[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(this.checkedLoadedFor[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.startsWith(i)&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.startsWith(i)&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!Z(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r={...r,count:e.count}),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},Ns=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ws.create(`languageUtils`)}getScriptPartFromCode(e){if(e=Ss(e),!e||!e.includes(`-`))return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=Ss(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Z(e)&&e.includes(`-`)){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),Z(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Z(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):Z(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.includes(e)||i(this.formatLanguageCode(e))}),r}},Ps={zero:0,one:1,two:2,few:3,many:4,other:5},Fs={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},Is=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=ws.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=Ss(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),Fs;if(!e.match(/-|_/))return Fs;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>Ps[e]-Ps[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},Ls=(e,t,n,r=`.`,i=!0)=>{let a=fs(e,t,n);return!a&&i&&Z(n)&&(a=xs(e,n,r),a===void 0&&(a=xs(t,n,r))),a},Rs=e=>e.replace(/\$/g,`$$$$`),zs=class{constructor(e={}){this.logger=ws.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?gs:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?ms(i):a||`{{`,this.suffix=o?ms(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?ms(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?ms(l):``,this.nestingPrefix=d?ms(d):f||ms(`$t(`),this.nestingSuffix=p?ms(p):m||ms(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_!==void 0&&_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(!e.includes(this.formatSeparator)){let i=Ls(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(Ls(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e):e}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0){if(typeof l==`function`){let t=l(e,i,r);a=Z(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``}else!Z(a)&&!this.useRawValueToEscape&&(a=rs(a));let s=t.safeValue(a);if(e=e.replace(i[0],Rs(s)),u?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${ms(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!Z(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/s.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!Z(i))return i;Z(i)||(i=rs(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},Bs=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||=i.trim():t===`relativetime`&&!i.includes(`:`)?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},Vs=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(Ss(r),i),t[o]=s),s(n)}},Hs=e=>(t,n,r)=>e(Ss(n),r)(t),Us=class{constructor(e={}){this.logger=ws.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?Vs:Hs;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Vs(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator),a=[];for(let e=0;e<i.length;e++){let t=i[e];for(;t.indexOf(`(`)>-1&&!t.includes(`)`)&&e+1<i.length;)t=`${t}${this.formatSeparator}${i[++e]}`;a.push(t)}return a.reduce((e,t)=>{let{formatName:i,formatOptions:a}=Bs(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${i}`),e},e)}},Ws=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Gs=class extends Ts{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=ws.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{us(n.loaded,[i],a),Ws(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read(e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();Z(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Z(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(n!=null&&n!==``){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},Ks=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),Z(e[1])&&(t.defaultValue=e[1]),Z(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),qs=e=>(Z(e.ns)&&(e.ns=[e.ns]),Z(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Z(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),Js=()=>{},Ys=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},Q=class e extends Ts{constructor(e={},t){if(super(),this.options=qs(e),this.services={},this.logger=ws,this.modules={external:[]},Ys(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(Z(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=Ks();this.options={...n,...this.options,...qs(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?ws.init(r(this.modules.logger),this.options):ws.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Us;let t=new Ns(this.options);this.store=new Es(this.options.resources,this.options);let n=this.services;n.logger=ws,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new Is(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new zs(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new Gs(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new Ms(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=Js,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=ns(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=Js){let n=t,r=Z(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=ns();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=Js,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&Ds.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&![`cimode`,`dev`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=ns();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=Z(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(Z(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n,r){let i=r?.scopeNs,a=(e,t,...r)=>{let o;o=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(r)),o.lng=o.lng||a.lng,o.lngs=o.lngs||a.lngs;let s=o.ns!==void 0&&o.ns!==null;o.ns=o.ns||a.ns,o.keyPrefix!==``&&(o.keyPrefix=o.keyPrefix||n||a.keyPrefix);let c={...this.options,...o};Array.isArray(i)&&!s&&(c.ns=i),typeof o.keyPrefix==`function`&&(o.keyPrefix=As(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=As(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=As(e,c)),u=o.keyPrefix?`${o.keyPrefix}${l}${e}`:e),this.t(u,o)};return Z(e)?a.lng=e:a.lngs=e,a.ns=t,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=ns();return this.options.ns?(Z(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=ns();Z(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new Ns(Ks());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=Js){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new Es(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...Ks().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new zs(n)}return a.translator=new Ms(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();Q.createInstance,Q.dir,Q.init,Q.loadResources,Q.reloadResources,Q.use,Q.changeLanguage,Q.getFixedT,Q.t,Q.exists,Q.setDefaultNamespace,Q.hasLoadedNamespace,Q.loadNamespaces,Q.loadLanguages;function Xs(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Zs(e){"@babel/helpers - typeof";return Zs=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Zs(e)}function Qs(e,t){if(Zs(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Zs(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function $s(e){var t=Qs(e,`string`);return Zs(t)==`symbol`?t:t+``}function ec(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,$s(r.key),r)}}function tc(e,t,n){return t&&ec(e.prototype,t),n&&ec(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var nc=[],rc=nc.forEach,ic=nc.slice,ac=[`__proto__`,`constructor`,`prototype`];function oc(e){return rc.call(ic.call(arguments,1),function(t){if(t)for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];ac.indexOf(i)>-1||e[i]===void 0&&(e[i]=t[i])}}),e}function sc(e){return e?typeof e==`function`?new e:e:null}function cc(){return{handleEmptyResourcesAsFailed:!0,cacheHitMode:`none`,retryOnFailure:!1}}function lc(e,t,n,r){var i=e.read.bind(e);if(i.length===2){try{var a=i(t,n);a&&typeof a.then==`function`?a.then(function(e){return r(null,e)}).catch(r):r(null,a)}catch(e){r(e)}return}i(t,n,r)}var uc=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Xs(this,e),this.backends=[],this.type=`backend`,this.allOptions=r,this.init(t,n)}return tc(e,[{key:`init`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=oc(n,this.options||{},cc()),this.allOptions=r,this.options.backends&&this.options.backends.length>1&&(this.allOptions.saveMissing||this.allOptions.updateMissing)&&this.services&&this.services.logger&&this.services.logger.warn(`i18next-chained-backend: Using multiple backends in combination with saveMissing/updateMissing is not recommended, as it may trigger based on stale data.`),this.options.backends&&this.options.backends.forEach(function(n,i){t.backends[i]=t.backends[i]||sc(n),t.backends[i].init(e,t.options.backendOptions&&t.options.backendOptions[i]||{},r)}),this.services&&this.options.reloadInterval&&setInterval(function(){return t.reload()},this.options.reloadInterval)}},{key:`read`,value:function(e,t,n){var r=this,i=this.backends.length,a=function(s){if(s>=i)return n(Error(`non of the backend loaded data`),r.options.retryOnFailure);var c=s===i-1,l=r.options.handleEmptyResourcesAsFailed&&!c?0:-1,u=r.backends[s];u.read?lc(u,e,t,function(i,c,d){if(!i&&c&&Object.keys(c).length>l){if(n(null,c,s),o(s-1,c),u.save&&r.options.cacheHitMode&&[`refresh`,`refreshAndUpdateStore`].indexOf(r.options.cacheHitMode)>-1){if(d&&r.options.refreshExpirationTime&&d+r.options.refreshExpirationTime>Date.now())return;var f=r.backends[s+1];f&&f.read&&lc(f,e,t,function(n,i){n||i&&(Object.keys(i).length<=l||(o(s,i),r.options.cacheHitMode===`refreshAndUpdateStore`&&r.services&&r.services.resourceStore&&r.services.resourceStore.addResourceBundle(e,t,i)))})}}else a(s+1)}):a(s+1)},o=function(n,i){if(!(n<0)){var a=r.backends[n];a.save&&a.save(e,t,i),o(n-1,i)}};a(0)}},{key:`create`,value:function(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){},a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};this.backends.forEach(function(o){if(o.create){var s=o.create.bind(o);if(s.length<6){try{var c=s.length===5?s(e,t,n,r,a):s(e,t,n,r);c&&typeof c.then==`function`?c.then(function(e){return i(null,e)}).catch(i):i(null,c)}catch(e){i(e)}return}s(e,t,n,r,i,a)}})}},{key:`reload`,value:function(){var e=this,t=this.services,n=t.backendConnector,r=t.languageUtils,i=t.logger,a=n.language;if(!(a&&a.toLowerCase()===`cimode`)){var o=[],s=function(e){r.toResolveHierarchy(e).forEach(function(e){o.indexOf(e)<0&&o.push(e)})};s(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(e){return s(e)}),o.forEach(function(t){e.allOptions.ns.forEach(function(e){n.read(t,e,`read`,null,null,function(r,a){r&&i.warn(`loading namespace ${e} for language ${t} failed`,r),!r&&a&&i.log(`loaded namespace ${e} for language ${t}`,a),n.loaded(`${t}|${e}`,r,a)})})})}}}])}();uc.type=`backend`;var dc=[];dc.forEach,dc.slice;var fc=[`__proto__`,`constructor`,`prototype`];function pc(e){return!(typeof e!=`string`||e.length===0||e.length>128||fc.indexOf(e)>-1||e.indexOf(`..`)>-1||e.indexOf(`\\`)>-1||/[?#%\s]/.test(e)||/[\x00-\x1F\x7F]/.test(e))}function mc(e){return!(!pc(e)||e.indexOf(`/`)>-1||e.indexOf(`@`)>-1)}function hc(e){return pc(e)}var gc={lng:mc,ns:hc};function _c(e){return typeof e==`string`?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e}function vc(e){if(typeof e!=`string`||e.length===0)return e;try{let t=new URL(e);return t.username||t.password?(t.username=``,t.password=``,t.toString()):e}catch{return e.replace(/(\/\/)[^/@\s]+@/g,`$1`)}}function yc(){return typeof XMLHttpRequest==`function`||typeof XMLHttpRequest==`object`}function bc(e){return!!e&&typeof e.then==`function`}function xc(e){return bc(e)?e:Promise.resolve(e)}var Sc=/\{\{(.+?)\}\}/g;function Cc(e,t){let n=!1,r=e.replace(Sc,(e,r)=>{let i=r.trim();if(fc.indexOf(i)>-1)return e;let a=t[i];if(a==null)return e;let o=gc[i]||mc,s=String(a).split(`+`);for(let t of s)if(!o(t))return n=!0,e;return s.join(`+`)});return n?null:r}var wc=typeof globalThis<`u`?globalThis:typeof global<`u`?global:typeof window<`u`?window:void 0,Tc;typeof fetch==`function`?Tc=fetch:wc&&typeof wc.fetch==`function`&&(Tc=wc.fetch);var Ec=yc()&&wc?wc.XMLHttpRequest:void 0,Dc=typeof ActiveXObject==`function`&&wc?wc.ActiveXObject:void 0,Oc=[`__proto__`,`constructor`,`prototype`],kc=(e,t)=>{if(t&&typeof t==`object`){let n=``;for(let e of Object.keys(t))Oc.indexOf(e)>-1||(n+=`&`+encodeURIComponent(e)+`=`+encodeURIComponent(t[e]));if(!n)return e;e=e+(e.indexOf(`?`)===-1?`?`:`&`)+n.slice(1)}return e},Ac=(e,t,n,r)=>{let i=e=>{if(!e.ok)return n(e.statusText||`Error`,{status:e.status});e.text().then(t=>{n(null,{status:e.status,data:t})}).catch(n)};if(r){let a=r(e,t);if(a instanceof Promise){a.then(i).catch(n);return}}typeof fetch==`function`?fetch(e,t).then(i).catch(n):Tc(e,t).then(i).catch(n)},jc=(e,t,n,r)=>{e.queryStringParams&&(t=kc(t,e.queryStringParams));let i={...typeof e.customHeaders==`function`?e.customHeaders():e.customHeaders};typeof window>`u`&&typeof global<`u`&&global.process!==void 0&&global.process.versions&&global.process.versions.node&&(i[`User-Agent`]=`i18next-http-backend (node/${global.process.version}; ${global.process.platform} ${global.process.arch})`),n&&(i[`Content-Type`]=`application/json`);let a=typeof e.requestOptions==`function`?e.requestOptions(n):e.requestOptions,o={method:n?`POST`:`GET`,body:n?e.stringify(n):void 0,headers:i,...e._omitFetchOptions?{}:a},s=typeof e.alternateFetch==`function`&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{Ac(t,o,r,s)}catch(n){if(!a||Object.keys(a).length===0||!n.message||n.message.indexOf(`not implemented`)<0)return r(n);try{Object.keys(a).forEach(e=>{delete o[e]}),Ac(t,o,r,s),e._omitFetchOptions=!0}catch(e){r(e)}}},Mc=(e,t,n,r)=>{n&&typeof n==`object`&&(n=kc(``,n).slice(1)),e.queryStringParams&&(t=kc(t,e.queryStringParams));try{let i=Ec?new Ec:new Dc(`MSXML2.XMLHTTP.3.0`);i.open(n?`POST`:`GET`,t,1),e.crossDomain||i.setRequestHeader(`X-Requested-With`,`XMLHttpRequest`),i.withCredentials=!!e.withCredentials,n&&i.setRequestHeader(`Content-Type`,`application/x-www-form-urlencoded`),i.overrideMimeType&&i.overrideMimeType(`application/json`);let a=e.customHeaders;if(a=typeof a==`function`?a():a,a)for(let e of Object.keys(a))Oc.indexOf(e)>-1||i.setRequestHeader(e,a[e]);i.onreadystatechange=()=>{i.readyState>3&&r(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(n)}catch(e){console&&console.log(e)}},Nc=(e,t,n,r)=>{if(typeof n==`function`&&(r=n,n=void 0),r||=(()=>{}),Tc&&t.indexOf(`file:`)!==0)return jc(e,t,n,r);if(yc()||typeof ActiveXObject==`function`)return Mc(e,t,n,r);r(Error(`No fetch and no xhr implementation found!`))},Pc=()=>({loadPath:`/locales/{{lng}}/{{ns}}.json`,addPath:`/locales/add/{{lng}}/{{ns}}`,parse:e=>JSON.parse(e),stringify:JSON.stringify,parsePayload:(e,t,n)=>({[t]:n||``}),parseLoadPayload:(e,t)=>void 0,request:Nc,reloadInterval:typeof window<`u`?!1:36e5,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:`cors`,credentials:`same-origin`,cache:`default`}}),Fc=class{constructor(e,t={},n={}){this.services=e,this.options=t,this.allOptions=n,this.type=`backend`,this.init(e,t,n)}init(e,t={},n={}){if(this.services=e,this.options={...Pc(),...this.options||{},...t},this.allOptions=n,this.services&&this.options.reloadInterval){let e=setInterval(()=>this.reload(),this.options.reloadInterval);typeof e==`object`&&typeof e.unref==`function`&&e.unref()}}readMulti(e,t,n){this._readAny(e,e,t,t,n)}read(e,t,n){this._readAny([e],e,[t],t,n)}_readAny(e,t,n,r,i){let a=this.options.loadPath;typeof this.options.loadPath==`function`&&(a=this.options.loadPath(e,n)),a=xc(a),a.then(a=>{if(!a)return i(null,{});let o=Cc(a,{lng:e.join(`+`),ns:n.join(`+`)});if(o==null){let t=e.map(_c).join(`, `),r=n.map(_c).join(`, `);return i(Error(`i18next-http-backend: unsafe lng/ns value — refusing to build request URL for languages=[`+t+`] namespaces=[`+r+`]`),!1)}this.loadUrl(o,i,t,r)})}loadUrl(e,t,n,r){let i=typeof n==`string`?[n]:n,a=typeof r==`string`?[r]:r,o=this.options.parseLoadPayload(i,a),s=_c(vc(e));this.options.request(this.options,e,o,(e,i)=>{if(i&&(i.status>=500&&i.status<600||!i.status))return t(`failed loading `+s+`; status code: `+i.status,!0);if(i&&i.status>=400&&i.status<500)return t(`failed loading `+s+`; status code: `+i.status,!1);if(!i&&e&&e.message){let n=e.message.toLowerCase();if([`failed`,`fetch`,`network`,`load`].find(e=>n.indexOf(e)>-1))return t(`failed loading `+s+`: `+_c(e.message),!0)}if(e)return t(e,!1);let a,o;try{a=typeof i.data==`string`?this.options.parse(i.data,n,r):i.data}catch{o=`failed parsing `+s+` to json`}if(o)return t(o,!1);t(null,a)})}create(e,t,n,r,i){if(!this.options.addPath)return;typeof e==`string`&&(e=[e]);let a=this.options.parsePayload(t,n,r),o=0,s=[],c=[];e.forEach(n=>{let r=this.options.addPath;typeof this.options.addPath==`function`&&(r=this.options.addPath(n,t));let l=Cc(r,{lng:n,ns:t});if(l==null){o+=1,i&&o===e.length&&i(s,c);return}this.options.request(this.options,l,a,(t,n)=>{o+=1,s.push(t),c.push(n),o===e.length&&typeof i==`function`&&i(s,c)})})}reload(){let{backendConnector:e,languageUtils:t,logger:n}=this.services,r=e.language;if(r&&r.toLowerCase()===`cimode`)return;let i=[],a=e=>{t.toResolveHierarchy(e).forEach(e=>{i.indexOf(e)<0&&i.push(e)})};a(r),this.allOptions.preload&&this.allOptions.preload.forEach(e=>a(e)),i.forEach(t=>{this.allOptions.ns.forEach(r=>{e.read(t,r,`read`,null,null,(i,a)=>{i&&n.warn(`loading namespace ${r} for language ${t} failed`,i),!i&&a&&n.log(`loaded namespace ${r} for language ${t}`,a),e.loaded(`${t}|${r}`,i,a)})})})}};Fc.type=`backend`;function Ic(e,t,n){return(t=$s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Lc(Object(n),!0).forEach(function(t){Ic(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zc=function(){function e(t){Xs(this,e),this.store=t.store}return tc(e,[{key:`setItem`,value:function(e,t){if(this.store)try{this.store.setItem(e,t)}catch{}}},{key:`getItem`,value:function(e,t){if(this.store)try{return this.store.getItem(e,t)}catch{}}}])}();function Bc(){var e=null;try{e=window.localStorage}catch(e){typeof window<`u`&&console.log(`Failed to load local storage.`,e)}return{prefix:`i18next_res_`,expirationTime:6048e5,defaultVersion:void 0,getVersion:void 0,versions:{},store:e}}var Vc=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Xs(this,e),this.init(t,n),this.type=`backend`}return tc(e,[{key:`init`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.services=e,this.options=Rc(Rc(Rc({},Bc()),this.options),t),this.storage=new zc(this.options)}},{key:`read`,value:function(e,t,n){var r=Date.now();if(!this.storage.store)return n(null,null);var i=this.storage.getItem(`${this.options.prefix}${e}-${t}`);if(i)try{i=JSON.parse(i)}catch{i=null}if(i&&Zs(i)===`object`){var a=this.getVersion(e,t);if(i.i18nStamp&&i.i18nStamp+this.options.expirationTime>r&&a===i.i18nVersion){var o=i.i18nStamp;return delete i.i18nVersion,delete i.i18nStamp,n(null,i,o)}}return n(null,null)}},{key:`save`,value:function(e,t,n){if(this.storage.store){var r=Rc(Rc({},n),{},{i18nStamp:Date.now()}),i=this.getVersion(e,t);i&&(r.i18nVersion=i),this.storage.setItem(`${this.options.prefix}${e}-${t}`,JSON.stringify(r))}}},{key:`getVersion`,value:function(e,t){var n=this.options,r=n.getVersion,i=n.versions,a=n.defaultVersion,o=Object.prototype.hasOwnProperty.call(i,e)?i[e]:void 0;return r?.(e,t)||o||a}}])}();Vc.type=`backend`;var Hc={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,"!doctype":!0,"!DOCTYPE":!0},Uc=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?("[^"]*"|'[^']*')/g;function Wc(e){let t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(Hc[n[1]]||e.charAt(e.length-2)===`/`)&&(t.voidElement=!0),t.name.startsWith(`!--`))){let t=e.indexOf(`-->`);return{type:`comment`,comment:t===-1?``:e.slice(4,t)}}let r=new RegExp(Uc),i=null;for(;i=r.exec(e),i!==null;)if(i[0].trim()){if(i[1]){let e=i[1].trim(),n=[e,null],a=e.indexOf(`=`);a>-1&&(n=[e.slice(0,a),e.slice(a+1)]),t.attrs[n[0]]=n[1],r.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1))}return t}var Gc=/<!--[\s\S]*?-->|<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Kc=/<\/?([^\s]+?)[/\s>]/,qc=/^\s*$/,Jc=/^(script|style)$/i,Yc=`\0`,Xc=Object.create(null);function Zc(e){e.forEach(function(e){if(e.type===`text`){e.content=e.content.split(Yc).join(`<`);return}if(e.type===`comment`){e.comment=e.comment.split(Yc).join(`<`);return}for(let t in e.attrs){let n=e.attrs[t];typeof n==`string`&&n.indexOf(Yc)>-1&&(e.attrs[t]=n.split(Yc).join(`<`))}e.children.length&&Zc(e.children)})}function Qc(e,t){let n=t&&t.components||Xc,r=t&&t.allowedTags,i=!1;if(r){let t=typeof r==`function`?r:function(e){return r.indexOf(e)>-1},n=``,a=0;Gc.lastIndex=0;let o;for(;o=Gc.exec(e);){let r=o[0];n+=e.slice(a,o.index);let s=r.match(Kc);r.startsWith(`<!--`)||s&&t(s[1])?(n+=r,a=o.index+r.length):(i=!0,n+=Yc,a=o.index+1,Gc.lastIndex=a)}e=n+e.slice(a)}let a=[],o=[],s,c=-1,l=!1,u=0,d;if(e.indexOf(`<`)!==0){let t=e.indexOf(`<`);a.push({type:`text`,content:t===-1?e:e.substring(0,t)})}let f=[],p;for(;p=Gc.exec(e);)f.push(p);return f.forEach(function(e,t){let n=e[0];if(!n||n.startsWith(`<!--`))return;let r=0,i=0,a=-1,o=null;for(let e=0;e<n.length;e++){let t=n.charAt(e);o?t===o&&(o=null):t===`"`||t===`'`?o=t:t===`<`?(r++,r===2&&(a=e)):t===`>`&&i++}let s=a>-1&&/[a-zA-Z0-9\-!/]/.test(n.charAt(a+1));if(r>i&&s){let e=n.substring(0,a),r=n.substring(e.length);f[t][0]=r,f[t].index+=e.length}}),f.forEach(function(t,r){let i=t[0];if(!i)return;let p=t.index;if(p<u)return;if(l){if(i!==`</`+s.name+`>`)return;l=!1}let m=i.charAt(1)!==`/`,h=i.startsWith(`<!--`),g=p+i.length,_=e.charAt(g),v=f[r+1],y;if(_===`<`&&v){let t=e.substring(g,v.index);y=t.split(`<`).length>t.split(`>`).length}let b;if(h){let t=Wc(i);if(c<0)return a.push(t),a;b=o[c],b.children.push(t);let n=e.slice(g,v?v.index:void 0);return n.length>0&&b.children.push({type:`text`,content:n}),a}if(m){c++,s=Wc(i),s.type===`tag`&&n[s.name]&&(s.type=`component`,l=!0);let t=!1;if(!l&&!s.voidElement&&Jc.test(s.name)){t=!0,d||=e.toLowerCase();let n=d.indexOf(`</`+s.name.toLowerCase()+`>`,g),r=n===-1?e.length:n,i=e.slice(g,r);i&&s.children.push({type:`text`,content:i}),u=r}!s.voidElement&&!l&&!t&&_&&_!==`<`&&s.children.push({type:`text`,content:e.slice(g,v?v.index:void 0)}),c===0&&a.push(s),b=o[c-1],b&&b.children.push(s),o[c]=s}if((!m||s.voidElement)&&(c>-1&&(s.voidElement||s.name===i.slice(2,-1))&&(c--,s=c===-1?a:o[c]),!l&&(_!==`<`||y)&&_)){b=c===-1?a:o[c].children;let t=v?v.index:-1,n=e.slice(g,t===-1?void 0:t);qc.test(n)&&(n=` `),(t>-1&&c+b.length>=0||n!==` `)&&b.push({type:`text`,content:n})}}),i&&Zc(a),a}function $c(e){let t=[];for(let n in e)e[n]===null?t.push(n):t.push(n+`="`+String(e[n]).replace(/"/g,`"`)+`"`);return t.length?` `+t.join(` `):``}function el(e,t){switch(t.type){case`text`:return e+t.content;case`tag`:{let n=t.voidElement&&t.name.toLowerCase()!==`!doctype`?`/>`:`>`;return e+=`<`+t.name+(t.attrs?$c(t.attrs):``)+n,t.voidElement?e:e+t.children.reduce(el,``)+`</`+t.name+`>`}case`comment`:return e+=`<!--`+t.comment+`-->`,e}}function tl(e){return e.reduce(function(e,t){return e+el(``,t)},``)}var nl={parse:Qc,stringify:tl},rl=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);ol(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},il={},al=(e,t,n,r)=>{ol(n)&&il[n]||(ol(n)&&(il[n]=new Date),rl(e,t,n,r))},ol=e=>typeof e==`string`,sl=e=>typeof e==`object`&&!!e,cl=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,ll={"&":`&`,"&":`&`,"<":`<`,"<":`<`,">":`>`,">":`>`,"'":`'`,"'":`'`,""":`"`,""":`"`," ":` `," ":` `,"©":`©`,"©":`©`,"®":`®`,"®":`®`,"…":`…`,"…":`…`,"/":`/`,"/":`/`},ul=e=>ll[e],dl=e=>e.replace(cl,ul),fl={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:dl,transDefaultProps:void 0},pl=(e={})=>{fl={...fl,...e}},ml=()=>fl,hl,gl=e=>{hl=e},_l=()=>hl,vl=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},yl=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?xl(t):t},bl=t=>Array.isArray(t)&&t.every(e.isValidElement),xl=e=>Array.isArray(e)?e:[e],Sl=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},Cl=t=>{let n={};if(!t)return n;let r=t=>{xl(t).forEach(t=>{ol(t)||(vl(t)?r(yl(t)):sl(t)&&!(0,e.isValidElement)(t)&&Object.assign(n,t))})};return r(t),n},wl=(t,n,r,i)=>{if(!t)return``;let a=``,o=xl(t),s=n?.transSupportBasicHtmlNodes?n.transKeepBasicHtmlNodesFor??[]:[];return o.forEach((t,o)=>{if(ol(t)){a+=`${t}`;return}if((0,e.isValidElement)(t)){let{props:e,type:c}=t,l=Object.keys(e).length,u=s.indexOf(c)>-1,d=e.children;if(!d&&u&&!l){a+=`<${c}/>`;return}if(!d&&(!u||l)||e.i18nIsDynamicList){a+=`<${o}></${o}>`;return}if(u&&l<=1){let e=ol(d)?d:wl(d,n,r,i);a+=`<${c}>${e}</${c}>`;return}let f=wl(d,n,r,i);a+=`<${o}>${f}</${o}>`;return}if(t===null){rl(r,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:i});return}if(sl(t)){let{format:e,...n}=t,o=Object.keys(n);if(o.length===1){let t=e?`${o[0]}, ${e}`:o[0];a+=`{{${t}}}`;return}rl(r,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:i,child:t});return}rl(r,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:i,child:t})}),a},Tl=(t,n,r,i,a,o,s)=>{if(r===``)return[];let c=a.transKeepBasicHtmlNodesFor||[],l=r&&new RegExp(c.map(e=>`<${e}`).join(`|`)).test(r);if(!t&&!n&&!l&&!s)return[r];let u=n??{},d=t=>{xl(t).forEach(t=>{ol(t)||(vl(t)?d(yl(t)):sl(t)&&!(0,e.isValidElement)(t)&&Object.assign(u,t))})};d(t);let f=Object.keys(u),p=nl.parse(`<0>${r}</0>`,{allowedTags:e=>/^\d+$/.test(e)||c.indexOf(e)>-1||f.indexOf(e)>-1}),m={...u,...o},h=(e,t,n)=>{let r=yl(e),i=_(r,t.children,n);return bl(r)&&i.length===0||e.props?.i18nIsDynamicList?r:i},g=(t,n,r,i,a)=>{t.dummy?(t.children=n,r.push((0,e.cloneElement)(t,{key:i},a?void 0:n))):r.push(...e.Children.map([t],t=>{if(t.type===e.Fragment||t.props?.i18nIsDynamicList!==void 0){let r={key:i};return t&&t.props&&Object.keys(t.props).forEach(e=>{e!==`children`&&e!==`i18nIsDynamicList`&&(r[e]=t.props[e])}),(0,e.createElement)(t.type,r,a?null:n)}let r={key:i};return t&&t.props&&Object.keys(t.props).forEach(e=>{e!==`ref`&&e!==`children`&&(r[e]=t.props[e])}),(0,e.cloneElement)(t,r,a?null:n)}))},_=(t,r,o)=>{let u=xl(t),d=xl(r),f={};return d.reduce((t,r,d)=>{let p=r.children?.[0]?.content&&i.services.interpolator.interpolate(r.children[0].content,m,i.language);if(r.type===`tag`){let v=u[parseInt(r.name,10)];!v&&n&&(v=n[r.name]),o.length===1&&!v&&(v=o[0][r.name]),v||={};let y={...r.attrs};s&&Object.keys(y).forEach(e=>{let t=y[e];ol(t)&&(y[e]=dl(t))});let b=Object.keys(y).length===0?v:Sl({props:y},v),x=(0,e.isValidElement)(b),S=x&&vl(r,!0)&&!r.voidElement,C=l&&sl(b)&&b.dummy&&!x,w=sl(n)&&Object.hasOwnProperty.call(n,r.name);if(ol(b)){let e=i.services.interpolator.interpolate(b,m,i.language);t.push(e)}else if(vl(b)||S){let e=h(b,r,o);g(b,e,t,d)}else if(C){let e=_(u,r.children,o);g(b,e,t,d)}else if(Number.isNaN(parseFloat(r.name))){if(w){let e=h(b,r,o);g(b,e,t,d,r.voidElement)}else if(a.transSupportBasicHtmlNodes&&c.indexOf(r.name)>-1){if(r.voidElement)t.push((0,e.createElement)(r.name,{key:`${r.name}-${d}`}));else{let n=f[r.name]||0;f[r.name]=n+1;let i,a=0;for(let t=0;t<u.length;t+=1){let o=u[t];if((0,e.isValidElement)(o)&&o.type===r.name){if(a===n){i=o;break}a+=1}}let s=i?xl(yl(i)):u,c=_(s,r.children,o);t.push((0,e.createElement)(r.name,{key:`${r.name}-${d}`},c))}}else if(r.voidElement)t.push(`<${r.name} />`);else{let e=_(u,r.children,o);t.push(`<${r.name}>${e}</${r.name}>`)}}else if(sl(b)&&!x){let e=r.children[0]?p:null;e&&t.push(e)}else g(b,p,t,d,r.children.length!==1||!p)}else if(r.type===`text`){let n=a.transWrapTextNodes,o=typeof a.unescape==`function`?a.unescape:ml().unescape,c=s?o(i.services.interpolator.interpolate(r.content,m,i.language)):i.services.interpolator.interpolate(r.content,m,i.language);n?t.push((0,e.createElement)(n,{key:`${r.name}-${d}`},c)):t.push(c)}return t},[])};return yl(_([{dummy:!0,children:t||[]}],p,xl(t||[]))[0])},El=(t,n,r)=>{let i=t.key||n,a=(0,e.cloneElement)(t,{key:i});if(!a.props||!a.props.children||r.indexOf(`${n}/>`)<0&&r.indexOf(`${n} />`)<0)return a;function o(){return(0,e.createElement)(e.Fragment,null,a)}return(0,e.createElement)(o,{key:i})},Dl=(e,t)=>e.map((e,n)=>El(e,n,t)),Ol=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:El(e[r],r,t)})}),n},kl=(e,t,n,r)=>e?Array.isArray(e)?Dl(e,t):sl(e)?Ol(e,t):(al(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,Al=e=>!sl(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function jl({children:t,count:n,parent:r,i18nKey:i,context:a,tOptions:o={},values:s,defaults:c,components:l,ns:u,i18n:d,t:f,shouldUnescape:p,...m}){let h=d||_l();if(!h)return al(h,`NO_I18NEXT_INSTANCE`,`Trans: You need to pass in an i18next instance using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`,{i18nKey:i}),t;let g=f||h.t.bind(h)||(e=>e),_={...ml(),...h.options?.react},v=u||g.ns||h.options?.defaultNS;v=ol(v)?[v]:v||[`translation`];let{transDefaultProps:y}=_,b=y?.tOptions?{...y.tOptions,...o}:o,x=p??y?.shouldUnescape,S=y?.values?{...y.values,...s}:s,C=y?.components?{...y.components,...l}:l,w=wl(t,_,h,i),T=c||b?.defaultValue||w||_.transEmptyNodeValue||(typeof i==`function`?As(i):i),{hashTransKey:E}=_,D=i||(E?E(w||T):w||T);s=h.options?.interpolation?.defaultVariables?S&&Object.keys(S).length>0?{...S,...h.options.interpolation.defaultVariables}:{...h.options.interpolation.defaultVariables}:S;let O=Cl(t);O&&typeof O.count==`number`&&n===void 0&&(n=O.count);let k=s||n!==void 0&&!h.options?.interpolation?.alwaysFormat||!t?b.interpolation:{interpolation:{...b.interpolation,prefix:`#$?`,suffix:`?$#`}},A={...b,context:a||b.context,count:n,...s,...k,defaultValue:T,ns:v},j=D?g(D,A):T;j===D&&T&&(j=T);let M=kl(C,j,h,i),N=M||t,ee=null;Al(M)&&(ee=M,N=t);let te=Tl(N,ee,j,h,_,A,x),P=r??_.defaultTransParent;return P?(0,e.createElement)(P,m,te):te}var Ml={type:`3rdParty`,init(e){pl(e.options.react),gl(e)}},Nl=(0,e.createContext)();function Pl({children:t,count:n,parent:r,i18nKey:i,context:a,tOptions:o={},values:s,defaults:c,components:l,ns:u,i18n:d,t:f,shouldUnescape:p,...m}){let{i18n:h,defaultNS:g}=(0,e.useContext)(Nl)||{},_=d||h||_l(),v=f||_?.t.bind(_);return jl({children:t,count:n,parent:r,i18nKey:i,context:a,tOptions:o,values:s,defaults:c,components:l,ns:u||v?.ns||g||_?.options?.defaultNS,i18n:_,t:f,shouldUnescape:p,...m})}var Fl={af:{name:`Afrikaans`,nativeName:`Afrikaans`,code:`af`,locale:`af`},ak:{name:`Akan`,nativeName:`Akan`,code:`ak`,locale:`ak`},sq:{name:`Albanian`,nativeName:`Shqip`,code:`sq`,locale:`sq`},arq:{name:`Algerian Arabic`,nativeName:`الدارجة الجزايرية`,code:`arq`,locale:`ar_DZ`},am:{name:`Amharic`,nativeName:`አማርኛ`,code:`am`,locale:`am`},ar:{name:`Arabic`,nativeName:`العربية`,code:`ar`,locale:`ar`},hy:{name:`Armenian`,nativeName:`Հայերեն`,code:`hy`,locale:`hy`},frp:{name:`Arpitan`,nativeName:`Arpitan`,code:`frp`,locale:`frp`},as:{name:`Assamese`,nativeName:`অসমীয়া`,code:`as`,locale:`as`},az:{name:`Azerbaijani`,nativeName:`Azərbaycan dili`,code:`az`,locale:`az`},ba:{name:`Bashkir`,nativeName:`башҡорт теле`,code:`ba`,locale:`ba`},eu:{name:`Basque`,nativeName:`Euskara`,code:`eu`,locale:`eu`},be:{name:`Belarusian`,nativeName:`Беларуская мова`,code:`be`,locale:`be`,alternatives:[`bel`]},bn:{name:`Bengali`,nativeName:`বাংলা`,code:`bn`,locale:`bn_BD`},bs:{name:`Bosnian`,nativeName:`Bosanski`,code:`bs`,locale:`bs_BA`},br:{name:`Breton`,nativeName:`Brezhoneg`,code:`br`,locale:`br`,alternatives:[`bre`]},bg:{name:`Bulgarian`,nativeName:`Български`,code:`bg`,locale:`bg_BG`},ca:{name:`Catalan`,nativeName:`Català`,code:`ca`,locale:`ca_ES`},ceb:{name:`Cebuano`,nativeName:`Cebuano`,code:`ceb`,locale:`ceb`},"zh-cn":{name:`Chinese (China)`,nativeName:`简体中文`,code:`zh-cn`,locale:`zh_CN`},"zh-hk":{name:`Chinese (Hong Kong)`,nativeName:`繁體中文(香港)`,code:`zh-hk`,locale:`zh_HK`},"zh-tw":{name:`Chinese (Taiwan)`,nativeName:`繁體中文(台灣)`,code:`zh-tw`,locale:`zh_TW`},co:{name:`Corsican`,nativeName:`Corsu`,code:`co`,locale:`co`},hr:{name:`Croatian`,nativeName:`Hrvatski`,code:`hr`,locale:`hr`},cs:{name:`Czech`,nativeName:`Čeština`,code:`cs`,locale:`cs_CZ`},da:{name:`Danish`,nativeName:`Dansk`,code:`da`,locale:`da_DK`},dv:{name:`Divehi`,nativeName:`ދިވެހި`,code:`dv`,locale:`dv`},nl:{name:`Dutch`,nativeName:`Nederlands`,code:`nl`,locale:`nl_NL`},"nl-be":{name:`Dutch (Belgium)`,nativeName:`Nederlands (België)`,code:`nl-be`,locale:`nl_BE`},"en-au":{name:`English (Australia)`,nativeName:`English (Australia)`,code:`en-au`,locale:`en_AU`},"en-ca":{name:`English (Canada)`,nativeName:`English (Canada)`,code:`en-ca`,locale:`en_CA`},"en-nz":{name:`English (New Zealand)`,nativeName:`English (New Zealand)`,code:`en-nz`,locale:`en_NZ`},"en-za":{name:`English (South Africa)`,nativeName:`English (South Africa)`,code:`en-za`,locale:`en_ZA`},"en-gb":{name:`English (UK)`,nativeName:`English (UK)`,code:`en-gb`,locale:`en_GB`},en:{name:`English (US)`,nativeName:`English (US)`,code:`en`,locale:`en_US`},eo:{name:`Esperanto`,nativeName:`Esperanto`,code:`eo`,locale:`eo`},et:{name:`Estonian`,nativeName:`Eesti`,code:`et`,locale:`et`},fo:{name:`Faroese`,nativeName:`Føroyskt`,code:`fo`,locale:`fo`},fi:{name:`Finnish`,nativeName:`Suomi`,code:`fi`,locale:`fi`},"fr-be":{name:`French (Belgium)`,nativeName:`Français (Belgique)`,code:`fr-be`,locale:`fr_BE`},"fr-ca":{name:`French (Canada)`,nativeName:`Français (Canada)`,code:`fr-ca`,locale:`fr_CA`},fr:{name:`French`,nativeName:`Français`,code:`fr`,locale:`fr_FR`},fy:{name:`Frisian`,nativeName:`Frysk`,code:`fy`,locale:`fy`},fur:{name:`Friulian`,nativeName:`Friulian`,code:`fur`,locale:`fur`},ff:{name:`Fulah`,nativeName:`Pulaar`,code:`ff`,locale:`ff`,alternatives:[`fuc`]},gl:{name:`Galician`,nativeName:`Galego`,code:`gl`,locale:`gl_ES`},ka:{name:`Georgian`,nativeName:`ქართული`,code:`ka`,locale:`ka_GE`},de:{name:`German`,nativeName:`Deutsch`,code:`de`,locale:`de_DE`},"de-ch":{name:`German (Switzerland)`,nativeName:`Deutsch (Schweiz)`,code:`de-ch`,locale:`de_CH`},el:{name:`Greek`,nativeName:`Ελληνικά`,code:`el`,locale:`el`},kl:{name:`Greenlandic`,nativeName:`Kalaallisut`,code:`kl`,locale:`kl`,alternatives:[`kal`]},gu:{name:`Gujarati`,nativeName:`ગુજરાતી`,code:`gu`,locale:`gu`},haw:{name:`Hawaiian`,nativeName:`ʻŌlelo Hawaiʻi`,code:`haw`,locale:`haw`},he:{name:`Hebrew`,nativeName:`עברית`,code:`he`,locale:`he_IL`},hi:{name:`Hindi`,nativeName:`हिन्दी`,code:`hi`,locale:`hi_IN`},hu:{name:`Hungarian`,nativeName:`Magyar`,code:`hu`,locale:`hu_HU`},is:{name:`Icelandic`,nativeName:`Íslenska`,code:`is`,locale:`is_IS`},ido:{name:`Ido`,nativeName:`Ido`,code:`ido`,locale:`ido`},id:{name:`Indonesian`,nativeName:`Bahasa Indonesia`,code:`id`,locale:`id_ID`},ga:{name:`Irish`,nativeName:`Gaeilge`,code:`ga`,locale:`ga`},it:{name:`Italian`,nativeName:`Italiano`,code:`it`,locale:`it_IT`},ja:{name:`Japanese`,nativeName:`日本語`,code:`ja`,locale:`ja`},jv:{name:`Javanese`,nativeName:`Basa Jawa`,code:`jv`,locale:`jv`},kab:{name:`Kabyle`,nativeName:`Taqbaylit`,code:`kab`,locale:`kab`},kn:{name:`Kannada`,nativeName:`ಕನ್ನಡ`,code:`kn`,locale:`kn`},kk:{name:`Kazakh`,nativeName:`Қазақ тілі`,code:`kk`,locale:`kk`},km:{name:`Khmer`,nativeName:`ភាសាខ្មែរ`,code:`km`,locale:`km`},rw:{name:`Kinyarwanda`,nativeName:`Ikinyarwanda`,code:`rw`,locale:`rw`,alternatives:[`kin`]},ky:{name:`Kirghiz`,nativeName:`кыргыз тили`,code:`ky`,locale:`ky`},ko:{name:`Korean`,nativeName:`한국어`,code:`ko`,locale:`ko_KR`},ckb:{name:`Kurdish (Sorani)`,nativeName:`کوردی`,code:`ckb`,locale:`ckb`},lo:{name:`Lao`,nativeName:`ພາສາລາວ`,code:`lo`,locale:`lo`},lv:{name:`Latvian`,nativeName:`Latviešu valoda`,code:`lv`,locale:`lv`},li:{name:`Limburgish`,nativeName:`Limburgs`,code:`li`,locale:`li`},ln:{name:`Lingala`,nativeName:`Ngala`,code:`ln`,locale:`ln`,alternatives:[`lin`]},lt:{name:`Lithuanian`,nativeName:`Lietuvių kalba`,code:`lt`,locale:`lt_LT`},lb:{name:`Luxembourgish`,nativeName:`Lëtzebuergesch`,code:`lb`,locale:`lb`},mk:{name:`Macedonian`,nativeName:`Македонски јазик`,code:`mk`,locale:`mk_MK`},mg:{name:`Malagasy`,nativeName:`Malagasy`,code:`mg`,locale:`mg`},ms:{name:`Malay`,nativeName:`Bahasa Melayu`,code:`ms`,locale:`ms_MY`},ml:{name:`Malayalam`,nativeName:`മലയാളം`,code:`ml`,locale:`ml_IN`},mi:{name:`Maori`,nativeName:`Te Reo Māori`,code:`mi`,locale:`mi`,alternatives:[`mri`]},mr:{name:`Marathi`,nativeName:`मराठी`,code:`mr`,locale:`mr`},mn:{name:`Mongolian`,nativeName:`Монгол`,code:`mn`,locale:`mn`},me:{name:`Montenegrin`,nativeName:`Crnogorski`,code:`me`,locale:`crn`},ary:{name:`Moroccan Arabic`,nativeName:`العربية المغربية`,code:`ary`,locale:`ary`},my:{name:`Myanmar (Burmese)`,nativeName:`ဗမာစာ`,code:`my`,locale:`my_MM`},ne:{name:`Nepali`,nativeName:`नेपाली`,code:`ne`,locale:`ne_NP`},nb:{name:`Norwegian Bokmål`,nativeName:`Norsk bokmål`,code:`nb`,locale:`nb_NO`},nn:{name:`Norwegian Nynorsk`,nativeName:`Norsk nynorsk`,code:`nn`,locale:`nn_NO`},oc:{name:`Occitan`,nativeName:`Occitan`,code:`oc`,locale:`oc`,alternatives:[`oci`]},ps:{name:`Pashto`,nativeName:`پښتو`,code:`ps`,locale:`ps`},fa:{name:`Persian`,nativeName:`فارسی`,code:`fa`,locale:`fa_IR`},"fa-af":{name:`Persian (Afghanistan)`,nativeName:`فارسی (افغانستان)`,code:`fa-af`,locale:`fa_AF`},pl:{name:`Polish`,nativeName:`Polski`,code:`pl`,locale:`pl_PL`},"pt-br":{name:`Portuguese (Brazil)`,nativeName:`Português do Brasil`,code:`pt-br`,locale:`pt_BR`},pt:{name:`Portuguese (Portugal)`,nativeName:`Português`,code:`pt`,locale:`pt_PT`},pa:{name:`Punjabi`,nativeName:`ਪੰਜਾਬੀ`,code:`pa`,locale:`pa_IN`},ro:{name:`Romanian`,nativeName:`Română`,code:`ro`,locale:`ro_RO`},rm:{name:`Romansh`,nativeName:`Rumantsch`,code:`rm`,locale:`rm`,alternatives:[`roh`]},ru:{name:`Russian`,nativeName:`Русский`,code:`ru`,locale:`ru_RU`},rue:{name:`Rusyn`,nativeName:`Русиньскый`,code:`rue`,locale:`rue`},sah:{name:`Sakha`,nativeName:`Сахалыы`,code:`sah`,locale:`sah`},sa:{name:`Sanskrit`,nativeName:`संस्कृत`,code:`sa`,locale:`sa_IN`},sc:{name:`Sardinian`,nativeName:`Sardu`,code:`sc`,locale:`sc`,alternatives:[`srd`]},gd:{name:`Scottish Gaelic`,nativeName:`Gàidhlig`,code:`gd`,locale:`gd`},sr:{name:`Serbian`,nativeName:`Српски`,code:`sr`,locale:`sr_RS`},szl:{name:`Silesian`,nativeName:`Ślōnskŏ gŏdka`,code:`szl`,locale:`szl`},sd:{name:`Sindhi`,nativeName:`سنڌي`,code:`sd`,locale:`sd`,alternatives:[`snd`]},si:{name:`Sinhala`,nativeName:`සිංහල`,code:`si`,locale:`si_LK`},sk:{name:`Slovak`,nativeName:`Slovenčina`,code:`sk`,locale:`sk_SK`},sl:{name:`Slovenian`,nativeName:`Slovenščina`,code:`sl`,locale:`sl_SI`},so:{name:`Somali`,nativeName:`Afsoomaali`,code:`so`,locale:`so`},"es-ar":{name:`Spanish (Argentina)`,nativeName:`Español de Argentina`,code:`es-ar`,locale:`es_AR`},"es-cl":{name:`Spanish (Chile)`,nativeName:`Español de Chile`,code:`es-cl`,locale:`es_CL`},"es-co":{name:`Spanish (Colombia)`,nativeName:`Español de Colombia`,code:`es-co`,locale:`es_CO`},"es-mx":{name:`Spanish (Mexico)`,nativeName:`Español de México`,code:`es-mx`,locale:`es_MX`},"es-pe":{name:`Spanish (Peru)`,nativeName:`Español de Perú`,code:`es-pe`,locale:`es_PE`},"es-pr":{name:`Spanish (Puerto Rico)`,nativeName:`Español de Puerto Rico`,code:`es-pr`,locale:`es_PR`},es:{name:`Spanish (Spain)`,nativeName:`Español`,code:`es`,locale:`es_ES`},"es-ve":{name:`Spanish (Venezuela)`,nativeName:`Español de Venezuela`,code:`es-ve`,locale:`es_VE`},su:{name:`Sundanese`,nativeName:`Basa Sunda`,code:`su`,locale:`su`},sw:{name:`Swahili`,nativeName:`Kiswahili`,code:`sw`,locale:`sw`},sv:{name:`Swedish`,nativeName:`Svenska`,code:`sv`,locale:`sv_SE`},gsw:{name:`Swiss German`,native:`Schwyzerdütsch`,code:`gsw`,locale:`gsw`},tl:{name:`Tagalog`,nativeName:`Tagalog`,code:`tl`,locale:`tl`},tg:{name:`Tajik`,nativeName:`Тоҷикӣ`,code:`tg`,locale:`tg`},tzm:{name:`Tamazight (Central Atlas)`,nativeName:`ⵜⴰⵎⴰⵣⵉⵖⵜ`,code:`tzm`,locale:`tzm`},ta:{name:`Tamil`,nativeName:`தமிழ்`,code:`ta`,locale:`ta_IN`},"ta-lk":{name:`Tamil (Sri Lanka)`,nativeName:`தமிழ்`,code:`ta-lk`,locale:`ta_LK`},tt:{name:`Tatar`,nativeName:`Татар теле`,code:`tt`,locale:`tt`},te:{name:`Telugu`,nativeName:`తెలుగు`,code:`te`,locale:`te`},th:{name:`Thai`,nativeName:`ไทย`,code:`th`,locale:`th`},bo:{name:`Tibetan`,nativeName:`བོད་སྐད`,code:`bo`,locale:`bo`},ti:{name:`Tigrinya`,nativeName:`ትግርኛ`,code:`ti`,locale:`ti`,alternatives:[`tir`]},tr:{name:`Turkish`,nativeName:`Türkçe`,code:`tr`,locale:`tr_TR`},tk:{name:`Turkmen`,nativeName:`Türkmençe`,code:`tk`,locale:`tk`,alternatives:[`tuk`]},twd:{name:`Tweants`,nativeName:`Twents`,code:`twd`,locale:`twd`},uk:{name:`Ukrainian`,nativeName:`Українська`,code:`uk`,locale:`uk`},ur:{name:`Urdu`,nativeName:`اردو`,code:`ur`,locale:`ur`},uz:{name:`Uzbek`,nativeName:`O‘zbekcha`,code:`uz`,locale:`uz`},vi:{name:`Vietnamese`,nativeName:`Tiếng Việt`,code:`vi`,locale:`vi`},wa:{name:`Walloon`,nativeName:`Walon`,code:`wa`,locale:`wa`},cy:{name:`Welsh`,nativeName:`Cymraeg`,code:`cy`,locale:`cy`},yo:{name:`Yoruba`,nativeName:`Yorùbá`,code:`yo`,locale:`yo`,alternatives:[`yor`]}};function Il(){let e=document.documentElement.getAttribute(`lang`)||`en`;return(Fl[e.toLowerCase()]||Fl[e.split(`-`)[0]]||Fl.en)?.locale||`en_US`}function Ll(){return window.wcpos?.translationVersion||`0.1.0`}function Rl({namespace:t,project:n,resources:r}){let i=Q.createInstance(),a=Il(),o=Ll(),s={lng:a,fallbackLng:`en`,ns:[t],defaultNS:t,keySeparator:!1,nsSeparator:!1,interpolation:{escapeValue:!1,prefix:`{`,suffix:`}`},backend:{backends:[Vc,Fc],backendOptions:[{prefix:`wcpos_i18n_`,expirationTime:6048e5,defaultVersion:o},{loadPath:(e,t)=>`https://cdn.jsdelivr.net/gh/wcpos/translations@${o}/translations/js/${e[0]}/${n}/${t[0]}.json`}]}};return r&&(s.resources=r,s.partialBundledLanguages=!0),{i18n:i,i18nPromise:i.use(uc).use(Ml).init(s).then(()=>i),t:i.t.bind(i),Trans:n=>(0,e.createElement)(Pl,{...n,i18n:i,ns:t})}}var{i18n:zl,i18nPromise:Bl,t:$,Trans:Vl}=Rl({namespace:`wp-admin-settings`,project:`woocommerce-pos`,resources:{en:{"wp-admin-settings":{"common.access":`Access`,"common.account":`Account`,"common.all":`All`,"common.cancel":`Cancel`,"common.checkout":`Checkout`,"common.cloud_print":`Cloud Print`,"common.created":`Created`,"common.default":`Default`,"common.description":`Description`,"common.dismiss":`Dismiss`,"common.documentation":`Documentation`,"common.enabled":`Enabled`,"common.expires":`Expires`,"common.extensions":`Extensions`,"common.faq":`Frequently Asked Questions`,"common.gateway":`Gateway`,"common.general":`General`,"common.guest":`Guest`,"common.license":`License`,"common.loading":`Loading…`,"common.logs":`Logs`,"common.next":`Next`,"common.no_results":`No results`,"common.previous":`Previous`,"extensions.refresh":`Refresh`,"extensions.refreshing":`Refreshing...`,"extensions.refresh_failed":`Could not refresh extensions. Please try again.`,"extensions.search_placeholder":`Search extensions...`,"logs.source":`Source`,"common.pos_settings":`POS settings`,"common.save":`Save`,"common.settings":`Settings`,"common.woocommerce_settings":`WooCommerce settings`,"common.something_went_wrong":`Something went wrong`,"common.title":`Title`,"common.tools":`Tools`,"common.upgrade_to_pro":`Upgrade to WCPOS Pro`,"common.remove":`Remove`,"common.back":`Back`,"common.continue":`Continue`,"common.done":`Done`,"settings.force_ssl":`Force SSL`,"settings.force_ssl_tip":`Force POS to send server requests over HTTPS (recommended)`,"settings.pos_only_products":`Enable POS only products`,"settings.pos_only_products_tip":`Adds online and POS visibility settings to product admin`,"settings.decimal_quantities":`Enable decimal quantities`,"settings.decimal_quantities_tip":`Allows items to have decimal values in the quantity field, eg: 0.25`,"settings.generate_username":`Automatically generate username from customer email`,"settings.default_customer":`Default POS customer`,"settings.default_customer_tip":`The default customer for POS orders, eg: Guest`,"settings.use_cashier_account":`Use cashier account`,"settings.barcode_field":`Barcode Field`,"settings.barcode_field_tip":`Product meta field to be used as barcode, eg: _sku or _barcode`,"settings.barcode_field_create":`Create "{value}"`,"settings.barcode_field_no_results":`No barcode fields match`,"settings.store_details_section_title":`Store details`,"settings.store_details_section_description":`Information about your physical store, used on POS receipts and invoices. Leave a field blank to inherit the WooCommerce default shown as a placeholder.`,"settings.store_details_upgrade_callout_title":`Unlock per-store settings`,"settings.store_details_upgrade_to_pro":`Upgrade to Pro to set up one or more stores, each with their own receipt template, pricing, tax rates, and authorized users.`,"settings.store_name":`Store name`,"settings.store_phone":`Phone`,"settings.store_email":`Email`,"settings.refund_returns_policy":`Refund & Returns Policy`,"settings.refund_returns_policy_tip":`Brief statement that will appear on POS receipts.`,"settings.store_tax_ids_section_title":`Store tax IDs`,"settings.store_tax_ids_section_description":`Tax or business-register IDs to print on fiscal receipt and invoice templates.`,"settings.store_tax_ids":`Store tax IDs`,"settings.store_tax_ids_tip":`Add one or more tax or business-register IDs (VAT, EIN, ABN, etc.) to print on fiscal receipt and invoice templates.`,"settings.store_tax_ids_callout_title":`What are store tax IDs?`,"settings.store_tax_ids_learn_more":`Learn more`,"settings.store_tax_ids_add":`Add tax ID`,"settings.store_tax_ids_type":`Type`,"settings.store_tax_ids_value":`Value`,"settings.store_tax_ids_country":`Country`,"settings.store_tax_ids_country_placeholder":`Select country`,"settings.store_tax_ids_country_search":`Search countries`,"settings.store_tax_ids_country_none":`No country`,"settings.store_tax_ids_country_no_results":`No countries match`,"settings.store_tax_ids_label":`Custom label`,"settings.store_tax_ids_remove":`Remove`,"settings.store_tax_ids_empty":`No additional store tax IDs configured.`,"settings.products_section_title":`Products`,"settings.customers_section_title":`Customers`,"settings.privacy_section_title":`Privacy`,"settings.advanced_section_title":`Advanced`,"settings.restore_stock_on_delete":`Restore stock on order delete`,"settings.restore_stock_on_delete_tip":`Automatically restore product stock when POS orders are trashed or deleted`,"settings.storefront_receipt_enabled":`Let customers download receipts`,"settings.storefront_receipt_enabled_tip":`Adds a Receipt button to My Account > Orders on your online store so customers can download their order receipt as a PDF, rendered with your WCPOS receipt template.`,"settings.storefront_receipt_template":`Receipt template for customers`,"settings.storefront_receipt_template_tip":`Which receipt template customers get when downloading from My Account.`,"settings.storefront_receipt_template_active":`Use active receipt template`,"settings.storefront_receipt_template_unavailable":`Unavailable template ({value})`,"settings.need_help":`Need help?`,"settings.allow_anonymous_usage_data":`Allow anonymous usage data`,"settings.allow_anonymous_usage_data_tip":`Help us make WCPOS better by sharing some anonymous information about your setup and how you use the plugin.`,"settings.privacy_learn_more":`Learn what's collected`,"settings.privacy_modal_title":`Help us make WCPOS better`,"settings.privacy_modal_intro":`If you're happy to, WCPOS can send us some anonymous information about how the plugin is being used. It really helps us decide what to build next.`,"settings.privacy_modal_includes":`Here's what that includes:`,"settings.privacy_modal_setup_label":`Your setup`,"settings.privacy_modal_setup_desc":`things like your PHP and WooCommerce versions, your country, and your currency, so we know what environments to support.`,"settings.privacy_modal_store_label":`Your store size`,"settings.privacy_modal_store_desc":`roughly how many products, orders, and POS users you have, so we understand the kinds of stores using WCPOS.`,"settings.privacy_modal_usage_label":`How you use WCPOS`,"settings.privacy_modal_usage_desc":`which screens you open and which features you turn on, so we can focus on what people actually use.`,"settings.privacy_modal_exclusions":`We never look at customer details, order contents, prices, your site address, or anything that could identify you or your customers. You can change your mind any time.`,"settings.privacy_modal_close":`Got it`,"checkout.order_status":`Order Status`,"checkout.admin_emails":`Admin emails`,"checkout.admin_emails_tip":`WooCommerce admin notification emails for POS orders`,"checkout.customer_emails":`Customer emails`,"checkout.customer_emails_tip":`WooCommerce customer notification emails for POS orders`,"checkout.cashier_emails":`Cashier emails`,"checkout.cashier_emails_tip":`Send new order notification to the cashier who processed the POS order`,"checkout.email_new_order":`New order`,"checkout.email_cancelled_order":`Cancelled order`,"checkout.email_failed_order":`Failed order`,"checkout.email_on_hold_order":`Order on hold`,"checkout.email_processing_order":`Processing order`,"checkout.email_completed_order":`Completed order`,"checkout.email_refunded_order":`Refunded order`,"checkout.gateways":`Gateways`,"checkout.gateways_description":`Installed gateways are listed below. Drag and drop gateways to control their display order at the Point of Sale. Payment Gateways enabled here will be available at the Point of Sale.`,"checkout.gateway_id":`Gateway ID`,"checkout.enable_pro_gateways":`To enable all WooCommerce gateways please enable the Pro plugin.`,"checkout.gateway_settings_pos_only":`This will change the settings for the POS only. If you would like to change gateway settings for online and POS, please visit the <link>WooCommerce Settings</link>.`,"access.default_roles_warning":`By default, access to the POS is limited to Administrator, Shop Manager and Cashier roles. It is recommended that you <strong>do not change</strong> the default settings unless you are fully aware of the consequences.`,"access.visit_documentation":`For more information please visit the <link>documentation</link>.`,"sessions.sessions":`Sessions`,"sessions.manage_description":`Manage active user sessions. You can view all logged-in users, see their devices, and terminate sessions if needed.`,"sessions.all_users":`All Users`,"sessions.my_sessions":`My Sessions`,"sessions.loading":`Loading sessions...`,"sessions.active_sessions":`Active Sessions`,"sessions.active_users":`Active Users`,"sessions.no_active_sessions":`No active sessions found`,"sessions.current_session":`Current Session`,"sessions.terminate":`Terminate`,"sessions.logout_all":`Logout All`,"sessions.logout_other_devices":`Logout Other Devices`,"sessions.session_terminated":`Session terminated successfully`,"sessions.sessions_terminated":`Sessions terminated successfully`,"sessions.failed_terminate_session":`Failed to terminate session`,"sessions.failed_terminate_sessions":`Failed to terminate sessions`,"sessions.confirm_terminate_session":`Are you sure you want to terminate this session?`,"sessions.confirm_logout_other_devices":`Are you sure you want to logout from all other devices?`,"sessions.confirm_logout_all_devices":`Are you sure you want to logout from all devices?`,"sessions.session_count_one":`{count} session`,"sessions.session_count_other":`{count} sessions`,"sessions.just_now":`Just now`,"sessions.minutes_ago":`{minutes} minutes ago`,"sessions.hours_ago":`{hours} hours ago`,"sessions.days_ago":`{days} days ago`,"sessions.ip":`IP`,"sessions.user_agent":`User Agent`,"sessions.ios_application":`iOS Application`,"sessions.android_application":`Android Application`,"sessions.desktop_application":`Desktop Application`,"sessions.web_application":`Web Application`,"sessions.you":`You`,"sessions.active_now":`Active now`,"sessions.filter_users":`Filter users`,"sessions.no_users_match":`No users match your filter`,"sessions.no_other_users":`No other users with active sessions`,"sessions.select_user":`Select a user to view their active sessions`,"sessions.current_device":`Current device`,"sessions.created":`Created`,"sessions.last_active":`Last active`,"sessions.expires":`Expires`,"sessions.confirm_terminate_current":`This will sign you out of the current device. Continue?`,"sessions.cancel":`Cancel`,"sessions.confirm":`Confirm`,"sessions.terminate_session_title":`Terminate session?`,"sessions.terminate_all_title":`Terminate all sessions?`,"sessions.terminate_other_title":`Terminate other sessions?`,"license.support_development":`Unlock extra features and support ongoing development by upgrading to WCPOS Pro.`,"license.existing_license_prefix":`Already have a Pro license? Follow the`,"license.existing_license_link":`installation instructions`,"license.existing_license_suffix":`to download and install the Pro plugin. Once installed, you can safely remove the free version.`,"license.thank_you":`Thank You!`,"license.activated":`License <code>{number}</code> has been activated.`,"license.ongoing_support":`Your support helps fund the ongoing development of WCPOS.`,"license.deactivate":`Deactivate`,"license.license_key":`License Key`,"license.activate":`Activate`,"logs.copied":`Copied`,"logs.copy":`Copy`,"logs.copy_failed":`Copy failed`,"logs.entries_count_one":`{count} entry`,"logs.entries_count_other":`{count} entries`,"logs.errors":`Errors`,"logs.fatal_errors_detected":`Fatal errors detected`,"logs.no_entries":`No log entries found.`,"logs.today":`Today`,"logs.view_in_wc":`view in WooCommerce logs`,"logs.warnings":`Warnings`,"logs.yesterday":`Yesterday`,"tax_ids.section_title":`Tax IDs`,"tax_ids.section_intro":`WCPOS adds a tax-ID custom field to your customers and copies it onto orders at checkout. Different plugins use different names for that field — WCPOS detects what you have installed and writes to the right one automatically.`,"tax_ids.learn_more":`Learn more`,"tax_ids.banner_auto_detected":`Auto-detected`,"tax_ids.banner_no_plugin":`No plugin detected`,"tax_ids.banner_is_installed":`is installed.`,"tax_ids.banner_detected_explainer":`WCPOS will save VAT-shaped tax IDs to the field this plugin reads. No action needed from you.`,"tax_ids.banner_overrides_active_one":`You also have {count} custom override set below — that takes priority over the plugin's default.`,"tax_ids.banner_overrides_active_other":`You also have {count} custom overrides set below — they take priority over the plugin's default.`,"tax_ids.banner_no_plugin_title":`WCPOS will save tax IDs using its built-in defaults.`,"tax_ids.banner_no_plugin_explainer":`If you have a plugin that uses a different field name, you can set a custom override below.`,"tax_ids.advanced_title":`Advanced: use a different field name`,"tax_ids.advanced_subtitle":`(only if your plugin uses a custom key)`,"tax_ids.advanced_intro":`The "Source" column shows how the field name was chosen for each tax-ID type. Type a key in the "Override" column to use a custom field instead.`,"tax_ids.advanced_override_count_one":`{count} override active`,"tax_ids.advanced_override_count_other":`{count} overrides active`,"tax_ids.col_type":`Type`,"tax_ids.col_field":`Field name in use`,"tax_ids.col_source":`Source`,"tax_ids.col_override":`Override`,"tax_ids.write_map_use_default":`(leave blank to use default)`,"tax_ids.source_plugin":`Plugin`,"tax_ids.source_built_in":`Built-in`,"tax_ids.source_custom":`Custom`,"tax_ids.legend_plugin":`from a detected plugin`,"tax_ids.legend_built_in":`WCPOS default`,"tax_ids.legend_custom":`your override`,"cloud_print.save_failed":`Save failed.`,"cloud_print.saving":`Saving…`,"cloud_print.saved":`Saved`,"cloud_print.intro_title":`What is cloud printing?`,"cloud_print.intro_p1":`Cloud printing lets your store send a receipt to a printer over the internet — the printer fetches each job itself, so it doesn't need to be connected to the POS device.`,"cloud_print.intro_p2":`Use it when a receipt printer is on a different network from the till, or when you want orders to print automatically. For example:`,"cloud_print.intro_li1":`send every order straight to the kitchen printer, or`,"cloud_print.intro_li2":`print a packing slip for every online sale.`,"cloud_print.intro_p3":`Cashiers can also print to a cloud printer manually from the POS.`,"cloud_print.printers":`Your cloud printers`,"cloud_print.printers_description":`Printers that fetch jobs from this store.`,"cloud_print.no_printers":`No cloud printers yet.`,"cloud_print.add_a_printer":`+ Add a printer`,"cloud_print.auto_print":`Auto-print rules`,"cloud_print.status_connected":`Connected`,"cloud_print.status_waiting":`Waiting for printer`,"cloud_print.status_offline":`Offline`,"cloud_print.status_linked":`Linked`,"cloud_print.status_online":`Online`,"cloud_print.status_unknown":`Unknown`,"cloud_print.format":`Print format`,"cloud_print.format_pdf":`PDF (recommended)`,"cloud_print.format_raw":`ESC/POS RAW — thermal templates only`,"cloud_print.token_missing":`This printer was created, but no setup token was returned. Remove and re-add it to get one.`,"cloud_print.test_sent":`Sent a test print to {name}.`,"cloud_print.test_unavailable":`Test print isn't available for this printer yet.`,"cloud_print.test_failed":`Test print failed.`,"cloud_print.never":`never`,"cloud_print.printer_name":`Printer name`,"cloud_print.printer_menu":`Printer actions`,"cloud_print.menu_setup":`Setup & token`,"cloud_print.menu_remove":`Remove printer`,"cloud_print.last_check_in":`Last check-in`,"cloud_print.printer_id":`Printer ID`,"cloud_print.printer_id_tooltip":`The printer's address in its setup URL. Created automatically and can't be changed — to rename, edit the name above; to change the ID, remove and re-add the printer.`,"cloud_print.test_print":`Test print`,"cloud_print.remove_title":`Remove printer?`,"cloud_print.remove_body":`This printer will stop receiving jobs. You can add it again later.`,"cloud_print.choice_star_desc":`Star printer with CloudPRNT built in (mC-Print, TSP143IV…)`,"cloud_print.choice_epson_desc":`Epson TM printer with Server Direct Print support`,"cloud_print.choice_printnode_desc":`Use a regular USB / network thermal printer through a PrintNode account`,"cloud_print.copy":`Copy`,"cloud_print.copied":`Copied to clipboard`,"cloud_print.create_failed":`Couldn't create the printer. Please try again.`,"cloud_print.connect_title":`Connect your printer`,"cloud_print.add_title":`Add a cloud printer`,"cloud_print.step_provider_q":`What kind of printer are you connecting?`,"cloud_print.printer_name_ph":`e.g. Kitchen printer`,"cloud_print.printer_name_help":`A friendly name so you can recognise it later. The technical ID is created for you.`,"cloud_print.printnode_api_key":`PrintNode API key`,"cloud_print.printnode_api_key_ph":`Paste your PrintNode account API key`,"cloud_print.printnode_printer_id":`PrintNode printer ID`,"cloud_print.printnode_note":`Install the small PrintNode client on a computer next to the printer, then paste your account's API key. We'll list that account's printers next.`,"cloud_print.printnode_fetch":`Fetch my printers`,"cloud_print.printnode_pick_printer":`Choose a printer`,"cloud_print.printnode_pick_placeholder":`Select a printer…`,"cloud_print.printnode_no_printers":`No printers found on this PrintNode account.`,"cloud_print.printnode_fetch_failed":`Couldn't list your PrintNode printers. Check the API key and that the desktop client is running.`,"cloud_print.created":`Printer created`,"cloud_print.poll_url_lost":`The full address (with its secret token) was shown only once when this printer was created and can't be displayed again. To get a new one, remove and re-add the printer.`,"cloud_print.poll_url_once_intro":`Copy this address into your printer's setup screen. It contains a secret token and is shown in full only once.`,"cloud_print.poll_url":`Poll URL`,"cloud_print.poll_url_help":`paste into the printer's "server URL"`,"cloud_print.linked":`Linked to PrintNode`,"cloud_print.printnode_delivery":`No URLs or tokens to copy — PrintNode handles delivery.`,"cloud_print.star_online_delivery":`No URLs or tokens to copy — Star Online handles delivery.`,"cloud_print.scope_every":`every order`,"cloud_print.scope_pos":`every in-store (POS) order`,"cloud_print.scope_online":`every online order`,"cloud_print.scope_store":`orders for {name}`,"cloud_print.scope_store_unknown":`Unknown store (#{id})`,"cloud_print.rules_tip":`This is optional — leave it empty to print receipts only manually from the POS.`,"cloud_print.rules_subline_pre":`Each rule prints the chosen template automatically when an order matches. Templates come from `,"cloud_print.templates_link":`POS › Templates`,"cloud_print.rules_subline_post":`. More than one rule can run for the same order.`,"cloud_print.no_rules":`No rules yet.`,"cloud_print.rule_print":`Automatically print`,"cloud_print.rule_scope_label":`Which orders to print`,"cloud_print.rule_to":`to`,"cloud_print.rule_printer_label":`Printer`,"cloud_print.rule_using":`using the`,"cloud_print.rule_template_label":`Receipt template`,"cloud_print.rule_template_suffix":`template.`,"cloud_print.add_rule":`+ Add rule`}}}});function Hl(e){return(0,L.jsx)(go,{dismissLabel:$(`common.dismiss`),...e})}function Ul({error:e,resetErrorBoundary:t}){let n=(0,r.get)(e,`message`,`Unknown error`);return(0,L.jsx)(`div`,{className:`wcpos:p-4`,children:(0,L.jsx)(Hl,{status:`error`,onRemove:t,children:(0,L.jsxs)(`p`,{children:[$(`common.something_went_wrong`),`: `,(0,L.jsx)(`code`,{children:n})]})})})}var Wl=e.createContext({notice:null,setNotice:()=>{}});function Gl({children:t}){let[n,r]=e.useState(null);return(0,L.jsx)(Wl.Provider,{value:{notice:n,setNotice:r},children:t})}var Kl=()=>e.useContext(Wl),ql=new Ve({defaultOptions:{queries:{staleTime:6e5}}});typeof window<`u`&&(window.wcpos=window.wcpos||{},window.wcpos.queryClient=ql);var Jl=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 448 512`,...e,children:(0,L.jsx)(`path`,{d:`M96 0C43 0 0 43 0 96V416c0 53 43 96 96 96H384h32c17.7 0 32-14.3 32-32s-14.3-32-32-32V384c17.7 0 32-14.3 32-32V32c0-17.7-14.3-32-32-32H384 96zm0 384H352v64H96c-17.7 0-32-14.3-32-32s14.3-32 32-32zm32-240c0-8.8 7.2-16 16-16H336c8.8 0 16 7.2 16 16s-7.2 16-16 16H144c-8.8 0-16-7.2-16-16zm16 48H336c8.8 0 16 7.2 16 16s-7.2 16-16 16H144c-8.8 0-16-7.2-16-16s7.2-16 16-16z`})}),Yl=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,L.jsx)(`path`,{d:`M256 31.1c-141.4 0-255.1 93.13-255.1 208c0 49.63 21.35 94.98 56.97 130.7c-12.5 50.38-54.27 95.27-54.77 95.77c-2.25 2.25-2.875 5.734-1.5 8.734c1.249 3 4.021 4.766 7.271 4.766c66.25 0 115.1-31.76 140.6-51.39c32.63 12.25 69.02 19.39 107.4 19.39c141.4 0 255.1-93.13 255.1-208S397.4 31.1 256 31.1zM249.1 352C235.4 352 224 340.6 224 326S235.4 300 249.1 300c14.63 0 26 11.38 26 26S264.6 352 249.1 352zM307.7 235.4l-38.33 23.13v1.652c0 10.74-9.168 19.83-20 19.83c-10.83 0-20-9.088-20-19.83V246.1c0-6.609 3.332-13.22 10-17.35l47.5-28.09C292.7 198.2 296 192.4 296 185.8c0-9.914-8.334-18.17-18.33-18.17H234.3c-10 0-18.33 8.26-18.33 18.17c0 10.74-9.166 19.83-20 19.83S176 196.6 176 185.8C176 153.6 201.8 128 234.3 128h43.33C310.2 128 336 153.6 336 185.8C336 205.7 325.2 224.7 307.7 235.4z`})}),Xl=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,L.jsx)(`path`,{d:`M48 64C21.5 64 0 85.5 0 112c0 15.1 7.1 29.3 19.2 38.4L236.8 313.6c11.4 8.5 27 8.5 38.4 0L492.8 150.4c12.1-9.1 19.2-23.3 19.2-38.4c0-26.5-21.5-48-48-48H48zM0 176V384c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V176L294.4 339.2c-22.8 17.1-54 17.1-76.8 0L0 176z`})});function Zl(){return(0,L.jsxs)(`footer`,{className:`wcpos:border-t wcpos:border-gray-200 wcpos:shrink-0 wcpos:px-6 wcpos:py-2 wcpos:flex wcpos:flex-col wcpos:sm:flex-row wcpos:flex-wrap wcpos:items-start wcpos:gap-x-4 wcpos:gap-y-2 wcpos:text-xs`,children:[(0,L.jsx)(`span`,{className:`wcpos:font-semibold wcpos:text-gray-500`,children:$(`settings.need_help`)}),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:md:flex-row wcpos:gap-1 wcpos:lg:gap-4`,children:[(0,L.jsxs)(`a`,{href:`https://docs.wcpos.com`,target:`_blank`,rel:`noreferrer`,className:`wcpos:flex wcpos:items-center wcpos:gap-1 wcpos:text-gray-500 hover:wcpos:text-gray-900 wcpos:no-underline`,children:[(0,L.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,L.jsx)(Jl,{fill:`#6b7280`})}),$(`common.documentation`),(0,L.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]}),(0,L.jsxs)(`a`,{href:`https://faq.wcpos.com`,target:`_blank`,rel:`noreferrer`,className:`wcpos:flex wcpos:items-center wcpos:gap-1 wcpos:text-gray-500 hover:wcpos:text-gray-900 wcpos:no-underline`,children:[(0,L.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,L.jsx)(Yl,{fill:`#6b7280`})}),$(`common.faq`),(0,L.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})]}),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:md:flex-row wcpos:gap-1 wcpos:lg:gap-4`,children:[(0,L.jsxs)(`a`,{href:`mailto:support@wcpos.com`,target:`_blank`,rel:`noreferrer`,className:`wcpos:flex wcpos:items-center wcpos:gap-1 wcpos:text-gray-500 hover:wcpos:text-gray-900 wcpos:no-underline`,children:[(0,L.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,L.jsx)(Xl,{fill:`#6b7280`})}),`support@wcpos.com`]}),(0,L.jsx)(`a`,{href:`https://wcpos.com/discord`,target:`_blank`,rel:`noreferrer`,className:`wcpos:no-underline`,children:(0,L.jsx)(`img`,{src:`https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fdiscord.com%2Fapi%2Finvites%2FGCEeEVpEvX%3Fwith_counts%3Dtrue&query=%24.approximate_presence_count&logo=discord&logoColor=white&label=users%20online&color=7c3aed&style=flat-square`,alt:`Discord`,className:`wcpos:h-4`,loading:`lazy`,width:`100`,height:`16`})})]})]})}function Ql({heading:e,children:t}){return(0,L.jsxs)(`div`,{className:`wcpos:mb-4`,children:[(0,L.jsx)(`h3`,{className:`wcpos:px-4 wcpos:mb-1 wcpos:text-xs wcpos:font-semibold wcpos:uppercase wcpos:tracking-wider wcpos:text-gray-400`,children:e}),(0,L.jsx)(`nav`,{children:t})]})}function $l({to:e,label:t,badge:n,onClick:r}){let i=ja()({to:e});return(0,L.jsxs)(da,{to:e,onClick:r,"data-testid":`settings-nav-${e.replace(/^\//,``)}`,className:(0,U.default)(`wcpos:flex wcpos:items-center wcpos:justify-between wcpos:px-4 wcpos:py-2 wcpos:text-sm wcpos:no-underline wcpos:border-l-3 wcpos:transition-colors wcpos:hover:bg-gray-100 wcpos:focus-visible:outline-none wcpos:focus-visible:bg-gray-100`,i?`wcpos:border-wp-admin-theme-color wcpos:bg-wp-admin-theme-color-lightest wcpos:text-gray-900 wcpos:font-semibold`:`wcpos:border-transparent wcpos:text-gray-600 wcpos:hover:text-gray-900 wcpos:hover:bg-gray-50`),children:[t,(()=>{if(n==null)return null;if(typeof n==`number`)return n<=0?null:(0,L.jsx)(J,{variant:`brand`,shape:`round`,size:`xs`,children:n});let{error:e=0,warning:t=0}=n;return e<=0&&t<=0?null:(0,L.jsxs)(`span`,{className:`wcpos:inline-flex wcpos:items-center wcpos:gap-1`,children:[e>0&&(0,L.jsx)(J,{variant:`critical`,shape:`round`,size:`xs`,children:e}),t>0&&(0,L.jsx)(J,{variant:`warning`,shape:`round`,size:`xs`,children:t})]})})()]})}var eu=e=>(0,L.jsxs)(`svg`,{fill:`#000`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1260 1260`,...e,children:[(0,L.jsx)(`path`,{fill:`#323A46`,d:`M0,90 q0,-90 90,-90 l1080,0 q90,0 90,90 l0,810 q0,90 -90,90 l-810,0 L0,1260 Z`}),(0,L.jsxs)(`g`,{children:[(0,L.jsxs)(`g`,{fill:`#CD2C24`,children:[(0,L.jsx)(`path`,{d:`M0,90 q0,-90 90,-90 l90,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,L.jsx)(`path`,{d:`M360,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,L.jsx)(`path`,{d:`M720,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,L.jsx)(`path`,{d:`M1080,0 l90,0 q90,0 90,90 l0,180 a90,90 0 1,1 -180,0 Z`})]}),(0,L.jsxs)(`g`,{fill:`#F5E5C0`,children:[(0,L.jsx)(`path`,{d:`M180,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,L.jsx)(`path`,{d:`M540,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,L.jsx)(`path`,{d:`M900,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`})]})]}),(0,L.jsxs)(`svg`,{viewBox:`0 0 1200 400`,width:`1060px`,x:`100px`,y:`50px`,stroke:`#FFF`,strokeWidth:60,strokeLinecap:`round`,fill:`#FFF`,fillOpacity:0,...e,children:[(0,L.jsx)(`path`,{d:` M30,480 l0,-450 m0,150 a150,150 0 1,0 300,0 a150,150 0 1,0 -300,0 `}),(0,L.jsx)(`path`,{d:` M600,30 m-150,150 a150,150 0 1,0 300,0 a150,150 0 1,0 -300,0 `}),(0,L.jsx)(`path`,{d:` M1170,70 c-25,-15 -75,-40 -150,-40 q-150,0 -150,75 t150,75 t150,75 t-150,75 c-75,0 -125,-25 -150,-40 `})]})]}),tu=window?.wcpos?.settings?.updateExtensionsCount??null,nu=new Set;function ru(){for(let e of nu)e()}function iu(e){return nu.add(e),()=>nu.delete(e)}function au(){return tu}function ou(){return(0,e.useSyncExternalStore)(iu,au)}function su(e){tu=e,ru()}var cu=window?.wcpos?.settings?.unreadLogCounts??{error:0,warning:0},lu=new Set;function uu(){for(let e of lu)e()}function du(e){return lu.add(e),()=>lu.delete(e)}function fu(){return cu}function pu(){return(0,e.useSyncExternalStore)(du,fu)}async function mu(){let e={...cu};cu={error:0,warning:0},uu();try{await(0,i.default)({path:`wcpos/v1/logs/mark-read?wcpos=1`,method:`POST`})}catch{cu=e,uu()}}var hu=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},gu=(e=>e?hu(e):hu),_u=e=>e;function vu(e,t=_u){let n=h.default.useSyncExternalStore(e.subscribe,h.default.useCallback(()=>t(e.getState()),[e,t]),h.default.useCallback(()=>t(e.getInitialState()),[e,t]));return h.default.useDebugValue(n),n}var yu=gu((e,t)=>({pages:[],fields:[],modifications:[],components:{},registerPage:t=>{e(e=>e.pages.some(e=>e.id===t.id)?(console.warn(`[wcpos] Page "${t.id}" is already registered.`),e):{pages:[...e.pages,{priority:10,...t}]})},registerField:t=>{e(e=>{let n=`${t.page}:${t.section||``}:${t.id}`;return e.fields.some(e=>`${e.page}:${e.section||``}:${e.id}`===n)?(console.warn(`[wcpos] Field "${n}" is already registered.`),e):{fields:[...e.fields,{priority:10,...t}]}})},modifyField:t=>{e(e=>({modifications:[...e.modifications,t]}))},getPages:e=>{let{pages:n}=t();return(e?n.filter(t=>t.group===e):n).sort((e,t)=>(e.priority??10)-(t.priority??10))},getFields:(e,n)=>{let{fields:r}=t();return r.filter(t=>t.page===e&&(n===void 0||t.section===n)).sort((e,t)=>(e.priority??10)-(t.priority??10))},getModifications:(e,n)=>{let{modifications:r}=t();return r.filter(t=>t.page===e&&t.id===n).reduce((e,t)=>({...e,...t.props}),{})},registerComponent:(t,n)=>{e(e=>({components:{...e.components,[t]:n}}))},getComponent:e=>t().components[e]}));typeof window<`u`&&(window.wcpos=window.wcpos||{},window.wcpos.settings={...window.wcpos.settings,registerPage:yu.getState().registerPage,registerField:yu.getState().registerField,modifyField:yu.getState().modifyField,registerComponent:yu.getState().registerComponent,getComponent:yu.getState().getComponent});function bu(t){let n=vu(yu,e=>e.pages);return(0,e.useMemo)(()=>(t?n.filter(e=>e.group===t):[...n]).sort((e,t)=>(e.priority??10)-(t.priority??10)),[n,t])}function xu({isOpen:e,onNavItemClick:t}){let n=bu(`tools`),r=bu(`account`),i=ou(),a=pu();return(0,L.jsxs)(`aside`,{className:[`wcpos:w-56 wcpos:shrink-0 wcpos:border-r wcpos:border-gray-200 wcpos:bg-gray-50 wcpos:flex wcpos:flex-col wcpos:transition-[margin] wcpos:duration-300 wcpos:ease-in-out`,`wcpos:lg:ml-0`,e?`wcpos:ml-0`:`wcpos:-ml-56`].join(` `),children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:px-4 wcpos:border-b wcpos:border-gray-200 wcpos:h-12`,children:[(0,L.jsx)(`div`,{className:`wcpos:w-8`,children:(0,L.jsx)(eu,{})}),(0,L.jsx)(`span`,{className:`wcpos:text-lg wcpos:font-semibold wcpos:text-gray-900`,children:`WCPOS`})]}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:overflow-y-auto wcpos:py-2`,children:[(0,L.jsxs)(Ql,{heading:$(`common.settings`),children:[(0,L.jsx)($l,{to:`/general`,label:$(`common.general`),onClick:t}),(0,L.jsx)($l,{to:`/checkout`,label:$(`common.checkout`),onClick:t}),(0,L.jsx)($l,{to:`/cloud-print`,label:$(`common.cloud_print`,`Cloud Print`),onClick:t}),(0,L.jsx)($l,{to:`/access`,label:$(`common.access`),onClick:t}),(0,L.jsx)($l,{to:`/sessions`,label:$(`sessions.sessions`),onClick:t}),(0,L.jsx)($l,{to:`/extensions`,label:$(`common.extensions`,`Extensions`),badge:i??void 0,onClick:t})]}),(0,L.jsxs)(Ql,{heading:$(`common.tools`,`Tools`),children:[(0,L.jsx)($l,{to:`/logs`,label:$(`common.logs`,`Logs`),badge:a,onClick:t}),n.map(e=>(0,L.jsx)($l,{to:`/${e.id}`,label:e.label,onClick:t},e.id))]}),(0,L.jsxs)(Ql,{heading:$(`common.account`,`Account`),children:[(0,L.jsx)($l,{to:`/license`,label:$(`common.license`),onClick:t}),r.map(e=>(0,L.jsx)($l,{to:`/${e.id}`,label:e.label,onClick:t},e.id))]})]})]})}function Su({rows:e=5}){return(0,L.jsx)(`div`,{className:`wcpos:pb-4 wcpos:mb-4`,role:`status`,"aria-label":$(`common.loading`),children:(0,L.jsx)(`div`,{className:`wcpos:space-y-0`,children:Array.from({length:e}).map((e,t)=>(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:sm:flex-row wcpos:sm:items-center wcpos:gap-1 wcpos:sm:gap-3 wcpos:py-2.5`,children:[t%2==0&&(0,L.jsx)(`div`,{className:`wcpos:sm:w-[30%] wcpos:sm:max-w-[200px] wcpos:shrink-0`,children:(0,L.jsx)(K,{className:`wcpos:h-4`,width:`${60+t*17%40}%`})}),(0,L.jsx)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:(0,L.jsx)(K,{className:`wcpos:h-5`,width:t%2==0?`200px`:`${40+t*23%30}%`})})]},t))})})}function Cu({cards:e=4}){return(0,L.jsxs)(`div`,{role:`status`,"aria-label":$(`common.loading`),children:[(0,L.jsx)(`div`,{className:`wcpos:mb-4`,children:(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`})}),(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:gap-2 wcpos:mb-6`,children:Array.from({length:3}).map((e,t)=>(0,L.jsx)(K,{className:`wcpos:h-7 wcpos:rounded-full`,width:`${60+t*20}px`},t))}),(0,L.jsx)(`div`,{className:`wcpos:grid wcpos:grid-cols-1 wcpos:sm:grid-cols-2 wcpos:gap-4`,children:Array.from({length:e}).map((e,t)=>(0,L.jsxs)(`div`,{className:`wcpos:border wcpos:border-gray-200 wcpos:rounded-lg wcpos:p-4 wcpos:space-y-3`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3`,children:[(0,L.jsx)(K,{className:`wcpos:h-10 wcpos:w-10 wcpos:rounded-lg wcpos:shrink-0`}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-2`,children:[(0,L.jsx)(K,{className:`wcpos:h-4`,width:`60%`}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`40%`})]})]}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`90%`}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`70%`})]},t))})]})}function wu({rows:e=8}){return(0,L.jsxs)(`div`,{role:`status`,"aria-label":$(`common.loading`),children:[(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:gap-2 wcpos:mb-4`,children:Array.from({length:3}).map((e,t)=>(0,L.jsx)(K,{className:`wcpos:h-7 wcpos:rounded-full`,width:`${50+t*15}px`},t))}),(0,L.jsx)(`div`,{className:`wcpos:space-y-1`,children:Array.from({length:e}).map((e,t)=>(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:border wcpos:border-gray-200 wcpos:rounded-md wcpos:px-3 wcpos:py-2`,children:[(0,L.jsx)(K,{className:`wcpos:h-5 wcpos:rounded wcpos:shrink-0`,width:`55px`}),(0,L.jsx)(K,{className:`wcpos:h-3 wcpos:shrink-0`,width:`130px`}),(0,L.jsx)(K,{className:`wcpos:h-3 wcpos:flex-1`,width:`${50+t*19%40}%`})]},t))})]})}function Tu(){return(0,L.jsxs)(`div`,{role:`status`,"aria-label":$(`common.loading`),children:[(0,L.jsx)(`div`,{className:`wcpos:p-4`,children:(0,L.jsx)(K,{className:`wcpos:h-10 wcpos:w-full wcpos:rounded-md`})}),(0,L.jsxs)(`div`,{className:`wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4 wcpos:p-4 wcpos:pt-0`,children:[(0,L.jsx)(`div`,{children:(0,L.jsx)(`div`,{className:`wcpos:space-y-1`,children:Array.from({length:5}).map((e,t)=>(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:rounded`},t))})}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(K,{className:`wcpos:h-5 wcpos:mb-3`,width:`80px`}),(0,L.jsx)(`div`,{className:`wcpos:space-y-2`,children:Array.from({length:6}).map((e,t)=>(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,L.jsx)(K,{className:`wcpos:h-4 wcpos:w-4 wcpos:rounded wcpos:shrink-0`}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`${60+t*17%30}%`})]},t))})]})]})]})}function Eu(){return(0,L.jsxs)(`div`,{className:`wcpos:p-4`,role:`status`,"aria-label":$(`common.loading`),children:[(0,L.jsx)(K,{className:`wcpos:h-10 wcpos:w-full wcpos:rounded-md wcpos:mb-3`}),(0,L.jsxs)(`div`,{className:`wcpos:grid wcpos:grid-cols-[minmax(0,18rem)_1fr] wcpos:gap-4`,children:[(0,L.jsxs)(`div`,{className:`wcpos:space-y-2 wcpos:border-r wcpos:border-gray-200 wcpos:pr-4`,children:[(0,L.jsx)(K,{className:`wcpos:h-8 wcpos:w-full wcpos:rounded-md`}),Array.from({length:4}).map((e,t)=>(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:px-3 wcpos:py-2`,children:[(0,L.jsx)(K,{className:`wcpos:h-10 wcpos:w-10 wcpos:shrink-0 wcpos:rounded-full`}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-1`,children:[(0,L.jsx)(K,{className:`wcpos:h-4`,width:`60%`}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`40%`})]}),(0,L.jsx)(K,{className:`wcpos:h-5 wcpos:w-6 wcpos:rounded-full`})]},t))]}),(0,L.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:border-b wcpos:border-gray-200 wcpos:pb-3`,children:[(0,L.jsx)(K,{className:`wcpos:h-12 wcpos:w-12 wcpos:shrink-0 wcpos:rounded-full`}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-1`,children:[(0,L.jsx)(K,{className:`wcpos:h-5`,width:`40%`}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`30%`})]}),(0,L.jsx)(K,{className:`wcpos:h-8 wcpos:rounded`,width:`120px`})]}),Array.from({length:3}).map((e,t)=>(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:gap-3 wcpos:rounded-md wcpos:border wcpos:border-gray-200 wcpos:p-3`,children:[(0,L.jsx)(K,{className:`wcpos:h-10 wcpos:w-10 wcpos:shrink-0 wcpos:rounded-md`}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-1`,children:[(0,L.jsx)(K,{className:`wcpos:h-4`,width:`50%`}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`70%`}),(0,L.jsx)(K,{className:`wcpos:h-8 wcpos:rounded wcpos:mt-2`,width:`100%`})]}),(0,L.jsx)(K,{className:`wcpos:h-7 wcpos:rounded`,width:`80px`})]},t))]})]})]})}function Du(){return(0,L.jsxs)(`div`,{className:`wcpos:px-4 wcpos:py-5 wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4`,role:`status`,"aria-label":$(`common.loading`),children:[(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:sm:justify-end`,children:(0,L.jsx)(K,{className:`wcpos:h-4`,width:`90px`})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:rounded`,width:`90px`})})]})}var Ou={"/general":`common.general`,"/checkout":`common.checkout`,"/cloud-print":`common.cloud_print`,"/access":`common.access`,"/sessions":`sessions.sessions`,"/extensions":`common.extensions`,"/logs":`common.logs`,"/license":`common.license`},ku={"/general":(0,L.jsx)(Su,{rows:5}),"/checkout":(0,L.jsx)(Su,{rows:4}),"/cloud-print":(0,L.jsx)(Su,{rows:4}),"/access":(0,L.jsx)(Tu,{}),"/sessions":(0,L.jsx)(Eu,{}),"/extensions":(0,L.jsx)(Cu,{cards:4}),"/logs":(0,L.jsx)(wu,{rows:8}),"/license":(0,L.jsx)(Du,{})};function Au(){let{notice:t,setNotice:n}=Kl(),[r,i]=e.useState(!1),a=La(),o=$(Ou[a.pathname]||`common.settings`);return(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:flex wcpos:bg-white`,children:[(0,L.jsx)(xu,{isOpen:r,onNavItemClick:()=>i(!1)}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:flex wcpos:flex-col wcpos:min-w-0`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:px-6 wcpos:border-b wcpos:border-gray-200 wcpos:shrink-0 wcpos:h-12`,children:[(0,L.jsx)(`button`,{type:`button`,"aria-label":`Open main menu`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`wcpos:lg:hidden wcpos:p-2 wcpos:mr-2 wcpos:rounded-md wcpos:text-gray-600 hover:wcpos:bg-gray-100`,children:(0,L.jsx)(`svg`,{className:`wcpos:h-5 wcpos:w-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 6h16M4 12h16M4 18h16`})})}),(0,L.jsx)(`h1`,{className:`wcpos:text-lg wcpos:font-semibold wcpos:text-gray-900 wcpos:m-0`,children:o})]}),(0,L.jsxs)(`main`,{className:`wcpos:flex-1 wcpos:px-6 wcpos:py-6`,children:[t&&(0,L.jsx)(`div`,{className:`wcpos:mb-4`,children:(0,L.jsx)(Hl,{status:t.type,onRemove:()=>n(null),children:t.message})}),(0,L.jsx)(Ba,{FallbackComponent:Ul,children:(0,L.jsx)(e.Suspense,{fallback:ku[a.pathname]||(0,L.jsx)(Su,{}),children:(0,L.jsx)(Ea,{})})})]}),(0,L.jsx)(Zl,{})]})]})}function ju(e){return(0,L.jsx)(io,{loadingLabel:$(`common.loading`),noResultsLabel:$(`common.no_results`),...e})}var Mu=e=>{let t=We(),{addSnackbar:n}=Io(),{setNotice:a}=Kl(),o=`wcpos/v1/settings/${e}?wcpos=1`,{data:s}=st({queryKey:[e],queryFn:async()=>{let e=await(0,i.default)({path:o,method:`GET`}).catch(e=>(console.error(e),e));return e?.code&&e?.message&&a({type:`error`,message:e?.message}),e}});return{data:s,mutate:ct({mutationFn:async e=>await(0,i.default)({path:o,method:`POST`,data:e}),onMutate:async i=>{a(null),n({message:`Saving`,id:e,status:`saving`}),await t.cancelQueries({queryKey:[e]});let o=t.getQueryData([e]);return t.setQueryData([e],e=>(0,r.merge)((0,r.cloneDeep)(e),i)),{previousSettings:o}},onSettled:(i,o,s,c)=>{let l=(0,r.get)(o,`message`);return l?(a({type:`error`,message:l}),n({message:l,id:e,status:`error`}),t.setQueryData([e],c?.previousSettings)):(n({message:`Saved`,id:e,status:`success`}),t.setQueryData([e],i))}}).mutate}};function Nu(){let{data:t,mutate:n}=Mu(`access`),[i,a]=e.useState(`administrator`),o=(0,r.get)(t,[i,`capabilities`],null);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`wcpos:p-4`,children:(0,L.jsxs)(Hl,{status:`info`,isDismissible:!1,children:[(0,L.jsx)(Vl,{i18nKey:`access.default_roles_warning`,components:{strong:(0,L.jsx)(`strong`,{})}}),`\xA0`,(0,L.jsx)(Vl,{i18nKey:`access.visit_documentation`,components:{link:(0,L.jsx)(`a`,{href:`https://docs.wcpos.com/pos-access`,target:`_blank`,rel:`noreferrer`})}})]})}),(0,L.jsxs)(`div`,{className:`wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4 wcpos:p-4 wcpos:pt-0`,children:[(0,L.jsx)(`div`,{className:``,children:(0,L.jsx)(`ul`,{children:(0,r.map)(t,(e,t)=>(0,L.jsx)(`li`,{"data-testid":`access-role-${t}`,className:(0,U.default)(`wcpos:p-4 wcpos:mb-1 wcpos:rounded wcpos:font-medium wcpos:text-sm wcpos:hover:bg-gray-100 wcpos:cursor-pointer`,t===i&&`wcpos:bg-wp-admin-theme-color-lightest wcpos:hover:bg-wp-admin-theme-color-lightest`),onClick:()=>{a(t)},children:e.name},t))})}),(0,L.jsx)(`div`,{className:``,children:o&&(0,r.map)(o,(e,t)=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`wcpos:text-base`,"data-testid":`access-capability-group-${t}`,children:{wcpos:`WCPOS`,wc:`WooCommerce`,wp:`WordPress`}[t]}),(0,L.jsx)(`div`,{children:(0,r.map)(e,(e,r)=>(0,L.jsx)(Ga,{label:r,checked:e,disabled:i===`administrator`&&r===`read`,onChange:e=>{n({[i]:{capabilities:{[t]:{[r]:e.target.checked}}}})}},r))})]},t))})]})]})}function Pu(e){if(Array.isArray(e))return e}function Fu(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Iu(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Lu(e,t){if(e){if(typeof e==`string`)return Iu(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Iu(e,t):void 0}}function Ru(){throw TypeError(`Invalid attempt to destructure non-iterable instance. |
| 2 | In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zu(e,t){return Pu(e)||Fu(e,t)||Lu(e,t)||Ru()}var Bu=f((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bind=void 0;function t(e,t){var n=t.type,r=t.listener,i=t.options;return e.addEventListener(n,r,i),function(){e.removeEventListener(n,r,i)}}e.bind=t})),Vu=f((e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.bindAll=void 0;var n=Bu();function r(e){if(e!==void 0)return typeof e==`boolean`?{capture:e}:e}function i(e,n){return n==null?e:t(t({},e),{options:t(t({},r(n)),r(e.options))})}function a(e,t,r){var a=t.map(function(t){var a=i(t,r);return(0,n.bind)(e,a)});return function(){a.forEach(function(e){return e()})}}e.bindAll=a})),Hu=f((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bindAll=e.bind=void 0;var t=Bu();Object.defineProperty(e,"bind",{enumerable:!0,get:function(){return t.bind}});var n=Vu();Object.defineProperty(e,"bindAll",{enumerable:!0,get:function(){return n.bindAll}})}))(),Uu=`data-pdnd-honey-pot`;function Wu(e){return e instanceof Element&&e.hasAttribute(`data-pdnd-honey-pot`)}function Gu(e){var t=zu(document.elementsFromPoint(e.x,e.y),2),n=t[0],r=t[1];return n?Wu(n)?r??null:n:null}var Ku=2147483647,qu={inset:`unset`,border:`none`,padding:0,margin:0,overflow:`visible`,color:`inherit`,background:`transparent`};function Ju(e){var t=null;return function(){if(!t){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];t={result:e.apply(this,r)}}return t.result}}var Yu=Ju(function(){return typeof HTMLElement<`u`&&typeof HTMLElement.prototype.showPopover==`function`});function Xu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Zu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Xu(Object(n),!0).forEach(function(t){Ic(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Qu=2,$u=Qu/2;function ed(e){return{x:Math.floor(e.x),y:Math.floor(e.y)}}function td(e){return{x:e.x-$u,y:e.y-$u}}function nd(e){return{x:Math.max(e.x,0),y:Math.max(e.y,0)}}function rd(e){return{x:Math.min(e.x,window.innerWidth-Qu),y:Math.min(e.y,window.innerHeight-Qu)}}function id(e){var t=e.client,n=rd(nd(td(ed(t))));return DOMRect.fromRect({x:n.x,y:n.y,width:Qu,height:Qu})}function ad(e){var t=e.clientRect;return{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`}}function od(e){var t=e.client,n=e.clientRect;return t.x>=n.x&&t.x<=n.x+n.width&&t.y>=n.y&&t.y<=n.y+n.height}function sd(e){var t=e.initial,n=document.createElement(`div`);n.setAttribute(Uu,`true`),Yu()&&n.setAttribute(`popover`,`manual`);var r=id({client:t});Object.assign(n.style,Zu(Zu({position:`fixed`},Yu()?qu:{zIndex:Ku}),{},{backgroundColor:`transparent`,padding:0,margin:0,boxSizing:`border-box`,pointerEvents:`auto`},ad({clientRect:r}))),document.body.appendChild(n),Yu()&&n.showPopover();var i=(0,Hu.bind)(window,{type:`pointermove`,listener:function(e){r=id({client:{x:e.clientX,y:e.clientY}}),Object.assign(n.style,ad({clientRect:r}))},options:{capture:!0}});return function(e){var t=e.current;if(i(),od({client:t,clientRect:r})){n.remove();return}function a(){o(),n.remove()}var o=(0,Hu.bindAll)(window,[{type:`pointerdown`,listener:a},{type:`pointermove`,listener:a},{type:`focusin`,listener:a},{type:`focusout`,listener:a},{type:`dragstart`,listener:a},{type:`dragenter`,listener:a},{type:`dragover`,listener:a}],{capture:!0})}}function cd(){var e=null;function t(){return e=null,(0,Hu.bind)(window,{type:`pointermove`,listener:function(t){e={x:t.clientX,y:t.clientY}},options:{capture:!0}})}function n(){var t=null;return function(n){var r=n.eventName,i=n.payload;if(r===`onDragStart`){var a=i.location.initial.input;t=sd({initial:e??{x:a.clientX,y:a.clientY}})}if(r===`onDrop`){var o,s=i.location.current.input;(o=t)==null||o({current:{x:s.clientX,y:s.clientY}}),t=null,e=null}}}return{bindEvents:t,getOnPostDispatch:n}}function ld(e){if(Array.isArray(e))return Iu(e)}function ud(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function dd(){throw TypeError(`Invalid attempt to spread non-iterable instance. |
| 3 | In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fd(e){return ld(e)||ud(e)||Lu(e)||dd()}var pd=Ju(function(){return navigator.userAgent.includes(`Firefox`)}),md=Ju(function(){var e=navigator.userAgent;return e.includes(`AppleWebKit`)&&!e.includes(`Chrome`)}),hd={isLeavingWindow:Symbol(`leaving`),isEnteringWindow:Symbol(`entering`)};function gd(e){var t=e.dragLeave;return md()?t.hasOwnProperty(hd.isLeavingWindow):!1}(function(){if(typeof window>`u`||!md())return;function e(){return{enterCount:0,isOverWindow:!1}}var t=e();function n(){t=e()}(0,Hu.bindAll)(window,[{type:`dragstart`,listener:function(){t.enterCount=0,t.isOverWindow=!0}},{type:`drop`,listener:n},{type:`dragend`,listener:n},{type:`dragenter`,listener:function(e){!t.isOverWindow&&t.enterCount===0&&(e[hd.isEnteringWindow]=!0),t.isOverWindow=!0,t.enterCount++}},{type:`dragleave`,listener:function(e){t.enterCount--,t.isOverWindow&&t.enterCount===0&&(e[hd.isLeavingWindow]=!0,t.isOverWindow=!1)}}],{capture:!0})})();function _d(e){return`nodeName`in e}function vd(e){return _d(e)&&e.ownerDocument!==document}function yd(e){var t=e.dragLeave,n=t.type,r=t.relatedTarget;return n===`dragleave`?md()?gd({dragLeave:t}):r==null?!0:pd()?vd(r):r instanceof HTMLIFrameElement:!1}function bd(e){var t=e.onDragEnd;return[{type:`pointermove`,listener:function(){var e=0;return function(){if(e<20){e++;return}t()}}()},{type:`pointerdown`,listener:t}]}function xd(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var Sd=function(e){var t=[],n=null,r=function(){for(var r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];t=i,!n&&(n=requestAnimationFrame(function(){n=null,e.apply(void 0,t)}))};return r.cancel=function(){n&&=(cancelAnimationFrame(n),null)},r}(function(e){return e()}),Cd=function(){var e=null;function t(t){e={frameId:requestAnimationFrame(function(){e=null,t()}),fn:t}}function n(){e&&=(cancelAnimationFrame(e.frameId),e.fn(),null)}return{schedule:t,flush:n}}();function wd(e){var t=e.source,n=e.initial,r=e.dispatchEvent,i={dropTargets:[]};function a(e){r(e),i={dropTargets:e.payload.location.current.dropTargets}}return{start:function(e){var r=e.nativeSetDragImage,o={current:n,previous:i,initial:n};a({eventName:`onGenerateDragPreview`,payload:{source:t,location:o,nativeSetDragImage:r}}),Cd.schedule(function(){a({eventName:`onDragStart`,payload:{source:t,location:o}})})},dragUpdate:function(e){var r=e.current;Cd.flush(),Sd.cancel(),a({eventName:`onDropTargetChange`,payload:{source:t,location:{initial:n,previous:i,current:r}}})},drag:function(e){var r=e.current;Sd(function(){Cd.flush(),a({eventName:`onDrag`,payload:{source:t,location:{initial:n,previous:i,current:r}}})})},drop:function(e){var r=e.current,o=e.updatedSourcePayload;Cd.flush(),Sd.cancel(),a({eventName:`onDrop`,payload:{source:o??t,location:{current:r,previous:i,initial:n}}})}}}var Td={isActive:!1};function Ed(){return!Td.isActive}function Dd(e){return e.dataTransfer?e.dataTransfer.setDragImage.bind(e.dataTransfer):null}function Od(e){var t=e.current,n=e.next;if(t.length!==n.length)return!0;for(var r=0;r<t.length;r++)if(t[r].element!==n[r].element)return!0;return!1}function kd(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=e.dispatchEvent;if(!Ed())return;var a=jd({event:t,dragType:n,getDropTargetsOver:r});Td.isActive=!0;var o={current:a};Ad({event:t,current:a.dropTargets});var s=wd({source:n.payload,dispatchEvent:i,initial:a});function c(e){var t=Od({current:o.current.dropTargets,next:e.dropTargets});o.current=e,t&&s.dragUpdate({current:o.current})}function l(e){var t=xd(e),i=r({target:Wu(e.target)?Gu({x:t.clientX,y:t.clientY}):e.target,input:t,source:n.payload,current:o.current.dropTargets});i.length&&(e.preventDefault(),Ad({event:e,current:i})),c({dropTargets:i,input:t})}function u(){o.current.dropTargets.length&&c({dropTargets:[],input:o.current.input}),s.drop({current:o.current,updatedSourcePayload:null}),d()}function d(){Td.isActive=!1,f()}var f=(0,Hu.bindAll)(window,[{type:`dragover`,listener:function(e){l(e),s.drag({current:o.current})}},{type:`dragenter`,listener:l},{type:`dragleave`,listener:function(e){yd({dragLeave:e})&&(c({input:o.current.input,dropTargets:[]}),n.startedFrom===`external`&&u())}},{type:`drop`,listener:function(e){if(o.current={dropTargets:o.current.dropTargets,input:xd(e)},!o.current.dropTargets.length){u();return}e.preventDefault(),Ad({event:e,current:o.current.dropTargets}),s.drop({current:o.current,updatedSourcePayload:n.type===`external`?n.getDropPayload(e):null}),d()}},{type:`dragend`,listener:function(e){o.current={dropTargets:o.current.dropTargets,input:xd(e)},u()}}].concat(fd(bd({onDragEnd:u}))),{capture:!0});s.start({nativeSetDragImage:Dd(t)})}function Ad(e){var t=e.event,n=e.current[0]?.dropEffect;n!=null&&t.dataTransfer&&(t.dataTransfer.dropEffect=n)}function jd(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=xd(t);return n.startedFrom===`external`?{input:i,dropTargets:[]}:{input:i,dropTargets:r({input:i,source:n.payload,target:t.target,current:[]})}}var Md={canStart:Ed,start:kd},Nd=new Map;function Pd(e){var t=e.typeKey,n=e.mount,r=Nd.get(t);if(r)return r.usageCount++,r;var i={typeKey:t,unmount:n(),usageCount:1};return Nd.set(t,i),i}function Fd(e){var t=Pd(e);return function(){t.usageCount--,!(t.usageCount>0)&&(t.unmount(),Nd.delete(e.typeKey))}}function Id(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(){t.forEach(function(e){return e()})}}function Ld(e,t){var n=t.attribute,r=t.value;return e.setAttribute(n,r),function(){return e.removeAttribute(n)}}function Rd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Rd(Object(n),!0).forEach(function(t){Ic(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Bd(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Vd(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. |
| 4 | In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function Vd(e,t){if(e){if(typeof e==`string`)return Hd(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hd(e,t):void 0}}function Hd(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ud(e){return e.slice(0).reverse()}function Wd(e){var t=e.typeKey,n=e.defaultDropEffect,r=new WeakMap,i=`data-drop-target-for-${t}`,a=`[${i}]`;function o(e){return r.set(e.element,e),function(){return r.delete(e.element)}}function s(e){return Ju(Id(Ld(e.element,{attribute:i,value:`true`}),o(e)))}function c(e){var t=e.source,i=e.target,o=e.input,s=e.result,l=s===void 0?[]:s;if(i==null)return l;if(!(i instanceof Element))return i instanceof Node?c({source:t,target:i.parentElement,input:o,result:l}):l;var u=i.closest(a);if(u==null)return l;var d=r.get(u);if(d==null)return l;var f={input:o,source:t,element:d.element};if(d.canDrop&&!d.canDrop(f))return c({source:t,target:d.element.parentElement,input:o,result:l});var p=d.getData?.call(d,f)??{},m=d.getDropEffect?.call(d,f)??n,h={data:p,element:d.element,dropEffect:m,isActiveDueToStickiness:!1};return c({source:t,target:d.element.parentElement,input:o,result:[].concat(fd(l),[h])})}function l(e){var t=e.eventName,n=e.payload,i=Bd(n.location.current.dropTargets),a;try{for(i.s();!(a=i.n()).done;){var o,s=a.value,c=r.get(s.element),l=zd(zd({},n),{},{self:s});c==null||(o=c[t])==null||o.call(c,l)}}catch(e){i.e(e)}finally{i.f()}}var u={onGenerateDragPreview:l,onDrag:l,onDragStart:l,onDrop:l,onDropTargetChange:function(e){var t=e.payload,n=new Set(t.location.current.dropTargets.map(function(e){return e.element})),i=new Set,a=Bd(t.location.previous.dropTargets),o;try{for(a.s();!(o=a.n()).done;){var s,c=o.value;i.add(c.element);var l=r.get(c.element),u=n.has(c.element),d=zd(zd({},t),{},{self:c});if(l==null||(s=l.onDropTargetChange)==null||s.call(l,d),!u){var f;l==null||(f=l.onDragLeave)==null||f.call(l,d)}}}catch(e){a.e(e)}finally{a.f()}var p=Bd(t.location.current.dropTargets),m;try{for(p.s();!(m=p.n()).done;){var h,g,_=m.value;if(!i.has(_.element)){var v=zd(zd({},t),{},{self:_}),y=r.get(_.element);y==null||(h=y.onDropTargetChange)==null||h.call(y,v),y==null||(g=y.onDragEnter)==null||g.call(y,v)}}}catch(e){p.e(e)}finally{p.f()}}};function d(e){u[e.eventName](e)}function f(e){var t=e.source,n=e.target,i=e.input,a=e.current,o=c({source:t,target:n,input:i});if(o.length>=a.length)return o;for(var s=Ud(a),l=Ud(o),u=[],d=0;d<s.length;d++){var f,p=s[d],m=l[d];if(m!=null){u.push(m);continue}var h=u[d-1],g=s[d-1];if(h?.element!==g?.element)break;var _=r.get(p.element);if(!_)break;var v={input:i,source:t,element:_.element};if(_.canDrop&&!_.canDrop(v)||!((f=_.getIsSticky)!=null&&f.call(_,v)))break;u.push(zd(zd({},p),{},{isActiveDueToStickiness:!0}))}return Ud(u)}return{dropTargetForConsumers:s,getIsOver:f,dispatchEvent:d}}function Gd(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Kd(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. |
| 5 | In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function Kd(e,t){if(e){if(typeof e==`string`)return qd(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qd(e,t):void 0}}function qd(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Jd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Jd(Object(n),!0).forEach(function(t){Ic(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xd(){var e=new Set,t=null;function n(e){t&&(!e.canMonitor||e.canMonitor(t.canMonitorArgs))&&t.active.add(e)}function r(r){var i=Yd({},r);e.add(i),n(i);function a(){e.delete(i),t&&t.active.delete(i)}return Ju(a)}function i(r){var i=r.eventName,a=r.payload;if(i===`onGenerateDragPreview`){t={canMonitorArgs:{initial:a.location.initial,source:a.source},active:new Set};var o=Gd(e),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;n(c)}}catch(e){o.e(e)}finally{o.f()}}if(t){for(var l=Array.from(t.active),u=0,d=l;u<d.length;u++){var f=d[u];if(t.active.has(f)){var p;(p=f[i])==null||p.call(f,a)}}i===`onDrop`&&(t.active.clear(),t=null)}}return{dispatchEvent:i,monitorForConsumers:r}}function Zd(e){var t=e.typeKey,n=e.mount,r=e.dispatchEventToSource,i=e.onPostDispatch,a=e.defaultDropEffect,o=Xd(),s=Wd({typeKey:t,defaultDropEffect:a});function c(e){r?.(e),s.dispatchEvent(e),o.dispatchEvent(e),i?.(e)}function l(e){var t=e.event,n=e.dragType;Md.start({event:t,dragType:n,getDropTargetsOver:s.getIsOver,dispatchEvent:c})}function u(){function e(){return n({canStart:Md.canStart,start:l})}return Fd({typeKey:t,mount:e})}return{registerUsage:u,dropTarget:s.dropTargetForConsumers,monitor:o.monitorForConsumers}}var Qd=Ju(function(){return navigator.userAgent.toLocaleLowerCase().includes(`android`)}),$d=`pdnd:android-fallback`,ef=`text/plain`,tf=`application/vnd.pdnd`,nf=new WeakMap;function rf(e){return nf.set(e.element,e),function(){nf.delete(e.element)}}var af=cd(),of=Zd({typeKey:`element`,defaultDropEffect:`move`,mount:function(e){return Id(af.bindEvents(),(0,Hu.bind)(document,{type:`dragstart`,listener:function(t){if(e.canStart(t)&&!t.defaultPrevented&&t.dataTransfer){var n=t.target;if(n instanceof HTMLElement){var r=nf.get(n);if(r){var i=xd(t),a={element:r.element,dragHandle:r.dragHandle??null,input:i};if(r.canDrag&&!r.canDrag(a)){t.preventDefault();return}if(r.dragHandle){var o=Gu({x:i.clientX,y:i.clientY});if(!r.dragHandle.contains(o)){t.preventDefault();return}}var s=r.getInitialDataForExternal?.call(r,a)??null;if(s)for(var c=0,l=Object.entries(s);c<l.length;c++){var u=zu(l[c],2),d=u[0],f=u[1];t.dataTransfer.setData(d,f??``)}Qd()&&!t.dataTransfer.types.includes(`text/plain`)&&!t.dataTransfer.types.includes(`text/uri-list`)&&t.dataTransfer.setData(ef,$d),t.dataTransfer.setData(tf,``);var p={type:`element`,payload:{element:r.element,dragHandle:r.dragHandle??null,data:r.getInitialData?.call(r,a)??{}},startedFrom:`internal`};e.start({event:t,dragType:p})}}}}}))},dispatchEventToSource:function(e){var t,n,r=e.eventName,i=e.payload;(t=nf.get(i.source.element))==null||(n=t[r])==null||n.call(t,i)},onPostDispatch:af.getOnPostDispatch()}),sf=of.dropTarget,cf=of.monitor;function lf(e){return Ju(Id(of.registerUsage(),rf(e),Ld(e.element,{attribute:`draggable`,value:`true`})))}function uf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function df(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?uf(Object(n),!0).forEach(function(t){Ic(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ff={top:function(e,t){return Math.abs(t.y-e.top)},right:function(e,t){return Math.abs(e.right-t.x)},bottom:function(e,t){return Math.abs(e.bottom-t.y)},left:function(e,t){return Math.abs(t.x-e.left)}},pf=Symbol(`closestEdge`);function mf(e,t){var n=t.element,r=t.input,i=t.allowedEdges,a={x:r.clientX,y:r.clientY},o=n.getBoundingClientRect(),s=i.map(function(e){return{edge:e,value:ff[e](o,a)}}).sort(function(e,t){return e.value-t.value})[0]?.edge??null;return df(df({},e),{},Ic({},pf,s))}function hf(e){return e[pf]??null}function gf(e){var t=e.list,n=e.startIndex,r=e.finishIndex;if(n===-1||r===-1)return Array.from(t);var i=Array.from(t),a=zu(i.splice(n,1),1)[0];return i.splice(r,0,a),i}function _f(e){var t=e.startIndex,n=e.closestEdgeOfTarget,r=e.indexOfTarget,i=e.axis;if(t===-1||r===-1||t===r)return t;if(n==null)return r;var a=i===`vertical`&&n===`bottom`||i===`horizontal`&&n===`right`;return t<r?a?r:r-1:a?r+1:r}function vf(e){var t=e.list,n=e.startIndex,r=e.closestEdgeOfTarget,i=e.indexOfTarget,a=e.axis;return gf({list:t,startIndex:n,finishIndex:_f({closestEdgeOfTarget:r,startIndex:n,indexOfTarget:i,axis:a})})}function yf({gateway:t,mutate:n,closeModal:r}){let[i,a]=e.useState(t.title),[o,s]=e.useState(t.description),c=e.useRef(),l=()=>{n({gateways:{[t.id]:{title:i,description:o}}}),r()},u=e.useCallback(e=>{let t=e.target.value,n=e.target.id;n===`title`&&a(t),n===`description`&&s(t)},[]);return(0,L.jsxs)(ao,{open:!0,onClose:()=>r(),title:t.title,className:`wcpos:max-w-md`,children:[(0,L.jsx)(Hl,{status:`info`,isDismissible:!1,children:(0,L.jsx)(Vl,{i18nKey:`checkout.gateway_settings_pos_only`,components:{link:(0,L.jsx)(`a`,{href:`admin.php?page=wc-settings&tab=checkout`,target:`_blank`,rel:`noreferrer`})}})}),(0,L.jsxs)(`div`,{className:`wcpos:py-2`,children:[(0,L.jsx)(`label`,{htmlFor:`title`,className:`wcpos:block wcpos:mb-1 wcpos:font-medium wcpos:text-sm`,children:$(`common.title`)}),(0,L.jsx)(`input`,{ref:c,id:`title`,name:`title`,type:`text`,value:i,onChange:u,className:`wcpos:w-full wcpos:p-2 wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:focus:border-wp-admin-theme-color`})]}),(0,L.jsxs)(`div`,{className:`wcpos:py-2`,children:[(0,L.jsx)(`label`,{htmlFor:`description`,className:`wcpos:block wcpos:mb-1 wcpos:font-medium wcpos:text-sm`,children:$(`common.description`)}),(0,L.jsx)(`textarea`,{id:`description`,name:`description`,value:o,onChange:u,className:`wcpos:w-full wcpos:h-20 wcpos:p-2 wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:focus:border-wp-admin-theme-color`})]}),(0,L.jsxs)(`div`,{className:`wcpos:text-right wcpos:pt-4 wcpos:flex wcpos:justify-end wcpos:gap-2`,children:[(0,L.jsx)(W,{onClick:r,children:$(`common.cancel`)}),(0,L.jsx)(W,{variant:`primary`,onClick:l,children:$(`common.save`)})]})]})}function bf({selectedStatus:t,onChange:n,disabled:r}){let i=window?.wcpos?.settings?.order_statuses??{},a=e.useMemo(()=>Object.entries(i).map(([e,t])=>({value:e,label:t})),[i]);return(0,L.jsx)(qa,{options:a||[],value:t,onChange:({value:e})=>{n(String(e))},disabled:r})}var xf=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,L.jsx)(`path`,{d:`M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z`})}),Sf=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,L.jsx)(`path`,{d:`M12 4a2 2 0 110 4 2 2 0 010-4zm0 6a2 2 0 110 4 2 2 0 010-4zm0 6a2 2 0 110 4 2 2 0 010-4z`})});function Cf(){return window?.wcpos?.posthog}function wf(e,t={}){Cf()?.capture?.(e,t)}function Tf(e){wf(`upgrade_cta_viewed`,{placement:e})}function Ef(e,t){wf(`pro_link_clicked`,{placement:e,destination:t})}function Df(){wf(`license_activate_attempted`)}function Of(e){wf(`license_activate_succeeded`,e?{license_tier:e}:{})}function kf(e){if(e instanceof TypeError)return`network`;let t=typeof e==`string`?e:e instanceof Error?e.message:typeof e==`object`&&e?e.error??e.message??``:``,n=(typeof t==`string`?t:``).toLowerCase();return n.includes(`network`)||n.includes(`fetch`)||n.includes(`failed to fetch`)?`network`:n.includes(`expired`)?`expired`:n.includes(`invalid`)?`invalid_key`:`server_error`}function Af(e){wf(`license_activate_failed`,{reason:kf(e)})}function jf({item:t,index:n,data:r,mutate:i,proEnabled:a,onEditGateway:o}){let s=e.useRef(null),c=e.useRef(null),[l,u]=e.useState(!1),[d,f]=e.useState(null);return e.useEffect(()=>{let e=s.current,r=c.current;if(!e||!r)return;let i=lf({element:e,dragHandle:r,getInitialData:()=>({id:t.id,index:n}),onDragStart:()=>u(!0),onDrop:()=>u(!1)}),a=sf({element:e,getData:({input:e,element:r})=>mf({id:t.id,index:n},{element:r,input:e,allowedEdges:[`top`,`bottom`]}),onDragEnter:({self:e})=>f(hf(e.data)),onDrag:({self:e})=>f(hf(e.data)),onDragLeave:()=>f(null),onDrop:()=>f(null)});return()=>{i(),a()}},[t.id,n]),(0,L.jsxs)(Vo,{ref:s,className:(0,U.default)(`wcpos:relative`,l&&`wcpos:opacity-50`,n%2!=0&&`wcpos:bg-gray-50`),children:[d&&(0,L.jsx)(X,{colSpan:7,className:(0,U.default)(`wcpos:absolute wcpos:left-0 wcpos:right-0 wcpos:h-0.5 wcpos:bg-wp-admin-theme-color wcpos:p-0`,d===`top`?`wcpos:top-0`:`wcpos:bottom-0`)}),(0,L.jsx)(X,{ref:c,className:`wcpos:pl-3 wcpos:pr-1 wcpos:whitespace-nowrap wcpos:cursor-grab wcpos:w-8`,children:(0,L.jsx)(xf,{className:`wcpos:w-5 wcpos:h-5 wcpos:text-gray-400 wcpos:fill-current`})}),(0,L.jsx)(X,{className:`wcpos:whitespace-nowrap wcpos:text-center`,children:(0,L.jsx)(`input`,{type:`radio`,value:t.id,checked:r?.default_gateway===t.id,disabled:!t.enabled,className:``,onChange:()=>{i({default_gateway:t.id})}})}),(0,L.jsx)(X,{className:`wcpos:text-ellipsis wcpos:overflow-hidden wcpos:whitespace-nowrap`,children:(0,L.jsx)(`strong`,{children:t.title})}),(0,L.jsx)(X,{className:`wcpos:whitespace-nowrap`,children:t.id}),(0,L.jsx)(X,{className:`wcpos:whitespace-nowrap wcpos:text-center`,children:(0,L.jsx)(Wa,{"aria-label":t.title,checked:t.enabled,onChange:()=>{i({gateways:{[t.id]:{enabled:!t.enabled}}})},disabled:!a&&![`pos_cash`,`pos_card`].includes(t.id)})}),(0,L.jsx)(X,{className:`wcpos:whitespace-nowrap`,children:(0,L.jsx)(bf,{selectedStatus:t.order_status||`wc-completed`,onChange:e=>{i({gateways:{[t.id]:{order_status:e}}})},disabled:!a&&![`pos_cash`,`pos_card`].includes(t.id)})}),(0,L.jsx)(X,{className:`wcpos:whitespace-nowrap wcpos:text-right`,children:(0,L.jsxs)(co,{label:t.title,trigger:(0,L.jsx)(`span`,{className:(0,U.default)(`wcpos:inline-flex wcpos:items-center wcpos:justify-center wcpos:rounded-md wcpos:border wcpos:border-gray-300 wcpos:bg-white wcpos:px-2 wcpos:py-1.5 wcpos:text-gray-700 wcpos:hover:bg-gray-50`,!a&&![`pos_cash`,`pos_card`].includes(t.id)&&`wcpos:opacity-50 wcpos:cursor-not-allowed wcpos:pointer-events-none`),"aria-label":$(`common.settings`),children:(0,L.jsx)(Sf,{className:`wcpos:w-4 wcpos:h-4 wcpos:fill-current`})}),children:[(0,L.jsx)(lo,{onSelect:()=>o(t),disabled:!a&&![`pos_cash`,`pos_card`].includes(t.id),children:$(`common.pos_settings`)}),![`pos_cash`,`pos_card`].includes(t.id)&&(0,L.jsx)(lo,{href:`admin.php?page=wc-settings&tab=checkout§ion=${t.id}`,children:$(`common.woocommerce_settings`)})]})})]})}function Mf(){let{data:t,mutate:n}=Mu(`payment-gateways`),[i,a]=e.useState(!1),o=e.useRef(null),s=t?.pro_enabled,c=(0,r.sortBy)(t?.gateways,[`order`,`id`]);e.useEffect(()=>cf({onDrop:({source:e,location:t})=>{let i=t.current.dropTargets[0];if(!i)return;let a=e.data.index,o=i.data.index,s=hf(i.data),l=vf({list:c,startIndex:a,indexOfTarget:o,closestEdgeOfTarget:s,axis:`vertical`}).map((e,t)=>({...e,order:t}));n({gateways:(0,r.keyBy)(l,`id`)})}}),[c,n]),e.useEffect(()=>{s||Tf(`checkout_gateways`)},[s]);let l=e.useCallback(e=>{o.current=e,a(!0)},[]);return(0,L.jsxs)(L.Fragment,{children:[s?``:(0,L.jsx)(`div`,{className:`wcpos:pb-5`,children:(0,L.jsxs)(Hl,{status:`info`,isDismissible:!1,children:[$(`checkout.enable_pro_gateways`),` `,(0,L.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>Ef(`checkout_gateways`,`https://wcpos.com/pro`),children:$(`common.upgrade_to_pro`)}),`.`]})}),(0,L.jsxs)(Lo,{children:[(0,L.jsx)(Ro,{children:(0,L.jsxs)(Bo,{children:[(0,L.jsx)(Y,{scope:`col`}),(0,L.jsx)(Y,{scope:`col`,className:`wcpos:text-center`,"data-testid":`gateways-th-default`,children:$(`common.default`)}),(0,L.jsx)(Y,{scope:`col`,"data-testid":`gateways-th-gateway`,children:$(`common.gateway`)}),(0,L.jsx)(Y,{scope:`col`,children:$(`checkout.gateway_id`)}),(0,L.jsx)(Y,{scope:`col`,className:`wcpos:text-center`,"data-testid":`gateways-th-enabled`,children:$(`common.enabled`)}),(0,L.jsx)(Y,{scope:`col`,children:$(`checkout.order_status`)}),(0,L.jsx)(Y,{scope:`col`})]})}),(0,L.jsx)(zo,{children:c.map((e,r)=>(0,L.jsx)(jf,{item:e,index:r,data:t,mutate:n,proEnabled:!!s,onEditGateway:l},e.id))})]}),i&&o.current&&(0,L.jsx)(yf,{gateway:o.current,mutate:n,closeModal:()=>a(!1)})]})}function Nf({children:e,tip:t}){return(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[e,t&&(0,L.jsx)(oo,{text:t,children:(0,L.jsx)(`span`,{className:`wcpos:inline-flex wcpos:text-gray-300`,children:(0,L.jsx)(Yl,{className:`wcpos:h-4 wcpos:w-4`,fill:`currentColor`})})})]})}var Pf=[{key:`new_order`,label:`checkout.email_new_order`},{key:`cancelled_order`,label:`checkout.email_cancelled_order`},{key:`failed_order`,label:`checkout.email_failed_order`}],Ff=[{key:`customer_on_hold_order`,label:`checkout.email_on_hold_order`},{key:`customer_processing_order`,label:`checkout.email_processing_order`},{key:`customer_completed_order`,label:`checkout.email_completed_order`},{key:`customer_refunded_order`,label:`checkout.email_refunded_order`},{key:`customer_failed_order`,label:`checkout.email_failed_order`}],If=[{key:`new_order`,label:`checkout.email_new_order`}];function Lf({settingsKey:e,label:t,tip:n,emailTypes:r,data:i,mutate:a}){let o=i?.[e],s=o?.enabled??!1;return(0,L.jsxs)(q,{children:[(0,L.jsx)(Nf,{tip:n,children:(0,L.jsx)(Wa,{checked:s,onChange:t=>{a({[e]:{enabled:t}})},label:t})}),s&&(0,L.jsx)(`div`,{className:`wcpos:ml-12 wcpos:mt-2 wcpos:flex wcpos:flex-col wcpos:gap-2`,children:r.map(({key:t,label:n})=>(0,L.jsx)(Ga,{checked:o?.[t]??!0,onChange:n=>{a({[e]:{[t]:n.target.checked}})},label:$(n)},t))})]})}function Rf(){let{data:t,mutate:n}=Mu(`checkout`);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(bo,{children:[(0,L.jsx)(Lf,{settingsKey:`admin_emails`,label:$(`checkout.admin_emails`),tip:$(`checkout.admin_emails_tip`),emailTypes:Pf,data:t,mutate:n}),(0,L.jsx)(Lf,{settingsKey:`customer_emails`,label:$(`checkout.customer_emails`),tip:$(`checkout.customer_emails_tip`),emailTypes:Ff,data:t,mutate:n}),(0,L.jsx)(Lf,{settingsKey:`cashier_emails`,label:$(`checkout.cashier_emails`),tip:$(`checkout.cashier_emails_tip`),emailTypes:If,data:t,mutate:n})]}),(0,L.jsxs)(`div`,{className:`wcpos:px-4 wcpos:pb-5`,children:[(0,L.jsx)(`h2`,{className:`wcpos:text-base`,children:$(`checkout.gateways`)}),(0,L.jsx)(`p`,{children:$(`checkout.gateways_description`)}),(0,L.jsx)(Ba,{FallbackComponent:Ul,children:(0,L.jsx)(e.Suspense,{fallback:(0,L.jsx)(wu,{rows:3}),children:(0,L.jsx)(Mf,{})})})]})]})}var zf={printnode:{label:`PrintNode`,badge:{mark:`PN`,className:`wcpos:bg-teal-600 wcpos:text-white`},isPolling:!1,pollEndpoint:null,templateEngines:`all`},"star-online":{label:`Star Online`,badge:{mark:`☆`,className:`wcpos:bg-indigo-600 wcpos:text-white`},isPolling:!1,pollEndpoint:null,templateEngines:`thermal`},"star-cloudprnt":{label:`Star CloudPRNT`,badge:{mark:`★`,className:`wcpos:bg-blue-500 wcpos:text-white`},isPolling:!0,pollEndpoint:`cloudprnt`,templateEngines:`thermal`},"epson-sdp":{label:`Epson Server Direct Print`,badge:{mark:`E`,className:`wcpos:bg-blue-900 wcpos:text-white`},isPolling:!0,pollEndpoint:`epson-sdp`,templateEngines:`thermal`}};function Bf(e,t){return zf[t].templateEngines===`all`?e:e.filter(e=>e.engine===zf[t].templateEngines)}var Vf=[`printnode`,`star-online`,`star-cloudprnt`,`epson-sdp`];function Hf(e){switch(e){case`star-online`:return $(`cloud_print.choice_star_online_desc`,`A Star printer linked to your stario.online account. Examples: mC-Print3, TSP143IV, mC-Label3.`);case`star-cloudprnt`:return $(`cloud_print.choice_star_desc`,`Star printer with CloudPRNT built in (mC-Print, TSP143IV…)`);case`epson-sdp`:return $(`cloud_print.choice_epson_desc`,`Epson TM printer with Server Direct Print support`);default:return $(`cloud_print.choice_printnode_desc`,`Use a regular USB / network thermal printer through a PrintNode account`)}}function Uf(e){switch(e){case`printnode`:return $(`cloud_print.best_printnode`,`Best if you have an ordinary USB or network receipt printer (not a cloud printer) and can run the small PrintNode app on a computer at the store.`);case`star-online`:return $(`cloud_print.best_star_online`,`Best if you have a Star printer and a stario.online account — Star's cloud handles delivery for you.`);case`star-cloudprnt`:return $(`cloud_print.best_star_direct`,`Best if you have a Star printer and want a free connection with no third-party account — the printer talks to your store directly.`);default:return $(`cloud_print.best_epson`,`Best if you have an Epson "intelligent" TM printer (TM-T88VI/VII, TM-m30III, TM-i series).`)}}function Wf(){return window.wpApiSettings?.root||`${window.location.origin}/wp-json/`}function Gf(e,t,n,r){let i=zf[e].pollEndpoint,a=`${encodeURIComponent(t)}/${n}`;if(r)return`${r.replace(/\/$/,``)}/${a}/${i}`;let o=`${Wf()}wcpos/v1/print-jobs/${i}/${a}`;return`${o}${o.includes(`?`)?`&`:`?`}wcpos=1`}function Kf(e,t,n,r){return Gf(e,t,encodeURIComponent(n),r)}function qf(e,t,n){return Gf(e,t,`••••`,n)}function Jf({label:t,help:n,value:r,copyValue:i,valueTestId:a,copyTestId:o}){let[s,c]=e.useState(!1),l=e.useCallback(()=>{i&&(navigator.clipboard?.writeText(i),c(!0),window.setTimeout(()=>c(!1),1500))},[i]);return(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-baseline wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:t}),n&&(0,L.jsxs)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:[`— `,n]})]}),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,L.jsx)(`code`,{"data-testid":a,className:`wcpos:min-w-0 wcpos:flex-1 wcpos:overflow-x-auto wcpos:whitespace-nowrap wcpos:rounded wcpos:bg-gray-100 wcpos:px-2 wcpos:py-1 wcpos:text-xs wcpos:text-gray-900`,children:r}),i&&(0,L.jsx)(W,{variant:`outline`,onClick:l,"data-testid":o,"aria-label":$(`cloud_print.copy`,`Copy`),children:s?$(`cloud_print.copied`,`Copied to clipboard`):$(`cloud_print.copy`,`Copy`)})]})]})}function Yf(){return(0,L.jsx)(`p`,{className:`wcpos:text-xs`,"data-testid":`wizard-relay-docs-note`,children:(0,L.jsxs)(`a`,{href:`https://docs.wcpos.com/receipts/cloud-printing`,target:`_blank`,rel:`noopener noreferrer`,className:`wcpos:inline-flex wcpos:items-center wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,L.jsx)(Jl,{fill:`currentColor`})}),$(`cloud_print.relay_docs_note`,`For more information on why we're using a relay server.`),(0,L.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})})}function Xf({url:e,copyable:t}){return(0,L.jsxs)(`details`,{className:`wcpos:mt-1`,"data-testid":`wizard-direct-disclosure`,children:[(0,L.jsx)(`summary`,{className:`wcpos:cursor-pointer wcpos:text-xs wcpos:text-gray-500`,children:$(`cloud_print.advanced_direct`,`Advanced: connect directly to this site (no relay)`)}),(0,L.jsxs)(`div`,{className:`wcpos:mt-2 wcpos:flex wcpos:flex-col wcpos:gap-2`,children:[(0,L.jsx)(`p`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`cloud_print.direct_url_help`,`The relay exists because many printers can't connect to modern hosting. Only connect directly if you'd rather not route print jobs through a relay — some printers can't reach this site and will stay stuck on "Waiting for printer".`)}),(0,L.jsx)(Jf,{label:$(`cloud_print.direct_url`,`Direct URL`),value:e,copyValue:t?e:void 0,valueTestId:`wizard-direct-url`,copyTestId:`wizard-copy-direct-url`})]})]})}function Zf({open:t,mode:n,setupPrinter:r,onClose:i,onCreate:a,fetchPrintNodePrinters:o,fetchStarDevices:s,relay:c}){let[l,u]=e.useState(0),[d,f]=e.useState(null),[p,m]=e.useState(``),[h,g]=e.useState(``),[_,v]=e.useState(``),[y,b]=e.useState(``),[x,S]=e.useState(!1),[C,w]=e.useState(null),[T,E]=e.useState(null),[D,O]=e.useState(null),[k,A]=e.useState(!1),[j,M]=e.useState(null),[N,ee]=e.useState(null),[te,P]=e.useState(!1),[ne,re]=e.useState(null),ie=e.useCallback(()=>{g(``),v(``),b(``),S(!1),w(null),E(null),O(null),A(!1),M(null),ee(null),P(!1),re(null)},[]),ae=e.useRef(d);e.useEffect(()=>{if(!t){ae.current=d;return}ae.current!==d&&(ie(),ae.current=d)},[t,d,ie]);let oe=async()=>{if(o){A(!0),M(null);try{let e=await o(h.trim());O(e),v(t=>e.some(e=>String(e.id)===t)?t:``),e.length===0&&M($(`cloud_print.printnode_no_printers`,`No printers found on this PrintNode account.`))}catch{O(null),M($(`cloud_print.printnode_fetch_failed`,`Couldn't list your PrintNode printers. Check the API key and that the desktop client is running.`))}finally{A(!1)}}},se=async()=>{if(s){P(!0),re(null);try{let e=await s(y.trim(),h.trim());ee(e),v(t=>e.some(e=>e.id===t)?t:``),e.length===0&&re($(`cloud_print.star_online_no_devices`,`No devices found in this Star Online group.`))}catch{ee(null),re($(`cloud_print.star_online_fetch_failed`,`Couldn't list your Star Online devices. Check the CloudPRNT URL and API key.`))}finally{P(!1)}}},F=e.useRef(!1);if(e.useEffect(()=>{t&&!F.current&&(n===`setup`&&r?(f(r.provider),u(2)):(f(null),u(0)),m(``),ie()),F.current=t},[t,n,ie,r]),!t)return null;let ce=d===`printnode`,le=d===`star-online`,ue=p.trim(),de=ue!==``&&(!ce||h.trim()!==``&&_.trim()!==``)&&(!le||h.trim()!==``&&y.trim()!==``&&_.trim()!==``),fe=async()=>{if(!d)return;let e={name:ue,provider:d};ce&&(e.printnode_api_key=h.trim(),e.printnode_printer_id=Number(_.trim())),le&&(e.star_api_key=h.trim(),e.star_cloudprnt_url=y.trim(),e.star_device_id=_.trim()),S(!0),w(null);try{let t=await a(e);E(t),u(2)}catch{w($(`cloud_print.create_failed`,`Couldn't create the printer. Please try again.`))}finally{S(!1)}},pe=l===2?$(`cloud_print.connect_title`,`Connect your printer`):$(`cloud_print.add_title`,`Add a cloud printer`),me=n===`setup`?r??null:T?.printer??null,I=n===`setup`&&r?r.provider:d,he=I?zf[I].isPolling:!1;return(0,L.jsx)(ao,{open:t,onClose:()=>i(),title:pe,className:`wcpos:max-w-xl`,children:(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-4`,children:[C&&(0,L.jsx)(go,{status:`error`,isDismissible:!1,children:(0,L.jsx)(`span`,{"data-testid":`wizard-error`,children:C})}),l===0&&(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-2`,children:[(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700`,children:$(`cloud_print.step_provider_q`,`What kind of printer are you connecting?`)}),Vf.map(e=>{let t=zf[e],n=d===e;return(0,L.jsxs)(`button`,{type:`button`,"data-testid":`provider-choice-${e}`,"aria-pressed":n,onClick:()=>f(e),className:`wcpos:flex wcpos:items-start wcpos:gap-3 wcpos:rounded-md wcpos:border wcpos:p-3 wcpos:text-left wcpos:transition-colors `+(n?`wcpos:border-wp-admin-theme-color wcpos:bg-wp-admin-theme-color-lightest`:`wcpos:border-gray-300 wcpos:hover:bg-gray-50`),children:[(0,L.jsx)(`span`,{className:t.badge.className+` wcpos:flex wcpos:size-8 wcpos:shrink-0 wcpos:items-center wcpos:justify-center wcpos:rounded wcpos:text-sm wcpos:font-semibold`,"aria-hidden":`true`,children:t.badge.mark}),(0,L.jsxs)(`span`,{className:`wcpos:min-w-0`,children:[(0,L.jsx)(`span`,{className:`wcpos:block wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900`,children:t.label}),(0,L.jsx)(`span`,{className:`wcpos:block wcpos:text-xs wcpos:text-gray-500`,children:Hf(e)}),(0,L.jsx)(`span`,{className:`wcpos:mt-1 wcpos:block wcpos:text-xs wcpos:text-gray-600`,children:Uf(e)})]})]},e)})]}),l===1&&(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-3`,children:[(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printer_name`,`Printer name`)}),(0,L.jsx)(G,{"data-testid":`wizard-name-input`,value:p,placeholder:$(`cloud_print.printer_name_ph`,`e.g. Kitchen printer`),onChange:e=>m(e.target.value)}),(0,L.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`cloud_print.printer_name_help`,`A friendly name so you can recognise it later. The technical ID is created for you.`)})]}),ce&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printnode_api_key`,`PrintNode API key`)}),(0,L.jsx)(G,{"data-testid":`wizard-printnode-api-key`,value:h,placeholder:$(`cloud_print.printnode_api_key_ph`,`Paste your PrintNode account API key`),onChange:e=>g(e.target.value)}),o&&(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1 wcpos:pt-1`,children:[(0,L.jsx)(W,{variant:`outline`,"data-testid":`wizard-printnode-fetch`,disabled:h.trim()===``||k,loading:k,onClick:oe,children:$(`cloud_print.printnode_fetch`,`Fetch my printers`)}),j&&(0,L.jsx)(`span`,{"data-testid":`wizard-printnode-fetch-error`,className:`wcpos:text-xs wcpos:text-red-600`,children:j})]})]}),D&&D.length>0&&(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printnode_pick_printer`,`Choose a printer`)}),(0,L.jsxs)(`select`,{"data-testid":`wizard-printnode-printer-select`,value:_,onChange:e=>v(e.target.value),className:`wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:px-2 wcpos:py-1 wcpos:text-sm`,children:[(0,L.jsx)(`option`,{value:``,children:$(`cloud_print.printnode_pick_placeholder`,`Select a printer…`)}),D.map(e=>(0,L.jsxs)(`option`,{value:String(e.id),children:[e.name,` (`,e.state,`)`]},e.id))]})]}),(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printnode_printer_id`,`PrintNode printer ID`)}),(0,L.jsx)(G,{"data-testid":`wizard-printnode-printer-id`,type:`number`,value:_,onChange:e=>v(e.target.value)})]}),(0,L.jsx)(go,{status:`info`,isDismissible:!1,children:$(`cloud_print.printnode_note`,`Install the small PrintNode client on a computer next to the printer, then paste your account's API key. We'll list that account's printers next.`)})]}),le&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_cloudprnt_url`,`CloudPRNT URL`)}),(0,L.jsx)(G,{"data-testid":`wizard-star-cloudprnt-url`,value:y,placeholder:`https://eu-device.stario.online/cloudprnt/your-group`,onChange:e=>b(e.target.value)})]}),(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_api_key`,`Star Online API key`)}),(0,L.jsx)(G,{"data-testid":`wizard-star-api-key`,value:h,placeholder:$(`cloud_print.star_api_key_ph`,`Paste your Star-Api-Key`),onChange:e=>g(e.target.value)}),s&&(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1 wcpos:pt-1`,children:[(0,L.jsx)(W,{variant:`outline`,"data-testid":`wizard-star-fetch`,disabled:h.trim()===``||y.trim()===``||te,loading:te,onClick:se,children:$(`cloud_print.star_fetch`,`Fetch my devices`)}),ne&&(0,L.jsx)(`span`,{"data-testid":`wizard-star-fetch-error`,className:`wcpos:text-xs wcpos:text-red-600`,children:ne})]})]}),N&&N.length>0&&(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_pick_device`,`Choose a device`)}),(0,L.jsxs)(`select`,{"data-testid":`wizard-star-device-select`,value:_,onChange:e=>v(e.target.value),className:`wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:px-2 wcpos:py-1 wcpos:text-sm`,children:[(0,L.jsx)(`option`,{value:``,children:$(`cloud_print.star_pick_placeholder`,`Select a device…`)}),N.map(e=>(0,L.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.state,`)`]},e.id))]})]}),(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_device_id`,`AccessIdentifier`)}),(0,L.jsx)(G,{"data-testid":`wizard-star-device-id`,value:_,onChange:e=>v(e.target.value)})]})]})]}),l===2&&I&&(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-3`,children:he?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{children:(0,L.jsx)(J,{variant:`success`,icon:`✓`,children:$(`cloud_print.created`,`Printer created`)})}),n===`setup`?(0,L.jsx)(go,{status:`info`,isDismissible:!1,children:$(`cloud_print.poll_url_lost`,`The full address (with its secret token) was shown only once when this printer was created and can't be displayed again. To get a new one, remove and re-add the printer.`)}):(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700`,children:$(`cloud_print.poll_url_once_intro`,`Copy this address into your printer's setup screen. It contains a secret token and is shown in full only once.`)}),(()=>{let e=me;if(!e)return null;let t=c?.enabled&&c.printer_base_url?c.printer_base_url:void 0;if(n===`setup`)return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Jf,{label:$(`cloud_print.poll_url`,`Poll URL`),help:$(`cloud_print.poll_url_help`,`paste into the printer's "server URL"`),value:qf(I,e.id,t),valueTestId:`wizard-poll-url`,copyTestId:`wizard-copy-url`}),t&&(0,L.jsx)(Yf,{}),t&&(0,L.jsx)(Xf,{url:qf(I,e.id),copyable:!1})]});let r=T?.token??``;if(!r)return(0,L.jsx)(go,{status:`warning`,isDismissible:!1,children:$(`cloud_print.token_missing`,`This printer was created, but no setup token was returned. Remove and re-add it to get one.`)});let i=Kf(I,e.id,r,t);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Jf,{label:$(`cloud_print.poll_url`,`Poll URL`),help:$(`cloud_print.poll_url_help`,`paste into the printer's "server URL"`),value:i,copyValue:i,valueTestId:`wizard-poll-url`,copyTestId:`wizard-copy-url`}),t&&(0,L.jsx)(Yf,{}),t&&(0,L.jsx)(Xf,{url:Kf(I,e.id,r),copyable:!0})]})})()]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{children:(0,L.jsx)(J,{variant:`success`,icon:`✓`,children:$(`cloud_print.linked_provider`,`Linked to {provider}`,{provider:zf[I].label})})}),(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700`,children:I===`star-online`?$(`cloud_print.star_online_delivery`,`No URLs or tokens to copy — Star Online handles delivery.`):$(`cloud_print.printnode_delivery`,`No URLs or tokens to copy — PrintNode handles delivery.`)})]})}),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:justify-end wcpos:gap-2 wcpos:pt-2`,children:[l===1&&(0,L.jsx)(W,{variant:`secondary`,"data-testid":`wizard-back`,onClick:()=>u(0),children:$(`common.back`,`Back`)}),l===0&&(0,L.jsx)(W,{variant:`primary`,"data-testid":`wizard-continue`,disabled:!d,onClick:()=>u(1),children:$(`common.continue`,`Continue`)}),l===1&&(0,L.jsx)(W,{variant:`primary`,"data-testid":`wizard-continue`,disabled:!de,loading:x,onClick:fe,children:$(`common.continue`,`Continue`)}),l===2&&(0,L.jsx)(W,{variant:`primary`,"data-testid":`wizard-done`,onClick:()=>i(),children:$(`common.done`,`Done`)})]})]})})}function Qf(e){return e.store_id&&e.store_id>0?`store:${e.store_id}`:e.scope}function $f(e,t){let n=[{value:`every`,label:$(`cloud_print.scope_every`,`every order`)},{value:`pos`,label:$(`cloud_print.scope_pos`,`every in-store (POS) order`)},{value:`online`,label:$(`cloud_print.scope_online`,`every online order`)}],r=e.map(e=>({value:`store:${e.id}`,label:$(`cloud_print.scope_store`,`orders for {name}`,{name:e.name})}));return t.store_id&&t.store_id>0&&!e.some(e=>e.id===t.store_id)&&r.push({value:`store:${t.store_id}`,label:$(`cloud_print.scope_store_unknown`,`Unknown store (#{id})`,{id:t.store_id}),disabled:!0}),[...n,...r]}function ep(e){if(e.startsWith(`store:`)){let t=Number.parseInt(e.slice(6),10);return{store_id:Number.isFinite(t)?t:0,scope:`every`}}return{store_id:0,scope:e}}var tp=`edit.php?post_type=wcpos_template`;function np(e,t){return e.find(e=>String(e.value)===String(t))?.label.length??0}function rp(e,t){return{width:`calc(${Math.max(np(e,t),1)}ch + 3.5rem)`}}function ip({printers:e,assignments:t,templateOptions:n,storeOptions:r=[],onChange:i}){let a=e.map(e=>({value:e.id,label:e.name})),o=t=>e.find(e=>e.id===t)?.provider??`printnode`,s=e=>Bf(n,o(e)),c=(e,n)=>{i(t.map((t,r)=>r===e?{...t,...n}:t))},l=()=>{let n=e[0];if(!n)return;let r=s(n.id);i([...t,{printer_id:n.id,store_id:0,scope:`every`,template_id:r[0]?.value??``}])},u=e=>i(t.filter((t,n)=>n!==e));return(0,L.jsxs)(`div`,{className:`wcpos:mt-4 wcpos:flex wcpos:flex-col wcpos:gap-3`,children:[(0,L.jsxs)(yo,{status:`info`,children:[`💡`,` `,$(`cloud_print.rules_tip`,`This is optional — leave it empty to print receipts only manually from the POS.`)]}),(0,L.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:[$(`cloud_print.rules_subline_pre`,`Each rule prints the chosen template automatically when an order matches. Templates come from `),(0,L.jsx)(`a`,{href:tp,target:`_blank`,rel:`noreferrer`,children:$(`cloud_print.templates_link`,`POS › Templates`)}),$(`cloud_print.rules_subline_post`,`. More than one rule can run for the same order.`)]}),t.length===0?(0,L.jsx)(`p`,{"data-testid":`rules-empty`,className:`wcpos:text-sm wcpos:text-gray-500`,children:$(`cloud_print.no_rules`,`No rules yet.`)}):(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-2`,children:t.map((e,t)=>{let n=$f(r,e),i=Qf(e);return(0,L.jsxs)(`div`,{"data-testid":`rule-${t}`,className:`wcpos:flex wcpos:flex-wrap wcpos:items-center wcpos:gap-x-1.5 wcpos:gap-y-1 wcpos:text-sm`,children:[(0,L.jsx)(`span`,{children:$(`cloud_print.rule_print`,`Automatically print`)}),(0,L.jsx)(qa,{inline:!0,"data-testid":`rule-scope-${t}`,"aria-label":$(`cloud_print.rule_scope_label`,`Which orders to print`),className:`wcpos:max-w-full`,style:rp(n,i),value:i,options:n,onChange:({value:e})=>c(t,ep(String(e)))}),(0,L.jsx)(`span`,{children:$(`cloud_print.rule_to`,`to`)}),(0,L.jsx)(qa,{inline:!0,"data-testid":`rule-printer-${t}`,"aria-label":$(`cloud_print.rule_printer_label`,`Printer`),className:`wcpos:max-w-full`,style:rp(a,e.printer_id),value:e.printer_id,options:a,onChange:({value:e})=>c(t,{printer_id:String(e)})}),(0,L.jsx)(`span`,{children:$(`cloud_print.rule_using`,`using the`)}),(0,L.jsx)(qa,{inline:!0,"data-testid":`rule-template-${t}`,"aria-label":$(`cloud_print.rule_template_label`,`Receipt template`),className:`wcpos:max-w-full`,style:rp(s(e.printer_id),e.template_id),value:e.template_id,options:s(e.printer_id),onChange:({value:e})=>c(t,{template_id:String(e)})}),(0,L.jsx)(`span`,{children:$(`cloud_print.rule_template_suffix`,`template.`)}),(0,L.jsx)(W,{variant:`ghost-destructive`,"data-testid":`rule-remove-${t}`,className:`wcpos:ml-1`,onClick:()=>u(t),children:$(`common.remove`,`Remove`)})]},t)})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(W,{variant:`outline`,"data-testid":`rules-add`,disabled:e.length===0,onClick:l,children:$(`cloud_print.add_rule`,`+ Add rule`)})})]})}async function ap(e,t=i.default){return(await t({path:`wcpos/v1/printnode/printers?wcpos=1`,method:`POST`,data:{api_key:e}})).printers??[]}async function op(e,t,n=i.default){return(await n({path:`wcpos/v1/star-online/devices?wcpos=1`,method:`POST`,data:{cloudprnt_url:e,api_key:t}})).devices??[]}var sp=`wcpos/v1/print-jobs/queue`,cp=`print-queue`,lp=20,up=3e4,dp=600,fp={pending:{label:()=>$(`cloud_print.queue_status_waiting`,`Waiting`),variant:`warning`},claimed:{label:()=>$(`cloud_print.queue_status_printing`,`Printing`),variant:`info`},printed:{label:()=>$(`cloud_print.queue_status_printed`,`Printed`),variant:`success`},failed:{label:()=>$(`cloud_print.queue_status_failed`,`Failed`),variant:`error`},cancelled:{label:()=>$(`cloud_print.queue_status_cancelled`,`Cancelled`),variant:`neutral`}};function pp(e){if(!e||e.startsWith(`0000`))return null;let t=new Date(`${e.replace(` `,`T`)}Z`);return Number.isNaN(t.getTime())?null:t}function mp(e){let t=Math.max(0,Math.round((Date.now()-e.getTime())/1e3)),n=new Intl.RelativeTimeFormat(void 0,{numeric:`auto`});return t<60?n.format(-t,`second`):t<3600?n.format(-Math.round(t/60),`minute`):t<86400?n.format(-Math.round(t/3600),`hour`):n.format(-Math.round(t/86400),`day`)}function hp(e){let t=pp(e);return t?mp(t):`—`}function gp(e){return e.polling===!1||e.pending===0?!1:e.last_seen===0||Date.now()/1e3-e.last_seen>dp}function _p(){let t=We(),[n,r]=e.useState(``),[a,o]=e.useState(`active`),[s,c]=e.useState(1),[l,u]=e.useState(new Set),{data:d}=ot({queryKey:[cp,n,a,s],queryFn:()=>(0,i.default)({path:`${sp}?wcpos=1&per_page=${lp}&page=${s}${n?`&printer_id=${encodeURIComponent(n)}`:``}${a?`&status=${encodeURIComponent(a)}`:``}`,method:`GET`}),refetchInterval:up}),{addSnackbar:f}=Io(),p=()=>{u(new Set),t.invalidateQueries({queryKey:[cp]})},m=()=>{f({message:$(`cloud_print.queue_action_failed`,`That didn't work — the queue is unchanged. Try again.`),status:`error`})},h=ct({mutationFn:e=>(0,i.default)({path:`${sp}/cancel?wcpos=1`,method:`POST`,data:e}),onSuccess:p,onError:m}),g=ct({mutationFn:e=>(0,i.default)({path:`wcpos/v1/print-jobs/${e}/reprint?wcpos=1`,method:`POST`}),onSuccess:p,onError:m}),_=d?.total;if(e.useEffect(()=>{if(typeof _!=`number`)return;let e=Math.max(1,Math.ceil(_/lp));s>e&&c(e)},[_,s]),!d||!Array.isArray(d.jobs)||!d.summary)return null;let{jobs:v,total:y,summary:b}=d,x=new Map(b.printers.map(e=>[e.printer_id,e.name])),S=b.printers.filter(gp),C=b.counts,w=Object.values(C).some(e=>e>0)||y>0,T=v.map(e=>e.id),E=T.length>0&&T.every(e=>l.has(e)),D=()=>{u(E?new Set:new Set(T))},O=e=>{let t=new Set(l);t.has(e)?t.delete(e):t.add(e),u(t)},k=v.filter(e=>l.has(e.id)&&(e.status===`pending`||e.status===`claimed`)).map(e=>e.id),A=Math.max(1,Math.ceil(y/lp)),j=(C.pending??0)+(C.claimed??0)+(C.failed??0),M=[{label:$(`cloud_print.queue_status_active`,`Needs attention ({count})`,{count:String(j)}),value:`active`},{label:$(`cloud_print.queue_all_statuses`,`All statuses`),value:``},...[`pending`,`claimed`,`failed`,`printed`,`cancelled`].map(e=>({label:`${fp[e].label()} (${C[e]??0})`,value:e}))],N=[{label:$(`cloud_print.queue_all_printers`,`All printers`),value:``},...b.printers.map(e=>({label:e.name,value:e.printer_id}))];return(0,L.jsxs)(bo,{title:$(`cloud_print.queue_title`,`Print queue`),description:$(`cloud_print.queue_description`,`Jobs waiting to be fetched by your printers.`),children:[S.map(e=>(0,L.jsx)(go,{status:`warning`,isDismissible:!1,children:(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:flex-wrap`,"data-testid":`queue-stale-${e.printer_id}`,children:[(0,L.jsx)(`span`,{children:e.last_seen===0?$(`cloud_print.queue_stale_never`,`{printer} has never fetched a job. {count} receipts are waiting — check the printer is on and its Server URL is set.`,{printer:e.name,count:String(e.pending)}):$(`cloud_print.queue_stale`,`{printer} last fetched jobs {ago}. {count} receipts are waiting — check the printer is on and connected.`,{printer:e.name,ago:mp(new Date(e.last_seen*1e3)),count:String(e.pending)})}),(0,L.jsx)(W,{variant:`ghost-destructive`,"data-testid":`queue-cancel-all-${e.printer_id}`,onClick:()=>h.mutate({printer_id:e.printer_id}),disabled:h.isPending,children:$(`cloud_print.queue_cancel_all`,`Cancel all {count}`,{count:String(e.pending)})})]})},e.printer_id)),w?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2 wcpos:flex-wrap`,children:[(0,L.jsx)(qa,{id:`wcpos-queue-printer-filter`,inline:!0,className:`wcpos:w-44 wcpos:max-w-full`,"aria-label":$(`cloud_print.queue_filter_printer`,`Filter by printer`),options:N,value:n,onChange:e=>{r(String(e.value)),c(1),u(new Set)}}),(0,L.jsx)(qa,{id:`wcpos-queue-status-filter`,inline:!0,className:`wcpos:w-52 wcpos:max-w-full`,"aria-label":$(`cloud_print.queue_filter_status`,`Filter by status`),options:M,value:a,onChange:e=>{o(String(e.value)),c(1),u(new Set)}}),(0,L.jsx)(`div`,{className:`wcpos:flex-1`}),k.length>0&&(0,L.jsx)(W,{variant:`ghost-destructive`,"data-testid":`queue-cancel-selected`,onClick:()=>h.mutate({ids:k}),disabled:h.isPending,children:$(`cloud_print.queue_cancel_selected`,`Cancel selected ({count})`,{count:String(k.length)})})]}),v.length===0?(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,"data-testid":`queue-no-matches`,children:$(`cloud_print.queue_no_matches`,`No jobs match this filter.`)}):(0,L.jsx)(`div`,{className:`wcpos:overflow-x-auto`,children:(0,L.jsxs)(Lo,{"data-testid":`queue-table`,className:`wcpos:min-w-[36rem]`,children:[(0,L.jsx)(Ro,{children:(0,L.jsxs)(Bo,{children:[(0,L.jsx)(Y,{className:`wcpos:w-8`,children:(0,L.jsx)(`input`,{type:`checkbox`,checked:E,onChange:D,"aria-label":$(`cloud_print.queue_select_all`,`Select all on this page`),"data-testid":`queue-select-all`})}),(0,L.jsx)(Y,{className:`wcpos:w-28`,children:$(`cloud_print.queue_col_order`,`Order`)}),(0,L.jsx)(Y,{children:$(`cloud_print.queue_col_printer`,`Printer`)}),(0,L.jsx)(Y,{className:`wcpos:w-28`,children:$(`cloud_print.queue_col_status`,`Status`)}),(0,L.jsx)(Y,{className:`wcpos:w-32`,children:$(`cloud_print.queue_col_waiting`,`Waiting`)}),(0,L.jsx)(Y,{className:`wcpos:w-24`})]})}),(0,L.jsx)(zo,{children:v.map(e=>{let t=fp[e.status]??fp.pending,n=e.status===`pending`||e.status===`claimed`?hp(e.created_gmt):`—`;return(0,L.jsxs)(Vo,{"data-testid":`queue-row-${e.id}`,children:[(0,L.jsx)(X,{children:(0,L.jsx)(`input`,{type:`checkbox`,checked:l.has(e.id),onChange:()=>O(e.id),"aria-label":$(`cloud_print.queue_select_job`,`Select job {id}`,{id:String(e.id)})})}),(0,L.jsx)(X,{children:e.order_edit_url?(0,L.jsxs)(`a`,{href:e.order_edit_url,target:`_blank`,rel:`noopener noreferrer`,children:[`#`,e.order_number??e.order_id]}):(0,L.jsx)(`span`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.queue_no_order`,`Job {id}`,{id:String(e.id)})})}),(0,L.jsx)(X,{children:x.get(e.printer_id)??e.printer_id}),(0,L.jsx)(X,{children:(0,L.jsx)(J,{variant:t.variant,shape:`pill`,size:`sm`,children:t.label()})}),(0,L.jsx)(X,{className:`wcpos:tabular-nums wcpos:text-gray-600`,children:n}),(0,L.jsxs)(X,{className:`wcpos:text-right`,children:[(e.status===`pending`||e.status===`claimed`)&&(0,L.jsx)(W,{variant:`ghost-destructive`,onClick:()=>h.mutate({ids:[e.id]}),disabled:h.isPending,"data-testid":`queue-cancel-${e.id}`,children:$(`cloud_print.queue_cancel`,`Cancel`)}),e.status===`failed`&&(0,L.jsx)(W,{variant:`text`,onClick:()=>g.mutate(e.id),disabled:g.isPending,"data-testid":`queue-retry-${e.id}`,children:$(`cloud_print.queue_retry`,`Retry`)})]})]},e.id)})})]})}),A>1&&(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-end wcpos:gap-3 wcpos:text-sm wcpos:text-gray-600`,children:[(0,L.jsx)(`span`,{"data-testid":`queue-page-info`,children:$(`cloud_print.queue_page_info`,`{from}–{to} of {total}`,{from:String((s-1)*lp+1),to:String(Math.min(s*lp,y)),total:String(y)})}),(0,L.jsx)(W,{variant:`outline`,onClick:()=>c(e=>Math.max(1,e-1)),disabled:s<=1,"aria-label":$(`common.previous`,`Previous`),children:`‹`}),(0,L.jsx)(W,{variant:`outline`,onClick:()=>c(e=>Math.min(A,e+1)),disabled:s>=A,"aria-label":$(`common.next`,`Next`),children:`›`})]})]}):(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,"data-testid":`queue-empty`,children:$(`cloud_print.queue_empty`,`No print jobs yet.`)})]})}var vp=`wcpos/v1/settings/cloud-print?wcpos=1`,yp=3e4;function bp(e,t){if(!t)switch(e){case`online`:return{variant:`success`,label:$(`cloud_print.status_online`,`Online`)};case`offline`:return{variant:`error`,label:$(`cloud_print.status_offline`,`Offline`)};default:return{variant:`info`,label:$(`cloud_print.status_unknown`,`Unknown`)}}switch(e){case`connected`:return{variant:`success`,label:$(`cloud_print.status_connected`,`Connected`)};case`waiting`:return{variant:`warning`,label:$(`cloud_print.status_waiting`,`Waiting for printer`)};case`blocked`:return{variant:`error`,label:$(`cloud_print.status_blocked`,`Blocked`)};default:return{variant:`error`,label:$(`cloud_print.status_offline`,`Offline`)}}}async function xp(){return await(0,i.default)({path:vp,method:`GET`})}var Sp=new Set,Cp,wp=!1;async function Tp(){if(!wp){wp=!0;try{let e=await xp();Sp.forEach(t=>t(e))}catch{}finally{wp=!1}}}function Ep(e){return Sp.add(e),Cp===void 0&&(Cp=window.setInterval(()=>{Tp()},yp)),()=>{Sp.delete(e),Sp.size===0&&Cp!==void 0&&(window.clearInterval(Cp),Cp=void 0)}}function Dp(t){let[n,r]=e.useState({status:t.status,statusDetail:t.status_detail});return e.useEffect(()=>(r({status:t.status,statusDetail:t.status_detail}),Ep(e=>{let n=e.printers.find(e=>e.id===t.id);r({status:n?.status,statusDetail:n?.status_detail})})),[t.id,t.status,t.status_detail]),n}function Op({printer:e}){let t=zf[e.provider],{status:n}=Dp(e),r=bp(n,t.isPolling);return(0,L.jsx)(J,{variant:r.variant,shape:`pill`,size:`sm`,"data-testid":`printer-card-status-${e.id}`,children:r.label})}function kp({label:e,testId:t}){return(0,L.jsx)(`span`,{className:`wcpos:inline-flex wcpos:items-center wcpos:justify-center wcpos:w-7 wcpos:h-7 wcpos:rounded-md wcpos:text-gray-500 wcpos:hover:bg-gray-100 wcpos:hover:text-gray-700 wcpos:cursor-pointer`,"data-testid":t,"aria-label":e,children:(0,L.jsx)(Sf,{className:`wcpos:w-4 wcpos:h-4 wcpos:fill-current`})})}function Ap({open:e,title:t,description:n,confirmLabel:r,cancelLabel:i,isSubmitting:a=!1,onConfirm:o,onClose:s}){return(0,L.jsx)(ao,{open:e,onClose:s,title:t,description:n,children:(0,L.jsxs)(`div`,{className:`wcpos:mt-4 wcpos:flex wcpos:justify-end wcpos:gap-2`,children:[(0,L.jsx)(W,{variant:`secondary`,onClick:()=>{s(!1)},disabled:a,children:i||$(`sessions.cancel`)}),(0,L.jsx)(W,{variant:`destructive`,onClick:o,disabled:a,children:r||$(`sessions.confirm`)})]})})}function jp(e){return e&&/^http-5/.test(e)?$(`cloud_print.blocked_site_error`,`WCPOS Cloud Print reached your site, but the site responded with a server error. Check your site health and error logs.`):$(`cloud_print.blocked_security`,`A security service (like Cloudflare or a firewall plugin) is blocking WCPOS Cloud Print, so receipts can't reach this printer. Allowlist the relay to restore printing — see wcpos.com/cloudprint.`)}function Mp(){return[{value:`pdf`,label:$(`cloud_print.format_pdf`,`PDF (recommended)`)},{value:`raw`,label:$(`cloud_print.format_raw`,`ESC/POS RAW — thermal templates only`)}]}var Np=[[`year`,31536e3],[`month`,2592e3],[`day`,86400],[`hour`,3600],[`minute`,60],[`second`,1]];function Pp(e,t){let n=Math.round(e-Date.now()/1e3),r=t?t.replace(/_/g,`-`):void 0,i;try{i=new Intl.RelativeTimeFormat(r,{numeric:`auto`})}catch{i=new Intl.RelativeTimeFormat(void 0,{numeric:`auto`})}let a=Math.abs(n);for(let[e,t]of Np)if(a>=t||e===`second`){let r=Math.round(n/t);return i.format(r,e)}return i.format(0,`second`)}function Fp(e){if(!e)return``;try{let t=new URL(e).pathname.match(/\/cloudprnt\/([^/]+)/);return t?decodeURIComponent(t[1]):``}catch{return``}}function Ip({printer:t,onRename:n,onRemove:r,onOpenSetup:a,onUpdate:o}){let{addSnackbar:s}=Io(),c=zf[t.provider],{status:l,statusDetail:u}=Dp(t),d=t.provider===`printnode`,f=t.provider===`star-online`,p=t.printnode_format??`pdf`,[m,h]=e.useState(t.name),[g,_]=e.useState(!1),[v,y]=e.useState(!1),b=e.useRef(t.name);e.useEffect(()=>{h(t.name),b.current=t.name},[t.name]);let x=e.useCallback(()=>{let e=m.trim();if(!e){h(t.name);return}e!==t.name&&e!==b.current&&(b.current=e,n(t.id,e))},[m,n,t.id,t.name]),S=e.useCallback(async()=>{_(!0);try{await(0,i.default)({path:`wcpos/v1/print-jobs/test?wcpos=1`,method:`POST`,data:{printer_id:t.id}}),s({message:$(`cloud_print.test_sent`,`Sent a test print to {name}.`,{name:t.name}),status:`success`})}catch(e){let t=typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:$(`cloud_print.test_failed`,`Test print failed.`);s({message:t,status:`error`})}finally{_(!1)}},[s,t.id,t.name]),C=t.last_seen==null?$(`cloud_print.never`,`never`):Pp(t.last_seen,zl.language||void 0);return(0,L.jsxs)(uo,{"data-testid":`printer-card-${t.id}`,children:[(0,L.jsxs)(uo.Body,{className:`wcpos:relative`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:gap-3`,children:[(0,L.jsx)(`span`,{className:c.badge.className+` wcpos:flex wcpos:size-8 wcpos:shrink-0 wcpos:items-center wcpos:justify-center wcpos:rounded wcpos:text-sm wcpos:font-semibold`,"aria-hidden":`true`,children:c.badge.mark}),(0,L.jsxs)(`div`,{className:`wcpos:min-w-0 wcpos:flex-1`,children:[(0,L.jsx)(`input`,{type:`text`,"data-testid":`printer-card-name-${t.id}`,value:m,onChange:e=>h(e.target.value),onBlur:x,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.target.blur(),x())},"aria-label":$(`cloud_print.printer_name`,`Printer name`),className:`wcpos:w-full wcpos:rounded wcpos:border wcpos:border-transparent wcpos:bg-transparent wcpos:px-1 wcpos:py-0.5 wcpos:pr-8 wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900 wcpos:hover:border-gray-300 wcpos:focus:border-wp-admin-theme-color wcpos:focus:bg-white wcpos:focus:outline-none`}),(0,L.jsx)(`div`,{className:`wcpos:px-1 wcpos:text-xs wcpos:text-gray-500`,children:c.label})]}),(0,L.jsxs)(co,{align:`end`,label:$(`cloud_print.printer_menu`,`Printer actions`),className:`wcpos:absolute wcpos:top-2 wcpos:right-2`,trigger:(0,L.jsx)(kp,{label:$(`cloud_print.printer_menu`,`Printer actions`),testId:`printer-card-menu-${t.id}`}),children:[(0,L.jsx)(lo,{onSelect:()=>a(t),children:$(`cloud_print.menu_setup`,`Setup & token`)}),(0,L.jsx)(lo,{destructive:!0,onSelect:()=>y(!0),children:$(`cloud_print.menu_remove`,`Remove printer`)})]})]}),(0,L.jsx)(`div`,{className:`wcpos:mt-2`,children:(0,L.jsx)(Op,{printer:t})}),l===`blocked`&&(0,L.jsx)(`p`,{"data-testid":`printer-card-blocked-${t.id}`,className:`wcpos:mt-2 wcpos:rounded wcpos:bg-red-50 wcpos:px-2 wcpos:py-1 wcpos:text-xs wcpos:text-red-700`,children:jp(u)}),(0,L.jsxs)(`dl`,{className:`wcpos:mt-3 wcpos:grid wcpos:grid-cols-[auto_1fr] wcpos:gap-x-3 wcpos:gap-y-1 wcpos:text-xs`,children:[(0,L.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.last_check_in`,`Last check-in`)}),(0,L.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-last-seen-${t.id}`,children:C}),(0,L.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.printer_id`,`Printer ID`)}),(0,L.jsxs)(`dd`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1 wcpos:text-gray-900`,children:[(0,L.jsx)(`code`,{className:`wcpos:rounded wcpos:bg-gray-100 wcpos:px-1 wcpos:py-0.5`,children:t.id}),(0,L.jsx)(oo,{text:$(`cloud_print.printer_id_tooltip`,`The printer's address in its setup URL. Created automatically and can't be changed — to rename, edit the name above; to change the ID, remove and re-add the printer.`),children:(0,L.jsx)(`span`,{"data-testid":`printer-card-id-info-${t.id}`,className:`wcpos:cursor-help wcpos:text-gray-400`,"aria-label":$(`cloud_print.printer_id`,`Printer ID`),children:`ⓘ`})})]}),f&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.star_device`,`Device`)}),(0,L.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-device-${t.id}`,children:t.star_client_type||zf[`star-online`].label}),(0,L.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.star_group`,`Group`)}),(0,L.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-group-${t.id}`,children:Fp(t.star_cloudprnt_url)||`—`}),(0,L.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.star_device_id`,`AccessIdentifier`)}),(0,L.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-device-id-${t.id}`,children:(0,L.jsx)(`code`,{className:`wcpos:rounded wcpos:bg-gray-100 wcpos:px-1 wcpos:py-0.5`,children:t.star_device_id})})]}),d&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.format`,`Print format`)}),(0,L.jsx)(`dd`,{className:`wcpos:text-gray-900`,children:(0,L.jsx)(qa,{"data-testid":`printer-card-format-${t.id}`,"aria-label":$(`cloud_print.format`,`Print format`),className:`wcpos:w-auto`,value:p,options:Mp(),onChange:({value:e})=>o(t.id,{printnode_format:e})})})]})]})]}),(0,L.jsx)(uo.Footer,{className:`wcpos:flex wcpos:justify-end`,children:(0,L.jsx)(W,{variant:`outline`,loading:g,disabled:g,onClick:S,"data-testid":`printer-card-test-${t.id}`,children:$(`cloud_print.test_print`,`Test print`)})}),(0,L.jsx)(Ap,{open:v,title:$(`cloud_print.remove_title`,`Remove printer?`),description:$(`cloud_print.remove_body`,`This printer will stop receiving jobs. You can add it again later.`),confirmLabel:$(`common.remove`,`Remove`),cancelLabel:$(`common.cancel`,`Cancel`),onConfirm:()=>{y(!1),r(t)},onClose:()=>y(!1)})]})}function Lp({children:e,className:t=``,...n}){return(0,L.jsx)(`div`,{className:`wcpos:grid wcpos:grid-cols-[repeat(auto-fill,minmax(min(100%,340px),1fr))] wcpos:gap-4 ${t}`,...n,children:e})}var Rp=`wcpos/v1/settings/cloud-print?wcpos=1`;function zp(){let e=We(),{data:t}=st({queryKey:[`cloud-print`],queryFn:()=>(0,i.default)({path:Rp,method:`GET`})});return{settings:t,save:ct({mutationFn:e=>(0,i.default)({path:Rp,method:`POST`,data:e}),onSuccess:t=>e.setQueryData([`cloud-print`],e=>({printers:t.printers,assignments:t.assignments,relay:t.relay??e?.relay}))}).mutateAsync}}var Bp=`wcpos/v1/print-jobs/relay/register?wcpos=1`;function Vp(){let e=We();return{register:ct({mutationFn:()=>(0,i.default)({path:Bp,method:`POST`}),onSuccess:t=>e.setQueryData([`cloud-print`],e=>e&&{...e,relay:t})})}}var Hp=`wcpos/v1/templates?wcpos=1&type=receipt`;function Up(e=!1){let{data:t}=st({queryKey:[`templates`,`receipt`],queryFn:()=>(0,i.default)({path:Hp,method:`GET`})});return t.filter(t=>t.status===`publish`||t.is_active===!0||e&&t.is_virtual===!0).map(e=>({value:String(e.id),label:e.title,engine:e.engine}))}function Wp(e){return e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:$(`cloud_print.save_failed`,`Save failed.`)}var Gp=`cloud-print-save`;function Kp(){let{settings:t,save:n}=zp(),{register:r}=Vp(),i=Up(),a=window.wcpos?.settings?.cloudPrintStoreOptions,o=Array.isArray(a)?a:[],{addSnackbar:s}=Io(),[c,l]=e.useState(t),[u,d]=e.useState({open:!1,mode:`add`,printer:null}),f=e.useRef(c),p=e.useRef(t),m=e.useRef(0),h=e.useRef(Promise.resolve()),g=e.useRef(0),_=e.useCallback(e=>{f.current=e,l(e)},[]);e.useEffect(()=>{m.current===0&&(p.current=t,_(t))},[_,t]);let v=e.useCallback(async e=>{let t=g.current+1;g.current=t,m.current+=1,_(e),s({id:Gp,message:$(`cloud_print.saving`,`Saving…`),status:`saving`});let r=h.current.catch(()=>void 0).then(async()=>await n(e));h.current=r.then(()=>void 0,()=>void 0);try{let e=await r,n={printers:e.printers,assignments:e.assignments};return p.current=n,t===g.current&&_(n),s({id:Gp,message:$(`cloud_print.saved`,`Saved`),status:`success`}),e}catch(e){let n=Wp(e);throw t===g.current&&_(p.current),s({id:Gp,message:n,status:`error`}),e}finally{--m.current}},[s,_,n]),y=e.useCallback(async e=>{let t=f.current,n=new Set(t.printers.map(e=>e.id)),r={id:``,name:e.name,provider:e.provider,store_id:0,...e.provider===`printnode`?{printnode_api_key:e.printnode_api_key,printnode_printer_id:e.printnode_printer_id,printnode_format:`pdf`}:{},...e.provider===`star-online`?{star_api_key:e.star_api_key,star_cloudprnt_url:e.star_cloudprnt_url,star_device_id:e.star_device_id}:{}},i=await v({...t,printers:[...t.printers,r]}),a=i.printers.find(e=>!n.has(e.id))??i.printers[i.printers.length-1];return{printer:a,token:i.generated?.[a.id]}},[v]),b=e.useCallback((e,t)=>{let n=f.current;v({...n,printers:n.printers.map(n=>n.id===e?{...n,name:t}:n)}).catch(()=>void 0)},[v]),x=e.useCallback((e,t)=>{let n=f.current;v({...n,printers:n.printers.map(n=>n.id===e?{...n,...t}:n)}).catch(()=>void 0)},[v]),S=e.useCallback(e=>{let t=f.current;v({...t,printers:t.printers.filter(t=>t.id!==e.id),assignments:t.assignments.filter(t=>t.printer_id!==e.id)}).catch(()=>void 0)},[v]),C=e.useCallback(e=>{let t=f.current;v({...t,assignments:e}).catch(()=>void 0)},[v]),w=t.relay,T=e.useRef(!1);return e.useEffect(()=>{!w||w.enabled||w.available===!1||T.current||(T.current=!0,r.mutate(void 0,{onError:()=>void 0}))},[w,r]),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-6 wcpos:px-4 wcpos:pb-5`,children:[(0,L.jsxs)(yo,{status:`info`,title:$(`cloud_print.intro_title`,`What is cloud printing?`),children:[(0,L.jsx)(`p`,{children:$(`cloud_print.intro_p1`,`Cloud printing lets your store send a receipt to a printer over the internet — the printer fetches each job itself, so it doesn't need to be connected to the POS device.`)}),(0,L.jsx)(`p`,{className:`wcpos:mt-2`,children:$(`cloud_print.intro_p2`,`Use it when a receipt printer is on a different network from the till, or when you want orders to print automatically. For example:`)}),(0,L.jsxs)(`ul`,{className:`wcpos:mt-1 wcpos:list-disc wcpos:pl-5`,children:[(0,L.jsx)(`li`,{children:$(`cloud_print.intro_li1`,`send every order straight to the kitchen printer, or`)}),(0,L.jsx)(`li`,{children:$(`cloud_print.intro_li2`,`print a packing slip for every online sale.`)})]}),(0,L.jsxs)(`p`,{className:`wcpos:mt-2`,children:[$(`cloud_print.intro_p3`,`Cashiers can also print to a cloud printer manually from the POS.`),` `,(0,L.jsxs)(`a`,{href:`https://docs.wcpos.com/receipts/cloud-printing`,target:`_blank`,rel:`noopener noreferrer`,className:`wcpos:inline-flex wcpos:items-center wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,L.jsx)(Jl,{fill:`currentColor`})}),$(`cloud_print.learn_more`,`Learn more`),(0,L.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})]})]}),(0,L.jsxs)(bo,{title:$(`cloud_print.printers`,`Your cloud printers`),description:$(`cloud_print.printers_description`,`Printers that print jobs from this store.`),children:[c.printers.length===0?(0,L.jsx)(`p`,{"data-testid":`cloud-print-empty`,className:`wcpos:text-sm wcpos:text-gray-500`,children:$(`cloud_print.no_printers`,`No cloud printers yet.`)}):(0,L.jsx)(Lp,{"data-testid":`cloud-print-list`,children:c.printers.map(e=>(0,L.jsx)(Ip,{printer:e,onRename:b,onRemove:S,onUpdate:x,onOpenSetup:e=>d({open:!0,mode:`setup`,printer:e})},e.id))}),(0,L.jsx)(`div`,{className:`wcpos:mt-4`,children:(0,L.jsx)(W,{variant:`outline`,"data-testid":`cloud-print-add`,onClick:()=>d({open:!0,mode:`add`,printer:null}),children:$(`cloud_print.add_a_printer`,`+ Add a printer`)})})]}),(0,L.jsx)(bo,{title:$(`cloud_print.auto_print`,`Auto-print rules`),children:(0,L.jsx)(ip,{printers:c.printers,assignments:c.assignments,templateOptions:i,storeOptions:o,onChange:C})}),(0,L.jsx)(_p,{}),(0,L.jsx)(Zf,{open:u.open,mode:u.mode,setupPrinter:u.printer,onClose:()=>d(e=>({...e,open:!1})),onCreate:y,fetchPrintNodePrinters:ap,fetchStarDevices:op,relay:w})]})}function qp(){return(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,className:`wcpos:w-12 wcpos:h-12 wcpos:text-gray-400`,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959V6.75m-1.5 0H5.625c-.621 0-1.125.504-1.125 1.125v3.026a2.999 2.999 0 010 5.198v2.776c0 .621.504 1.125 1.125 1.125h3.026a2.999 2.999 0 015.198 0h2.776c.621 0 1.125-.504 1.125-1.125v-3.026a2.999 2.999 0 010-5.198V7.875c0-.621-.504-1.125-1.125-1.125h-3.026`})})}function Jp(e){try{let t=new URL(e).hostname.toLowerCase();return t===`github.com`||t===`www.github.com`}catch{return!1}}function Yp(e,t){try{let n=new URL(e),r=n.hostname.toLowerCase();if(r!==`github.com`&&r!==`www.github.com`)return null;let[i,a]=n.pathname.replace(/^\/+|\/+$/g,``).split(`/`);return!i||!a?null:`https://github.com/${i}/${a}/releases/tag/v${encodeURIComponent(t)}`}catch{return null}}function Xp({extension:e}){let{homepage:t,installed_version:n,latest_version:r,status:i}=e;if((i===`update_available`||e.has_update)&&n){let e=Yp(t,n),i=Yp(t,r);return(0,L.jsxs)(`span`,{className:`wcpos:text-xs wcpos:text-gray-400`,children:[e?(0,L.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`hover:wcpos:text-gray-600 wcpos:transition-colors`,children:[`v`,n]}):(0,L.jsxs)(L.Fragment,{children:[`v`,n]}),` → `,i?(0,L.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,className:`wcpos:text-yellow-700 hover:wcpos:text-yellow-800 wcpos:transition-colors`,children:[`v`,r]}):(0,L.jsxs)(`span`,{className:`wcpos:text-yellow-700`,children:[`v`,r]})]})}let a=n||r,o=Yp(t,a);return(0,L.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-400`,children:o?(0,L.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`hover:wcpos:text-gray-600 wcpos:transition-colors`,children:[`v`,a]}):(0,L.jsxs)(L.Fragment,{children:[`v`,a]})})}function Zp({status:e}){switch(e){case`active`:return(0,L.jsx)(J,{variant:`success`,icon:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,className:`wcpos:h-3 wcpos:w-3`,"aria-hidden":`true`,focusable:`false`,children:(0,L.jsx)(`path`,{fillRule:`evenodd`,d:`M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z`,clipRule:`evenodd`})}),children:$(`extensions.active`,`Active`)});case`update_available`:return(0,L.jsx)(J,{variant:`warning`,children:$(`extensions.update_available`,`Update available`)});case`inactive`:return(0,L.jsx)(J,{variant:`neutral`,children:$(`extensions.inactive`,`Inactive`)});default:return null}}function Qp({extension:e}){return e.status===`not_installed`?(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-end`,children:(0,L.jsx)(oo,{text:$(`extensions.requires_pro`,`Requires Pro to install`),children:(0,L.jsx)(`span`,{children:(0,L.jsx)(`button`,{type:`button`,disabled:!0,className:`wcpos:inline-flex wcpos:items-center wcpos:rounded-md wcpos:border wcpos:border-gray-300 wcpos:bg-white wcpos:px-3 wcpos:py-1.5 wcpos:text-xs wcpos:font-medium wcpos:text-gray-700 disabled:wcpos:opacity-60 disabled:wcpos:cursor-not-allowed`,children:$(`extensions.install`,`Install`)})})})}):null}function $p(){return window.wcpos?.settings?.getComponent?.(`extensions.action`)??null}function em(e){let t=$p();return t?(0,L.jsx)(t,{extension:e}):e.status===`not_installed`?(0,L.jsx)(Qp,{extension:e}):null}function tm({extension:e}){let t=(e.category||``).trim(),n=t?t.charAt(0).toUpperCase()+t.slice(1):null,r=em(e),i=!!e.settings_url&&e.status!==`not_installed`,a=!!e.homepage&&Jp(e.homepage),o=i||a;return(0,L.jsxs)(uo,{children:[(0,L.jsxs)(uo.Body,{className:`wcpos:relative wcpos:flex wcpos:gap-4`,children:[o&&(0,L.jsxs)(co,{label:e.name,className:`wcpos:absolute wcpos:top-2 wcpos:right-2`,trigger:(0,L.jsx)(kp,{label:$(`extensions.more_actions`,`More actions`)}),children:[i&&(0,L.jsx)(lo,{href:e.settings_url,children:$(`extensions.settings`,`Settings`)}),a&&(0,L.jsx)(lo,{href:e.homepage,target:`_blank`,rel:`noopener noreferrer`,children:$(`extensions.view_on_github`,`View on GitHub`)})]}),(0,L.jsx)(`div`,{className:`wcpos:shrink-0 wcpos:flex wcpos:items-start`,children:e.icon?(0,L.jsx)(`img`,{src:e.icon,alt:e.name,className:`wcpos:w-12 wcpos:h-12 wcpos:rounded`}):(0,L.jsx)(qp,{})}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[(0,L.jsx)(`h3`,{className:(0,U.default)(`wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900`,o&&`wcpos:pr-8`),children:e.name}),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-wrap wcpos:items-center wcpos:gap-x-1.5 wcpos:gap-y-1 wcpos:mt-1`,children:[(0,L.jsx)(Zp,{status:e.status}),(0,L.jsx)(Xp,{extension:e}),n&&(0,L.jsxs)(`span`,{className:`wcpos:inline-flex wcpos:items-center wcpos:gap-1.5 wcpos:whitespace-nowrap`,children:[(0,L.jsx)(`span`,{className:`wcpos:w-0.5 wcpos:h-0.5 wcpos:rounded-full wcpos:bg-gray-300`}),(0,L.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:n})]})]}),(0,L.jsx)(`p`,{className:`wcpos:mt-2 wcpos:text-sm wcpos:text-gray-500`,children:e.description})]})]}),r!=null&&(0,L.jsx)(uo.Footer,{children:r})]})}function nm(){let[t,n]=e.useState(``),[r,a]=e.useState(`all`),[o,s]=e.useState(!1),[c,l]=e.useState(!1),u=We(),{data:d=[]}=st({queryKey:[`extensions`],queryFn:()=>(0,i.default)({path:`wcpos/v1/extensions?wcpos=1`,method:`GET`})}),f=!!window?.wcpos?.settings?.getComponent?.(`extensions.action`),p=async()=>{s(!0);try{let e=await(0,i.default)({path:`wcpos/v1/extensions?wcpos=1&force=1`,method:`GET`});if(e.length===0)throw Error(`Extension refresh returned no data`);u.setQueryData([`extensions`],e),l(!1)}catch{l(!0)}finally{s(!1)}};e.useEffect(()=>{let e=d.filter(e=>e.status===`update_available`).length;su(e)},[d]),e.useEffect(()=>{f||Tf(`extensions_screen`)},[f]);let m=e.useMemo(()=>{let e=new Set(d.map(e=>e.category||`other`));return[`all`,...Array.from(e).sort()]},[d]),h=e.useMemo(()=>d.filter(e=>{let n=r===`all`||(e.category||`other`)===r,i=t.toLowerCase(),a=!t||e.name.toLowerCase().includes(i)||(e.description||``).toLowerCase().includes(i)||(e.tags||[]).some(e=>e.toLowerCase().includes(i));return n&&a}),[d,r,t]);return(0,L.jsxs)(`div`,{children:[c&&(0,L.jsx)(Hl,{status:`error`,isDismissible:!1,className:`wcpos:mb-4`,children:$(`extensions.refresh_failed`,`Could not refresh extensions. Please try again.`)}),!f&&(0,L.jsxs)(Hl,{status:`info`,isDismissible:!1,className:`wcpos:mb-4`,children:[$(`extensions.upgrade_to_pro`,`Upgrade to Pro to install and manage extensions.`),` `,(0,L.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>Ef(`extensions_screen`,`https://wcpos.com/pro`),children:$(`common.upgrade_to_pro`)}),`.`]}),(0,L.jsxs)(`div`,{className:`wcpos:mb-4 wcpos:flex wcpos:items-center wcpos:gap-3`,children:[(0,L.jsx)(`input`,{type:`text`,placeholder:$(`extensions.search_placeholder`,`Search extensions...`),value:t,onChange:e=>n(e.target.value),className:`wcpos:block wcpos:min-w-0 wcpos:flex-1 wcpos:rounded-md wcpos:border wcpos:border-gray-300 wcpos:px-3 wcpos:py-2 wcpos:text-sm focus:wcpos:outline-none focus:wcpos:ring-2 focus:wcpos:ring-wp-admin-theme-color`}),(0,L.jsx)(W,{variant:`secondary`,loading:o,onClick:p,children:o?$(`extensions.refreshing`,`Refreshing...`):$(`extensions.refresh`,`Refresh`)})]}),(0,L.jsx)(xo,{className:`wcpos:mb-6`,items:m.map(e=>({key:e,label:e===`all`?$(`common.all`,`All`):e.charAt(0).toUpperCase()+e.slice(1)})),value:r,onChange:a}),h.length===0?(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:$(`extensions.no_results`,`No extensions found.`)}):(0,L.jsx)(Lp,{children:h.map(e=>(0,L.jsx)(tm,{extension:e},e.slug))})]})}var{i18n:rm,i18nPromise:im,t:am,Trans:om}=Rl({namespace:`wp-admin-consent`,project:`woocommerce-pos`,resources:{en:{"wp-admin-consent":{"consent.modal_title":`Help us make WCPOS better`,"consent.modal_intro":`If you're happy to, WCPOS can send us some anonymous information about how the plugin is being used. It really helps us decide what to build next.`,"consent.callout_title":`Help us make WCPOS better`,"consent.callout_body":`Can WCPOS collect anonymous usage data to help improve the product? No personal or customer data is collected. You can change this any time in POS > Settings > General.`,"consent.allow":`Allow`,"consent.deny":`No thanks`,"consent.learn_more":`Learn what's collected`,"consent.dismiss":`Dismiss`,"consent.dismiss_notice":`Dismiss this notice.`,"consent.save_error":`We couldn't save your choice. Please try again.`,"consent.modal_includes":`Here's what that includes:`,"consent.modal_setup_label":`Your setup`,"consent.modal_setup_desc":`things like your PHP and WooCommerce versions, your country, and your currency, so we know what environments to support.`,"consent.modal_store_label":`Your store size`,"consent.modal_store_desc":`roughly how many products, orders, and POS users you have, so we understand the kinds of stores using WCPOS.`,"consent.modal_usage_label":`How you use WCPOS`,"consent.modal_usage_desc":`which screens you open and which features you turn on, so we can focus on what people actually use.`,"consent.modal_exclusions":`We never look at customer details, order contents, prices, your site address, or anything that could identify you or your customers. You can change your mind any time.`}}}});function sm(e,t,n){let r=e?.[t];return typeof r==`string`&&r!==``?r:am(n)}function cm({open:e,onClose:t,copy:n}){return(0,L.jsxs)(ao,{open:e,onClose:t,title:sm(n,`title`,`consent.modal_title`),children:[(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700 wcpos:mb-3`,children:sm(n,`body`,`consent.modal_intro`)}),(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700 wcpos:mb-2`,children:sm(n,`fields_intro`,`consent.modal_includes`)}),(0,L.jsxs)(`ul`,{className:`wcpos:text-sm wcpos:text-gray-700 wcpos:mb-4 wcpos:pl-4 wcpos:list-disc wcpos:space-y-2`,children:[(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`strong`,{children:am(`consent.modal_setup_label`)}),` — `,am(`consent.modal_setup_desc`)]}),(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`strong`,{children:am(`consent.modal_store_label`)}),` — `,am(`consent.modal_store_desc`)]}),(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`strong`,{children:am(`consent.modal_usage_label`)}),` — `,am(`consent.modal_usage_desc`)]})]}),(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-4`,children:sm(n,`privacy_note`,`consent.modal_exclusions`)}),(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:justify-end`,children:(0,L.jsx)(W,{onClick:t,children:am(`consent.dismiss`)})})]})}function lm({selected:t,onSelect:n}){let r=e.useMemo(()=>(window?.wcpos?.settings?.barcodes??[]).map(e=>({value:e,label:e})),[]);return(0,L.jsx)(ju,{value:t,options:r,onChange:e=>n(e||null),allowCustomValue:!0,createLabel:e=>$(`settings.barcode_field_create`,{value:e}),noResultsLabel:$(`settings.barcode_field_no_results`),"aria-label":$(`settings.barcode_field`)})}var um=`https://wcpos.com/pro`,dm=`general_store_details`,fm=`https://docs.wcpos.com/settings/wp-admin/store-tax-ids`;function pm({data:t,mutate:n,storeDefaults:i}){return e.useEffect(()=>{Tf(dm)},[]),(0,L.jsxs)(bo,{title:$(`settings.store_details_section_title`),description:$(`settings.store_details_section_description`),divider:!0,children:[(0,L.jsxs)(yo,{status:`info`,title:$(`settings.store_details_upgrade_callout_title`),className:`wcpos:mt-4`,children:[(0,L.jsx)(`p`,{className:`wcpos:m-0`,children:$(`settings.store_details_upgrade_to_pro`)}),(0,L.jsx)(`p`,{className:`wcpos:mt-2 wcpos:mb-0`,children:(0,L.jsx)(`a`,{href:um,target:`_blank`,rel:`noreferrer noopener`,onClick:()=>Ef(dm,um),children:$(`common.upgrade_to_pro`)})})]}),(0,L.jsx)(q,{label:$(`settings.store_name`),children:(0,L.jsx)(G,{value:(0,r.isString)(t?.store_name)?t.store_name:``,placeholder:i.store_name,onChange:e=>n({store_name:e.target.value})})}),(0,L.jsx)(q,{label:$(`settings.store_phone`),children:(0,L.jsx)(G,{value:(0,r.isString)(t?.store_phone)?t.store_phone:``,placeholder:i.store_phone,onChange:e=>n({store_phone:e.target.value})})}),(0,L.jsx)(q,{label:$(`settings.store_email`),children:(0,L.jsx)(G,{type:`email`,value:(0,r.isString)(t?.store_email)?t.store_email:``,placeholder:i.store_email,onChange:e=>n({store_email:e.target.value})})}),(0,L.jsx)(q,{label:$(`settings.refund_returns_policy`),description:$(`settings.refund_returns_policy_tip`),children:(0,L.jsx)(Ka,{rows:4,value:(0,r.isString)(t?.policies_and_conditions)?t.policies_and_conditions:``,placeholder:i.policies_and_conditions,onChange:e=>n({policies_and_conditions:e.target.value})})}),(0,L.jsxs)(`div`,{className:`wcpos:mt-4`,children:[(0,L.jsx)(`h4`,{className:`wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900 wcpos:m-0 wcpos:mb-1`,children:$(`settings.store_tax_ids_section_title`)}),(0,L.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-3`,children:[$(`settings.store_tax_ids_section_description`),` `,(0,L.jsx)(`a`,{href:fm,target:`_blank`,rel:`noreferrer noopener`,className:`wcpos:text-wp-admin-theme-color wcpos:underline`,children:$(`settings.store_tax_ids_learn_more`)})]}),(0,L.jsx)(ts,{value:Array.isArray(t?.store_tax_ids)?t.store_tax_ids:null,onChange:e=>{n({store_tax_ids:e})},labels:{add:$(`settings.store_tax_ids_add`),type:$(`settings.store_tax_ids_type`),value:$(`settings.store_tax_ids_value`),country:$(`settings.store_tax_ids_country`),countryPlaceholder:$(`settings.store_tax_ids_country_placeholder`),countrySearchPlaceholder:$(`settings.store_tax_ids_country_search`),countryNoResults:$(`settings.store_tax_ids_country_no_results`),countryClear:$(`settings.store_tax_ids_country_none`),label:$(`settings.store_tax_ids_label`),remove:$(`settings.store_tax_ids_remove`),empty:$(`settings.store_tax_ids_empty`)}})]})]})}function mm({value:t,onChange:n}){let r=Up(!0),i=t!==``&&!r.some(e=>e.value===t),a=e.useMemo(()=>[{value:``,label:$(`settings.storefront_receipt_template_active`)},...i?[{value:t,label:$(`settings.storefront_receipt_template_unavailable`,{value:t}),disabled:!0}]:[],...r.map(({value:e,label:t})=>({value:e,label:t}))],[i,r,t]);return(0,L.jsx)(qa,{value:t,options:a,onChange:({value:e})=>n(String(e)),"aria-label":$(`settings.storefront_receipt_template`)})}function hm({enabled:t,template:n,onChange:r}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(q,{children:(0,L.jsx)(Nf,{tip:$(`settings.storefront_receipt_enabled_tip`),children:(0,L.jsx)(Wa,{checked:t,onChange:e=>r({storefront_receipt_enabled:e}),label:$(`settings.storefront_receipt_enabled`)})})}),t&&(0,L.jsx)(q,{label:$(`settings.storefront_receipt_template`),children:(0,L.jsx)(Nf,{tip:$(`settings.storefront_receipt_template_tip`),children:(0,L.jsx)(e.Suspense,{fallback:(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,L.jsx)(mm,{value:n,onChange:e=>r({storefront_receipt_template:e})})})})})]})}var gm={eu_vat:`EU VAT`,gb_vat:`GB VAT`,sa_vat:`SA VAT`,au_abn:`AU ABN`,br_cpf:`BR CPF`,br_cnpj:`BR CNPJ`,in_gst:`IN GSTIN`,it_cf:`IT Codice Fiscale`,it_piva:`IT Partita IVA`,es_nif:`ES NIF`,ar_cuit:`AR CUIT`,ca_gst_hst:`CA GST/HST`,us_ein:`US EIN`,other:`Other`},_m={wc_eu_vat_number:`WooCommerce EU VAT Number`,aelia_eu_vat:`Aelia EU VAT Assistant`,wpfactory_eu_vat:`WPFactory EU/UK VAT Manager`,germanized:`WooCommerce Germanized`,br_market:`Brazilian Market on WooCommerce`,es_nif:`NIF/CIF Spain for WooCommerce`},vm=`https://docs.wcpos.com/settings/wp-admin/customer-tax-ids`;function ym(e,t,n,r){return t&&t!==``?`override`:n&&n!==r?`plugin`:`default`}function bm(e,t,n){return e&&e!==``?e:t||n}function xm({source:e}){let t={plugin:`wcpos:bg-green-50 wcpos:text-green-800 wcpos:border-green-200`,default:`wcpos:bg-gray-100 wcpos:text-gray-700 wcpos:border-gray-200`,override:`wcpos:bg-amber-50 wcpos:text-amber-800 wcpos:border-amber-200`},n={plugin:$(`tax_ids.source_plugin`),default:$(`tax_ids.source_built_in`),override:$(`tax_ids.source_custom`)};return(0,L.jsx)(`span`,{className:(0,U.default)(`wcpos:inline-flex wcpos:items-center wcpos:px-2 wcpos:py-0.5 wcpos:rounded wcpos:text-[11px] wcpos:font-medium wcpos:uppercase wcpos:tracking-wide wcpos:border`,t[e]),children:n[e]})}function Sm(){return(0,L.jsx)(`a`,{href:vm,target:`_blank`,rel:`noreferrer noopener`,className:`wcpos:text-wp-admin-theme-color wcpos:underline`,children:$(`tax_ids.learn_more`)})}function Cm({plugins:e,overrideCount:t}){let n=e.length>0,r=e.map(e=>_m[e]??e);return(0,L.jsx)(`div`,{className:(0,U.default)(`wcpos:p-3 wcpos:rounded wcpos:mb-3 wcpos:border-l-[3px]`,n?`wcpos:bg-blue-50 wcpos:border-l-wp-admin-theme-color`:`wcpos:bg-gray-50 wcpos:border-l-gray-400`),children:(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:gap-2`,children:[(0,L.jsx)(`span`,{className:(0,U.default)(`wcpos:inline-flex wcpos:items-center wcpos:px-2 wcpos:py-0.5 wcpos:rounded wcpos:text-[11px] wcpos:font-medium wcpos:uppercase wcpos:tracking-wide wcpos:border wcpos:mt-0.5 wcpos:flex-shrink-0`,n?`wcpos:bg-green-50 wcpos:text-green-800 wcpos:border-green-200`:`wcpos:bg-gray-100 wcpos:text-gray-700 wcpos:border-gray-200`),children:n?`✓ ${$(`tax_ids.banner_auto_detected`)}`:$(`tax_ids.banner_no_plugin`)}),(0,L.jsx)(`div`,{className:`wcpos:flex-1 wcpos:text-sm`,children:n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`wcpos:font-medium`,children:[r.join(`, `),` `,(0,L.jsx)(`span`,{className:`wcpos:font-normal`,children:$(`tax_ids.banner_is_installed`)})]}),(0,L.jsxs)(`div`,{className:`wcpos:text-xs wcpos:text-gray-600 wcpos:mt-1`,children:[$(`tax_ids.banner_detected_explainer`),t>0&&(0,L.jsxs)(L.Fragment,{children:[` `,$(`tax_ids.banner_overrides_active`,{count:t})]})]})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`wcpos:font-medium`,children:$(`tax_ids.banner_no_plugin_title`)}),(0,L.jsx)(`div`,{className:`wcpos:text-xs wcpos:text-gray-600 wcpos:mt-1`,children:$(`tax_ids.banner_no_plugin_explainer`)})]})})]})})}function wm({type:e,composed:t,defaultKey:n,override:r,suggestions:i,onCommit:a}){let o=bm(r,t,n),s=ym(e,r,t,n);return(0,L.jsxs)(Vo,{className:(0,U.default)(s===`override`&&`wcpos:bg-amber-50/40`),children:[(0,L.jsx)(X,{className:`wcpos:font-medium wcpos:text-gray-900`,children:gm[e]??e}),(0,L.jsx)(X,{className:`wcpos:font-mono wcpos:text-xs wcpos:text-gray-600`,children:o}),(0,L.jsx)(X,{children:(0,L.jsx)(xm,{source:s})}),(0,L.jsx)(X,{children:(0,L.jsx)(ju,{value:r??``,options:i,onChange:t=>a(e,t.trim(),n),allowCustomValue:!0,placeholder:$(`tax_ids.write_map_use_default`),className:`wcpos:font-mono wcpos:text-xs`,"aria-label":`${gm[e]??e} ${$(`tax_ids.col_override`)}`})})]})}function Tm(){let{data:t,mutate:n}=Mu(`tax_ids`),r=t?.write_map??{},{data:a}=st({queryKey:[`tax_ids_detection`],queryFn:async()=>(0,i.default)({path:`wcpos/v1/settings/tax_ids/detection?wcpos=1`,method:`GET`})}),o=Object.keys(r).filter(e=>r[e]).length,s=e.useCallback((e,t,i)=>{if(t===(r[e]??``))return;let a={...r};t===``?delete a[e]:a[e]=t,n({write_map:a})},[n,r]),c=e.useMemo(()=>{let e=new Set;return Object.values(a.default_write_map).forEach(t=>t&&e.add(t)),Object.values(a.composed_write_map).forEach(t=>t&&e.add(t)),Array.from(e).sort().map(e=>({value:e,label:e}))},[a.composed_write_map,a.default_write_map]);return(0,L.jsxs)(`div`,{className:`wcpos:mt-4`,children:[(0,L.jsx)(`h4`,{className:`wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900 wcpos:m-0 wcpos:mb-1`,children:$(`tax_ids.section_title`)}),(0,L.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-3`,children:[$(`tax_ids.section_intro`),` `,(0,L.jsx)(Sm,{})]}),(0,L.jsx)(Cm,{plugins:a.plugins,overrideCount:o}),(0,L.jsxs)(`details`,{className:`wcpos:border wcpos:border-gray-200 wcpos:rounded`,children:[(0,L.jsxs)(`summary`,{className:(0,U.default)(`wcpos:px-3 wcpos:py-2 wcpos:text-sm wcpos:cursor-pointer wcpos:list-none`,`wcpos:flex wcpos:justify-between wcpos:items-center`,`wcpos:hover:bg-gray-50`),children:[(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{children:$(`tax_ids.advanced_title`)}),` `,(0,L.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`tax_ids.advanced_subtitle`)})]}),o>0&&(0,L.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`tax_ids.advanced_override_count`,{count:o})})]}),(0,L.jsxs)(`div`,{className:`wcpos:border-t wcpos:border-gray-200 wcpos:px-3 wcpos:py-3`,children:[(0,L.jsx)(`p`,{className:`wcpos:text-xs wcpos:text-gray-500 wcpos:mb-3`,children:$(`tax_ids.advanced_intro`)}),(0,L.jsxs)(Lo,{children:[(0,L.jsx)(Ro,{children:(0,L.jsxs)(Bo,{children:[(0,L.jsx)(Y,{children:$(`tax_ids.col_type`)}),(0,L.jsx)(Y,{children:$(`tax_ids.col_field`)}),(0,L.jsx)(Y,{children:$(`tax_ids.col_source`)}),(0,L.jsx)(Y,{children:$(`tax_ids.col_override`)})]})}),(0,L.jsx)(zo,{children:a.types.map(e=>(0,L.jsx)(wm,{type:e,composed:a.composed_write_map[e]??``,defaultKey:a.default_write_map[e]??``,override:r[e],suggestions:c,onCommit:s},e))})]}),(0,L.jsxs)(`div`,{className:`wcpos:mt-3 wcpos:text-xs wcpos:text-gray-500 wcpos:flex wcpos:flex-wrap wcpos:gap-x-3 wcpos:gap-y-1 wcpos:items-center`,children:[(0,L.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,L.jsx)(xm,{source:`plugin`}),` `,$(`tax_ids.legend_plugin`)]}),(0,L.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,L.jsx)(xm,{source:`default`}),` `,$(`tax_ids.legend_built_in`)]}),(0,L.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,L.jsx)(xm,{source:`override`}),` `,$(`tax_ids.legend_custom`)]})]})]})]})]})}function Em({disabled:t=!1,selected:n,onSelect:r}){let a=e.useMemo(()=>({id:0,name:$(`common.guest`)}),[]),{setNotice:o}=Kl(),[s,c]=e.useState(``),{data:l,isFetching:u}=ot({queryKey:[`users`,s],queryFn:async()=>{let e=await(0,i.default)({path:`wp/v2/users?search=${encodeURIComponent(s)}`,method:`GET`}).catch(e=>(console.error(e),e));return e?.code&&e?.message&&o({type:`error`,message:e?.message}),Array.isArray(e)?(e.unshift(a),e):[]},placeholderData:[a]}),d=e.useMemo(()=>(l||[]).map(e=>({value:String(e.id),label:e.name})),[l]);return(0,L.jsx)(ju,{value:String(n||0),options:d,onChange:e=>r(e?Number(e):0),onQuery:c,loading:u,disabled:t})}function Dm(e){if(typeof e==`boolean`)return e;if(typeof e==`string`){let t=e.trim().toLowerCase();return t!==``&&t!==`false`&&t!==`0`}return!!e}function Om(){return window?.wcpos?.settings?.getComponent?.(`general.store_details_block`)||null}function km(){let{data:t,mutate:n}=Mu(`general`),[i,a]=e.useState(!1),o=!!t&&!(t?.code&&t?.message),s={store_name:``,store_phone:``,store_email:``,policies_and_conditions:``,...t?.store_defaults??{}},c=Om()??pm;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(c,{data:t,mutate:n,storeDefaults:s}),(0,L.jsxs)(bo,{title:$(`settings.products_section_title`),divider:!0,children:[(0,L.jsx)(q,{children:(0,L.jsx)(Nf,{tip:$(`settings.pos_only_products_tip`),children:(0,L.jsx)(Wa,{checked:!!t?.pos_only_products,onChange:e=>{n({pos_only_products:e})},label:$(`settings.pos_only_products`)})})}),(0,L.jsx)(q,{children:(0,L.jsx)(Nf,{tip:$(`settings.decimal_quantities_tip`),children:(0,L.jsx)(Wa,{checked:!!t?.decimal_qty,onChange:e=>{n({decimal_qty:e})},label:$(`settings.decimal_quantities`)})})}),(0,L.jsx)(q,{children:(0,L.jsx)(Nf,{tip:$(`settings.restore_stock_on_delete_tip`),children:(0,L.jsx)(Wa,{checked:!!t?.restore_stock_on_delete,onChange:e=>{n({restore_stock_on_delete:e})},label:$(`settings.restore_stock_on_delete`)})})}),(0,L.jsx)(q,{label:$(`settings.barcode_field`),children:(0,L.jsx)(Nf,{tip:$(`settings.barcode_field_tip`),children:(0,L.jsx)(e.Suspense,{fallback:(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,L.jsx)(lm,{selected:(0,r.isString)(t?.barcode_field)&&t?.barcode_field||``,onSelect:e=>{n({barcode_field:e||`_sku`})}})})})})]}),(0,L.jsxs)(bo,{title:$(`settings.customers_section_title`),divider:!0,children:[(0,L.jsx)(q,{children:(0,L.jsx)(Wa,{checked:!!t?.generate_username,onChange:e=>{n({generate_username:e})},label:$(`settings.generate_username`)})}),(0,L.jsxs)(q,{label:$(`settings.default_customer`),children:[(0,L.jsx)(Nf,{tip:$(`settings.default_customer_tip`),children:(0,L.jsx)(e.Suspense,{fallback:(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,L.jsx)(Em,{disabled:!!t?.default_customer_is_cashier,selected:(0,r.isNumber)(t?.default_customer)&&t?.default_customer||0,onSelect:e=>{n({default_customer:e})}})})}),(0,L.jsx)(`div`,{className:`wcpos:mt-2`,children:(0,L.jsx)(Ga,{label:$(`settings.use_cashier_account`),checked:!!t?.default_customer_is_cashier,onChange:e=>{n({default_customer_is_cashier:e.target.checked})}})})]}),(0,L.jsx)(hm,{enabled:!!t?.storefront_receipt_enabled,template:(0,r.isString)(t?.storefront_receipt_template)?t?.storefront_receipt_template:``,onChange:e=>{n(e)}}),(0,L.jsx)(e.Suspense,{fallback:(0,L.jsx)(K,{className:`wcpos:h-32 wcpos:w-full wcpos:rounded-md wcpos:mt-4`}),children:(0,L.jsx)(Tm,{})})]}),(0,L.jsxs)(bo,{title:$(`settings.privacy_section_title`),divider:!0,children:[(0,L.jsx)(q,{children:(0,L.jsx)(Nf,{children:(0,L.jsx)(Wa,{checked:t?.tracking_consent===`allowed`,onChange:e=>{n({tracking_consent:e?`allowed`:`denied`})},label:$(`settings.allow_anonymous_usage_data`)})})}),(0,L.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:[$(`settings.allow_anonymous_usage_data_tip`),` `,(0,L.jsx)(`button`,{type:`button`,onClick:()=>a(!0),className:`wcpos:underline wcpos:text-wp-admin-theme-color wcpos:cursor-pointer wcpos:bg-transparent wcpos:border-0 wcpos:p-0`,children:$(`settings.privacy_learn_more`)})]})]}),(0,L.jsx)(bo,{title:$(`settings.advanced_section_title`),divider:!0,children:(0,L.jsx)(q,{children:(0,L.jsx)(Nf,{tip:$(`settings.force_ssl_tip`),children:(0,L.jsx)(Wa,{checked:!o||Dm(t?.force_ssl),disabled:!o,onChange:e=>{n({force_ssl:e})},label:$(`settings.force_ssl`)})})})}),(0,L.jsx)(cm,{open:i,onClose:()=>a(!1)})]})}var Am=(e,t=20,n=`...`)=>{if(e.length<=t)return e;n||=`...`;let r=t-n.length,i=Math.ceil(r/2),a=Math.floor(r/2);return e.substr(0,i)+n+e.substr(e.length-a)};function jm(){let{data:t,mutate:n}=Mu(`license`),{setNotice:i}=Kl(),[o,s]=e.useState(t?.key),c=e=>s(e.target.value),l=async(e=!1)=>{e||Df();let c=window.wcpos?.settings,l=e||!c?{}:{...c.anon_id?{anon_id:c.anon_id}:{},...c.site_uuid?{site_uuid:c.site_uuid}:{}},u=(0,a.addQueryArgs)(`https://wcpos.com`,{"wc-api":`am-software-api`,request:e?`deactivation`:`activation`,instance:t?.instance,api_key:o,product_id:t?.product_id,platform:t?.platform,version:t?.version,timestamp:Date.now(),...l}),d=await fetch(u,{method:`GET`,credentials:`omit`}).then(e=>e.json()).catch(t=>(e||Af(t),i({type:`error`,message:t.message}),null));if(d){if(!d.success)e||Af(d),i({type:`error`,message:d.error});else{if(e)s(``);else{Of((0,r.isString)(d?.license_tier)?d.license_tier:void 0);let e=(0,r.get)(window,`confetti`);e&&e()}n({key:e?``:o,activated:!!d.activated})}}};return e.useEffect(()=>{t?.instance||(Tf(`license_screen_card`),Tf(`license_screen_link`))},[t?.instance]),t?.instance?t.activated?(0,L.jsxs)(`div`,{className:`wcpos:px-4 wcpos:py-5 wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4 wcpos:sm:px-6 wcpos:items-center`,children:[(0,L.jsx)(`div`,{className:`wcpos:sm:text-right wcpos:text-8xl`,children:`🎉`}),(0,L.jsxs)(`div`,{className:`wcpos:col-span-2`,children:[(0,L.jsx)(`h3`,{children:$(`license.thank_you`)}),(0,L.jsx)(`p`,{children:(0,L.jsx)(Vl,{i18nKey:`license.activated`,components:{code:(0,L.jsx)(`code`,{})},values:{number:Am((0,r.isString)(t?.key)?t?.key:``)}})}),(0,L.jsx)(`p`,{children:$(`license.ongoing_support`)}),(0,L.jsx)(W,{variant:`primary`,onClick:()=>l(!0),children:$(`license.deactivate`)})]})]}):(0,L.jsxs)(`div`,{className:`wcpos:px-4 wcpos:py-5 wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4`,children:[(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:sm:justify-end`,children:(0,L.jsx)(Nf,{children:$(`license.license_key`)})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(`input`,{type:`text`,name:`license-key`,id:`license-key`,className:`wcpos:mt-1 wcpos:focus:ring-indigo-500 wcpos:focus:border-wp-admin-theme-color wcpos:block wcpos:w-full wcpos:shadow-xs wcpos:sm:text-sm wcpos:border-gray-300 wcpos:rounded-md`,onChange:(0,r.throttle)(c,100)})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(W,{variant:`primary`,disabled:!o,onClick:()=>l(),children:$(`license.activate`)})})]}):(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:items-center wcpos:gap-6 wcpos:px-4 wcpos:py-8 wcpos:max-w-md wcpos:mx-auto`,children:[(0,L.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>Ef(`license_screen_card`,`https://wcpos.com/pro`),children:(0,L.jsx)(`img`,{src:`https://wcpos.com/images/wcpos-pro.png`,alt:`WCPOS Pro`,width:80,height:80})}),(0,L.jsxs)(`div`,{className:`wcpos:text-center`,children:[(0,L.jsx)(`p`,{className:`wcpos:text-gray-600 wcpos:mb-3`,children:$(`license.support_development`)}),(0,L.jsxs)(`a`,{href:`https://wcpos.com/pro`,"data-testid":`license-upgrade-cta`,className:`wcpos:inline-block wcpos:font-medium wcpos:text-[color:var(--wp-admin-theme-color)] hover:wcpos:underline`,onClick:()=>Ef(`license_screen_link`,`https://wcpos.com/pro`),children:[$(`common.upgrade_to_pro`),` →`]})]}),(0,L.jsxs)(Hl,{status:`info`,isDismissible:!1,className:`wcpos:w-full`,children:[$(`license.existing_license_prefix`),` `,(0,L.jsx)(`a`,{href:`https://docs.wcpos.com/getting-started/pro-license#installation`,target:`_blank`,rel:`noopener noreferrer`,className:`wcpos:font-medium wcpos:underline`,children:$(`license.existing_license_link`)}),` `,$(`license.existing_license_suffix`)]})]})}function Mm(e,t={}){let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t.locale,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,timeZone:t.timeZone}).format(n)}function Nm(e,t={}){let n=[`[${Mm(e.timestamp,t)}] ${e.level.toUpperCase()}`,e.message];return e.context&&e.context.trim()!==``&&(n.push(``),n.push(`Context:`),n.push(e.context)),n.join(` |
| 6 | `)}function Pm(e,t){return new Intl.DateTimeFormat(`en-CA`,{year:`numeric`,month:`2-digit`,day:`2-digit`,timeZone:t}).format(e)}function Fm(e){let[t,n,r]=e.split(`-`).map(Number);return Pm(new Date(Date.UTC(t,n-1,r)-864e5),`UTC`)}function Im(e,t,n={}){if(e.length===0)return[];let{timeZone:r}=n,i=Pm(new Date(t),r),a=Fm(i),o=[],s=null;for(let t of e){let e=new Date(t.timestamp),n;if(Number.isNaN(e.getTime()))n=t.timestamp;else{let t=Pm(e,r);n=t===i?`today`:t===a?`yesterday`:t}(!s||s.label!==n)&&(s={label:n,entries:[]},o.push(s)),s.entries.push(t)}return o}var Lm=`all`,Rm={emergency:`wcpos:bg-red-600`,alert:`wcpos:bg-red-600`,critical:`wcpos:bg-red-500`,error:`wcpos:bg-red-400`,warning:`wcpos:bg-amber-400`,notice:`wcpos:bg-blue-400`,info:`wcpos:bg-blue-400`,debug:`wcpos:bg-gray-400`},zm={emergency:`wcpos:text-red-800`,alert:`wcpos:text-red-800`,critical:`wcpos:text-red-700`,error:`wcpos:text-red-700`,warning:`wcpos:text-amber-700`,notice:`wcpos:text-blue-700`,info:`wcpos:text-blue-700`,debug:`wcpos:text-gray-700`},Bm={emergency:`hover:wcpos:bg-red-50`,alert:`hover:wcpos:bg-red-50`,critical:`hover:wcpos:bg-red-50`,error:`hover:wcpos:bg-red-50`,warning:`hover:wcpos:bg-amber-50`,notice:`hover:wcpos:bg-blue-50`,info:`hover:wcpos:bg-blue-50`,debug:`hover:wcpos:bg-gray-50`},Vm={emergency:`critical`,alert:`critical`,critical:`critical`,error:`error`,warning:`warning`,notice:`info`,info:`info`,debug:`debug`};function Hm(e){return Rm[e]?e:`debug`}function Um(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`})}function Wm(e){return e===`today`?$(`logs.today`,`Today`):e===`yesterday`?$(`logs.yesterday`,`Yesterday`):e}async function Gm(e){if(typeof navigator<`u`&&navigator.clipboard&&window.isSecureContext)try{return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>`u`)return!1;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`0`,document.body.appendChild(t);let n=document.activeElement;t.focus(),t.select();let r=!1;try{r=document.execCommand(`copy`)}catch{r=!1}return document.body.removeChild(t),n?.focus?.(),r}function Km({payload:t}){let[n,r]=e.useState(`idle`),i=async()=>{let e=await Gm(t);r(e?`copied`:`failed`),setTimeout(()=>r(`idle`),1500)},a=n===`copied`?$(`logs.copied`,`Copied`):n===`failed`?$(`logs.copy_failed`,`Copy failed`):$(`logs.copy`,`Copy`);return(0,L.jsx)(W,{variant:`secondary`,onClick:i,children:a})}function qm({entry:t,isExpanded:n,onToggle:r,sourceName:i}){let a=Hm(t.level),o=e.useMemo(()=>Nm(t),[t]);return(0,L.jsxs)(`div`,{className:`wcpos:border-b wcpos:border-gray-100 wcpos:last:border-b-0`,children:[(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:r,className:`wcpos:grid wcpos:grid-cols-[78px_1fr_14px] wcpos:items-center wcpos:gap-3 wcpos:w-full wcpos:text-left wcpos:bg-transparent wcpos:border-0 wcpos:py-2 wcpos:pr-2 wcpos:pl-4 wcpos:cursor-pointer wcpos:relative ${Bm[a]}`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`wcpos:absolute wcpos:left-0 wcpos:top-0 wcpos:bottom-0 wcpos:w-1 ${Rm[a]}`}),(0,L.jsx)(`span`,{className:`wcpos:text-xs wcpos:font-mono wcpos:text-gray-500`,children:Um(t.timestamp)}),(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:break-words ${zm[a]}`,children:t.message}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`wcpos:text-gray-400 wcpos:transition-transform ${n?`wcpos:rotate-90`:``}`,children:`›`})]}),n&&(0,L.jsxs)(`div`,{className:`wcpos:px-4 wcpos:pb-3`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-between wcpos:bg-gray-50 wcpos:rounded-t-md wcpos:px-3 wcpos:py-2 wcpos:gap-2`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2 wcpos:flex-wrap`,children:[(0,L.jsx)(J,{variant:Vm[a],children:t.level.toUpperCase()}),(0,L.jsx)(J,{variant:`neutral`,children:i}),(0,L.jsx)(J,{variant:`neutral`,children:Mm(t.timestamp)})]}),(0,L.jsx)(Km,{payload:o})]}),(0,L.jsx)(Ka,{readOnly:!0,value:o,onFocus:e=>e.currentTarget.select(),className:`wcpos:bg-gray-900 wcpos:text-gray-100 wcpos:font-mono wcpos:text-xs wcpos:rounded-b-md wcpos:rounded-t-none wcpos:border-gray-900 wcpos:min-h-[160px]`})]})]})}function Jm(){let[t,n]=e.useState(`all`),[r,a]=e.useState(Lm),[o,s]=e.useState(null),[c,l]=e.useState(1),u=t===`all`?``:`&level=${t}`,d=`&source=${encodeURIComponent(r)}`,{data:f}=st({queryKey:[`logs`,t,r,c],queryFn:()=>(0,i.default)({path:`wcpos/v1/logs?wcpos=1&per_page=50&page=${c}${u}${d}`,method:`GET`,parse:!1}).then(async e=>({...await e.json(),_totalPages:parseInt(e.headers.get(`X-WP-TotalPages`)||`1`,10)}))}),p=f?.entries??[],m=f?.sources??[],h=e.useMemo(()=>{let e=new Map;return m.forEach(t=>e.set(t.source,t)),e},[m]),g=f?._totalPages??1;e.useEffect(()=>{mu()},[]),e.useEffect(()=>{s(null)},[p]);let _=e.useMemo(()=>Im(p,Date.now()),[p]),v=[{key:`all`,label:$(`common.all`,`All`)},{key:`error`,label:$(`logs.errors`,`Errors`)},{key:`warning`,label:$(`logs.warnings`,`Warnings`)}];return(0,L.jsxs)(`div`,{children:[f?.has_fatal_errors&&(0,L.jsxs)(Hl,{status:`warning`,isDismissible:!1,className:`wcpos:mb-4`,children:[$(`logs.fatal_errors_detected`,`Fatal errors detected`),` — `,(0,L.jsx)(`a`,{href:f.fatal_errors_url,target:`_blank`,rel:`noopener noreferrer`,children:$(`logs.view_in_wc`,`view in WooCommerce logs`)})]}),(0,L.jsxs)(`div`,{className:`wcpos:mb-4 wcpos:flex wcpos:flex-wrap wcpos:items-center wcpos:gap-3`,children:[(0,L.jsx)(xo,{items:v,value:t,onChange:e=>{n(e),l(1),s(null)}}),m.length>1&&(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,L.jsx)(`label`,{htmlFor:`wcpos-log-source-select`,className:`wcpos:text-sm wcpos:text-gray-600`,children:$(`logs.source`,`Source`)}),(0,L.jsx)(qa,{id:`wcpos-log-source-select`,value:r,onChange:e=>{a(String(e.value)),l(1),s(null)},options:[{value:Lm,label:$(`common.all`,`All`)},...m.map(e=>({value:e.source,label:e.name}))]})]})]}),p.length===0?(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:$(`logs.no_entries`,`No log entries found.`)}):(0,L.jsx)(`div`,{className:`wcpos:space-y-4`,children:_.map(e=>(0,L.jsxs)(`div`,{className:`wcpos:border wcpos:border-gray-200 wcpos:rounded-md wcpos:overflow-hidden`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-between wcpos:bg-gray-50 wcpos:px-4 wcpos:py-2 wcpos:border-b wcpos:border-gray-200`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-semibold wcpos:text-gray-700`,children:Wm(e.label)}),(0,L.jsx)(J,{variant:`neutral`,size:`xs`,children:$(`logs.entries_count`,{count:e.entries.length})})]}),(0,L.jsx)(`div`,{children:e.entries.map((t,n)=>{let r=`${e.label}-${t.timestamp}-${n}`,i=t.source||`woocommerce-pos`,a=h.get(i)?.name??`WCPOS`;return(0,L.jsx)(qm,{entry:t,isExpanded:o===r,onToggle:()=>s(o===r?null:r),sourceName:a},r)})})]},e.label))}),g>1&&(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-center wcpos:gap-2 wcpos:mt-4`,children:[(0,L.jsx)(`button`,{onClick:()=>{l(e=>Math.max(1,e-1)),s(null)},disabled:c<=1,className:`wcpos:px-3 wcpos:py-1 wcpos:rounded wcpos:text-sm wcpos:border wcpos:border-gray-300 disabled:wcpos:opacity-50`,children:$(`common.previous`,`Previous`)}),(0,L.jsxs)(`span`,{className:`wcpos:text-sm wcpos:text-gray-600`,children:[c,` / `,g]}),(0,L.jsx)(`button`,{onClick:()=>{l(e=>Math.min(g,e+1)),s(null)},disabled:c>=g,className:`wcpos:px-3 wcpos:py-1 wcpos:rounded wcpos:text-sm wcpos:border wcpos:border-gray-300 disabled:wcpos:opacity-50`,children:$(`common.next`,`Next`)})]})]})}var Ym=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,L.jsx)(`path`,{d:`M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.11-.9-2-2-2H4c-1.11 0-2 .89-2 2v10c0 1.1.89 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z`})}),Xm=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,L.jsx)(`path`,{d:`M17 1.01 7 1c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99zM17 19H7V5h10v14z`})}),Zm=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,L.jsx)(`path`,{d:`M21 4H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h18c1.1 0 1.99-.9 1.99-2L23 6c0-1.1-.9-2-2-2zm-2 14H5V6h14v12z`})}),Qm=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,L.jsx)(`path`,{d:`M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM18.92 8h-2.95a15.65 15.65 0 0 0-1.38-3.56A8.03 8.03 0 0 1 18.92 8zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56A7.99 7.99 0 0 1 5.08 16zm2.95-8H5.08a7.99 7.99 0 0 1 4.33-3.56A15.65 15.65 0 0 0 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2s.07-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95a8.03 8.03 0 0 1-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z`})});function $m({app_type:e,device_type:t}){switch(e){case`ios_app`:case`android_app`:return t===`mobile`?Xm:Zm;case`electron_app`:return Ym;default:return t===`mobile`?Xm:t===`tablet`?Zm:Qm}}function eh({deviceInfo:e,className:t}){let n=$m(e);return(0,L.jsx)(n,{className:(0,U.default)(`wcpos:fill-current`,t),"aria-hidden":`true`,focusable:`false`})}function th(e){switch(e){case`ios_app`:return $(`sessions.ios_application`);case`android_app`:return $(`sessions.android_application`);case`electron_app`:return $(`sessions.desktop_application`);default:return $(`sessions.web_application`)}}function nh(e){try{return new Date(e*1e3).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}catch{return`N/A`}}function rh(e){let t=Math.floor(Date.now()/1e3)-e;return t<60?$(`sessions.just_now`):t<3600?$(`sessions.minutes_ago`,{minutes:Math.floor(t/60)}):t<86400?$(`sessions.hours_ago`,{hours:Math.floor(t/3600)}):$(`sessions.days_ago`,{days:Math.floor(t/86400)})}function ih({session:e,onDelete:t,isDeleting:n}){return(0,L.jsx)(`div`,{className:(0,U.default)(`wcpos:rounded-md wcpos:border wcpos:bg-white wcpos:p-3 wcpos:transition-colors`,e.is_current?`wcpos:border-wp-admin-theme-color wcpos:ring-1 wcpos:ring-wp-admin-theme-color/30`:`wcpos:border-gray-200 hover:wcpos:border-gray-300`),children:(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:gap-3`,children:[(0,L.jsx)(`div`,{className:(0,U.default)(`wcpos:shrink-0 wcpos:flex wcpos:h-10 wcpos:w-10 wcpos:items-center wcpos:justify-center wcpos:rounded-md`,e.is_current?`wcpos:bg-wp-admin-theme-color-lightest wcpos:text-wp-admin-theme-color`:`wcpos:bg-gray-100 wcpos:text-gray-500`),children:(0,L.jsx)(eh,{deviceInfo:e.device_info,className:`wcpos:h-5 wcpos:w-5`})}),(0,L.jsxs)(`div`,{className:`wcpos:min-w-0 wcpos:flex-1`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:justify-between wcpos:gap-2`,children:[(0,L.jsxs)(`div`,{className:`wcpos:min-w-0 wcpos:flex-1`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,L.jsxs)(`h4`,{className:`wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900 wcpos:leading-tight wcpos:truncate`,children:[th(e.device_info.app_type),e.device_info.browser_version&&(0,L.jsx)(`span`,{className:`wcpos:ml-1 wcpos:text-xs wcpos:font-normal wcpos:text-gray-500`,children:e.device_info.browser_version})]}),e.is_current&&(0,L.jsx)(J,{variant:`brand`,size:`xs`,shape:`pill`,children:$(`sessions.current_device`)})]}),(0,L.jsxs)(`p`,{className:`wcpos:mt-0.5 wcpos:text-xs wcpos:text-gray-600 wcpos:truncate`,children:[e.device_info.browser,` · `,e.device_info.os]})]}),(0,L.jsx)(W,{variant:`ghost-destructive`,onClick:t,disabled:n,className:`wcpos:shrink-0 wcpos:px-2 wcpos:py-1 wcpos:text-xs`,children:$(`sessions.terminate`)})]}),(0,L.jsxs)(`div`,{className:`wcpos:mt-2 wcpos:grid wcpos:grid-cols-2 wcpos:gap-x-4 wcpos:gap-y-1 wcpos:rounded wcpos:bg-gray-50 wcpos:px-2 wcpos:py-1.5 wcpos:text-xs`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:justify-between wcpos:gap-2`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-gray-500`,children:$(`sessions.last_active`)}),(0,L.jsx)(`span`,{className:`wcpos:text-gray-900`,children:rh(e.last_active)})]}),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:justify-between wcpos:gap-2`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-gray-500`,children:$(`sessions.ip`)}),(0,L.jsx)(`span`,{className:`wcpos:text-gray-900`,children:e.ip_address||`N/A`})]}),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:justify-between wcpos:gap-2`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-gray-500`,children:$(`sessions.created`)}),(0,L.jsx)(`span`,{className:`wcpos:text-gray-900`,children:nh(e.created)})]}),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:justify-between wcpos:gap-2`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-gray-500`,children:$(`sessions.expires`)}),(0,L.jsx)(`span`,{className:`wcpos:text-gray-900`,children:nh(e.expires)})]})]}),e.user_agent&&(0,L.jsxs)(`details`,{className:`wcpos:mt-2 wcpos:group`,children:[(0,L.jsxs)(`summary`,{className:`wcpos:flex wcpos:cursor-pointer wcpos:select-none wcpos:items-center wcpos:gap-1 wcpos:text-[11px] wcpos:text-gray-500 hover:wcpos:text-gray-700`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-[8px] wcpos:transition-transform group-open:wcpos:rotate-90`,children:`▶`}),$(`sessions.user_agent`)]}),(0,L.jsx)(`div`,{className:`wcpos:mt-1 wcpos:rounded wcpos:border wcpos:border-gray-200 wcpos:bg-gray-50 wcpos:p-1.5`,children:(0,L.jsx)(`p`,{className:`wcpos:break-all wcpos:font-mono wcpos:text-[10px] wcpos:leading-tight wcpos:text-gray-700`,children:e.user_agent})})]})]})]})})}function ah({user:t,isYou:n,isActiveNow:r,isDeleting:i,onDeleteSession:a,onDeleteAll:o}){let s=t.sessions.some(e=>e.is_current),c=e.useMemo(()=>[...t.sessions].sort((e,t)=>e.is_current&&!t.is_current?-1:!e.is_current&&t.is_current?1:t.last_active-e.last_active),[t.sessions]);return(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:h-full wcpos:flex-col`,children:[(0,L.jsxs)(`div`,{className:`wcpos:mb-3 wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:border-b wcpos:border-gray-200 wcpos:pb-3`,children:[(0,L.jsx)(ko,{name:t.display_name,src:t.avatar_url,size:`lg`,status:r?`active`:`none`,statusLabel:$(`sessions.active_now`)}),(0,L.jsxs)(`div`,{className:`wcpos:min-w-0 wcpos:flex-1`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,L.jsx)(`h3`,{className:`wcpos:truncate wcpos:text-base wcpos:font-semibold wcpos:text-gray-900`,children:t.display_name}),n&&(0,L.jsx)(J,{variant:`brand`,size:`xs`,shape:`pill`,children:$(`sessions.you`)}),r&&(0,L.jsx)(J,{variant:`success`,size:`xs`,shape:`pill`,children:$(`sessions.active_now`)})]}),(0,L.jsxs)(`p`,{className:`wcpos:truncate wcpos:text-xs wcpos:text-gray-600`,children:[`@`,t.username,` · `,$(`sessions.session_count`,{count:t.session_count})]})]}),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:shrink-0 wcpos:gap-2`,children:[s&&t.sessions.length>1&&(0,L.jsx)(W,{variant:`outline`,onClick:()=>o(!0),disabled:i,className:`wcpos:text-xs`,children:$(`sessions.logout_other_devices`)}),t.sessions.length>0&&(0,L.jsx)(W,{variant:`destructive`,onClick:()=>o(!1),disabled:i,className:`wcpos:text-xs`,children:$(`sessions.logout_all`)})]})]}),(0,L.jsx)(`div`,{className:`wcpos:flex-1 wcpos:space-y-2 wcpos:overflow-y-auto`,children:c.map(e=>(0,L.jsx)(ih,{session:e,onDelete:()=>a(e.jti),isDeleting:i},e.jti))})]})}function oh({user:e,isSelected:t,isYou:n,isActiveNow:r,onSelect:i}){return(0,L.jsxs)(`button`,{type:`button`,onClick:i,"aria-pressed":t,className:(0,U.default)(`wcpos:flex wcpos:w-full wcpos:items-center wcpos:gap-3 wcpos:rounded-md wcpos:border wcpos:px-3 wcpos:py-2 wcpos:text-left wcpos:transition-colors`,t?`wcpos:border-wp-admin-theme-color wcpos:bg-wp-admin-theme-color-lightest`:`wcpos:border-transparent wcpos:bg-white hover:wcpos:border-gray-200 hover:wcpos:bg-gray-50`),children:[(0,L.jsx)(ko,{name:e.display_name,src:e.avatar_url,size:`md`,status:r?`active`:`none`,statusLabel:$(`sessions.active_now`)}),(0,L.jsxs)(`div`,{className:`wcpos:min-w-0 wcpos:flex-1`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,L.jsx)(`span`,{className:`wcpos:truncate wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:e.display_name}),n&&(0,L.jsx)(J,{variant:`brand`,size:`xs`,shape:`pill`,children:$(`sessions.you`)})]}),(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1 wcpos:text-xs wcpos:text-gray-600`,children:(0,L.jsxs)(`span`,{className:`wcpos:truncate`,children:[`@`,e.username]})})]}),(0,L.jsx)(J,{variant:`neutral`,size:`xs`,shape:`round`,children:e.session_count})]})}var sh=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,L.jsx)(`path`,{d:`M15.5 14h-.79l-.28-.27a6.471 6.471 0 0 0 1.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 0 0-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.471 6.471 0 0 0 5.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z`})});function ch({users:t,selectedUserId:n,currentUserId:r,activeNowThresholdSeconds:i,onSelect:a}){let[o,s]=e.useState(``),c=Math.floor(Date.now()/1e3),l=e.useMemo(()=>{let e=o.trim().toLowerCase();return e?t.filter(t=>t.display_name.toLowerCase().includes(e)||t.username.toLowerCase().includes(e)):t},[t,o]);return(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:h-full wcpos:flex-col`,children:[(0,L.jsxs)(`div`,{className:`wcpos:relative wcpos:mb-2`,children:[(0,L.jsx)(sh,{className:`wcpos:pointer-events-none wcpos:absolute wcpos:left-2 wcpos:top-1/2 wcpos:h-4 wcpos:w-4 wcpos:-translate-y-1/2 wcpos:fill-current wcpos:text-gray-400`,"aria-hidden":`true`,focusable:`false`}),(0,L.jsx)(G,{value:o,onChange:e=>s(e.target.value),placeholder:$(`sessions.filter_users`),"aria-label":$(`sessions.filter_users`),className:`wcpos:pl-8`})]}),(0,L.jsx)(`div`,{className:`wcpos:flex-1 wcpos:overflow-y-auto wcpos:space-y-1 wcpos:pr-1`,children:l.length===0?(0,L.jsx)(`div`,{className:`wcpos:py-6 wcpos:text-center wcpos:text-xs wcpos:text-gray-500`,children:o.trim()?$(`sessions.no_users_match`):$(`sessions.no_other_users`)}):l.map(e=>{let t=c-e.last_active<=i;return(0,L.jsx)(oh,{user:e,isSelected:e.user_id===n,isYou:r!==null&&e.user_id===r,isActiveNow:t,onSelect:()=>a(e.user_id)},e.user_id)})})]})}var lh=300;function uh(){let e=window?.wcpos?.settings?.currentUserId;return typeof e==`number`&&e>0?e:null}function dh(e,t){return[...e].sort((e,n)=>{if(t!==null){if(e.user_id===t)return-1;if(n.user_id===t)return 1}return n.last_active-e.last_active})}function fh(){let t=We(),{setNotice:n}=Kl(),r=e.useMemo(uh,[]),{data:a}=st({queryKey:[`sessions`,`all`],queryFn:async()=>await(0,i.default)({path:`/wcpos/v1/auth/users/sessions?wcpos=1`,method:`GET`})}),o=e.useMemo(()=>dh(a?.users??[],r),[a?.users,r]),[s,c]=e.useState(null),[l,u]=e.useState(null);e.useEffect(()=>{if(o.length===0){s!==null&&c(null);return}if(!(s!==null&&o.some(e=>e.user_id===s))){let e=r!==null&&o.some(e=>e.user_id===r)?r:o[0].user_id;c(e)}},[o,s,r]);let d=e.useMemo(()=>o.find(e=>e.user_id===s)||null,[o,s]),f=ct({mutationFn:async({userId:e,jti:t})=>(0,i.default)({path:`/wcpos/v1/auth/sessions/${t}?user_id=${e}&wcpos=1`,method:`DELETE`}),onSuccess:()=>{t.invalidateQueries({queryKey:[`sessions`]}),n({type:`success`,message:$(`sessions.session_terminated`)})},onError:e=>{n({type:`error`,message:e?.message||$(`sessions.failed_terminate_session`)})}}),p=ct({mutationFn:async({userId:e,exceptCurrent:t})=>{let n=new URLSearchParams({user_id:e.toString(),wcpos:`1`});return t&&n.append(`except_current`,`true`),(0,i.default)({path:`/wcpos/v1/auth/sessions?${n.toString()}`,method:`DELETE`})},onSuccess:()=>{t.invalidateQueries({queryKey:[`sessions`]}),n({type:`success`,message:$(`sessions.sessions_terminated`)})},onError:e=>{n({type:`error`,message:e?.message||$(`sessions.failed_terminate_sessions`)})}}),m=f.isPending||p.isPending,h=()=>{l&&(l.kind===`session`?f.mutate({userId:l.userId,jti:l.jti},{onSettled:()=>u(null)}):p.mutate({userId:l.userId,exceptCurrent:l.exceptCurrent},{onSettled:()=>u(null)}))},g=Math.floor(Date.now()/1e3),_=d!==null&&g-d.last_active<=lh,v=e.useMemo(()=>l?l.kind===`session`?{title:$(`sessions.terminate_session_title`),description:l.isCurrent?$(`sessions.confirm_terminate_current`):$(`sessions.confirm_terminate_session`),confirmLabel:$(`sessions.terminate`)}:{title:l.exceptCurrent?$(`sessions.terminate_other_title`):$(`sessions.terminate_all_title`),description:l.exceptCurrent?$(`sessions.confirm_logout_other_devices`):$(`sessions.confirm_logout_all_devices`),confirmLabel:l.exceptCurrent?$(`sessions.logout_other_devices`):$(`sessions.logout_all`)}:null,[l]);return(0,L.jsxs)(`div`,{className:`wcpos:p-4`,children:[(0,L.jsx)(`div`,{className:`wcpos:mb-3`,"data-testid":`sessions-manage-description`,children:(0,L.jsx)(Hl,{status:`info`,isDismissible:!1,children:$(`sessions.manage_description`)})}),o.length===0?(0,L.jsx)(Hl,{status:`info`,children:$(`sessions.no_active_sessions`)}):(0,L.jsxs)(`div`,{className:`wcpos:grid wcpos:grid-cols-[minmax(0,18rem)_1fr] wcpos:gap-4 wcpos:min-h-[32rem]`,children:[(0,L.jsx)(`aside`,{className:`wcpos:border-r wcpos:border-gray-200 wcpos:pr-4`,children:(0,L.jsx)(ch,{users:o,selectedUserId:s,currentUserId:r,activeNowThresholdSeconds:lh,onSelect:c})}),(0,L.jsx)(`section`,{children:d?(0,L.jsx)(ah,{user:d,isYou:r!==null&&d.user_id===r,isActiveNow:_,isDeleting:m,onDeleteSession:e=>{let t=d.sessions.find(t=>t.jti===e);u({kind:`session`,userId:d.user_id,jti:e,isCurrent:!!t?.is_current})},onDeleteAll:e=>u({kind:`all`,userId:d.user_id,exceptCurrent:e})}):(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:h-full wcpos:items-center wcpos:justify-center wcpos:text-sm wcpos:text-gray-500`,children:$(`sessions.select_user`)})})]}),l&&v&&(0,L.jsx)(Ap,{open:!!l,title:v.title,description:v.description,confirmLabel:v.confirmLabel,isSubmitting:m,onConfirm:h,onClose:()=>{m||u(null)}})]})}function ph(){return(0,L.jsx)(e.Suspense,{fallback:(0,L.jsx)(Eu,{}),children:(0,L.jsx)(fh,{})})}var mh=ga({component:Au}),hh=ma({getParentRoute:()=>mh,path:`/`,beforeLoad:()=>{throw Hn({to:`/general`})}}),gh=e=>()=>{ql.prefetchQuery({queryKey:[e],queryFn:()=>(0,i.default)({path:`wcpos/v1/settings/${e}?wcpos=1`,method:`GET`}),retry:1})},_h=ma({getParentRoute:()=>mh,path:`/general`,loader:()=>{gh(`general`)(),gh(`tax_ids`)()},component:km}),vh=ma({getParentRoute:()=>mh,path:`/checkout`,loader:gh(`checkout`),component:Rf}),yh=ma({getParentRoute:()=>mh,path:`/cloud-print`,loader:gh(`cloud-print`),component:Kp}),bh=ma({getParentRoute:()=>mh,path:`/access`,loader:gh(`access`),component:Nu}),xh=ma({getParentRoute:()=>mh,path:`/sessions`,component:ph}),Sh=ma({getParentRoute:()=>mh,path:`/extensions`,loader:()=>{ql.prefetchQuery({queryKey:[`extensions`],queryFn:()=>(0,i.default)({path:`wcpos/v1/extensions?wcpos=1`,method:`GET`}),retry:1})},component:nm}),Ch=ma({getParentRoute:()=>mh,path:`/logs`,component:Jm}),wh=ma({getParentRoute:()=>mh,path:`/license`,loader:gh(`license`),component:jm}),Th=Na({routeTree:mh.addChildren([hh,_h,vh,yh,bh,xh,Sh,Ch,wh]),basepath:`/`,history:tr()});function Eh(){return(0,L.jsx)(Ba,{FallbackComponent:Ul,children:(0,L.jsxs)(Ge,{client:ql,children:[(0,L.jsx)(Gl,{children:(0,L.jsx)(Fo,{children:(0,L.jsx)(Ia,{router:Th})})}),(0,L.jsx)(lt,{initialIsOpen:!1})]})})}var Dh=document.getElementById(`woocommerce-pos-settings`);Dh&&(0,n.createRoot)(Dh).render((0,L.jsx)(Eh,{}))})(globalThis.React,globalThis.ReactDOM,globalThis.ReactDOM,globalThis.lodash,globalThis.wp.apiFetch,globalThis.wp.url); |