| 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),n=m(n),i=m(i);var g=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})),_=f(((e,t)=>{t.exports=g()}))(),v=h.createContext(void 0),y=e=>{let t=h.useContext(v);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},b=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,_.jsx)(v.Provider,{value:e,children:t})),x={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},S=new class{#e=x;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 C(e){setTimeout(e,0)}var w=typeof window>`u`||`Deno`in globalThis;function T(){}function E(e,t){return typeof e==`function`?e(t):e}function D(e){return typeof e==`number`&&e>=0&&e!==1/0}function O(e,t){return Math.max(e+(t||0)-Date.now(),0)}function k(e,t){return typeof e==`function`?e(t):e}function A(e,t){return typeof e==`function`?e(t):e}function j(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==N(o,t.options))return!1}else if(!F(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 M(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(P(t.options.mutationKey)!==P(a))return!1}else if(!F(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function N(e,t){return(t?.queryKeyHashFn||P)(e)}function P(e){return JSON.stringify(e,(e,t)=>re(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function F(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(!F(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!F(e[r],t[r]))return!1;return!0}return!1}var ee=Object.prototype.hasOwnProperty;function te(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ne(e)&&ne(t);if(!r&&!(re(e)&&re(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:ee.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=te(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function I(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 ne(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function re(e){if(!ie(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ie(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ie(e){return Object.prototype.toString.call(e)===`[object Object]`}function ae(e){return new Promise(t=>{S.setTimeout(t,e)})}function oe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:te(e,t)}function se(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ce(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var le=Symbol();function ue(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===le?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function de(e,t){return typeof e==`function`?e(...t):!!e}function fe(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 pe=(()=>{let e=()=>w;return{isServer(){return e()},setIsServer(t){e=t}}})(),me=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(){}},he=new class extends me{#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`}},L=C;function ge(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=L,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 R=ge(),_e=new class extends me{#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 ve(e){return Math.min(1e3*2**e,3e4)}function ye(e){return(e??`online`)!==`online`||_e.isOnline()}var be=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function xe(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(T);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new be(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>he.isFocused()&&(e.networkMode===`always`||_e.isOnline())&&e.canRun(),p=()=>ye(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())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(m).catch(r=>{if(c())return;let i=e.retry??(pe.isServer()?0:3),a=e.retryDelay??ve,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),ae(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Se=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),D(this.gcTime)&&(this.#e=S.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(pe.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(S.clearTimeout(this.#e),this.#e=void 0)}};function Ce(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=>{fe(e,()=>t.signal,()=>n=!0)},u=ue(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?ce:se;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Te:we,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:we(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 we(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 Te(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ee=class extends Se{#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=ke(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=ke(this.options);e.data!==void 0&&(this.setState(Oe(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=oe(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(T).catch(T):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=>A(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===le||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>k(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:!O(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){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),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=ue(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`?Ce(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});let o=this.#a=xe({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof be&&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 o.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 be){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.#a===o&&(this.#a=void 0),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,...De(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Oe(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),R.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function De(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ye(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Oe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ke(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 Ae=class extends me{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Me(this.#t,this.options)?this.#m():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ne(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ne(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#b(),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 A(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#x(),this.#t.setOptions(this.options),t._defaulted&&!I(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Pe(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||A(this.options.enabled,this.#t)!==A(t.enabled,this.#t)||k(this.options.staleTime,this.#t)!==k(t.staleTime,this.#t))&&this.#h();let i=this.#g();r&&(this.#t!==n||A(this.options.enabled,this.#t)!==A(t.enabled,this.#t)||i!==this.#f)&&this.#_(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ie(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),Reflect.get(e,n))})}trackProp(e){this.#p.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),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#x();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(T)),t}#h(){this.#y();let e=k(this.options.staleTime,this.#t);if(pe.isServer()||this.#r.isStale||!D(e))return;let t=O(this.#r.dataUpdatedAt,e)+1;this.#u=S.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#g(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#_(e){this.#b(),this.#f=e,!(pe.isServer()||A(this.options.enabled,this.#t)===!1||!D(this.#f)||this.#f===0)&&(this.#d=S.setInterval(()=>{(this.options.refetchIntervalInBackground||he.isFocused())&&this.#m()},this.#f))}#v(){this.#h(),this.#_(this.#g())}#y(){this.#u!==void 0&&(S.clearTimeout(this.#u),this.#u=void 0)}#b(){this.#d!==void 0&&(S.clearInterval(this.#d),this.#d=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&&Me(e,t),o=i&&Pe(e,n,t,r);(a||o)&&(l={...l,...De(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.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=oe(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=oe(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{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:Fe(e,t),refetch:this.refetch,isEnabled:A(t.enabled,e)!==!1}}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.#l=this.#t),!I(t,e)&&(this.#r=t,this.#S({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);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)})})()}))}#x(){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.#v()}#S(e){R.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function je(e,t){return A(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||A(t.retryOnMount,e)!==!1)}function Me(e,t){return je(e,t)||e.state.data!==void 0&&Ne(e,t,t.refetchOnMount)}function Ne(e,t,n){if(A(t.enabled,e)!==!1&&k(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Fe(e,t)}return!1}function Pe(e,t,n,r){return(e!==t||A(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Fe(e,n)}function Fe(e,t){return A(t.enabled,e)!==!1&&e.isStaleByTime(k(t.staleTime,e))}function Ie(e,t){return!I(e.getCurrentResult(),t)}var Le=class extends Se{#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||Re(),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.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=xe({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)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),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:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}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.#r===r&&(this.#r=void 0),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),R.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Re(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ze=class extends me{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Le({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=Be(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=Be(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=Be(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=Be(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){R.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=>M(t,e))}findAll(e={}){return this.getAll().filter(t=>M(e,t))}notify(e){R.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return R.batch(()=>Promise.all(e.map(e=>e.continue().catch(T))))}};function Be(e){return e.options.scope?.id}var Ve=class extends me{#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),I(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&P(t.mutationKey)!==P(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}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??Re();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){R.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)})})}},He=class extends me{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??N(r,t),a=this.get(i);return a||(a=new Ee({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(){R.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=>j(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>j(e,t)):t}notify(e){R.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){R.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){R.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ue=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new He,this.#t=e.mutationCache||new ze,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=he.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=_e.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(k(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=E(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return R.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;R.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return R.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=R.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(T).catch(T)}invalidateQueries(e,t={}){return R.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=R.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(T)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(T)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(k(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(k(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(T).catch(T)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(T).catch(T)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return _e.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(P(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{F(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(P(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{F(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||=N(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===le&&(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()}},We=h.createContext(!1),Ge=()=>h.useContext(We);We.Provider;function Ke(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var qe=h.createContext(Ke()),Je=()=>h.useContext(qe),Ye=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?de(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Xe=e=>{h.useEffect(()=>{e.clearReset()},[e])},Ze=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||de(n,[e.error,r])),Qe=(e,t)=>t.state.data===void 0,$e=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))}},et=(e,t)=>e?.suspense&&t.isPending,tt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function nt(e,t,n){let r=Ge(),i=Je(),a=y(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,$e(o),Ye(o,i,s),Xe(i);let[l]=h.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(h.useSyncExternalStore(h.useCallback(e=>{let t=d?l.subscribe(R.batchCalls(e)):T;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),h.useEffect(()=>{l.setOptions(o)},[o,l]),et(o,u))throw tt(o,l,i);if(Ze({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function rt(e,t){return nt(e,Ae,t)}function it(e,t){return nt({...e,enabled:!0,suspense:!0,throwOnError:Qe,placeholderData:void 0},Ae,t)}function at(e,t){let n=y(t),[r]=h.useState(()=>new Ve(n,e));h.useEffect(()=>{r.setOptions(e)},[r,e]);let i=h.useSyncExternalStore(h.useCallback(e=>r.subscribe(R.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=h.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(T)},[r]);if(i.error&&de(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var ot=function(){return null},st=h.useLayoutEffect;function ct(e,t,n){h.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function lt(e){let t=h.useRef(null);return h.useImperativeHandle(e,()=>t.current,[]),t}function ut(e){return e[e.length-1]}function dt(e,t){return typeof e==`function`?e(t):e}var ft=Object.prototype.hasOwnProperty,pt=Object.prototype.propertyIsEnumerable;function mt(e){for(let t in e)if(ft.call(e,t))return!0;return!1}var ht=()=>Object.create(null),gt=(e,t)=>_t(e,t,ht);function _t(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=xt(e)&&xt(i);if(!a&&!(yt(e)&&yt(i)))return i;let o=a?e:vt(e);if(!o)return i;let s=a?i:vt(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:ft.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=_t(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function vt(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!pt.call(e,r))return!1;t.push(r)}return t}function yt(e){if(!bt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!bt(n)||!n.hasOwnProperty(`isPrototypeOf`))}function bt(e){return Object.prototype.toString.call(e)===`[object Object]`}function xt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function St(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(!St(e[r],t[r],n))return!1;return!0}if(yt(e)&&yt(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!St(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||!St(e[o],t[o],n)))return!1;return i===a}return!1}var Ct=/[\x00-\x1f\x7f"<>`{}]/g;function wt(e){return e.replace(Ct,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function Tt(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 wt(t)}var Et=[`http:`,`https:`,`mailto:`,`tel:`];function Dt(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Ot(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+=Tt(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=Tt(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function kt(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function At(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 jt(){throw Error(`Invariant failed`)}function Mt(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 Nt=4,Pt=5;function Ft(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=a.indexOf(`{`),s;if(o!==-1&&o+1<a.length&&(s=a.indexOf(`}`,o))!==-1){let r=a.charCodeAt(o+1);if(r===45){if(o+2<a.length&&a.charCodeAt(o+2)===36){let e=o+3,r=s;if(e<r)return n[0]=3,n[1]=t+o,n[2]=t+e,n[3]=t+r,n[4]=t+s+1,n[5]=i,n}}else if(r===36){let r=o+1,a=o+2;return a===s?(n[0]=2,n[1]=t+o,n[2]=t+r,n[3]=t+a,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+o,n[2]=t+a,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 It(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=Ft(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=Rt(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);u||(t=t.toLowerCase(),c=c.toLowerCase());let m=f===1?i.dynamic:f===3?i.optional:i.wildcard,h=f!==2&&!d&&m?.find(e=>!e.parse&&e.caseSensitive===p&&e.prefix===t&&e.suffix===c);if(h)n=h;else{let e=zt(f,r,p,t,c);n=e,e.parent=i,e.depth=a;let s;s=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],s.push(e),s.length===2&&o?.push(s)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Rt(r);e.kind=Pt,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=Rt(r);e.kind=Nt,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)It(e,t,r,c,i,a,o,s)}function Lt(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 Rt(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 zt(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 Bt(e,t){let n=Rt(`/`),r=new Uint16Array(6),i=[];for(let t of e)It(!1,r,t,1,n,0,i);for(let e of i)e.sort(Lt);t.masksTree=n,t.flatCache=Mt(1e3)}function Vt(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=Kt(e,t.masksTree);return t.flatCache.set(e,r),r}function Ht(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Rt(`/`),It(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),Kt(r,o,n)}function Ut(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=Kt(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Jt(a.route)),t.matchCache.set(r,a),a}function Wt(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Gt(e,t=!1,n){let r=Rt(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;It(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&jt(),o[e.id]=e,c!==0&&e.path){let t=Wt(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(Lt);return{processedTree:{segmentTree:r,singleCache:Mt(1e3),matchCache:Mt(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function Kt(e,t,n=!1){let r=e.split(`/`),i=Xt(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=Yt(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===Nt)break;if(u.kind===Pt){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;if(e.charCodeAt(t)===123){let n=u.suffix.length,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,r=u.suffix.length,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,e.length-t.suffix.length),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 Jt(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Yt(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Xt(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!ut(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&&!en(l,n))continue;if(i.parse){if(!$t(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==Nt&&en(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===Nt||i.kind===2)&&en(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&&($t(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Qt(f,o))return n;en(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(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length<r.length)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.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+Zt(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.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+Zt(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+Zt(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+Zt(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 Zt(e,t){return 2**(e-t-1)}function Qt(e,t){return e===2**(t-1)-1}function $t(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 en(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===Nt)>(e.node.kind===Nt)||t.node.kind===Nt==(e.node.kind===Nt)&&t.node.depth>e.node.depth)))}function tn(e){return nn(e.filter(e=>e!==void 0).join(`/`))}function nn(e){return e.replace(/\/{2,}/g,`/`)}function rn(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function an(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function on(e){return an(rn(e))}function sn(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function cn(e,t,n){return sn(e,n)===sn(t,n)}function ln({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=nn(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=nn(e)),o=e.split(`/`);o.length>1&&ut(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(ut(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?nn(s):s)||`/`;return a&&r&&r.set(a,c),c}function un(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 dn(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>pn(e,n)).join(`/`):pn(r,n):r}function fn({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=Ft(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=dn(`_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=dn(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=dn(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function pn(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function mn(e){return e?.isNotFound===!0}function hn(){try{return sessionStorage}catch{return}}var gn=`tsr-scroll-restoration-v1_3`,_n=hn();function vn(){try{return JSON.parse(_n?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function yn(){try{_n?.setItem(gn,JSON.stringify(bn))}catch{}}var bn=vn(),xn=`data-scroll-restoration-id`,Sn=e=>e.state.__TSR_key||e.href;function Cn(e){let t=e.getAttribute(xn);if(t)return`[${xn}="${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 wn=!1,Tn=`window`;function En(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Dn(e){let t=new Set;for(let n of e){if(n===Tn)continue;let e=En(n);e&&t.add(e)}return t}function On(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Sn,a=new Set,o=e=>{let t=bn[e]||={};for(let e of a)e===document?t[Tn]={scrollX,scrollY}:e.isConnected&&(t[Cn(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,wn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{wn||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())),yn()})),!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=bn[d];if(e){let t=bn[u];for(let n in e){if(n===Tn){if(s)continue}else{let e=En(n);if(!e||s&&o&&(l??=Dn(o),l.has(e)))continue}t||=bn[u]={},t[n]??=e[n]}}}wn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Dn(o));let t=e&&i&&c,s=r.restoring?bn[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Tn){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=En(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{wn=!1}}))}function kn(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 An(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function jn(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]=An(r):Array.isArray(t)?t.push(An(r)):n[e]=[t,An(r)]}return n}var Mn=/^(?:\s|["[{\d-]|fa|nu|tr)/,Nn=Fn(JSON.parse),Pn=In(JSON.stringify,JSON.parse);function Fn(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=jn(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function In(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!Mn.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=kn(e,r);return t?`?${t}`:``}}var Ln=`__root__`;function Rn(e){if(e.statusCode=e.statusCode||e.code||307,!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 zn(e){return e instanceof Response&&!!e.options}function Bn(e){return{input:({url:t})=>{for(let n of e)t=Hn(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Un(e[n],t);return t}}}function Vn(e){let t=on(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=tn([`/`,t,e.pathname]),e)}}function Hn(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 Un(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 Wn(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(()=>{At(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 Gn=`__TSR_index`,Kn=`popstate`,qn=`beforeunload`;function Jn(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=$n(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[Gn];i=Yn(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[Gn];i=Yn(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[Gn]!==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 Yn(e,t){t||={};let n=er();return{...t,key:n,__TSR_key:n,[Gn]:e}}function Xn(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??(()=>$n(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=er();t.history.replaceState({[Gn]: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=$n(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[Gn]-l.state[Gn],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=Jn({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(qn,x,{capture:!0}),t.removeEventListener(Kn,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(qn,x,{capture:!0}),t.addEventListener(Kn,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 Zn(e){let t=e?.window??(typeof document<`u`?window:void 0);return Xn({window:t,parseLocation:()=>{let e=t.location.hash.split(`#`).slice(1),n=e[0]??`/`,r=t.location.search,i=e.slice(1);return $n(`${n}${r}${i.length===0?``:`#${i.join(`#`)}`}`,t.history.state)},createHref:e=>`${t.location.pathname}${t.location.search}#${e}`})}function Qn(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function $n(e,t){let n=Qn(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=er();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||{[Gn]:0,key:a,__TSR_key:a}}}function er(){return(Math.random()+1).toString(36).substring(7)}function tr(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function nr(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function rr({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function ir(e,t,n,r){for(let i of t){if(r&&e._tx!==r)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r&&e._tx!==r)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var ar=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=un(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Xn()),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=Mt(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Wn(this.latestLocation,e),On(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=on(a);t&&t!==`/`&&e.push(Vn({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Bn(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=Gt(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Bt(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:Ot(e).path,external:!1,searchStr:o,search:gt(t?.search,i),hash:Ot(r.slice(1)).path,state:_t(t?.state,a)}}let o=new URL(i,this.origin),s=Hn(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:Ot(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:gt(t?.search,c),hash:Ot(s.hash.slice(1)).path,state:_t(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)=>ln({base:e,to: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=Ut(an(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={})=>{if(t.href){let e=$n(t.href,{});t={...t,to:Hn(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}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=r[2],o=r[3],s=this.resolvePathWithBase(i,t.to?`${t.to}`:`.`),c=dr(t.params,o),l=this.routesByPath[an(s)],u;if(l)u=this.getRouteBranch(l);else if(s.includes(`$`))u=[];else{let[e,t,n]=this.getMatchedRoutes(s);u=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(u=[...u,this.options.notFoundRoute])}if(u.length&&mt(c))for(let e of u){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){c===o&&(c=Object.assign(Object.create(null),c));try{Object.assign(c,t(c))}catch{}}}let d=e.leaveParams?s:Ot(fn({path:s,params:c,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,f=a;if(e._includeValidateSearch&&this.options.search?.strict){let e={};u.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,cr(t.options.validateSearch,{...e,...f}))}catch{}}),f=e}f=lr(f,t,u,e._includeValidateSearch),f=gt(a,f);let p=this.options.stringifySearch(f),m=t.hash===!0?n.hash:t.hash?dt(t.hash,n.hash):void 0,h=m?`#${m}`:``,g=t.state===!0?n.state:t.state?dt(t.state,n.state):{};t.state&&(g=_t(n.state,g));let _=`${d}${p}${h}`,v,y,b=!1;if(this.rewrite){let e=new URL(_,this.origin),t=Un(this.rewrite,e);v=e.href.replace(e.origin,``),t.origin===this.origin?y=t.pathname+t.search+t.hash:(y=t.href,b=!0)}else v=kt(_),y=v;return{publicHref:y,href:v,pathname:d,search:f,searchStr:p,state:g,hash:m??``,external:b,unmaskOnReload:t.unmaskOnReload}},n=t(e);if(e.mask)n.maskedLocation=t({from:e.from,...e.mask});else if(this.options.routeMasks){let r=Vt(n.pathname,this.processedTree);if(r){let i=Object.assign(Object.create(null),r.rawParams),{from:a,params:o,...s}=r.route,c=dr(o,i);n.maskedLocation=t({from:e.from,...s,params:c})}}return n},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=an(this.latestLocation.href)===an(n.href)&&St(rr(n.state),rr(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,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},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(Dt(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 ei(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(nr(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`)&&tr(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){let t=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&&Dt(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=hr,this.preloadRoute=e=>ti(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=Ht(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!St(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?St(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??Pn,parseSearch:e.parseSearch??Nn,protocolAllowlist:e.protocolAllowlist??Et}),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=Jt(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[`**`]:an(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?ur(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=cr(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof or||(r=new or(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:_}=fn({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{fr(i,d)}catch(e){if(x=mn(e)||zn(e)?e:new sr(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:gt(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=tr(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?gt(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?_t(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`?gt(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=ut(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=ut(a),c={...e.search};for(let e of a)try{Object.assign(c,cr(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{fr(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}},or=class extends Error{},sr=class extends Error{};function cr(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new or(`Async validation not supported`);if(n.issues)throw new or(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 lr(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;r&&n&&i.push(({search:e,next:t,meta:r})=>{let i=t(e);try{let e=cr(n,i);if(r&&e)for(let t in e)t in i||(r.defaulted||=new Map).set(t,e[t]);return{...i,...e}}catch{}return i})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=dt(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 ur(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 Ln}function dr(e,t){if(e===!1||e===null)return Object.create(null);if((e??!0)===!0)return t;let n=Object.assign(Object.create(null),t);return Object.assign(n,dt(e,n))}function fr(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function pr(e,t){return e.options[t]?.preload?.()}function mr(e,t){let n=pr(e,`component`),r=pr(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function hr(e,t,n){let r=()=>t===!1?void 0:t?pr(e,t):mr(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 gr(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var _r=0,vr=1,yr=2,z=3,br=[4];function xr(e){return typeof e[0]==`number`}function Sr(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 Cr(e,t){return e.routesById[t.routeId]}function wr(e,t,n){return zn(e)?[z,e]:mn(e)?(e.routeId||=n,[yr,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[vr,e]):[_r,e]}function Tr(e,t){let n=wr(t,!0,e.id);if(n[0]!==vr)return n;try{e.options.onError?.(n[1])}catch(t){n=wr(t,!0,e.id)}return n}function Er(e,t,n,r,i){return i[0].signal.aborted?br:Vr(e,t,n,Tr(n,r),i)}async function Dr(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;i<r;i++){let r=s[i],u=Cr(e,r);r.abortController=n[0];let d=s[i-1]?.context??e.options.context??{},f={params:r.params,location:o,navigate:t=>e.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return kr(e,r),[i,Er(e,t,u,a,n)]}if(c.aborted)return[i,br];let p=r.paramsError??r.searchError;if(p!==void 0)return kr(e,r),[i,Er(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{jr(e,r,`beforeLoad`,n[0]);let a=await Sr(m({...f,search:r.search,context:r.context,...e.options.additionalContext}),c);if(c.aborted)return[i,br];let o=Vr(e,t,u,wr(a,!1,u.id),n);if(o[0]!==_r)return kr(e,r),[i,o];r.context={...r.context,...a}}catch(a){return kr(e,r),[i,Er(e,t,u,a,n)]}finally{r.status=h,jr(e,r,!1,n[0])}}i()}function Or(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 kr(e,t){let n=t._flight;t._flight=void 0,Or(e,t,n)?.abort()}function B(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Or(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Ar(e){for(let t of e){let e=t._flight;e&&e[2]++}}function jr(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 Mr(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation: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 Nr(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return br;if(!i)return[_r,void 0];let l=n._flight;jr(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(Mr(e,t,n,r,s,a,!!o[3]))).then(e=>wr(e,!1,r.id),e=>wr(e,!0,r.id)).then(t=>(t[0]!==_r&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===vr&&l[2]?Tr(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Vr(e,t,r,await Sr(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return kr(e,n),br}finally{jr(e,n,!1,s)}}function Pr(e,t,n){t[0]!==z&&(e.status=`success`,e.error=void 0,t[0]===_r?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function Fr(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&&kr(e,r)}function Ir(e,t){return t[0]===vr||t[0]===yr?{...e,status:t[0]===vr?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Lr(e,t,n,r,i,a,o){let s=t[1][n],c=Cr(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(Mr(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=br)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,kr(e,s),p=Er(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!!(m&&f&&s.status===`success`&&!l&&!a[4]&&((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)!==`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Or(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=(p?Promise.resolve(p):x?Nr(e,t,s,c,g,i,a):Promise.resolve([_r,s.loaderData])).then(t=>(x&&(Pr(s,t,l),t[0]===_r&&(m&&!a[0].signal.aborted&&Fr(e,s,u),n>=o&&(s.status=`pending`))),t)),T=Sr(Promise.resolve().then(()=>hr(c,void 0,C)),a[0].signal).then(()=>void 0,r=>t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound))?void 0:[n,Er(e,t,c,r,a)]).then(e=>w.then(t=>(x&&!e&&t[0]===_r&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.()),e)));if(r.push([n,w,T]),!y)return w.then(e=>Ir(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let D=Nr(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,Pr(E,e,!1),e));return(t[2]??=[]).push([n,D,T,E]),D.then(e=>Ir(E,e))}async function Rr(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=Cr(e,t[n]);try{let e=hr(i,!1);e&&await Sr(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function zr(e,t){t[2]&&=(B(e,t[2].map(e=>e[3])),void 0)}async function Br(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]>=z)throw[a,t];!i&&t[0]!==_r&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===z)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Vr(e,t,n,r,i,a){for(;r[0]===z;){let o=r[1],s=o.options;if(s.reloadDocument?i[3]:i[1]>=20)return r;try{return s.href&&s.reloadDocument?(e.resolveRedirect(o),r):[z,o,e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0})]}catch(e){r=a?[vr,e]:Tr(n,e),a=!0}}return r}async function Hr(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===yr?Rr(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=z)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==_r&&t[0]<z&&!(`loaderData`in o[e[0]])){s=[e[0],t],d=s[2]=await u(s);break}}}for(let e of n){if(e[0]>=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=z){let n=s[1];if(n[0]!==z||n[1].options.reloadDocument||n[2])return zr(e,t),n;c=!0,s=[0,[vr,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===vr?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)};p(),i||a?.();let m=Cr(e,u);try{await Sr(i?Promise.resolve().then(()=>hr(m,l===vr?`errorComponent`:`notFoundComponent`)):Promise.all([hr(m),hr(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return zr(e,t),br}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),zr(e,t),B(e,o),p()):u.status=`success`}return t}async function Ur(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=Cr(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 Sr(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&&n.aborted)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function Wr(e,t,n,r){let i=[t,n],a=r[0].signal,o;try{let t=e.stores.matches.get(),s=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await Rr(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l<c&&l!==s;){let e=n[l],i=r[2][l],a=t[l];if(i?.id!==e.id||i.status!==`success`||i._notFound||e.preload||a?.id!==e.id||a.status!==`success`||a._notFound)break;l++}let u=[],d=r[6]??0,f=d?Promise.resolve(n[d-1]):void 0,p=()=>{for(let t=d;t<c&&!a.aborted;t++)f=Lr(e,i,t,u,f,r,l)},m=await Dr(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===yr){let t=await Rr(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=z&&(c=0);p()}if(!a.aborted&&!r[3]){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()}let h=Hr(e,i,u,r[0],Br(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Br(i[2],void 0,void 0,h.then(e=>xr(e)?0:gr(n).length,()=>0))),o=await h}catch(t){if(zr(e,i),t===a&&a.aborted)return br;throw t}return xr(o)?o:Ur(e,o,a,r[6]===n.length?r[6]:0)}function Gr(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a<n.length;a++){let o=n[a],s=o.status===`success`&&!o._notFound,c=r[a]?.id===o.id&&r[a]?.status===`pending`;if(s&&!c)continue;let l=Cr(e,o),u=s||o.invalid?0:l.options.pendingMs??e.options.defaultPendingMs,d=l.options.pendingComponent??e.options.defaultPendingComponent;if(!d||typeof u!=`number`||u===1/0){i&&(i[0]=t,i[2]=0,i[4]=!0);return}let f=l.options.pendingMinMs??e.options.defaultPendingMinMs??0,p=!1;if(i?.[1]===o.id?(p=i[0]!==t,i[0]=t):(clearTimeout(i?.[3]),e._pending=i=void 0),i||(e._pending=i=[t,o.id,c?Date.now()+f:t[4]+u,void 0,c||void 0,d]),i[4]&&!p&&i[5]===d)return;if(i[5]=d,!i[4]){clearTimeout(i[3]);let n=i[2]-Date.now();if(n>0){i[3]=setTimeout(()=>Gr(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function Kr(e,t){let n=e._pending;(e._tx===t||!e._tx?.[3].some(e=>e.id===n?.[1]))&&(clearTimeout(n?.[3]),e._pending=void 0)}async function qr(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!gr(t[3]).some(e=>e.id===n[1]))return;let i;try{await Sr(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function Jr(e,t){e._committed=t,e.stores.setMatches(t)}function Yr(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=gr(n).length,s=new Map;{let t=Date.now();for(let r of[...i,...a.values()]){if(r.status!==`success`||n.some((e,t)=>e.id===r.id&&(t<o||e.status===`success`)))continue;let i=Cr(e,r);!i.options.loader||t-r.updatedAt>=(r.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||s.set(r.id,a.get(r.id)===r?r:{...r,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=s,Jr(e,n),B(e,[...a.values(),...i],[...n,...s.values()]),ir(e,i,n,t)}async function Xr(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}function Zr(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:i.publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function Qr(e,t,n,r,i){let a=n.map(e=>({...e}));Ar(a);for(let t of r)kr(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Hr(e,o,r,t[0],i)}catch(t){throw B(e,a),t}if(xr(s)){B(e,a),s[0]===z&&e._tx===t&&e._committed===n&&await Zr(e,t,s);return}if(await Ur(e,s,t[0].signal),e._tx!==t||e._committed!==n){B(e,a);return}for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),kr(e,n))}Jr(e,a),B(e,n,a)}async function $r(e,t,n,r,i,a){let o=await Wr(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(xr(o)){let n=o[0]===z&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Kr(e,t),B(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Kr(e,t);return}await Zr(e,t,o);return}let s=o[1];if(e._tx===t&&await qr(e,t),e._tx!==t){Kr(e,t),B(e,s),zr(e,o);return}let c=t[2],l=nr(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await qr(e,t),e._tx!==t){Kr(e,t),B(e,s),zr(e,o);return}let n=await e.startTransition(()=>{Kr(e,t),Yr(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);if(e._tx!==t){zr(e,o);return}u?.length&&Qr(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function ei(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){let t=nr(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await Xr(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Ar(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){B(e,m),await Xr(e,n);return}e._preflight=void 0;let g,_=()=>$r(e,y,f,()=>Gr(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_).then(),y=[p,s,a,m,Date.now(),v];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&jr(e,t,!1)}n[0].abort(),B(e,n[3],y[3],!0)}if(e._tx!==y){B(e,y[3]),y[3]=[],g?.(),await Xr(e,y);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&Gr(e,y),g?.(_()),await v,await Xr(e,y)}async function ti(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Ar(a),o=(e._preloads??=new Map).set(i,a),s=await Wr(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),B(e,a)),i.abort()}if(!xr(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){mn(e)||console.error(e);return}}}var ni=`Error preloading route! ☝️`,ri=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=Ln:this.parentRoute||jt();let r=n?Ln:t?.path;r&&r!==`/`&&(r=rn(r));let i=t?.id||r,a=n?Ln:tn([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=tn([`/`,a]));let o=a===`__root__`?`/`:tn([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=an(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=>Rn({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.`)}},ii=class extends ri{constructor(e){super(e)}},ai=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??oi,{error:e,reset:this.reset}):this.props.children}};function oi({error:e}){let[t,n]=h.useState(!1);return(0,_.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,_.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,_.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,_.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,_.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,_.jsx)(`div`,{children:(0,_.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,_.jsx)(`code`,{children:e.message}):null})}):null]})}function si({children:e,fallback:t=null}){return(0,_.jsx)(h.default.Fragment,{children:ci()?e:t})}function ci(){return h.default.useSyncExternalStore(li,()=>!0,()=>!1)}function li(){return()=>{}}var ui=h.createContext(null);function V(e){return h.useContext(ui)}var di=h.createContext(void 0),fi=h.createContext(void 0),H=(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))(H||{});function pi({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 mi(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 hi=[],gi=0,{link:_i,unlink:vi,propagate:yi,checkDirty:bi,shallowPropagate:xi}=pi({update(e){return e._update()},notify(e){hi[Ci++]=e,e.flags&=~H.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=H.Mutable|H.Dirty,Di(e))}}),Si=0,Ci=0,wi,Ti=0;function Ei(e){try{++Ti,e()}finally{--Ti||Oi()}}function Di(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=vi(n,e)}function Oi(){if(!(Ti>0)){for(;Si<Ci;){let e=hi[Si];hi[Si++]=void 0,e.notify()}Si=0,Ci=0}}function ki(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?H.None:H.Mutable,get(){return wi!==void 0&&_i(i,wi,gi),i._snapshot},subscribe(e){let t=mi(e),n={current:!1},r=Ai(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=wi,o=t?.compare??Object.is;if(n)wi=i,++gi,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=H.Mutable|H.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{wi=a,n&&(i.flags&=~H.RecursedCheck),Di(i)}}};return n?(i.flags=H.Mutable|H.Dirty,i.get=function(){let e=i.flags;if(e&H.Dirty||e&H.Pending&&bi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&xi(e)}}else e&H.Pending&&(i.flags=e&~H.Pending);return wi!==void 0&&_i(i,wi,gi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(yi(e),xi(e),Oi())}},i}function Ai(e){let t=()=>{let t=wi;wi=n,++gi,n.depsTail=void 0,n.flags=H.Watching|H.RecursedCheck;try{return e()}finally{wi=t,n.flags&=~H.RecursedCheck,Di(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:H.Watching|H.RecursedCheck,notify(){let e=this.flags;e&H.Dirty||e&H.Pending&&bi(this.deps,this)?t():this.flags=H.Watching},stop(){this.flags=H.None,this.depsTail=void 0,Di(this)}};return t(),n}var ji=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})),Mi=f(((e,t)=>{t.exports=ji()})),Ni=f((e=>{var t=globalThis.React,n=Mi();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}})),Pi=f(((e,t)=>{t.exports=Ni()}))();function Fi(e,t){return e===t}function Ii(e,t,n=Fi){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,Pi.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Li={};function Ri(e,t){let n=h.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=_t(n.current,i):i}}function zi(e){let t=V(),n=h.useContext(e.from?fi:di),r=e.from??n,i=t.stores.getMatchStore(r),a=Ri(e,t),o=Ii(i,e=>e?a(e):Li);if(o!==Li)return o;(e.shouldThrow??!0)&&jt()}function Bi(e){return zi({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Vi(e){let{select:t,...n}=e;return zi({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Hi(e){return zi({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 Ui(e){return zi({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Wi(e){let t=V();return h.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Gi(e){return zi({...e,select:t=>e.select?e.select(t.context):t.context})}function Ki(e){let t=h.useRef(e);return St(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function qi(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Ji(e,t,n){if(e?.external)return Dt(e.href,n)?void 0:e.href;if(!aa(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),Dt(t,n)?void 0:t}catch{}}function Yi(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!cn(e.pathname,t.pathname,r))return!1}else{let n=sn(e.pathname,r),i=sn(t.pathname,r);if(!(n.startsWith(i)&&(n.length===i.length||n[i.length]===`/`)))return!1}return(n?.includeSearch??!0)&&!St(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function Xi(e,t){let n=V(),r=lt(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:g,children:_,target:v,disabled:y,style:b,className:x,onClick:S,onBlur:C,onFocus:w,onMouseEnter:T,onMouseLeave:E,onTouchStart:D,ignoreBlocker:O,params:k,search:A,hash:j,state:M,mask:N,reloadDocument:P,unsafeRelative:F,from:ee,_fromLocation:te,...I}=e,ne=ci(),re=Ki(e.search),ie=Ki(e.params),ae=Ki(o),oe=h.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,re,ie,e.state,e.mask,e.unsafeRelative]),se=h.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...oe}),r=ia(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,y),i=Ji(r,s,n.protocolAllowlist);return[r?.href,i,Yi(e,t,ae,n.basepath,ne,i!==void 0)]},[ae,y,ne,oe,n,s]),[ce,le,ue]=Ii(n.stores.location,se,qi),de=ue?dt(i,{})??Qi:Zi,fe=ue?Zi:dt(a,{})??Zi,pe=[x,de.className,fe.className].filter(Boolean).join(` `),me=(b||de.style||fe.style)&&{...b,...de.style,...fe.style},he=h.useRef(!1),L=e.reloadDocument||le||y?!1:c??n.options.defaultPreload,ge=l??n.options.defaultPreloadDelay??0,R=h.useCallback(()=>{n.preloadRoute(oe).catch(e=>{console.warn(e),console.warn(ni)})},[n,oe]),_e=h.useCallback(e=>{if(!e){na(r);return}if(!(e.isIntersecting??L===`intent`)){e.isIntersecting===!1&&na(r);return}if(!ge){R();return}ta.has(r)||ta.set(r,setTimeout(()=>{ta.delete(r),R()},ge))},[R,r,L,ge]);ct(r,_e,L!==`viewport`),h.useEffect(()=>{he.current||L===`render`&&(R(),he.current=!0)},[R,L]);let ve=e=>{let t=e.currentTarget.getAttribute(`target`),r=v===void 0?t:v;!y&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...oe,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:g,ignoreBlocker:O}))};if(le)return{...I,ref:r,href:le,..._&&{children:_},...v&&{target:v},...y&&{disabled:y},...b&&{style:b},...x&&{className:x},...S&&{onClick:S},...C&&{onBlur:C},...w&&{onFocus:w},...T&&{onMouseEnter:T},...E&&{onMouseLeave:E},...D&&{onTouchStart:D}};let ye=()=>{L===`intent`&&R()},be=()=>{L===`intent`&&na(r)};return{...I,...de,...fe,href:ce,ref:r,onClick:ra([S,ve]),onBlur:ra([C,be]),onFocus:ra([w,_e]),onMouseEnter:ra([T,_e]),onMouseLeave:ra([E,be]),onTouchStart:ra([D,ye]),disabled:!!y,target:v,...me&&{style:me},...pe&&{className:pe},...y&&$i,...ue&&ea}}var Zi={},Qi={className:`active`},$i={role:`link`,"aria-disabled":!0},ea={"data-status":`active`,"aria-current":`page`},ta=new WeakMap,na=e=>{clearTimeout(ta.get(e)),ta.delete(e)},ra=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function ia(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function aa(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var oa=h.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Xi(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)}),sa=class extends ri{constructor(e){super(e),this.useMatch=e=>zi({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Gi({...e,from:this.id}),this.useSearch=e=>Ui({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Hi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Vi({...e,from:this.id}),this.useLoaderData=e=>Bi({...e,from:this.id}),this.useNavigate=()=>Wi({from:this.fullPath}),this.Link=h.default.forwardRef((e,t)=>(0,_.jsx)(oa,{ref:t,from:this.fullPath,...e}))}};function ca(e){return new sa(e)}var la=class extends ii{constructor(e){super(e),this.useMatch=e=>zi({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Gi({...e,from:this.id}),this.useSearch=e=>Ui({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Hi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Vi({...e,from:this.id}),this.useLoaderData=e=>Bi({...e,from:this.id}),this.useNavigate=()=>Wi({from:this.fullPath}),this.Link=h.default.forwardRef((e,t)=>(0,_.jsx)(oa,{ref:t,from:this.fullPath,...e}))}};function ua(e){return new la(e)}function da(e){let t=V(),n=`not-found-${Ii(t.stores.location,e=>e.pathname)}-${Ii(t.stores.status,e=>e)}`;return(0,_.jsx)(ai,{getResetKey:()=>n,onCatch:(t,n)=>{if(mn(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(mn(t))return e.fallback?.(t);throw t},children:e.children})}function fa(){return(0,_.jsx)(`p`,{children:`Not Found`})}function pa(e){return(0,_.jsx)(_.Fragment,{children:e.children})}function ma(e,t,n){return t.options.notFoundComponent?(0,_.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,_.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,_.jsx)(fa,{})}function ha(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,_.jsx)(n,{}):null}var ga=(e,t)=>e[0]===t[0]&&e[1]===t[1],_a=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,va=h.memo(function({routeId:e}){let t=V();return(0,_.jsx)(ya,{router:t,match:Ii(t.stores.getMatchStore(e),e=>e)})});function ya({router:e,match:t}){let n=e.routesById[t.routeId],r=ha(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=_a(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?h.Suspense:pa,l=i?ai:pa,u=o?da:pa;return(0,_.jsxs)(n.isRoot?n.options.shellComponent??pa:pa,{children:[(0,_.jsx)(di.Provider,{value:t.routeId,children:(0,_.jsx)(c,{fallback:r,children:(0,_.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(mn(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,_.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return h.createElement(o,e)},children:s?(0,_.jsx)(si,{fallback:r,children:(0,_.jsx)(ba,{match:t})}):(0,_.jsx)(ba,{match:t})})})})}),null]})}var ba=h.memo(function({match:e}){let t=V(),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,_.jsx)(e,{},i):(0,_.jsx)(xa,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!_a(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return ha(t,r)}if(e.status===`notFound`)return ma(t,r,e.error);if(e.status===`error`)throw e.error;return a}),xa=h.memo(function(){let e=V(),t=h.useContext(di),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=Ii(a,e=>[!!e._notFound,e.error],ga),i=Ii(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return ma(e,e.routesById[t],r);if(!i)return null;let a=(0,_.jsx)(va,{routeId:i});return t===`__root__`?(0,_.jsx)(h.Suspense,{fallback:ha(e),children:a}):a});function Sa(e,t){let n=e[1];e.length=0,n?.(t)}function Ca({t:e}){let t=V(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Sa(n,!1),n.push(i,a),e(t),h.startTransition(r)}),st(()=>{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(an(r.publicHref)!==an(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`,...nr(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function wa(){let e=V(),t=e.routesById[Ln],n=ha(e,t),r=e.ssr?pa:h.Suspense,i=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Ca,{t:h.useState()[1]}),(0,_.jsx)(r,{fallback:n,children:(0,_.jsx)(Ta,{})})]});return e.options.InnerWrap?(0,_.jsx)(e.options.InnerWrap,{children:i}):i}function Ta(){let e=V(),t=e._rendered,n=Ii(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;st(()=>{t[0]===n&&Sa(t,!0)},[t,n]);let a=i?(0,_.jsx)(va,{routeId:i}):null;return(0,_.jsx)(di.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,_.jsx)(ai,{getResetKey:()=>r,onCatch:void 0,children:a})})}function Ea(){let e=V();return 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,Ii(e.stores.location,e=>e.href),Ii(e.stores.resolvedLocation,e=>e?.href),Ii(e.stores.status,e=>e)])}var Da=e=>({createMutableStore:ki,createReadonlyStore:ki,batch:Ei}),Oa=e=>new ka(e),ka=class extends ar{constructor(e){super(e,Da)}};function Aa({router:e,children:t,...n}){mt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,_.jsx)(ui.Provider,{value:e,children:t});return e.options.Wrap?(0,_.jsx)(e.options.Wrap,{children:r}):r}function ja({router:e,...t}){return(0,_.jsx)(Aa,{router:e,...t,children:(0,_.jsx)(wa,{})})}function Ma(e){let t=V();return Ii(t.stores.location,Ri(e,t))}var Na=(0,h.createContext)(null),Pa={didCatch:!1,error:null},Fa=class extends h.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Pa}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(Pa))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&Ia(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(Pa))}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)(Na.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function Ia(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})()}))()),La={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 Ra(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=Ra(e);return(0,_.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`,La[c],s?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`,r),...o,children:[t&&(0,_.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,_.jsx)(`circle`,{className:`wcpos:opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,_.jsx)(`path`,{className:`wcpos:opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),i]})}function za({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,_.jsxs)(`div`,{className:(0,U.default)(`wcpos:flex wcpos:items-center wcpos:gap-3`,o),children:[(0,_.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,_.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,_.jsxs)(`div`,{onClick:f,children:[(0,_.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,_.jsx)(`p`,{id:d,className:`wcpos:text-sm wcpos:text-gray-500`,children:i})]})]})}function Ba({label:t,className:n,id:r,disabled:i,indeterminate:a,...o}){let s=e.useId(),c=r||s,l=e.useRef(null);return e.useEffect(()=>{l.current&&(l.current.indeterminate=!!a&&!o.checked)},[a,o.checked]),(0,_.jsxs)(`div`,{className:(0,U.default)(`wcpos:flex wcpos:items-center wcpos:gap-2`,n),children:[(0,_.jsx)(`input`,{ref:l,id:c,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,...o}),t&&(0,_.jsx)(`label`,{htmlFor:c,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,_.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 Va=e.forwardRef(({error:e,className:t,...n},r)=>(0,_.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}));Va.displayName=`TextArea`;function Ha({value:e,options:t,onChange:n,placeholder:r,disabled:i,className:a,inline:o,...s}){return(0,_.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,_.jsx)(`option`,{value:``,disabled:!0,children:r}),t.map(e=>(0,_.jsx)(`option`,{value:String(e.value),disabled:!!e.disabled,children:e.label},String(e.value)))]})}var Ua=`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`,Wa=`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`;function Ga(e){return e.toLowerCase()}function Ka({countries:t,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),v=e.useRef(null),[y,b]=e.useState(!1),[x,S]=e.useState(``),[C,w]=e.useState(0),[T,E]=e.useState({top:0,left:0,width:0}),D=e.useId(),O=e.useMemo(()=>Object.entries(t).map(([e,t])=>({value:e,label:t})).sort((e,t)=>e.label.localeCompare(t.label)),[t]),k=e.useMemo(()=>{let e=Ga(x.trim());return e?O.filter(t=>Ga(t.label).includes(e)||Ga(t.value).includes(e)):O},[O,x]),A=e.useMemo(()=>c?[{value:``,label:l??`—`,isClear:!0},...k]:k,[c,l,k]),j=r?t[r]:``,M=e.useCallback(()=>{if(!m.current)return;let e=m.current.getBoundingClientRect();E({top:e.bottom+4,left:e.left,width:e.width})},[]),N=e.useCallback(()=>{b(!1),S(``)},[]),P=e.useCallback(()=>{if(u)return;b(!0);let e=r?Math.max(0,A.findIndex(e=>!e.isClear&&e.value===r)):+!!c;w(Math.min(e,Math.max(0,A.length-1)))},[c,u,A,r]),F=e.useCallback(e=>{i(e),N(),m.current?.focus()},[N,i]);e.useLayoutEffect(()=>{if(!y)return;M();let e=requestAnimationFrame(()=>g.current?.focus());return()=>cancelAnimationFrame(e)},[y,M]),e.useEffect(()=>{if(!y)return;let e=e=>{let t=e.target;m.current?.contains(t)||h.current?.contains(t)||N()};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)}},[y,N,M]),e.useEffect(()=>{y&&w(e=>A.length===0?0:e>=A.length?A.length-1:e)},[y,A]),e.useEffect(()=>{!y||!v.current||v.current.querySelector(`[data-index="${C}"]`)?.scrollIntoView?.({block:`nearest`})},[y,C]);let ee=e=>{u||(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},te=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),w(e=>A.length===0?0:(e+1)%A.length);break;case`ArrowUp`:e.preventDefault(),w(e=>A.length===0?0:(e-1+A.length)%A.length);break;case`Home`:e.preventDefault(),w(0);break;case`End`:e.preventDefault(),w(Math.max(0,A.length-1));break;case`Enter`:e.preventDefault(),A[C]&&F(A[C].value);break;case`Escape`:e.preventDefault(),N(),m.current?.focus();break;case`Tab`:N()}},I=A.length>0?`${D}-option-${C}`:void 0;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`button`,{ref:m,id:f,type:`button`,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":y,"aria-controls":y?D:void 0,"aria-label":p,disabled:u,onClick:()=>y?N():P(),onKeyDown:ee,className:(0,U.default)(Ua,u&&Wa,d),children:[(0,_.jsx)(`span`,{className:(0,U.default)(`wcpos:truncate`,!j&&`wcpos:text-gray-500`),children:j||a||``}),(0,_.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,_.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`})})]}),y&&n.createPortal((0,_.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:T.top,left:T.left,width:T.width},children:[(0,_.jsx)(`div`,{className:`wcpos:p-2 wcpos:border-b wcpos:border-gray-100`,children:(0,_.jsx)(`input`,{ref:g,type:`text`,role:`searchbox`,"aria-autocomplete":`list`,"aria-controls":D,"aria-activedescendant":I,value:x,onChange:e=>S(e.target.value),onKeyDown:te,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,_.jsxs)(`ul`,{ref:v,id:D,role:`listbox`,"aria-label":p,className:`wcpos:m-0 wcpos:max-h-60 wcpos:list-none wcpos:overflow-auto wcpos:p-1`,children:[A.map((e,t)=>{let n=t===C,i=e.isClear?r===``:e.value===r;return(0,_.jsx)(`li`,{id:`${D}-option-${t}`,"data-index":t,role:`option`,"aria-selected":i,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>w(t),onClick:()=>F(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,_.jsx)(`span`,{className:`wcpos:truncate`,children:e.label}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{className:`wcpos:truncate`,children:e.label}),(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-400`,children:e.value})]})},e.isClear?`__clear__`:e.value)}),k.length===0&&(0,_.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`,Ja=`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`,Ya=`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`,Xa=`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 Za(e){return e.toLowerCase()}function Qa(e,t,n){let r=t.find(t=>t.value===e);return r?r.label:n?e:``}function $a({value:t,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 v=e.useRef(null),y=e.useRef(null),b=e.useRef(null),x=e.useRef(null),[S,C]=e.useState(!1),[w,T]=e.useState(()=>Qa(t,r,a)),[E,D]=e.useState(-1),[O,k]=e.useState({top:0,left:0,width:0}),A=e.useId(),j=s!==void 0;e.useEffect(()=>{S||T(Qa(t,r,a))},[t,r,S,a]);let M=e.useMemo(()=>{let e=w.trim(),t=Za(e),n=!j&&S&&t?r.filter(e=>Za(e.label).includes(t)||Za(e.value).includes(t)):r.slice();return S&&a&&o&&e&&(r.some(e=>Za(e.label)===t||Za(e.value)===t)||n.push({value:e,label:o(e),isCreate:!0})),n},[a,o,w,S,r,j]),N=e.useCallback(()=>{if(!v.current)return;let e=v.current.getBoundingClientRect();k({top:e.bottom+4,left:e.left,width:e.width})},[]),P=e.useCallback(()=>{C(!1)},[]),F=e.useCallback(()=>{f||(C(!0),D(-1))},[f]),ee=e.useCallback(e=>{let t=e.isCreate?e.value:e.label;T(t),P(),i(e.value)},[P,i]),te=e.useCallback(()=>{let e=w.trim(),n=r.find(t=>Za(t.label)===Za(e));if(n){T(n.label),P(),n.value!==t&&i(n.value);return}if(a){T(e),P(),e!==t&&i(e);return}T(Qa(t,r,a)),P()},[a,P,w,i,r,t]),I=e.useRef(te);e.useEffect(()=>{I.current=te},[te]),e.useLayoutEffect(()=>{S&&N()},[S,N]),e.useEffect(()=>{if(!S)return;let e=e=>{let t=e.target;v.current?.contains(t)||b.current?.contains(t)||I.current()};return document.addEventListener(`mousedown`,e),window.addEventListener(`scroll`,N,!0),window.addEventListener(`resize`,N),()=>{document.removeEventListener(`mousedown`,e),window.removeEventListener(`scroll`,N,!0),window.removeEventListener(`resize`,N)}},[S,N]),e.useEffect(()=>{S&&D(e=>M.length===0?-1:e>=M.length?M.length-1:e)},[S,M]),e.useEffect(()=>{!S||!x.current||x.current.querySelector(`[data-index="${E}"]`)?.scrollIntoView?.({block:`nearest`})},[S,E]);let ne=e=>{let t=e.target.value;T(t),S||C(!0),D(t.trim()===``?-1:0),s?.(t)},re=()=>{if(f)return;C(!0);let e=y.current;e&&requestAnimationFrame(()=>e.select())},ie=e=>{let t=e.relatedTarget;t&&(v.current?.contains(t)||b.current?.contains(t))||I.current()},ae=e=>{if(!f)switch(e.key){case`ArrowDown`:if(e.preventDefault(),!S){F();return}D(e=>M.length===0?-1:e===-1?0:(e+1)%M.length);break;case`ArrowUp`:if(e.preventDefault(),!S){F();return}D(e=>M.length===0?-1:e===-1?M.length-1:(e-1+M.length)%M.length);break;case`Home`:S&&M.length>0&&(e.preventDefault(),D(0));break;case`End`:S&&M.length>0&&(e.preventDefault(),D(M.length-1));break;case`Enter`:if(S&&E>=0&&M[E]){e.preventDefault(),ee(M[E]);return}e.preventDefault(),te();break;case`Escape`:S&&(e.preventDefault(),T(Qa(t,r,a)),P());break;case`Tab`:S&&te()}},oe=e=>{e.preventDefault(),!f&&(S?P():(F(),y.current?.focus()))},se=S&&E>=0&&M.length>0?`${A}-option-${E}`:void 0;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{ref:v,className:(0,U.default)(qa,f&&Ja,p),children:[(0,_.jsx)(`input`,{ref:y,id:m,type:`text`,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":S,"aria-controls":S?A:void 0,"aria-autocomplete":`list`,"aria-activedescendant":se,"aria-label":h,"aria-labelledby":g,autoComplete:`off`,"data-1p-ignore":!0,"data-lpignore":`true`,disabled:f,value:w,placeholder:c,onChange:ne,onFocus:re,onBlur:ie,onKeyDown:ae,className:Ya}),(0,_.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-hidden":`true`,disabled:f,onMouseDown:oe,className:Xa,children:(0,_.jsx)(`svg`,{className:`wcpos:h-4 wcpos:w-4`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,_.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`})})})]}),S&&n.createPortal((0,_.jsx)(`div`,{ref:b,className:`wcpos:fixed wcpos:z-[99999] wcpos:rounded-md wcpos:border wcpos:border-gray-200 wcpos:bg-white wcpos:shadow-lg`,style:{top:O.top,left:O.left,width:O.width},children:(0,_.jsx)(`ul`,{ref:x,id:A,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,_.jsx)(`li`,{role:`presentation`,className:`wcpos:px-2 wcpos:py-2 wcpos:text-sm wcpos:text-gray-500`,children:d??`Loading…`}):M.length===0?(0,_.jsx)(`li`,{role:`presentation`,className:`wcpos:px-2 wcpos:py-2 wcpos:text-sm wcpos:text-gray-500`,children:l??`No results`}):M.map((e,n)=>{let r=n===E,i=!e.isCreate&&e.value===t;return(0,_.jsx)(`li`,{id:`${A}-option-${n}`,"data-index":n,role:`option`,"aria-selected":i,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>D(n),onClick:()=>ee(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,_.jsx)(`span`,{className:`wcpos:truncate`,children:e.label})},e.isCreate?`__create__-${A}`:e.value)})})}),document.body)]})}function eo({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,_.jsxs)(`div`,{className:`wcpos:relative wcpos:z-50`,children:[(0,_.jsx)(`div`,{className:`wcpos:fixed wcpos:inset-0 wcpos:bg-black/30`,"aria-hidden":`true`}),(0,_.jsx)(`div`,{className:`wcpos:fixed wcpos:inset-0 wcpos:flex wcpos:items-center wcpos:justify-center wcpos:p-4`,onClick:()=>n(!1),children:(0,_.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,_.jsx)(`h2`,{id:c,className:`wcpos:text-lg wcpos:font-semibold wcpos:text-gray-900 wcpos:mb-2`,children:r}),a&&(0,_.jsx)(`p`,{id:l,className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-4`,children:a}),o]})})]}):null}function to({text:t,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,_.jsxs)(_.Fragment,{children:[(0,_.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&&n.createPortal((0,_.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:t}),document.body)]})}var no=e.createContext(null);function ro({trigger:t,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),[]),v=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 y=e.useMemo(()=>({close:g}),[g]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{ref:c,className:(0,U.default)(`wcpos:inline-flex`,o),onClick:v,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v())},role:`button`,tabIndex:0,"aria-haspopup":`menu`,"aria-expanded":u,"aria-controls":u?m:void 0,children:t}),u&&n.createPortal((0,_.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,_.jsx)(no.Provider,{value:y,children:r})}),document.body)]})}function io({children:t,onSelect:n,href:r,disabled:i,target:a,rel:o,destructive:s}){let c=e.useContext(no),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,_.jsx)(`a`,{href:i?void 0:r,target:a,rel:o,role:`menuitem`,className:l,"aria-disabled":i,onClick:u,children:t}):(0,_.jsx)(`button`,{type:`button`,role:`menuitem`,className:l,disabled:i,onClick:u,children:t})}ro.Item=io;function ao({active:e=!1,className:t,children:n,...r}){return(0,_.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 oo({noPadding:e=!1,className:t,children:n,...r}){return(0,_.jsx)(`div`,{className:(0,U.default)(`wcpos:flex-1`,!e&&`wcpos:p-4`,t),...r,children:n})}function so({className:e,children:t,...n}){return(0,_.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})}ao.Body=oo,ao.Footer=so;var co={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 lo(){return(0,_.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,_.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 uo({status:e=`info`,children:t,onRemove:n,isDismissible:r=!0,className:i,dismissLabel:a=`Dismiss`}){return(0,_.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`,co[e],i),children:[(0,_.jsx)(`div`,{className:`wcpos:flex-1`,children:t}),r&&n&&(0,_.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,_.jsx)(lo,{})})]})}var fo={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`},po={info:`i`,success:`✓`,warning:`!`,error:`!`};function mo({status:e=`info`,title:t,icon:n,children:r,className:i}){let a=n===void 0?po[e]:n;return(0,_.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`,fo[e],i),children:[a!==null&&(0,_.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,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[t&&(0,_.jsx)(`div`,{className:`wcpos:font-semibold wcpos:mb-0.5`,children:t}),(0,_.jsx)(`div`,{children:r})]})]})}function K({className:e,width:t,height:n,style:r,...i}){return(0,_.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,_.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,_.jsx)(`div`,{className:`wcpos:sm:w-[30%] wcpos:sm:max-w-[200px] wcpos:shrink-0 wcpos:sm:pt-0.5`,children:(0,_.jsx)(`label`,{htmlFor:t,className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-700`,children:e})}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[r,n&&(0,_.jsx)(`p`,{className:`wcpos:mt-1 wcpos:text-xs wcpos:text-gray-500`,children:n})]})]})}function ho({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,_.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,_.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,_.jsxs)(`div`,{children:[e&&(0,_.jsx)(`h3`,{className:`wcpos:text-base wcpos:font-semibold wcpos:text-gray-900 wcpos:m-0`,children:e}),t&&(0,_.jsx)(`p`,{className:(0,U.default)(`wcpos:text-sm wcpos:text-gray-500`,e&&`wcpos:mt-1`),children:t})]}),s&&(0,_.jsx)(`div`,{className:`wcpos:flex-shrink-0`,children:n})]}),(0,_.jsx)(`div`,{children:i})]})}function go({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,_.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,_.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,_.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 _o={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`},vo={sm:`wcpos:text-xs wcpos:px-2 wcpos:py-0.5`,xs:`wcpos:text-[10px] wcpos:px-1.5 wcpos:py-0.5`},yo={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,_.jsxs)(`span`,{className:(0,U.default)(`wcpos:inline-flex wcpos:items-center wcpos:gap-1 wcpos:font-medium wcpos:leading-none wcpos:shrink-0`,_o[e],vo[n],yo[t],i),...o,children:[r,a]})}var bo={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`},xo={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`},So={none:`wcpos:ring-1 wcpos:ring-gray-200`,brand:`wcpos:ring-2 wcpos:ring-wp-admin-theme-color`};function Co(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 wo({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,_.jsxs)(`span`,{className:(0,U.default)(`wcpos:relative wcpos:inline-flex wcpos:shrink-0`,s),children:[(0,_.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`,bo[r],So[i]),role:u?void 0:`img`,"aria-label":u?void 0:d,children:u?(0,_.jsx)(`img`,{src:n,alt:t,className:`wcpos:w-full wcpos:h-full wcpos:object-cover`,onError:()=>l(!0)}):(0,_.jsx)(`span`,{"aria-hidden":`true`,children:Co(t)})}),a===`active`&&(0,_.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`,xo[r]),role:`status`,"aria-label":o||`Active now`,title:o||`Active now`})]})}var To={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 Eo({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,_.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`,To[n],a?`wcpos:translate-y-0 wcpos:opacity-100`:`wcpos:-translate-y-full wcpos:opacity-0`),children:t}):null}var Do=e.createContext(null),Oo=0;function ko(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():(Oo+=1,`snackbar-${Date.now()}-${Oo}`)}function Ao({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??ko();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,_.jsx)(Do.Provider,{value:{addSnackbar:c},children:(0,_.jsxs)(`div`,{ref:a,className:`wcpos:relative wcpos:flex-1 wcpos:flex wcpos:flex-col`,children:[(0,_.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,_.jsx)(Eo,{...e,onRemove:()=>{try{e.onRemove?.()}finally{l(e.id)}}},e.id))}),t]})})}function jo(){let t=e.useContext(Do);if(!t)throw Error(`useSnackbar must be called within SnackbarProvider`);return t}function Mo({className:e,tableClassName:t,children:n,...r}){return(0,_.jsx)(`div`,{className:(0,U.default)(`wcpos:overflow-x-auto wcpos:rounded-md wcpos:border wcpos:border-gray-200`,e),...r,children:(0,_.jsx)(`table`,{className:(0,U.default)(`wcpos:w-full wcpos:text-sm`,t),children:n})})}function No({className:e,children:t,...n}){return(0,_.jsx)(`thead`,{className:e,...n,children:t})}function Po({className:e,children:t,...n}){return(0,_.jsx)(`tbody`,{className:e,...n,children:t})}var Fo=e.forwardRef(function({className:e,children:t,...n},r){return(0,_.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})}),Io=e.forwardRef(function({className:e,children:t,...n},r){return(0,_.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,_.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,_.jsx)(`td`,{ref:r,className:(0,U.default)(`wcpos:px-3 wcpos:py-2 wcpos:align-middle`,e),...n,children:t})});Mo.Header=No,Mo.HeaderRow=Fo,Mo.Body=Po,Mo.Row=Io,Mo.Head=Y,Mo.Cell=X;var Lo=[{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`}],Ro={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`},zo={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`},Bo={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`},Vo=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 Ho(e){if(!e)return`other`;let t=e.toUpperCase();return zo[t]?zo[t]:Vo.has(t)?`eu_vat`:`other`}function Uo(e,t){if(e===`eu_vat`){let e=t?.toUpperCase();if(e&&Vo.has(e))return e;let n=window?.wcpos?.settings?.storeCountry?.toUpperCase();return n&&Vo.has(n)?n:void 0}return Bo[e]}function Wo(e,t){return Ro[e]??t}var Go=e=>{let t={type:e.type||`other`,value:e.value||``};return e.country&&(t.country=e.country),e.label&&(t.label=e.label),t},Ko=(e,t)=>{if(typeof t.country==`string`&&t.country)return{...t,type:Ho(t.country)};if(typeof t.type==`string`){let n=Uo(t.type,e.country);if(n)return{...t,country:n};if(t.type===`eu_vat`)return{...t,country:void 0}}return t},qo=0,Jo=()=>`tax-id-row-${++qo}`;function Yo({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,_.jsxs)(Io,{children:[(0,_.jsx)(X,{children:(0,_.jsx)(Ha,{"aria-label":n.type,value:t.type,options:Lo,onChange:({value:e})=>r({type:String(e)})})}),(0,_.jsx)(X,{children:(0,_.jsx)(G,{"aria-label":n.value,placeholder:Wo(t.type,n.value),value:a,onChange:e=>o(e.target.value),onBlur:()=>{let e=a.trim();e!==t.value&&r({value:e})}})}),(0,_.jsx)(X,{children:(0,_.jsx)(Ka,{"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,_.jsx)(X,{children:(0,_.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,_.jsx)(X,{className:`wcpos:text-right`,children:(0,_.jsx)(W,{variant:`ghost-destructive`,onMouseDown:e=>e.preventDefault(),onClick:i,children:n.remove})})]})}var Xo=e.forwardRef(function({value:t,onChange:n,labels:r},i){let a=e.useMemo(()=>Array.isArray(t)?t.map(Go):[],[t]),[o,s]=e.useState(()=>a.map(()=>Jo())),[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},()=>Jo());return[...e,...t]}return e.slice(0,a.length)})},[a.length]);let u=e.useCallback((e,t)=>{if(e>=a.length&&c){let e=Ko(c.taxId,t),r=Go({...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=Ko(n,t);return Go({...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:Ho(t),value:``};return t&&(n.country=t),{id:Jo(),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,_.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,_.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,_.jsx)(W,{variant:`outline`,onClick:f,children:r.add})]}):(0,_.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,_.jsxs)(Mo,{children:[(0,_.jsx)(No,{children:(0,_.jsxs)(Fo,{children:[(0,_.jsx)(Y,{style:{width:`11rem`},children:r.type}),(0,_.jsx)(Y,{children:r.value}),(0,_.jsx)(Y,{style:{width:`12rem`},children:r.country}),(0,_.jsx)(Y,{children:r.label}),(0,_.jsx)(Y,{className:`wcpos:text-right`,style:{width:`1%`},children:(0,_.jsx)(`span`,{className:`wcpos:sr-only`,children:r.remove})})]})}),(0,_.jsx)(Po,{children:p.map((e,t)=>(0,_.jsx)(Yo,{taxId:e.taxId,labels:r,onChangeField:e=>u(t,e),onRemove:()=>d(t)},e.id))})]}),(0,_.jsx)(W,{variant:`outline`,onClick:f,children:r.add})]})}),Z=e=>typeof e==`string`,Zo=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Qo=e=>e==null?``:String(e),$o=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},es=/###/g,ts=e=>e&&e.includes(`###`)?e.replace(es,`.`):e,ns=e=>!e||Z(e),rs=(e,t,n)=>{let r=Z(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(ns(e))return{};let t=ts(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return ns(e)?{}:{obj:e,k:ts(r[i])}},is=(e,t,n)=>{let{obj:r,k:i}=rs(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=rs(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=rs(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},as=(e,t,n,r)=>{let{obj:i,k:a}=rs(e,t,Object);i[a]=i[a]||[],i[a].push(n)},os=(e,t)=>{let{obj:n,k:r}=rs(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},ss=(e,t,n)=>{let r=os(e,n);return r===void 0?os(t,n):r},cs=(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]):cs(e[r],t[r],n):e[r]=t[r]);return e},ls=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),us={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"/":`/`},ds=e=>Z(e)?e.replace(/[&<>"'\/]/g,e=>us[e]):e,fs=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}},ps=[` `,`,`,`?`,`!`,`;`],ms=new fs(20),hs=(e,t,n)=>{t||=``,n||=``;let r=ps.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=ms.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},gs=(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},_s=e=>e?.replace(/_/g,`-`),vs={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)}},ys=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||vs,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)}},bs=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)})}},xs=class extends bs{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=os(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:gs(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),is(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=os(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?cs(s,n,i):s={...s,...n},is(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}},Ss={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}},Cs=Symbol(`i18next/PATH_KEY`);function ws(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Cs?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Ts(e,t){let{[Cs]:n}=e(ws()),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 Es=e=>!Z(e)&&typeof e!=`boolean`&&typeof e!=`number`,Ds=class e extends bs{constructor(e,t={}){super(),$o([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=ys.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=Es(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&&!hs(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=Ts(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?Ts(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=Es(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:Es(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=Ss.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`?Ts(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}},Os=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ys.create(`languageUtils`),this.resolveHierarchyCache={}}clearCache(){this.resolveHierarchyCache={}}getScriptPartFromCode(e){if(e=_s(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=_s(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.options.fallbackLng,r=Array.isArray(n)?n.join(`|`):n;r!==this._cachedFallbackLng&&(this.resolveHierarchyCache={},this._cachedFallbackLng=r);let i=t===void 0||t===!1||Z(t),a=t===void 0&&typeof this.options.fallbackLng==`function`,o=Z(e)&&i&&!a,s=null;if(o){let n;n=t===void 0?`undefined`:t===!1?`boolean:false`:`string:${t}`,s=`${e.length}:${e}|${n}`}if(s!==null){let e=this.resolveHierarchyCache[s];if(e!==void 0)return e.slice()}let c=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),l=[],u=e=>{e&&(this.isSupportedCode(e)?l.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Z(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&u(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&u(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&u(this.getLanguagePartFromCode(e))):Z(e)&&u(this.formatLanguageCode(e)),c.forEach(e=>{l.includes(e)||u(this.formatLanguageCode(e))}),s===null?l:(this.resolveHierarchyCache[s]=l,l.slice())}},ks={zero:0,one:1,two:2,few:3,many:4,other:5},As={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},js=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=ys.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=_s(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!`),As;if(!e.match(/-|_/))return As;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)=>ks[e]-ks[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))}},Ms=(e,t,n,r=`.`,i=!0)=>{let a=ss(e,t,n);return!a&&i&&Z(n)&&(a=gs(e,n,r),a===void 0&&(a=gs(t,n,r))),a},Ns=e=>e.replace(/\$/g,`$$$$`),Ps=class{constructor(e={}){this.logger=ys.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?ds:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?ls(i):a||`{{`,this.suffix=o?ls(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?ls(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?ls(l):``,this.nestingPrefix=d?ls(d):f||ls(`$t(`),this.nestingSuffix=p?ls(p):m||ls(`)`),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=Ms(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(Ms(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=Qo(a));let s=t.safeValue(a);if(e=e.replace(i[0],Ns(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(`${ls(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=Qo(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}},Fs=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}},Is=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(_s(r),i),t[o]=s),s(n)}},Ls=e=>(t,n,r)=>e(_s(n),r)(t),Rs=class{constructor(e={}){this.logger=ys.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?Is:Ls;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()]=Is(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}=Fs(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)}},zs=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Bs=class extends bs{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=ys.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=>{as(n.loaded,[i],a),zs(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)}}},Vs=()=>({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}),Hs=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),Us=()=>{},Ws=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},Q=class e extends bs{constructor(e={},t){if(super(),this.options=Hs(e),this.services={},this.logger=ys,this.modules={external:[]},Ws(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=Vs();this.options={...n,...this.options,...Hs(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?ys.init(r(this.modules.logger),this.options):ys.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Rs;let t=new Os(this.options);this.store=new xs(this.options.resources,this.options);let n=this.services;n.logger=ys,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new js(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 Ps(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new Bs(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 Ds(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||=Us,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=Zo(),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=Us){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=Zo();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||=Us,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`&&Ss.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=Zo();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=Ts(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=Ts(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=Ts(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=Zo();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=Zo();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 Os(Vs());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=Us){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 xs(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={...Vs().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new Ps(n)}return a.translator=new Ds(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 Gs(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ks(e){"@babel/helpers - typeof";return Ks=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},Ks(e)}function qs(e,t){if(Ks(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Ks(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Js(e){var t=qs(e,`string`);return Ks(t)==`symbol`?t:t+``}function Ys(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,Js(r.key),r)}}function Xs(e,t,n){return t&&Ys(e.prototype,t),n&&Ys(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var Zs=[],Qs=Zs.forEach,$s=Zs.slice,ec=[`__proto__`,`constructor`,`prototype`];function tc(e){return Qs.call($s.call(arguments,1),function(t){if(t)for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];ec.indexOf(i)>-1||e[i]===void 0&&(e[i]=t[i])}}),e}function nc(e){return e?typeof e==`function`?new e:e:null}function rc(){return{handleEmptyResourcesAsFailed:!0,cacheHitMode:`none`,retryOnFailure:!1}}function ic(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 ac=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]:{};Gs(this,e),this.backends=[],this.type=`backend`,this.allOptions=r,this.init(t,n)}return Xs(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=tc(n,this.options||{},rc()),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]||nc(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?ic(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&&ic(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)})})})}}}])}();ac.type=`backend`;var oc=[];oc.forEach,oc.slice;var sc=[`__proto__`,`constructor`,`prototype`];function cc(e){return!(typeof e!=`string`||e.length===0||e.length>128||sc.indexOf(e)>-1||e.indexOf(`..`)>-1||e.indexOf(`\\`)>-1||/[?#%\s]/.test(e)||/[\x00-\x1F\x7F]/.test(e))}function lc(e){return!(!cc(e)||e.indexOf(`/`)>-1||e.indexOf(`@`)>-1)}function uc(e){return cc(e)}var dc={lng:lc,ns:uc};function fc(e){return typeof e==`string`?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e}function pc(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 mc(){return typeof XMLHttpRequest==`function`||typeof XMLHttpRequest==`object`}function hc(e){return!!e&&typeof e.then==`function`}function gc(e){return hc(e)?e:Promise.resolve(e)}var _c=/\{\{(.+?)\}\}/g;function vc(e,t){let n=!1,r=e.replace(_c,(e,r)=>{let i=r.trim();if(sc.indexOf(i)>-1)return e;let a=t[i];if(a==null)return e;let o=dc[i]||lc,s=String(a).split(`+`);for(let t of s)if(!o(t))return n=!0,e;return s.join(`+`)});return n?null:r}var yc=typeof globalThis<`u`?globalThis:typeof global<`u`?global:typeof window<`u`?window:void 0,bc;typeof fetch==`function`?bc=fetch:yc&&typeof yc.fetch==`function`&&(bc=yc.fetch);var xc=mc()&&yc?yc.XMLHttpRequest:void 0,Sc=typeof ActiveXObject==`function`&&yc?yc.ActiveXObject:void 0,Cc=[`__proto__`,`constructor`,`prototype`],wc=(e,t)=>{if(t&&typeof t==`object`){let n=``;for(let e of Object.keys(t))Cc.indexOf(e)>-1||(n+=`&`+encodeURIComponent(e)+`=`+encodeURIComponent(t[e]));if(!n)return e;e=e+(e.indexOf(`?`)===-1?`?`:`&`)+n.slice(1)}return e},Tc=(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):bc(e,t).then(i).catch(n)},Ec=(e,t,n,r)=>{e.queryStringParams&&(t=wc(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{Tc(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]}),Tc(t,o,r,s),e._omitFetchOptions=!0}catch(e){r(e)}}},Dc=(e,t,n,r)=>{n&&typeof n==`object`&&(n=wc(``,n).slice(1)),e.queryStringParams&&(t=wc(t,e.queryStringParams));try{let i=xc?new xc:new Sc(`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))Cc.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)}},Oc=(e,t,n,r)=>{if(typeof n==`function`&&(r=n,n=void 0),r||=(()=>{}),bc&&t.indexOf(`file:`)!==0)return Ec(e,t,n,r);if(mc()||typeof ActiveXObject==`function`)return Dc(e,t,n,r);r(Error(`No fetch and no xhr implementation found!`))},kc=()=>({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:Oc,reloadInterval:typeof window<`u`?!1:36e5,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:`cors`,credentials:`same-origin`,cache:`default`}}),Ac=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={...kc(),...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=gc(a),a.then(a=>{if(!a)return i(null,{});let o=vc(a,{lng:e.join(`+`),ns:n.join(`+`)});if(o==null){let t=e.map(fc).join(`, `),r=n.map(fc).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=fc(pc(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+`: `+fc(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=vc(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)})})})}};Ac.type=`backend`;function jc(e,t,n){return(t=Js(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mc(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 Nc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Mc(Object(n),!0).forEach(function(t){jc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Pc=function(){function e(t){Gs(this,e),this.store=t.store}return Xs(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 Fc(){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 Ic=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Gs(this,e),this.init(t,n),this.type=`backend`}return Xs(e,[{key:`init`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.services=e,this.options=Nc(Nc(Nc({},Fc()),this.options),t),this.storage=new Pc(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&&Ks(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=Nc(Nc({},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}}])}();Ic.type=`backend`;var Lc={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},Rc=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?("[^"]*"|'[^']*')/g;function zc(e){let t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(Lc[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(Rc),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 Bc=/<!--[\s\S]*?-->|<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Vc=/<\/?([^\s]+?)[/\s>]/,Hc=/^\s*$/,Uc=/^(script|style)$/i,Wc=`\0`,Gc=Object.create(null);function Kc(e){e.forEach(function(e){if(e.type===`text`){e.content=e.content.split(Wc).join(`<`);return}if(e.type===`comment`){e.comment=e.comment.split(Wc).join(`<`);return}for(let t in e.attrs){let n=e.attrs[t];typeof n==`string`&&n.indexOf(Wc)>-1&&(e.attrs[t]=n.split(Wc).join(`<`))}e.children.length&&Kc(e.children)})}function qc(e,t){let n=t&&t.components||Gc,r=t&&t.allowedTags,i=!1;if(r){let t=typeof r==`function`?r:function(e){return r.indexOf(e)>-1},n=``,a=0;Bc.lastIndex=0;let o;for(;o=Bc.exec(e);){let r=o[0];n+=e.slice(a,o.index);let s=r.match(Vc);r.startsWith(`<!--`)||s&&t(s[1])?(n+=r,a=o.index+r.length):(i=!0,n+=Wc,a=o.index+1,Bc.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=Bc.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=zc(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=zc(i),s.type===`tag`&&n[s.name]&&(s.type=`component`,l=!0);let t=!1;if(!l&&!s.voidElement&&Uc.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);Hc.test(n)&&(n=` `),(t>-1&&c+b.length>=0||n!==` `)&&b.push({type:`text`,content:n})}}),i&&Kc(a),a}function Jc(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 Yc(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?Jc(t.attrs):``)+n,t.voidElement?e:e+t.children.reduce(Yc,``)+`</`+t.name+`>`}case`comment`:return e+=`<!--`+t.comment+`-->`,e}}function Xc(e){return e.reduce(function(e,t){return e+Yc(``,t)},``)}var Zc={parse:qc,stringify:Xc},Qc=(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);tl(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},$c={},el=(e,t,n,r)=>{tl(n)&&$c[n]||(tl(n)&&($c[n]=new Date),Qc(e,t,n,r))},tl=e=>typeof e==`string`,nl=e=>typeof e==`object`&&!!e,rl=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,il={"&":`&`,"&":`&`,"<":`<`,"<":`<`,">":`>`,">":`>`,"'":`'`,"'":`'`,""":`"`,""":`"`," ":` `," ":` `,"©":`©`,"©":`©`,"®":`®`,"®":`®`,"…":`…`,"…":`…`,"/":`/`,"/":`/`},al=e=>il[e],ol=e=>e.replace(rl,al),sl={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:ol,transDefaultProps:void 0},cl=(e={})=>{sl={...sl,...e}},ll=()=>sl,ul,dl=e=>{ul=e},fl=()=>ul,pl=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},ml=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?gl(t):t},hl=t=>Array.isArray(t)&&t.every(e.isValidElement),gl=e=>Array.isArray(e)?e:[e],_l=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},vl=t=>{let n={};if(!t)return n;let r=t=>{gl(t).forEach(t=>{tl(t)||(pl(t)?r(ml(t)):nl(t)&&!(0,e.isValidElement)(t)&&Object.assign(n,t))})};return r(t),n},yl=(t,n,r,i)=>{if(!t)return``;let a=``,o=gl(t),s=n?.transSupportBasicHtmlNodes?n.transKeepBasicHtmlNodesFor??[]:[];return o.forEach((t,o)=>{if(tl(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=tl(d)?d:yl(d,n,r,i);a+=`<${c}>${e}</${c}>`;return}let f=yl(d,n,r,i);a+=`<${o}>${f}</${o}>`;return}if(t===null){Qc(r,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:i});return}if(nl(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}Qc(r,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:i,child:t});return}Qc(r,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:i,child:t})}),a},bl=(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=>{gl(t).forEach(t=>{tl(t)||(pl(t)?d(ml(t)):nl(t)&&!(0,e.isValidElement)(t)&&Object.assign(u,t))})};d(t);let f=Object.keys(u),p=Zc.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=ml(e),i=_(r,t.children,n);return hl(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=gl(t),d=gl(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];tl(t)&&(y[e]=ol(t))});let b=Object.keys(y).length===0?v:_l({props:y},v),x=(0,e.isValidElement)(b),S=x&&pl(r,!0)&&!r.voidElement,C=l&&nl(b)&&b.dummy&&!x,w=nl(n)&&Object.hasOwnProperty.call(n,r.name);if(tl(b)){let e=i.services.interpolator.interpolate(b,m,i.language);t.push(e)}else if(pl(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?gl(ml(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(nl(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:ll().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 ml(_([{dummy:!0,children:t||[]}],p,gl(t||[]))[0])},xl=(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})},Sl=(e,t)=>e.map((e,n)=>xl(e,n,t)),Cl=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:xl(e[r],r,t)})}),n},wl=(e,t,n,r)=>e?Array.isArray(e)?Sl(e,t):nl(e)?Cl(e,t):(el(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,Tl=e=>!nl(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function El({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||fl();if(!h)return el(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),_={...ll(),...h.options?.react},v=u||g.ns||h.options?.defaultNS;v=tl(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=yl(t,_,h,i),T=c||b?.defaultValue||w||_.transEmptyNodeValue||(typeof i==`function`?Ts(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=vl(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=wl(C,j,h,i),N=M||t,P=null;Tl(M)&&(P=M,N=t);let F=bl(N,P,j,h,_,A,x),ee=r??_.defaultTransParent;return ee?(0,e.createElement)(ee,m,F):F}var Dl={type:`3rdParty`,init(e){cl(e.options.react),dl(e)}},Ol=(0,e.createContext)();function kl({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)(Ol)||{},_=d||h||fl(),v=f||_?.t.bind(_);return El({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 Al={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 jl(){let e=document.documentElement.getAttribute(`lang`)||`en`;return(Al[e.toLowerCase()]||Al[e.split(`-`)[0]]||Al.en)?.locale||`en_US`}function Ml(){return window.wcpos?.translationVersion||`0.1.0`}function Nl({namespace:t,project:n,resources:r}){let i=Q.createInstance(),a=jl(),o=Ml(),s={lng:a,fallbackLng:`en`,ns:[t],defaultNS:t,keySeparator:!1,nsSeparator:!1,interpolation:{escapeValue:!1,prefix:`{`,suffix:`}`},backend:{backends:[Ic,Ac],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(ac).use(Dl).init(s).then(()=>i),t:i.t.bind(i),Trans:n=>(0,e.createElement)(kl,{...n,i18n:i,ns:t})}}var{i18n:Pl,i18nPromise:Fl,t:$,Trans:Il}=Nl({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: _global_unique_id (GTIN), _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.prevent_overselling":`Prevent overselling`,"checkout.prevent_overselling_tip":`Reject orders at checkout when quantities exceed available stock.`,"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>.`,"access.tasks_title":`What this role can do`,"access.task_use_pos":`Use the POS`,"access.task_manage_settings":`Manage POS settings`,"access.task_edit_products":`Create & edit products`,"access.task_delete_products":`Delete products`,"access.task_edit_coupons":`Create & edit coupons`,"access.task_delete_coupons":`Delete coupons`,"access.task_manage_orders":`Manage orders`,"access.task_manage_customers":`Manage customers`,"access.task_manage_categories":`Manage categories & tags`,"access.task_partial":`partly granted`,"access.advanced_title":`Advanced`,"access.advanced_subtitle":`individual capabilities`,"access.advanced_intro":`Each task above is a set of these capabilities. Change them individually only if you know what you are doing.`,"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.rule_copies_one":`{count} copy`,"cloud_print.rule_copies_other":`{count} copies`,"cloud_print.rule_copies_label":`Number of copies`,"cloud_print.rule_trigger_join":`,`,"cloud_print.rule_trigger_label":`When to print`,"cloud_print.trigger_paid":`once it's paid`,"cloud_print.trigger_created":`as soon as it's created`,"cloud_print.rule_copies_suffix":`.`,"cloud_print.add_rule":`+ Add rule`}}}});function Ll(e){return(0,_.jsx)(uo,{dismissLabel:$(`common.dismiss`),...e})}function Rl({error:e,resetErrorBoundary:t}){let n=(0,r.get)(e,`message`,`Unknown error`);return(0,_.jsx)(`div`,{className:`wcpos:p-4`,children:(0,_.jsx)(Ll,{status:`error`,onRemove:t,children:(0,_.jsxs)(`p`,{children:[$(`common.something_went_wrong`),`: `,(0,_.jsx)(`code`,{children:n})]})})})}var zl=e.createContext({notice:null,setNotice:()=>{}});function Bl({children:t}){let[n,r]=e.useState(null);return(0,_.jsx)(zl.Provider,{value:{notice:n,setNotice:r},children:t})}var Vl=()=>e.useContext(zl);function Hl(){return window?.wcpos?.posthog}function Ul(e,t={}){Hl()?.capture?.(e,t)}function Wl(e){let t=Hl();if(t){if(e===`allowed`){t.opt_in_capturing?.();return}t.opt_out_capturing?.(),t.reset?.()}}function Gl(e){Ul(`upgrade_cta_viewed`,{placement:e})}function Kl(e,t){Ul(`pro_link_clicked`,{placement:e,destination:t})}function ql(e){e&&Ul(`settings_section_viewed`,{section:e})}function Jl(){Ul(`license_activate_attempted`)}function Yl(e){Ul(`license_activate_succeeded`,e?{license_tier:e}:{})}function Xl(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 Zl(e){Ul(`license_activate_failed`,{reason:Xl(e)})}var Ql=new Ue({defaultOptions:{queries:{staleTime:6e5}}});typeof window<`u`&&(window.wcpos=window.wcpos||{},window.wcpos.queryClient=Ql);var $l=e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 448 512`,...e,children:(0,_.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`})}),eu=e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,_.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`})}),tu=e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,_.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 nu(){return(0,_.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,_.jsx)(`span`,{className:`wcpos:font-semibold wcpos:text-gray-500`,children:$(`settings.need_help`)}),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:md:flex-row wcpos:gap-1 wcpos:lg:gap-4`,children:[(0,_.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,_.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,_.jsx)($l,{fill:`#6b7280`})}),$(`common.documentation`),(0,_.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]}),(0,_.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,_.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,_.jsx)(eu,{fill:`#6b7280`})}),$(`common.faq`),(0,_.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})]}),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:md:flex-row wcpos:gap-1 wcpos:lg:gap-4`,children:[(0,_.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,_.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,_.jsx)(tu,{fill:`#6b7280`})}),`support@wcpos.com`]}),(0,_.jsx)(`a`,{href:`https://wcpos.com/discord`,target:`_blank`,rel:`noreferrer`,className:`wcpos:no-underline`,children:(0,_.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 ru({heading:e,children:t}){return(0,_.jsxs)(`div`,{className:`wcpos:mb-4`,children:[(0,_.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,_.jsx)(`nav`,{children:t})]})}function iu({to:e,label:t,badge:n,onClick:r}){let i=Ea()({to:e});return(0,_.jsxs)(oa,{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,_.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,_.jsxs)(`span`,{className:`wcpos:inline-flex wcpos:items-center wcpos:gap-1`,children:[e>0&&(0,_.jsx)(J,{variant:`critical`,shape:`round`,size:`xs`,children:e}),t>0&&(0,_.jsx)(J,{variant:`warning`,shape:`round`,size:`xs`,children:t})]})})()]})}var au=e=>(0,_.jsxs)(`svg`,{fill:`#000`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1260 1260`,...e,children:[(0,_.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,_.jsxs)(`g`,{children:[(0,_.jsxs)(`g`,{fill:`#CD2C24`,children:[(0,_.jsx)(`path`,{d:`M0,90 q0,-90 90,-90 l90,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,_.jsx)(`path`,{d:`M360,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,_.jsx)(`path`,{d:`M720,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,_.jsx)(`path`,{d:`M1080,0 l90,0 q90,0 90,90 l0,180 a90,90 0 1,1 -180,0 Z`})]}),(0,_.jsxs)(`g`,{fill:`#F5E5C0`,children:[(0,_.jsx)(`path`,{d:`M180,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,_.jsx)(`path`,{d:`M540,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,_.jsx)(`path`,{d:`M900,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`})]})]}),(0,_.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,_.jsx)(`path`,{d:` M30,480 l0,-450 m0,150 a150,150 0 1,0 300,0 a150,150 0 1,0 -300,0 `}),(0,_.jsx)(`path`,{d:` M600,30 m-150,150 a150,150 0 1,0 300,0 a150,150 0 1,0 -300,0 `}),(0,_.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 `})]})]}),ou=window?.wcpos?.settings?.updateExtensionsCount??null,su=new Set;function cu(){for(let e of su)e()}function lu(e){return su.add(e),()=>su.delete(e)}function uu(){return ou}function du(){return(0,e.useSyncExternalStore)(lu,uu)}function fu(e){ou=e,cu()}var pu=window?.wcpos?.settings?.unreadLogCounts??{error:0,warning:0},mu=new Set;function hu(){for(let e of mu)e()}function gu(e){return mu.add(e),()=>mu.delete(e)}function _u(){return pu}function vu(){return(0,e.useSyncExternalStore)(gu,_u)}async function yu(){let e={...pu};pu={error:0,warning:0},hu();try{await(0,i.default)({path:`wcpos/v1/logs/mark-read?wcpos=1`,method:`POST`})}catch{pu=e,hu()}}var bu=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},xu=(e=>e?bu(e):bu),Su=e=>e;function Cu(e,t=Su){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 wu=xu((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:wu.getState().registerPage,registerField:wu.getState().registerField,modifyField:wu.getState().modifyField,registerComponent:wu.getState().registerComponent,getComponent:wu.getState().getComponent});function Tu(t){let n=Cu(wu,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 Eu({isOpen:e,onNavItemClick:t}){let n=Tu(`tools`),r=Tu(`account`),i=du(),a=vu();return(0,_.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,_.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,_.jsx)(`div`,{className:`wcpos:w-8`,children:(0,_.jsx)(au,{})}),(0,_.jsx)(`span`,{className:`wcpos:text-lg wcpos:font-semibold wcpos:text-gray-900`,children:`WCPOS`})]}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:overflow-y-auto wcpos:py-2`,children:[(0,_.jsxs)(ru,{heading:$(`common.settings`),children:[(0,_.jsx)(iu,{to:`/general`,label:$(`common.general`),onClick:t}),(0,_.jsx)(iu,{to:`/checkout`,label:$(`common.checkout`),onClick:t}),(0,_.jsx)(iu,{to:`/cloud-print`,label:$(`common.cloud_print`,`Cloud Print`),onClick:t}),(0,_.jsx)(iu,{to:`/access`,label:$(`common.access`),onClick:t}),(0,_.jsx)(iu,{to:`/sessions`,label:$(`sessions.sessions`),onClick:t}),(0,_.jsx)(iu,{to:`/extensions`,label:$(`common.extensions`,`Extensions`),badge:i??void 0,onClick:t})]}),(0,_.jsxs)(ru,{heading:$(`common.tools`,`Tools`),children:[(0,_.jsx)(iu,{to:`/logs`,label:$(`common.logs`,`Logs`),badge:a,onClick:t}),n.map(e=>(0,_.jsx)(iu,{to:`/${e.id}`,label:e.label,onClick:t},e.id))]}),(0,_.jsxs)(ru,{heading:$(`common.account`,`Account`),children:[(0,_.jsx)(iu,{to:`/license`,label:$(`common.license`),onClick:t}),r.map(e=>(0,_.jsx)(iu,{to:`/${e.id}`,label:e.label,onClick:t},e.id))]})]})]})}function Du({rows:e=5}){return(0,_.jsx)(`div`,{className:`wcpos:pb-4 wcpos:mb-4`,role:`status`,"aria-label":$(`common.loading`),children:(0,_.jsx)(`div`,{className:`wcpos:space-y-0`,children:Array.from({length:e}).map((e,t)=>(0,_.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,_.jsx)(`div`,{className:`wcpos:sm:w-[30%] wcpos:sm:max-w-[200px] wcpos:shrink-0`,children:(0,_.jsx)(K,{className:`wcpos:h-4`,width:`${60+t*17%40}%`})}),(0,_.jsx)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:(0,_.jsx)(K,{className:`wcpos:h-5`,width:t%2==0?`200px`:`${40+t*23%30}%`})})]},t))})})}function Ou({cards:e=4}){return(0,_.jsxs)(`div`,{role:`status`,"aria-label":$(`common.loading`),children:[(0,_.jsx)(`div`,{className:`wcpos:mb-4`,children:(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`})}),(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:gap-2 wcpos:mb-6`,children:Array.from({length:3}).map((e,t)=>(0,_.jsx)(K,{className:`wcpos:h-7 wcpos:rounded-full`,width:`${60+t*20}px`},t))}),(0,_.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,_.jsxs)(`div`,{className:`wcpos:border wcpos:border-gray-200 wcpos:rounded-lg wcpos:p-4 wcpos:space-y-3`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3`,children:[(0,_.jsx)(K,{className:`wcpos:h-10 wcpos:w-10 wcpos:rounded-lg wcpos:shrink-0`}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-2`,children:[(0,_.jsx)(K,{className:`wcpos:h-4`,width:`60%`}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`40%`})]})]}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`90%`}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`70%`})]},t))})]})}function ku({rows:e=8}){return(0,_.jsxs)(`div`,{role:`status`,"aria-label":$(`common.loading`),children:[(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:gap-2 wcpos:mb-4`,children:Array.from({length:3}).map((e,t)=>(0,_.jsx)(K,{className:`wcpos:h-7 wcpos:rounded-full`,width:`${50+t*15}px`},t))}),(0,_.jsx)(`div`,{className:`wcpos:space-y-1`,children:Array.from({length:e}).map((e,t)=>(0,_.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,_.jsx)(K,{className:`wcpos:h-5 wcpos:rounded wcpos:shrink-0`,width:`55px`}),(0,_.jsx)(K,{className:`wcpos:h-3 wcpos:shrink-0`,width:`130px`}),(0,_.jsx)(K,{className:`wcpos:h-3 wcpos:flex-1`,width:`${50+t*19%40}%`})]},t))})]})}function Au(){return(0,_.jsxs)(`div`,{role:`status`,"aria-label":$(`common.loading`),children:[(0,_.jsx)(`div`,{className:`wcpos:p-4`,children:(0,_.jsx)(K,{className:`wcpos:h-10 wcpos:w-full wcpos:rounded-md`})}),(0,_.jsxs)(`div`,{className:`wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4 wcpos:p-4 wcpos:pt-0`,children:[(0,_.jsx)(`div`,{children:(0,_.jsx)(`div`,{className:`wcpos:space-y-1`,children:Array.from({length:5}).map((e,t)=>(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:rounded`},t))})}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(K,{className:`wcpos:h-5 wcpos:mb-3`,width:`80px`}),(0,_.jsx)(`div`,{className:`wcpos:space-y-2`,children:Array.from({length:6}).map((e,t)=>(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,_.jsx)(K,{className:`wcpos:h-4 wcpos:w-4 wcpos:rounded wcpos:shrink-0`}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`${60+t*17%30}%`})]},t))})]})]})]})}function ju(){return(0,_.jsxs)(`div`,{className:`wcpos:p-4`,role:`status`,"aria-label":$(`common.loading`),children:[(0,_.jsx)(K,{className:`wcpos:h-10 wcpos:w-full wcpos:rounded-md wcpos:mb-3`}),(0,_.jsxs)(`div`,{className:`wcpos:grid wcpos:grid-cols-[minmax(0,18rem)_1fr] wcpos:gap-4`,children:[(0,_.jsxs)(`div`,{className:`wcpos:space-y-2 wcpos:border-r wcpos:border-gray-200 wcpos:pr-4`,children:[(0,_.jsx)(K,{className:`wcpos:h-8 wcpos:w-full wcpos:rounded-md`}),Array.from({length:4}).map((e,t)=>(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:px-3 wcpos:py-2`,children:[(0,_.jsx)(K,{className:`wcpos:h-10 wcpos:w-10 wcpos:shrink-0 wcpos:rounded-full`}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-1`,children:[(0,_.jsx)(K,{className:`wcpos:h-4`,width:`60%`}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`40%`})]}),(0,_.jsx)(K,{className:`wcpos:h-5 wcpos:w-6 wcpos:rounded-full`})]},t))]}),(0,_.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:border-b wcpos:border-gray-200 wcpos:pb-3`,children:[(0,_.jsx)(K,{className:`wcpos:h-12 wcpos:w-12 wcpos:shrink-0 wcpos:rounded-full`}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-1`,children:[(0,_.jsx)(K,{className:`wcpos:h-5`,width:`40%`}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`30%`})]}),(0,_.jsx)(K,{className:`wcpos:h-8 wcpos:rounded`,width:`120px`})]}),Array.from({length:3}).map((e,t)=>(0,_.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,_.jsx)(K,{className:`wcpos:h-10 wcpos:w-10 wcpos:shrink-0 wcpos:rounded-md`}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-1`,children:[(0,_.jsx)(K,{className:`wcpos:h-4`,width:`50%`}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`70%`}),(0,_.jsx)(K,{className:`wcpos:h-8 wcpos:rounded wcpos:mt-2`,width:`100%`})]}),(0,_.jsx)(K,{className:`wcpos:h-7 wcpos:rounded`,width:`80px`})]},t))]})]})]})}function Mu(){return(0,_.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,_.jsx)(`div`,{className:`wcpos:flex wcpos:sm:justify-end`,children:(0,_.jsx)(K,{className:`wcpos:h-4`,width:`90px`})}),(0,_.jsx)(`div`,{children:(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`})}),(0,_.jsx)(`div`,{children:(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:rounded`,width:`90px`})})]})}var Nu={"/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`},Pu={"/general":(0,_.jsx)(Du,{rows:5}),"/checkout":(0,_.jsx)(Du,{rows:4}),"/cloud-print":(0,_.jsx)(Du,{rows:4}),"/access":(0,_.jsx)(Au,{}),"/sessions":(0,_.jsx)(ju,{}),"/extensions":(0,_.jsx)(Ou,{cards:4}),"/logs":(0,_.jsx)(ku,{rows:8}),"/license":(0,_.jsx)(Mu,{})};function Fu(){let{notice:t,setNotice:n}=Vl(),[r,i]=e.useState(!1),a=Ma(),o=$(Nu[a.pathname]||`common.settings`);return(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:flex wcpos:bg-white`,children:[(0,_.jsx)(Eu,{isOpen:r,onNavItemClick:()=>i(!1)}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:flex wcpos:flex-col wcpos:min-w-0`,children:[(0,_.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,_.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,_.jsx)(`svg`,{className:`wcpos:h-5 wcpos:w-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,_.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 6h16M4 12h16M4 18h16`})})}),(0,_.jsx)(`h1`,{className:`wcpos:text-lg wcpos:font-semibold wcpos:text-gray-900 wcpos:m-0`,children:o})]}),(0,_.jsxs)(`main`,{className:`wcpos:flex-1 wcpos:px-6 wcpos:py-6`,children:[t&&(0,_.jsx)(`div`,{className:`wcpos:mb-4`,children:(0,_.jsx)(Ll,{status:t.type,onRemove:()=>n(null),children:t.message})}),(0,_.jsx)(Fa,{FallbackComponent:Rl,children:(0,_.jsx)(e.Suspense,{fallback:Pu[a.pathname]||(0,_.jsx)(Du,{}),children:(0,_.jsx)(xa,{})})})]}),(0,_.jsx)(nu,{})]})]})}var Iu=[{id:`use_pos`,labelKey:`access.task_use_pos`,capabilities:[`access_woocommerce_pos`]},{id:`manage_settings`,labelKey:`access.task_manage_settings`,capabilities:[`manage_woocommerce_pos`]},{id:`edit_products`,labelKey:`access.task_edit_products`,capabilities:[`edit_product`,`edit_products`,`edit_others_products`,`edit_private_products`,`edit_published_products`,`publish_products`,`read_private_products`]},{id:`delete_products`,labelKey:`access.task_delete_products`,capabilities:[`delete_product`,`delete_products`,`delete_others_products`,`delete_private_products`,`delete_published_products`]},{id:`edit_coupons`,labelKey:`access.task_edit_coupons`,capabilities:[`edit_shop_coupons`,`edit_others_shop_coupons`,`edit_private_shop_coupons`,`edit_published_shop_coupons`,`publish_shop_coupons`,`read_private_shop_coupons`]},{id:`delete_coupons`,labelKey:`access.task_delete_coupons`,capabilities:[`delete_shop_coupons`,`delete_others_shop_coupons`,`delete_private_shop_coupons`,`delete_published_shop_coupons`]},{id:`manage_orders`,labelKey:`access.task_manage_orders`,capabilities:[`read_private_shop_orders`,`publish_shop_orders`,`edit_shop_orders`,`edit_others_shop_orders`]},{id:`manage_customers`,labelKey:`access.task_manage_customers`,capabilities:[`edit_users`,`list_users`],alternatives:[[`create_customers`,`promote_users`]]},{id:`manage_categories`,labelKey:`access.task_manage_categories`,capabilities:[`manage_product_terms`]}];function Lu(e){let t={};return Object.entries(e||{}).forEach(([e,n])=>{Object.keys(n||{}).forEach(n=>{t[n]=e})}),t}function Ru(e){let t=Lu(e);return Iu.filter(e=>e.capabilities.every(e=>e in t)&&(e.alternatives||[]).every(e=>e.some(e=>e in t))).map(n=>{let r=[...n.capabilities];(n.alternatives||[]).forEach(e=>{let n=e.find(e=>e in t);n&&r.push(n)});let i=r.filter(e=>e in t).map(e=>({group:t[e],name:e})),a=i.filter(({group:t,name:n})=>e[t][n]).length;return{task:n,members:i,allGranted:i.length>0&&a===i.length,partiallyGranted:a>0&&a<i.length}}).filter(({members:e})=>e.length>0)}function zu(e,t){return e.reduce((e,{group:n,name:r})=>(e[n]||(e[n]={}),e[n][r]=t,e),{})}function Bu(e){return(0,_.jsx)($a,{loadingLabel:$(`common.loading`),noResultsLabel:$(`common.no_results`),...e})}var Vu=e=>{let t=y(),{addSnackbar:n}=jo(),{setNotice:a}=Vl(),o=`wcpos/v1/settings/${e}?wcpos=1`,{data:s}=it({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:at({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}},Hu={wcpos:`WCPOS`,wc:`WooCommerce`,wp:`WordPress`};function Uu(){let{data:t,mutate:n}=Vu(`access`),[i,a]=e.useState(`administrator`),[o,s]=e.useState(!1),c=(0,r.get)(t,[i,`capabilities`],null),l=e.useMemo(()=>c?Ru(c):[],[c]),u=e.useCallback((e,t)=>{n({[i]:{capabilities:zu(e,t)}})},[n,i]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`wcpos:p-4`,children:(0,_.jsxs)(Ll,{status:`info`,isDismissible:!1,children:[(0,_.jsx)(Il,{i18nKey:`access.default_roles_warning`,components:{strong:(0,_.jsx)(`strong`,{})}}),`\xA0`,(0,_.jsx)(Il,{i18nKey:`access.visit_documentation`,components:{link:(0,_.jsx)(`a`,{href:`https://docs.wcpos.com/pos-access`,target:`_blank`,rel:`noreferrer`})}})]})}),(0,_.jsxs)(`div`,{className:`wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4 wcpos:p-4 wcpos:pt-0`,children:[(0,_.jsx)(`div`,{className:``,children:(0,_.jsx)(`ul`,{children:(0,r.map)(t,(e,t)=>(0,_.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))})}),c&&(0,_.jsxs)(`div`,{className:`wcpos:sm:col-span-2`,children:[(0,_.jsx)(`h2`,{className:`wcpos:text-base wcpos:mb-2`,children:$(`access.tasks_title`)}),(0,_.jsx)(`div`,{"data-testid":`access-task-groups`,children:l.map(({task:e,members:t,allGranted:n,partiallyGranted:r})=>(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2 wcpos:py-1`,children:[(0,_.jsx)(Ba,{"data-testid":`access-task-${e.id}`,label:$(e.labelKey),checked:n,indeterminate:r,onChange:()=>{u(t,!n)}}),r&&(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`access.task_partial`)})]},e.id))}),(0,_.jsxs)(`details`,{open:o,"data-testid":`access-advanced`,className:`wcpos:mt-4 wcpos:border wcpos:border-gray-200 wcpos:rounded`,children:[(0,_.jsx)(`summary`,{"data-testid":`access-advanced-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`),onClick:e=>{e.preventDefault(),s(e=>!e)},children:(0,_.jsxs)(`span`,{children:[(0,_.jsx)(`strong`,{children:$(`access.advanced_title`)}),` `,(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`access.advanced_subtitle`)})]})}),o&&(0,_.jsxs)(`div`,{className:`wcpos:border-t wcpos:border-gray-200 wcpos:px-3 wcpos:py-3`,children:[(0,_.jsx)(`p`,{className:`wcpos:text-xs wcpos:text-gray-500 wcpos:mb-3`,children:$(`access.advanced_intro`)}),(0,r.map)(c,(e,t)=>(0,_.jsxs)(`div`,{className:`wcpos:mb-3 wcpos:last:mb-0`,children:[(0,_.jsx)(`h3`,{className:`wcpos:text-sm wcpos:font-medium`,"data-testid":`access-capability-group-${t}`,children:Hu[t]||t}),(0,_.jsx)(`div`,{children:(0,r.map)(e,(e,r)=>(0,_.jsx)(Ba,{label:r,checked:e,disabled:i===`administrator`&&r===`read`,onChange:e=>{n({[i]:{capabilities:{[t]:{[r]:e.target.checked}}}})}},r))})]},t))]})]})]})]})]})}function Wu(e){if(Array.isArray(e))return e}function Gu(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 Ku(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 qu(e,t){if(e){if(typeof e==`string`)return Ku(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)?Ku(e,t):void 0}}function Ju(){throw TypeError(`Invalid attempt to destructure 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 nf(e,t){if(e){if(typeof e==`string`)return rf(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)?rf(e,t):void 0}}function rf(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 af(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 of(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?af(Object(n),!0).forEach(function(t){jc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):af(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function sf(){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=of({},r);e.add(i),n(i);function a(){e.delete(i),t&&t.active.delete(i)}return id(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=tf(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 cf(e){var t=e.typeKey,n=e.mount,r=e.dispatchEventToSource,i=e.onPostDispatch,a=e.defaultDropEffect,o=sf(),s=ef({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;Hd.start({event:t,dragType:n,getDropTargetsOver:s.getIsOver,dispatchEvent:c})}function u(){function e(){return n({canStart:Hd.canStart,start:l})}return Gd({typeKey:t,mount:e})}return{registerUsage:u,dropTarget:s.dropTargetForConsumers,monitor:o.monitorForConsumers}}var lf=id(function(){return navigator.userAgent.toLocaleLowerCase().includes(`android`)}),uf=`pdnd:android-fallback`,df=`text/plain`,ff=`application/vnd.pdnd`,pf=new WeakMap;function mf(e){return pf.set(e.element,e),function(){pf.delete(e.element)}}var hf=vd(),gf=cf({typeKey:`element`,defaultDropEffect:`move`,mount:function(e){return Kd(hf.bindEvents(),(0,Qu.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=pf.get(n);if(r){var i=jd(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=td({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=Yu(l[c],2),d=u[0],f=u[1];t.dataTransfer.setData(d,f??``)}lf()&&!t.dataTransfer.types.includes(`text/plain`)&&!t.dataTransfer.types.includes(`text/uri-list`)&&t.dataTransfer.setData(df,uf),t.dataTransfer.setData(ff,``);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=pf.get(i.source.element))==null||(n=t[r])==null||n.call(t,i)},onPostDispatch:hf.getOnPostDispatch()}),_f=gf.dropTarget,vf=gf.monitor;function yf(e){return id(Kd(gf.registerUsage(),mf(e),qd(e.element,{attribute:`draggable`,value:`true`})))}function bf(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 xf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?bf(Object(n),!0).forEach(function(t){jc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Sf={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)}};function Cf(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:Sf[e](o,a)}}).sort(function(e,t){return e.value-t.value})[0]?.edge??null;return xf(xf({},e),{},jc({},Tf,s))}function wf(e){return e[Tf]??null}var Tf=Symbol(`closestEdge`);function Ef(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=Yu(i.splice(n,1),1)[0];return i.splice(r,0,a),i}function Df(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 Of(e){var t=e.list,n=e.startIndex,r=e.closestEdgeOfTarget,i=e.indexOfTarget,a=e.axis;return Ef({list:t,startIndex:n,finishIndex:Df({closestEdgeOfTarget:r,startIndex:n,indexOfTarget:i,axis:a})})}function kf({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,_.jsxs)(eo,{open:!0,onClose:()=>r(),title:t.title,className:`wcpos:max-w-md`,children:[(0,_.jsx)(Ll,{status:`info`,isDismissible:!1,children:(0,_.jsx)(Il,{i18nKey:`checkout.gateway_settings_pos_only`,components:{link:(0,_.jsx)(`a`,{href:`admin.php?page=wc-settings&tab=checkout`,target:`_blank`,rel:`noreferrer`})}})}),(0,_.jsxs)(`div`,{className:`wcpos:py-2`,children:[(0,_.jsx)(`label`,{htmlFor:`title`,className:`wcpos:block wcpos:mb-1 wcpos:font-medium wcpos:text-sm`,children:$(`common.title`)}),(0,_.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,_.jsxs)(`div`,{className:`wcpos:py-2`,children:[(0,_.jsx)(`label`,{htmlFor:`description`,className:`wcpos:block wcpos:mb-1 wcpos:font-medium wcpos:text-sm`,children:$(`common.description`)}),(0,_.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,_.jsxs)(`div`,{className:`wcpos:text-right wcpos:pt-4 wcpos:flex wcpos:justify-end wcpos:gap-2`,children:[(0,_.jsx)(W,{onClick:r,children:$(`common.cancel`)}),(0,_.jsx)(W,{variant:`primary`,onClick:l,children:$(`common.save`)})]})]})}function Af({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,_.jsx)(Ha,{options:a||[],value:t,onChange:({value:e})=>{n(String(e))},disabled:r})}var jf=e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,_.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`})}),Mf=e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,_.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 Nf({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=yf({element:e,dragHandle:r,getInitialData:()=>({id:t.id,index:n}),onDragStart:()=>u(!0),onDrop:()=>u(!1)}),a=_f({element:e,getData:({input:e,element:r})=>Cf({id:t.id,index:n},{element:r,input:e,allowedEdges:[`top`,`bottom`]}),onDragEnter:({self:e})=>f(wf(e.data)),onDrag:({self:e})=>f(wf(e.data)),onDragLeave:()=>f(null),onDrop:()=>f(null)});return()=>{i(),a()}},[t.id,n]),(0,_.jsxs)(Io,{ref:s,className:(0,U.default)(`wcpos:relative`,l&&`wcpos:opacity-50`,n%2!=0&&`wcpos:bg-gray-50`),children:[d&&(0,_.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,_.jsx)(X,{ref:c,className:`wcpos:pl-3 wcpos:pr-1 wcpos:whitespace-nowrap wcpos:cursor-grab wcpos:w-8`,children:(0,_.jsx)(jf,{className:`wcpos:w-5 wcpos:h-5 wcpos:text-gray-400 wcpos:fill-current`})}),(0,_.jsx)(X,{className:`wcpos:whitespace-nowrap wcpos:text-center`,children:(0,_.jsx)(`input`,{type:`radio`,value:t.id,checked:r?.default_gateway===t.id,disabled:!t.enabled,className:``,onChange:()=>{i({default_gateway:t.id})}})}),(0,_.jsx)(X,{className:`wcpos:text-ellipsis wcpos:overflow-hidden wcpos:whitespace-nowrap`,children:(0,_.jsx)(`strong`,{children:t.title})}),(0,_.jsx)(X,{className:`wcpos:whitespace-nowrap`,children:t.id}),(0,_.jsx)(X,{className:`wcpos:whitespace-nowrap wcpos:text-center`,children:(0,_.jsx)(za,{"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,_.jsx)(X,{className:`wcpos:whitespace-nowrap`,children:(0,_.jsx)(Af,{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,_.jsx)(X,{className:`wcpos:whitespace-nowrap wcpos:text-right`,children:(0,_.jsxs)(ro,{label:t.title,trigger:(0,_.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,_.jsx)(Mf,{className:`wcpos:w-4 wcpos:h-4 wcpos:fill-current`})}),children:[(0,_.jsx)(io,{onSelect:()=>o(t),disabled:!a&&![`pos_cash`,`pos_card`].includes(t.id),children:$(`common.pos_settings`)}),![`pos_cash`,`pos_card`].includes(t.id)&&(0,_.jsx)(io,{href:`admin.php?page=wc-settings&tab=checkout§ion=${t.id}`,children:$(`common.woocommerce_settings`)})]})})]})}function Pf(){let{data:t,mutate:n}=Vu(`payment-gateways`),[i,a]=e.useState(!1),[o,s]=e.useState(null),c=t?.pro_enabled,l=(0,r.sortBy)(t?.gateways,[`order`,`id`]);e.useEffect(()=>vf({onDrop:({source:e,location:t})=>{let i=t.current.dropTargets[0];if(!i)return;let a=e.data.index,o=i.data.index,s=wf(i.data),c=Of({list:l,startIndex:a,indexOfTarget:o,closestEdgeOfTarget:s,axis:`vertical`}).map((e,t)=>({...e,order:t}));n({gateways:(0,r.keyBy)(c,`id`)})}}),[l,n]),e.useEffect(()=>{c||Gl(`checkout_gateways`)},[c]);let u=e.useCallback(e=>{s(e),a(!0)},[]);return(0,_.jsxs)(_.Fragment,{children:[c?``:(0,_.jsx)(`div`,{className:`wcpos:pb-5`,children:(0,_.jsxs)(Ll,{status:`info`,isDismissible:!1,children:[$(`checkout.enable_pro_gateways`),` `,(0,_.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>Kl(`checkout_gateways`,`https://wcpos.com/pro`),children:$(`common.upgrade_to_pro`)}),`.`]})}),(0,_.jsxs)(Mo,{children:[(0,_.jsx)(No,{children:(0,_.jsxs)(Fo,{children:[(0,_.jsx)(Y,{scope:`col`}),(0,_.jsx)(Y,{scope:`col`,className:`wcpos:text-center`,"data-testid":`gateways-th-default`,children:$(`common.default`)}),(0,_.jsx)(Y,{scope:`col`,"data-testid":`gateways-th-gateway`,children:$(`common.gateway`)}),(0,_.jsx)(Y,{scope:`col`,children:$(`checkout.gateway_id`)}),(0,_.jsx)(Y,{scope:`col`,className:`wcpos:text-center`,"data-testid":`gateways-th-enabled`,children:$(`common.enabled`)}),(0,_.jsx)(Y,{scope:`col`,children:$(`checkout.order_status`)}),(0,_.jsx)(Y,{scope:`col`})]})}),(0,_.jsx)(Po,{children:l.map((e,r)=>(0,_.jsx)(Nf,{item:e,index:r,data:t,mutate:n,proEnabled:!!c,onEditGateway:u},e.id))})]}),i&&o&&(0,_.jsx)(kf,{gateway:o,mutate:n,closeModal:()=>a(!1)})]})}function Ff({children:e,tip:t}){return(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[e,t&&(0,_.jsx)(to,{text:t,children:(0,_.jsx)(`span`,{className:`wcpos:inline-flex wcpos:text-gray-300`,children:(0,_.jsx)(eu,{className:`wcpos:h-4 wcpos:w-4`,fill:`currentColor`})})})]})}var If=[{key:`new_order`,label:`checkout.email_new_order`},{key:`cancelled_order`,label:`checkout.email_cancelled_order`},{key:`failed_order`,label:`checkout.email_failed_order`}],Lf=[{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`}],Rf=[{key:`new_order`,label:`checkout.email_new_order`}];function zf({settingsKey:e,label:t,tip:n,emailTypes:r,data:i,mutate:a}){let o=i?.[e],s=o?.enabled??!1;return(0,_.jsxs)(q,{children:[(0,_.jsx)(Ff,{tip:n,children:(0,_.jsx)(za,{checked:s,onChange:t=>{a({[e]:{enabled:t}})},label:t})}),s&&(0,_.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,_.jsx)(Ba,{checked:o?.[t]??!0,onChange:n=>{a({[e]:{[t]:n.target.checked}})},label:$(n)},t))})]})}function Bf(){let{data:t,mutate:n}=Vu(`checkout`);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(ho,{children:[(0,_.jsx)(q,{children:(0,_.jsx)(Ff,{tip:$(`checkout.prevent_overselling_tip`),children:(0,_.jsx)(za,{checked:!!t?.prevent_overselling,onChange:e=>{n({prevent_overselling:e})},label:$(`checkout.prevent_overselling`)})})}),(0,_.jsx)(zf,{settingsKey:`admin_emails`,label:$(`checkout.admin_emails`),tip:$(`checkout.admin_emails_tip`),emailTypes:If,data:t,mutate:n}),(0,_.jsx)(zf,{settingsKey:`customer_emails`,label:$(`checkout.customer_emails`),tip:$(`checkout.customer_emails_tip`),emailTypes:Lf,data:t,mutate:n}),(0,_.jsx)(zf,{settingsKey:`cashier_emails`,label:$(`checkout.cashier_emails`),tip:$(`checkout.cashier_emails_tip`),emailTypes:Rf,data:t,mutate:n})]}),(0,_.jsxs)(`div`,{className:`wcpos:px-4 wcpos:pb-5`,children:[(0,_.jsx)(`h2`,{className:`wcpos:text-base`,children:$(`checkout.gateways`)}),(0,_.jsx)(`p`,{children:$(`checkout.gateways_description`)}),(0,_.jsx)(Fa,{FallbackComponent:Rl,children:(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(ku,{rows:3}),children:(0,_.jsx)(Pf,{})})})]})]})}var Vf={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 Hf(e,t){return Vf[t].templateEngines===`all`?e:e.filter(e=>e.engine===Vf[t].templateEngines)}var Uf=[`printnode`,`star-online`,`star-cloudprnt`,`epson-sdp`];function Wf(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 Gf(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 Kf(){return window.wpApiSettings?.root||`${window.location.origin}/wp-json/`}function qf(e,t,n,r){let i=Vf[e].pollEndpoint,a=`${encodeURIComponent(t)}/${n}`;if(r)return`${r.replace(/\/$/,``)}/${a}/${i}`;let o=`${Kf()}wcpos/v1/print-jobs/${i}/${a}`;return`${o}${o.includes(`?`)?`&`:`?`}wcpos=1`}function Jf(e,t,n,r){return qf(e,t,encodeURIComponent(n),r)}function Yf(e,t,n){return qf(e,t,`••••`,n)}function Xf({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,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-baseline wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:t}),n&&(0,_.jsxs)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:[`— `,n]})]}),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,_.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,_.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 Zf(){return(0,_.jsx)(`p`,{className:`wcpos:text-xs`,"data-testid":`wizard-relay-docs-note`,children:(0,_.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,_.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,_.jsx)($l,{fill:`currentColor`})}),$(`cloud_print.relay_docs_note`,`For more information on why we're using a relay server.`),(0,_.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})})}function Qf({url:e,copyable:t}){return(0,_.jsxs)(`details`,{className:`wcpos:mt-1`,"data-testid":`wizard-direct-disclosure`,children:[(0,_.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,_.jsxs)(`div`,{className:`wcpos:mt-2 wcpos:flex wcpos:flex-col wcpos:gap-2`,children:[(0,_.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,_.jsx)(Xf,{label:$(`cloud_print.direct_url`,`Direct URL`),value:e,copyValue:t?e:void 0,valueTestId:`wizard-direct-url`,copyTestId:`wizard-copy-direct-url`})]})]})}function $f({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,y]=e.useState(``),[b,x]=e.useState(``),[S,C]=e.useState(!1),[w,T]=e.useState(null),[E,D]=e.useState(null),[O,k]=e.useState(null),[A,j]=e.useState(!1),[M,N]=e.useState(null),[P,F]=e.useState(null),[ee,te]=e.useState(!1),[I,ne]=e.useState(null),re=e.useCallback(()=>{g(``),y(``),x(``),C(!1),T(null),D(null),k(null),j(!1),N(null),F(null),te(!1),ne(null)},[]),ie=e.useRef(d);e.useEffect(()=>{if(!t){ie.current=d;return}ie.current!==d&&(re(),ie.current=d)},[t,d,re]);let ae=async()=>{if(o){j(!0),N(null);try{let e=await o(h.trim());k(e),y(t=>e.some(e=>String(e.id)===t)?t:``),e.length===0&&N($(`cloud_print.printnode_no_printers`,`No printers found on this PrintNode account.`))}catch{k(null),N($(`cloud_print.printnode_fetch_failed`,`Couldn't list your PrintNode printers. Check the API key and that the desktop client is running.`))}finally{j(!1)}}},oe=async()=>{if(s){te(!0),ne(null);try{let e=await s(b.trim(),h.trim());F(e),y(t=>e.some(e=>e.id===t)?t:``),e.length===0&&ne($(`cloud_print.star_online_no_devices`,`No devices found in this Star Online group.`))}catch{F(null),ne($(`cloud_print.star_online_fetch_failed`,`Couldn't list your Star Online devices. Check the CloudPRNT URL and API key.`))}finally{te(!1)}}},[se,ce]=e.useState(!1);if(t!==se&&(ce(t),t&&(n===`setup`&&r?(f(r.provider),u(2)):(f(null),u(0)),m(``),re())),!t)return null;let le=d===`printnode`,ue=d===`star-online`,de=p.trim(),fe=de!==``&&(!le||h.trim()!==``&&v.trim()!==``)&&(!ue||h.trim()!==``&&b.trim()!==``&&v.trim()!==``),pe=async()=>{if(!d)return;let e={name:de,provider:d};le&&(e.printnode_api_key=h.trim(),e.printnode_printer_id=Number(v.trim())),ue&&(e.star_api_key=h.trim(),e.star_cloudprnt_url=b.trim(),e.star_device_id=v.trim()),C(!0),T(null);try{let t=await a(e);D(t),u(2)}catch{T($(`cloud_print.create_failed`,`Couldn't create the printer. Please try again.`))}finally{C(!1)}},me=l===2?$(`cloud_print.connect_title`,`Connect your printer`):$(`cloud_print.add_title`,`Add a cloud printer`),he=n===`setup`?r??null:E?.printer??null,L=n===`setup`&&r?r.provider:d,ge=L?Vf[L].isPolling:!1;return(0,_.jsx)(eo,{open:t,onClose:()=>i(),title:me,className:`wcpos:max-w-xl`,children:(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-4`,children:[w&&(0,_.jsx)(uo,{status:`error`,isDismissible:!1,children:(0,_.jsx)(`span`,{"data-testid":`wizard-error`,children:w})}),l===0&&(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-2`,children:[(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700`,children:$(`cloud_print.step_provider_q`,`What kind of printer are you connecting?`)}),Uf.map(e=>{let t=Vf[e],n=d===e;return(0,_.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,_.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,_.jsxs)(`span`,{className:`wcpos:min-w-0`,children:[(0,_.jsx)(`span`,{className:`wcpos:block wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900`,children:t.label}),(0,_.jsx)(`span`,{className:`wcpos:block wcpos:text-xs wcpos:text-gray-500`,children:Wf(e)}),(0,_.jsx)(`span`,{className:`wcpos:mt-1 wcpos:block wcpos:text-xs wcpos:text-gray-600`,children:Gf(e)})]})]},e)})]}),l===1&&(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-3`,children:[(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printer_name`,`Printer name`)}),(0,_.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,_.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.`)})]}),le&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printnode_api_key`,`PrintNode API key`)}),(0,_.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,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1 wcpos:pt-1`,children:[(0,_.jsx)(W,{variant:`outline`,"data-testid":`wizard-printnode-fetch`,disabled:h.trim()===``||A,loading:A,onClick:ae,children:$(`cloud_print.printnode_fetch`,`Fetch my printers`)}),M&&(0,_.jsx)(`span`,{"data-testid":`wizard-printnode-fetch-error`,className:`wcpos:text-xs wcpos:text-red-600`,children:M})]})]}),O&&O.length>0&&(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printnode_pick_printer`,`Choose a printer`)}),(0,_.jsxs)(`select`,{"data-testid":`wizard-printnode-printer-select`,value:v,onChange:e=>y(e.target.value),className:`wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:px-2 wcpos:py-1 wcpos:text-sm`,children:[(0,_.jsx)(`option`,{value:``,children:$(`cloud_print.printnode_pick_placeholder`,`Select a printer…`)}),O.map(e=>(0,_.jsxs)(`option`,{value:String(e.id),children:[e.name,` (`,e.state,`)`]},e.id))]})]}),(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printnode_printer_id`,`PrintNode printer ID`)}),(0,_.jsx)(G,{"data-testid":`wizard-printnode-printer-id`,type:`number`,value:v,onChange:e=>y(e.target.value)})]}),(0,_.jsx)(uo,{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.`)})]}),ue&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_cloudprnt_url`,`CloudPRNT URL`)}),(0,_.jsx)(G,{"data-testid":`wizard-star-cloudprnt-url`,value:b,placeholder:`https://eu-device.stario.online/cloudprnt/your-group`,onChange:e=>x(e.target.value)})]}),(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_api_key`,`Star Online API key`)}),(0,_.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,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1 wcpos:pt-1`,children:[(0,_.jsx)(W,{variant:`outline`,"data-testid":`wizard-star-fetch`,disabled:h.trim()===``||b.trim()===``||ee,loading:ee,onClick:oe,children:$(`cloud_print.star_fetch`,`Fetch my devices`)}),I&&(0,_.jsx)(`span`,{"data-testid":`wizard-star-fetch-error`,className:`wcpos:text-xs wcpos:text-red-600`,children:I})]})]}),P&&P.length>0&&(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_pick_device`,`Choose a device`)}),(0,_.jsxs)(`select`,{"data-testid":`wizard-star-device-select`,value:v,onChange:e=>y(e.target.value),className:`wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:px-2 wcpos:py-1 wcpos:text-sm`,children:[(0,_.jsx)(`option`,{value:``,children:$(`cloud_print.star_pick_placeholder`,`Select a device…`)}),P.map(e=>(0,_.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.state,`)`]},e.id))]})]}),(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_device_id`,`AccessIdentifier`)}),(0,_.jsx)(G,{"data-testid":`wizard-star-device-id`,value:v,onChange:e=>y(e.target.value)})]})]})]}),l===2&&L&&(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-3`,children:ge?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{children:(0,_.jsx)(J,{variant:`success`,icon:`✓`,children:$(`cloud_print.created`,`Printer created`)})}),n===`setup`?(0,_.jsx)(uo,{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,_.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=he;if(!e)return null;let t=c?.enabled&&c.printer_base_url?c.printer_base_url:void 0;if(n===`setup`)return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Xf,{label:$(`cloud_print.poll_url`,`Poll URL`),help:$(`cloud_print.poll_url_help`,`paste into the printer's "server URL"`),value:Yf(L,e.id,t),valueTestId:`wizard-poll-url`,copyTestId:`wizard-copy-url`}),t&&(0,_.jsx)(Zf,{}),t&&(0,_.jsx)(Qf,{url:Yf(L,e.id),copyable:!1})]});let r=E?.token??``;if(!r)return(0,_.jsx)(uo,{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=Jf(L,e.id,r,t);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Xf,{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,_.jsx)(Zf,{}),t&&(0,_.jsx)(Qf,{url:Jf(L,e.id,r),copyable:!0})]})})()]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{children:(0,_.jsx)(J,{variant:`success`,icon:`✓`,children:$(`cloud_print.linked_provider`,`Linked to {provider}`,{provider:Vf[L].label})})}),(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700`,children:L===`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,_.jsxs)(`div`,{className:`wcpos:flex wcpos:justify-end wcpos:gap-2 wcpos:pt-2`,children:[l===1&&(0,_.jsx)(W,{variant:`secondary`,"data-testid":`wizard-back`,onClick:()=>u(0),children:$(`common.back`,`Back`)}),l===0&&(0,_.jsx)(W,{variant:`primary`,"data-testid":`wizard-continue`,disabled:!d,onClick:()=>u(1),children:$(`common.continue`,`Continue`)}),l===1&&(0,_.jsx)(W,{variant:`primary`,"data-testid":`wizard-continue`,disabled:!fe,loading:S,onClick:pe,children:$(`common.continue`,`Continue`)}),l===2&&(0,_.jsx)(W,{variant:`primary`,"data-testid":`wizard-done`,onClick:()=>i(),children:$(`common.done`,`Done`)})]})]})})}function ep(e){return e.store_id&&e.store_id>0?`store:${e.store_id}`:e.scope}function tp(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 np(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 rp=`edit.php?post_type=wcpos_template`;function ip(e,t){return e.find(e=>String(e.value)===String(t))?.label.length??0}function ap(e,t){return{width:`calc(${Math.max(ip(e,t),1)}ch + 3.5rem)`}}function op({printers:e,assignments:t,templateOptions:n,storeOptions:r=[],onChange:i}){let a=e.map(e=>({value:e.id,label:e.name})),o=Array.from({length:5},(e,t)=>{let n=t+1;return{value:n,label:$(`cloud_print.rule_copies`,{count:n})}}),s=[{value:`paid`,label:$(`cloud_print.trigger_paid`,`once it's paid`)},{value:`created`,label:$(`cloud_print.trigger_created`,`as soon as it's created`)}],c=t=>e.find(e=>e.id===t)?.provider??`printnode`,l=e=>Hf(n,c(e)),u=(e,n)=>{i(t.map((t,r)=>r===e?{...t,...n}:t))},d=()=>{let n=e[0];if(!n)return;let r=l(n.id);i([...t,{printer_id:n.id,store_id:0,scope:`every`,template_id:r[0]?.value??``,copies:1,trigger:`paid`}])},f=e=>i(t.filter((t,n)=>n!==e));return(0,_.jsxs)(`div`,{className:`wcpos:mt-4 wcpos:flex wcpos:flex-col wcpos:gap-3`,children:[(0,_.jsxs)(mo,{status:`info`,children:[`💡`,` `,$(`cloud_print.rules_tip`,`This is optional — leave it empty to print receipts only manually from the POS.`)]}),(0,_.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,_.jsx)(`a`,{href:rp,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,_.jsx)(`p`,{"data-testid":`rules-empty`,className:`wcpos:text-sm wcpos:text-gray-500`,children:$(`cloud_print.no_rules`,`No rules yet.`)}):(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-2`,children:t.map((e,t)=>{let n=tp(r,e),i=ep(e);return(0,_.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,_.jsx)(`span`,{children:$(`cloud_print.rule_print`,`Automatically print`)}),(0,_.jsx)(Ha,{inline:!0,"data-testid":`rule-scope-${t}`,"aria-label":$(`cloud_print.rule_scope_label`,`Which orders to print`),className:`wcpos:max-w-full`,style:ap(n,i),value:i,options:n,onChange:({value:e})=>u(t,np(String(e)))}),(0,_.jsx)(`span`,{children:$(`cloud_print.rule_to`,`to`)}),(0,_.jsx)(Ha,{inline:!0,"data-testid":`rule-printer-${t}`,"aria-label":$(`cloud_print.rule_printer_label`,`Printer`),className:`wcpos:max-w-full`,style:ap(a,e.printer_id),value:e.printer_id,options:a,onChange:({value:e})=>u(t,{printer_id:String(e)})}),(0,_.jsx)(`span`,{children:$(`cloud_print.rule_using`,`using the`)}),(0,_.jsx)(Ha,{inline:!0,"data-testid":`rule-template-${t}`,"aria-label":$(`cloud_print.rule_template_label`,`Receipt template`),className:`wcpos:max-w-full`,style:ap(l(e.printer_id),e.template_id),value:e.template_id,options:l(e.printer_id),onChange:({value:e})=>u(t,{template_id:String(e)})}),(0,_.jsx)(`span`,{children:$(`cloud_print.rule_template_suffix`,`template,`)}),(0,_.jsx)(Ha,{inline:!0,"data-testid":`rule-copies-${t}`,"aria-label":$(`cloud_print.rule_copies_label`,`Number of copies`),className:`wcpos:max-w-full`,style:ap(o,e.copies??1),value:e.copies??1,options:o,onChange:({value:e})=>u(t,{copies:Number(e)})}),(0,_.jsx)(`span`,{children:$(`cloud_print.rule_trigger_join`,`,`)}),(0,_.jsx)(Ha,{inline:!0,"data-testid":`rule-trigger-${t}`,"aria-label":$(`cloud_print.rule_trigger_label`,`When to print`),className:`wcpos:max-w-full`,style:ap(s,e.trigger??`paid`),value:e.trigger??`paid`,options:s,onChange:({value:e})=>u(t,{trigger:e===`created`?`created`:`paid`})}),(0,_.jsx)(`span`,{children:$(`cloud_print.rule_copies_suffix`,`.`)}),(0,_.jsx)(W,{variant:`ghost-destructive`,"data-testid":`rule-remove-${t}`,className:`wcpos:ml-1`,onClick:()=>f(t),children:$(`common.remove`,`Remove`)})]},t)})}),(0,_.jsx)(`div`,{children:(0,_.jsx)(W,{variant:`outline`,"data-testid":`rules-add`,disabled:e.length===0,onClick:d,children:$(`cloud_print.add_rule`,`+ Add rule`)})})]})}async function sp(e,t=i.default){return(await t({path:`wcpos/v1/printnode/printers?wcpos=1`,method:`POST`,data:{api_key:e}})).printers??[]}async function cp(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 lp=`wcpos/v1/print-jobs/queue`,up=`print-queue`,dp=20,fp=3e4,pp=600,mp={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 hp(e){if(!e||e.startsWith(`0000`))return null;let t=new Date(`${e.replace(` `,`T`)}Z`);return Number.isNaN(t.getTime())?null:t}function gp(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 _p(e){let t=hp(e);return t?gp(t):`—`}function vp(e){return e.polling===!1||e.pending===0?!1:e.last_seen===0||Date.now()/1e3-e.last_seen>pp}function yp(){let t=y(),[n,r]=e.useState(``),[a,o]=e.useState(`active`),[s,c]=e.useState(1),[l,u]=e.useState(new Set),{data:d}=rt({queryKey:[up,n,a,s],queryFn:()=>(0,i.default)({path:`${lp}?wcpos=1&per_page=${dp}&page=${s}${n?`&printer_id=${encodeURIComponent(n)}`:``}${a?`&status=${encodeURIComponent(a)}`:``}`,method:`GET`}),refetchInterval:fp}),{addSnackbar:f}=jo(),p=()=>{u(new Set),t.invalidateQueries({queryKey:[up]})},m=()=>{f({message:$(`cloud_print.queue_action_failed`,`That didn't work — the queue is unchanged. Try again.`),status:`error`})},h=at({mutationFn:e=>(0,i.default)({path:`${lp}/cancel?wcpos=1`,method:`POST`,data:e}),onSuccess:p,onError:m}),g=at({mutationFn:e=>(0,i.default)({path:`wcpos/v1/print-jobs/${e}/reprint?wcpos=1`,method:`POST`}),onSuccess:p,onError:(e,n)=>{let r=e,i=r.data?.retried_to;if(r.code!==`wcpos_print_job_already_retried`||!i){m();return}u(new Set),t.setQueriesData({queryKey:[up]},e=>{if(!e)return e;let t=e.jobs.some(e=>e.id===n&&!e.retried_to);return{...e,jobs:e.jobs.map(e=>e.id===n?{...e,retried_to:i}:e),summary:{...e.summary,counts:{...e.summary.counts,failed_unresolved:Math.max(0,(e.summary.counts.failed_unresolved??e.summary.counts.failed??0)-+!!t)}}}}),t.invalidateQueries({queryKey:[up]}),f({message:$(`cloud_print.queue_retried_as`,`Retried as #{id}`,{id:String(i)}),status:`success`})}}),v=d?.total;if(e.useEffect(()=>{if(typeof v!=`number`)return;let e=Math.max(1,Math.ceil(v/dp));s>e&&c(e)},[v,s]),!d||!Array.isArray(d.jobs)||!d.summary)return null;let{jobs:b,total:x,summary:S}=d,C=new Map(S.printers.map(e=>[e.printer_id,e.name])),w=S.printers.filter(vp),T=S.counts,E=Object.values(T).some(e=>e>0)||x>0,D=b.map(e=>e.id),O=D.length>0&&D.every(e=>l.has(e)),k=()=>{u(O?new Set:new Set(D))},A=e=>{let t=new Set(l);t.has(e)?t.delete(e):t.add(e),u(t)},j=b.filter(e=>l.has(e.id)&&(e.status===`pending`||e.status===`claimed`)).map(e=>e.id),M=Math.max(1,Math.ceil(x/dp)),N=(T.pending??0)+(T.claimed??0)+(T.failed_unresolved??T.failed??0),P=[{label:$(`cloud_print.queue_status_active`,`Needs attention ({count})`,{count:String(N)}),value:`active`},{label:$(`cloud_print.queue_all_statuses`,`All statuses`),value:``},...[`pending`,`claimed`,`failed`,`printed`,`cancelled`].map(e=>({label:`${mp[e].label()} (${T[e]??0})`,value:e}))],F=[{label:$(`cloud_print.queue_all_printers`,`All printers`),value:``},...S.printers.map(e=>({label:e.name,value:e.printer_id}))];return(0,_.jsxs)(ho,{title:$(`cloud_print.queue_title`,`Print queue`),description:$(`cloud_print.queue_description`,`Jobs waiting to be fetched by your printers.`),children:[w.map(e=>(0,_.jsx)(uo,{status:`warning`,isDismissible:!1,children:(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:flex-wrap`,"data-testid":`queue-stale-${e.printer_id}`,children:[(0,_.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:gp(new Date(e.last_seen*1e3)),count:String(e.pending)})}),(0,_.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)),E?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2 wcpos:flex-wrap`,children:[(0,_.jsx)(Ha,{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:F,value:n,onChange:e=>{r(String(e.value)),c(1),u(new Set)}}),(0,_.jsx)(Ha,{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:P,value:a,onChange:e=>{o(String(e.value)),c(1),u(new Set)}}),(0,_.jsx)(`div`,{className:`wcpos:flex-1`}),j.length>0&&(0,_.jsx)(W,{variant:`ghost-destructive`,"data-testid":`queue-cancel-selected`,onClick:()=>h.mutate({ids:j}),disabled:h.isPending,children:$(`cloud_print.queue_cancel_selected`,`Cancel selected ({count})`,{count:String(j.length)})})]}),b.length===0?(0,_.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,_.jsx)(`div`,{className:`wcpos:overflow-x-auto`,children:(0,_.jsxs)(Mo,{"data-testid":`queue-table`,className:`wcpos:min-w-[36rem]`,children:[(0,_.jsx)(No,{children:(0,_.jsxs)(Fo,{children:[(0,_.jsx)(Y,{className:`wcpos:w-8`,children:(0,_.jsx)(`input`,{type:`checkbox`,checked:O,onChange:k,"aria-label":$(`cloud_print.queue_select_all`,`Select all on this page`),"data-testid":`queue-select-all`})}),(0,_.jsx)(Y,{className:`wcpos:w-28`,children:$(`cloud_print.queue_col_order`,`Order`)}),(0,_.jsx)(Y,{children:$(`cloud_print.queue_col_printer`,`Printer`)}),(0,_.jsx)(Y,{className:`wcpos:w-28`,children:$(`cloud_print.queue_col_status`,`Status`)}),(0,_.jsx)(Y,{className:`wcpos:w-32`,children:$(`cloud_print.queue_col_waiting`,`Waiting`)}),(0,_.jsx)(Y,{className:`wcpos:w-24`})]})}),(0,_.jsx)(Po,{children:b.map(e=>{let t=mp[e.status]??mp.pending,n=e.status===`pending`||e.status===`claimed`?_p(e.created_gmt):`—`;return(0,_.jsxs)(Io,{"data-testid":`queue-row-${e.id}`,children:[(0,_.jsx)(X,{children:(0,_.jsx)(`input`,{type:`checkbox`,checked:l.has(e.id),onChange:()=>A(e.id),"aria-label":$(`cloud_print.queue_select_job`,`Select job {id}`,{id:String(e.id)})})}),(0,_.jsx)(X,{children:e.order_edit_url?(0,_.jsxs)(`a`,{href:e.order_edit_url,target:`_blank`,rel:`noopener noreferrer`,children:[`#`,e.order_number??e.order_id]}):(0,_.jsx)(`span`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.queue_no_order`,`Job {id}`,{id:String(e.id)})})}),(0,_.jsx)(X,{children:C.get(e.printer_id)??e.printer_id}),(0,_.jsx)(X,{children:(0,_.jsx)(J,{variant:t.variant,shape:`pill`,size:`sm`,children:t.label()})}),(0,_.jsx)(X,{className:`wcpos:tabular-nums wcpos:text-gray-600`,children:n}),(0,_.jsxs)(X,{className:`wcpos:text-right`,children:[(e.status===`pending`||e.status===`claimed`)&&(0,_.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`&&e.retried_to?$(`cloud_print.queue_retried_as`,`Retried as #{id}`,{id:String(e.retried_to)}):e.status===`failed`?(0,_.jsx)(W,{variant:`text`,onClick:()=>g.mutate(e.id),disabled:g.isPending,"data-testid":`queue-retry-${e.id}`,children:$(`cloud_print.queue_retry`,`Retry`)}):null]})]},e.id)})})]})}),M>1&&(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-end wcpos:gap-3 wcpos:text-sm wcpos:text-gray-600`,children:[(0,_.jsx)(`span`,{"data-testid":`queue-page-info`,children:$(`cloud_print.queue_page_info`,`{from}–{to} of {total}`,{from:String((s-1)*dp+1),to:String(Math.min(s*dp,x)),total:String(x)})}),(0,_.jsx)(W,{variant:`outline`,onClick:()=>c(e=>Math.max(1,e-1)),disabled:s<=1,"aria-label":$(`common.previous`,`Previous`),children:`‹`}),(0,_.jsx)(W,{variant:`outline`,onClick:()=>c(e=>Math.min(M,e+1)),disabled:s>=M,"aria-label":$(`common.next`,`Next`),children:`›`})]})]}):(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,"data-testid":`queue-empty`,children:$(`cloud_print.queue_empty`,`No print jobs yet.`)})]})}var bp=`wcpos/v1/settings/cloud-print?wcpos=1`,xp=3e4;function Sp(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 Cp(){return await(0,i.default)({path:bp,method:`GET`})}var wp=new Set,Tp,Ep=!1;async function Dp(){if(!Ep){Ep=!0;try{let e=await Cp();wp.forEach(t=>t(e))}catch{}finally{Ep=!1}}}function Op(e){return wp.add(e),Tp===void 0&&(Tp=window.setInterval(()=>{Dp()},xp)),()=>{wp.delete(e),wp.size===0&&Tp!==void 0&&(window.clearInterval(Tp),Tp=void 0)}}function kp(t){let[n,r]=e.useState({status:t.status,statusDetail:t.status_detail}),[i,a]=e.useState({status:t.status,statusDetail:t.status_detail});if(t.status!==i.status||t.status_detail!==i.statusDetail){let e={status:t.status,statusDetail:t.status_detail};a(e),r(e)}return e.useEffect(()=>Op(e=>{let n=e.printers.find(e=>e.id===t.id);r({status:n?.status,statusDetail:n?.status_detail})}),[t.id]),n}function Ap({printer:e}){let t=Vf[e.provider],{status:n}=kp(e),r=Sp(n,t.isPolling);return(0,_.jsx)(J,{variant:r.variant,shape:`pill`,size:`sm`,"data-testid":`printer-card-status-${e.id}`,children:r.label})}function jp({label:e,testId:t}){return(0,_.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,_.jsx)(Mf,{className:`wcpos:w-4 wcpos:h-4 wcpos:fill-current`})})}function Mp({open:e,title:t,description:n,confirmLabel:r,cancelLabel:i,isSubmitting:a=!1,onConfirm:o,onClose:s}){return(0,_.jsx)(eo,{open:e,onClose:s,title:t,description:n,children:(0,_.jsxs)(`div`,{className:`wcpos:mt-4 wcpos:flex wcpos:justify-end wcpos:gap-2`,children:[(0,_.jsx)(W,{variant:`secondary`,onClick:()=>{s(!1)},disabled:a,children:i||$(`sessions.cancel`)}),(0,_.jsx)(W,{variant:`destructive`,onClick:o,disabled:a,children:r||$(`sessions.confirm`)})]})})}function Np(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 Pp(){return[{value:`pdf`,label:$(`cloud_print.format_pdf`,`PDF (recommended)`)},{value:`raw`,label:$(`cloud_print.format_raw`,`ESC/POS RAW — thermal templates only`)}]}var Fp=[[`year`,31536e3],[`month`,2592e3],[`day`,86400],[`hour`,3600],[`minute`,60],[`second`,1]];function Ip(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 Fp)if(a>=t||e===`second`){let r=Math.round(n/t);return i.format(r,e)}return i.format(0,`second`)}function Lp(e){if(!e)return``;try{let t=new URL(e).pathname.match(/\/cloudprnt\/([^/]+)/);return t?decodeURIComponent(t[1]):``}catch{return``}}function Rp({printer:t,onRename:n,onRemove:r,onOpenSetup:a,onUpdate:o}){let{addSnackbar:s}=jo(),c=Vf[t.provider],{status:l,statusDetail:u}=kp(t),d=t.provider===`printnode`,f=t.provider===`star-online`,p=t.printnode_format??`pdf`,[m,h]=e.useState(t.name),[g,v]=e.useState(!1),[y,b]=e.useState(!1),x=e.useRef(t.name),[S,C]=e.useState(t.name);t.name!==S&&(C(t.name),h(t.name)),e.useEffect(()=>{x.current=t.name},[t.name]);let w=e.useCallback(()=>{let e=m.trim();if(!e){h(t.name);return}e!==t.name&&e!==x.current&&(x.current=e,n(t.id,e))},[m,n,t.id,t.name]),T=e.useCallback(async()=>{v(!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{v(!1)}},[s,t.id,t.name]),E=t.last_seen==null?$(`cloud_print.never`,`never`):Ip(t.last_seen,Pl.language||void 0);return(0,_.jsxs)(ao,{"data-testid":`printer-card-${t.id}`,children:[(0,_.jsxs)(ao.Body,{className:`wcpos:relative`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:gap-3`,children:[(0,_.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,_.jsxs)(`div`,{className:`wcpos:min-w-0 wcpos:flex-1`,children:[(0,_.jsx)(`input`,{type:`text`,"data-testid":`printer-card-name-${t.id}`,value:m,onChange:e=>h(e.target.value),onBlur:w,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.target.blur(),w())},"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,_.jsx)(`div`,{className:`wcpos:px-1 wcpos:text-xs wcpos:text-gray-500`,children:c.label})]}),(0,_.jsxs)(ro,{align:`end`,label:$(`cloud_print.printer_menu`,`Printer actions`),className:`wcpos:absolute wcpos:top-2 wcpos:right-2`,trigger:(0,_.jsx)(jp,{label:$(`cloud_print.printer_menu`,`Printer actions`),testId:`printer-card-menu-${t.id}`}),children:[(0,_.jsx)(io,{onSelect:()=>a(t),children:$(`cloud_print.menu_setup`,`Setup & token`)}),(0,_.jsx)(io,{destructive:!0,onSelect:()=>b(!0),children:$(`cloud_print.menu_remove`,`Remove printer`)})]})]}),(0,_.jsx)(`div`,{className:`wcpos:mt-2`,children:(0,_.jsx)(Ap,{printer:t})}),l===`blocked`&&(0,_.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:Np(u)}),(0,_.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,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.last_check_in`,`Last check-in`)}),(0,_.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-last-seen-${t.id}`,children:E}),(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.printer_id`,`Printer ID`)}),(0,_.jsxs)(`dd`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1 wcpos:text-gray-900`,children:[(0,_.jsx)(`code`,{className:`wcpos:rounded wcpos:bg-gray-100 wcpos:px-1 wcpos:py-0.5`,children:t.id}),(0,_.jsx)(to,{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,_.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,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.star_device`,`Device`)}),(0,_.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-device-${t.id}`,children:t.star_client_type||Vf[`star-online`].label}),(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.star_group`,`Group`)}),(0,_.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-group-${t.id}`,children:Lp(t.star_cloudprnt_url)||`—`}),(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.star_device_id`,`AccessIdentifier`)}),(0,_.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-device-id-${t.id}`,children:(0,_.jsx)(`code`,{className:`wcpos:rounded wcpos:bg-gray-100 wcpos:px-1 wcpos:py-0.5`,children:t.star_device_id})})]}),d&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.format`,`Print format`)}),(0,_.jsx)(`dd`,{className:`wcpos:text-gray-900`,children:(0,_.jsx)(Ha,{"data-testid":`printer-card-format-${t.id}`,"aria-label":$(`cloud_print.format`,`Print format`),className:`wcpos:w-auto`,value:p,options:Pp(),onChange:({value:e})=>o(t.id,{printnode_format:e})})})]})]})]}),(0,_.jsx)(ao.Footer,{className:`wcpos:flex wcpos:justify-end`,children:(0,_.jsx)(W,{variant:`outline`,loading:g,disabled:g,onClick:T,"data-testid":`printer-card-test-${t.id}`,children:$(`cloud_print.test_print`,`Test print`)})}),(0,_.jsx)(Mp,{open:y,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:()=>{b(!1),r(t)},onClose:()=>b(!1)})]})}function zp({children:e,className:t=``,...n}){return(0,_.jsx)(`div`,{className:`wcpos:grid wcpos:grid-cols-[repeat(auto-fill,minmax(min(100%,340px),1fr))] wcpos:gap-4 ${t}`,...n,children:e})}var Bp=`wcpos/v1/settings/cloud-print?wcpos=1`;function Vp(){let e=y(),{data:t}=it({queryKey:[`cloud-print`],queryFn:()=>(0,i.default)({path:Bp,method:`GET`})});return{settings:t,save:at({mutationFn:e=>(0,i.default)({path:Bp,method:`POST`,data:e}),onSuccess:t=>e.setQueryData([`cloud-print`],e=>({printers:t.printers,assignments:t.assignments,relay:t.relay??e?.relay}))}).mutateAsync}}var Hp=`wcpos/v1/print-jobs/relay/register?wcpos=1`;function Up(){let e=y();return{register:at({mutationFn:()=>(0,i.default)({path:Hp,method:`POST`}),onSuccess:t=>e.setQueryData([`cloud-print`],e=>e&&{...e,relay:t})})}}var Wp=`wcpos/v1/templates?wcpos=1&type=receipt`;function Gp(e=!1){let{data:t}=it({queryKey:[`templates`,`receipt`],queryFn:()=>(0,i.default)({path:Wp,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 Kp(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 qp=`cloud-print-save`;function Jp(){let{settings:t,save:n}=Vp(),{register:r}=Up(),i=Gp(),a=window.wcpos?.settings?.cloudPrintStoreOptions,o=Array.isArray(a)?a:[],{addSnackbar:s}=jo(),[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),v=e.useCallback(e=>{f.current=e,l(e)},[]);e.useEffect(()=>{m.current===0&&(p.current=t,v(t))},[v,t]);let y=e.useCallback(async e=>{let t=g.current+1;g.current=t,m.current+=1,v(e),s({id:qp,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&&v(n),s({id:qp,message:$(`cloud_print.saved`,`Saved`),status:`success`}),e}catch(e){let n=Kp(e);throw t===g.current&&v(p.current),s({id:qp,message:n,status:`error`}),e}finally{--m.current}},[s,v,n]),b=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 y({...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]}},[y]),x=e.useCallback((e,t)=>{let n=f.current;y({...n,printers:n.printers.map(n=>n.id===e?{...n,name:t}:n)}).catch(()=>void 0)},[y]),S=e.useCallback((e,t)=>{let n=f.current;y({...n,printers:n.printers.map(n=>n.id===e?{...n,...t}:n)}).catch(()=>void 0)},[y]),C=e.useCallback(e=>{let t=f.current;y({...t,printers:t.printers.filter(t=>t.id!==e.id),assignments:t.assignments.filter(t=>t.printer_id!==e.id)}).catch(()=>void 0)},[y]),w=e.useCallback(e=>{let t=f.current;y({...t,assignments:e}).catch(()=>void 0)},[y]),T=t.relay,E=e.useRef(!1);return e.useEffect(()=>{!T||T.enabled||T.available===!1||E.current||(E.current=!0,r.mutate(void 0,{onError:()=>void 0}))},[T,r]),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-6 wcpos:px-4 wcpos:pb-5`,children:[(0,_.jsxs)(mo,{status:`info`,title:$(`cloud_print.intro_title`,`What is cloud printing?`),children:[(0,_.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,_.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,_.jsxs)(`ul`,{className:`wcpos:mt-1 wcpos:list-disc wcpos:pl-5`,children:[(0,_.jsx)(`li`,{children:$(`cloud_print.intro_li1`,`send every order straight to the kitchen printer, or`)}),(0,_.jsx)(`li`,{children:$(`cloud_print.intro_li2`,`print a packing slip for every online sale.`)})]}),(0,_.jsxs)(`p`,{className:`wcpos:mt-2`,children:[$(`cloud_print.intro_p3`,`Cashiers can also print to a cloud printer manually from the POS.`),` `,(0,_.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,_.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,_.jsx)($l,{fill:`currentColor`})}),$(`cloud_print.learn_more`,`Learn more`),(0,_.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})]})]}),(0,_.jsxs)(ho,{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,_.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,_.jsx)(zp,{"data-testid":`cloud-print-list`,children:c.printers.map(e=>(0,_.jsx)(Rp,{printer:e,onRename:x,onRemove:C,onUpdate:S,onOpenSetup:e=>d({open:!0,mode:`setup`,printer:e})},e.id))}),(0,_.jsx)(`div`,{className:`wcpos:mt-4`,children:(0,_.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,_.jsx)(ho,{title:$(`cloud_print.auto_print`,`Auto-print rules`),children:(0,_.jsx)(op,{printers:c.printers,assignments:c.assignments,templateOptions:i,storeOptions:o,onChange:w})}),(0,_.jsx)(yp,{}),(0,_.jsx)($f,{open:u.open,mode:u.mode,setupPrinter:u.printer,onClose:()=>d(e=>({...e,open:!1})),onCreate:b,fetchPrintNodePrinters:sp,fetchStarDevices:cp,relay:T})]})}function Yp(){return(0,_.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,_.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 Xp(e){try{let t=new URL(e).hostname.toLowerCase();return t===`github.com`||t===`www.github.com`}catch{return!1}}function Zp(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 Qp({extension:e}){let{homepage:t,installed_version:n,latest_version:r,status:i}=e;if((i===`update_available`||e.has_update)&&n){let e=Zp(t,n),i=Zp(t,r);return(0,_.jsxs)(`span`,{className:`wcpos:text-xs wcpos:text-gray-400`,children:[e?(0,_.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`hover:wcpos:text-gray-600 wcpos:transition-colors`,children:[`v`,n]}):(0,_.jsxs)(_.Fragment,{children:[`v`,n]}),` → `,i?(0,_.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,_.jsxs)(`span`,{className:`wcpos:text-yellow-700`,children:[`v`,r]})]})}let a=n||r,o=Zp(t,a);return(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-400`,children:o?(0,_.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`hover:wcpos:text-gray-600 wcpos:transition-colors`,children:[`v`,a]}):(0,_.jsxs)(_.Fragment,{children:[`v`,a]})})}function $p({status:e}){switch(e){case`active`:return(0,_.jsx)(J,{variant:`success`,icon:(0,_.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,_.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,_.jsx)(J,{variant:`warning`,children:$(`extensions.update_available`,`Update available`)});case`inactive`:return(0,_.jsx)(J,{variant:`neutral`,children:$(`extensions.inactive`,`Inactive`)});default:return null}}function em({extension:e}){return e.status===`not_installed`?(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-end`,children:(0,_.jsx)(to,{text:$(`extensions.requires_pro`,`Requires Pro to install`),children:(0,_.jsx)(`span`,{children:(0,_.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 tm(){return window.wcpos?.settings?.getComponent?.(`extensions.action`)??null}function nm(e){let t=tm();return t?(0,_.jsx)(t,{extension:e}):e.status===`not_installed`?(0,_.jsx)(em,{extension:e}):null}function rm({extension:e}){let t=(e.category||``).trim(),n=t?t.charAt(0).toUpperCase()+t.slice(1):null,r=nm(e),i=!!e.settings_url&&e.status!==`not_installed`,a=!!e.homepage&&Xp(e.homepage),o=i||a;return(0,_.jsxs)(ao,{children:[(0,_.jsxs)(ao.Body,{className:`wcpos:relative wcpos:flex wcpos:gap-4`,children:[o&&(0,_.jsxs)(ro,{label:e.name,className:`wcpos:absolute wcpos:top-2 wcpos:right-2`,trigger:(0,_.jsx)(jp,{label:$(`extensions.more_actions`,`More actions`)}),children:[i&&(0,_.jsx)(io,{href:e.settings_url,children:$(`extensions.settings`,`Settings`)}),a&&(0,_.jsx)(io,{href:e.homepage,target:`_blank`,rel:`noopener noreferrer`,children:$(`extensions.view_on_github`,`View on GitHub`)})]}),(0,_.jsx)(`div`,{className:`wcpos:shrink-0 wcpos:flex wcpos:items-start`,children:e.icon?(0,_.jsx)(`img`,{src:e.icon,alt:e.name,className:`wcpos:w-12 wcpos:h-12 wcpos:rounded`}):(0,_.jsx)(Yp,{})}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[(0,_.jsx)(`h3`,{className:(0,U.default)(`wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900`,o&&`wcpos:pr-8`),children:e.name}),(0,_.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,_.jsx)($p,{status:e.status}),(0,_.jsx)(Qp,{extension:e}),n&&(0,_.jsxs)(`span`,{className:`wcpos:inline-flex wcpos:items-center wcpos:gap-1.5 wcpos:whitespace-nowrap`,children:[(0,_.jsx)(`span`,{className:`wcpos:w-0.5 wcpos:h-0.5 wcpos:rounded-full wcpos:bg-gray-300`}),(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:n})]})]}),(0,_.jsx)(`p`,{className:`wcpos:mt-2 wcpos:text-sm wcpos:text-gray-500`,children:e.description})]})]}),r!=null&&(0,_.jsx)(ao.Footer,{children:r})]})}function im(){let[t,n]=e.useState(``),[r,a]=e.useState(`all`),[o,s]=e.useState(!1),[c,l]=e.useState(!1),u=y(),{data:d=[]}=it({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;fu(e)},[d]),e.useEffect(()=>{f||Gl(`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,_.jsxs)(`div`,{children:[c&&(0,_.jsx)(Ll,{status:`error`,isDismissible:!1,className:`wcpos:mb-4`,children:$(`extensions.refresh_failed`,`Could not refresh extensions. Please try again.`)}),!f&&(0,_.jsxs)(Ll,{status:`info`,isDismissible:!1,className:`wcpos:mb-4`,children:[$(`extensions.upgrade_to_pro`,`Upgrade to Pro to install and manage extensions.`),` `,(0,_.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>Kl(`extensions_screen`,`https://wcpos.com/pro`),children:$(`common.upgrade_to_pro`)}),`.`]}),(0,_.jsxs)(`div`,{className:`wcpos:mb-4 wcpos:flex wcpos:items-center wcpos:gap-3`,children:[(0,_.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,_.jsx)(W,{variant:`secondary`,loading:o,onClick:p,children:o?$(`extensions.refreshing`,`Refreshing...`):$(`extensions.refresh`,`Refresh`)})]}),(0,_.jsx)(go,{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,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:$(`extensions.no_results`,`No extensions found.`)}):(0,_.jsx)(zp,{children:h.map(e=>(0,_.jsx)(rm,{extension:e},e.slug))})]})}var{i18n:am,i18nPromise:om,t:sm,Trans:cm}=Nl({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 lm(e,t,n){let r=e?.[t];return typeof r==`string`&&r!==``?r:sm(n)}function um({open:e,onClose:t,copy:n}){return(0,_.jsxs)(eo,{open:e,onClose:t,title:lm(n,`title`,`consent.modal_title`),children:[(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700 wcpos:mb-3`,children:lm(n,`body`,`consent.modal_intro`)}),(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700 wcpos:mb-2`,children:lm(n,`fields_intro`,`consent.modal_includes`)}),(0,_.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,_.jsxs)(`li`,{children:[(0,_.jsx)(`strong`,{children:sm(`consent.modal_setup_label`)}),` — `,sm(`consent.modal_setup_desc`)]}),(0,_.jsxs)(`li`,{children:[(0,_.jsx)(`strong`,{children:sm(`consent.modal_store_label`)}),` — `,sm(`consent.modal_store_desc`)]}),(0,_.jsxs)(`li`,{children:[(0,_.jsx)(`strong`,{children:sm(`consent.modal_usage_label`)}),` — `,sm(`consent.modal_usage_desc`)]})]}),(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-4`,children:lm(n,`privacy_note`,`consent.modal_exclusions`)}),(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:justify-end`,children:(0,_.jsx)(W,{onClick:t,children:sm(`consent.dismiss`)})})]})}function dm({selected:t,onSelect:n}){let r=e.useMemo(()=>(window?.wcpos?.settings?.barcodes??[]).map(e=>({value:e,label:e})),[]);return(0,_.jsx)(Bu,{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 fm=`https://wcpos.com/pro`,pm=`general_store_details`,mm=`https://docs.wcpos.com/settings/wp-admin/store-tax-ids`;function hm({data:t,mutate:n,storeDefaults:i}){return e.useEffect(()=>{Gl(pm)},[]),(0,_.jsxs)(ho,{title:$(`settings.store_details_section_title`),description:$(`settings.store_details_section_description`),divider:!0,children:[(0,_.jsxs)(mo,{status:`info`,title:$(`settings.store_details_upgrade_callout_title`),className:`wcpos:mt-4`,children:[(0,_.jsx)(`p`,{className:`wcpos:m-0`,children:$(`settings.store_details_upgrade_to_pro`)}),(0,_.jsx)(`p`,{className:`wcpos:mt-2 wcpos:mb-0`,children:(0,_.jsx)(`a`,{href:fm,target:`_blank`,rel:`noreferrer noopener`,onClick:()=>Kl(pm,fm),children:$(`common.upgrade_to_pro`)})})]}),(0,_.jsx)(q,{label:$(`settings.store_name`),children:(0,_.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,_.jsx)(q,{label:$(`settings.store_phone`),children:(0,_.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,_.jsx)(q,{label:$(`settings.store_email`),children:(0,_.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,_.jsx)(q,{label:$(`settings.refund_returns_policy`),description:$(`settings.refund_returns_policy_tip`),children:(0,_.jsx)(Va,{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,_.jsxs)(`div`,{className:`wcpos:mt-4`,children:[(0,_.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,_.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-3`,children:[$(`settings.store_tax_ids_section_description`),` `,(0,_.jsx)(`a`,{href:mm,target:`_blank`,rel:`noreferrer noopener`,className:`wcpos:text-wp-admin-theme-color wcpos:underline`,children:$(`settings.store_tax_ids_learn_more`)})]}),(0,_.jsx)(Xo,{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 gm({value:t,onChange:n}){let r=Gp(!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,_.jsx)(Ha,{value:t,options:a,onChange:({value:e})=>n(String(e)),"aria-label":$(`settings.storefront_receipt_template`)})}function _m({enabled:t,template:n,onChange:r}){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(q,{children:(0,_.jsx)(Ff,{tip:$(`settings.storefront_receipt_enabled_tip`),children:(0,_.jsx)(za,{checked:t,onChange:e=>r({storefront_receipt_enabled:e}),label:$(`settings.storefront_receipt_enabled`)})})}),t&&(0,_.jsx)(q,{label:$(`settings.storefront_receipt_template`),children:(0,_.jsx)(Ff,{tip:$(`settings.storefront_receipt_template_tip`),children:(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,_.jsx)(gm,{value:n,onChange:e=>r({storefront_receipt_template:e})})})})})]})}var vm={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`},ym={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`},bm=`https://docs.wcpos.com/settings/wp-admin/customer-tax-ids`;function xm(e,t,n,r){return t&&t!==``?`override`:n&&n!==r?`plugin`:`default`}function Sm(e,t,n){return e&&e!==``?e:t||n}function Cm({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,_.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 wm(){return(0,_.jsx)(`a`,{href:bm,target:`_blank`,rel:`noreferrer noopener`,className:`wcpos:text-wp-admin-theme-color wcpos:underline`,children:$(`tax_ids.learn_more`)})}function Tm({plugins:e,overrideCount:t}){let n=e.length>0,r=e.map(e=>ym[e]??e);return(0,_.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,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:gap-2`,children:[(0,_.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,_.jsx)(`div`,{className:`wcpos:flex-1 wcpos:text-sm`,children:n?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`wcpos:font-medium`,children:[r.join(`, `),` `,(0,_.jsx)(`span`,{className:`wcpos:font-normal`,children:$(`tax_ids.banner_is_installed`)})]}),(0,_.jsxs)(`div`,{className:`wcpos:text-xs wcpos:text-gray-600 wcpos:mt-1`,children:[$(`tax_ids.banner_detected_explainer`),t>0&&(0,_.jsxs)(_.Fragment,{children:[` `,$(`tax_ids.banner_overrides_active`,{count:t})]})]})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`wcpos:font-medium`,children:$(`tax_ids.banner_no_plugin_title`)}),(0,_.jsx)(`div`,{className:`wcpos:text-xs wcpos:text-gray-600 wcpos:mt-1`,children:$(`tax_ids.banner_no_plugin_explainer`)})]})})]})})}function Em({type:e,composed:t,defaultKey:n,override:r,suggestions:i,onCommit:a}){let o=Sm(r,t,n),s=xm(e,r,t,n);return(0,_.jsxs)(Io,{className:(0,U.default)(s===`override`&&`wcpos:bg-amber-50/40`),children:[(0,_.jsx)(X,{className:`wcpos:font-medium wcpos:text-gray-900`,children:vm[e]??e}),(0,_.jsx)(X,{className:`wcpos:font-mono wcpos:text-xs wcpos:text-gray-600`,children:o}),(0,_.jsx)(X,{children:(0,_.jsx)(Cm,{source:s})}),(0,_.jsx)(X,{children:(0,_.jsx)(Bu,{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":`${vm[e]??e} ${$(`tax_ids.col_override`)}`})})]})}function Dm(){let{data:t,mutate:n}=Vu(`tax_ids`),r=t?.write_map??{},{data:a}=it({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,_.jsxs)(`div`,{className:`wcpos:mt-4`,children:[(0,_.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,_.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-3`,children:[$(`tax_ids.section_intro`),` `,(0,_.jsx)(wm,{})]}),(0,_.jsx)(Tm,{plugins:a.plugins,overrideCount:o}),(0,_.jsxs)(`details`,{className:`wcpos:border wcpos:border-gray-200 wcpos:rounded`,children:[(0,_.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,_.jsxs)(`span`,{children:[(0,_.jsx)(`strong`,{children:$(`tax_ids.advanced_title`)}),` `,(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`tax_ids.advanced_subtitle`)})]}),o>0&&(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`tax_ids.advanced_override_count`,{count:o})})]}),(0,_.jsxs)(`div`,{className:`wcpos:border-t wcpos:border-gray-200 wcpos:px-3 wcpos:py-3`,children:[(0,_.jsx)(`p`,{className:`wcpos:text-xs wcpos:text-gray-500 wcpos:mb-3`,children:$(`tax_ids.advanced_intro`)}),(0,_.jsxs)(Mo,{children:[(0,_.jsx)(No,{children:(0,_.jsxs)(Fo,{children:[(0,_.jsx)(Y,{children:$(`tax_ids.col_type`)}),(0,_.jsx)(Y,{children:$(`tax_ids.col_field`)}),(0,_.jsx)(Y,{children:$(`tax_ids.col_source`)}),(0,_.jsx)(Y,{children:$(`tax_ids.col_override`)})]})}),(0,_.jsx)(Po,{children:a.types.map(e=>(0,_.jsx)(Em,{type:e,composed:a.composed_write_map[e]??``,defaultKey:a.default_write_map[e]??``,override:r[e],suggestions:c,onCommit:s},e))})]}),(0,_.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,_.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,_.jsx)(Cm,{source:`plugin`}),` `,$(`tax_ids.legend_plugin`)]}),(0,_.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,_.jsx)(Cm,{source:`default`}),` `,$(`tax_ids.legend_built_in`)]}),(0,_.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,_.jsx)(Cm,{source:`override`}),` `,$(`tax_ids.legend_custom`)]})]})]})]})]})}function Om({disabled:t=!1,selected:n,onSelect:r}){let a=e.useMemo(()=>({id:0,name:$(`common.guest`)}),[]),{setNotice:o}=Vl(),[s,c]=e.useState(``),{data:l,isFetching:u}=rt({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,_.jsx)(Bu,{value:String(n||0),options:d,onChange:e=>r(e?Number(e):0),onQuery:c,loading:u,disabled:t})}function km(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 Am(){return window?.wcpos?.settings?.getComponent?.(`general.store_details_block`)||null}function jm(){let{data:t,mutate:n}=Vu(`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=e.useMemo(()=>Am()??hm,[]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c,{data:t,mutate:n,storeDefaults:s}),(0,_.jsxs)(ho,{title:$(`settings.products_section_title`),divider:!0,children:[(0,_.jsx)(q,{children:(0,_.jsx)(Ff,{tip:$(`settings.pos_only_products_tip`),children:(0,_.jsx)(za,{checked:!!t?.pos_only_products,onChange:e=>{n({pos_only_products:e})},label:$(`settings.pos_only_products`)})})}),(0,_.jsx)(q,{children:(0,_.jsx)(Ff,{tip:$(`settings.decimal_quantities_tip`),children:(0,_.jsx)(za,{checked:!!t?.decimal_qty,onChange:e=>{n({decimal_qty:e})},label:$(`settings.decimal_quantities`)})})}),(0,_.jsx)(q,{children:(0,_.jsx)(Ff,{tip:$(`settings.restore_stock_on_delete_tip`),children:(0,_.jsx)(za,{checked:!!t?.restore_stock_on_delete,onChange:e=>{n({restore_stock_on_delete:e})},label:$(`settings.restore_stock_on_delete`)})})}),(0,_.jsx)(q,{label:$(`settings.barcode_field`),children:(0,_.jsx)(Ff,{tip:$(`settings.barcode_field_tip`),children:(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,_.jsx)(dm,{selected:(0,r.isString)(t?.barcode_field)&&t?.barcode_field||``,onSelect:e=>{n({barcode_field:e||`_global_unique_id`})}})})})})]}),(0,_.jsxs)(ho,{title:$(`settings.customers_section_title`),divider:!0,children:[(0,_.jsx)(q,{children:(0,_.jsx)(za,{checked:!!t?.generate_username,onChange:e=>{n({generate_username:e})},label:$(`settings.generate_username`)})}),(0,_.jsxs)(q,{label:$(`settings.default_customer`),children:[(0,_.jsx)(Ff,{tip:$(`settings.default_customer_tip`),children:(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,_.jsx)(Om,{disabled:!!t?.default_customer_is_cashier,selected:(0,r.isNumber)(t?.default_customer)&&t?.default_customer||0,onSelect:e=>{n({default_customer:e})}})})}),(0,_.jsx)(`div`,{className:`wcpos:mt-2`,children:(0,_.jsx)(Ba,{label:$(`settings.use_cashier_account`),checked:!!t?.default_customer_is_cashier,onChange:e=>{n({default_customer_is_cashier:e.target.checked})}})})]}),(0,_.jsx)(_m,{enabled:!!t?.storefront_receipt_enabled,template:(0,r.isString)(t?.storefront_receipt_template)?t?.storefront_receipt_template:``,onChange:e=>{n(e)}}),(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(K,{className:`wcpos:h-32 wcpos:w-full wcpos:rounded-md wcpos:mt-4`}),children:(0,_.jsx)(Dm,{})})]}),(0,_.jsxs)(ho,{title:$(`settings.privacy_section_title`),divider:!0,children:[(0,_.jsx)(q,{children:(0,_.jsx)(Ff,{children:(0,_.jsx)(za,{checked:t?.tracking_consent===`allowed`,onChange:e=>{let t=e?`allowed`:`denied`;Wl(t),n({tracking_consent:t})},label:$(`settings.allow_anonymous_usage_data`)})})}),(0,_.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:[$(`settings.allow_anonymous_usage_data_tip`),` `,(0,_.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,_.jsx)(ho,{title:$(`settings.advanced_section_title`),divider:!0,children:(0,_.jsx)(q,{children:(0,_.jsx)(Ff,{tip:$(`settings.force_ssl_tip`),children:(0,_.jsx)(za,{checked:!o||km(t?.force_ssl),disabled:!o,onChange:e=>{n({force_ssl:e})},label:$(`settings.force_ssl`)})})})}),(0,_.jsx)(um,{open:i,onClose:()=>a(!1)})]})}var Mm=(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 Nm(){let{data:t,mutate:n}=Vu(`license`),{setNotice:i}=Vl(),[o,s]=e.useState(t?.key),c=e=>s(e.target.value),l=async(e=!1)=>{e||Jl();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||Zl(t),i({type:`error`,message:t.message}),null));if(d){if(!d.success)e||Zl(d),i({type:`error`,message:d.error});else{if(e)s(``);else{Yl((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||(Gl(`license_screen_card`),Gl(`license_screen_link`))},[t?.instance]),t?.instance?t.activated?(0,_.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,_.jsx)(`div`,{className:`wcpos:sm:text-right wcpos:text-8xl`,children:`🎉`}),(0,_.jsxs)(`div`,{className:`wcpos:col-span-2`,children:[(0,_.jsx)(`h3`,{children:$(`license.thank_you`)}),(0,_.jsx)(`p`,{children:(0,_.jsx)(Il,{i18nKey:`license.activated`,components:{code:(0,_.jsx)(`code`,{})},values:{number:Mm((0,r.isString)(t?.key)?t?.key:``)}})}),(0,_.jsx)(`p`,{children:$(`license.ongoing_support`)}),(0,_.jsx)(W,{variant:`primary`,onClick:()=>l(!0),children:$(`license.deactivate`)})]})]}):(0,_.jsxs)(`div`,{className:`wcpos:px-4 wcpos:py-5 wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4`,children:[(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:sm:justify-end`,children:(0,_.jsx)(Ff,{children:$(`license.license_key`)})}),(0,_.jsx)(`div`,{children:(0,_.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,_.jsx)(`div`,{children:(0,_.jsx)(W,{variant:`primary`,disabled:!o,onClick:()=>l(),children:$(`license.activate`)})})]}):(0,_.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,_.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>Kl(`license_screen_card`,`https://wcpos.com/pro`),children:(0,_.jsx)(`img`,{src:`https://wcpos.com/images/wcpos-pro.png`,alt:`WCPOS Pro`,width:80,height:80})}),(0,_.jsxs)(`div`,{className:`wcpos:text-center`,children:[(0,_.jsx)(`p`,{className:`wcpos:text-gray-600 wcpos:mb-3`,children:$(`license.support_development`)}),(0,_.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:()=>Kl(`license_screen_link`,`https://wcpos.com/pro`),children:[$(`common.upgrade_to_pro`),` →`]})]}),(0,_.jsxs)(Ll,{status:`info`,isDismissible:!1,className:`wcpos:w-full`,children:[$(`license.existing_license_prefix`),` `,(0,_.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 Pm(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 Fm(e,t={}){let n=[`[${Pm(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(` |