@warp-ds/elements 2.10.0-next.6 → 2.10.0-next.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +10 -4
- package/dist/docs/icon/api.md +8 -2
- package/dist/docs/icon/icon.md +8 -2
- package/dist/packages/affix/affix.js +4 -4
- package/dist/packages/affix/affix.js.map +2 -2
- package/dist/packages/alert/alert.js +2 -2
- package/dist/packages/alert/alert.js.map +2 -2
- package/dist/packages/attention/attention.js +5 -5
- package/dist/packages/attention/attention.js.map +2 -2
- package/dist/packages/datepicker/datepicker.js.map +2 -2
- package/dist/packages/expandable/expandable.js +4 -4
- package/dist/packages/expandable/expandable.js.map +2 -2
- package/dist/packages/icon/icon.d.ts +3 -1
- package/dist/packages/icon/icon.js +2 -2
- package/dist/packages/icon/icon.js.map +2 -2
- package/dist/packages/modal-header/modal-header.js +1 -1
- package/dist/packages/modal-header/modal-header.js.map +2 -2
- package/dist/packages/pagination/pagination.js +1 -1
- package/dist/packages/pagination/pagination.js.map +2 -2
- package/dist/packages/pill/pill.js +2 -2
- package/dist/packages/pill/pill.js.map +2 -2
- package/dist/packages/select/select.js +4 -4
- package/dist/packages/select/select.js.map +2 -2
- package/dist/packages/slider-thumb/slider-thumb.js +1 -1
- package/dist/packages/slider-thumb/slider-thumb.js.map +3 -3
- package/dist/packages/step/step.js +3 -3
- package/dist/packages/step/step.js.map +2 -2
- package/dist/packages/toast/toast.js +3 -3
- package/dist/packages/toast/toast.js.map +2 -2
- package/dist/web-types.json +3 -3
- package/eik/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var h=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var c=(i,o,e,s)=>{for(var t=s>1?void 0:s?w(o,e):o,r=i.length-1,
|
|
1
|
+
var h=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var c=(i,o,e,s)=>{for(var t=s>1?void 0:s?w(o,e):o,r=i.length-1,l;r>=0;r--)(l=i[r])&&(t=(s?l(o,e,t):l(t))||t);return s&&t&&h(o,e,t),t};import{html as g,LitElement as u}from"lit";import{property as a,state as v}from"lit/decorators.js";import{classMap as f}from"lit/directives/class-map.js";import{css as d}from"lit";var p=d`
|
|
2
2
|
:host {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
}
|
|
@@ -23,5 +23,5 @@ var h=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var c=(i,o,e,s
|
|
|
23
23
|
--w-icon-size: 32px;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
`;var m=new Map,y='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function x(i,o={}){var s;let e=(s=o.responseParser)!=null?s:(t=>t.text());return m.has(i)||m.set(i,fetch(i).then(e)),m.get(i)}var n=class extends u{constructor(){super(...arguments);this.locale=document.documentElement.lang||"en";this.svg=null}async fetchIcon(e){let s=`https://assets.finn.no/pkg/eikons/v1/${this.locale}/${e}.svg`;try{let t=await x(s);return new DOMParser().parseFromString(t,"text/html").body.querySelector("svg")}catch(t){return null}}firstUpdated(){this.loadIcon()}updated(e){(e.has("name")||e.has("locale"))&&this.loadIcon()}async loadIcon(){if(!this.name){this.svg=null;return}let e=await this.fetchIcon(this.name);e||(e=new DOMParser().parseFromString(y,"text/html").body.firstElementChild),this.svg=e}render(){let e=this.size||"medium",s=this.name||"",t={"w-icon":!0,"w-icon--s":e==="small","w-icon--m":e==="medium","w-icon--l":e==="large"},r=typeof e=="string"&&e.endsWith("px")?`--w-icon-size: ${e};`:"";return
|
|
26
|
+
`;var m=new Map,y='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function x(i,o={}){var s;let e=(s=o.responseParser)!=null?s:(t=>t.text());return m.has(i)||m.set(i,fetch(i).then(e)),m.get(i)}var n=class extends u{constructor(){super(...arguments);this.locale=document.documentElement.lang||"en";this.svg=null}async fetchIcon(e){let s=`https://assets.finn.no/pkg/eikons/v1/${this.locale}/${e}.svg`;try{let t=await x(s);return new DOMParser().parseFromString(t,"text/html").body.querySelector("svg")}catch(t){return null}}firstUpdated(){this.loadIcon()}updated(e){(e.has("name")||e.has("locale"))&&this.loadIcon()}async loadIcon(){if(!this.name){this.svg=null;return}let e=await this.fetchIcon(this.name);e||(e=new DOMParser().parseFromString(y,"text/html").body.firstElementChild),this.svg=e}render(){let e=this.size||"medium",s=this.name||"",t={"w-icon":!0,"w-icon--s":e==="small","w-icon--m":e==="medium","w-icon--l":e==="large"},r=typeof e=="string"&&e.endsWith("px")?`--w-icon-size: ${e};`:"";return g`<div class="${f(t)}" style="${r}" part="w-${s.toLowerCase()}">${this.svg}</div>`}};n.styles=[p],c([a({type:String,reflect:!0})],n.prototype,"name",2),c([a({type:String,reflect:!0})],n.prototype,"size",2),c([a({type:String,reflect:!0,useDefault:!0})],n.prototype,"locale",2),c([v()],n.prototype,"svg",2);var M=n;customElements.get("w-icon")||customElements.define("w-icon",n);export{M as WIcon,n as WarpIcon};
|
|
27
27
|
//# sourceMappingURL=icon.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/icon/icon.ts", "../../../packages/icon/style.ts"],
|
|
4
|
-
"sourcesContent": ["import { html, LitElement, TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './style.js';\n\n// Generic parser for fetch responses\ntype ResponseParser<T> = (response: Response) => Promise<T>;\n\ninterface CacheFetchOptions<T> {\n responseParser?: ResponseParser<T>;\n}\n\nconst _fetchMap = new Map<string, Promise<any>>();\nconst ERROR_SVG = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>';\n\n/**\n * A minimal in-memory map to de-duplicate Fetch API media requests.\n *\n * @param uri - Resource URL\n * @param options - Optional parser for the response\n * @returns Promise of parsed response\n */\nfunction cacheFetch<T = string>(uri: string, options: CacheFetchOptions<T> = {}): Promise<T> {\n const parser = options.responseParser ?? ((res: Response) => res.text() as Promise<any>);\n if (!_fetchMap.has(uri)) {\n _fetchMap.set(uri, fetch(uri).then(parser));\n }\n return _fetchMap.get(uri) as Promise<T>;\n}\n\nexport class WarpIcon extends LitElement {\n static styles = [styles];\n\n /** Icon filename (without .svg) */\n @property({ type: String, reflect: true })\n name!: string;\n\n /** \n * Size: small, medium, large or pixel value (e.g. \"32px\").\n * \n * @default \"medium\"\n */\n @property({ type: String, reflect: true })\n size: 'small' | 'medium' | 'large' |
|
|
5
|
-
"mappings": "wMAAA,OAAS,QAAAA,EAAM,cAAAC,MAAkC,MACjD,OAAS,YAAAC,EAAU,SAAAC,MAAa,oBAChC,OAAS,YAAAC,MAAgB,8BCFzB,OAAS,OAAAC,MAAW,MAEb,IAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { html, LitElement, TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './style.js';\n\n// Generic parser for fetch responses\ntype ResponseParser<T> = (response: Response) => Promise<T>;\n\ntype PixelValue = `${number}px`;\n\ninterface CacheFetchOptions<T> {\n responseParser?: ResponseParser<T>;\n}\n\nconst _fetchMap = new Map<string, Promise<any>>();\nconst ERROR_SVG = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>';\n\n/**\n * A minimal in-memory map to de-duplicate Fetch API media requests.\n *\n * @param uri - Resource URL\n * @param options - Optional parser for the response\n * @returns Promise of parsed response\n */\nfunction cacheFetch<T = string>(uri: string, options: CacheFetchOptions<T> = {}): Promise<T> {\n const parser = options.responseParser ?? ((res: Response) => res.text() as Promise<any>);\n if (!_fetchMap.has(uri)) {\n _fetchMap.set(uri, fetch(uri).then(parser));\n }\n return _fetchMap.get(uri) as Promise<T>;\n}\n\nexport class WarpIcon extends LitElement {\n static styles = [styles];\n\n /** Icon filename (without .svg) */\n @property({ type: String, reflect: true })\n name!: string;\n\n /** \n * Size: small, medium, large or pixel value (e.g. \"32px\").\n * \n * @default \"medium\"\n */\n @property({ type: String, reflect: true })\n size: 'small' | 'medium' | 'large' | PixelValue;\n\n /** \n * Locale used for `<title>` text.\n * \n * Reads the `lang` attribute from `<html>`, falls back to 'en'. \n */\n @property({ type: String, reflect: true, useDefault: true })\n locale: string = document.documentElement.lang || 'en';\n\n /** Parsed SVG element (not reflected as attribute) */\n @state()\n private svg: SVGElement | null = null;\n\n /**\n * Fetch an icon SVG from the CDN, with caching\n * @param iconName - Name of the icon file\n * @returns SVGElement or null on failure\n */\n private async fetchIcon(iconName: string): Promise<SVGElement | null> {\n const uri = `https://assets.finn.no/pkg/eikons/v1/${this.locale}/${iconName}.svg`;\n try {\n const svgText = await cacheFetch<string>(uri);\n const doc = new DOMParser().parseFromString(svgText, 'text/html');\n return doc.body.querySelector('svg');\n } catch {\n return null;\n }\n }\n\n protected firstUpdated(): void {\n this.loadIcon();\n }\n\n protected updated(changedProps: Map<string, unknown>): void {\n if (changedProps.has('name') || changedProps.has('locale')) {\n this.loadIcon();\n }\n }\n\n private async loadIcon(): Promise<void> {\n if (!this.name) {\n this.svg = null;\n return;\n }\n\n let iconEl = await this.fetchIcon(this.name);\n if (!iconEl) {\n const doc = new DOMParser().parseFromString(ERROR_SVG, 'text/html');\n iconEl = doc.body.firstElementChild as SVGElement;\n }\n this.svg = iconEl;\n }\n\n render(): TemplateResult {\n const size = this.size || 'medium';\n const name = this.name || '';\n const classes = {\n 'w-icon': true,\n 'w-icon--s': size === 'small',\n 'w-icon--m': size === 'medium',\n 'w-icon--l': size === 'large',\n };\n const customStyle = typeof size === 'string' && size.endsWith('px') ? `--w-icon-size: ${size};` : '';\n return html`<div class=\"${classMap(classes)}\" style=\"${customStyle}\" part=\"w-${name.toLowerCase()}\">${this.svg}</div>`;\n }\n}\n\n/** @deprecated Exported for backwards compatibility. Use WarpIcon. */\nexport const WIcon = WarpIcon;\n\nif (!customElements.get('w-icon')) {\n customElements.define('w-icon', WarpIcon);\n}\n", "import { css } from 'lit';\n\nexport const styles = css`\n:host {\n display: inline-block;\n}\n.w-icon {\n --_w-icon-size: var(--w-icon-size, 24px);\n height: var(--_w-icon-size);\n width: var(--_w-icon-size);\n display: flex;\n}\n.w-icon svg {\n pointer-events: none;\n height: var(--_w-icon-size);\n width: var(--_w-icon-size);\n}\n.w-icon--s {\n --w-icon-size: 16px;\n}\n.w-icon--m {\n --w-icon-size: 24px;\n}\n.w-icon--l {\n --w-icon-size: 32px;\n}\n\n`;\n"],
|
|
5
|
+
"mappings": "wMAAA,OAAS,QAAAA,EAAM,cAAAC,MAAkC,MACjD,OAAS,YAAAC,EAAU,SAAAC,MAAa,oBAChC,OAAS,YAAAC,MAAgB,8BCFzB,OAAS,OAAAC,MAAW,MAEb,IAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EDYtB,IAAME,EAAY,IAAI,IAChBC,EAAY,qEASlB,SAASC,EAAuBC,EAAaC,EAAgC,CAAC,EAAe,CAxB7F,IAAAC,EAyBE,IAAMC,GAASD,EAAAD,EAAQ,iBAAR,KAAAC,GAA4BE,GAAkBA,EAAI,KAAK,GACtE,OAAKP,EAAU,IAAIG,CAAG,GACpBH,EAAU,IAAIG,EAAK,MAAMA,CAAG,EAAE,KAAKG,CAAM,CAAC,EAErCN,EAAU,IAAIG,CAAG,CAC1B,CAEO,IAAMK,EAAN,cAAuBC,CAAW,CAAlC,kCAqBL,YAAiB,SAAS,gBAAgB,MAAQ,KAIlD,KAAQ,IAAyB,KAOjC,MAAc,UAAUC,EAA8C,CACpE,IAAMP,EAAM,wCAAwC,KAAK,MAAM,IAAIO,CAAQ,OAC3E,GAAI,CACF,IAAMC,EAAU,MAAMT,EAAmBC,CAAG,EAE5C,OADY,IAAI,UAAU,EAAE,gBAAgBQ,EAAS,WAAW,EACrD,KAAK,cAAc,KAAK,CACrC,OAAQC,EAAA,CACN,OAAO,IACT,CACF,CAEU,cAAqB,CAC7B,KAAK,SAAS,CAChB,CAEU,QAAQC,EAA0C,EACtDA,EAAa,IAAI,MAAM,GAAKA,EAAa,IAAI,QAAQ,IACvD,KAAK,SAAS,CAElB,CAEA,MAAc,UAA0B,CACtC,GAAI,CAAC,KAAK,KAAM,CACd,KAAK,IAAM,KACX,MACF,CAEA,IAAIC,EAAS,MAAM,KAAK,UAAU,KAAK,IAAI,EACtCA,IAEHA,EADY,IAAI,UAAU,EAAE,gBAAgBb,EAAW,WAAW,EACrD,KAAK,mBAEpB,KAAK,IAAMa,CACb,CAEA,QAAyB,CACvB,IAAMC,EAAO,KAAK,MAAQ,SACpBC,EAAO,KAAK,MAAQ,GACpBC,EAAU,CACd,SAAU,GACV,YAAaF,IAAS,QACtB,YAAaA,IAAS,SACtB,YAAaA,IAAS,OACxB,EACMG,EAAc,OAAOH,GAAS,UAAYA,EAAK,SAAS,IAAI,EAAI,kBAAkBA,CAAI,IAAM,GAClG,OAAOI,gBAAmBC,EAASH,CAAO,CAAC,YAAYC,CAAW,aAAaF,EAAK,YAAY,CAAC,KAAK,KAAK,GAAG,QAChH,CACF,EA/EaR,EACJ,OAAS,CAACa,CAAM,EAIvBC,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAJ9Bf,EAKX,oBAQAc,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAZ9Bf,EAaX,oBAQAc,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,GAAM,WAAY,EAAK,CAAC,GApBhDf,EAqBX,sBAIQc,EAAA,CADPE,EAAM,GAxBIhB,EAyBH,mBAyDH,IAAMiB,EAAQjB,EAEhB,eAAe,IAAI,QAAQ,GAC9B,eAAe,OAAO,SAAUA,CAAQ",
|
|
6
6
|
"names": ["html", "LitElement", "property", "state", "classMap", "css", "styles", "_fetchMap", "ERROR_SVG", "cacheFetch", "uri", "options", "_a", "parser", "res", "WarpIcon", "LitElement", "iconName", "svgText", "e", "changedProps", "iconEl", "size", "name", "classes", "customStyle", "html", "classMap", "styles", "__decorateClass", "property", "state", "WIcon"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var B=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var ue=(o,e,r)=>e in o?B(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r;var d=(o,e,r,t)=>{for(var a=t>1?void 0:t?ge(e,r):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(a=(t?n(e,r,a):n(a))||a);return t&&a&&B(e,r,a),a};var k=(o,e,r)=>ue(o,typeof e!="symbol"?e+"":e,r);var X=(o,e)=>({dx:o.left-e.left,dy:o.top-e.top,dw:o.width/e.width,dh:o.height/e.height,first:o,last:e}),I=({dx:o,dy:e})=>[{transform:`translate(${o}px, ${e}px)`},{transform:"none"}],Z={easing:"ease",duration:300};var M=!1,he=typeof window!="undefined";if(he){let o=window.matchMedia("(prefers-reduced-motion: reduce)"),e=({matches:r})=>M=r;o.addEventListener&&o.addEventListener("change",e),e(o)}var y=class{constructor(e,{animation:r={},keyframes:t,respectReduceMotion:a=!0}={}){k(this,"first");k(this,"last");k(this,"el");this.el=e,this.first={},this.last={},this.userAnimationOptions=r,this.keyframeGenerator=t||I,this.shouldReduceMotion=a}async when(e){this.prep();let r=await e();return await this.play(),r}prep(){this.first=this.el.getBoundingClientRect()}async play(){if(this.last=this.el.getBoundingClientRect(),!this.el.animate)return;await this.el.animate(this.keyframes,this.animationOptions).finished}get keyframes(){return this.keyframeGenerator(X(this.first,this.last))}get defaults(){return Z}get mergedOptions(){return{...this.defaults,...this.userAnimationOptions}}get animationOptions(){return this.shouldReduceMotion?M?{...this.mergedOptions,duration:0}:this.mergedOptions:this.mergedOptions}};var p=o=>typeof o=="string",me=o=>typeof o=="function",
|
|
1
|
+
var B=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var ue=(o,e,r)=>e in o?B(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r;var d=(o,e,r,t)=>{for(var a=t>1?void 0:t?ge(e,r):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(a=(t?n(e,r,a):n(a))||a);return t&&a&&B(e,r,a),a};var k=(o,e,r)=>ue(o,typeof e!="symbol"?e+"":e,r);var X=(o,e)=>({dx:o.left-e.left,dy:o.top-e.top,dw:o.width/e.width,dh:o.height/e.height,first:o,last:e}),I=({dx:o,dy:e})=>[{transform:`translate(${o}px, ${e}px)`},{transform:"none"}],Z={easing:"ease",duration:300};var M=!1,he=typeof window!="undefined";if(he){let o=window.matchMedia("(prefers-reduced-motion: reduce)"),e=({matches:r})=>M=r;o.addEventListener&&o.addEventListener("change",e),e(o)}var y=class{constructor(e,{animation:r={},keyframes:t,respectReduceMotion:a=!0}={}){k(this,"first");k(this,"last");k(this,"el");this.el=e,this.first={},this.last={},this.userAnimationOptions=r,this.keyframeGenerator=t||I,this.shouldReduceMotion=a}async when(e){this.prep();let r=await e();return await this.play(),r}prep(){this.first=this.el.getBoundingClientRect()}async play(){if(this.last=this.el.getBoundingClientRect(),!this.el.animate)return;await this.el.animate(this.keyframes,this.animationOptions).finished}get keyframes(){return this.keyframeGenerator(X(this.first,this.last))}get defaults(){return Z}get mergedOptions(){return{...this.defaults,...this.userAnimationOptions}}get animationOptions(){return this.shouldReduceMotion?M?{...this.mergedOptions,duration:0}:this.mergedOptions:this.mergedOptions}};var p=o=>typeof o=="string",me=o=>typeof o=="function",V=new Map,q="en";function P(o){return[...Array.isArray(o)?o:[o],q]}function $(o,e,r){let t=P(o);r||(r="default");let a;if(typeof r=="string")switch(a={day:"numeric",month:"short",year:"numeric"},r){case"full":a.weekday="long";case"long":a.month="long";break;case"short":a.month="numeric";break}else a=r;return _(()=>z("date",t,r),()=>new Intl.DateTimeFormat(t,a)).format(p(e)?new Date(e):e)}function ve(o,e,r){let t;if(r||(r="default"),typeof r=="string")switch(t={second:"numeric",minute:"numeric",hour:"numeric"},r){case"full":case"long":t.timeZoneName="short";break;case"short":delete t.second}else t=r;return $(o,e,t)}function T(o,e,r){let t=P(o);return _(()=>z("number",t,r),()=>new Intl.NumberFormat(t,r)).format(e)}function G(o,e,r,{offset:t=0,...a}){var i,l;let s=P(o),n=e?_(()=>z("plural-ordinal",s),()=>new Intl.PluralRules(s,{type:"ordinal"})):_(()=>z("plural-cardinal",s),()=>new Intl.PluralRules(s,{type:"cardinal"}));return(l=(i=a[r])!=null?i:a[n.select(r-t)])!=null?l:a.other}function _(o,e){let r=o(),t=V.get(r);return t||(t=e(),V.set(r,t)),t}function z(o,e,r){let t=e.join("-");return`${o}-${t}-${JSON.stringify(r)}`}var J=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,U=o=>o.replace(/\\u([a-fA-F0-9]{4})|\\x([a-fA-F0-9]{2})/g,(e,r,t)=>{if(r){let a=parseInt(r,16);return String.fromCharCode(a)}else{let a=parseInt(t,16);return String.fromCharCode(a)}}),K="%__lingui_octothorpe__%",we=(o,e,r={})=>{let t=e||o,a=n=>typeof n=="object"?n:r[n],s=(n,i)=>{let l=Object.keys(r).length?a("number"):void 0,u=T(t,n,l);return i.replace(new RegExp(K,"g"),u)};return{plural:(n,i)=>{let{offset:l=0}=i,u=G(t,!1,n,i);return s(n-l,u)},selectordinal:(n,i)=>{let{offset:l=0}=i,u=G(t,!0,n,i);return s(n-l,u)},select:fe,number:(n,i)=>T(t,n,a(i)||{style:i}),date:(n,i)=>$(t,n,a(i)||i),time:(n,i)=>ve(t,n,a(i)||i)}},fe=(o,e)=>{var r;return(r=e[o])!=null?r:e.other};function xe(o,e,r){return(t={},a)=>{let s=we(e,r,a),n=(l,u=!1)=>Array.isArray(l)?l.reduce((w,f)=>{if(f==="#"&&u)return w+K;if(p(f))return w+f;let[A,h,R]=f,E={};h==="plural"||h==="selectordinal"||h==="select"?Object.entries(R).forEach(([L,pe])=>{E[L]=n(pe,h==="plural"||h==="selectordinal")}):E=R;let x;if(h){let L=s[h];x=L(t[A],E)}else x=t[A];return x==null?w:w+x},""):l,i=n(o);return p(i)&&J.test(i)?U(i):p(i)?i:i?String(i):""}}var ke=Object.defineProperty,ye=(o,e,r)=>e in o?ke(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,_e=(o,e,r)=>(ye(o,typeof e!="symbol"?e+"":e,r),r),S=class{constructor(){_e(this,"_events",{})}on(e,r){var a;var t;return(a=(t=this._events)[e])!=null||(t[e]=[]),this._events[e].push(r),()=>this.removeListener(e,r)}removeListener(e,r){let t=this._getListeners(e);if(!t)return;let a=t.indexOf(r);~a&&t.splice(a,1)}emit(e,...r){let t=this._getListeners(e);t&&t.map(a=>a.apply(this,r))}_getListeners(e){let r=this._events[e];return Array.isArray(r)?r:!1}},ze=Object.defineProperty,Ce=(o,e,r)=>e in o?ze(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,m=(o,e,r)=>(Ce(o,typeof e!="symbol"?e+"":e,r),r),O=class extends S{constructor(e){var r;super(),m(this,"_locale",""),m(this,"_locales"),m(this,"_localeData",{}),m(this,"_messages",{}),m(this,"_missing"),m(this,"_messageCompiler"),m(this,"t",this._.bind(this)),e.missing!=null&&(this._missing=e.missing),e.messages!=null&&this.load(e.messages),e.localeData!=null&&this.loadLocaleData(e.localeData),(typeof e.locale=="string"||e.locales)&&this.activate((r=e.locale)!=null?r:q,e.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){var e;return(e=this._messages[this._locale])!=null?e:{}}get localeData(){var e;return(e=this._localeData[this._locale])!=null?e:{}}_loadLocaleData(e,r){let t=this._localeData[e];t?Object.assign(t,r):this._localeData[e]=r}setMessagesCompiler(e){return this._messageCompiler=e,this}loadLocaleData(e,r){typeof e=="string"?this._loadLocaleData(e,r):Object.keys(e).forEach(t=>this._loadLocaleData(t,e[t])),this.emit("change")}_load(e,r){let t=this._messages[e];t?Object.assign(t,r):this._messages[e]=r}load(e,r){typeof e=="string"&&typeof r=="object"?this._load(e,r):Object.entries(e).forEach(([t,a])=>this._load(t,a)),this.emit("change")}loadAndActivate({locale:e,locales:r,messages:t}){this._locale=e,this._locales=r||void 0,this._messages[this._locale]=t,this.emit("change")}activate(e,r){this._locale=e,this._locales=r,this.emit("change")}_(e,r,t){if(!this.locale)throw new Error("Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic.");let a=t==null?void 0:t.message;e||(e=""),p(e)||(r=e.values||r,a=e.message,e=e.id);let s=this.messages[e],n=s===void 0,i=this._missing;if(i&&n)return me(i)?i(this._locale,e):i;n&&this.emit("missing",{id:e,locale:this._locale});let l=s||a||e;return p(l)&&(this._messageCompiler?l=this._messageCompiler(l):console.warn(`Uncompiled message detected! Message:
|
|
2
2
|
|
|
3
3
|
> ${l}
|
|
4
4
|
|