| 2 |
\r`.includes(e)?``:encodeURIComponent(e))),Bn(e)}function Hn(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=Kn(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[In];i=Un(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[In];i=Un(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,n?.ignoreBlocker??!1),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[In]!==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,_getBlockers:()=>e.getBlockers?.()??[]}}function Un(e,t){let n=qn();return{...t,key:n,__TSR_key:n,[In]:e}}function Wn(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=t=>Vn(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>Kn(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=qn();t.history.replaceState({[In]: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=(t,n,r)=>{let i=e?.createHref?s(n):void 0,a=!!g;a||(u=l),l=Kn(n,r),g=[i??l.href,r,g?.[2]||t],a||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(m=!1,f){f=!1;return}let e=c(),n=e.state[In]-l.state[In],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 r=a();if(typeof document<`u`&&r.length){for(let i of r)if(await i.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(-n),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=Hn({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,n)=>{d=!0,n&&(p=!0,m=!0),t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Rn,x,{capture:!0}),t.removeEventListener(Ln,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return S._ignoreNextBeforeUnload=e=>{m=!1;try{e=new URL(e,t.document.baseURI).href,m=/^https?:/.test(e)&&(!e.includes(`#`)||e.split(`#`)[0]!==t.location.href.split(`#`)[0])}catch{}},t.addEventListener(Rn,x,{capture:!0}),t.addEventListener(Ln,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 Gn(e){let t=e?.window??(typeof document<`u`?window:void 0);return Wn({window:t,parseLocation:()=>{let e=t.location.hash.split(`#`).slice(1),n=e[0]??`/`,r=t.location.search,i=e.slice(1);return Kn(`${n}${r}${i.length===0?``:`#${i.join(`#`)}`}`,t.history.state)},createHref:e=>`${t.location.pathname}${t.location.search}#${e}`})}function Kn(e,t){let n=Vn(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=qn();t={[In]:0,key:e,__TSR_key:e}}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}}function qn(){return(Math.random()+1).toString(36).substring(7)}function Jn(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function Yn(e){return e.pathname+e.search+e.hash}function Xn(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Zn(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Qn({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function $n(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function er(e,t,n,r,i,a){r&&(t=t.slice(0,r)),i&&(n=n.slice(0,i));for(let r of t){if(a&&e._tx!==a)return;n.some(e=>e.routeId===r.routeId)||e.routesById[r.routeId].options.onLeave?.(r)}for(let r of n){if(a&&e._tx!==a)return;e.routesById[r.routeId].options[t.some(e=>e.routeId===r.routeId)?`onStay`:`onEnter`]?.(r)}}var tr=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.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options;this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.staticLocations=new WeakMap,this.protocolAllowlist=new Set(this.options.protocolAllowlist),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Wn()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`;let n=this.options.basepath??`/`,r=this.options.rewrite,i=this.basepath!==n||t?.rewrite!==r||t?.caseSensitive!==this.options.caseSensitive;if(i&&(this.basepath=n,this.rewrite=n!==`/`&&At(n)?Mn(n,this.options.caseSensitive,r):r),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;e=this.buildRouteTree(),this.setRoutes(e)}if(this.stores)i&&this.stores.location.set(this.latestLocation);else if(this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Fn(this.latestLocation,e),Zt(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Sn(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&vn(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:un(1e3)}},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},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:Ct(e),external:!1,searchStr:o,search:ft(t?.search,i),hash:Ct(r.slice(1)),state:pt(t?.state,a)}}let o=Nn(this.rewrite,new URL(i,this.origin)),s=this.options.parseSearch(o.search),c=this.options.stringifySearch(s);return o.search=c,{href:o.href.replace(o.origin,``),publicHref:i,pathname:Ct(Bn(o.pathname)),external:!!this.rewrite&&Jn(o,this.origin),searchStr:c,search:ft(t?.search,s),hash:Ct(o.hash.slice(1)),state:pt(t?.state,a)}},r=n(e,e.state),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i,{...i.state,__tempLocation:void 0,key:r.state.key,__TSR_key:r.state.__TSR_key});return e.maskedLocation=r,e}return r},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=xn(kt(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{{let t=this.staticLocations.get(e);if(t)return t}let t=!1,n=(n={})=>{if(n.href){let e=Kn(n.href,{});n={...n,to:Nn(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=n._fromLocation||this._pendingLocation||this.latestLocation,i,a=()=>(t=!0,r),o=()=>(t=!0,i??=this.matchRoutesLightweight(r)),s=n.to?`${n.to}`:`.`,c=Mt(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[kt(c)],u=c.includes(`$`),d;if(l)d=l._branch??=Tn(l);else if(u)d=[];else{let[e,t,n]=this.getMatchedRoutes(c);d=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(d=[...d,this.options.notFoundRoute])}let f=u?l?._interpolation??hn(!1,{fullPath:c},0):void 0,p;for(let e of d){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){let e=o()[3];if(p??=or(n.params,e),!ut(p))break;p===e&&(p=Object.assign(dt(),p));try{Object.assign(p,t(p))}catch{}}}p??=or(n.params,sr(n.params,f)?o()[3]:cr);let m=e.leaveParams?c:Bn(Ct(f?It(c,f,p,this.pathParamsDecoder):c)),h=lr(d,e._includeValidateSearch),g=()=>{let t=o()[2];if(e._includeValidateSearch&&this.options.search?.strict){let e={};d.forEach(n=>{if(n.options.validateSearch)try{Object.assign(e,ar(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?ur(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||cr,v=this.options.stringifySearch(_),y=n.hash===!0?a().hash:typeof n.hash==`function`?n.hash(a().hash):n.hash||void 0,b=y?`#${y}`:``,x=n.state?n.state===!0?a().state:typeof n.state==`function`?n.state(a().state):n.state:cr,S=`${m}${v}${b}`,C,w,T=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=Pn(this.rewrite,e);C=Yn(e),Jn(n,t)?(w=n.href,T=!0):w=Bn(Yn(n))}else C=wt(S),w=C;return{publicHref:w,href:C,pathname:m,search:_,searchStr:v,state:x,hash:y??``,external:T,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=yn(r.pathname,this.processedTree);if(t){let i=Object.assign(dt(),t.rawParams),{from:a,params:o,...s}=t.route,c=or(o,i);r.maskedLocation=n({from:e.from,...s,params:c})}}return!t&&e._fromLocation&&!r.maskedLocation&&this.staticLocations.set(e,r),r},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=n.maskedLocation??n;if(r.external)return nr(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=kt(this.latestLocation.href)===kt(n.href)&&ht(Qn(n.state),Qn(this.latestLocation.state)),o=this._commitPromise,s,c=new Promise(e=>{s=e});if(c.resolve=()=>{s(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.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={...o.state,__hashScrollIntoViewOptions:a??this.options.defaultHashScrollIntoView??!0},this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:i}})}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=n?bt(n):void 0;if(a||t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i}),a=t.maskedLocation??t;n??=a.publicHref,r??=a.publicHref}let t=!a&&r?r:n;return nr(this,t,i)}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(Zn(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,a=e=>{(!n||n(e))&&i.add(e.id)};t.forEach(a),this._cache.forEach(a),r?.forEach(e=>e.forEach(a)),this._tx?.[3].forEach(a);let o=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),o.push(e));let s=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&Xn(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(s);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 o)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.options,n=e.headers.get(`Location`)||t.href;if(!n){let e=this.buildLocation(t);n=(e.maskedLocation??e).publicHref||`/`}let r;if(xt.test(n)||(r=bt(n))&&!this.protocolAllowlist.has(r))throw Error(`Redirect blocked: unsafe protocol`);if(r===`http:`||r===`https:`){let e=new URL(n);e.pathname.startsWith(`//`)?n=e.href:Jn(e,this.origin)||(n=Yn(e),r=void 0)}return r&&(t.reloadDocument=!0),t.href=n,e.headers.set(`Location`,n),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?Mt(e.from||``,e.to,this.options.trailingSlash,this.resolvePathCache):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=bn(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!ht(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?ht(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=Nt(e.pathParamsAllowedCharacters)),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??rn,parseSearch:e.parseSearch??nn,protocolAllowlist:e.protocolAllowlist??yt}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes(e){Object.assign(this,e),this.lightweightCache=new WeakMap,this.staticLocations=new WeakMap;let t=this.options.notFoundRoute;t&&(t.init(99999999999),this.routesById[t.id]!==t&&(t._interpolation=hn(!1,t,0)),this.routesById[t.id]=t)}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:kt(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?dr(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=ar(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof rr||(r=new rr(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 g=dt(),_=i._interpolation?It(i.fullPath,i._interpolation,r,this.pathParamsDecoder,g):i.fullPath,v=i.id+_+h,y=u(i,n),b=this._cache.get(v)??(y?.id===v?y:void 0);d=b?._strictParams??Object.assign(g,d);let x;if(!b)try{fr(i,d)}catch(e){if(x=Lt(e)||ln(e)?e:new ir(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:ft(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=Xn(i)?`pending`:`success`;C={id:v,ssr:i.options.ssr,index:n,routeId:i.id,params:y?.params??d,_strictParams:d,pathname:_,updatedAt:Date.now(),search:y?ft(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?pt(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`?ft(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=st(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=st(a),c={...e.search};for(let e of a)try{Object.assign(c,ar(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=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}};async function nr(e,t,{replace:n,ignoreBlocker:r}){if(!St(t,e.protocolAllowlist)){if(!r){let t=e.history._getBlockers();for(let r of t)if(r?.blockerFn&&await r.blockerFn({currentLocation:e.history.location,nextLocation:e.history.location,action:n?`REPLACE`:`PUSH`}))return}e.history._ignoreNextBeforeUnload?.(t),n?window.location.replace(t):window.location.href=t}}var rr=class extends Error{},ir=class extends Error{};function ar(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new rr(`Async validation not supported`);if(n.issues)throw new rr(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 or(e,t){if(e===void 0||e===!0)return t;let n=Object.create(null);return e===!1||e===null?n:typeof e==`function`?(Object.assign(n,t),Object.assign(n,e(n))):Object.assign(n,t,e)}function sr(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!lt.call(e,t[1]))}var cr=Object.freeze({});function lr(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r].options;`search`in i?i.search?.middlewares&&n.push(...i.search.middlewares):(i.preSearchFilters||i.postSearchFilters)&&n.push(({search:e,next:t})=>{let n=t(i.preSearchFilters?i.preSearchFilters.reduce((e,t)=>t(e),e):e);return i.postSearchFilters?i.postSearchFilters.reduce((e,t)=>t(e),n):n});let a=i.validateSearch;t&&a&&n.push(({search:e,next:t,meta:n})=>{let r=t(e);try{let e=ar(a,r);if(n&&e)for(let t in e)t in r||(n.defaulted||=new Map).set(t,e[t]);return{...r,...e}}catch{}return r})}return n}function ur(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=ct(n.search,i);return a&&(a.explicit=e),e}return e[t]({search:i,next:(e,n)=>{if(n){let n=a||{};return{search:r(t+1,e,n),meta:n}}return r(t+1,e,a)},meta:a})};return r(0,t)}function dr(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 sn}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).then(()=>t.removeEventListener(`abort`,i))})}function Cr(e,t){return e.routesById[t.routeId]}function wr(e,t,n){return ln(e)?[z,e]:Lt(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=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?Sr(a,c):a);if(c.aborted)return[i,br];let s=Vr(e,t,u,wr(o,!1,u.id),n);if(s[0]!==_r)return kr(e,r),[i,s];r.context={...r.context,...o}}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&&x?Nr(e,t,s,c,g,i,a).then(t=>(Pr(s,t,l),t[0]===_r&&(m&&!a[0].signal.aborted&&Fr(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[_r,s.loaderData]),T=(async()=>{try{let e=hr(c,void 0,C);e&&await Sr(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,Er(e,t,c,r,a)]}let r=await w;x&&r[0]===_r&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();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;try{if((s.href||o.headers.has(`Location`))&&(e.resolveRedirect(o),s.reloadDocument)||(s.reloadDocument?i[3]:i[1]>=20))return r;let n=e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0}),a=n.maskedLocation??n;if(a.external){let t=o.clone();return t.options={...s},t.headers.set(`Location`,a.publicHref),e.resolveRedirect(t),i[3]?[z,t]:[z,t,a]}return[z,o,n]}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`||e.preload||a?.id!==e.id||a.status!==`success`||(l++,i._notFound||a._notFound))break}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._lifecycleEnd,o=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let s=gr(n).length,c=new Map;{let t=Date.now(),r=new Set;for(let e=0;e<n.length;e++){let t=n[e];(e<s||t.status===`success`)&&r.add(t.id)}for(let n of[...i,...o.values()]){if(n.status!==`success`||r.has(n.id))continue;let i=Cr(e,n);!i.options.loader||t-n.updatedAt>=(n.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||c.set(n.id,o.get(n.id)===n?n:{...n,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=c;let l=e._lifecycleEnd=$n(n);Jr(e,n),B(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),er(e,i,n,a,l,t)}async function Xr(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],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.maskedLocation??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=Zn(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=Zn(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(_),y=[p,s,a,m,Date.now(),v.then(()=>Xr(e,y))];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 y[5]}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){Lt(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,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=sn:this.parentRoute||Et();let r=n?sn:t?.path;r&&r!==`/`&&(r=Ot(r));let i=t?.id||r,a=n?sn:Dt((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:Dt(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=kt(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=>cn({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:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{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[0],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]})}var si=()=>!0,ci=()=>!1;function li({children:e,fallback:t=null}){return(0,_.jsx)(h.default.Fragment,{children:ui()?e:t})}function ui(){return h.default.useSyncExternalStore(di,si,ci)}function di(){return()=>{}}var fi=h.createContext(null);function pi(e){return h.useContext(fi)}var mi=h.createContext(void 0),hi=h.createContext(void 0);function gi({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(1)}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(1)}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 _i(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 vi=[],yi=0,{link:bi,unlink:xi,propagate:Si,checkDirty:Ci,shallowPropagate:wi}=gi({update(e){return e._update()},notify(e){vi[Ei++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Ai(e))}}),Ti=0,Ei=0,Di,Oi=0;function ki(e){try{++Oi,e()}finally{--Oi||ji()}}function Ai(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=xi(n,e)}function ji(){if(!(Oi>0)){for(;Ti<Ei;){let e=vi[Ti];vi[Ti++]=void 0,e.notify()}Ti=0,Ei=0}}function Mi(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,get(){return Di!==void 0&&bi(i,Di,yi),i._snapshot},subscribe(e){let t=_i(e),n={current:!1},r=Ni(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Di,o=t?.compare??Object.is;if(n)Di=i,++yi,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);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{Di=a,n&&(i.flags&=-5),Ai(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Ci(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&wi(e)}}else e&32&&(i.flags=e&-33);return Di!==void 0&&bi(i,Di,yi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Si(e),wi(e),ji())}},i}function Ni(e){let t=()=>{let t=Di;Di=n,++yi,n.depsTail=void 0,n.flags=6;try{return e()}finally{Di=t,n.flags&=-5,Ai(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Ci(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Ai(this)}};return t(),n}var Pi=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})),Fi=f(((e,t)=>{t.exports=Pi()})),Ii=f((e=>{var t=globalThis.React,n=Fi();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}})),Li=f(((e,t)=>{t.exports=Ii()}))();function Ri(e,t){return e===t}function zi(e,t=e=>e,n){let r=n?.compare??Ri,i=(0,h.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,h.useCallback)(()=>e.get(),[e]);return(0,Li.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Bi={};function Vi(e,t){let n=h.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=pt(n.current,i):i}}function Hi(e){let t=pi(),n=h.useContext(e.from?hi:mi),r=e.from??n,i=t.stores.getMatchStore(r),a=Vi(e,t),o=zi(i,e=>e?a(e):Bi);if(o!==Bi)return o;(e.shouldThrow??!0)&&Et()}function Ui(e){return Hi({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Wi(e){let{select:t,...n}=e;return Hi({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Gi(e){return Hi({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 Ki(e){return Hi({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function qi(e){let t=pi();return h.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Ji(e){return Hi({...e,select:t=>e.select?e.select(t.context):t.context})}function Yi(...e){let t=h.useRef(e),n=t.current;return e.forEach((e,t)=>{ht(n[t],e,!1,!0)||(n[t]=e)}),t.current}function Xi(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(ni)})}var Zi={compare:(e,t)=>e[0]===t[0]&&e[1]===t[1]};function Qi(e,t){let n=typeof e==`string`&&bt(e);if(n)return t.has(n)?e:null}function $i(e,t,n,r,i){let a=jt(e.pathname,r),o=jt(t.pathname,r);return(n?.exact?a!==o:!a.startsWith(o)||a.length!==o.length&&a[o.length]!==`/`)||(n?.includeSearch??!0)&&!ht(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||i&&e.hash===t.hash}function ea(e,t,n){let r=pi(),i=h.useRef(null),a=h.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,hashScrollIntoView:u,replace:d,startTransition:f,resetScroll:p,viewTransition:m,ignoreBlocker:g,disabled:_,target:v,onClick:y,onBlur:b,onFocus:x,onMouseEnter:S,onMouseLeave:C,onTouchStart:w}=e,T=ui(),[E,D,O]=Yi(e.search,e.params,o),[k,A]=h.useMemo(()=>[e,{...e}],[r,e.from,e._fromLocation,e.hash,e.to,E,D,e.state,e.mask,e.unsafeRelative]),j=h.useCallback(e=>{let t=Qi(s,r.protocolAllowlist);if(t!==void 0)return[t??void 0];k._fromLocation||(A._fromLocation=e);let n=r.buildLocation(A),i=la(n,r,_);return[i,!_&&(!i||bt(i))?void 0:$i(e,n,O,r.basepath,T)]},[O,_,T,k,A,r,s]),[M,N]=zi(r.stores.location,j,Zi),P=N===void 0?M:void 0,F=_||M===void 0,ee=h.useRef(!1),I=e.reloadDocument||P||F?!1:c??r.options.defaultPreload,te=l??r.options.defaultPreloadDelay??0,ne=h.useCallback(e=>{let t=e?.isIntersecting;if(!(t??I===`intent`)){t===!1&&sa(i);return}if(!te){Xi(r,k);return}oa.has(i)||oa.set(i,setTimeout(()=>{oa.delete(i),Xi(r,k)},te))},[r,k,i,I,te]);h.useEffect(()=>{I===`render`&&!ee.current&&(ee.current=!0,Xi(r,k));let e;return I===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(e=new IntersectionObserver(e=>ne(e.pop()),{rootMargin:`100px`}),e.observe(i.current)),()=>{e?.disconnect(),sa(i)}},[r,k,I,ne,i]);let L=ia(e,n);if(L.ref=t?a:i,P)return L.href=P,L;let re=e=>{let t=v??e.currentTarget.getAttribute(`target`);!F&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!t||t===`_self`)&&e.button===0&&(e.preventDefault(),r.navigate({...k,replace:d,resetScroll:p,hashScrollIntoView:u,startTransition:f,viewTransition:m,ignoreBlocker:g}))},ie=()=>{I===`intent`&&Xi(r,k)},ae=()=>{I===`intent`&&sa(i)};return L.onClick=ca(y,re),L.onBlur=ca(b,ae),L.onFocus=ca(x,ne),L.onMouseEnter=ca(S,ne),L.onMouseLeave=ca(C,ae),L.onTouchStart=ca(w,ie),aa(L,e,N,M,F,n)}var ta={},na={className:`active`},ra=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`_fromLocation`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function ia(e,t){let n={};for(let r in e)ra.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function aa(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=ct(n?o:s,{})??(n?na:ta);Object.assign(e,d),e.href=r,a!==`a`&&(e.disabled=i),e.target=u;let f=d.style;(l||f)&&(e.style=l&&f?{...l,...f}:l||f);let p=d.className;return(c||p)&&(e.className=c?p?`${c} ${p}`:c:p),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var oa=new WeakMap,sa=e=>{clearTimeout(oa.get(e)),oa.delete(e)},ca=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function la(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!St(i,t.protocolAllowlist))return i}var ua=h.memo(h.forwardRef((e,t)=>{let n=e._asChild||`a`,r=ea(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return h.createElement(n,r,i)}),da);function da(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!ra.has(r)||!ht(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var fa=class extends ri{constructor(e){super(e),this.useMatch=e=>Hi({...e,from:this.id}),this.useRouteContext=e=>Ji({...e,from:this.id}),this.useSearch=e=>Ki({...e,from:this.id}),this.useParams=e=>Gi({...e,from:this.id}),this.useLoaderDeps=e=>Wi({...e,from:this.id}),this.useLoaderData=e=>Ui({...e,from:this.id}),this.useNavigate=()=>qi({from:this.fullPath}),this.Link=h.default.forwardRef((e,t)=>(0,_.jsx)(ua,{ref:t,from:this.fullPath,...e}))}};function pa(e){return new fa(e)}var ma=class extends ii{constructor(e){super(e),this.useMatch=e=>Hi({...e,from:this.id}),this.useRouteContext=e=>Ji({...e,from:this.id}),this.useSearch=e=>Ki({...e,from:this.id}),this.useParams=e=>Gi({...e,from:this.id}),this.useLoaderDeps=e=>Wi({...e,from:this.id}),this.useLoaderData=e=>Ui({...e,from:this.id}),this.useNavigate=()=>qi({from:this.fullPath}),this.Link=h.default.forwardRef((e,t)=>(0,_.jsx)(ua,{ref:t,from:this.fullPath,...e}))}};function ha(e){return new ma(e)}function ga(e){let t=pi(),n=`not-found-${zi(t.stores.location,e=>e.pathname)}-${zi(t.stores.status)}`;return(0,_.jsx)(ai,{getResetKey:()=>n,onCatch:(t,n)=>{if(Lt(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Lt(t))return e.fallback?.(t);throw t},children:e.children})}function _a(){return(0,_.jsx)(`p`,{children:`Not Found`})}function va(e){return(0,_.jsx)(_.Fragment,{children:e.children})}function ya(e,t,n){return t.options.notFoundComponent?(0,_.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,_.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,_.jsx)(_a,{})}function ba(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,_.jsx)(n,{}):null}var xa=(e,t)=>e[0]===t[0]&&e[1]===t[1],Sa=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Ca=h.memo(function({routeId:e}){let t=pi();return(0,_.jsx)(wa,{router:t,match:zi(t.stores.getMatchStore(e))})});function wa({router:e,match:t}){let n=e.routesById[t.routeId],r=ba(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=Sa(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?h.Suspense:va,l=i?ai:va,u=o?ga:va;return(0,_.jsxs)(n.isRoot?n.options.shellComponent??va:va,{children:[(0,_.jsx)(mi.Provider,{value:t.routeId,children:(0,_.jsx)(c,{fallback:r,children:(0,_.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Lt(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)(li,{fallback:r,children:(0,_.jsx)(Ta,{match:t})}):(0,_.jsx)(Ta,{match:t})})})})}),null]})}var Ta=h.memo(function({match:e}){let t=pi(),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)(Ea,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!Sa(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return ba(t,r)}if(e.status===`notFound`)return ya(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Ea=h.memo(function(){let e=pi(),t=h.useContext(mi),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=zi(a,e=>[!!e._notFound,e.error],{compare:xa}),i=zi(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return ya(e,e.routesById[t],r);if(!i)return null;let a=(0,_.jsx)(Ca,{routeId:i});return t===`__root__`?(0,_.jsx)(h.Suspense,{fallback:ba(e),children:a}):a});function Da(e,t){let n=e[1];e.length=0,n?.(t)}function Oa({t:e}){let t=pi(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Da(n,!1),n.push(i,a),e(t),h.startTransition(r)}),ot(()=>{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(kt(r.publicHref)!==kt(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`,...Zn(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function ka(){let e=pi(),t=e.routesById[sn],n=ba(e,t),r=e.ssr?va:h.Suspense,i=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Oa,{t:h.useState()[1]}),(0,_.jsx)(r,{fallback:n,children:(0,_.jsx)(Aa,{})})]});return e.options.InnerWrap?(0,_.jsx)(e.options.InnerWrap,{children:i}):i}function Aa(){let e=pi(),t=e._rendered,n=zi(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;ot(()=>{t[0]===n&&Da(t,!0)},[t,n]);let a=i?(0,_.jsx)(Ca,{routeId:i}):null;return(0,_.jsx)(mi.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,_.jsx)(ai,{getResetKey:()=>r,onCatch:void 0,children:a})})}function ja(){let e=pi();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,zi(e.stores.location,e=>e.href),zi(e.stores.resolvedLocation,e=>e?.href),zi(e.stores.status)])}var Ma=e=>({createMutableStore:Mi,createReadonlyStore:Mi,batch:ki}),Na=e=>new Pa(e),Pa=class extends tr{constructor(e){super(e,Ma)}};function Fa({router:e,children:t,...n}){ut(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,_.jsx)(fi.Provider,{value:e,children:t});return e.options.Wrap?(0,_.jsx)(e.options.Wrap,{children:r}):r}function Ia({router:e,...t}){return(0,_.jsx)(Fa,{router:e,...t,children:(0,_.jsx)(ka,{})})}function La(e){let t=pi();return zi(t.stores.location,Vi(e,t))}var Ra=(0,h.createContext)(null),za={didCatch:!1,error:null},Ba=class extends h.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=za}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{didCatch:t}=this.state;t&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(za))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.didCatch&&Va(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(za))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,h.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,h.createElement)(Ra.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function Va(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}var V=m(f(((e,t)=>{(function(){"use strict";var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}))()),Ha={primary:`wcpos:bg-wp-admin-theme-color wcpos:text-white wcpos:hover:bg-wp-admin-theme-color-darker-10 wcpos:focus:ring-wp-admin-theme-color`,secondary:`wcpos:bg-white wcpos:text-gray-700 wcpos:border wcpos:border-gray-300 wcpos:hover:bg-gray-50 wcpos:focus:ring-wp-admin-theme-color`,destructive:`wcpos:bg-red-600 wcpos:text-white wcpos:hover:bg-red-700 wcpos:focus:ring-red-500`,outline:`wcpos:bg-transparent wcpos:text-wp-admin-theme-color wcpos:border wcpos:border-wp-admin-theme-color wcpos:hover:bg-wp-admin-theme-color-lightest wcpos:focus:ring-wp-admin-theme-color`,ghost:`wcpos:bg-transparent wcpos:text-gray-700 wcpos:hover:bg-gray-100 wcpos:focus:ring-wp-admin-theme-color`,"ghost-destructive":`wcpos:bg-transparent wcpos:text-red-600 wcpos:hover:bg-red-50 wcpos:focus:ring-red-500`,text:`wcpos:bg-transparent wcpos:text-wp-admin-theme-color wcpos:hover:underline wcpos:focus:ring-wp-admin-theme-color`};function Ua(e){return e===`danger`?`destructive`:e}function H({variant:e=`secondary`,loading:t=!1,disabled:n,className:r,children:i,type:a=`button`,...o}){let s=n||t,c=Ua(e);return(0,_.jsxs)(`button`,{type:a,disabled:s,className:(0,V.default)(`wcpos:inline-flex wcpos:items-center wcpos:justify-center wcpos:rounded-md wcpos:text-sm wcpos:font-medium wcpos:transition-colors wcpos:duration-150`,`wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-offset-2`,c===`text`?`wcpos:px-0 wcpos:py-0`:`wcpos:px-3 wcpos:py-1.5`,Ha[c],s?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`,r),...o,children:[t&&(0,_.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 Wa({checked:t,onChange:n,label:r,description:i,disabled:a,className:o,labelClassName:s,"aria-label":c}){let l=e.useId(),u=r?`${l}-label`:void 0,d=i?`${l}-description`:void 0,f=e.useCallback(()=>{a||n(!t)},[t,a,n]);return(0,_.jsxs)(`div`,{className:(0,V.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,V.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,V.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,V.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 Ga({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,V.default)(`wcpos:flex wcpos:items-center wcpos:gap-2`,n),children:[(0,_.jsx)(`input`,{ref:l,id:c,type:`checkbox`,className:(0,V.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,V.default)(`wcpos:text-sm wcpos:text-gray-700`,i?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`),children:t})]})}var U=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,V.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}));U.displayName=`TextInput`;var Ka=e.forwardRef(({error:e,className:t,...n},r)=>(0,_.jsx)(`textarea`,{ref:r,"aria-invalid":e||void 0,className:(0,V.default)(`wcpos:block wcpos:w-full wcpos:rounded-md wcpos:border wcpos:px-2.5 wcpos:py-1.5 wcpos:text-sm wcpos:shadow-xs`,`wcpos:transition-colors wcpos:duration-150`,`wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-offset-0`,e?`wcpos:border-red-300 wcpos:focus:border-red-500 wcpos:focus:ring-red-500`:`wcpos:border-gray-300 wcpos:focus:border-wp-admin-theme-color wcpos:focus:ring-wp-admin-theme-color`,n.disabled&&`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`,t),...n}));Ka.displayName=`TextArea`;function W({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,V.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 qa=`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`,Ja=`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`;function Ya(e){return e.toLowerCase()}function Xa({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=Ya(x.trim());return e?O.filter(t=>Ya(t.label).includes(e)||Ya(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())},I=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()}},te=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,V.default)(qa,u&&Ja,d),children:[(0,_.jsx)(`span`,{className:(0,V.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":te,value:x,onChange:e=>S(e.target.value),onKeyDown:I,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,V.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 Za=`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`,Qa=`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`,$a=`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`,eo=`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 to(e){return e.toLowerCase()}function no(e,t,n){let r=t.find(t=>t.value===e);return r?r.label:n?e:``}function ro({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(()=>no(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(no(t,r,a))},[t,r,S,a]);let M=e.useMemo(()=>{let e=w.trim(),t=to(e),n=!j&&S&&t?r.filter(e=>to(e.label).includes(t)||to(e.value).includes(t)):r.slice();return S&&a&&o&&e&&(r.some(e=>to(e.label)===t||to(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]),I=e.useCallback(()=>{let e=w.trim(),n=r.find(t=>to(t.label)===to(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(no(t,r,a)),P()},[a,P,w,i,r,t]),te=e.useRef(I);e.useEffect(()=>{te.current=I},[I]),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)||te.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)},L=()=>{if(f)return;C(!0);let e=y.current;e&&requestAnimationFrame(()=>e.select())},re=e=>{let t=e.relatedTarget;t&&(v.current?.contains(t)||b.current?.contains(t))||te.current()},ie=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(),I();break;case`Escape`:S&&(e.preventDefault(),T(no(t,r,a)),P());break;case`Tab`:S&&I()}},ae=e=>{e.preventDefault(),!f&&(S?P():(F(),y.current?.focus()))},oe=S&&E>=0&&M.length>0?`${A}-option-${E}`:void 0;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{ref:v,className:(0,V.default)(Za,f&&Qa,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":oe,"aria-label":h,"aria-labelledby":g,autoComplete:`off`,"data-1p-ignore":!0,"data-lpignore":`true`,disabled:f,value:w,placeholder:c,onChange:ne,onFocus:L,onBlur:re,onKeyDown:ie,className:$a}),(0,_.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-hidden":`true`,disabled:f,onMouseDown:ae,className:eo,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,V.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 io({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,V.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 ao({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,V.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 oo=e.createContext(null);function so({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,V.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)(oo.Provider,{value:y,children:r})}),document.body)]})}function co({children:t,onSelect:n,href:r,disabled:i,target:a,rel:o,destructive:s}){let c=e.useContext(oo),l=(0,V.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})}so.Item=co;function lo({active:e=!1,className:t,children:n,...r}){return(0,_.jsx)(`div`,{className:(0,V.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 uo({noPadding:e=!1,className:t,children:n,...r}){return(0,_.jsx)(`div`,{className:(0,V.default)(`wcpos:flex-1`,!e&&`wcpos:p-4`,t),...r,children:n})}function fo({className:e,children:t,...n}){return(0,_.jsx)(`div`,{className:(0,V.default)(`wcpos:border-t wcpos:border-gray-200 wcpos:bg-gray-50 wcpos:px-4 wcpos:py-2.5`,e),...n,children:t})}lo.Body=uo,lo.Footer=fo;var po={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 mo(){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 ho({status:e=`info`,children:t,onRemove:n,isDismissible:r=!0,className:i,dismissLabel:a=`Dismiss`}){return(0,_.jsxs)(`div`,{className:(0,V.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`,po[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)(mo,{})})]})}var go={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`},_o={info:`i`,success:`✓`,warning:`!`,error:`!`};function vo({status:e=`info`,title:t,icon:n,children:r,className:i}){let a=n===void 0?_o[e]:n;return(0,_.jsxs)(`div`,{className:(0,V.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`,go[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 G({className:e,width:t,height:n,style:r,...i}){return(0,_.jsx)(`div`,{className:(0,V.default)(`wcpos:animate-pulse wcpos:rounded wcpos:bg-gray-200`,e),style:{width:t,height:n,...r},...i})}function K({label:e,htmlFor:t,description:n,children:r,className:i}){return(0,_.jsxs)(`div`,{className:(0,V.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 yo({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,V.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,V.default)(`wcpos:mb-3`,s&&(0,V.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,V.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 bo({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,V.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,V.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 xo={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`},So={sm:`wcpos:text-xs wcpos:px-2 wcpos:py-0.5`,xs:`wcpos:text-[10px] wcpos:px-1.5 wcpos:py-0.5`},Co={pill:`wcpos:rounded-full`,round:`wcpos:rounded-full wcpos:min-w-5 wcpos:justify-center`};function q({variant:e=`neutral`,shape:t=`pill`,size:n=`sm`,icon:r,className:i,children:a,...o}){return(0,_.jsxs)(`span`,{className:(0,V.default)(`wcpos:inline-flex wcpos:items-center wcpos:gap-1 wcpos:font-medium wcpos:leading-none wcpos:shrink-0`,xo[e],So[n],Co[t],i),...o,children:[r,a]})}var wo={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`},To={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`},Eo={none:`wcpos:ring-1 wcpos:ring-gray-200`,brand:`wcpos:ring-2 wcpos:ring-wp-admin-theme-color`};function Do(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 Oo({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,V.default)(`wcpos:relative wcpos:inline-flex wcpos:shrink-0`,s),children:[(0,_.jsx)(`span`,{className:(0,V.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`,wo[r],Eo[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:Do(t)})}),a===`active`&&(0,_.jsx)(`span`,{className:(0,V.default)(`wcpos:absolute wcpos:-bottom-0.5 wcpos:-right-0.5`,`wcpos:rounded-full wcpos:bg-green-500 wcpos:ring-2 wcpos:ring-white`,To[r]),role:`status`,"aria-label":o||`Active now`,title:o||`Active now`})]})}var ko={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 Ao({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,V.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`,ko[n],a?`wcpos:translate-y-0 wcpos:opacity-100`:`wcpos:-translate-y-full wcpos:opacity-0`),children:t}):null}var jo=e.createContext(null),Mo=0;function No(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():(Mo+=1,`snackbar-${Date.now()}-${Mo}`)}function Po({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??No();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)(jo.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)(Ao,{...e,onRemove:()=>{try{e.onRemove?.()}finally{l(e.id)}}},e.id))}),t]})})}function Fo(){let t=e.useContext(jo);if(!t)throw Error(`useSnackbar must be called within SnackbarProvider`);return t}function Io({className:e,tableClassName:t,children:n,...r}){return(0,_.jsx)(`div`,{className:(0,V.default)(`wcpos:overflow-x-auto wcpos:rounded-md wcpos:border wcpos:border-gray-200`,e),...r,children:(0,_.jsx)(`table`,{className:(0,V.default)(`wcpos:w-full wcpos:text-sm`,t),children:n})})}function Lo({className:e,children:t,...n}){return(0,_.jsx)(`thead`,{className:e,...n,children:t})}function Ro({className:e,children:t,...n}){return(0,_.jsx)(`tbody`,{className:e,...n,children:t})}var zo=e.forwardRef(function({className:e,children:t,...n},r){return(0,_.jsx)(`tr`,{ref:r,className:(0,V.default)(`wcpos:bg-gray-50 wcpos:text-left wcpos:text-xs wcpos:uppercase wcpos:tracking-wide wcpos:text-gray-500`,e),...n,children:t})}),Bo=e.forwardRef(function({className:e,children:t,...n},r){return(0,_.jsx)(`tr`,{ref:r,className:(0,V.default)(`wcpos:border-t wcpos:border-gray-100`,e),...n,children:t})}),J=e.forwardRef(function({className:e,children:t,...n},r){return(0,_.jsx)(`th`,{ref:r,className:(0,V.default)(`wcpos:px-3 wcpos:py-2 wcpos:font-medium`,e),...n,children:t})}),Y=e.forwardRef(function({className:e,children:t,...n},r){return(0,_.jsx)(`td`,{ref:r,className:(0,V.default)(`wcpos:px-3 wcpos:py-2 wcpos:align-middle`,e),...n,children:t})});Io.Header=Lo,Io.HeaderRow=zo,Io.Body=Ro,Io.Row=Bo,Io.Head=J,Io.Cell=Y;var Vo=[{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`}],Ho={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`},Uo={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`},Wo={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`},Go=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 Ko(e){if(!e)return`other`;let t=e.toUpperCase();return Uo[t]?Uo[t]:Go.has(t)?`eu_vat`:`other`}function qo(e,t){if(e===`eu_vat`){let e=t?.toUpperCase();if(e&&Go.has(e))return e;let n=window?.wcpos?.settings?.storeCountry?.toUpperCase();return n&&Go.has(n)?n:void 0}return Wo[e]}function Jo(e,t){return Ho[e]??t}var Yo=e=>{let t={type:e.type||`other`,value:e.value||``};return e.country&&(t.country=e.country),e.label&&(t.label=e.label),t},Xo=(e,t)=>{if(typeof t.country==`string`&&t.country)return{...t,type:Ko(t.country)};if(typeof t.type==`string`){let n=qo(t.type,e.country);if(n)return{...t,country:n};if(t.type===`eu_vat`)return{...t,country:void 0}}return t},Zo=0,Qo=()=>`tax-id-row-${++Zo}`;function $o({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)(Bo,{children:[(0,_.jsx)(Y,{children:(0,_.jsx)(W,{"aria-label":n.type,value:t.type,options:Vo,onChange:({value:e})=>r({type:String(e)})})}),(0,_.jsx)(Y,{children:(0,_.jsx)(U,{"aria-label":n.value,placeholder:Jo(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)(Y,{children:(0,_.jsx)(Xa,{"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)(Y,{children:(0,_.jsx)(U,{"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)(Y,{className:`wcpos:text-right`,children:(0,_.jsx)(H,{variant:`ghost-destructive`,onMouseDown:e=>e.preventDefault(),onClick:i,children:n.remove})})]})}var es=e.forwardRef(function({value:t,onChange:n,labels:r},i){let a=e.useMemo(()=>Array.isArray(t)?t.map(Yo):[],[t]),[o,s]=e.useState(()=>a.map(()=>Qo())),[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},()=>Qo());return[...e,...t]}return e.slice(0,a.length)})},[a.length]);let u=e.useCallback((e,t)=>{if(e>=a.length&&c){let e=Xo(c.taxId,t),r=Yo({...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=Xo(n,t);return Yo({...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:Ko(t),value:``};return t&&(n.country=t),{id:Qo(),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)(H,{variant:`outline`,onClick:f,children:r.add})]}):(0,_.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,_.jsxs)(Io,{children:[(0,_.jsx)(Lo,{children:(0,_.jsxs)(zo,{children:[(0,_.jsx)(J,{style:{width:`11rem`},children:r.type}),(0,_.jsx)(J,{children:r.value}),(0,_.jsx)(J,{style:{width:`12rem`},children:r.country}),(0,_.jsx)(J,{children:r.label}),(0,_.jsx)(J,{className:`wcpos:text-right`,style:{width:`1%`},children:(0,_.jsx)(`span`,{className:`wcpos:sr-only`,children:r.remove})})]})}),(0,_.jsx)(Ro,{children:p.map((e,t)=>(0,_.jsx)($o,{taxId:e.taxId,labels:r,onChangeField:e=>u(t,e),onRemove:()=>d(t)},e.id))})]}),(0,_.jsx)(H,{variant:`outline`,onClick:f,children:r.add})]})}),X=e=>typeof e==`string`,ts=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},ns=e=>e==null?``:String(e),rs=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},is=/###/g,as=e=>e&&e.includes(`###`)?e.replace(is,`.`):e,os=e=>!e||X(e),ss=(e,t,n)=>{let r=X(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(os(e))return{};let t=as(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return os(e)?{}:{obj:e,k:as(r[i])}},cs=(e,t,n)=>{let{obj:r,k:i}=ss(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=ss(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=ss(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},ls=(e,t,n,r)=>{let{obj:i,k:a}=ss(e,t,Object);i[a]=i[a]||[],i[a].push(n)},us=(e,t)=>{let{obj:n,k:r}=ss(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},ds=(e,t,n)=>{let r=us(e,n);return r===void 0?us(t,n):r},fs=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(Object.prototype.hasOwnProperty.call(e,r)?X(e[r])||e[r]instanceof String||X(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):fs(e[r],t[r],n):e[r]=t[r]);return e},ps=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),ms={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"/":`/`},hs=e=>X(e)?e.replace(/[&<>"'\/]/g,e=>ms[e]):e,gs=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}},_s=[` `,`,`,`?`,`!`,`;`],vs=new gs(20),ys=(e,t,n)=>{t||=``,n||=``;let r=_s.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=vs.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},bs=(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},xs=e=>e?.replace(/_/g,`-`),Ss={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)}},Cs=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||Ss,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=>X(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),X(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)}},ws=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)})}},Ts=class extends ws{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):X(n)&&i?o.push(...n.split(i)):o.push(n)));let s=us(this.data,o);return!s&&!t&&!n&&e.includes(`.`)&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!X(n)?s:bs(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),cs(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)(X(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=us(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?fs(s,n,i):s={...s,...n},cs(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}},Es={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}},Ds=Symbol(`i18next/PATH_KEY`);function Os(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Ds?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function ks(e,t){let{[Ds]:n}=e(Os()),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 As=e=>!X(e)&&typeof e!=`boolean`&&typeof e!=`number`,js=class e extends ws{constructor(e,t={}){super(),rs([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=Cs.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=As(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&&!ys(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:X(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:X(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=ks(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?ks(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&&!X(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=As(E),O=Object.prototype.toString.apply(E);if(y&&E&&D&&!_.includes(O)&&!(X(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:As(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&&X(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=X(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&&!X(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=X(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=Es.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 X(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?ks(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&&!X(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(X(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&&!X(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}},Ms=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Cs.create(`languageUtils`),this.resolveHierarchyCache={}}clearCache(){this.resolveHierarchyCache={}}getScriptPartFromCode(e){if(e=xs(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=xs(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(X(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)),X(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||X(t),a=t===void 0&&typeof this.options.fallbackLng==`function`,o=X(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 X(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))):X(e)&&u(this.formatLanguageCode(e)),c.forEach(e=>{l.includes(e)||u(this.formatLanguageCode(e))}),s===null?l:(this.resolveHierarchyCache[s]=l,l.slice())}},Ns={zero:0,one:1,two:2,few:3,many:4,other:5},Ps={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},Fs=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Cs.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=xs(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!`),Ps;if(!e.match(/-|_/))return Ps;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)=>Ns[e]-Ns[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))}},Is=(e,t,n,r=`.`,i=!0)=>{let a=ds(e,t,n);return!a&&i&&X(n)&&(a=bs(e,n,r),a===void 0&&(a=bs(t,n,r))),a},Ls=e=>e.replace(/\$/g,`$$$$`),Rs=class{constructor(e={}){this.logger=Cs.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?hs:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?ps(i):a||`{{`,this.suffix=o?ps(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?ps(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?ps(l):``,this.nestingPrefix=d?ps(d):f||ps(`$t(`),this.nestingSuffix=p?ps(p):m||ps(`)`),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=Is(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(Is(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=X(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!X(a)&&!this.useRawValueToEscape&&(a=ns(a));let s=t.safeValue(a);if(e=e.replace(i[0],Ls(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(`${ps(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&&!X(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&&!X(i))return i;X(i)||(i=ns(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],Ls(ns(i))),this.regexp.lastIndex=0}return e}},zs=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}},Bs=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(xs(r),i),t[o]=s),s(n)}},Vs=e=>(t,n,r)=>e(xs(n),r)(t),Hs=class{constructor(e={}){this.logger=Cs.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?Bs:Vs;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()]=Bs(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}=zs(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)}},Us=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Ws=class extends ws{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Cs.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=>{ls(n.loaded,[i],a),Us(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();X(e)&&(e=this.languageUtils.toResolveHierarchy(e)),X(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)}}},Gs=()=>({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]),X(e[1])&&(t.defaultValue=e[1]),X(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}),Ks=e=>(X(e.ns)&&(e.ns=[e.ns]),X(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),X(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),qs=()=>{},Js=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},Z=class e extends ws{constructor(e={},t){if(super(),this.options=Ks(e),this.services={},this.logger=Cs,this.modules={external:[]},Js(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&&(X(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=Gs();this.options={...n,...this.options,...Ks(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?Cs.init(r(this.modules.logger),this.options):Cs.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Hs;let t=new Ms(this.options);this.store=new Ts(this.options.resources,this.options);let n=this.services;n.logger=Cs,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new Fs(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 Rs(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new Ws(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 js(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||=qs,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=ts(),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=qs){let n=t,r=X(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=ts();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||=qs,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`&&Es.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=ts();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=X(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(X(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=ks(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=ks(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=ks(e,c)),u=o.keyPrefix?`${o.keyPrefix}${l}${e}`:e),this.t(u,o)};return X(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=ts();return this.options.ns?(X(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=ts();X(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 Ms(Gs());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=qs){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 Ts(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={...Gs().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new Rs(n)}return a.translator=new js(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();Z.createInstance,Z.dir,Z.init,Z.loadResources,Z.reloadResources,Z.use,Z.changeLanguage,Z.getFixedT,Z.t,Z.exists,Z.setDefaultNamespace,Z.hasLoadedNamespace,Z.loadNamespaces,Z.loadLanguages;function Ys(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Xs(e){"@babel/helpers - typeof";return Xs=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},Xs(e)}function Zs(e,t){if(Xs(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Xs(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Qs(e){var t=Zs(e,`string`);return Xs(t)==`symbol`?t:t+``}function $s(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,Qs(r.key),r)}}function ec(e,t,n){return t&&$s(e.prototype,t),n&&$s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var tc=[],nc=tc.forEach,rc=tc.slice,ic=[`__proto__`,`constructor`,`prototype`];function ac(e){return nc.call(rc.call(arguments,1),function(t){if(t)for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];ic.indexOf(i)>-1||e[i]===void 0&&(e[i]=t[i])}}),e}function oc(e){return e?typeof e==`function`?new e:e:null}function sc(){return{handleEmptyResourcesAsFailed:!0,cacheHitMode:`none`,retryOnFailure:!1}}function cc(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 lc=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]:{};Ys(this,e),this.backends=[],this.type=`backend`,this.allOptions=r,this.init(t,n)}return ec(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=ac(n,this.options||{},sc()),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]||oc(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?cc(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&&cc(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)})})})}}}])}();lc.type=`backend`;var uc=[];uc.forEach,uc.slice;var dc=[`__proto__`,`constructor`,`prototype`];function fc(e){return!(typeof e!=`string`||e.length===0||e.length>128||dc.indexOf(e)>-1||e.indexOf(`..`)>-1||e.indexOf(`\\`)>-1||/[?#%:\s]/.test(e)||/[\x00-\x1F\x7F]/.test(e))}function pc(e){return!(!fc(e)||e.indexOf(`/`)>-1||e.indexOf(`@`)>-1)}function mc(e){return!(!fc(e)||e.indexOf(`//`)>-1)}var hc={lng:pc,ns:mc};function gc(e){return typeof e==`string`?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e}function _c(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 vc(){return typeof XMLHttpRequest==`function`||typeof XMLHttpRequest==`object`}function yc(e){return!!e&&typeof e.then==`function`}function bc(e){return yc(e)?e:Promise.resolve(e)}var xc=/\{\{(.+?)\}\}/g;function Sc(e,t){let n=!1,r=e.replace(xc,(e,r)=>{let i=r.trim();if(dc.indexOf(i)>-1)return e;let a=t[i];if(a==null)return e;let o=hc[i]||pc,s=String(a).split(`+`);for(let t of s)if(!o(t))return n=!0,e;return s.join(`+`)});return n?null:r}var Cc=typeof globalThis<`u`?globalThis:typeof global<`u`?global:typeof window<`u`?window:void 0,wc;typeof fetch==`function`?wc=fetch:Cc&&typeof Cc.fetch==`function`&&(wc=Cc.fetch);var Tc=vc()&&Cc?Cc.XMLHttpRequest:void 0,Ec=typeof ActiveXObject==`function`&&Cc?Cc.ActiveXObject:void 0,Dc=[`__proto__`,`constructor`,`prototype`],Oc=(e,t)=>{if(t&&typeof t==`object`){let n=``;for(let e of Object.keys(t))Dc.indexOf(e)>-1||(n+=`&`+encodeURIComponent(e)+`=`+encodeURIComponent(t[e]));if(!n)return e;e=e+(e.indexOf(`?`)===-1?`?`:`&`)+n.slice(1)}return e},kc=(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):wc(e,t).then(i).catch(n)},Ac=(e,t,n,r)=>{e.queryStringParams&&(t=Oc(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{kc(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]}),kc(t,o,r,s),e._omitFetchOptions=!0}catch(e){r(e)}}},jc=(e,t,n,r)=>{n&&typeof n==`object`&&(n=Oc(``,n).slice(1)),e.queryStringParams&&(t=Oc(t,e.queryStringParams));try{let i=Tc?new Tc:new Ec(`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))Dc.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)}},Mc=(e,t,n,r)=>{if(typeof n==`function`&&(r=n,n=void 0),r||=(()=>{}),wc&&t.indexOf(`file:`)!==0)return Ac(e,t,n,r);if(vc()||typeof ActiveXObject==`function`)return jc(e,t,n,r);r(Error(`No fetch and no xhr implementation found!`))},Nc=()=>({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:Mc,reloadInterval:typeof window<`u`?!1:36e5,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:`cors`,credentials:`same-origin`,cache:`default`}}),Pc=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={...Nc(),...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=bc(a),a.then(a=>{if(!a)return i(null,{});let o=Sc(a,{lng:e.join(`+`),ns:n.join(`+`)});if(o==null){let t=e.map(gc).join(`, `),r=n.map(gc).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=gc(_c(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+`: `+gc(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=Sc(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)})})})}};Pc.type=`backend`;function Fc(e,t,n){return(t=Qs(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ic(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 Lc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ic(Object(n),!0).forEach(function(t){Fc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ic(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Rc=function(){function e(t){Ys(this,e),this.store=t.store}return ec(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 zc(){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 Bc=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ys(this,e),this.init(t,n),this.type=`backend`}return ec(e,[{key:`init`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.services=e,this.options=Lc(Lc(Lc({},zc()),this.options),t),this.storage=new Rc(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&&Xs(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=Lc(Lc({},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}}])}();Bc.type=`backend`;var Vc={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},Hc=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?("[^"]*"|'[^']*')/g;function Uc(e){let t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(Vc[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(Hc),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 Wc=/<!--[\s\S]*?-->|<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Gc=/<\/?([^\s]+?)[/\s>]/,Kc=/^\s*$/,qc=/^(script|style)$/i,Jc=`\0`,Yc=Object.create(null);function Xc(e){e.forEach(function(e){if(e.type===`text`){e.content=e.content.split(Jc).join(`<`);return}if(e.type===`comment`){e.comment=e.comment.split(Jc).join(`<`);return}for(let t in e.attrs){let n=e.attrs[t];typeof n==`string`&&n.indexOf(Jc)>-1&&(e.attrs[t]=n.split(Jc).join(`<`))}e.children.length&&Xc(e.children)})}function Zc(e,t){let n=t&&t.components||Yc,r=t&&t.allowedTags,i=!1;if(r){let t=typeof r==`function`?r:function(e){return r.indexOf(e)>-1},n=``,a=0;Wc.lastIndex=0;let o;for(;o=Wc.exec(e);){let r=o[0];n+=e.slice(a,o.index);let s=r.match(Gc);r.startsWith(`<!--`)||s&&t(s[1])?(n+=r,a=o.index+r.length):(i=!0,n+=Jc,a=o.index+1,Wc.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=Wc.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=Uc(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=Uc(i),s.type===`tag`&&n[s.name]&&(s.type=`component`,l=!0);let t=!1;if(!l&&!s.voidElement&&qc.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);Kc.test(n)&&(n=` `),(t>-1&&c+b.length>=0||n!==` `)&&b.push({type:`text`,content:n})}}),i&&Xc(a),a}function Qc(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 $c(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?Qc(t.attrs):``)+n,t.voidElement?e:e+t.children.reduce($c,``)+`</`+t.name+`>`}case`comment`:return e+=`<!--`+t.comment+`-->`,e}}function el(e){return e.reduce(function(e,t){return e+$c(``,t)},``)}var tl={parse:Zc,stringify:el},nl=(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);al(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},rl={},il=(e,t,n,r)=>{al(n)&&rl[n]||(al(n)&&(rl[n]=new Date),nl(e,t,n,r))},al=e=>typeof e==`string`,ol=e=>typeof e==`object`&&!!e,sl=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,cl={"&":`&`,"&":`&`,"<":`<`,"<":`<`,">":`>`,">":`>`,"'":`'`,"'":`'`,""":`"`,""":`"`," ":` `," ":` `,"©":`©`,"©":`©`,"®":`®`,"®":`®`,"…":`…`,"…":`…`,"/":`/`,"/":`/`},ll=e=>cl[e],ul=e=>e.replace(sl,ll),dl={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:ul,transDefaultProps:void 0},fl=(e={})=>{dl={...dl,...e}},pl=()=>dl,ml,hl=e=>{ml=e},gl=()=>ml,_l=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},vl=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?bl(t):t},yl=t=>Array.isArray(t)&&t.every(e.isValidElement),bl=e=>Array.isArray(e)?e:[e],xl=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},Sl=t=>{let n={};if(!t)return n;let r=t=>{bl(t).forEach(t=>{al(t)||(_l(t)?r(vl(t)):ol(t)&&!(0,e.isValidElement)(t)&&Object.assign(n,t))})};return r(t),n},Cl=(t,n,r,i)=>{if(!t)return``;let a=``,o=bl(t),s=n?.transSupportBasicHtmlNodes?n.transKeepBasicHtmlNodesFor??[]:[];return o.forEach((t,o)=>{if(al(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=al(d)?d:Cl(d,n,r,i);a+=`<${c}>${e}</${c}>`;return}let f=Cl(d,n,r,i);a+=`<${o}>${f}</${o}>`;return}if(t===null){nl(r,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:i});return}if(ol(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}nl(r,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:i,child:t});return}nl(r,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:i,child:t})}),a},wl=(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=>{bl(t).forEach(t=>{al(t)||(_l(t)?d(vl(t)):ol(t)&&!(0,e.isValidElement)(t)&&Object.assign(u,t))})};d(t);let f=Object.keys(u),p=tl.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=vl(e),i=_(r,t.children,n);return yl(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=bl(t),d=bl(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];al(t)&&(y[e]=ul(t))});let b=Object.keys(y).length===0?v:xl({props:y},v),x=(0,e.isValidElement)(b),S=x&&_l(r,!0)&&!r.voidElement,C=l&&ol(b)&&b.dummy&&!x,w=ol(n)&&Object.hasOwnProperty.call(n,r.name);if(al(b)){let e=i.services.interpolator.interpolate(b,m,i.language);t.push(e)}else if(_l(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?bl(vl(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(ol(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:pl().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 vl(_([{dummy:!0,children:t||[]}],p,bl(t||[]))[0])},Tl=(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})},El=(e,t)=>e.map((e,n)=>Tl(e,n,t)),Dl=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:Tl(e[r],r,t)})}),n},Ol=(e,t,n,r)=>e?Array.isArray(e)?El(e,t):ol(e)?Dl(e,t):(il(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,kl=e=>!ol(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function Al({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||gl();if(!h)return il(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),_={...pl(),...h.options?.react},v=u||g.ns||h.options?.defaultNS;v=al(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=Cl(t,_,h,i),T=c||b?.defaultValue||w||_.transEmptyNodeValue||(typeof i==`function`?ks(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=Sl(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=Ol(C,j,h,i),N=M||t,P=null;kl(M)&&(P=M,N=t);let F=wl(N,P,j,h,_,A,x),ee=r??_.defaultTransParent;return ee?(0,e.createElement)(ee,m,F):F}var jl={type:`3rdParty`,init(e){fl(e.options.react),hl(e)}},Ml=(0,e.createContext)();function Nl({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)(Ml)||{},_=d||h||gl(),v=f||_?.t.bind(_);return Al({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 Pl={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 Fl(){let e=document.documentElement.getAttribute(`lang`)||`en`;return(Pl[e.toLowerCase()]||Pl[e.split(`-`)[0]]||Pl.en)?.locale||`en_US`}function Il(){return window.wcpos?.translationVersion||`0.1.0`}function Ll({namespace:t,project:n,resources:r}){let i=Z.createInstance(),a=Fl(),o=Il(),s={lng:a,fallbackLng:`en`,ns:[t],defaultNS:t,keySeparator:!1,nsSeparator:!1,interpolation:{escapeValue:!1,prefix:`{`,suffix:`}`},backend:{backends:[Bc,Pc],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(lc).use(jl).init(s).then(()=>i),t:i.t.bind(i),Trans:n=>(0,e.createElement)(Nl,{...n,i18n:i,ns:t})}}var{i18n:Rl,i18nPromise:zl,t:Q,Trans:Bl}=Ll({namespace:`wp-admin-settings`,project:`woocommerce-pos`,resources:{en:{"wp-admin-settings":{"cloudflare.title":`Your store is behind Cloudflare`,"cloudflare.body":`Cloudflare's security checks (Bot Fight Mode, Under Attack Mode and WAF challenges) can stop the WCPOS app from reaching your store's REST API. If the app reports "This store's hosting setup is blocking the app" (HOST121) or opens a security-check window, the fix is in your Cloudflare dashboard: a WAF Skip rule for /wp-json/, or turning off Bot Fight Mode, which no rule can bypass.`,"cloudflare.plugin_note":`The Cloudflare WordPress plugin does not manage these rules. They live in the Cloudflare dashboard.`,"cloudflare.docs_link":`How to add the rule`,"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_v2":`Allow anonymous usage data and error reports`,"settings.allow_anonymous_usage_data_tip_v3":`Help us find bugs and make WCPOS better by sharing anonymous information about your setup, how you use the plugin, and what goes wrong — in the app or on your server.`,"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 Vl(e){return(0,_.jsx)(ho,{dismissLabel:Q(`common.dismiss`),...e})}function Hl({error:e,resetErrorBoundary:t}){let n=(0,r.get)(e,`message`,`Unknown error`);return(0,_.jsx)(`div`,{className:`wcpos:p-4`,children:(0,_.jsx)(Vl,{status:`error`,onRemove:t,children:(0,_.jsxs)(`p`,{children:[Q(`common.something_went_wrong`),`: `,(0,_.jsx)(`code`,{children:n})]})})})}var Ul=e.createContext({notice:null,setNotice:()=>{}});function Wl({children:t}){let[n,r]=e.useState(null);return(0,_.jsx)(Ul.Provider,{value:{notice:n,setNotice:r},children:t})}var Gl=()=>e.useContext(Ul);function Kl(){return window?.wcpos?.posthog}function ql(e,t={}){Kl()?.capture?.(e,t)}function Jl(e){let t=Kl();if(t){if(e===`allowed`){t.opt_in_capturing?.();return}t.opt_out_capturing?.(),t.reset?.()}}function Yl(e){ql(`upgrade_cta_viewed`,{placement:e})}function Xl(e,t){ql(`pro_link_clicked`,{placement:e,destination:t})}function Zl(e){e&&ql(`settings_section_viewed`,{section:e})}function Ql(){ql(`license_activate_attempted`)}function $l(e){ql(`license_activate_succeeded`,e?{license_tier:e}:{})}function eu(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 tu(e){ql(`license_activate_failed`,{reason:eu(e)})}var nu=new He({defaultOptions:{queries:{staleTime:6e5}}});typeof window<`u`&&(window.wcpos=window.wcpos||{},window.wcpos.queryClient=nu);var ru=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`})}),iu=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`})}),au=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 ou(){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:Q(`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)(ru,{fill:`#6b7280`})}),Q(`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)(iu,{fill:`#6b7280`})}),Q(`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)(au,{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 su({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 cu({to:e,label:t,badge:n,onClick:r}){let i=ja()({to:e});return(0,_.jsxs)(ua,{to:e,onClick:r,"data-testid":`settings-nav-${e.replace(/^\//,``)}`,className:(0,V.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)(q,{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)(q,{variant:`critical`,shape:`round`,size:`xs`,children:e}),t>0&&(0,_.jsx)(q,{variant:`warning`,shape:`round`,size:`xs`,children:t})]})})()]})}var lu=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 `})]})]}),uu=window?.wcpos?.settings?.updateExtensionsCount??null,du=new Set;function fu(){for(let e of du)e()}function pu(e){return du.add(e),()=>du.delete(e)}function mu(){return uu}function hu(){return(0,e.useSyncExternalStore)(pu,mu)}function gu(e){uu=e,fu()}var _u=window?.wcpos?.settings?.unreadLogCounts??{error:0,warning:0},vu=new Set;function yu(){for(let e of vu)e()}function bu(e){return vu.add(e),()=>vu.delete(e)}function xu(){return _u}function Su(){return(0,e.useSyncExternalStore)(bu,xu)}async function Cu(){let e={..._u};_u={error:0,warning:0},yu();try{await(0,i.default)({path:`wcpos/v1/logs/mark-read?wcpos=1`,method:`POST`})}catch{_u=e,yu()}}var wu=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},Tu=(e=>e?wu(e):wu),Eu=e=>e;function Du(e,t=Eu){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 Ou=Tu((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:Ou.getState().registerPage,registerField:Ou.getState().registerField,modifyField:Ou.getState().modifyField,registerComponent:Ou.getState().registerComponent,getComponent:Ou.getState().getComponent});function ku(t){let n=Du(Ou,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 Au({isOpen:e,onNavItemClick:t}){let n=ku(`tools`),r=ku(`account`),i=hu(),a=Su();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)(lu,{})}),(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)(su,{heading:Q(`common.settings`),children:[(0,_.jsx)(cu,{to:`/general`,label:Q(`common.general`),onClick:t}),(0,_.jsx)(cu,{to:`/checkout`,label:Q(`common.checkout`),onClick:t}),(0,_.jsx)(cu,{to:`/cloud-print`,label:Q(`common.cloud_print`,`Cloud Print`),onClick:t}),(0,_.jsx)(cu,{to:`/access`,label:Q(`common.access`),onClick:t}),(0,_.jsx)(cu,{to:`/sessions`,label:Q(`sessions.sessions`),onClick:t}),(0,_.jsx)(cu,{to:`/extensions`,label:Q(`common.extensions`,`Extensions`),badge:i??void 0,onClick:t})]}),(0,_.jsxs)(su,{heading:Q(`common.tools`,`Tools`),children:[(0,_.jsx)(cu,{to:`/logs`,label:Q(`common.logs`,`Logs`),badge:a,onClick:t}),n.map(e=>(0,_.jsx)(cu,{to:`/${e.id}`,label:e.label,onClick:t},e.id))]}),(0,_.jsxs)(su,{heading:Q(`common.account`,`Account`),children:[(0,_.jsx)(cu,{to:`/license`,label:Q(`common.license`),onClick:t}),r.map(e=>(0,_.jsx)(cu,{to:`/${e.id}`,label:e.label,onClick:t},e.id))]})]})]})}function ju({rows:e=5}){return(0,_.jsx)(`div`,{className:`wcpos:pb-4 wcpos:mb-4`,role:`status`,"aria-label":Q(`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)(G,{className:`wcpos:h-4`,width:`${60+t*17%40}%`})}),(0,_.jsx)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:(0,_.jsx)(G,{className:`wcpos:h-5`,width:t%2==0?`200px`:`${40+t*23%30}%`})})]},t))})})}function Mu({cards:e=4}){return(0,_.jsxs)(`div`,{role:`status`,"aria-label":Q(`common.loading`),children:[(0,_.jsx)(`div`,{className:`wcpos:mb-4`,children:(0,_.jsx)(G,{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)(G,{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)(G,{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)(G,{className:`wcpos:h-4`,width:`60%`}),(0,_.jsx)(G,{className:`wcpos:h-3`,width:`40%`})]})]}),(0,_.jsx)(G,{className:`wcpos:h-3`,width:`90%`}),(0,_.jsx)(G,{className:`wcpos:h-3`,width:`70%`})]},t))})]})}function Nu({rows:e=8}){return(0,_.jsxs)(`div`,{role:`status`,"aria-label":Q(`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)(G,{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)(G,{className:`wcpos:h-5 wcpos:rounded wcpos:shrink-0`,width:`55px`}),(0,_.jsx)(G,{className:`wcpos:h-3 wcpos:shrink-0`,width:`130px`}),(0,_.jsx)(G,{className:`wcpos:h-3 wcpos:flex-1`,width:`${50+t*19%40}%`})]},t))})]})}function Pu(){return(0,_.jsxs)(`div`,{role:`status`,"aria-label":Q(`common.loading`),children:[(0,_.jsx)(`div`,{className:`wcpos:p-4`,children:(0,_.jsx)(G,{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)(G,{className:`wcpos:h-9 wcpos:rounded`},t))})}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(G,{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)(G,{className:`wcpos:h-4 wcpos:w-4 wcpos:rounded wcpos:shrink-0`}),(0,_.jsx)(G,{className:`wcpos:h-3`,width:`${60+t*17%30}%`})]},t))})]})]})]})}function Fu(){return(0,_.jsxs)(`div`,{className:`wcpos:p-4`,role:`status`,"aria-label":Q(`common.loading`),children:[(0,_.jsx)(G,{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)(G,{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)(G,{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)(G,{className:`wcpos:h-4`,width:`60%`}),(0,_.jsx)(G,{className:`wcpos:h-3`,width:`40%`})]}),(0,_.jsx)(G,{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)(G,{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)(G,{className:`wcpos:h-5`,width:`40%`}),(0,_.jsx)(G,{className:`wcpos:h-3`,width:`30%`})]}),(0,_.jsx)(G,{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)(G,{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)(G,{className:`wcpos:h-4`,width:`50%`}),(0,_.jsx)(G,{className:`wcpos:h-3`,width:`70%`}),(0,_.jsx)(G,{className:`wcpos:h-8 wcpos:rounded wcpos:mt-2`,width:`100%`})]}),(0,_.jsx)(G,{className:`wcpos:h-7 wcpos:rounded`,width:`80px`})]},t))]})]})]})}function Iu(){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":Q(`common.loading`),children:[(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:sm:justify-end`,children:(0,_.jsx)(G,{className:`wcpos:h-4`,width:`90px`})}),(0,_.jsx)(`div`,{children:(0,_.jsx)(G,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`})}),(0,_.jsx)(`div`,{children:(0,_.jsx)(G,{className:`wcpos:h-9 wcpos:rounded`,width:`90px`})})]})}var Lu={"/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`},Ru={"/general":(0,_.jsx)(ju,{rows:5}),"/checkout":(0,_.jsx)(ju,{rows:4}),"/cloud-print":(0,_.jsx)(ju,{rows:4}),"/access":(0,_.jsx)(Pu,{}),"/sessions":(0,_.jsx)(Fu,{}),"/extensions":(0,_.jsx)(Mu,{cards:4}),"/logs":(0,_.jsx)(Nu,{rows:8}),"/license":(0,_.jsx)(Iu,{})};function zu(){let{notice:t,setNotice:n}=Gl(),[r,i]=e.useState(!1),a=La(),o=Q(Lu[a.pathname]||`common.settings`);return(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:flex wcpos:bg-white`,children:[(0,_.jsx)(Au,{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)(Vl,{status:t.type,onRemove:()=>n(null),children:t.message})}),(0,_.jsx)(Ba,{FallbackComponent:Hl,children:(0,_.jsx)(e.Suspense,{fallback:Ru[a.pathname]||(0,_.jsx)(ju,{}),children:(0,_.jsx)(Ea,{})})})]}),(0,_.jsx)(ou,{})]})]})}var Bu=[{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 Vu(e){let t={};return Object.entries(e||{}).forEach(([e,n])=>{Object.keys(n||{}).forEach(n=>{t[n]=e})}),t}function Hu(e){let t=Vu(e);return Bu.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 Uu(e,t){return e.reduce((e,{group:n,name:r})=>(e[n]||(e[n]={}),e[n][r]=t,e),{})}function Wu(e){return(0,_.jsx)(ro,{loadingLabel:Q(`common.loading`),noResultsLabel:Q(`common.no_results`),...e})}var Gu=e=>{let t=y(),{addSnackbar:n}=Fo(),{setNotice:a}=Gl(),o=`wcpos/v1/settings/${e}?wcpos=1`,{data:s}=rt({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:it({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}},Ku={wcpos:`WCPOS`,wc:`WooCommerce`,wp:`WordPress`};function qu(){let{data:t,mutate:n}=Gu(`access`),[i,a]=e.useState(`administrator`),[o,s]=e.useState(!1),c=(0,r.get)(t,[i,`capabilities`],null),l=e.useMemo(()=>c?Hu(c):[],[c]),u=e.useCallback((e,t)=>{n({[i]:{capabilities:Uu(e,t)}})},[n,i]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`wcpos:p-4`,children:(0,_.jsxs)(Vl,{status:`info`,isDismissible:!1,children:[(0,_.jsx)(Bl,{i18nKey:`access.default_roles_warning`,components:{strong:(0,_.jsx)(`strong`,{})}}),`\xA0`,(0,_.jsx)(Bl,{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,V.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:Q(`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)(Ga,{"data-testid":`access-task-${e.id}`,label:Q(e.labelKey),checked:n,indeterminate:r,onChange:()=>{u(t,!n)}}),r&&(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:Q(`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,V.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:Q(`access.advanced_title`)}),` `,(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:Q(`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:Q(`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:Ku[t]||t}),(0,_.jsx)(`div`,{children:(0,r.map)(e,(e,r)=>(0,_.jsx)(Ga,{label:r,checked:e,disabled:i===`administrator`&&r===`read`,onChange:e=>{n({[i]:{capabilities:{[t]:{[r]:e.target.checked}}}})}},r))})]},t))]})]})]})]})]})}function Ju(e){if(Array.isArray(e))return e}function Yu(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 Xu(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 Zu(e,t){if(e){if(typeof e==`string`)return Xu(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)?Xu(e,t):void 0}}function Qu(){throw TypeError(`Invalid attempt to destructure non-iterable instance. |
| 6 |
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 sf(e,t){if(e){if(typeof e==`string`)return cf(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)?cf(e,t):void 0}}function cf(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 lf(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 uf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?lf(Object(n),!0).forEach(function(t){Fc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function df(){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=uf({},r);e.add(i),n(i);function a(){e.delete(i),t&&t.active.delete(i)}return cd(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=of(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 ff(e){var t=e.typeKey,n=e.mount,r=e.dispatchEventToSource,i=e.onPostDispatch,a=e.defaultDropEffect,o=df(),s=af({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;Kd.start({event:t,dragType:n,getDropTargetsOver:s.getIsOver,dispatchEvent:c})}function u(){function e(){return n({canStart:Kd.canStart,start:l})}return Yd({typeKey:t,mount:e})}return{registerUsage:u,dropTarget:s.dropTargetForConsumers,monitor:o.monitorForConsumers}}var pf=cd(function(){return navigator.userAgent.toLocaleLowerCase().includes(`android`)}),mf=`pdnd:android-fallback`,hf=`text/plain`,gf=`application/vnd.pdnd`,_f=new WeakMap;function vf(e){return _f.set(e.element,e),function(){_f.delete(e.element)}}var yf=Sd(),bf=ff({typeKey:`element`,defaultDropEffect:`move`,mount:function(e){return Xd(yf.bindEvents(),(0,nd.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=_f.get(n);if(r){var i=Fd(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=ad({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=$u(l[c],2),d=u[0],f=u[1];t.dataTransfer.setData(d,f??``)}pf()&&!t.dataTransfer.types.includes(`text/plain`)&&!t.dataTransfer.types.includes(`text/uri-list`)&&t.dataTransfer.setData(hf,mf),t.dataTransfer.setData(gf,``);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=_f.get(i.source.element))==null||(n=t[r])==null||n.call(t,i)},onPostDispatch:yf.getOnPostDispatch()}),xf=bf.dropTarget,Sf=bf.monitor;function Cf(e){return cd(Xd(bf.registerUsage(),vf(e),Zd(e.element,{attribute:`draggable`,value:`true`})))}function wf(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 Tf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?wf(Object(n),!0).forEach(function(t){Fc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ef={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 Df(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:Ef[e](o,a)}}).sort(function(e,t){return e.value-t.value})[0]?.edge??null;return Tf(Tf({},e),{},Fc({},kf,s))}function Of(e){return e[kf]??null}var kf=Symbol(`closestEdge`);function Af(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=$u(i.splice(n,1),1)[0];return i.splice(r,0,a),i}function jf(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 Mf(e){var t=e.list,n=e.startIndex,r=e.closestEdgeOfTarget,i=e.indexOfTarget,a=e.axis;return Af({list:t,startIndex:n,finishIndex:jf({closestEdgeOfTarget:r,startIndex:n,indexOfTarget:i,axis:a})})}function Nf({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)(io,{open:!0,onClose:()=>r(),title:t.title,className:`wcpos:max-w-md`,children:[(0,_.jsx)(Vl,{status:`info`,isDismissible:!1,children:(0,_.jsx)(Bl,{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:Q(`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:Q(`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)(H,{onClick:r,children:Q(`common.cancel`)}),(0,_.jsx)(H,{variant:`primary`,onClick:l,children:Q(`common.save`)})]})]})}function Pf({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)(W,{options:a||[],value:t,onChange:({value:e})=>{n(String(e))},disabled:r})}var Ff=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`})}),If=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 Lf({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=Cf({element:e,dragHandle:r,getInitialData:()=>({id:t.id,index:n}),onDragStart:()=>u(!0),onDrop:()=>u(!1)}),a=xf({element:e,getData:({input:e,element:r})=>Df({id:t.id,index:n},{element:r,input:e,allowedEdges:[`top`,`bottom`]}),onDragEnter:({self:e})=>f(Of(e.data)),onDrag:({self:e})=>f(Of(e.data)),onDragLeave:()=>f(null),onDrop:()=>f(null)});return()=>{i(),a()}},[t.id,n]),(0,_.jsxs)(Bo,{ref:s,className:(0,V.default)(`wcpos:relative`,l&&`wcpos:opacity-50`,n%2!=0&&`wcpos:bg-gray-50`),children:[d&&(0,_.jsx)(Y,{colSpan:7,className:(0,V.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)(Y,{ref:c,className:`wcpos:pl-3 wcpos:pr-1 wcpos:whitespace-nowrap wcpos:cursor-grab wcpos:w-8`,children:(0,_.jsx)(Ff,{className:`wcpos:w-5 wcpos:h-5 wcpos:text-gray-400 wcpos:fill-current`})}),(0,_.jsx)(Y,{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)(Y,{className:`wcpos:text-ellipsis wcpos:overflow-hidden wcpos:whitespace-nowrap`,children:(0,_.jsx)(`strong`,{children:t.title})}),(0,_.jsx)(Y,{className:`wcpos:whitespace-nowrap`,children:t.id}),(0,_.jsx)(Y,{className:`wcpos:whitespace-nowrap wcpos:text-center`,children:(0,_.jsx)(Wa,{"aria-label":t.title,checked:t.enabled,onChange:()=>{i({gateways:{[t.id]:{enabled:!t.enabled}}})},disabled:!a&&![`pos_cash`,`pos_card`].includes(t.id)})}),(0,_.jsx)(Y,{className:`wcpos:whitespace-nowrap`,children:(0,_.jsx)(Pf,{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)(Y,{className:`wcpos:whitespace-nowrap wcpos:text-right`,children:(0,_.jsxs)(so,{label:t.title,trigger:(0,_.jsx)(`span`,{className:(0,V.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":Q(`common.settings`),children:(0,_.jsx)(If,{className:`wcpos:w-4 wcpos:h-4 wcpos:fill-current`})}),children:[(0,_.jsx)(co,{onSelect:()=>o(t),disabled:!a&&![`pos_cash`,`pos_card`].includes(t.id),children:Q(`common.pos_settings`)}),![`pos_cash`,`pos_card`].includes(t.id)&&(0,_.jsx)(co,{href:`admin.php?page=wc-settings&tab=checkout§ion=${t.id}`,children:Q(`common.woocommerce_settings`)})]})})]})}function Rf(){let{data:t,mutate:n}=Gu(`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(()=>Sf({onDrop:({source:e,location:t})=>{let i=t.current.dropTargets[0];if(!i)return;let a=e.data.index,o=i.data.index,s=Of(i.data),c=Mf({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||Yl(`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)(Vl,{status:`info`,isDismissible:!1,children:[Q(`checkout.enable_pro_gateways`),` `,(0,_.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>Xl(`checkout_gateways`,`https://wcpos.com/pro`),children:Q(`common.upgrade_to_pro`)}),`.`]})}),(0,_.jsxs)(Io,{children:[(0,_.jsx)(Lo,{children:(0,_.jsxs)(zo,{children:[(0,_.jsx)(J,{scope:`col`}),(0,_.jsx)(J,{scope:`col`,className:`wcpos:text-center`,"data-testid":`gateways-th-default`,children:Q(`common.default`)}),(0,_.jsx)(J,{scope:`col`,"data-testid":`gateways-th-gateway`,children:Q(`common.gateway`)}),(0,_.jsx)(J,{scope:`col`,children:Q(`checkout.gateway_id`)}),(0,_.jsx)(J,{scope:`col`,className:`wcpos:text-center`,"data-testid":`gateways-th-enabled`,children:Q(`common.enabled`)}),(0,_.jsx)(J,{scope:`col`,children:Q(`checkout.order_status`)}),(0,_.jsx)(J,{scope:`col`})]})}),(0,_.jsx)(Ro,{children:l.map((e,r)=>(0,_.jsx)(Lf,{item:e,index:r,data:t,mutate:n,proEnabled:!!c,onEditGateway:u},e.id))})]}),i&&o&&(0,_.jsx)(Nf,{gateway:o,mutate:n,closeModal:()=>a(!1)})]})}function $({children:e,tip:t}){return(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[e,t&&(0,_.jsx)(ao,{text:t,children:(0,_.jsx)(`span`,{className:`wcpos:inline-flex wcpos:text-gray-300`,children:(0,_.jsx)(iu,{className:`wcpos:h-4 wcpos:w-4`,fill:`currentColor`})})})]})}var zf=[{key:`new_order`,label:`checkout.email_new_order`},{key:`cancelled_order`,label:`checkout.email_cancelled_order`},{key:`failed_order`,label:`checkout.email_failed_order`}],Bf=[{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`}],Vf=[{key:`new_order`,label:`checkout.email_new_order`}];function Hf({settingsKey:e,label:t,tip:n,emailTypes:r,data:i,mutate:a}){let o=i?.[e],s=o?.enabled??!1;return(0,_.jsxs)(K,{children:[(0,_.jsx)($,{tip:n,children:(0,_.jsx)(Wa,{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)(Ga,{checked:o?.[t]??!0,onChange:n=>{a({[e]:{[t]:n.target.checked}})},label:Q(n)},t))})]})}function Uf(){let{data:t,mutate:n}=Gu(`checkout`);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(yo,{children:[(0,_.jsx)(K,{children:(0,_.jsx)($,{tip:Q(`checkout.prevent_overselling_tip`),children:(0,_.jsx)(Wa,{checked:!!t?.prevent_overselling,onChange:e=>{n({prevent_overselling:e})},label:Q(`checkout.prevent_overselling`)})})}),(0,_.jsx)(Hf,{settingsKey:`admin_emails`,label:Q(`checkout.admin_emails`),tip:Q(`checkout.admin_emails_tip`),emailTypes:zf,data:t,mutate:n}),(0,_.jsx)(Hf,{settingsKey:`customer_emails`,label:Q(`checkout.customer_emails`),tip:Q(`checkout.customer_emails_tip`),emailTypes:Bf,data:t,mutate:n}),(0,_.jsx)(Hf,{settingsKey:`cashier_emails`,label:Q(`checkout.cashier_emails`),tip:Q(`checkout.cashier_emails_tip`),emailTypes:Vf,data:t,mutate:n})]}),(0,_.jsxs)(`div`,{className:`wcpos:px-4 wcpos:pb-5`,children:[(0,_.jsx)(`h2`,{className:`wcpos:text-base`,children:Q(`checkout.gateways`)}),(0,_.jsx)(`p`,{children:Q(`checkout.gateways_description`)}),(0,_.jsx)(Ba,{FallbackComponent:Hl,children:(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(Nu,{rows:3}),children:(0,_.jsx)(Rf,{})})})]})]})}var Wf={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 Gf(e,t){return Wf[t].templateEngines===`all`?e:e.filter(e=>e.engine===Wf[t].templateEngines)}var Kf=[`printnode`,`star-online`,`star-cloudprnt`,`epson-sdp`];function qf(e){switch(e){case`star-online`:return Q(`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 Q(`cloud_print.choice_star_desc`,`Star printer with CloudPRNT built in (mC-Print, TSP143IV…)`);case`epson-sdp`:return Q(`cloud_print.choice_epson_desc`,`Epson TM printer with Server Direct Print support`);default:return Q(`cloud_print.choice_printnode_desc`,`Use a regular USB / network thermal printer through a PrintNode account`)}}function Jf(e){switch(e){case`printnode`:return Q(`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 Q(`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 Q(`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 Q(`cloud_print.best_epson`,`Best if you have an Epson "intelligent" TM printer (TM-T88VI/VII, TM-m30III, TM-i series).`)}}function Yf(){return window.wpApiSettings?.root||`${window.location.origin}/wp-json/`}function Xf(e,t,n,r){let i=Wf[e].pollEndpoint,a=`${encodeURIComponent(t)}/${n}`;if(r)return`${r.replace(/\/$/,``)}/${a}/${i}`;let o=`${Yf()}wcpos/v1/print-jobs/${i}/${a}`;return`${o}${o.includes(`?`)?`&`:`?`}wcpos=1`}function Zf(e,t,n,r){return Xf(e,t,encodeURIComponent(n),r)}function Qf(e,t,n){return Xf(e,t,`••••`,n)}function $f({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)(H,{variant:`outline`,onClick:l,"data-testid":o,"aria-label":Q(`cloud_print.copy`,`Copy`),children:s?Q(`cloud_print.copied`,`Copied to clipboard`):Q(`cloud_print.copy`,`Copy`)})]})]})}function ep(){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)(ru,{fill:`currentColor`})}),Q(`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 tp({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:Q(`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:Q(`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)($f,{label:Q(`cloud_print.direct_url`,`Direct URL`),value:e,copyValue:t?e:void 0,valueTestId:`wizard-direct-url`,copyTestId:`wizard-copy-direct-url`})]})]})}function np({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,I]=e.useState(!1),[te,ne]=e.useState(null),L=e.useCallback(()=>{g(``),y(``),x(``),C(!1),T(null),D(null),k(null),j(!1),N(null),F(null),I(!1),ne(null)},[]),re=e.useRef(d);e.useEffect(()=>{if(!t){re.current=d;return}re.current!==d&&(L(),re.current=d)},[t,d,L]);let ie=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(Q(`cloud_print.printnode_no_printers`,`No printers found on this PrintNode account.`))}catch{k(null),N(Q(`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)}}},ae=async()=>{if(s){I(!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(Q(`cloud_print.star_online_no_devices`,`No devices found in this Star Online group.`))}catch{F(null),ne(Q(`cloud_print.star_online_fetch_failed`,`Couldn't list your Star Online devices. Check the CloudPRNT URL and API key.`))}finally{I(!1)}}},[oe,se]=e.useState(!1);if(t!==oe&&(se(t),t&&(n===`setup`&&r?(f(r.provider),u(2)):(f(null),u(0)),m(``),L())),!t)return null;let ce=d===`printnode`,le=d===`star-online`,ue=p.trim(),de=ue!==``&&(!ce||h.trim()!==``&&v.trim()!==``)&&(!le||h.trim()!==``&&b.trim()!==``&&v.trim()!==``),fe=async()=>{if(!d)return;let e={name:ue,provider:d};ce&&(e.printnode_api_key=h.trim(),e.printnode_printer_id=Number(v.trim())),le&&(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(Q(`cloud_print.create_failed`,`Couldn't create the printer. Please try again.`))}finally{C(!1)}},pe=l===2?Q(`cloud_print.connect_title`,`Connect your printer`):Q(`cloud_print.add_title`,`Add a cloud printer`),me=n===`setup`?r??null:E?.printer??null,he=n===`setup`&&r?r.provider:d,ge=he?Wf[he].isPolling:!1;return(0,_.jsx)(io,{open:t,onClose:()=>i(),title:pe,className:`wcpos:max-w-xl`,children:(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-4`,children:[w&&(0,_.jsx)(ho,{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:Q(`cloud_print.step_provider_q`,`What kind of printer are you connecting?`)}),Kf.map(e=>{let t=Wf[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:qf(e)}),(0,_.jsx)(`span`,{className:`wcpos:mt-1 wcpos:block wcpos:text-xs wcpos:text-gray-600`,children:Jf(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:Q(`cloud_print.printer_name`,`Printer name`)}),(0,_.jsx)(U,{"data-testid":`wizard-name-input`,value:p,placeholder:Q(`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:Q(`cloud_print.printer_name_help`,`A friendly name so you can recognise it later. The technical ID is created for you.`)})]}),ce&&(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:Q(`cloud_print.printnode_api_key`,`PrintNode API key`)}),(0,_.jsx)(U,{"data-testid":`wizard-printnode-api-key`,value:h,placeholder:Q(`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)(H,{variant:`outline`,"data-testid":`wizard-printnode-fetch`,disabled:h.trim()===``||A,loading:A,onClick:ie,children:Q(`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:Q(`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:Q(`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:Q(`cloud_print.printnode_printer_id`,`PrintNode printer ID`)}),(0,_.jsx)(U,{"data-testid":`wizard-printnode-printer-id`,type:`number`,value:v,onChange:e=>y(e.target.value)})]}),(0,_.jsx)(ho,{status:`info`,isDismissible:!1,children:Q(`cloud_print.printnode_note`,`Install the small PrintNode client on a computer next to the printer, then paste your account's API key. We'll list that account's printers next.`)})]}),le&&(0,_.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:Q(`cloud_print.star_cloudprnt_url`,`CloudPRNT URL`)}),(0,_.jsx)(U,{"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:Q(`cloud_print.star_api_key`,`Star Online API key`)}),(0,_.jsx)(U,{"data-testid":`wizard-star-api-key`,value:h,placeholder:Q(`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)(H,{variant:`outline`,"data-testid":`wizard-star-fetch`,disabled:h.trim()===``||b.trim()===``||ee,loading:ee,onClick:ae,children:Q(`cloud_print.star_fetch`,`Fetch my devices`)}),te&&(0,_.jsx)(`span`,{"data-testid":`wizard-star-fetch-error`,className:`wcpos:text-xs wcpos:text-red-600`,children:te})]})]}),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:Q(`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:Q(`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:Q(`cloud_print.star_device_id`,`AccessIdentifier`)}),(0,_.jsx)(U,{"data-testid":`wizard-star-device-id`,value:v,onChange:e=>y(e.target.value)})]})]})]}),l===2&&he&&(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-3`,children:ge?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{children:(0,_.jsx)(q,{variant:`success`,icon:`✓`,children:Q(`cloud_print.created`,`Printer created`)})}),n===`setup`?(0,_.jsx)(ho,{status:`info`,isDismissible:!1,children:Q(`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:Q(`cloud_print.poll_url_once_intro`,`Copy this address into your printer's setup screen. It contains a secret token and is shown in full only once.`)}),(()=>{let e=me;if(!e)return null;let t=c?.enabled&&c.printer_base_url?c.printer_base_url:void 0;if(n===`setup`)return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)($f,{label:Q(`cloud_print.poll_url`,`Poll URL`),help:Q(`cloud_print.poll_url_help`,`paste into the printer's "server URL"`),value:Qf(he,e.id,t),valueTestId:`wizard-poll-url`,copyTestId:`wizard-copy-url`}),t&&(0,_.jsx)(ep,{}),t&&(0,_.jsx)(tp,{url:Qf(he,e.id),copyable:!1})]});let r=E?.token??``;if(!r)return(0,_.jsx)(ho,{status:`warning`,isDismissible:!1,children:Q(`cloud_print.token_missing`,`This printer was created, but no setup token was returned. Remove and re-add it to get one.`)});let i=Zf(he,e.id,r,t);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)($f,{label:Q(`cloud_print.poll_url`,`Poll URL`),help:Q(`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)(ep,{}),t&&(0,_.jsx)(tp,{url:Zf(he,e.id,r),copyable:!0})]})})()]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{children:(0,_.jsx)(q,{variant:`success`,icon:`✓`,children:Q(`cloud_print.linked_provider`,`Linked to {provider}`,{provider:Wf[he].label})})}),(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700`,children:he===`star-online`?Q(`cloud_print.star_online_delivery`,`No URLs or tokens to copy — Star Online handles delivery.`):Q(`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)(H,{variant:`secondary`,"data-testid":`wizard-back`,onClick:()=>u(0),children:Q(`common.back`,`Back`)}),l===0&&(0,_.jsx)(H,{variant:`primary`,"data-testid":`wizard-continue`,disabled:!d,onClick:()=>u(1),children:Q(`common.continue`,`Continue`)}),l===1&&(0,_.jsx)(H,{variant:`primary`,"data-testid":`wizard-continue`,disabled:!de,loading:S,onClick:fe,children:Q(`common.continue`,`Continue`)}),l===2&&(0,_.jsx)(H,{variant:`primary`,"data-testid":`wizard-done`,onClick:()=>i(),children:Q(`common.done`,`Done`)})]})]})})}function rp(e){return e.store_id&&e.store_id>0?`store:${e.store_id}`:e.scope}function ip(e,t){let n=[{value:`every`,label:Q(`cloud_print.scope_every`,`every order`)},{value:`pos`,label:Q(`cloud_print.scope_pos`,`every in-store (POS) order`)},{value:`online`,label:Q(`cloud_print.scope_online`,`every online order`)}],r=e.map(e=>({value:`store:${e.id}`,label:Q(`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:Q(`cloud_print.scope_store_unknown`,`Unknown store (#{id})`,{id:t.store_id}),disabled:!0}),[...n,...r]}function ap(e,t){let n=e.map(({value:e,label:t})=>({value:e,label:t}));return n.some(e=>e.value===t)?n:[{value:t,label:t===``?Q(`cloud_print.rule_template_none`,`Choose a template…`):Q(`cloud_print.rule_template_unsupported`,`Unsupported template (#{id})`,{id:t}),disabled:!0},...n]}function op(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 sp=`edit.php?post_type=wcpos_template`;function cp(e,t){return e.find(e=>String(e.value)===String(t))?.label.length??0}function lp(e,t){return{width:`calc(${Math.max(cp(e,t),1)}ch + 3.5rem)`}}function up({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:Q(`cloud_print.rule_copies`,{count:n})}}),s=[{value:`paid`,label:Q(`cloud_print.trigger_paid`,`once it's paid`)},{value:`created`,label:Q(`cloud_print.trigger_created`,`as soon as it's created`)}],c=t=>e.find(e=>e.id===t)?.provider??`printnode`,l=e=>Gf(n,c(e)),u=(e,n)=>{i(t.map((t,r)=>r===e?{...t,...n}:t))},d=(e,t)=>{let n=l(t);return n.some(t=>t.value===e.template_id)?{printer_id:t}:{printer_id:t,template_id:n[0]?.value??``}},f=()=>{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`}])},p=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)(vo,{status:`info`,children:[`💡`,` `,Q(`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:[Q(`cloud_print.rules_subline_pre`,`Each rule prints the chosen template automatically when an order matches. Templates come from `),(0,_.jsx)(`a`,{href:sp,target:`_blank`,rel:`noreferrer`,children:Q(`cloud_print.templates_link`,`POS › Templates`)}),Q(`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:Q(`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=ip(r,e),i=rp(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:Q(`cloud_print.rule_print`,`Automatically print`)}),(0,_.jsx)(W,{inline:!0,"data-testid":`rule-scope-${t}`,"aria-label":Q(`cloud_print.rule_scope_label`,`Which orders to print`),className:`wcpos:max-w-full`,style:lp(n,i),value:i,options:n,onChange:({value:e})=>u(t,op(String(e)))}),(0,_.jsx)(`span`,{children:Q(`cloud_print.rule_to`,`to`)}),(0,_.jsx)(W,{inline:!0,"data-testid":`rule-printer-${t}`,"aria-label":Q(`cloud_print.rule_printer_label`,`Printer`),className:`wcpos:max-w-full`,style:lp(a,e.printer_id),value:e.printer_id,options:a,onChange:({value:n})=>u(t,d(e,String(n)))}),(0,_.jsx)(`span`,{children:Q(`cloud_print.rule_using`,`using the`)}),(0,_.jsx)(W,{inline:!0,"data-testid":`rule-template-${t}`,"aria-label":Q(`cloud_print.rule_template_label`,`Receipt template`),className:`wcpos:max-w-full`,style:lp(ap(l(e.printer_id),e.template_id),e.template_id),value:e.template_id,options:ap(l(e.printer_id),e.template_id),onChange:({value:e})=>u(t,{template_id:String(e)})}),(0,_.jsx)(`span`,{children:Q(`cloud_print.rule_template_suffix`,`template,`)}),(0,_.jsx)(W,{inline:!0,"data-testid":`rule-copies-${t}`,"aria-label":Q(`cloud_print.rule_copies_label`,`Number of copies`),className:`wcpos:max-w-full`,style:lp(o,e.copies??1),value:e.copies??1,options:o,onChange:({value:e})=>u(t,{copies:Number(e)})}),(0,_.jsx)(`span`,{children:Q(`cloud_print.rule_trigger_join`,`,`)}),(0,_.jsx)(W,{inline:!0,"data-testid":`rule-trigger-${t}`,"aria-label":Q(`cloud_print.rule_trigger_label`,`When to print`),className:`wcpos:max-w-full`,style:lp(s,e.trigger??`paid`),value:e.trigger??`paid`,options:s,onChange:({value:e})=>u(t,{trigger:e===`created`?`created`:`paid`})}),(0,_.jsx)(`span`,{children:Q(`cloud_print.rule_copies_suffix`,`.`)}),(0,_.jsx)(H,{variant:`ghost-destructive`,"data-testid":`rule-remove-${t}`,className:`wcpos:ml-1`,onClick:()=>p(t),children:Q(`common.remove`,`Remove`)})]},t)})}),(0,_.jsx)(`div`,{children:(0,_.jsx)(H,{variant:`outline`,"data-testid":`rules-add`,disabled:e.length===0,onClick:f,children:Q(`cloud_print.add_rule`,`+ Add rule`)})})]})}async function dp(e,t=i.default){return(await t({path:`wcpos/v1/printnode/printers?wcpos=1`,method:`POST`,data:{api_key:e}})).printers??[]}async function fp(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 pp=`wcpos/v1/templates?wcpos=1&type=receipt`;function mp(e=!1){let{data:t}=rt({queryKey:[`templates`,`receipt`],queryFn:()=>(0,i.default)({path:pp,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 hp(){let{data:t}=nt({queryKey:[`templates`,`receipt`],queryFn:()=>(0,i.default)({path:pp,method:`GET`})});return(0,e.useMemo)(()=>new Map((Array.isArray(t)?t:[]).map(e=>[String(e.id),e.title])),[t])}var gp=`wcpos/v1/print-jobs/queue`,_p=`print-queue`,vp=20,yp=3e4,bp=600,xp={pending:{label:()=>Q(`cloud_print.queue_status_waiting`,`Waiting`),variant:`warning`},claimed:{label:()=>Q(`cloud_print.queue_status_printing`,`Printing`),variant:`info`},printed:{label:()=>Q(`cloud_print.queue_status_printed`,`Printed`),variant:`success`},failed:{label:()=>Q(`cloud_print.queue_status_failed`,`Failed`),variant:`error`},cancelled:{label:()=>Q(`cloud_print.queue_status_cancelled`,`Cancelled`),variant:`neutral`}};function Sp(e){if(!e||e.startsWith(`0000`))return null;let t=new Date(`${e.replace(` `,`T`)}Z`);return Number.isNaN(t.getTime())?null:t}function Cp(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 wp(e){let t=Sp(e);return t?Cp(t):`—`}function Tp(e){return e.polling===!1||e.pending===0?!1:e.last_seen===0||Date.now()/1e3-e.last_seen>bp}function Ep(){let t=y(),n=hp(),[r,a]=e.useState(``),[o,s]=e.useState(``),[c,l]=e.useState(1),[u,d]=e.useState(new Set),{data:f}=nt({queryKey:[_p,r,o,c],queryFn:()=>(0,i.default)({path:`${gp}?wcpos=1&per_page=${vp}&page=${c}${r?`&printer_id=${encodeURIComponent(r)}`:``}${o?`&status=${encodeURIComponent(o)}`:``}`,method:`GET`}),refetchInterval:yp}),{addSnackbar:p}=Fo(),m=()=>{d(new Set),t.invalidateQueries({queryKey:[_p]})},h=()=>{p({message:Q(`cloud_print.queue_action_failed`,`That didn't work — the queue is unchanged. Try again.`),status:`error`})},g=it({mutationFn:e=>(0,i.default)({path:`${gp}/cancel?wcpos=1`,method:`POST`,data:e}),onSuccess:m,onError:h}),v=it({mutationFn:e=>(0,i.default)({path:`${gp}/delete?wcpos=1`,method:`POST`,data:{ids:e}}),onSuccess:m,onError:h}),b=it({mutationFn:e=>(0,i.default)({path:`wcpos/v1/print-jobs/${e}/reprint?wcpos=1`,method:`POST`}),onSuccess:m,onError:(e,n)=>{let r=e,i=r.data?.retried_to;if(r.code!==`wcpos_print_job_already_retried`||!i){h();return}d(new Set),t.setQueriesData({queryKey:[_p]},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:[_p]}),p({message:Q(`cloud_print.queue_retried_as`,`Retried as #{id}`,{id:String(i)}),status:`success`})}}),x=f?.total;if(e.useEffect(()=>{if(typeof x!=`number`)return;let e=Math.max(1,Math.ceil(x/vp));c>e&&l(e)},[x,c]),!f||!Array.isArray(f.jobs)||!f.summary)return null;let{jobs:S,total:C,summary:w}=f,T=new Map(w.printers.map(e=>[e.printer_id,e.name])),E=w.printers.filter(Tp),D=w.counts,O=Object.values(D).some(e=>e>0)||C>0,k=S.map(e=>e.id),A=k.length>0&&k.every(e=>u.has(e)),j=()=>{d(A?new Set:new Set(k))},M=e=>{let t=new Set(u);t.has(e)?t.delete(e):t.add(e),d(t)},N=S.filter(e=>u.has(e.id)&&(e.status===`pending`||e.status===`claimed`)).map(e=>e.id),P=Math.max(1,Math.ceil(C/vp)),F=(D.pending??0)+(D.claimed??0)+(D.failed_unresolved??D.failed??0),ee=[{label:Q(`cloud_print.queue_status_active`,`Needs attention ({count})`,{count:String(F)}),value:`active`},{label:Q(`cloud_print.queue_all_statuses`,`All statuses`),value:``},...[`pending`,`claimed`,`failed`,`printed`,`cancelled`].map(e=>({label:`${xp[e].label()} (${D[e]??0})`,value:e}))],I=[{label:Q(`cloud_print.queue_all_printers`,`All printers`),value:``},...w.printers.map(e=>({label:e.name,value:e.printer_id}))];return(0,_.jsxs)(yo,{title:Q(`cloud_print.queue_title`,`Print queue`),description:Q(`cloud_print.queue_description`,`Jobs across every status, including printed and cancelled.`),children:[E.map(e=>(0,_.jsx)(ho,{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?Q(`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)}):Q(`cloud_print.queue_stale`,`{printer} last fetched jobs {ago}. {count} receipts are waiting — check the printer is on and connected.`,{printer:e.name,ago:Cp(new Date(e.last_seen*1e3)),count:String(e.pending)})}),(0,_.jsx)(H,{variant:`ghost-destructive`,"data-testid":`queue-cancel-all-${e.printer_id}`,onClick:()=>g.mutate({printer_id:e.printer_id}),disabled:g.isPending,children:Q(`cloud_print.queue_cancel_all`,`Cancel all {count}`,{count:String(e.pending)})})]})},e.printer_id)),O?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2 wcpos:flex-wrap wcpos:mb-3`,children:[(0,_.jsx)(W,{id:`wcpos-queue-printer-filter`,inline:!0,className:`wcpos:w-44 wcpos:max-w-full`,"aria-label":Q(`cloud_print.queue_filter_printer`,`Filter by printer`),options:I,value:r,onChange:e=>{a(String(e.value)),l(1),d(new Set)}}),(0,_.jsx)(W,{id:`wcpos-queue-status-filter`,inline:!0,className:`wcpos:w-52 wcpos:max-w-full`,"aria-label":Q(`cloud_print.queue_filter_status`,`Filter by status`),options:ee,value:o,onChange:e=>{s(String(e.value)),l(1),d(new Set)}}),(0,_.jsx)(`div`,{className:`wcpos:flex-1`}),N.length>0&&(0,_.jsx)(H,{variant:`ghost-destructive`,"data-testid":`queue-cancel-selected`,onClick:()=>g.mutate({ids:N}),disabled:g.isPending,children:Q(`cloud_print.queue_cancel_selected`,`Cancel selected ({count})`,{count:String(N.length)})}),u.size>0&&(0,_.jsx)(H,{variant:`ghost-destructive`,"data-testid":`queue-delete-selected`,onClick:()=>v.mutate(Array.from(u)),disabled:v.isPending,children:Q(`cloud_print.queue_delete_selected`,`Delete selected ({count})`,{count:String(u.size)})})]}),S.length===0?(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,"data-testid":`queue-no-matches`,children:Q(`cloud_print.queue_no_matches`,`No jobs match this filter.`)}):(0,_.jsx)(`div`,{className:`wcpos:overflow-x-auto`,children:(0,_.jsxs)(Io,{"data-testid":`queue-table`,className:`wcpos:min-w-[52rem]`,children:[(0,_.jsx)(Lo,{children:(0,_.jsxs)(zo,{children:[(0,_.jsx)(J,{className:`wcpos:w-8`,children:(0,_.jsx)(`input`,{type:`checkbox`,checked:A,onChange:j,"aria-label":Q(`cloud_print.queue_select_all`,`Select all on this page`),"data-testid":`queue-select-all`})}),(0,_.jsx)(J,{className:`wcpos:w-28`,children:Q(`cloud_print.queue_col_order`,`Order`)}),(0,_.jsx)(J,{children:Q(`cloud_print.queue_col_printer`,`Printer`)}),(0,_.jsx)(J,{children:Q(`cloud_print.queue_col_template`,`Template`)}),(0,_.jsx)(J,{className:`wcpos:w-28`,children:Q(`cloud_print.queue_col_status`,`Status`)}),(0,_.jsx)(J,{children:Q(`cloud_print.queue_col_detail`,`Detail`)}),(0,_.jsx)(J,{className:`wcpos:w-32`,children:Q(`cloud_print.queue_col_created`,`Created`)}),(0,_.jsx)(J,{className:`wcpos:w-24`})]})}),(0,_.jsx)(Ro,{children:S.map(e=>{let t=xp[e.status]??xp.pending,r=wp(e.created_gmt),i=e.terminal_at?Cp(new Date(e.terminal_at*1e3)):``;return(0,_.jsxs)(Bo,{"data-testid":`queue-row-${e.id}`,children:[(0,_.jsx)(Y,{children:(0,_.jsx)(`input`,{type:`checkbox`,checked:u.has(e.id),onChange:()=>M(e.id),"aria-label":Q(`cloud_print.queue_select_job`,`Select job {id}`,{id:String(e.id)})})}),(0,_.jsx)(Y,{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:Q(`cloud_print.queue_no_order`,`Job {id}`,{id:String(e.id)})})}),(0,_.jsx)(Y,{children:T.get(e.printer_id)??e.printer_id}),(0,_.jsx)(Y,{className:`wcpos:text-gray-600`,children:n.get(e.template_id)??(e.template_id||`—`)}),(0,_.jsx)(Y,{children:(0,_.jsx)(q,{variant:t.variant,shape:`pill`,size:`sm`,children:t.label()})}),(0,_.jsx)(Y,{className:`wcpos:text-gray-600`,children:e.status===`failed`&&e.unconfirmed?(0,_.jsx)(`span`,{className:`wcpos:text-red-700`,"data-testid":`queue-error-${e.id}`,children:e.retried_to?Q(`cloud_print.queue_unconfirmed_retried`,`The printer never confirmed this job.`):Q(`cloud_print.queue_unconfirmed`,`The printer never confirmed this job. It was not re-sent automatically, which could print it twice — retry it if it did not print.`)}):e.status===`failed`&&e.error?(0,_.jsx)(`span`,{className:`wcpos:text-red-700`,"data-testid":`queue-error-${e.id}`,children:e.error}):e.status===`printed`&&i?Q(`cloud_print.queue_printed_ago`,`Printed {ago}`,{ago:i}):`—`}),(0,_.jsx)(Y,{className:`wcpos:tabular-nums wcpos:text-gray-600`,children:r}),(0,_.jsxs)(Y,{className:`wcpos:text-right`,children:[(e.status===`pending`||e.status===`claimed`)&&(0,_.jsx)(H,{variant:`ghost-destructive`,onClick:()=>g.mutate({ids:[e.id]}),disabled:g.isPending,"data-testid":`queue-cancel-${e.id}`,children:Q(`cloud_print.queue_cancel`,`Cancel`)}),e.status===`failed`&&e.retried_to?Q(`cloud_print.queue_retried_as`,`Retried as #{id}`,{id:String(e.retried_to)}):e.status===`failed`?(0,_.jsx)(H,{variant:`text`,onClick:()=>b.mutate(e.id),disabled:b.isPending,"data-testid":`queue-retry-${e.id}`,children:Q(`cloud_print.queue_retry`,`Retry`)}):null,(0,_.jsx)(H,{variant:`text`,onClick:()=>v.mutate([e.id]),disabled:v.isPending,"data-testid":`queue-delete-${e.id}`,"aria-label":Q(`cloud_print.queue_delete_job`,`Delete job {id}`,{id:String(e.id)}),children:Q(`cloud_print.queue_delete`,`Delete`)})]})]},e.id)})})]})}),P>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:Q(`cloud_print.queue_page_info`,`{from}–{to} of {total}`,{from:String((c-1)*vp+1),to:String(Math.min(c*vp,C)),total:String(C)})}),(0,_.jsx)(H,{variant:`outline`,onClick:()=>l(e=>Math.max(1,e-1)),disabled:c<=1,"aria-label":Q(`common.previous`,`Previous`),children:`‹`}),(0,_.jsx)(H,{variant:`outline`,onClick:()=>l(e=>Math.min(P,e+1)),disabled:c>=P,"aria-label":Q(`common.next`,`Next`),children:`›`})]})]}):(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,"data-testid":`queue-empty`,children:Q(`cloud_print.queue_empty`,`No print jobs yet.`)})]})}var Dp=`wcpos/v1/settings/cloud-print?wcpos=1`,Op=3e4;function kp(e,t){if(!t)switch(e){case`online`:return{variant:`success`,label:Q(`cloud_print.status_online`,`Online`)};case`offline`:return{variant:`error`,label:Q(`cloud_print.status_offline`,`Offline`)};default:return{variant:`info`,label:Q(`cloud_print.status_unknown`,`Unknown`)}}switch(e){case`connected`:return{variant:`success`,label:Q(`cloud_print.status_connected`,`Connected`)};case`waiting`:return{variant:`warning`,label:Q(`cloud_print.status_waiting`,`Waiting for printer`)};case`blocked`:return{variant:`error`,label:Q(`cloud_print.status_blocked`,`Blocked`)};default:return{variant:`error`,label:Q(`cloud_print.status_offline`,`Offline`)}}}async function Ap(){return await(0,i.default)({path:Dp,method:`GET`})}var jp=new Set,Mp,Np=!1;async function Pp(){if(!Np){Np=!0;try{let e=await Ap();jp.forEach(t=>t(e))}catch{}finally{Np=!1}}}function Fp(e){return jp.add(e),Mp===void 0&&(Mp=window.setInterval(()=>{Pp()},Op)),()=>{jp.delete(e),jp.size===0&&Mp!==void 0&&(window.clearInterval(Mp),Mp=void 0)}}function Ip(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(()=>Fp(e=>{let n=e.printers.find(e=>e.id===t.id);r({status:n?.status,statusDetail:n?.status_detail})}),[t.id]),n}function Lp({printer:e}){let t=Wf[e.provider],{status:n}=Ip(e),r=kp(n,t.isPolling);return(0,_.jsx)(q,{variant:r.variant,shape:`pill`,size:`sm`,"data-testid":`printer-card-status-${e.id}`,children:r.label})}function Rp({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)(If,{className:`wcpos:w-4 wcpos:h-4 wcpos:fill-current`})})}function zp({open:e,title:t,description:n,confirmLabel:r,cancelLabel:i,isSubmitting:a=!1,onConfirm:o,onClose:s}){return(0,_.jsx)(io,{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)(H,{variant:`secondary`,onClick:()=>{s(!1)},disabled:a,children:i||Q(`sessions.cancel`)}),(0,_.jsx)(H,{variant:`destructive`,onClick:o,disabled:a,children:r||Q(`sessions.confirm`)})]})})}function Bp(e){return e&&/^http-5/.test(e)?Q(`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.`):Q(`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 Vp(){return[{value:`pdf`,label:Q(`cloud_print.format_pdf`,`PDF (recommended)`)},{value:`raw`,label:Q(`cloud_print.format_raw`,`ESC/POS RAW — thermal templates only`)}]}var Hp=[[`year`,31536e3],[`month`,2592e3],[`day`,86400],[`hour`,3600],[`minute`,60],[`second`,1]];function Up(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 Hp)if(a>=t||e===`second`){let r=Math.round(n/t);return i.format(r,e)}return i.format(0,`second`)}function Wp(e){if(!e)return``;try{let t=new URL(e).pathname.match(/\/cloudprnt\/([^/]+)/);return t?decodeURIComponent(t[1]):``}catch{return``}}function Gp({printer:t,onRename:n,onRemove:r,onOpenSetup:a,onUpdate:o}){let{addSnackbar:s}=Fo(),c=Wf[t.provider],{status:l,statusDetail:u}=Ip(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:Q(`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:Q(`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?Q(`cloud_print.never`,`never`):Up(t.last_seen,Rl.language||void 0);return(0,_.jsxs)(lo,{"data-testid":`printer-card-${t.id}`,children:[(0,_.jsxs)(lo.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":Q(`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)(so,{align:`end`,label:Q(`cloud_print.printer_menu`,`Printer actions`),className:`wcpos:absolute wcpos:top-2 wcpos:right-2`,trigger:(0,_.jsx)(Rp,{label:Q(`cloud_print.printer_menu`,`Printer actions`),testId:`printer-card-menu-${t.id}`}),children:[(0,_.jsx)(co,{onSelect:()=>a(t),children:Q(`cloud_print.menu_setup`,`Setup & token`)}),(0,_.jsx)(co,{destructive:!0,onSelect:()=>b(!0),children:Q(`cloud_print.menu_remove`,`Remove printer`)})]})]}),(0,_.jsx)(`div`,{className:`wcpos:mt-2`,children:(0,_.jsx)(Lp,{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:Bp(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:Q(`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:Q(`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)(ao,{text:Q(`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":Q(`cloud_print.printer_id`,`Printer ID`),children:`ⓘ`})})]}),f&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:Q(`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||Wf[`star-online`].label}),(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:Q(`cloud_print.star_group`,`Group`)}),(0,_.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-group-${t.id}`,children:Wp(t.star_cloudprnt_url)||`—`}),(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:Q(`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:Q(`cloud_print.format`,`Print format`)}),(0,_.jsx)(`dd`,{className:`wcpos:text-gray-900`,children:(0,_.jsx)(W,{"data-testid":`printer-card-format-${t.id}`,"aria-label":Q(`cloud_print.format`,`Print format`),className:`wcpos:w-auto`,value:p,options:Vp(),onChange:({value:e})=>o(t.id,{printnode_format:e})})})]})]})]}),(0,_.jsx)(lo.Footer,{className:`wcpos:flex wcpos:justify-end`,children:(0,_.jsx)(H,{variant:`outline`,loading:g,disabled:g,onClick:T,"data-testid":`printer-card-test-${t.id}`,children:Q(`cloud_print.test_print`,`Test print`)})}),(0,_.jsx)(zp,{open:y,title:Q(`cloud_print.remove_title`,`Remove printer?`),description:Q(`cloud_print.remove_body`,`This printer will stop receiving jobs. You can add it again later.`),confirmLabel:Q(`common.remove`,`Remove`),cancelLabel:Q(`common.cancel`,`Cancel`),onConfirm:()=>{b(!1),r(t)},onClose:()=>b(!1)})]})}function Kp({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 qp=`wcpos/v1/settings/cloud-print?wcpos=1`;function Jp(){let e=y(),{data:t}=rt({queryKey:[`cloud-print`],queryFn:()=>(0,i.default)({path:qp,method:`GET`})});return{settings:t,save:it({mutationFn:e=>(0,i.default)({path:qp,method:`POST`,data:e}),onSuccess:t=>e.setQueryData([`cloud-print`],e=>({printers:t.printers,assignments:t.assignments,relay:t.relay??e?.relay}))}).mutateAsync}}var Yp=`wcpos/v1/print-jobs/relay/register?wcpos=1`;function Xp(){let e=y();return{register:it({mutationFn:()=>(0,i.default)({path:Yp,method:`POST`}),onSuccess:t=>e.setQueryData([`cloud-print`],e=>e&&{...e,relay:t})})}}function Zp(e){return e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:Q(`cloud_print.save_failed`,`Save failed.`)}var Qp=`cloud-print-save`;function $p(){let{settings:t,save:n}=Jp(),{register:r}=Xp(),i=mp(),a=window.wcpos?.settings?.cloudPrintStoreOptions,o=Array.isArray(a)?a:[],{addSnackbar:s}=Fo(),[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:Q(`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:Q(`cloud_print.saved`,`Saved`),status:`success`}),e}catch(e){let n=Zp(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)(vo,{status:`info`,title:Q(`cloud_print.intro_title`,`What is cloud printing?`),children:[(0,_.jsx)(`p`,{children:Q(`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:Q(`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:Q(`cloud_print.intro_li1`,`send every order straight to the kitchen printer, or`)}),(0,_.jsx)(`li`,{children:Q(`cloud_print.intro_li2`,`print a packing slip for every online sale.`)})]}),(0,_.jsxs)(`p`,{className:`wcpos:mt-2`,children:[Q(`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)(ru,{fill:`currentColor`})}),Q(`cloud_print.learn_more`,`Learn more`),(0,_.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})]})]}),(0,_.jsxs)(yo,{title:Q(`cloud_print.printers`,`Your cloud printers`),description:Q(`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:Q(`cloud_print.no_printers`,`No cloud printers yet.`)}):(0,_.jsx)(Kp,{"data-testid":`cloud-print-list`,children:c.printers.map(e=>(0,_.jsx)(Gp,{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)(H,{variant:`outline`,"data-testid":`cloud-print-add`,onClick:()=>d({open:!0,mode:`add`,printer:null}),children:Q(`cloud_print.add_a_printer`,`+ Add a printer`)})})]}),(0,_.jsx)(yo,{title:Q(`cloud_print.auto_print`,`Auto-print rules`),children:(0,_.jsx)(up,{printers:c.printers,assignments:c.assignments,templateOptions:i,storeOptions:o,onChange:w})}),(0,_.jsx)(Ep,{}),(0,_.jsx)(np,{open:u.open,mode:u.mode,setupPrinter:u.printer,onClose:()=>d(e=>({...e,open:!1})),onCreate:b,fetchPrintNodePrinters:dp,fetchStarDevices:fp,relay:T})]})}function em(){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 tm(e){try{let t=new URL(e).hostname.toLowerCase();return t===`github.com`||t===`www.github.com`}catch{return!1}}function nm(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 rm({extension:e}){let{homepage:t,installed_version:n,latest_version:r,status:i}=e;if((i===`update_available`||e.has_update)&&n){let e=nm(t,n),i=nm(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=nm(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 im({status:e}){switch(e){case`active`:return(0,_.jsx)(q,{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:Q(`extensions.active`,`Active`)});case`update_available`:return(0,_.jsx)(q,{variant:`warning`,children:Q(`extensions.update_available`,`Update available`)});case`inactive`:return(0,_.jsx)(q,{variant:`neutral`,children:Q(`extensions.inactive`,`Inactive`)});default:return null}}function am({extension:e}){return e.status===`not_installed`?(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-end`,children:(0,_.jsx)(ao,{text:Q(`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:Q(`extensions.install`,`Install`)})})})}):null}function om(){return window.wcpos?.settings?.getComponent?.(`extensions.action`)??null}function sm(e){let t=om();return t?(0,_.jsx)(t,{extension:e}):e.status===`not_installed`?(0,_.jsx)(am,{extension:e}):null}function cm({extension:e}){let t=(e.category||``).trim(),n=t?t.charAt(0).toUpperCase()+t.slice(1):null,r=sm(e),i=!!e.settings_url&&e.status!==`not_installed`,a=!!e.homepage&&tm(e.homepage),o=i||a;return(0,_.jsxs)(lo,{children:[(0,_.jsxs)(lo.Body,{className:`wcpos:relative wcpos:flex wcpos:gap-4`,children:[o&&(0,_.jsxs)(so,{label:e.name,className:`wcpos:absolute wcpos:top-2 wcpos:right-2`,trigger:(0,_.jsx)(Rp,{label:Q(`extensions.more_actions`,`More actions`)}),children:[i&&(0,_.jsx)(co,{href:e.settings_url,children:Q(`extensions.settings`,`Settings`)}),a&&(0,_.jsx)(co,{href:e.homepage,target:`_blank`,rel:`noopener noreferrer`,children:Q(`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)(em,{})}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[(0,_.jsx)(`h3`,{className:(0,V.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)(im,{status:e.status}),(0,_.jsx)(rm,{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)(lo.Footer,{children:r})]})}function lm(){let[t,n]=e.useState(``),[r,a]=e.useState(`all`),[o,s]=e.useState(!1),[c,l]=e.useState(!1),u=y(),{data:d=[]}=rt({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;gu(e)},[d]),e.useEffect(()=>{f||Yl(`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)(Vl,{status:`error`,isDismissible:!1,className:`wcpos:mb-4`,children:Q(`extensions.refresh_failed`,`Could not refresh extensions. Please try again.`)}),!f&&(0,_.jsxs)(Vl,{status:`info`,isDismissible:!1,className:`wcpos:mb-4`,children:[Q(`extensions.upgrade_to_pro`,`Upgrade to Pro to install and manage extensions.`),` `,(0,_.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>Xl(`extensions_screen`,`https://wcpos.com/pro`),children:Q(`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:Q(`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)(H,{variant:`secondary`,loading:o,onClick:p,children:o?Q(`extensions.refreshing`,`Refreshing...`):Q(`extensions.refresh`,`Refresh`)})]}),(0,_.jsx)(bo,{className:`wcpos:mb-6`,items:m.map(e=>({key:e,label:e===`all`?Q(`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:Q(`extensions.no_results`,`No extensions found.`)}):(0,_.jsx)(Kp,{children:h.map(e=>(0,_.jsx)(cm,{extension:e},e.slug))})]})}var{i18n:um,i18nPromise:dm,t:fm,Trans:pm}=Ll({namespace:`wp-admin-consent`,project:`woocommerce-pos`,resources:{en:{"wp-admin-consent":{"consent.modal_title":`Help us make WCPOS better`,"consent.modal_intro_v2":`WCPOS gets better when we can see what's working and what's breaking. If you're happy to, it can send us anonymous usage data and error reports — that's how we find bugs, fix them faster, and decide what to build next.`,"consent.callout_title":`Help us make WCPOS better`,"consent.callout_body_v2":`Can WCPOS send anonymous usage data and error reports so we can fix bugs and improve the product? No personal or customer data is ever included. 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 which environments to support and test.`,"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 build what people actually use.`,"consent.modal_errors_label":`When something breaks`,"consent.modal_errors_desc_v2":`what went wrong, in the app or in the WCPOS plugin on your server — the error and the versions involved — so we can spot bugs and ship fixes before you need to write in.`,"consent.modal_exclusions":`We never see 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 mm(e,t,n){let r=e?.[t];return typeof r==`string`&&r!==``?r:fm(n)}function hm({open:e,onClose:t,copy:n}){return(0,_.jsxs)(io,{open:e,onClose:t,title:mm(n,`title`,`consent.modal_title`),children:[(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700 wcpos:mb-3`,children:mm(n,`body`,`consent.modal_intro_v2`)}),(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700 wcpos:mb-2`,children:mm(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:fm(`consent.modal_setup_label`)}),` — `,fm(`consent.modal_setup_desc`)]}),(0,_.jsxs)(`li`,{children:[(0,_.jsx)(`strong`,{children:fm(`consent.modal_store_label`)}),` — `,fm(`consent.modal_store_desc`)]}),(0,_.jsxs)(`li`,{children:[(0,_.jsx)(`strong`,{children:fm(`consent.modal_usage_label`)}),` — `,fm(`consent.modal_usage_desc`)]}),(0,_.jsxs)(`li`,{children:[(0,_.jsx)(`strong`,{children:fm(`consent.modal_errors_label`)}),` — `,fm(`consent.modal_errors_desc_v2`)]})]}),(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-4`,children:mm(n,`privacy_note`,`consent.modal_exclusions`)}),(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:justify-end`,children:(0,_.jsx)(H,{onClick:t,children:fm(`consent.dismiss`)})})]})}function gm({selected:t,onSelect:n}){let r=e.useMemo(()=>(window?.wcpos?.settings?.barcodes??[]).map(e=>({value:e,label:e})),[]);return(0,_.jsx)(Wu,{value:t,options:r,onChange:e=>n(e||null),allowCustomValue:!0,createLabel:e=>Q(`settings.barcode_field_create`,{value:e}),noResultsLabel:Q(`settings.barcode_field_no_results`),"aria-label":Q(`settings.barcode_field`)})}var _m=`https://docs.wcpos.com/support/troubleshooting/cloudflare`;function vm(){let e=window.wcpos?.settings?.environment?.cloudflare;return e?.proxied===!0?(0,_.jsx)(`div`,{"data-testid":`cloudflare-callout`,className:`wcpos:mb-4`,children:(0,_.jsxs)(vo,{status:`info`,title:Q(`cloudflare.title`,`Your store is behind Cloudflare`),children:[(0,_.jsx)(`p`,{children:Q(`cloudflare.body`,`Cloudflare's security checks (Bot Fight Mode, Under Attack Mode and WAF challenges) can stop the WCPOS app from reaching your store's REST API. If the app reports "This store's hosting setup is blocking the app" (HOST121) or opens a security-check window, the fix is in your Cloudflare dashboard: a WAF Skip rule for /wp-json/, or turning off Bot Fight Mode, which no rule can bypass.`)}),e.plugin_active===!0&&(0,_.jsx)(`p`,{children:Q(`cloudflare.plugin_note`,`The Cloudflare WordPress plugin does not manage these rules. They live in the Cloudflare dashboard.`)}),(0,_.jsx)(`a`,{href:_m,target:`_blank`,rel:`noreferrer`,className:`wcpos:text-wp-admin-theme-color wcpos:underline`,children:Q(`cloudflare.docs_link`,`How to add the rule`)})]})}):null}var ym=`https://wcpos.com/pro`,bm=`general_store_details`,xm=`https://docs.wcpos.com/settings/wp-admin/store-tax-ids`;function Sm({data:t,mutate:n,storeDefaults:i}){return e.useEffect(()=>{Yl(bm)},[]),(0,_.jsxs)(yo,{title:Q(`settings.store_details_section_title`),description:Q(`settings.store_details_section_description`),divider:!0,children:[(0,_.jsxs)(vo,{status:`info`,title:Q(`settings.store_details_upgrade_callout_title`),className:`wcpos:mt-4`,children:[(0,_.jsx)(`p`,{className:`wcpos:m-0`,children:Q(`settings.store_details_upgrade_to_pro`)}),(0,_.jsx)(`p`,{className:`wcpos:mt-2 wcpos:mb-0`,children:(0,_.jsx)(`a`,{href:ym,target:`_blank`,rel:`noreferrer noopener`,onClick:()=>Xl(bm,ym),children:Q(`common.upgrade_to_pro`)})})]}),(0,_.jsx)(K,{label:Q(`settings.store_name`),children:(0,_.jsx)(U,{value:(0,r.isString)(t?.store_name)?t.store_name:``,placeholder:i.store_name,onChange:e=>n({store_name:e.target.value})})}),(0,_.jsx)(K,{label:Q(`settings.store_phone`),children:(0,_.jsx)(U,{value:(0,r.isString)(t?.store_phone)?t.store_phone:``,placeholder:i.store_phone,onChange:e=>n({store_phone:e.target.value})})}),(0,_.jsx)(K,{label:Q(`settings.store_email`),children:(0,_.jsx)(U,{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)(K,{label:Q(`settings.refund_returns_policy`),description:Q(`settings.refund_returns_policy_tip`),children:(0,_.jsx)(Ka,{rows:4,value:(0,r.isString)(t?.policies_and_conditions)?t.policies_and_conditions:``,placeholder:i.policies_and_conditions,onChange:e=>n({policies_and_conditions:e.target.value})})}),(0,_.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:Q(`settings.store_tax_ids_section_title`)}),(0,_.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-3`,children:[Q(`settings.store_tax_ids_section_description`),` `,(0,_.jsx)(`a`,{href:xm,target:`_blank`,rel:`noreferrer noopener`,className:`wcpos:text-wp-admin-theme-color wcpos:underline`,children:Q(`settings.store_tax_ids_learn_more`)})]}),(0,_.jsx)(es,{value:Array.isArray(t?.store_tax_ids)?t.store_tax_ids:null,onChange:e=>{n({store_tax_ids:e})},labels:{add:Q(`settings.store_tax_ids_add`),type:Q(`settings.store_tax_ids_type`),value:Q(`settings.store_tax_ids_value`),country:Q(`settings.store_tax_ids_country`),countryPlaceholder:Q(`settings.store_tax_ids_country_placeholder`),countrySearchPlaceholder:Q(`settings.store_tax_ids_country_search`),countryNoResults:Q(`settings.store_tax_ids_country_no_results`),countryClear:Q(`settings.store_tax_ids_country_none`),label:Q(`settings.store_tax_ids_label`),remove:Q(`settings.store_tax_ids_remove`),empty:Q(`settings.store_tax_ids_empty`)}})]})]})}function Cm({value:t,onChange:n}){let r=mp(!0),i=t!==``&&!r.some(e=>e.value===t),a=e.useMemo(()=>[{value:``,label:Q(`settings.storefront_receipt_template_active`)},...i?[{value:t,label:Q(`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)(W,{value:t,options:a,onChange:({value:e})=>n(String(e)),"aria-label":Q(`settings.storefront_receipt_template`)})}function wm({enabled:t,template:n,onChange:r}){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(K,{children:(0,_.jsx)($,{tip:Q(`settings.storefront_receipt_enabled_tip`),children:(0,_.jsx)(Wa,{checked:t,onChange:e=>r({storefront_receipt_enabled:e}),label:Q(`settings.storefront_receipt_enabled`)})})}),t&&(0,_.jsx)(K,{label:Q(`settings.storefront_receipt_template`),children:(0,_.jsx)($,{tip:Q(`settings.storefront_receipt_template_tip`),children:(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(G,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,_.jsx)(Cm,{value:n,onChange:e=>r({storefront_receipt_template:e})})})})})]})}var Tm={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`},Em={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`},Dm=`https://docs.wcpos.com/settings/wp-admin/customer-tax-ids`;function Om(e,t,n,r){return t&&t!==``?`override`:n&&n!==r?`plugin`:`default`}function km(e,t,n){return e&&e!==``?e:t||n}function Am({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:Q(`tax_ids.source_plugin`),default:Q(`tax_ids.source_built_in`),override:Q(`tax_ids.source_custom`)};return(0,_.jsx)(`span`,{className:(0,V.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 jm(){return(0,_.jsx)(`a`,{href:Dm,target:`_blank`,rel:`noreferrer noopener`,className:`wcpos:text-wp-admin-theme-color wcpos:underline`,children:Q(`tax_ids.learn_more`)})}function Mm({plugins:e,overrideCount:t}){let n=e.length>0,r=e.map(e=>Em[e]??e);return(0,_.jsx)(`div`,{className:(0,V.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,V.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?`✓ ${Q(`tax_ids.banner_auto_detected`)}`:Q(`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:Q(`tax_ids.banner_is_installed`)})]}),(0,_.jsxs)(`div`,{className:`wcpos:text-xs wcpos:text-gray-600 wcpos:mt-1`,children:[Q(`tax_ids.banner_detected_explainer`),t>0&&(0,_.jsxs)(_.Fragment,{children:[` `,Q(`tax_ids.banner_overrides_active`,{count:t})]})]})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`wcpos:font-medium`,children:Q(`tax_ids.banner_no_plugin_title`)}),(0,_.jsx)(`div`,{className:`wcpos:text-xs wcpos:text-gray-600 wcpos:mt-1`,children:Q(`tax_ids.banner_no_plugin_explainer`)})]})})]})})}function Nm({type:e,composed:t,defaultKey:n,override:r,suggestions:i,onCommit:a}){let o=km(r,t,n),s=Om(e,r,t,n);return(0,_.jsxs)(Bo,{className:(0,V.default)(s===`override`&&`wcpos:bg-amber-50/40`),children:[(0,_.jsx)(Y,{className:`wcpos:font-medium wcpos:text-gray-900`,children:Tm[e]??e}),(0,_.jsx)(Y,{className:`wcpos:font-mono wcpos:text-xs wcpos:text-gray-600`,children:o}),(0,_.jsx)(Y,{children:(0,_.jsx)(Am,{source:s})}),(0,_.jsx)(Y,{children:(0,_.jsx)(Wu,{value:r??``,options:i,onChange:t=>a(e,t.trim(),n),allowCustomValue:!0,placeholder:Q(`tax_ids.write_map_use_default`),className:`wcpos:font-mono wcpos:text-xs`,"aria-label":`${Tm[e]??e} ${Q(`tax_ids.col_override`)}`})})]})}function Pm(){let{data:t,mutate:n}=Gu(`tax_ids`),r=t?.write_map??{},{data:a}=rt({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:Q(`tax_ids.section_title`)}),(0,_.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-3`,children:[Q(`tax_ids.section_intro`),` `,(0,_.jsx)(jm,{})]}),(0,_.jsx)(Mm,{plugins:a.plugins,overrideCount:o}),(0,_.jsxs)(`details`,{className:`wcpos:border wcpos:border-gray-200 wcpos:rounded`,children:[(0,_.jsxs)(`summary`,{className:(0,V.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:Q(`tax_ids.advanced_title`)}),` `,(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:Q(`tax_ids.advanced_subtitle`)})]}),o>0&&(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:Q(`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:Q(`tax_ids.advanced_intro`)}),(0,_.jsxs)(Io,{children:[(0,_.jsx)(Lo,{children:(0,_.jsxs)(zo,{children:[(0,_.jsx)(J,{children:Q(`tax_ids.col_type`)}),(0,_.jsx)(J,{children:Q(`tax_ids.col_field`)}),(0,_.jsx)(J,{children:Q(`tax_ids.col_source`)}),(0,_.jsx)(J,{children:Q(`tax_ids.col_override`)})]})}),(0,_.jsx)(Ro,{children:a.types.map(e=>(0,_.jsx)(Nm,{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)(Am,{source:`plugin`}),` `,Q(`tax_ids.legend_plugin`)]}),(0,_.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,_.jsx)(Am,{source:`default`}),` `,Q(`tax_ids.legend_built_in`)]}),(0,_.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,_.jsx)(Am,{source:`override`}),` `,Q(`tax_ids.legend_custom`)]})]})]})]})]})}function Fm({disabled:t=!1,selected:n,onSelect:r}){let a=e.useMemo(()=>({id:0,name:Q(`common.guest`)}),[]),{setNotice:o}=Gl(),[s,c]=e.useState(``),{data:l,isFetching:u}=nt({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)(Wu,{value:String(n||0),options:d,onChange:e=>r(e?Number(e):0),onQuery:c,loading:u,disabled:t})}function Im(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 Lm(){return window?.wcpos?.settings?.getComponent?.(`general.store_details_block`)||null}function Rm(){let{data:t,mutate:n}=Gu(`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(()=>Lm()??Sm,[]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c,{data:t,mutate:n,storeDefaults:s}),(0,_.jsxs)(yo,{title:Q(`settings.products_section_title`),divider:!0,children:[(0,_.jsx)(K,{children:(0,_.jsx)($,{tip:Q(`settings.pos_only_products_tip`),children:(0,_.jsx)(Wa,{checked:!!t?.pos_only_products,onChange:e=>{n({pos_only_products:e})},label:Q(`settings.pos_only_products`)})})}),(0,_.jsx)(K,{children:(0,_.jsx)($,{tip:Q(`settings.decimal_quantities_tip`),children:(0,_.jsx)(Wa,{checked:!!t?.decimal_qty,onChange:e=>{n({decimal_qty:e})},label:Q(`settings.decimal_quantities`)})})}),(0,_.jsx)(K,{children:(0,_.jsx)($,{tip:Q(`settings.restore_stock_on_delete_tip`),children:(0,_.jsx)(Wa,{checked:!!t?.restore_stock_on_delete,onChange:e=>{n({restore_stock_on_delete:e})},label:Q(`settings.restore_stock_on_delete`)})})}),(0,_.jsx)(K,{label:Q(`settings.barcode_field`),children:(0,_.jsx)($,{tip:Q(`settings.barcode_field_tip`),children:(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(G,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,_.jsx)(gm,{selected:(0,r.isString)(t?.barcode_field)&&t?.barcode_field||``,onSelect:e=>{n({barcode_field:e||`_global_unique_id`})}})})})})]}),(0,_.jsxs)(yo,{title:Q(`settings.customers_section_title`),divider:!0,children:[(0,_.jsx)(K,{children:(0,_.jsx)(Wa,{checked:!!t?.generate_username,onChange:e=>{n({generate_username:e})},label:Q(`settings.generate_username`)})}),(0,_.jsxs)(K,{label:Q(`settings.default_customer`),children:[(0,_.jsx)($,{tip:Q(`settings.default_customer_tip`),children:(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(G,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,_.jsx)(Fm,{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)(Ga,{label:Q(`settings.use_cashier_account`),checked:!!t?.default_customer_is_cashier,onChange:e=>{n({default_customer_is_cashier:e.target.checked})}})})]}),(0,_.jsx)(wm,{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)(G,{className:`wcpos:h-32 wcpos:w-full wcpos:rounded-md wcpos:mt-4`}),children:(0,_.jsx)(Pm,{})})]}),(0,_.jsxs)(yo,{title:Q(`settings.privacy_section_title`),divider:!0,children:[(0,_.jsx)(K,{children:(0,_.jsx)($,{children:(0,_.jsx)(Wa,{checked:t?.tracking_consent===`allowed`,onChange:e=>{let t=e?`allowed`:`denied`;Jl(t),n({tracking_consent:t})},label:Q(`settings.allow_anonymous_usage_data_v2`)})})}),(0,_.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:[Q(`settings.allow_anonymous_usage_data_tip_v3`),` `,(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:Q(`settings.privacy_learn_more`)})]})]}),(0,_.jsx)(yo,{title:Q(`settings.advanced_section_title`),divider:!0,children:(0,_.jsx)(K,{children:(0,_.jsx)($,{tip:Q(`settings.force_ssl_tip`),children:(0,_.jsx)(Wa,{checked:!o||Im(t?.force_ssl),disabled:!o,onChange:e=>{n({force_ssl:e})},label:Q(`settings.force_ssl`)})})})}),(0,_.jsx)(hm,{open:i,onClose:()=>a(!1)})]})}function zm(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(vm,{}),(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(ju,{rows:5}),children:(0,_.jsx)(Rm,{})})]})}var Bm=(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 Vm(){let{data:t,mutate:n}=Gu(`license`),{setNotice:i}=Gl(),[o,s]=e.useState(t?.key),c=e=>s(e.target.value),l=async(e=!1)=>{e||Ql();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||tu(t),i({type:`error`,message:t.message}),null));if(d){if(!d.success)e||tu(d),i({type:`error`,message:d.error});else{if(e)s(``);else{$l((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||(Yl(`license_screen_card`),Yl(`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:Q(`license.thank_you`)}),(0,_.jsx)(`p`,{children:(0,_.jsx)(Bl,{i18nKey:`license.activated`,components:{code:(0,_.jsx)(`code`,{})},values:{number:Bm((0,r.isString)(t?.key)?t?.key:``)}})}),(0,_.jsx)(`p`,{children:Q(`license.ongoing_support`)}),(0,_.jsx)(H,{variant:`primary`,onClick:()=>l(!0),children:Q(`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)($,{children:Q(`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)(H,{variant:`primary`,disabled:!o,onClick:()=>l(),children:Q(`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:()=>Xl(`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:Q(`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:()=>Xl(`license_screen_link`,`https://wcpos.com/pro`),children:[Q(`common.upgrade_to_pro`),` →`]})]}),(0,_.jsxs)(Vl,{status:`info`,isDismissible:!1,className:`wcpos:w-full`,children:[Q(`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:Q(`license.existing_license_link`)}),` `,Q(`license.existing_license_suffix`)]})]})}function Hm(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 Um(e,t={}){let n=[`[${Hm(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(` |