@warp-ds/elements 2.2.0-next.4 → 2.2.0-next.5
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/README.md +27 -17
- package/dist/.storybook/utilities.d.ts +28 -0
- package/dist/api.js +1 -49
- package/dist/api.js.map +2 -2
- package/dist/custom-elements.json +2799 -313
- package/dist/index.css +2 -0
- package/dist/index.css.map +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +415 -7146
- package/dist/index.js.map +4 -4
- package/dist/packages/affix/affix.stories.d.ts +10 -0
- package/dist/packages/affix/affix.test.d.ts +1 -0
- package/dist/packages/affix/index.d.ts +52 -24
- package/dist/packages/affix/index.js +2448 -2241
- package/dist/packages/affix/index.js.map +4 -4
- package/dist/packages/affix/react.d.ts +2 -0
- package/dist/packages/affix/react.js +2482 -0
- package/dist/packages/affix/react.js.map +7 -0
- package/dist/packages/affix/styles.d.ts +1 -0
- package/dist/packages/alert/alert.stories.d.ts +15 -0
- package/dist/packages/alert/index.d.ts +16 -1
- package/dist/packages/alert/index.js +2472 -0
- package/dist/packages/alert/index.js.map +7 -0
- package/dist/packages/alert/react.d.ts +2 -0
- package/dist/packages/alert/react.js +2492 -0
- package/dist/packages/alert/react.js.map +7 -0
- package/dist/packages/alert/styles.d.ts +1 -0
- package/dist/packages/attention/attention.stories.d.ts +10 -0
- package/dist/packages/attention/index.d.ts +14 -1
- package/dist/packages/attention/index.js +17 -3977
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/badge/badge.stories.d.ts +17 -0
- package/dist/packages/badge/badge.test.d.ts +1 -0
- package/dist/packages/badge/index.d.ts +17 -12
- package/dist/packages/badge/index.js +2441 -300
- package/dist/packages/badge/index.js.map +4 -4
- package/dist/packages/badge/react.d.ts +2 -0
- package/dist/packages/badge/react.js +2465 -0
- package/dist/packages/badge/react.js.map +7 -0
- package/dist/packages/badge/styles.d.ts +1 -0
- package/dist/packages/box/box.stories.d.ts +14 -0
- package/dist/packages/box/box.test.d.ts +1 -0
- package/dist/packages/box/index.d.ts +21 -21
- package/dist/packages/box/index.js +2441 -304
- package/dist/packages/box/index.js.map +4 -4
- package/dist/packages/box/react.d.ts +2 -0
- package/dist/packages/box/react.js +2465 -0
- package/dist/packages/box/react.js.map +7 -0
- package/dist/packages/box/slot.test.d.ts +1 -0
- package/dist/packages/box/styles.d.ts +1 -0
- package/dist/packages/breadcrumbs/breadcrumbs.stories.d.ts +12 -0
- package/dist/packages/breadcrumbs/breadcrumbs.test.d.ts +1 -0
- package/dist/packages/breadcrumbs/index.d.ts +24 -16
- package/dist/packages/breadcrumbs/index.js +2402 -2049
- package/dist/packages/breadcrumbs/index.js.map +4 -4
- package/dist/packages/breadcrumbs/react.d.ts +2 -0
- package/dist/packages/breadcrumbs/react.js +2475 -0
- package/dist/packages/breadcrumbs/react.js.map +7 -0
- package/dist/packages/breadcrumbs/styles.d.ts +1 -0
- package/dist/packages/button/button.stories.d.ts +21 -0
- package/dist/packages/button/index.d.ts +82 -7
- package/dist/packages/button/index.js +2460 -0
- package/dist/packages/button/index.js.map +7 -0
- package/dist/packages/button/react.d.ts +2 -0
- package/dist/packages/button/react.js +2480 -0
- package/dist/packages/button/react.js.map +7 -0
- package/dist/packages/button/styles.d.ts +1 -0
- package/dist/packages/card/card.stories.d.ts +15 -0
- package/dist/packages/card/index.d.ts +27 -1
- package/dist/packages/card/index.js +2467 -0
- package/dist/packages/card/index.js.map +7 -0
- package/dist/packages/card/react.d.ts +2 -0
- package/dist/packages/card/react.js +2487 -0
- package/dist/packages/card/react.js.map +7 -0
- package/dist/packages/card/styles.d.ts +1 -0
- package/dist/packages/dead-toggle/dead-toggle.stories.d.ts +10 -0
- package/dist/packages/dead-toggle/dead-toggle.test.d.ts +1 -0
- package/dist/packages/dead-toggle/index.d.ts +21 -0
- package/dist/packages/dead-toggle/index.js +2487 -0
- package/dist/packages/dead-toggle/index.js.map +7 -0
- package/dist/packages/dead-toggle/react.d.ts +2 -0
- package/dist/packages/dead-toggle/react.js +2507 -0
- package/dist/packages/dead-toggle/react.js.map +7 -0
- package/dist/packages/expandable/expandable.stories.d.ts +19 -0
- package/dist/packages/expandable/index.d.ts +43 -0
- package/dist/packages/expandable/index.js +2475 -0
- package/dist/packages/expandable/index.js.map +7 -0
- package/dist/packages/expandable/react.d.ts +2 -0
- package/dist/packages/expandable/react.js +2495 -0
- package/dist/packages/expandable/react.js.map +7 -0
- package/dist/packages/expandable/styles.d.ts +1 -0
- package/dist/packages/modal/index.d.ts +5 -6
- package/dist/packages/modal/index.js +2568 -2445
- package/dist/packages/modal/index.js.map +4 -4
- package/dist/packages/modal/modal-footer.d.ts +17 -10
- package/dist/packages/modal/modal-header.d.ts +20 -13
- package/dist/packages/modal/modal-main.d.ts +18 -7
- package/dist/packages/modal/modal.stories.d.ts +19 -0
- package/dist/packages/modal/react.d.ts +4 -0
- package/dist/packages/modal/react.js +2754 -0
- package/dist/packages/modal/react.js.map +7 -0
- package/dist/packages/modal/util.d.ts +7 -17
- package/dist/packages/pagination/index.d.ts +34 -0
- package/dist/packages/pagination/index.js +2486 -0
- package/dist/packages/pagination/index.js.map +7 -0
- package/dist/packages/pagination/locales/da/messages.d.mts +1 -0
- package/dist/packages/pagination/locales/en/messages.d.mts +1 -0
- package/dist/packages/pagination/locales/fi/messages.d.mts +1 -0
- package/dist/packages/pagination/locales/nb/messages.d.mts +1 -0
- package/dist/packages/pagination/locales/sv/messages.d.mts +1 -0
- package/dist/packages/pagination/pagination.stories.d.ts +14 -0
- package/dist/packages/pagination/pagination.test.d.ts +1 -0
- package/dist/packages/pagination/react.d.ts +2 -0
- package/dist/packages/pagination/react.js +2506 -0
- package/dist/packages/pagination/react.js.map +7 -0
- package/dist/packages/pagination/styles.d.ts +1 -0
- package/dist/packages/pill/index.d.ts +44 -23
- package/dist/packages/pill/index.js +2408 -2173
- package/dist/packages/pill/index.js.map +4 -4
- package/dist/packages/pill/pill.stories.d.ts +12 -0
- package/dist/packages/pill/pill.test.d.ts +1 -0
- package/dist/packages/pill/styles.d.ts +1 -0
- package/dist/packages/rip-and-tear-checkbox/checkbox.d.ts +64 -0
- package/dist/packages/rip-and-tear-checkbox/index.css +2 -0
- package/dist/packages/rip-and-tear-checkbox/index.css.map +7 -0
- package/dist/packages/rip-and-tear-checkbox/index.d.ts +6 -0
- package/dist/packages/rip-and-tear-checkbox/index.js +36 -0
- package/dist/packages/rip-and-tear-checkbox/index.js.map +7 -0
- package/dist/packages/rip-and-tear-radio/base-element.d.ts +46 -0
- package/dist/packages/rip-and-tear-radio/custom-error-validator.d.ts +6 -0
- package/dist/packages/rip-and-tear-radio/form-associated-element.d.ts +103 -0
- package/dist/packages/rip-and-tear-radio/index.css +2 -0
- package/dist/packages/rip-and-tear-radio/index.css.map +7 -0
- package/dist/packages/rip-and-tear-radio/index.d.ts +8 -0
- package/dist/packages/rip-and-tear-radio/index.js +34 -0
- package/dist/packages/rip-and-tear-radio/index.js.map +7 -0
- package/dist/packages/rip-and-tear-radio/invalid.d.ts +8 -0
- package/dist/packages/rip-and-tear-radio/math.d.ts +1 -0
- package/dist/packages/rip-and-tear-radio/radio-group.d.ts +72 -0
- package/dist/packages/rip-and-tear-radio/radio.d.ts +38 -0
- package/dist/packages/rip-and-tear-radio/required-validator.d.ts +11 -0
- package/dist/packages/rip-and-tear-radio/slot.d.ts +20 -0
- package/dist/packages/rip-and-tear-radio/watch.d.ts +26 -0
- package/dist/packages/select/index.d.ts +59 -58
- package/dist/packages/select/index.js +2421 -2531
- package/dist/packages/select/index.js.map +4 -4
- package/dist/packages/select/react.d.ts +2 -0
- package/dist/packages/select/react.js +2494 -0
- package/dist/packages/select/react.js.map +7 -0
- package/dist/packages/select/select.stories.d.ts +10 -0
- package/dist/packages/select/select.test.d.ts +1 -0
- package/dist/packages/select/styles.d.ts +1 -0
- package/dist/packages/textfield/index.d.ts +70 -72
- package/dist/packages/textfield/index.js +2455 -701
- package/dist/packages/textfield/index.js.map +4 -4
- package/dist/packages/textfield/react.d.ts +2 -0
- package/dist/packages/textfield/react.js +2490 -0
- package/dist/packages/textfield/react.js.map +7 -0
- package/dist/packages/textfield/styles.d.ts +1 -0
- package/dist/packages/textfield/textfield.stories.d.ts +17 -0
- package/dist/packages/textfield/textfield.test.d.ts +1 -0
- package/dist/packages/toast/index.js +24 -2782
- package/dist/packages/toast/index.js.map +4 -4
- package/dist/packages/toast/toast-container.d.ts +16 -0
- package/dist/packages/toast/toast.d.ts +20 -0
- package/dist/packages/toast/toast.stories.d.ts +12 -0
- package/dist/packages/utils/index.d.ts +1 -1
- package/dist/packages/utils/unstyled-heading.d.ts +1 -1
- package/dist/setup-tests.d.ts +1 -0
- package/dist/vscode.css-custom-data.json +6 -0
- package/dist/vscode.html-custom-data.json +313 -0
- package/dist/web-types.json +707 -0
- package/package.json +47 -13
|
@@ -1,3991 +1,38 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __objRest = (source, exclude) => {
|
|
25
|
-
var target = {};
|
|
26
|
-
for (var prop in source)
|
|
27
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
if (source != null && __getOwnPropSymbols)
|
|
30
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
-
target[prop] = source[prop];
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
};
|
|
36
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
37
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
38
|
-
};
|
|
39
|
-
var __copyProps = (to, from, except, desc) => {
|
|
40
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
-
for (let key of __getOwnPropNames(from))
|
|
42
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
-
}
|
|
45
|
-
return to;
|
|
46
|
-
};
|
|
47
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
48
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
49
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
50
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
51
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
52
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
53
|
-
mod
|
|
54
|
-
));
|
|
55
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1
|
+
var Eo=Object.create;var Ke=Object.defineProperty;var _o=Object.getOwnPropertyDescriptor;var So=Object.getOwnPropertyNames;var Ao=Object.getPrototypeOf,Do=Object.prototype.hasOwnProperty;var Co=(e,t,o)=>t in e?Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var ut=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Oo=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of So(t))!Do.call(e,n)&&n!==o&&Ke(e,n,{get:()=>t[n],enumerable:!(r=_o(t,n))||r.enumerable});return e};var Lo=(e,t,o)=>(o=e!=null?Eo(Ao(e)):{},Oo(t||!e||!e.__esModule?Ke(o,"default",{value:e,enumerable:!0}):o,e));var Ye=(e,t,o)=>Co(e,typeof t!="symbol"?t+"":t,o);var ft=ut(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.errorMessages=ie.ErrorType=void 0;var pe;(function(e){e.MalformedUnicode="MALFORMED_UNICODE",e.MalformedHexadecimal="MALFORMED_HEXADECIMAL",e.CodePointLimit="CODE_POINT_LIMIT",e.OctalDeprecation="OCTAL_DEPRECATION",e.EndOfString="END_OF_STRING"})(pe=ie.ErrorType||(ie.ErrorType={}));ie.errorMessages=new Map([[pe.MalformedUnicode,"malformed Unicode character escape sequence"],[pe.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[pe.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[pe.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[pe.EndOfString,"malformed escape sequence at end of string"]])});var gt=ut(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.unraw=V.errorMessages=V.ErrorType=void 0;var C=ft();Object.defineProperty(V,"ErrorType",{enumerable:!0,get:function(){return C.ErrorType}});Object.defineProperty(V,"errorMessages",{enumerable:!0,get:function(){return C.errorMessages}});function To(e){return!e.match(/[^a-f0-9]/i)?parseInt(e,16):NaN}function Se(e,t,o){let r=To(e);if(Number.isNaN(r)||o!==void 0&&o!==e.length)throw new SyntaxError(C.errorMessages.get(t));return r}function Ro(e){let t=Se(e,C.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(t)}function pt(e,t){let o=Se(e,C.ErrorType.MalformedUnicode,4);if(t!==void 0){let r=Se(t,C.ErrorType.MalformedUnicode,4);return String.fromCharCode(o,r)}return String.fromCharCode(o)}function Po(e){return e.charAt(0)==="{"&&e.charAt(e.length-1)==="}"}function Mo(e){if(!Po(e))throw new SyntaxError(C.errorMessages.get(C.ErrorType.MalformedUnicode));let t=e.slice(1,-1),o=Se(t,C.ErrorType.MalformedUnicode);try{return String.fromCodePoint(o)}catch(r){throw r instanceof RangeError?new SyntaxError(C.errorMessages.get(C.ErrorType.CodePointLimit)):r}}function Bo(e,t=!1){if(t)throw new SyntaxError(C.errorMessages.get(C.ErrorType.OctalDeprecation));let o=parseInt(e,8);return String.fromCharCode(o)}var No=new Map([["b","\b"],["f","\f"],["n",`
|
|
2
|
+
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function jo(e){return No.get(e)||e}var Io=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function mt(e,t=!1){return e.replace(Io,function(o,r,n,s,i,a,l,c,d){if(r!==void 0)return"\\";if(n!==void 0)return Ro(n);if(s!==void 0)return Mo(s);if(i!==void 0)return pt(i,a);if(l!==void 0)return pt(l);if(c==="0")return"\0";if(c!==void 0)return Bo(c,!t);if(d!==void 0)return jo(d);throw new SyntaxError(C.errorMessages.get(C.ErrorType.EndOfString))})}V.unraw=mt;V.default=mt});import{css as Gr,html as he,nothing as yo}from"lit";var _e=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return e.reduce(function(o,r){return o.concat(typeof r=="string"?r:Array.isArray(r)?_e.apply(void 0,r):typeof r=="object"&&r?Object.keys(r).map(function(n){return r[n]?n:""}):"")},[]).join(" ")};var vt=Lo(gt(),1);var ee=e=>typeof e=="string",Fo=e=>typeof e=="function",bt=new Map,wt="en";function tt(e){return[...Array.isArray(e)?e:[e],wt]}function ot(e,t,o){let r=tt(e);o||(o="default");let n;if(typeof o=="string")switch(n={day:"numeric",month:"short",year:"numeric"},o){case"full":n.weekday="long";case"long":n.month="long";break;case"short":n.month="numeric";break}else n=o;return Ae(()=>De("date",r,o),()=>new Intl.DateTimeFormat(r,n)).format(ee(t)?new Date(t):t)}function Ho(e,t,o){let r;if(o||(o="default"),typeof o=="string")switch(r={second:"numeric",minute:"numeric",hour:"numeric"},o){case"full":case"long":r.timeZoneName="short";break;case"short":delete r.second}else r=o;return ot(e,t,r)}function Xe(e,t,o){let r=tt(e);return Ae(()=>De("number",r,o),()=>new Intl.NumberFormat(r,o)).format(t)}function ht(e,t,o,{offset:r=0,...n}){var a,l;let s=tt(e),i=t?Ae(()=>De("plural-ordinal",s),()=>new Intl.PluralRules(s,{type:"ordinal"})):Ae(()=>De("plural-cardinal",s),()=>new Intl.PluralRules(s,{type:"cardinal"}));return(l=(a=n[o])!=null?a:n[i.select(o-r)])!=null?l:n.other}function Ae(e,t){let o=e(),r=bt.get(o);return r||(r=t(),bt.set(o,r)),r}function De(e,t,o){let r=t.join("-");return`${e}-${r}-${JSON.stringify(o)}`}var xt=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,yt="%__lingui_octothorpe__%",zo=(e,t,o={})=>{let r=t||e,n=i=>typeof i=="object"?i:o[i],s=(i,a)=>{let l=Object.keys(o).length?n("number"):void 0,c=Xe(r,i,l);return a.replace(new RegExp(yt,"g"),c)};return{plural:(i,a)=>{let{offset:l=0}=a,c=ht(r,!1,i,a);return s(i-l,c)},selectordinal:(i,a)=>{let{offset:l=0}=a,c=ht(r,!0,i,a);return s(i-l,c)},select:Qo,number:(i,a)=>Xe(r,i,n(a)||{style:a}),date:(i,a)=>ot(r,i,n(a)||a),time:(i,a)=>Ho(r,i,n(a)||a)}},Qo=(e,t)=>{var o;return(o=t[e])!=null?o:t.other};function Uo(e,t,o){return(r={},n)=>{let s=zo(t,o,n),i=(l,c=!1)=>Array.isArray(l)?l.reduce((d,u)=>{if(u==="#"&&c)return d+yt;if(ee(u))return d+u;let[b,f,h]=u,v={};f==="plural"||f==="selectordinal"||f==="select"?Object.entries(h).forEach(([y,$])=>{v[y]=i($,f==="plural"||f==="selectordinal")}):v=h;let w;if(f){let y=s[f];w=y(r[b],v)}else w=r[b];return w==null?d:d+w},""):l,a=i(e);return ee(a)&&xt.test(a)?(0,vt.unraw)(a):ee(a)?a:a?String(a):""}}var Wo=Object.defineProperty,Vo=(e,t,o)=>t in e?Wo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,qo=(e,t,o)=>(Vo(e,typeof t!="symbol"?t+"":t,o),o),Ze=class{constructor(){qo(this,"_events",{})}on(t,o){var n;var r;return(n=(r=this._events)[t])!=null||(r[t]=[]),this._events[t].push(o),()=>this.removeListener(t,o)}removeListener(t,o){let r=this._getListeners(t);if(!r)return;let n=r.indexOf(o);~n&&r.splice(n,1)}emit(t,...o){let r=this._getListeners(t);r&&r.map(n=>n.apply(this,o))}_getListeners(t){let o=this._events[t];return Array.isArray(o)?o:!1}},Jo=Object.defineProperty,Go=(e,t,o)=>t in e?Jo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,se=(e,t,o)=>(Go(e,typeof t!="symbol"?t+"":t,o),o),et=class extends Ze{constructor(t){var o;super(),se(this,"_locale",""),se(this,"_locales"),se(this,"_localeData",{}),se(this,"_messages",{}),se(this,"_missing"),se(this,"_messageCompiler"),se(this,"t",this._.bind(this)),t.missing!=null&&(this._missing=t.missing),t.messages!=null&&this.load(t.messages),t.localeData!=null&&this.loadLocaleData(t.localeData),(typeof t.locale=="string"||t.locales)&&this.activate((o=t.locale)!=null?o:wt,t.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){var t;return(t=this._messages[this._locale])!=null?t:{}}get localeData(){var t;return(t=this._localeData[this._locale])!=null?t:{}}_loadLocaleData(t,o){let r=this._localeData[t];r?Object.assign(r,o):this._localeData[t]=o}setMessagesCompiler(t){return this._messageCompiler=t,this}loadLocaleData(t,o){typeof t=="string"?this._loadLocaleData(t,o):Object.keys(t).forEach(r=>this._loadLocaleData(r,t[r])),this.emit("change")}_load(t,o){let r=this._messages[t];r?Object.assign(r,o):this._messages[t]=o}load(t,o){typeof t=="string"&&typeof o=="object"?this._load(t,o):Object.entries(t).forEach(([r,n])=>this._load(r,n)),this.emit("change")}loadAndActivate({locale:t,locales:o,messages:r}){this._locale=t,this._locales=o||void 0,this._messages[this._locale]=r,this.emit("change")}activate(t,o){this._locale=t,this._locales=o,this.emit("change")}_(t,o,r){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 n=r==null?void 0:r.message;t||(t=""),ee(t)||(o=t.values||o,n=t.message,t=t.id);let s=this.messages[t],i=s===void 0,a=this._missing;if(a&&i)return Fo(a)?a(this._locale,t):a;i&&this.emit("missing",{id:t,locale:this._locale});let l=s||n||t;return ee(l)&&(this._messageCompiler?l=this._messageCompiler(l):console.warn(`Uncompiled message detected! Message:
|
|
56
3
|
|
|
57
|
-
|
|
58
|
-
var require_errors = __commonJS({
|
|
59
|
-
"node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/errors.js"(exports) {
|
|
60
|
-
"use strict";
|
|
61
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
exports.errorMessages = exports.ErrorType = void 0;
|
|
63
|
-
var ErrorType;
|
|
64
|
-
(function(ErrorType2) {
|
|
65
|
-
ErrorType2["MalformedUnicode"] = "MALFORMED_UNICODE";
|
|
66
|
-
ErrorType2["MalformedHexadecimal"] = "MALFORMED_HEXADECIMAL";
|
|
67
|
-
ErrorType2["CodePointLimit"] = "CODE_POINT_LIMIT";
|
|
68
|
-
ErrorType2["OctalDeprecation"] = "OCTAL_DEPRECATION";
|
|
69
|
-
ErrorType2["EndOfString"] = "END_OF_STRING";
|
|
70
|
-
})(ErrorType = exports.ErrorType || (exports.ErrorType = {}));
|
|
71
|
-
exports.errorMessages = /* @__PURE__ */ new Map([
|
|
72
|
-
[ErrorType.MalformedUnicode, "malformed Unicode character escape sequence"],
|
|
73
|
-
[
|
|
74
|
-
ErrorType.MalformedHexadecimal,
|
|
75
|
-
"malformed hexadecimal character escape sequence"
|
|
76
|
-
],
|
|
77
|
-
[
|
|
78
|
-
ErrorType.CodePointLimit,
|
|
79
|
-
"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"
|
|
80
|
-
],
|
|
81
|
-
[
|
|
82
|
-
ErrorType.OctalDeprecation,
|
|
83
|
-
'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'
|
|
84
|
-
],
|
|
85
|
-
[ErrorType.EndOfString, "malformed escape sequence at end of string"]
|
|
86
|
-
]);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/index.js
|
|
91
|
-
var require_dist = __commonJS({
|
|
92
|
-
"node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/index.js"(exports) {
|
|
93
|
-
"use strict";
|
|
94
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
95
|
-
exports.unraw = exports.errorMessages = exports.ErrorType = void 0;
|
|
96
|
-
var errors_1 = require_errors();
|
|
97
|
-
Object.defineProperty(exports, "ErrorType", { enumerable: true, get: function() {
|
|
98
|
-
return errors_1.ErrorType;
|
|
99
|
-
} });
|
|
100
|
-
Object.defineProperty(exports, "errorMessages", { enumerable: true, get: function() {
|
|
101
|
-
return errors_1.errorMessages;
|
|
102
|
-
} });
|
|
103
|
-
function parseHexToInt(hex) {
|
|
104
|
-
const isOnlyHexChars = !hex.match(/[^a-f0-9]/i);
|
|
105
|
-
return isOnlyHexChars ? parseInt(hex, 16) : NaN;
|
|
106
|
-
}
|
|
107
|
-
function validateAndParseHex(hex, errorName, enforcedLength) {
|
|
108
|
-
const parsedHex = parseHexToInt(hex);
|
|
109
|
-
if (Number.isNaN(parsedHex) || enforcedLength !== void 0 && enforcedLength !== hex.length) {
|
|
110
|
-
throw new SyntaxError(errors_1.errorMessages.get(errorName));
|
|
111
|
-
}
|
|
112
|
-
return parsedHex;
|
|
113
|
-
}
|
|
114
|
-
function parseHexadecimalCode(code) {
|
|
115
|
-
const parsedCode = validateAndParseHex(code, errors_1.ErrorType.MalformedHexadecimal, 2);
|
|
116
|
-
return String.fromCharCode(parsedCode);
|
|
117
|
-
}
|
|
118
|
-
function parseUnicodeCode(code, surrogateCode) {
|
|
119
|
-
const parsedCode = validateAndParseHex(code, errors_1.ErrorType.MalformedUnicode, 4);
|
|
120
|
-
if (surrogateCode !== void 0) {
|
|
121
|
-
const parsedSurrogateCode = validateAndParseHex(surrogateCode, errors_1.ErrorType.MalformedUnicode, 4);
|
|
122
|
-
return String.fromCharCode(parsedCode, parsedSurrogateCode);
|
|
123
|
-
}
|
|
124
|
-
return String.fromCharCode(parsedCode);
|
|
125
|
-
}
|
|
126
|
-
function isCurlyBraced(text) {
|
|
127
|
-
return text.charAt(0) === "{" && text.charAt(text.length - 1) === "}";
|
|
128
|
-
}
|
|
129
|
-
function parseUnicodeCodePointCode(codePoint) {
|
|
130
|
-
if (!isCurlyBraced(codePoint)) {
|
|
131
|
-
throw new SyntaxError(errors_1.errorMessages.get(errors_1.ErrorType.MalformedUnicode));
|
|
132
|
-
}
|
|
133
|
-
const withoutBraces = codePoint.slice(1, -1);
|
|
134
|
-
const parsedCode = validateAndParseHex(withoutBraces, errors_1.ErrorType.MalformedUnicode);
|
|
135
|
-
try {
|
|
136
|
-
return String.fromCodePoint(parsedCode);
|
|
137
|
-
} catch (err) {
|
|
138
|
-
throw err instanceof RangeError ? new SyntaxError(errors_1.errorMessages.get(errors_1.ErrorType.CodePointLimit)) : err;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
function parseOctalCode(code, error = false) {
|
|
142
|
-
if (error) {
|
|
143
|
-
throw new SyntaxError(errors_1.errorMessages.get(errors_1.ErrorType.OctalDeprecation));
|
|
144
|
-
}
|
|
145
|
-
const parsedCode = parseInt(code, 8);
|
|
146
|
-
return String.fromCharCode(parsedCode);
|
|
147
|
-
}
|
|
148
|
-
var singleCharacterEscapes = /* @__PURE__ */ new Map([
|
|
149
|
-
["b", "\b"],
|
|
150
|
-
["f", "\f"],
|
|
151
|
-
["n", "\n"],
|
|
152
|
-
["r", "\r"],
|
|
153
|
-
["t", " "],
|
|
154
|
-
["v", "\v"],
|
|
155
|
-
["0", "\0"]
|
|
156
|
-
]);
|
|
157
|
-
function parseSingleCharacterCode(code) {
|
|
158
|
-
return singleCharacterEscapes.get(code) || code;
|
|
159
|
-
}
|
|
160
|
-
var escapeMatch = /\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;
|
|
161
|
-
function unraw2(raw, allowOctals = false) {
|
|
162
|
-
return raw.replace(escapeMatch, function(_, backslash, hex, codePoint, unicodeWithSurrogate, surrogate, unicode, octal, singleCharacter) {
|
|
163
|
-
if (backslash !== void 0) {
|
|
164
|
-
return "\\";
|
|
165
|
-
}
|
|
166
|
-
if (hex !== void 0) {
|
|
167
|
-
return parseHexadecimalCode(hex);
|
|
168
|
-
}
|
|
169
|
-
if (codePoint !== void 0) {
|
|
170
|
-
return parseUnicodeCodePointCode(codePoint);
|
|
171
|
-
}
|
|
172
|
-
if (unicodeWithSurrogate !== void 0) {
|
|
173
|
-
return parseUnicodeCode(unicodeWithSurrogate, surrogate);
|
|
174
|
-
}
|
|
175
|
-
if (unicode !== void 0) {
|
|
176
|
-
return parseUnicodeCode(unicode);
|
|
177
|
-
}
|
|
178
|
-
if (octal === "0") {
|
|
179
|
-
return "\0";
|
|
180
|
-
}
|
|
181
|
-
if (octal !== void 0) {
|
|
182
|
-
return parseOctalCode(octal, !allowOctals);
|
|
183
|
-
}
|
|
184
|
-
if (singleCharacter !== void 0) {
|
|
185
|
-
return parseSingleCharacterCode(singleCharacter);
|
|
186
|
-
}
|
|
187
|
-
throw new SyntaxError(errors_1.errorMessages.get(errors_1.ErrorType.EndOfString));
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
exports.unraw = unraw2;
|
|
191
|
-
exports.default = unraw2;
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
// node_modules/.pnpm/moo@0.5.2/node_modules/moo/moo.js
|
|
196
|
-
var require_moo = __commonJS({
|
|
197
|
-
"node_modules/.pnpm/moo@0.5.2/node_modules/moo/moo.js"(exports, module) {
|
|
198
|
-
(function(root, factory) {
|
|
199
|
-
if (typeof define === "function" && define.amd) {
|
|
200
|
-
define([], factory);
|
|
201
|
-
} else if (typeof module === "object" && module.exports) {
|
|
202
|
-
module.exports = factory();
|
|
203
|
-
} else {
|
|
204
|
-
root.moo = factory();
|
|
205
|
-
}
|
|
206
|
-
})(exports, function() {
|
|
207
|
-
"use strict";
|
|
208
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
209
|
-
var toString = Object.prototype.toString;
|
|
210
|
-
var hasSticky = typeof new RegExp().sticky === "boolean";
|
|
211
|
-
function isRegExp(o) {
|
|
212
|
-
return o && toString.call(o) === "[object RegExp]";
|
|
213
|
-
}
|
|
214
|
-
function isObject(o) {
|
|
215
|
-
return o && typeof o === "object" && !isRegExp(o) && !Array.isArray(o);
|
|
216
|
-
}
|
|
217
|
-
function reEscape(s) {
|
|
218
|
-
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
219
|
-
}
|
|
220
|
-
function reGroups(s) {
|
|
221
|
-
var re = new RegExp("|" + s);
|
|
222
|
-
return re.exec("").length - 1;
|
|
223
|
-
}
|
|
224
|
-
function reCapture(s) {
|
|
225
|
-
return "(" + s + ")";
|
|
226
|
-
}
|
|
227
|
-
function reUnion(regexps) {
|
|
228
|
-
if (!regexps.length) return "(?!)";
|
|
229
|
-
var source = regexps.map(function(s) {
|
|
230
|
-
return "(?:" + s + ")";
|
|
231
|
-
}).join("|");
|
|
232
|
-
return "(?:" + source + ")";
|
|
233
|
-
}
|
|
234
|
-
function regexpOrLiteral(obj) {
|
|
235
|
-
if (typeof obj === "string") {
|
|
236
|
-
return "(?:" + reEscape(obj) + ")";
|
|
237
|
-
} else if (isRegExp(obj)) {
|
|
238
|
-
if (obj.ignoreCase) throw new Error("RegExp /i flag not allowed");
|
|
239
|
-
if (obj.global) throw new Error("RegExp /g flag is implied");
|
|
240
|
-
if (obj.sticky) throw new Error("RegExp /y flag is implied");
|
|
241
|
-
if (obj.multiline) throw new Error("RegExp /m flag is implied");
|
|
242
|
-
return obj.source;
|
|
243
|
-
} else {
|
|
244
|
-
throw new Error("Not a pattern: " + obj);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
function pad(s, length) {
|
|
248
|
-
if (s.length > length) {
|
|
249
|
-
return s;
|
|
250
|
-
}
|
|
251
|
-
return Array(length - s.length + 1).join(" ") + s;
|
|
252
|
-
}
|
|
253
|
-
function lastNLines(string, numLines) {
|
|
254
|
-
var position = string.length;
|
|
255
|
-
var lineBreaks = 0;
|
|
256
|
-
while (true) {
|
|
257
|
-
var idx = string.lastIndexOf("\n", position - 1);
|
|
258
|
-
if (idx === -1) {
|
|
259
|
-
break;
|
|
260
|
-
} else {
|
|
261
|
-
lineBreaks++;
|
|
262
|
-
}
|
|
263
|
-
position = idx;
|
|
264
|
-
if (lineBreaks === numLines) {
|
|
265
|
-
break;
|
|
266
|
-
}
|
|
267
|
-
if (position === 0) {
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
var startPosition = lineBreaks < numLines ? 0 : position + 1;
|
|
272
|
-
return string.substring(startPosition).split("\n");
|
|
273
|
-
}
|
|
274
|
-
function objectToRules(object) {
|
|
275
|
-
var keys = Object.getOwnPropertyNames(object);
|
|
276
|
-
var result = [];
|
|
277
|
-
for (var i = 0; i < keys.length; i++) {
|
|
278
|
-
var key = keys[i];
|
|
279
|
-
var thing = object[key];
|
|
280
|
-
var rules = [].concat(thing);
|
|
281
|
-
if (key === "include") {
|
|
282
|
-
for (var j = 0; j < rules.length; j++) {
|
|
283
|
-
result.push({ include: rules[j] });
|
|
284
|
-
}
|
|
285
|
-
continue;
|
|
286
|
-
}
|
|
287
|
-
var match = [];
|
|
288
|
-
rules.forEach(function(rule) {
|
|
289
|
-
if (isObject(rule)) {
|
|
290
|
-
if (match.length) result.push(ruleOptions(key, match));
|
|
291
|
-
result.push(ruleOptions(key, rule));
|
|
292
|
-
match = [];
|
|
293
|
-
} else {
|
|
294
|
-
match.push(rule);
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
if (match.length) result.push(ruleOptions(key, match));
|
|
298
|
-
}
|
|
299
|
-
return result;
|
|
300
|
-
}
|
|
301
|
-
function arrayToRules(array) {
|
|
302
|
-
var result = [];
|
|
303
|
-
for (var i = 0; i < array.length; i++) {
|
|
304
|
-
var obj = array[i];
|
|
305
|
-
if (obj.include) {
|
|
306
|
-
var include = [].concat(obj.include);
|
|
307
|
-
for (var j = 0; j < include.length; j++) {
|
|
308
|
-
result.push({ include: include[j] });
|
|
309
|
-
}
|
|
310
|
-
continue;
|
|
311
|
-
}
|
|
312
|
-
if (!obj.type) {
|
|
313
|
-
throw new Error("Rule has no type: " + JSON.stringify(obj));
|
|
314
|
-
}
|
|
315
|
-
result.push(ruleOptions(obj.type, obj));
|
|
316
|
-
}
|
|
317
|
-
return result;
|
|
318
|
-
}
|
|
319
|
-
function ruleOptions(type, obj) {
|
|
320
|
-
if (!isObject(obj)) {
|
|
321
|
-
obj = { match: obj };
|
|
322
|
-
}
|
|
323
|
-
if (obj.include) {
|
|
324
|
-
throw new Error("Matching rules cannot also include states");
|
|
325
|
-
}
|
|
326
|
-
var options = {
|
|
327
|
-
defaultType: type,
|
|
328
|
-
lineBreaks: !!obj.error || !!obj.fallback,
|
|
329
|
-
pop: false,
|
|
330
|
-
next: null,
|
|
331
|
-
push: null,
|
|
332
|
-
error: false,
|
|
333
|
-
fallback: false,
|
|
334
|
-
value: null,
|
|
335
|
-
type: null,
|
|
336
|
-
shouldThrow: false
|
|
337
|
-
};
|
|
338
|
-
for (var key in obj) {
|
|
339
|
-
if (hasOwnProperty.call(obj, key)) {
|
|
340
|
-
options[key] = obj[key];
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
if (typeof options.type === "string" && type !== options.type) {
|
|
344
|
-
throw new Error("Type transform cannot be a string (type '" + options.type + "' for token '" + type + "')");
|
|
345
|
-
}
|
|
346
|
-
var match = options.match;
|
|
347
|
-
options.match = Array.isArray(match) ? match : match ? [match] : [];
|
|
348
|
-
options.match.sort(function(a, b) {
|
|
349
|
-
return isRegExp(a) && isRegExp(b) ? 0 : isRegExp(b) ? -1 : isRegExp(a) ? 1 : b.length - a.length;
|
|
350
|
-
});
|
|
351
|
-
return options;
|
|
352
|
-
}
|
|
353
|
-
function toRules(spec) {
|
|
354
|
-
return Array.isArray(spec) ? arrayToRules(spec) : objectToRules(spec);
|
|
355
|
-
}
|
|
356
|
-
var defaultErrorRule = ruleOptions("error", { lineBreaks: true, shouldThrow: true });
|
|
357
|
-
function compileRules(rules, hasStates) {
|
|
358
|
-
var errorRule = null;
|
|
359
|
-
var fast = /* @__PURE__ */ Object.create(null);
|
|
360
|
-
var fastAllowed = true;
|
|
361
|
-
var unicodeFlag = null;
|
|
362
|
-
var groups = [];
|
|
363
|
-
var parts = [];
|
|
364
|
-
for (var i = 0; i < rules.length; i++) {
|
|
365
|
-
if (rules[i].fallback) {
|
|
366
|
-
fastAllowed = false;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
for (var i = 0; i < rules.length; i++) {
|
|
370
|
-
var options = rules[i];
|
|
371
|
-
if (options.include) {
|
|
372
|
-
throw new Error("Inheritance is not allowed in stateless lexers");
|
|
373
|
-
}
|
|
374
|
-
if (options.error || options.fallback) {
|
|
375
|
-
if (errorRule) {
|
|
376
|
-
if (!options.fallback === !errorRule.fallback) {
|
|
377
|
-
throw new Error("Multiple " + (options.fallback ? "fallback" : "error") + " rules not allowed (for token '" + options.defaultType + "')");
|
|
378
|
-
} else {
|
|
379
|
-
throw new Error("fallback and error are mutually exclusive (for token '" + options.defaultType + "')");
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
errorRule = options;
|
|
383
|
-
}
|
|
384
|
-
var match = options.match.slice();
|
|
385
|
-
if (fastAllowed) {
|
|
386
|
-
while (match.length && typeof match[0] === "string" && match[0].length === 1) {
|
|
387
|
-
var word = match.shift();
|
|
388
|
-
fast[word.charCodeAt(0)] = options;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
if (options.pop || options.push || options.next) {
|
|
392
|
-
if (!hasStates) {
|
|
393
|
-
throw new Error("State-switching options are not allowed in stateless lexers (for token '" + options.defaultType + "')");
|
|
394
|
-
}
|
|
395
|
-
if (options.fallback) {
|
|
396
|
-
throw new Error("State-switching options are not allowed on fallback tokens (for token '" + options.defaultType + "')");
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
if (match.length === 0) {
|
|
400
|
-
continue;
|
|
401
|
-
}
|
|
402
|
-
fastAllowed = false;
|
|
403
|
-
groups.push(options);
|
|
404
|
-
for (var j = 0; j < match.length; j++) {
|
|
405
|
-
var obj = match[j];
|
|
406
|
-
if (!isRegExp(obj)) {
|
|
407
|
-
continue;
|
|
408
|
-
}
|
|
409
|
-
if (unicodeFlag === null) {
|
|
410
|
-
unicodeFlag = obj.unicode;
|
|
411
|
-
} else if (unicodeFlag !== obj.unicode && options.fallback === false) {
|
|
412
|
-
throw new Error("If one rule is /u then all must be");
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
var pat = reUnion(match.map(regexpOrLiteral));
|
|
416
|
-
var regexp = new RegExp(pat);
|
|
417
|
-
if (regexp.test("")) {
|
|
418
|
-
throw new Error("RegExp matches empty string: " + regexp);
|
|
419
|
-
}
|
|
420
|
-
var groupCount = reGroups(pat);
|
|
421
|
-
if (groupCount > 0) {
|
|
422
|
-
throw new Error("RegExp has capture groups: " + regexp + "\nUse (?: \u2026 ) instead");
|
|
423
|
-
}
|
|
424
|
-
if (!options.lineBreaks && regexp.test("\n")) {
|
|
425
|
-
throw new Error("Rule should declare lineBreaks: " + regexp);
|
|
426
|
-
}
|
|
427
|
-
parts.push(reCapture(pat));
|
|
428
|
-
}
|
|
429
|
-
var fallbackRule = errorRule && errorRule.fallback;
|
|
430
|
-
var flags = hasSticky && !fallbackRule ? "ym" : "gm";
|
|
431
|
-
var suffix2 = hasSticky || fallbackRule ? "" : "|";
|
|
432
|
-
if (unicodeFlag === true) flags += "u";
|
|
433
|
-
var combined = new RegExp(reUnion(parts) + suffix2, flags);
|
|
434
|
-
return { regexp: combined, groups, fast, error: errorRule || defaultErrorRule };
|
|
435
|
-
}
|
|
436
|
-
function compile(rules) {
|
|
437
|
-
var result = compileRules(toRules(rules));
|
|
438
|
-
return new Lexer({ start: result }, "start");
|
|
439
|
-
}
|
|
440
|
-
function checkStateGroup(g, name, map) {
|
|
441
|
-
var state = g && (g.push || g.next);
|
|
442
|
-
if (state && !map[state]) {
|
|
443
|
-
throw new Error("Missing state '" + state + "' (in token '" + g.defaultType + "' of state '" + name + "')");
|
|
444
|
-
}
|
|
445
|
-
if (g && g.pop && +g.pop !== 1) {
|
|
446
|
-
throw new Error("pop must be 1 (in token '" + g.defaultType + "' of state '" + name + "')");
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
function compileStates(states, start) {
|
|
450
|
-
var all = states.$all ? toRules(states.$all) : [];
|
|
451
|
-
delete states.$all;
|
|
452
|
-
var keys = Object.getOwnPropertyNames(states);
|
|
453
|
-
if (!start) start = keys[0];
|
|
454
|
-
var ruleMap = /* @__PURE__ */ Object.create(null);
|
|
455
|
-
for (var i = 0; i < keys.length; i++) {
|
|
456
|
-
var key = keys[i];
|
|
457
|
-
ruleMap[key] = toRules(states[key]).concat(all);
|
|
458
|
-
}
|
|
459
|
-
for (var i = 0; i < keys.length; i++) {
|
|
460
|
-
var key = keys[i];
|
|
461
|
-
var rules = ruleMap[key];
|
|
462
|
-
var included = /* @__PURE__ */ Object.create(null);
|
|
463
|
-
for (var j = 0; j < rules.length; j++) {
|
|
464
|
-
var rule = rules[j];
|
|
465
|
-
if (!rule.include) continue;
|
|
466
|
-
var splice = [j, 1];
|
|
467
|
-
if (rule.include !== key && !included[rule.include]) {
|
|
468
|
-
included[rule.include] = true;
|
|
469
|
-
var newRules = ruleMap[rule.include];
|
|
470
|
-
if (!newRules) {
|
|
471
|
-
throw new Error("Cannot include nonexistent state '" + rule.include + "' (in state '" + key + "')");
|
|
472
|
-
}
|
|
473
|
-
for (var k = 0; k < newRules.length; k++) {
|
|
474
|
-
var newRule = newRules[k];
|
|
475
|
-
if (rules.indexOf(newRule) !== -1) continue;
|
|
476
|
-
splice.push(newRule);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
rules.splice.apply(rules, splice);
|
|
480
|
-
j--;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
var map = /* @__PURE__ */ Object.create(null);
|
|
484
|
-
for (var i = 0; i < keys.length; i++) {
|
|
485
|
-
var key = keys[i];
|
|
486
|
-
map[key] = compileRules(ruleMap[key], true);
|
|
487
|
-
}
|
|
488
|
-
for (var i = 0; i < keys.length; i++) {
|
|
489
|
-
var name = keys[i];
|
|
490
|
-
var state = map[name];
|
|
491
|
-
var groups = state.groups;
|
|
492
|
-
for (var j = 0; j < groups.length; j++) {
|
|
493
|
-
checkStateGroup(groups[j], name, map);
|
|
494
|
-
}
|
|
495
|
-
var fastKeys = Object.getOwnPropertyNames(state.fast);
|
|
496
|
-
for (var j = 0; j < fastKeys.length; j++) {
|
|
497
|
-
checkStateGroup(state.fast[fastKeys[j]], name, map);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
return new Lexer(map, start);
|
|
501
|
-
}
|
|
502
|
-
function keywordTransform(map) {
|
|
503
|
-
var isMap = typeof Map !== "undefined";
|
|
504
|
-
var reverseMap = isMap ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
|
|
505
|
-
var types = Object.getOwnPropertyNames(map);
|
|
506
|
-
for (var i = 0; i < types.length; i++) {
|
|
507
|
-
var tokenType = types[i];
|
|
508
|
-
var item = map[tokenType];
|
|
509
|
-
var keywordList = Array.isArray(item) ? item : [item];
|
|
510
|
-
keywordList.forEach(function(keyword) {
|
|
511
|
-
if (typeof keyword !== "string") {
|
|
512
|
-
throw new Error("keyword must be string (in keyword '" + tokenType + "')");
|
|
513
|
-
}
|
|
514
|
-
if (isMap) {
|
|
515
|
-
reverseMap.set(keyword, tokenType);
|
|
516
|
-
} else {
|
|
517
|
-
reverseMap[keyword] = tokenType;
|
|
518
|
-
}
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
return function(k) {
|
|
522
|
-
return isMap ? reverseMap.get(k) : reverseMap[k];
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
var Lexer = function(states, state) {
|
|
526
|
-
this.startState = state;
|
|
527
|
-
this.states = states;
|
|
528
|
-
this.buffer = "";
|
|
529
|
-
this.stack = [];
|
|
530
|
-
this.reset();
|
|
531
|
-
};
|
|
532
|
-
Lexer.prototype.reset = function(data, info) {
|
|
533
|
-
this.buffer = data || "";
|
|
534
|
-
this.index = 0;
|
|
535
|
-
this.line = info ? info.line : 1;
|
|
536
|
-
this.col = info ? info.col : 1;
|
|
537
|
-
this.queuedToken = info ? info.queuedToken : null;
|
|
538
|
-
this.queuedText = info ? info.queuedText : "";
|
|
539
|
-
this.queuedThrow = info ? info.queuedThrow : null;
|
|
540
|
-
this.setState(info ? info.state : this.startState);
|
|
541
|
-
this.stack = info && info.stack ? info.stack.slice() : [];
|
|
542
|
-
return this;
|
|
543
|
-
};
|
|
544
|
-
Lexer.prototype.save = function() {
|
|
545
|
-
return {
|
|
546
|
-
line: this.line,
|
|
547
|
-
col: this.col,
|
|
548
|
-
state: this.state,
|
|
549
|
-
stack: this.stack.slice(),
|
|
550
|
-
queuedToken: this.queuedToken,
|
|
551
|
-
queuedText: this.queuedText,
|
|
552
|
-
queuedThrow: this.queuedThrow
|
|
553
|
-
};
|
|
554
|
-
};
|
|
555
|
-
Lexer.prototype.setState = function(state) {
|
|
556
|
-
if (!state || this.state === state) return;
|
|
557
|
-
this.state = state;
|
|
558
|
-
var info = this.states[state];
|
|
559
|
-
this.groups = info.groups;
|
|
560
|
-
this.error = info.error;
|
|
561
|
-
this.re = info.regexp;
|
|
562
|
-
this.fast = info.fast;
|
|
563
|
-
};
|
|
564
|
-
Lexer.prototype.popState = function() {
|
|
565
|
-
this.setState(this.stack.pop());
|
|
566
|
-
};
|
|
567
|
-
Lexer.prototype.pushState = function(state) {
|
|
568
|
-
this.stack.push(this.state);
|
|
569
|
-
this.setState(state);
|
|
570
|
-
};
|
|
571
|
-
var eat = hasSticky ? function(re, buffer) {
|
|
572
|
-
return re.exec(buffer);
|
|
573
|
-
} : function(re, buffer) {
|
|
574
|
-
var match = re.exec(buffer);
|
|
575
|
-
if (match[0].length === 0) {
|
|
576
|
-
return null;
|
|
577
|
-
}
|
|
578
|
-
return match;
|
|
579
|
-
};
|
|
580
|
-
Lexer.prototype._getGroup = function(match) {
|
|
581
|
-
var groupCount = this.groups.length;
|
|
582
|
-
for (var i = 0; i < groupCount; i++) {
|
|
583
|
-
if (match[i + 1] !== void 0) {
|
|
584
|
-
return this.groups[i];
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
throw new Error("Cannot find token type for matched text");
|
|
588
|
-
};
|
|
589
|
-
function tokenToString() {
|
|
590
|
-
return this.value;
|
|
591
|
-
}
|
|
592
|
-
Lexer.prototype.next = function() {
|
|
593
|
-
var index = this.index;
|
|
594
|
-
if (this.queuedGroup) {
|
|
595
|
-
var token = this._token(this.queuedGroup, this.queuedText, index);
|
|
596
|
-
this.queuedGroup = null;
|
|
597
|
-
this.queuedText = "";
|
|
598
|
-
return token;
|
|
599
|
-
}
|
|
600
|
-
var buffer = this.buffer;
|
|
601
|
-
if (index === buffer.length) {
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
var group = this.fast[buffer.charCodeAt(index)];
|
|
605
|
-
if (group) {
|
|
606
|
-
return this._token(group, buffer.charAt(index), index);
|
|
607
|
-
}
|
|
608
|
-
var re = this.re;
|
|
609
|
-
re.lastIndex = index;
|
|
610
|
-
var match = eat(re, buffer);
|
|
611
|
-
var error = this.error;
|
|
612
|
-
if (match == null) {
|
|
613
|
-
return this._token(error, buffer.slice(index, buffer.length), index);
|
|
614
|
-
}
|
|
615
|
-
var group = this._getGroup(match);
|
|
616
|
-
var text = match[0];
|
|
617
|
-
if (error.fallback && match.index !== index) {
|
|
618
|
-
this.queuedGroup = group;
|
|
619
|
-
this.queuedText = text;
|
|
620
|
-
return this._token(error, buffer.slice(index, match.index), index);
|
|
621
|
-
}
|
|
622
|
-
return this._token(group, text, index);
|
|
623
|
-
};
|
|
624
|
-
Lexer.prototype._token = function(group, text, offset3) {
|
|
625
|
-
var lineBreaks = 0;
|
|
626
|
-
if (group.lineBreaks) {
|
|
627
|
-
var matchNL = /\n/g;
|
|
628
|
-
var nl = 1;
|
|
629
|
-
if (text === "\n") {
|
|
630
|
-
lineBreaks = 1;
|
|
631
|
-
} else {
|
|
632
|
-
while (matchNL.exec(text)) {
|
|
633
|
-
lineBreaks++;
|
|
634
|
-
nl = matchNL.lastIndex;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
var token = {
|
|
639
|
-
type: typeof group.type === "function" && group.type(text) || group.defaultType,
|
|
640
|
-
value: typeof group.value === "function" ? group.value(text) : text,
|
|
641
|
-
text,
|
|
642
|
-
toString: tokenToString,
|
|
643
|
-
offset: offset3,
|
|
644
|
-
lineBreaks,
|
|
645
|
-
line: this.line,
|
|
646
|
-
col: this.col
|
|
647
|
-
};
|
|
648
|
-
var size3 = text.length;
|
|
649
|
-
this.index += size3;
|
|
650
|
-
this.line += lineBreaks;
|
|
651
|
-
if (lineBreaks !== 0) {
|
|
652
|
-
this.col = size3 - nl + 1;
|
|
653
|
-
} else {
|
|
654
|
-
this.col += size3;
|
|
655
|
-
}
|
|
656
|
-
if (group.shouldThrow) {
|
|
657
|
-
var err = new Error(this.formatError(token, "invalid syntax"));
|
|
658
|
-
throw err;
|
|
659
|
-
}
|
|
660
|
-
if (group.pop) this.popState();
|
|
661
|
-
else if (group.push) this.pushState(group.push);
|
|
662
|
-
else if (group.next) this.setState(group.next);
|
|
663
|
-
return token;
|
|
664
|
-
};
|
|
665
|
-
if (typeof Symbol !== "undefined" && Symbol.iterator) {
|
|
666
|
-
var LexerIterator = function(lexer) {
|
|
667
|
-
this.lexer = lexer;
|
|
668
|
-
};
|
|
669
|
-
LexerIterator.prototype.next = function() {
|
|
670
|
-
var token = this.lexer.next();
|
|
671
|
-
return { value: token, done: !token };
|
|
672
|
-
};
|
|
673
|
-
LexerIterator.prototype[Symbol.iterator] = function() {
|
|
674
|
-
return this;
|
|
675
|
-
};
|
|
676
|
-
Lexer.prototype[Symbol.iterator] = function() {
|
|
677
|
-
return new LexerIterator(this);
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
Lexer.prototype.formatError = function(token, message) {
|
|
681
|
-
if (token == null) {
|
|
682
|
-
var text = this.buffer.slice(this.index);
|
|
683
|
-
var token = {
|
|
684
|
-
text,
|
|
685
|
-
offset: this.index,
|
|
686
|
-
lineBreaks: text.indexOf("\n") === -1 ? 0 : 1,
|
|
687
|
-
line: this.line,
|
|
688
|
-
col: this.col
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
var numLinesAround = 2;
|
|
692
|
-
var firstDisplayedLine = Math.max(token.line - numLinesAround, 1);
|
|
693
|
-
var lastDisplayedLine = token.line + numLinesAround;
|
|
694
|
-
var lastLineDigits = String(lastDisplayedLine).length;
|
|
695
|
-
var displayedLines = lastNLines(
|
|
696
|
-
this.buffer,
|
|
697
|
-
this.line - token.line + numLinesAround + 1
|
|
698
|
-
).slice(0, 5);
|
|
699
|
-
var errorLines = [];
|
|
700
|
-
errorLines.push(message + " at line " + token.line + " col " + token.col + ":");
|
|
701
|
-
errorLines.push("");
|
|
702
|
-
for (var i = 0; i < displayedLines.length; i++) {
|
|
703
|
-
var line = displayedLines[i];
|
|
704
|
-
var lineNo = firstDisplayedLine + i;
|
|
705
|
-
errorLines.push(pad(String(lineNo), lastLineDigits) + " " + line);
|
|
706
|
-
if (lineNo === token.line) {
|
|
707
|
-
errorLines.push(pad("", lastLineDigits + token.col + 1) + "^");
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
return errorLines.join("\n");
|
|
711
|
-
};
|
|
712
|
-
Lexer.prototype.clone = function() {
|
|
713
|
-
return new Lexer(this.states, this.state);
|
|
714
|
-
};
|
|
715
|
-
Lexer.prototype.has = function(tokenType) {
|
|
716
|
-
return true;
|
|
717
|
-
};
|
|
718
|
-
return {
|
|
719
|
-
compile,
|
|
720
|
-
states: compileStates,
|
|
721
|
-
error: Object.freeze({ error: true }),
|
|
722
|
-
fallback: Object.freeze({ fallback: true }),
|
|
723
|
-
keywords: keywordTransform
|
|
724
|
-
};
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
});
|
|
728
|
-
|
|
729
|
-
// node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js
|
|
730
|
-
var require_lexer = __commonJS({
|
|
731
|
-
"node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
|
|
732
|
-
"use strict";
|
|
733
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
734
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
735
|
-
};
|
|
736
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
737
|
-
exports.lexer = exports.states = void 0;
|
|
738
|
-
var moo_1 = __importDefault(require_moo());
|
|
739
|
-
exports.states = {
|
|
740
|
-
body: {
|
|
741
|
-
doubleapos: { match: "''", value: () => "'" },
|
|
742
|
-
quoted: {
|
|
743
|
-
lineBreaks: true,
|
|
744
|
-
match: /'[{}#](?:[^']|'')*'(?!')/u,
|
|
745
|
-
value: (src) => src.slice(1, -1).replace(/''/g, "'")
|
|
746
|
-
},
|
|
747
|
-
argument: {
|
|
748
|
-
lineBreaks: true,
|
|
749
|
-
match: /\{\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,
|
|
750
|
-
push: "arg",
|
|
751
|
-
value: (src) => src.substring(1).trim()
|
|
752
|
-
},
|
|
753
|
-
octothorpe: "#",
|
|
754
|
-
end: { match: "}", pop: 1 },
|
|
755
|
-
content: { lineBreaks: true, match: /[^][^{}#']*/u }
|
|
756
|
-
},
|
|
757
|
-
arg: {
|
|
758
|
-
select: {
|
|
759
|
-
lineBreaks: true,
|
|
760
|
-
match: /,\s*(?:plural|select|selectordinal)\s*,\s*/u,
|
|
761
|
-
next: "select",
|
|
762
|
-
value: (src) => src.split(",")[1].trim()
|
|
763
|
-
},
|
|
764
|
-
"func-args": {
|
|
765
|
-
lineBreaks: true,
|
|
766
|
-
match: /,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*,/u,
|
|
767
|
-
next: "body",
|
|
768
|
-
value: (src) => src.split(",")[1].trim()
|
|
769
|
-
},
|
|
770
|
-
"func-simple": {
|
|
771
|
-
lineBreaks: true,
|
|
772
|
-
match: /,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,
|
|
773
|
-
value: (src) => src.substring(1).trim()
|
|
774
|
-
},
|
|
775
|
-
end: { match: "}", pop: 1 }
|
|
776
|
-
},
|
|
777
|
-
select: {
|
|
778
|
-
offset: {
|
|
779
|
-
lineBreaks: true,
|
|
780
|
-
match: /\s*offset\s*:\s*\d+\s*/u,
|
|
781
|
-
value: (src) => src.split(":")[1].trim()
|
|
782
|
-
},
|
|
783
|
-
case: {
|
|
784
|
-
lineBreaks: true,
|
|
785
|
-
match: /\s*(?:=\d+|[^\p{Pat_Syn}\p{Pat_WS}]+)\s*\{/u,
|
|
786
|
-
push: "body",
|
|
787
|
-
value: (src) => src.substring(0, src.indexOf("{")).trim()
|
|
788
|
-
},
|
|
789
|
-
end: { match: /\s*\}/u, pop: 1 }
|
|
790
|
-
}
|
|
791
|
-
};
|
|
792
|
-
exports.lexer = moo_1.default.states(exports.states);
|
|
793
|
-
}
|
|
794
|
-
});
|
|
795
|
-
|
|
796
|
-
// node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js
|
|
797
|
-
var require_parser = __commonJS({
|
|
798
|
-
"node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js"(exports) {
|
|
799
|
-
"use strict";
|
|
800
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
801
|
-
exports.ParseError = void 0;
|
|
802
|
-
exports.parse = parse2;
|
|
803
|
-
var lexer_js_1 = require_lexer();
|
|
804
|
-
var getContext = (lt) => ({
|
|
805
|
-
offset: lt.offset,
|
|
806
|
-
line: lt.line,
|
|
807
|
-
col: lt.col,
|
|
808
|
-
text: lt.text,
|
|
809
|
-
lineBreaks: lt.lineBreaks
|
|
810
|
-
});
|
|
811
|
-
var isSelectType = (type) => type === "plural" || type === "select" || type === "selectordinal";
|
|
812
|
-
function strictArgStyleParam(lt, param) {
|
|
813
|
-
let value = "";
|
|
814
|
-
let text = "";
|
|
815
|
-
for (const p of param) {
|
|
816
|
-
const pText = p.ctx.text;
|
|
817
|
-
text += pText;
|
|
818
|
-
switch (p.type) {
|
|
819
|
-
case "content":
|
|
820
|
-
value += p.value;
|
|
821
|
-
break;
|
|
822
|
-
case "argument":
|
|
823
|
-
case "function":
|
|
824
|
-
case "octothorpe":
|
|
825
|
-
value += pText;
|
|
826
|
-
break;
|
|
827
|
-
default:
|
|
828
|
-
throw new ParseError(lt, `Unsupported part in strict mode function arg style: ${pText}`);
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
const c = {
|
|
832
|
-
type: "content",
|
|
833
|
-
value: value.trim(),
|
|
834
|
-
ctx: Object.assign({}, param[0].ctx, { text })
|
|
835
|
-
};
|
|
836
|
-
return [c];
|
|
837
|
-
}
|
|
838
|
-
var strictArgTypes = [
|
|
839
|
-
"number",
|
|
840
|
-
"date",
|
|
841
|
-
"time",
|
|
842
|
-
"spellout",
|
|
843
|
-
"ordinal",
|
|
844
|
-
"duration"
|
|
845
|
-
];
|
|
846
|
-
var defaultPluralKeys = ["zero", "one", "two", "few", "many", "other"];
|
|
847
|
-
var ParseError = class extends Error {
|
|
848
|
-
/** @internal */
|
|
849
|
-
constructor(lt, msg) {
|
|
850
|
-
super(lexer_js_1.lexer.formatError(lt, msg));
|
|
851
|
-
}
|
|
852
|
-
};
|
|
853
|
-
exports.ParseError = ParseError;
|
|
854
|
-
var Parser = class {
|
|
855
|
-
constructor(src, opt) {
|
|
856
|
-
var _a, _b, _c, _d;
|
|
857
|
-
this.lexer = lexer_js_1.lexer.reset(src);
|
|
858
|
-
this.cardinalKeys = (_a = opt === null || opt === void 0 ? void 0 : opt.cardinal) !== null && _a !== void 0 ? _a : defaultPluralKeys;
|
|
859
|
-
this.ordinalKeys = (_b = opt === null || opt === void 0 ? void 0 : opt.ordinal) !== null && _b !== void 0 ? _b : defaultPluralKeys;
|
|
860
|
-
this.strict = (_c = opt === null || opt === void 0 ? void 0 : opt.strict) !== null && _c !== void 0 ? _c : false;
|
|
861
|
-
this.strictPluralKeys = (_d = opt === null || opt === void 0 ? void 0 : opt.strictPluralKeys) !== null && _d !== void 0 ? _d : true;
|
|
862
|
-
}
|
|
863
|
-
parse() {
|
|
864
|
-
return this.parseBody(false, true);
|
|
865
|
-
}
|
|
866
|
-
checkSelectKey(lt, type, key) {
|
|
867
|
-
if (key[0] === "=") {
|
|
868
|
-
if (type === "select") {
|
|
869
|
-
throw new ParseError(lt, `The case ${key} is not valid with select`);
|
|
870
|
-
}
|
|
871
|
-
} else if (type !== "select") {
|
|
872
|
-
const keys = type === "plural" ? this.cardinalKeys : this.ordinalKeys;
|
|
873
|
-
if (this.strictPluralKeys && keys.length > 0 && !keys.includes(key)) {
|
|
874
|
-
const msg = `The ${type} case ${key} is not valid in this locale`;
|
|
875
|
-
throw new ParseError(lt, msg);
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
parseSelect({ value: arg }, inPlural, ctx, type) {
|
|
880
|
-
const sel = { type, arg, cases: [], ctx };
|
|
881
|
-
if (type === "plural" || type === "selectordinal")
|
|
882
|
-
inPlural = true;
|
|
883
|
-
else if (this.strict)
|
|
884
|
-
inPlural = false;
|
|
885
|
-
for (const lt of this.lexer) {
|
|
886
|
-
switch (lt.type) {
|
|
887
|
-
case "offset":
|
|
888
|
-
if (type === "select") {
|
|
889
|
-
throw new ParseError(lt, "Unexpected plural offset for select");
|
|
890
|
-
}
|
|
891
|
-
if (sel.cases.length > 0) {
|
|
892
|
-
throw new ParseError(lt, "Plural offset must be set before cases");
|
|
893
|
-
}
|
|
894
|
-
sel.pluralOffset = Number(lt.value);
|
|
895
|
-
ctx.text += lt.text;
|
|
896
|
-
ctx.lineBreaks += lt.lineBreaks;
|
|
897
|
-
break;
|
|
898
|
-
case "case": {
|
|
899
|
-
this.checkSelectKey(lt, type, lt.value);
|
|
900
|
-
sel.cases.push({
|
|
901
|
-
key: lt.value,
|
|
902
|
-
tokens: this.parseBody(inPlural),
|
|
903
|
-
ctx: getContext(lt)
|
|
904
|
-
});
|
|
905
|
-
break;
|
|
906
|
-
}
|
|
907
|
-
case "end":
|
|
908
|
-
return sel;
|
|
909
|
-
default:
|
|
910
|
-
throw new ParseError(lt, `Unexpected lexer token: ${lt.type}`);
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
throw new ParseError(null, "Unexpected message end");
|
|
914
|
-
}
|
|
915
|
-
parseArgToken(lt, inPlural) {
|
|
916
|
-
const ctx = getContext(lt);
|
|
917
|
-
const argType = this.lexer.next();
|
|
918
|
-
if (!argType)
|
|
919
|
-
throw new ParseError(null, "Unexpected message end");
|
|
920
|
-
ctx.text += argType.text;
|
|
921
|
-
ctx.lineBreaks += argType.lineBreaks;
|
|
922
|
-
if (this.strict && (argType.type === "func-simple" || argType.type === "func-args") && !strictArgTypes.includes(argType.value)) {
|
|
923
|
-
const msg = `Invalid strict mode function arg type: ${argType.value}`;
|
|
924
|
-
throw new ParseError(lt, msg);
|
|
925
|
-
}
|
|
926
|
-
switch (argType.type) {
|
|
927
|
-
case "end":
|
|
928
|
-
return { type: "argument", arg: lt.value, ctx };
|
|
929
|
-
case "func-simple": {
|
|
930
|
-
const end = this.lexer.next();
|
|
931
|
-
if (!end)
|
|
932
|
-
throw new ParseError(null, "Unexpected message end");
|
|
933
|
-
if (end.type !== "end") {
|
|
934
|
-
throw new ParseError(end, `Unexpected lexer token: ${end.type}`);
|
|
935
|
-
}
|
|
936
|
-
ctx.text += end.text;
|
|
937
|
-
if (isSelectType(argType.value.toLowerCase())) {
|
|
938
|
-
throw new ParseError(argType, `Invalid type identifier: ${argType.value}`);
|
|
939
|
-
}
|
|
940
|
-
return {
|
|
941
|
-
type: "function",
|
|
942
|
-
arg: lt.value,
|
|
943
|
-
key: argType.value,
|
|
944
|
-
ctx
|
|
945
|
-
};
|
|
946
|
-
}
|
|
947
|
-
case "func-args": {
|
|
948
|
-
if (isSelectType(argType.value.toLowerCase())) {
|
|
949
|
-
const msg = `Invalid type identifier: ${argType.value}`;
|
|
950
|
-
throw new ParseError(argType, msg);
|
|
951
|
-
}
|
|
952
|
-
let param = this.parseBody(this.strict ? false : inPlural);
|
|
953
|
-
if (this.strict && param.length > 0) {
|
|
954
|
-
param = strictArgStyleParam(lt, param);
|
|
955
|
-
}
|
|
956
|
-
return {
|
|
957
|
-
type: "function",
|
|
958
|
-
arg: lt.value,
|
|
959
|
-
key: argType.value,
|
|
960
|
-
param,
|
|
961
|
-
ctx
|
|
962
|
-
};
|
|
963
|
-
}
|
|
964
|
-
case "select":
|
|
965
|
-
if (isSelectType(argType.value)) {
|
|
966
|
-
return this.parseSelect(lt, inPlural, ctx, argType.value);
|
|
967
|
-
} else {
|
|
968
|
-
throw new ParseError(argType, `Unexpected select type ${argType.value}`);
|
|
969
|
-
}
|
|
970
|
-
default:
|
|
971
|
-
throw new ParseError(argType, `Unexpected lexer token: ${argType.type}`);
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
parseBody(inPlural, atRoot) {
|
|
975
|
-
const tokens = [];
|
|
976
|
-
let content = null;
|
|
977
|
-
for (const lt of this.lexer) {
|
|
978
|
-
if (lt.type === "argument") {
|
|
979
|
-
if (content)
|
|
980
|
-
content = null;
|
|
981
|
-
tokens.push(this.parseArgToken(lt, inPlural));
|
|
982
|
-
} else if (lt.type === "octothorpe" && inPlural) {
|
|
983
|
-
if (content)
|
|
984
|
-
content = null;
|
|
985
|
-
tokens.push({ type: "octothorpe", ctx: getContext(lt) });
|
|
986
|
-
} else if (lt.type === "end" && !atRoot) {
|
|
987
|
-
return tokens;
|
|
988
|
-
} else {
|
|
989
|
-
let value = lt.value;
|
|
990
|
-
if (!inPlural && lt.type === "quoted" && value[0] === "#") {
|
|
991
|
-
if (value.includes("{")) {
|
|
992
|
-
const errMsg = `Unsupported escape pattern: ${value}`;
|
|
993
|
-
throw new ParseError(lt, errMsg);
|
|
994
|
-
}
|
|
995
|
-
value = lt.text;
|
|
996
|
-
}
|
|
997
|
-
if (content) {
|
|
998
|
-
content.value += value;
|
|
999
|
-
content.ctx.text += lt.text;
|
|
1000
|
-
content.ctx.lineBreaks += lt.lineBreaks;
|
|
1001
|
-
} else {
|
|
1002
|
-
content = { type: "content", value, ctx: getContext(lt) };
|
|
1003
|
-
tokens.push(content);
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
if (atRoot)
|
|
1008
|
-
return tokens;
|
|
1009
|
-
throw new ParseError(null, "Unexpected message end");
|
|
1010
|
-
}
|
|
1011
|
-
};
|
|
1012
|
-
function parse2(src, options = {}) {
|
|
1013
|
-
const parser = new Parser(src, options);
|
|
1014
|
-
return parser.parse();
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
});
|
|
1018
|
-
|
|
1019
|
-
// packages/attention/index.js
|
|
1020
|
-
import { css, html as html2, nothing } from "lit";
|
|
1021
|
-
|
|
1022
|
-
// node_modules/.pnpm/@chbphone55+classnames@2.0.0/node_modules/@chbphone55/classnames/dist/index.m.js
|
|
1023
|
-
var r = function() {
|
|
1024
|
-
for (var t = [], n = arguments.length; n--; ) t[n] = arguments[n];
|
|
1025
|
-
return t.reduce(function(t2, n2) {
|
|
1026
|
-
return t2.concat("string" == typeof n2 ? n2 : Array.isArray(n2) ? r.apply(void 0, n2) : "object" == typeof n2 && n2 ? Object.keys(n2).map(function(r2) {
|
|
1027
|
-
return n2[r2] ? r2 : "";
|
|
1028
|
-
}) : "");
|
|
1029
|
-
}, []).join(" ");
|
|
1030
|
-
};
|
|
1031
|
-
|
|
1032
|
-
// node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_ty_33a2537ce57a59324989ce8020998d0e/node_modules/@lingui/core/dist/index.mjs
|
|
1033
|
-
var import_unraw = __toESM(require_dist(), 1);
|
|
1034
|
-
|
|
1035
|
-
// node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
|
|
1036
|
-
var import_parser = __toESM(require_parser(), 1);
|
|
1037
|
-
var DateFormatError = class extends Error {
|
|
1038
|
-
/** @internal */
|
|
1039
|
-
constructor(msg, token, type) {
|
|
1040
|
-
super(msg);
|
|
1041
|
-
this.token = token;
|
|
1042
|
-
this.type = type || "error";
|
|
1043
|
-
}
|
|
1044
|
-
};
|
|
1045
|
-
var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
|
|
1046
|
-
var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
|
|
1047
|
-
function yearOptions(token, onError) {
|
|
1048
|
-
switch (token.char) {
|
|
1049
|
-
case "y":
|
|
1050
|
-
return { year: numeric(token.width) };
|
|
1051
|
-
case "r":
|
|
1052
|
-
return { calendar: "gregory", year: "numeric" };
|
|
1053
|
-
case "u":
|
|
1054
|
-
case "U":
|
|
1055
|
-
case "Y":
|
|
1056
|
-
default:
|
|
1057
|
-
onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
|
|
1058
|
-
return { year: "numeric" };
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
function monthStyle(token, onError) {
|
|
1062
|
-
switch (token.width) {
|
|
1063
|
-
case 1:
|
|
1064
|
-
return "numeric";
|
|
1065
|
-
case 2:
|
|
1066
|
-
return "2-digit";
|
|
1067
|
-
case 3:
|
|
1068
|
-
return "short";
|
|
1069
|
-
case 4:
|
|
1070
|
-
return "long";
|
|
1071
|
-
case 5:
|
|
1072
|
-
return "narrow";
|
|
1073
|
-
default:
|
|
1074
|
-
onError(`${token.desc} is not supported with width ${token.width}`);
|
|
1075
|
-
return void 0;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
function dayStyle(token, onError) {
|
|
1079
|
-
const { char, desc, width } = token;
|
|
1080
|
-
if (char === "d") {
|
|
1081
|
-
return numeric(width);
|
|
1082
|
-
} else {
|
|
1083
|
-
onError(`${desc} is not supported`);
|
|
1084
|
-
return void 0;
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
function weekdayStyle(token, onError) {
|
|
1088
|
-
const { char, desc, width } = token;
|
|
1089
|
-
if ((char === "c" || char === "e") && width < 3) {
|
|
1090
|
-
const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
|
|
1091
|
-
onError(msg, DateFormatError.WARNING);
|
|
1092
|
-
}
|
|
1093
|
-
return alpha(width);
|
|
1094
|
-
}
|
|
1095
|
-
function hourOptions(token) {
|
|
1096
|
-
const hour = numeric(token.width);
|
|
1097
|
-
let hourCycle;
|
|
1098
|
-
switch (token.char) {
|
|
1099
|
-
case "h":
|
|
1100
|
-
hourCycle = "h12";
|
|
1101
|
-
break;
|
|
1102
|
-
case "H":
|
|
1103
|
-
hourCycle = "h23";
|
|
1104
|
-
break;
|
|
1105
|
-
case "k":
|
|
1106
|
-
hourCycle = "h24";
|
|
1107
|
-
break;
|
|
1108
|
-
case "K":
|
|
1109
|
-
hourCycle = "h11";
|
|
1110
|
-
break;
|
|
1111
|
-
}
|
|
1112
|
-
return hourCycle ? { hour, hourCycle } : { hour };
|
|
1113
|
-
}
|
|
1114
|
-
function timeZoneNameStyle(token, onError) {
|
|
1115
|
-
const { char, desc, width } = token;
|
|
1116
|
-
switch (char) {
|
|
1117
|
-
case "v":
|
|
1118
|
-
case "z":
|
|
1119
|
-
return width === 4 ? "long" : "short";
|
|
1120
|
-
case "V":
|
|
1121
|
-
if (width === 4)
|
|
1122
|
-
return "long";
|
|
1123
|
-
onError(`${desc} is not supported with width ${width}`);
|
|
1124
|
-
return void 0;
|
|
1125
|
-
case "X":
|
|
1126
|
-
onError(`${desc} is not supported`);
|
|
1127
|
-
return void 0;
|
|
1128
|
-
}
|
|
1129
|
-
return "short";
|
|
1130
|
-
}
|
|
1131
|
-
function compileOptions(token, onError) {
|
|
1132
|
-
switch (token.field) {
|
|
1133
|
-
case "era":
|
|
1134
|
-
return { era: alpha(token.width) };
|
|
1135
|
-
case "year":
|
|
1136
|
-
return yearOptions(token, onError);
|
|
1137
|
-
case "month":
|
|
1138
|
-
return { month: monthStyle(token, onError) };
|
|
1139
|
-
case "day":
|
|
1140
|
-
return { day: dayStyle(token, onError) };
|
|
1141
|
-
case "weekday":
|
|
1142
|
-
return { weekday: weekdayStyle(token, onError) };
|
|
1143
|
-
case "period":
|
|
1144
|
-
return void 0;
|
|
1145
|
-
case "hour":
|
|
1146
|
-
return hourOptions(token);
|
|
1147
|
-
case "min":
|
|
1148
|
-
return { minute: numeric(token.width) };
|
|
1149
|
-
case "sec":
|
|
1150
|
-
return { second: numeric(token.width) };
|
|
1151
|
-
case "tz":
|
|
1152
|
-
return { timeZoneName: timeZoneNameStyle(token, onError) };
|
|
1153
|
-
case "quarter":
|
|
1154
|
-
case "week":
|
|
1155
|
-
case "sec-frac":
|
|
1156
|
-
case "ms":
|
|
1157
|
-
onError(`${token.desc} is not supported`);
|
|
1158
|
-
}
|
|
1159
|
-
return void 0;
|
|
1160
|
-
}
|
|
1161
|
-
function getDateFormatOptions(tokens, timeZone, onError = (error) => {
|
|
1162
|
-
throw error;
|
|
1163
|
-
}) {
|
|
1164
|
-
const options = {
|
|
1165
|
-
timeZone
|
|
1166
|
-
};
|
|
1167
|
-
const fields2 = [];
|
|
1168
|
-
for (const token of tokens) {
|
|
1169
|
-
const { error, field, str } = token;
|
|
1170
|
-
if (error) {
|
|
1171
|
-
const dte = new DateFormatError(error.message, token);
|
|
1172
|
-
dte.stack = error.stack;
|
|
1173
|
-
onError(dte);
|
|
1174
|
-
}
|
|
1175
|
-
if (str) {
|
|
1176
|
-
const msg = `Ignoring string part: ${str}`;
|
|
1177
|
-
onError(new DateFormatError(msg, token, DateFormatError.WARNING));
|
|
1178
|
-
}
|
|
1179
|
-
if (field) {
|
|
1180
|
-
if (fields2.indexOf(field) === -1)
|
|
1181
|
-
fields2.push(field);
|
|
1182
|
-
else
|
|
1183
|
-
onError(new DateFormatError(`Duplicate ${field} token`, token));
|
|
1184
|
-
}
|
|
1185
|
-
const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
|
|
1186
|
-
if (opt)
|
|
1187
|
-
Object.assign(options, opt);
|
|
1188
|
-
}
|
|
1189
|
-
return options;
|
|
1190
|
-
}
|
|
1191
|
-
var fields = {
|
|
1192
|
-
G: { field: "era", desc: "Era" },
|
|
1193
|
-
y: { field: "year", desc: "Year" },
|
|
1194
|
-
Y: { field: "year", desc: 'Year of "Week of Year"' },
|
|
1195
|
-
u: { field: "year", desc: "Extended year" },
|
|
1196
|
-
U: { field: "year", desc: "Cyclic year name" },
|
|
1197
|
-
r: { field: "year", desc: "Related Gregorian year" },
|
|
1198
|
-
Q: { field: "quarter", desc: "Quarter" },
|
|
1199
|
-
q: { field: "quarter", desc: "Stand-alone quarter" },
|
|
1200
|
-
M: { field: "month", desc: "Month in year" },
|
|
1201
|
-
L: { field: "month", desc: "Stand-alone month in year" },
|
|
1202
|
-
w: { field: "week", desc: "Week of year" },
|
|
1203
|
-
W: { field: "week", desc: "Week of month" },
|
|
1204
|
-
d: { field: "day", desc: "Day in month" },
|
|
1205
|
-
D: { field: "day", desc: "Day of year" },
|
|
1206
|
-
F: { field: "day", desc: "Day of week in month" },
|
|
1207
|
-
g: { field: "day", desc: "Modified julian day" },
|
|
1208
|
-
E: { field: "weekday", desc: "Day of week" },
|
|
1209
|
-
e: { field: "weekday", desc: "Local day of week" },
|
|
1210
|
-
c: { field: "weekday", desc: "Stand-alone local day of week" },
|
|
1211
|
-
a: { field: "period", desc: "AM/PM marker" },
|
|
1212
|
-
b: { field: "period", desc: "AM/PM/noon/midnight marker" },
|
|
1213
|
-
B: { field: "period", desc: "Flexible day period" },
|
|
1214
|
-
h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
|
|
1215
|
-
H: { field: "hour", desc: "Hour in day (0~23)" },
|
|
1216
|
-
k: { field: "hour", desc: "Hour in day (1~24)" },
|
|
1217
|
-
K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
|
|
1218
|
-
j: { field: "hour", desc: "Hour in preferred cycle" },
|
|
1219
|
-
J: { field: "hour", desc: "Hour in preferred cycle without marker" },
|
|
1220
|
-
C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
|
|
1221
|
-
m: { field: "min", desc: "Minute in hour" },
|
|
1222
|
-
s: { field: "sec", desc: "Second in minute" },
|
|
1223
|
-
S: { field: "sec-frac", desc: "Fractional second" },
|
|
1224
|
-
A: { field: "ms", desc: "Milliseconds in day" },
|
|
1225
|
-
z: { field: "tz", desc: "Time Zone: specific non-location" },
|
|
1226
|
-
Z: { field: "tz", desc: "Time Zone" },
|
|
1227
|
-
O: { field: "tz", desc: "Time Zone: localized" },
|
|
1228
|
-
v: { field: "tz", desc: "Time Zone: generic non-location" },
|
|
1229
|
-
V: { field: "tz", desc: "Time Zone: ID" },
|
|
1230
|
-
X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
|
|
1231
|
-
x: { field: "tz", desc: "Time Zone: ISO8601" }
|
|
1232
|
-
};
|
|
1233
|
-
var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
|
|
1234
|
-
function readFieldToken(src, pos) {
|
|
1235
|
-
const char = src[pos];
|
|
1236
|
-
let width = 1;
|
|
1237
|
-
while (src[++pos] === char)
|
|
1238
|
-
++width;
|
|
1239
|
-
const field = fields[char];
|
|
1240
|
-
if (!field) {
|
|
1241
|
-
const msg = `The letter ${char} is not a valid field identifier`;
|
|
1242
|
-
return { char, error: new Error(msg), width };
|
|
1243
|
-
}
|
|
1244
|
-
return { char, field: field.field, desc: field.desc, width };
|
|
1245
|
-
}
|
|
1246
|
-
function readQuotedToken(src, pos) {
|
|
1247
|
-
let str = src[++pos];
|
|
1248
|
-
let width = 2;
|
|
1249
|
-
if (str === "'")
|
|
1250
|
-
return { char: "'", str, width };
|
|
1251
|
-
while (true) {
|
|
1252
|
-
const next = src[++pos];
|
|
1253
|
-
++width;
|
|
1254
|
-
if (next === void 0) {
|
|
1255
|
-
const msg = `Unterminated quoted literal in pattern: ${str || src}`;
|
|
1256
|
-
return { char: "'", error: new Error(msg), str, width };
|
|
1257
|
-
} else if (next === "'") {
|
|
1258
|
-
if (src[++pos] !== "'")
|
|
1259
|
-
return { char: "'", str, width };
|
|
1260
|
-
else
|
|
1261
|
-
++width;
|
|
1262
|
-
}
|
|
1263
|
-
str += next;
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
function readToken(src, pos) {
|
|
1267
|
-
const char = src[pos];
|
|
1268
|
-
if (!char)
|
|
1269
|
-
return null;
|
|
1270
|
-
if (isLetter(char))
|
|
1271
|
-
return readFieldToken(src, pos);
|
|
1272
|
-
if (char === "'")
|
|
1273
|
-
return readQuotedToken(src, pos);
|
|
1274
|
-
let str = char;
|
|
1275
|
-
let width = 1;
|
|
1276
|
-
while (true) {
|
|
1277
|
-
const next = src[++pos];
|
|
1278
|
-
if (!next || isLetter(next) || next === "'")
|
|
1279
|
-
return { char, str, width };
|
|
1280
|
-
str += next;
|
|
1281
|
-
width += 1;
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
function parseDateTokens(src) {
|
|
1285
|
-
const tokens = [];
|
|
1286
|
-
let pos = 0;
|
|
1287
|
-
while (true) {
|
|
1288
|
-
const token = readToken(src, pos);
|
|
1289
|
-
if (!token)
|
|
1290
|
-
return tokens;
|
|
1291
|
-
tokens.push(token);
|
|
1292
|
-
pos += token.width;
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
function processTokens(tokens, mapText) {
|
|
1296
|
-
if (!tokens.filter((token) => token.type !== "content").length) {
|
|
1297
|
-
return tokens.map((token) => mapText(token.value));
|
|
1298
|
-
}
|
|
1299
|
-
return tokens.map((token) => {
|
|
1300
|
-
var _a;
|
|
1301
|
-
if (token.type === "content") {
|
|
1302
|
-
return mapText(token.value);
|
|
1303
|
-
} else if (token.type === "octothorpe") {
|
|
1304
|
-
return "#";
|
|
1305
|
-
} else if (token.type === "argument") {
|
|
1306
|
-
return [token.arg];
|
|
1307
|
-
} else if (token.type === "function") {
|
|
1308
|
-
const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
|
|
1309
|
-
if (token.key === "date" && _param) {
|
|
1310
|
-
const opts = compileDateExpression(_param.value.trim(), (e) => {
|
|
1311
|
-
throw new Error(`Unable to compile date expression: ${e.message}`);
|
|
1312
|
-
});
|
|
1313
|
-
return [token.arg, token.key, opts];
|
|
1314
|
-
}
|
|
1315
|
-
if (_param) {
|
|
1316
|
-
return [token.arg, token.key, _param.value.trim()];
|
|
1317
|
-
} else {
|
|
1318
|
-
return [token.arg, token.key];
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
const offset3 = token.pluralOffset;
|
|
1322
|
-
const formatProps = {};
|
|
1323
|
-
token.cases.forEach(({ key, tokens: tokens2 }) => {
|
|
1324
|
-
const prop = key[0] === "=" ? key.slice(1) : key;
|
|
1325
|
-
formatProps[prop] = processTokens(tokens2, mapText);
|
|
1326
|
-
});
|
|
1327
|
-
return [
|
|
1328
|
-
token.arg,
|
|
1329
|
-
token.type,
|
|
1330
|
-
__spreadValues({
|
|
1331
|
-
offset: offset3
|
|
1332
|
-
}, formatProps)
|
|
1333
|
-
];
|
|
1334
|
-
});
|
|
1335
|
-
}
|
|
1336
|
-
function compileDateExpression(format, onError) {
|
|
1337
|
-
if (/^::/.test(format)) {
|
|
1338
|
-
const tokens = parseDateTokens(format.substring(2));
|
|
1339
|
-
return getDateFormatOptions(tokens, void 0, onError);
|
|
1340
|
-
}
|
|
1341
|
-
return format;
|
|
1342
|
-
}
|
|
1343
|
-
function compileMessage(message, mapText = (v) => v) {
|
|
1344
|
-
try {
|
|
1345
|
-
return processTokens((0, import_parser.parse)(message), mapText);
|
|
1346
|
-
} catch (e) {
|
|
1347
|
-
console.error(`${e.message}
|
|
1348
|
-
|
|
1349
|
-
Message: ${message}`);
|
|
1350
|
-
return [message];
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
// node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_ty_33a2537ce57a59324989ce8020998d0e/node_modules/@lingui/core/dist/index.mjs
|
|
1355
|
-
var isString = (s) => typeof s === "string";
|
|
1356
|
-
var isFunction = (f) => typeof f === "function";
|
|
1357
|
-
var cache = /* @__PURE__ */ new Map();
|
|
1358
|
-
var defaultLocale = "en";
|
|
1359
|
-
function normalizeLocales(locales) {
|
|
1360
|
-
const out = Array.isArray(locales) ? locales : [locales];
|
|
1361
|
-
return [...out, defaultLocale];
|
|
1362
|
-
}
|
|
1363
|
-
function date(locales, value, format) {
|
|
1364
|
-
const _locales = normalizeLocales(locales);
|
|
1365
|
-
if (!format) {
|
|
1366
|
-
format = "default";
|
|
1367
|
-
}
|
|
1368
|
-
let o;
|
|
1369
|
-
if (typeof format === "string") {
|
|
1370
|
-
o = {
|
|
1371
|
-
day: "numeric",
|
|
1372
|
-
month: "short",
|
|
1373
|
-
year: "numeric"
|
|
1374
|
-
};
|
|
1375
|
-
switch (format) {
|
|
1376
|
-
case "full":
|
|
1377
|
-
o.weekday = "long";
|
|
1378
|
-
case "long":
|
|
1379
|
-
o.month = "long";
|
|
1380
|
-
break;
|
|
1381
|
-
case "short":
|
|
1382
|
-
o.month = "numeric";
|
|
1383
|
-
break;
|
|
1384
|
-
}
|
|
1385
|
-
} else {
|
|
1386
|
-
o = format;
|
|
1387
|
-
}
|
|
1388
|
-
const formatter = getMemoized(
|
|
1389
|
-
() => cacheKey("date", _locales, format),
|
|
1390
|
-
() => new Intl.DateTimeFormat(_locales, o)
|
|
1391
|
-
);
|
|
1392
|
-
return formatter.format(isString(value) ? new Date(value) : value);
|
|
1393
|
-
}
|
|
1394
|
-
function time(locales, value, format) {
|
|
1395
|
-
let o;
|
|
1396
|
-
if (!format) {
|
|
1397
|
-
format = "default";
|
|
1398
|
-
}
|
|
1399
|
-
if (typeof format === "string") {
|
|
1400
|
-
o = {
|
|
1401
|
-
second: "numeric",
|
|
1402
|
-
minute: "numeric",
|
|
1403
|
-
hour: "numeric"
|
|
1404
|
-
};
|
|
1405
|
-
switch (format) {
|
|
1406
|
-
case "full":
|
|
1407
|
-
case "long":
|
|
1408
|
-
o.timeZoneName = "short";
|
|
1409
|
-
break;
|
|
1410
|
-
case "short":
|
|
1411
|
-
delete o.second;
|
|
1412
|
-
}
|
|
1413
|
-
} else {
|
|
1414
|
-
o = format;
|
|
1415
|
-
}
|
|
1416
|
-
return date(locales, value, o);
|
|
1417
|
-
}
|
|
1418
|
-
function number(locales, value, format) {
|
|
1419
|
-
const _locales = normalizeLocales(locales);
|
|
1420
|
-
const formatter = getMemoized(
|
|
1421
|
-
() => cacheKey("number", _locales, format),
|
|
1422
|
-
() => new Intl.NumberFormat(_locales, format)
|
|
1423
|
-
);
|
|
1424
|
-
return formatter.format(value);
|
|
1425
|
-
}
|
|
1426
|
-
function plural(locales, ordinal, value, _a) {
|
|
1427
|
-
var _b = _a, { offset: offset3 = 0 } = _b, rules = __objRest(_b, ["offset"]);
|
|
1428
|
-
var _a2, _b2;
|
|
1429
|
-
const _locales = normalizeLocales(locales);
|
|
1430
|
-
const plurals = ordinal ? getMemoized(
|
|
1431
|
-
() => cacheKey("plural-ordinal", _locales),
|
|
1432
|
-
() => new Intl.PluralRules(_locales, { type: "ordinal" })
|
|
1433
|
-
) : getMemoized(
|
|
1434
|
-
() => cacheKey("plural-cardinal", _locales),
|
|
1435
|
-
() => new Intl.PluralRules(_locales, { type: "cardinal" })
|
|
1436
|
-
);
|
|
1437
|
-
return (_b2 = (_a2 = rules[value]) != null ? _a2 : rules[plurals.select(value - offset3)]) != null ? _b2 : rules.other;
|
|
1438
|
-
}
|
|
1439
|
-
function getMemoized(getKey, construct) {
|
|
1440
|
-
const key = getKey();
|
|
1441
|
-
let formatter = cache.get(key);
|
|
1442
|
-
if (!formatter) {
|
|
1443
|
-
formatter = construct();
|
|
1444
|
-
cache.set(key, formatter);
|
|
1445
|
-
}
|
|
1446
|
-
return formatter;
|
|
1447
|
-
}
|
|
1448
|
-
function cacheKey(type, locales, options) {
|
|
1449
|
-
const localeKey = locales.join("-");
|
|
1450
|
-
return `${type}-${localeKey}-${JSON.stringify(options)}`;
|
|
1451
|
-
}
|
|
1452
|
-
var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
|
|
1453
|
-
var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
|
|
1454
|
-
var getDefaultFormats = (locale, passedLocales, formats = {}) => {
|
|
1455
|
-
const locales = passedLocales || locale;
|
|
1456
|
-
const style = (format) => {
|
|
1457
|
-
if (typeof format === "object")
|
|
1458
|
-
return format;
|
|
1459
|
-
return formats[format];
|
|
1460
|
-
};
|
|
1461
|
-
const replaceOctothorpe = (value, message) => {
|
|
1462
|
-
const numberFormat = Object.keys(formats).length ? style("number") : void 0;
|
|
1463
|
-
const valueStr = number(locales, value, numberFormat);
|
|
1464
|
-
return message.replace(new RegExp(OCTOTHORPE_PH, "g"), valueStr);
|
|
1465
|
-
};
|
|
1466
|
-
return {
|
|
1467
|
-
plural: (value, cases) => {
|
|
1468
|
-
const { offset: offset3 = 0 } = cases;
|
|
1469
|
-
const message = plural(locales, false, value, cases);
|
|
1470
|
-
return replaceOctothorpe(value - offset3, message);
|
|
1471
|
-
},
|
|
1472
|
-
selectordinal: (value, cases) => {
|
|
1473
|
-
const { offset: offset3 = 0 } = cases;
|
|
1474
|
-
const message = plural(locales, true, value, cases);
|
|
1475
|
-
return replaceOctothorpe(value - offset3, message);
|
|
1476
|
-
},
|
|
1477
|
-
select: selectFormatter,
|
|
1478
|
-
number: (value, format) => number(
|
|
1479
|
-
locales,
|
|
1480
|
-
value,
|
|
1481
|
-
style(format) || { style: format }
|
|
1482
|
-
),
|
|
1483
|
-
date: (value, format) => date(locales, value, style(format) || format),
|
|
1484
|
-
time: (value, format) => time(locales, value, style(format) || format)
|
|
1485
|
-
};
|
|
1486
|
-
};
|
|
1487
|
-
var selectFormatter = (value, rules) => {
|
|
1488
|
-
var _a;
|
|
1489
|
-
return (_a = rules[value]) != null ? _a : rules.other;
|
|
1490
|
-
};
|
|
1491
|
-
function interpolate(translation, locale, locales) {
|
|
1492
|
-
return (values = {}, formats) => {
|
|
1493
|
-
const formatters = getDefaultFormats(locale, locales, formats);
|
|
1494
|
-
const formatMessage = (tokens, replaceOctothorpe = false) => {
|
|
1495
|
-
if (!Array.isArray(tokens))
|
|
1496
|
-
return tokens;
|
|
1497
|
-
return tokens.reduce((message, token) => {
|
|
1498
|
-
if (token === "#" && replaceOctothorpe) {
|
|
1499
|
-
return message + OCTOTHORPE_PH;
|
|
1500
|
-
}
|
|
1501
|
-
if (isString(token)) {
|
|
1502
|
-
return message + token;
|
|
1503
|
-
}
|
|
1504
|
-
const [name, type, format] = token;
|
|
1505
|
-
let interpolatedFormat = {};
|
|
1506
|
-
if (type === "plural" || type === "selectordinal" || type === "select") {
|
|
1507
|
-
Object.entries(format).forEach(
|
|
1508
|
-
([key, value2]) => {
|
|
1509
|
-
interpolatedFormat[key] = formatMessage(
|
|
1510
|
-
value2,
|
|
1511
|
-
type === "plural" || type === "selectordinal"
|
|
1512
|
-
);
|
|
1513
|
-
}
|
|
1514
|
-
);
|
|
1515
|
-
} else {
|
|
1516
|
-
interpolatedFormat = format;
|
|
1517
|
-
}
|
|
1518
|
-
let value;
|
|
1519
|
-
if (type) {
|
|
1520
|
-
const formatter = formatters[type];
|
|
1521
|
-
value = formatter(values[name], interpolatedFormat);
|
|
1522
|
-
} else {
|
|
1523
|
-
value = values[name];
|
|
1524
|
-
}
|
|
1525
|
-
if (value == null) {
|
|
1526
|
-
return message;
|
|
1527
|
-
}
|
|
1528
|
-
return message + value;
|
|
1529
|
-
}, "");
|
|
1530
|
-
};
|
|
1531
|
-
const result = formatMessage(translation);
|
|
1532
|
-
if (isString(result) && UNICODE_REGEX.test(result)) {
|
|
1533
|
-
return (0, import_unraw.unraw)(result);
|
|
1534
|
-
}
|
|
1535
|
-
if (isString(result))
|
|
1536
|
-
return result;
|
|
1537
|
-
return result ? String(result) : "";
|
|
1538
|
-
};
|
|
1539
|
-
}
|
|
1540
|
-
var __defProp$1 = Object.defineProperty;
|
|
1541
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1542
|
-
var __publicField$1 = (obj, key, value) => {
|
|
1543
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1544
|
-
return value;
|
|
1545
|
-
};
|
|
1546
|
-
var EventEmitter = class {
|
|
1547
|
-
constructor() {
|
|
1548
|
-
__publicField$1(this, "_events", {});
|
|
1549
|
-
}
|
|
1550
|
-
on(event, listener) {
|
|
1551
|
-
var _a2;
|
|
1552
|
-
var _a;
|
|
1553
|
-
(_a2 = (_a = this._events)[event]) != null ? _a2 : _a[event] = [];
|
|
1554
|
-
this._events[event].push(listener);
|
|
1555
|
-
return () => this.removeListener(event, listener);
|
|
1556
|
-
}
|
|
1557
|
-
removeListener(event, listener) {
|
|
1558
|
-
const maybeListeners = this._getListeners(event);
|
|
1559
|
-
if (!maybeListeners)
|
|
1560
|
-
return;
|
|
1561
|
-
const index = maybeListeners.indexOf(listener);
|
|
1562
|
-
if (~index)
|
|
1563
|
-
maybeListeners.splice(index, 1);
|
|
1564
|
-
}
|
|
1565
|
-
emit(event, ...args) {
|
|
1566
|
-
const maybeListeners = this._getListeners(event);
|
|
1567
|
-
if (!maybeListeners)
|
|
1568
|
-
return;
|
|
1569
|
-
maybeListeners.map((listener) => listener.apply(this, args));
|
|
1570
|
-
}
|
|
1571
|
-
_getListeners(event) {
|
|
1572
|
-
const maybeListeners = this._events[event];
|
|
1573
|
-
return Array.isArray(maybeListeners) ? maybeListeners : false;
|
|
1574
|
-
}
|
|
1575
|
-
};
|
|
1576
|
-
var __defProp2 = Object.defineProperty;
|
|
1577
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1578
|
-
var __publicField2 = (obj, key, value) => {
|
|
1579
|
-
__defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1580
|
-
return value;
|
|
1581
|
-
};
|
|
1582
|
-
var I18n = class extends EventEmitter {
|
|
1583
|
-
constructor(params) {
|
|
1584
|
-
var _a;
|
|
1585
|
-
super();
|
|
1586
|
-
__publicField2(this, "_locale", "");
|
|
1587
|
-
__publicField2(this, "_locales");
|
|
1588
|
-
__publicField2(this, "_localeData", {});
|
|
1589
|
-
__publicField2(this, "_messages", {});
|
|
1590
|
-
__publicField2(this, "_missing");
|
|
1591
|
-
__publicField2(this, "_messageCompiler");
|
|
1592
|
-
__publicField2(this, "t", this._.bind(this));
|
|
1593
|
-
if (true) {
|
|
1594
|
-
this.setMessagesCompiler(compileMessage);
|
|
1595
|
-
}
|
|
1596
|
-
if (params.missing != null)
|
|
1597
|
-
this._missing = params.missing;
|
|
1598
|
-
if (params.messages != null)
|
|
1599
|
-
this.load(params.messages);
|
|
1600
|
-
if (params.localeData != null)
|
|
1601
|
-
this.loadLocaleData(params.localeData);
|
|
1602
|
-
if (typeof params.locale === "string" || params.locales) {
|
|
1603
|
-
this.activate((_a = params.locale) != null ? _a : defaultLocale, params.locales);
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
get locale() {
|
|
1607
|
-
return this._locale;
|
|
1608
|
-
}
|
|
1609
|
-
get locales() {
|
|
1610
|
-
return this._locales;
|
|
1611
|
-
}
|
|
1612
|
-
get messages() {
|
|
1613
|
-
var _a;
|
|
1614
|
-
return (_a = this._messages[this._locale]) != null ? _a : {};
|
|
1615
|
-
}
|
|
1616
|
-
/**
|
|
1617
|
-
* @deprecated this has no effect. Please remove this from the code. Deprecated in v4
|
|
1618
|
-
*/
|
|
1619
|
-
get localeData() {
|
|
1620
|
-
var _a;
|
|
1621
|
-
return (_a = this._localeData[this._locale]) != null ? _a : {};
|
|
1622
|
-
}
|
|
1623
|
-
_loadLocaleData(locale, localeData) {
|
|
1624
|
-
const maybeLocaleData = this._localeData[locale];
|
|
1625
|
-
if (!maybeLocaleData) {
|
|
1626
|
-
this._localeData[locale] = localeData;
|
|
1627
|
-
} else {
|
|
1628
|
-
Object.assign(maybeLocaleData, localeData);
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
/**
|
|
1632
|
-
* Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
|
|
1633
|
-
*
|
|
1634
|
-
* In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
|
|
1635
|
-
* By default, message catalogs should be precompiled during the build process. However,
|
|
1636
|
-
* if you need to compile catalogs at runtime, you can use this method to set a message compiler.
|
|
1637
|
-
*
|
|
1638
|
-
* Example usage:
|
|
1639
|
-
*
|
|
1640
|
-
* ```ts
|
|
1641
|
-
* import { compileMessage } from "@lingui/message-utils/compileMessage";
|
|
1642
|
-
*
|
|
1643
|
-
* i18n.setMessagesCompiler(compileMessage);
|
|
1644
|
-
* ```
|
|
1645
|
-
*/
|
|
1646
|
-
setMessagesCompiler(compiler) {
|
|
1647
|
-
this._messageCompiler = compiler;
|
|
1648
|
-
return this;
|
|
1649
|
-
}
|
|
1650
|
-
/**
|
|
1651
|
-
* @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
|
|
1652
|
-
*/
|
|
1653
|
-
loadLocaleData(localeOrAllData, localeData) {
|
|
1654
|
-
if (typeof localeOrAllData === "string") {
|
|
1655
|
-
this._loadLocaleData(localeOrAllData, localeData);
|
|
1656
|
-
} else {
|
|
1657
|
-
Object.keys(localeOrAllData).forEach(
|
|
1658
|
-
(locale) => this._loadLocaleData(locale, localeOrAllData[locale])
|
|
1659
|
-
);
|
|
1660
|
-
}
|
|
1661
|
-
this.emit("change");
|
|
1662
|
-
}
|
|
1663
|
-
_load(locale, messages7) {
|
|
1664
|
-
const maybeMessages = this._messages[locale];
|
|
1665
|
-
if (!maybeMessages) {
|
|
1666
|
-
this._messages[locale] = messages7;
|
|
1667
|
-
} else {
|
|
1668
|
-
Object.assign(maybeMessages, messages7);
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
load(localeOrMessages, messages7) {
|
|
1672
|
-
if (typeof localeOrMessages == "string" && typeof messages7 === "object") {
|
|
1673
|
-
this._load(localeOrMessages, messages7);
|
|
1674
|
-
} else {
|
|
1675
|
-
Object.entries(localeOrMessages).forEach(
|
|
1676
|
-
([locale, messages23]) => this._load(locale, messages23)
|
|
1677
|
-
);
|
|
1678
|
-
}
|
|
1679
|
-
this.emit("change");
|
|
1680
|
-
}
|
|
1681
|
-
/**
|
|
1682
|
-
* @param options {@link LoadAndActivateOptions}
|
|
1683
|
-
*/
|
|
1684
|
-
loadAndActivate({ locale, locales, messages: messages7 }) {
|
|
1685
|
-
this._locale = locale;
|
|
1686
|
-
this._locales = locales || void 0;
|
|
1687
|
-
this._messages[this._locale] = messages7;
|
|
1688
|
-
this.emit("change");
|
|
1689
|
-
}
|
|
1690
|
-
activate(locale, locales) {
|
|
1691
|
-
if (true) {
|
|
1692
|
-
if (!this._messages[locale]) {
|
|
1693
|
-
console.warn(`Messages for locale "${locale}" not loaded.`);
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
this._locale = locale;
|
|
1697
|
-
this._locales = locales;
|
|
1698
|
-
this.emit("change");
|
|
1699
|
-
}
|
|
1700
|
-
_(id, values, options) {
|
|
1701
|
-
if (!this.locale) {
|
|
1702
|
-
throw new Error(
|
|
1703
|
-
"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."
|
|
1704
|
-
);
|
|
1705
|
-
}
|
|
1706
|
-
let message = options == null ? void 0 : options.message;
|
|
1707
|
-
if (!id) {
|
|
1708
|
-
id = "";
|
|
1709
|
-
}
|
|
1710
|
-
if (!isString(id)) {
|
|
1711
|
-
values = id.values || values;
|
|
1712
|
-
message = id.message;
|
|
1713
|
-
id = id.id;
|
|
1714
|
-
}
|
|
1715
|
-
const messageForId = this.messages[id];
|
|
1716
|
-
const messageMissing = messageForId === void 0;
|
|
1717
|
-
const missing = this._missing;
|
|
1718
|
-
if (missing && messageMissing) {
|
|
1719
|
-
return isFunction(missing) ? missing(this._locale, id) : missing;
|
|
1720
|
-
}
|
|
1721
|
-
if (messageMissing) {
|
|
1722
|
-
this.emit("missing", { id, locale: this._locale });
|
|
1723
|
-
}
|
|
1724
|
-
let translation = messageForId || message || id;
|
|
1725
|
-
if (isString(translation)) {
|
|
1726
|
-
if (this._messageCompiler) {
|
|
1727
|
-
translation = this._messageCompiler(translation);
|
|
1728
|
-
} else {
|
|
1729
|
-
console.warn(`Uncompiled message detected! Message:
|
|
1730
|
-
|
|
1731
|
-
> ${translation}
|
|
4
|
+
> ${l}
|
|
1732
5
|
|
|
1733
6
|
That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
|
|
1734
7
|
ICU features such as interpolation and plurals will not work properly for that message.
|
|
1735
8
|
|
|
1736
9
|
Please compile your catalog first.
|
|
1737
|
-
`);
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
return JSON.parse(`"${translation}"`);
|
|
1742
|
-
if (isString(translation))
|
|
1743
|
-
return translation;
|
|
1744
|
-
return interpolate(
|
|
1745
|
-
translation,
|
|
1746
|
-
this._locale,
|
|
1747
|
-
this._locales
|
|
1748
|
-
)(values, options == null ? void 0 : options.formats);
|
|
1749
|
-
}
|
|
1750
|
-
date(value, format) {
|
|
1751
|
-
return date(this._locales || this._locale, value, format);
|
|
1752
|
-
}
|
|
1753
|
-
number(value, format) {
|
|
1754
|
-
return number(this._locales || this._locale, value, format);
|
|
1755
|
-
}
|
|
1756
|
-
};
|
|
1757
|
-
function setupI18n(params = {}) {
|
|
1758
|
-
return new I18n(params);
|
|
1759
|
-
}
|
|
1760
|
-
var i18n = setupI18n();
|
|
1761
|
-
|
|
1762
|
-
// node_modules/.pnpm/@floating-ui+utils@0.2.9/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
1763
|
-
var sides = ["top", "right", "bottom", "left"];
|
|
1764
|
-
var min = Math.min;
|
|
1765
|
-
var max = Math.max;
|
|
1766
|
-
var round = Math.round;
|
|
1767
|
-
var createCoords = (v) => ({
|
|
1768
|
-
x: v,
|
|
1769
|
-
y: v
|
|
1770
|
-
});
|
|
1771
|
-
var oppositeSideMap = {
|
|
1772
|
-
left: "right",
|
|
1773
|
-
right: "left",
|
|
1774
|
-
bottom: "top",
|
|
1775
|
-
top: "bottom"
|
|
1776
|
-
};
|
|
1777
|
-
var oppositeAlignmentMap = {
|
|
1778
|
-
start: "end",
|
|
1779
|
-
end: "start"
|
|
1780
|
-
};
|
|
1781
|
-
function clamp(start, value, end) {
|
|
1782
|
-
return max(start, min(value, end));
|
|
1783
|
-
}
|
|
1784
|
-
function evaluate(value, param) {
|
|
1785
|
-
return typeof value === "function" ? value(param) : value;
|
|
1786
|
-
}
|
|
1787
|
-
function getSide(placement) {
|
|
1788
|
-
return placement.split("-")[0];
|
|
1789
|
-
}
|
|
1790
|
-
function getAlignment(placement) {
|
|
1791
|
-
return placement.split("-")[1];
|
|
1792
|
-
}
|
|
1793
|
-
function getOppositeAxis(axis) {
|
|
1794
|
-
return axis === "x" ? "y" : "x";
|
|
1795
|
-
}
|
|
1796
|
-
function getAxisLength(axis) {
|
|
1797
|
-
return axis === "y" ? "height" : "width";
|
|
1798
|
-
}
|
|
1799
|
-
function getSideAxis(placement) {
|
|
1800
|
-
return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
|
|
1801
|
-
}
|
|
1802
|
-
function getAlignmentAxis(placement) {
|
|
1803
|
-
return getOppositeAxis(getSideAxis(placement));
|
|
1804
|
-
}
|
|
1805
|
-
function getAlignmentSides(placement, rects, rtl) {
|
|
1806
|
-
if (rtl === void 0) {
|
|
1807
|
-
rtl = false;
|
|
1808
|
-
}
|
|
1809
|
-
const alignment = getAlignment(placement);
|
|
1810
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
1811
|
-
const length = getAxisLength(alignmentAxis);
|
|
1812
|
-
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
1813
|
-
if (rects.reference[length] > rects.floating[length]) {
|
|
1814
|
-
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
1815
|
-
}
|
|
1816
|
-
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
1817
|
-
}
|
|
1818
|
-
function getExpandedPlacements(placement) {
|
|
1819
|
-
const oppositePlacement = getOppositePlacement(placement);
|
|
1820
|
-
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
1821
|
-
}
|
|
1822
|
-
function getOppositeAlignmentPlacement(placement) {
|
|
1823
|
-
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
|
|
1824
|
-
}
|
|
1825
|
-
function getSideList(side2, isStart, rtl) {
|
|
1826
|
-
const lr = ["left", "right"];
|
|
1827
|
-
const rl = ["right", "left"];
|
|
1828
|
-
const tb = ["top", "bottom"];
|
|
1829
|
-
const bt = ["bottom", "top"];
|
|
1830
|
-
switch (side2) {
|
|
1831
|
-
case "top":
|
|
1832
|
-
case "bottom":
|
|
1833
|
-
if (rtl) return isStart ? rl : lr;
|
|
1834
|
-
return isStart ? lr : rl;
|
|
1835
|
-
case "left":
|
|
1836
|
-
case "right":
|
|
1837
|
-
return isStart ? tb : bt;
|
|
1838
|
-
default:
|
|
1839
|
-
return [];
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
1843
|
-
const alignment = getAlignment(placement);
|
|
1844
|
-
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
1845
|
-
if (alignment) {
|
|
1846
|
-
list = list.map((side2) => side2 + "-" + alignment);
|
|
1847
|
-
if (flipAlignment) {
|
|
1848
|
-
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
1849
|
-
}
|
|
1850
|
-
}
|
|
1851
|
-
return list;
|
|
1852
|
-
}
|
|
1853
|
-
function getOppositePlacement(placement) {
|
|
1854
|
-
return placement.replace(/left|right|bottom|top/g, (side2) => oppositeSideMap[side2]);
|
|
1855
|
-
}
|
|
1856
|
-
function expandPaddingObject(padding) {
|
|
1857
|
-
return __spreadValues({
|
|
1858
|
-
top: 0,
|
|
1859
|
-
right: 0,
|
|
1860
|
-
bottom: 0,
|
|
1861
|
-
left: 0
|
|
1862
|
-
}, padding);
|
|
1863
|
-
}
|
|
1864
|
-
function getPaddingObject(padding) {
|
|
1865
|
-
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
1866
|
-
top: padding,
|
|
1867
|
-
right: padding,
|
|
1868
|
-
bottom: padding,
|
|
1869
|
-
left: padding
|
|
1870
|
-
};
|
|
1871
|
-
}
|
|
1872
|
-
function rectToClientRect(rect) {
|
|
1873
|
-
const {
|
|
1874
|
-
x,
|
|
1875
|
-
y,
|
|
1876
|
-
width,
|
|
1877
|
-
height
|
|
1878
|
-
} = rect;
|
|
1879
|
-
return {
|
|
1880
|
-
width,
|
|
1881
|
-
height,
|
|
1882
|
-
top: y,
|
|
1883
|
-
left: x,
|
|
1884
|
-
right: x + width,
|
|
1885
|
-
bottom: y + height,
|
|
1886
|
-
x,
|
|
1887
|
-
y
|
|
1888
|
-
};
|
|
1889
|
-
}
|
|
1890
|
-
|
|
1891
|
-
// node_modules/.pnpm/@floating-ui+core@1.6.9/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
1892
|
-
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
1893
|
-
let {
|
|
1894
|
-
reference,
|
|
1895
|
-
floating
|
|
1896
|
-
} = _ref;
|
|
1897
|
-
const sideAxis = getSideAxis(placement);
|
|
1898
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
1899
|
-
const alignLength = getAxisLength(alignmentAxis);
|
|
1900
|
-
const side2 = getSide(placement);
|
|
1901
|
-
const isVertical = sideAxis === "y";
|
|
1902
|
-
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
1903
|
-
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
1904
|
-
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
1905
|
-
let coords;
|
|
1906
|
-
switch (side2) {
|
|
1907
|
-
case "top":
|
|
1908
|
-
coords = {
|
|
1909
|
-
x: commonX,
|
|
1910
|
-
y: reference.y - floating.height
|
|
1911
|
-
};
|
|
1912
|
-
break;
|
|
1913
|
-
case "bottom":
|
|
1914
|
-
coords = {
|
|
1915
|
-
x: commonX,
|
|
1916
|
-
y: reference.y + reference.height
|
|
1917
|
-
};
|
|
1918
|
-
break;
|
|
1919
|
-
case "right":
|
|
1920
|
-
coords = {
|
|
1921
|
-
x: reference.x + reference.width,
|
|
1922
|
-
y: commonY
|
|
1923
|
-
};
|
|
1924
|
-
break;
|
|
1925
|
-
case "left":
|
|
1926
|
-
coords = {
|
|
1927
|
-
x: reference.x - floating.width,
|
|
1928
|
-
y: commonY
|
|
1929
|
-
};
|
|
1930
|
-
break;
|
|
1931
|
-
default:
|
|
1932
|
-
coords = {
|
|
1933
|
-
x: reference.x,
|
|
1934
|
-
y: reference.y
|
|
1935
|
-
};
|
|
1936
|
-
}
|
|
1937
|
-
switch (getAlignment(placement)) {
|
|
1938
|
-
case "start":
|
|
1939
|
-
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
1940
|
-
break;
|
|
1941
|
-
case "end":
|
|
1942
|
-
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
1943
|
-
break;
|
|
1944
|
-
}
|
|
1945
|
-
return coords;
|
|
1946
|
-
}
|
|
1947
|
-
var computePosition = async (reference, floating, config) => {
|
|
1948
|
-
const {
|
|
1949
|
-
placement = "bottom",
|
|
1950
|
-
strategy = "absolute",
|
|
1951
|
-
middleware = [],
|
|
1952
|
-
platform: platform2
|
|
1953
|
-
} = config;
|
|
1954
|
-
const validMiddleware = middleware.filter(Boolean);
|
|
1955
|
-
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
1956
|
-
let rects = await platform2.getElementRects({
|
|
1957
|
-
reference,
|
|
1958
|
-
floating,
|
|
1959
|
-
strategy
|
|
1960
|
-
});
|
|
1961
|
-
let {
|
|
1962
|
-
x,
|
|
1963
|
-
y
|
|
1964
|
-
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
1965
|
-
let statefulPlacement = placement;
|
|
1966
|
-
let middlewareData = {};
|
|
1967
|
-
let resetCount = 0;
|
|
1968
|
-
for (let i = 0; i < validMiddleware.length; i++) {
|
|
1969
|
-
const {
|
|
1970
|
-
name,
|
|
1971
|
-
fn
|
|
1972
|
-
} = validMiddleware[i];
|
|
1973
|
-
const {
|
|
1974
|
-
x: nextX,
|
|
1975
|
-
y: nextY,
|
|
1976
|
-
data,
|
|
1977
|
-
reset
|
|
1978
|
-
} = await fn({
|
|
1979
|
-
x,
|
|
1980
|
-
y,
|
|
1981
|
-
initialPlacement: placement,
|
|
1982
|
-
placement: statefulPlacement,
|
|
1983
|
-
strategy,
|
|
1984
|
-
middlewareData,
|
|
1985
|
-
rects,
|
|
1986
|
-
platform: platform2,
|
|
1987
|
-
elements: {
|
|
1988
|
-
reference,
|
|
1989
|
-
floating
|
|
1990
|
-
}
|
|
1991
|
-
});
|
|
1992
|
-
x = nextX != null ? nextX : x;
|
|
1993
|
-
y = nextY != null ? nextY : y;
|
|
1994
|
-
middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
|
|
1995
|
-
[name]: __spreadValues(__spreadValues({}, middlewareData[name]), data)
|
|
1996
|
-
});
|
|
1997
|
-
if (reset && resetCount <= 50) {
|
|
1998
|
-
resetCount++;
|
|
1999
|
-
if (typeof reset === "object") {
|
|
2000
|
-
if (reset.placement) {
|
|
2001
|
-
statefulPlacement = reset.placement;
|
|
2002
|
-
}
|
|
2003
|
-
if (reset.rects) {
|
|
2004
|
-
rects = reset.rects === true ? await platform2.getElementRects({
|
|
2005
|
-
reference,
|
|
2006
|
-
floating,
|
|
2007
|
-
strategy
|
|
2008
|
-
}) : reset.rects;
|
|
2009
|
-
}
|
|
2010
|
-
({
|
|
2011
|
-
x,
|
|
2012
|
-
y
|
|
2013
|
-
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
2014
|
-
}
|
|
2015
|
-
i = -1;
|
|
2016
|
-
}
|
|
2017
|
-
}
|
|
2018
|
-
return {
|
|
2019
|
-
x,
|
|
2020
|
-
y,
|
|
2021
|
-
placement: statefulPlacement,
|
|
2022
|
-
strategy,
|
|
2023
|
-
middlewareData
|
|
2024
|
-
};
|
|
2025
|
-
};
|
|
2026
|
-
async function detectOverflow(state, options) {
|
|
2027
|
-
var _await$platform$isEle;
|
|
2028
|
-
if (options === void 0) {
|
|
2029
|
-
options = {};
|
|
2030
|
-
}
|
|
2031
|
-
const {
|
|
2032
|
-
x,
|
|
2033
|
-
y,
|
|
2034
|
-
platform: platform2,
|
|
2035
|
-
rects,
|
|
2036
|
-
elements,
|
|
2037
|
-
strategy
|
|
2038
|
-
} = state;
|
|
2039
|
-
const {
|
|
2040
|
-
boundary = "clippingAncestors",
|
|
2041
|
-
rootBoundary = "viewport",
|
|
2042
|
-
elementContext = "floating",
|
|
2043
|
-
altBoundary = false,
|
|
2044
|
-
padding = 0
|
|
2045
|
-
} = evaluate(options, state);
|
|
2046
|
-
const paddingObject = getPaddingObject(padding);
|
|
2047
|
-
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
2048
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
2049
|
-
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
2050
|
-
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
2051
|
-
boundary,
|
|
2052
|
-
rootBoundary,
|
|
2053
|
-
strategy
|
|
2054
|
-
}));
|
|
2055
|
-
const rect = elementContext === "floating" ? {
|
|
2056
|
-
x,
|
|
2057
|
-
y,
|
|
2058
|
-
width: rects.floating.width,
|
|
2059
|
-
height: rects.floating.height
|
|
2060
|
-
} : rects.reference;
|
|
2061
|
-
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
2062
|
-
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
2063
|
-
x: 1,
|
|
2064
|
-
y: 1
|
|
2065
|
-
} : {
|
|
2066
|
-
x: 1,
|
|
2067
|
-
y: 1
|
|
2068
|
-
};
|
|
2069
|
-
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
2070
|
-
elements,
|
|
2071
|
-
rect,
|
|
2072
|
-
offsetParent,
|
|
2073
|
-
strategy
|
|
2074
|
-
}) : rect);
|
|
2075
|
-
return {
|
|
2076
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
2077
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
2078
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
2079
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
2080
|
-
};
|
|
2081
|
-
}
|
|
2082
|
-
var arrow = (options) => ({
|
|
2083
|
-
name: "arrow",
|
|
2084
|
-
options,
|
|
2085
|
-
async fn(state) {
|
|
2086
|
-
const {
|
|
2087
|
-
x,
|
|
2088
|
-
y,
|
|
2089
|
-
placement,
|
|
2090
|
-
rects,
|
|
2091
|
-
platform: platform2,
|
|
2092
|
-
elements,
|
|
2093
|
-
middlewareData
|
|
2094
|
-
} = state;
|
|
2095
|
-
const {
|
|
2096
|
-
element,
|
|
2097
|
-
padding = 0
|
|
2098
|
-
} = evaluate(options, state) || {};
|
|
2099
|
-
if (element == null) {
|
|
2100
|
-
return {};
|
|
2101
|
-
}
|
|
2102
|
-
const paddingObject = getPaddingObject(padding);
|
|
2103
|
-
const coords = {
|
|
2104
|
-
x,
|
|
2105
|
-
y
|
|
2106
|
-
};
|
|
2107
|
-
const axis = getAlignmentAxis(placement);
|
|
2108
|
-
const length = getAxisLength(axis);
|
|
2109
|
-
const arrowDimensions = await platform2.getDimensions(element);
|
|
2110
|
-
const isYAxis = axis === "y";
|
|
2111
|
-
const minProp = isYAxis ? "top" : "left";
|
|
2112
|
-
const maxProp = isYAxis ? "bottom" : "right";
|
|
2113
|
-
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
|
2114
|
-
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
2115
|
-
const startDiff = coords[axis] - rects.reference[axis];
|
|
2116
|
-
const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
|
|
2117
|
-
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
2118
|
-
if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
|
|
2119
|
-
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
2120
|
-
}
|
|
2121
|
-
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
2122
|
-
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
2123
|
-
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
2124
|
-
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
2125
|
-
const min$1 = minPadding;
|
|
2126
|
-
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
2127
|
-
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
2128
|
-
const offset3 = clamp(min$1, center, max2);
|
|
2129
|
-
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset3 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
2130
|
-
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
2131
|
-
return {
|
|
2132
|
-
[axis]: coords[axis] + alignmentOffset,
|
|
2133
|
-
data: __spreadValues({
|
|
2134
|
-
[axis]: offset3,
|
|
2135
|
-
centerOffset: center - offset3 - alignmentOffset
|
|
2136
|
-
}, shouldAddOffset && {
|
|
2137
|
-
alignmentOffset
|
|
2138
|
-
}),
|
|
2139
|
-
reset: shouldAddOffset
|
|
2140
|
-
};
|
|
2141
|
-
}
|
|
2142
|
-
});
|
|
2143
|
-
var flip = function(options) {
|
|
2144
|
-
if (options === void 0) {
|
|
2145
|
-
options = {};
|
|
2146
|
-
}
|
|
2147
|
-
return {
|
|
2148
|
-
name: "flip",
|
|
2149
|
-
options,
|
|
2150
|
-
async fn(state) {
|
|
2151
|
-
var _middlewareData$arrow, _middlewareData$flip;
|
|
2152
|
-
const {
|
|
2153
|
-
placement,
|
|
2154
|
-
middlewareData,
|
|
2155
|
-
rects,
|
|
2156
|
-
initialPlacement,
|
|
2157
|
-
platform: platform2,
|
|
2158
|
-
elements
|
|
2159
|
-
} = state;
|
|
2160
|
-
const _a = evaluate(options, state), {
|
|
2161
|
-
mainAxis: checkMainAxis = true,
|
|
2162
|
-
crossAxis: checkCrossAxis = true,
|
|
2163
|
-
fallbackPlacements: specifiedFallbackPlacements,
|
|
2164
|
-
fallbackStrategy = "bestFit",
|
|
2165
|
-
fallbackAxisSideDirection = "none",
|
|
2166
|
-
flipAlignment = true
|
|
2167
|
-
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
2168
|
-
"mainAxis",
|
|
2169
|
-
"crossAxis",
|
|
2170
|
-
"fallbackPlacements",
|
|
2171
|
-
"fallbackStrategy",
|
|
2172
|
-
"fallbackAxisSideDirection",
|
|
2173
|
-
"flipAlignment"
|
|
2174
|
-
]);
|
|
2175
|
-
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
2176
|
-
return {};
|
|
2177
|
-
}
|
|
2178
|
-
const side2 = getSide(placement);
|
|
2179
|
-
const initialSideAxis = getSideAxis(initialPlacement);
|
|
2180
|
-
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
2181
|
-
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
2182
|
-
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
2183
|
-
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
2184
|
-
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
2185
|
-
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
2186
|
-
}
|
|
2187
|
-
const placements2 = [initialPlacement, ...fallbackPlacements];
|
|
2188
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
2189
|
-
const overflows = [];
|
|
2190
|
-
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
2191
|
-
if (checkMainAxis) {
|
|
2192
|
-
overflows.push(overflow[side2]);
|
|
2193
|
-
}
|
|
2194
|
-
if (checkCrossAxis) {
|
|
2195
|
-
const sides2 = getAlignmentSides(placement, rects, rtl);
|
|
2196
|
-
overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
|
|
2197
|
-
}
|
|
2198
|
-
overflowsData = [...overflowsData, {
|
|
2199
|
-
placement,
|
|
2200
|
-
overflows
|
|
2201
|
-
}];
|
|
2202
|
-
if (!overflows.every((side3) => side3 <= 0)) {
|
|
2203
|
-
var _middlewareData$flip2, _overflowsData$filter;
|
|
2204
|
-
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
2205
|
-
const nextPlacement = placements2[nextIndex];
|
|
2206
|
-
if (nextPlacement) {
|
|
2207
|
-
return {
|
|
2208
|
-
data: {
|
|
2209
|
-
index: nextIndex,
|
|
2210
|
-
overflows: overflowsData
|
|
2211
|
-
},
|
|
2212
|
-
reset: {
|
|
2213
|
-
placement: nextPlacement
|
|
2214
|
-
}
|
|
2215
|
-
};
|
|
2216
|
-
}
|
|
2217
|
-
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
2218
|
-
if (!resetPlacement) {
|
|
2219
|
-
switch (fallbackStrategy) {
|
|
2220
|
-
case "bestFit": {
|
|
2221
|
-
var _overflowsData$filter2;
|
|
2222
|
-
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
2223
|
-
if (hasFallbackAxisSideDirection) {
|
|
2224
|
-
const currentSideAxis = getSideAxis(d.placement);
|
|
2225
|
-
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
2226
|
-
// reading directions favoring greater width.
|
|
2227
|
-
currentSideAxis === "y";
|
|
2228
|
-
}
|
|
2229
|
-
return true;
|
|
2230
|
-
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
2231
|
-
if (placement2) {
|
|
2232
|
-
resetPlacement = placement2;
|
|
2233
|
-
}
|
|
2234
|
-
break;
|
|
2235
|
-
}
|
|
2236
|
-
case "initialPlacement":
|
|
2237
|
-
resetPlacement = initialPlacement;
|
|
2238
|
-
break;
|
|
2239
|
-
}
|
|
2240
|
-
}
|
|
2241
|
-
if (placement !== resetPlacement) {
|
|
2242
|
-
return {
|
|
2243
|
-
reset: {
|
|
2244
|
-
placement: resetPlacement
|
|
2245
|
-
}
|
|
2246
|
-
};
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
return {};
|
|
2250
|
-
}
|
|
2251
|
-
};
|
|
2252
|
-
};
|
|
2253
|
-
function getSideOffsets(overflow, rect) {
|
|
2254
|
-
return {
|
|
2255
|
-
top: overflow.top - rect.height,
|
|
2256
|
-
right: overflow.right - rect.width,
|
|
2257
|
-
bottom: overflow.bottom - rect.height,
|
|
2258
|
-
left: overflow.left - rect.width
|
|
2259
|
-
};
|
|
2260
|
-
}
|
|
2261
|
-
function isAnySideFullyClipped(overflow) {
|
|
2262
|
-
return sides.some((side2) => overflow[side2] >= 0);
|
|
2263
|
-
}
|
|
2264
|
-
var hide = function(options) {
|
|
2265
|
-
if (options === void 0) {
|
|
2266
|
-
options = {};
|
|
2267
|
-
}
|
|
2268
|
-
return {
|
|
2269
|
-
name: "hide",
|
|
2270
|
-
options,
|
|
2271
|
-
async fn(state) {
|
|
2272
|
-
const {
|
|
2273
|
-
rects
|
|
2274
|
-
} = state;
|
|
2275
|
-
const _a = evaluate(options, state), {
|
|
2276
|
-
strategy = "referenceHidden"
|
|
2277
|
-
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
2278
|
-
"strategy"
|
|
2279
|
-
]);
|
|
2280
|
-
switch (strategy) {
|
|
2281
|
-
case "referenceHidden": {
|
|
2282
|
-
const overflow = await detectOverflow(state, __spreadProps(__spreadValues({}, detectOverflowOptions), {
|
|
2283
|
-
elementContext: "reference"
|
|
2284
|
-
}));
|
|
2285
|
-
const offsets = getSideOffsets(overflow, rects.reference);
|
|
2286
|
-
return {
|
|
2287
|
-
data: {
|
|
2288
|
-
referenceHiddenOffsets: offsets,
|
|
2289
|
-
referenceHidden: isAnySideFullyClipped(offsets)
|
|
2290
|
-
}
|
|
2291
|
-
};
|
|
2292
|
-
}
|
|
2293
|
-
case "escaped": {
|
|
2294
|
-
const overflow = await detectOverflow(state, __spreadProps(__spreadValues({}, detectOverflowOptions), {
|
|
2295
|
-
altBoundary: true
|
|
2296
|
-
}));
|
|
2297
|
-
const offsets = getSideOffsets(overflow, rects.floating);
|
|
2298
|
-
return {
|
|
2299
|
-
data: {
|
|
2300
|
-
escapedOffsets: offsets,
|
|
2301
|
-
escaped: isAnySideFullyClipped(offsets)
|
|
2302
|
-
}
|
|
2303
|
-
};
|
|
2304
|
-
}
|
|
2305
|
-
default: {
|
|
2306
|
-
return {};
|
|
2307
|
-
}
|
|
2308
|
-
}
|
|
2309
|
-
}
|
|
2310
|
-
};
|
|
2311
|
-
};
|
|
2312
|
-
async function convertValueToCoords(state, options) {
|
|
2313
|
-
const {
|
|
2314
|
-
placement,
|
|
2315
|
-
platform: platform2,
|
|
2316
|
-
elements
|
|
2317
|
-
} = state;
|
|
2318
|
-
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
2319
|
-
const side2 = getSide(placement);
|
|
2320
|
-
const alignment = getAlignment(placement);
|
|
2321
|
-
const isVertical = getSideAxis(placement) === "y";
|
|
2322
|
-
const mainAxisMulti = ["left", "top"].includes(side2) ? -1 : 1;
|
|
2323
|
-
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
2324
|
-
const rawValue = evaluate(options, state);
|
|
2325
|
-
let {
|
|
2326
|
-
mainAxis,
|
|
2327
|
-
crossAxis,
|
|
2328
|
-
alignmentAxis
|
|
2329
|
-
} = typeof rawValue === "number" ? {
|
|
2330
|
-
mainAxis: rawValue,
|
|
2331
|
-
crossAxis: 0,
|
|
2332
|
-
alignmentAxis: null
|
|
2333
|
-
} : {
|
|
2334
|
-
mainAxis: rawValue.mainAxis || 0,
|
|
2335
|
-
crossAxis: rawValue.crossAxis || 0,
|
|
2336
|
-
alignmentAxis: rawValue.alignmentAxis
|
|
2337
|
-
};
|
|
2338
|
-
if (alignment && typeof alignmentAxis === "number") {
|
|
2339
|
-
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
2340
|
-
}
|
|
2341
|
-
return isVertical ? {
|
|
2342
|
-
x: crossAxis * crossAxisMulti,
|
|
2343
|
-
y: mainAxis * mainAxisMulti
|
|
2344
|
-
} : {
|
|
2345
|
-
x: mainAxis * mainAxisMulti,
|
|
2346
|
-
y: crossAxis * crossAxisMulti
|
|
2347
|
-
};
|
|
2348
|
-
}
|
|
2349
|
-
var offset = function(options) {
|
|
2350
|
-
if (options === void 0) {
|
|
2351
|
-
options = 0;
|
|
2352
|
-
}
|
|
2353
|
-
return {
|
|
2354
|
-
name: "offset",
|
|
2355
|
-
options,
|
|
2356
|
-
async fn(state) {
|
|
2357
|
-
var _middlewareData$offse, _middlewareData$arrow;
|
|
2358
|
-
const {
|
|
2359
|
-
x,
|
|
2360
|
-
y,
|
|
2361
|
-
placement,
|
|
2362
|
-
middlewareData
|
|
2363
|
-
} = state;
|
|
2364
|
-
const diffCoords = await convertValueToCoords(state, options);
|
|
2365
|
-
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
2366
|
-
return {};
|
|
2367
|
-
}
|
|
2368
|
-
return {
|
|
2369
|
-
x: x + diffCoords.x,
|
|
2370
|
-
y: y + diffCoords.y,
|
|
2371
|
-
data: __spreadProps(__spreadValues({}, diffCoords), {
|
|
2372
|
-
placement
|
|
2373
|
-
})
|
|
2374
|
-
};
|
|
2375
|
-
}
|
|
2376
|
-
};
|
|
2377
|
-
};
|
|
2378
|
-
var shift = function(options) {
|
|
2379
|
-
if (options === void 0) {
|
|
2380
|
-
options = {};
|
|
2381
|
-
}
|
|
2382
|
-
return {
|
|
2383
|
-
name: "shift",
|
|
2384
|
-
options,
|
|
2385
|
-
async fn(state) {
|
|
2386
|
-
const {
|
|
2387
|
-
x,
|
|
2388
|
-
y,
|
|
2389
|
-
placement
|
|
2390
|
-
} = state;
|
|
2391
|
-
const _a = evaluate(options, state), {
|
|
2392
|
-
mainAxis: checkMainAxis = true,
|
|
2393
|
-
crossAxis: checkCrossAxis = false,
|
|
2394
|
-
limiter = {
|
|
2395
|
-
fn: (_ref) => {
|
|
2396
|
-
let {
|
|
2397
|
-
x: x2,
|
|
2398
|
-
y: y2
|
|
2399
|
-
} = _ref;
|
|
2400
|
-
return {
|
|
2401
|
-
x: x2,
|
|
2402
|
-
y: y2
|
|
2403
|
-
};
|
|
2404
|
-
}
|
|
2405
|
-
}
|
|
2406
|
-
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
2407
|
-
"mainAxis",
|
|
2408
|
-
"crossAxis",
|
|
2409
|
-
"limiter"
|
|
2410
|
-
]);
|
|
2411
|
-
const coords = {
|
|
2412
|
-
x,
|
|
2413
|
-
y
|
|
2414
|
-
};
|
|
2415
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
2416
|
-
const crossAxis = getSideAxis(getSide(placement));
|
|
2417
|
-
const mainAxis = getOppositeAxis(crossAxis);
|
|
2418
|
-
let mainAxisCoord = coords[mainAxis];
|
|
2419
|
-
let crossAxisCoord = coords[crossAxis];
|
|
2420
|
-
if (checkMainAxis) {
|
|
2421
|
-
const minSide = mainAxis === "y" ? "top" : "left";
|
|
2422
|
-
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
2423
|
-
const min2 = mainAxisCoord + overflow[minSide];
|
|
2424
|
-
const max2 = mainAxisCoord - overflow[maxSide];
|
|
2425
|
-
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
2426
|
-
}
|
|
2427
|
-
if (checkCrossAxis) {
|
|
2428
|
-
const minSide = crossAxis === "y" ? "top" : "left";
|
|
2429
|
-
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
2430
|
-
const min2 = crossAxisCoord + overflow[minSide];
|
|
2431
|
-
const max2 = crossAxisCoord - overflow[maxSide];
|
|
2432
|
-
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
2433
|
-
}
|
|
2434
|
-
const limitedCoords = limiter.fn(__spreadProps(__spreadValues({}, state), {
|
|
2435
|
-
[mainAxis]: mainAxisCoord,
|
|
2436
|
-
[crossAxis]: crossAxisCoord
|
|
2437
|
-
}));
|
|
2438
|
-
return __spreadProps(__spreadValues({}, limitedCoords), {
|
|
2439
|
-
data: {
|
|
2440
|
-
x: limitedCoords.x - x,
|
|
2441
|
-
y: limitedCoords.y - y,
|
|
2442
|
-
enabled: {
|
|
2443
|
-
[mainAxis]: checkMainAxis,
|
|
2444
|
-
[crossAxis]: checkCrossAxis
|
|
2445
|
-
}
|
|
2446
|
-
}
|
|
2447
|
-
});
|
|
2448
|
-
}
|
|
2449
|
-
};
|
|
2450
|
-
};
|
|
2451
|
-
var size = function(options) {
|
|
2452
|
-
if (options === void 0) {
|
|
2453
|
-
options = {};
|
|
2454
|
-
}
|
|
2455
|
-
return {
|
|
2456
|
-
name: "size",
|
|
2457
|
-
options,
|
|
2458
|
-
async fn(state) {
|
|
2459
|
-
var _state$middlewareData, _state$middlewareData2;
|
|
2460
|
-
const {
|
|
2461
|
-
placement,
|
|
2462
|
-
rects,
|
|
2463
|
-
platform: platform2,
|
|
2464
|
-
elements
|
|
2465
|
-
} = state;
|
|
2466
|
-
const _a = evaluate(options, state), {
|
|
2467
|
-
apply = () => {
|
|
2468
|
-
}
|
|
2469
|
-
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
2470
|
-
"apply"
|
|
2471
|
-
]);
|
|
2472
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
2473
|
-
const side2 = getSide(placement);
|
|
2474
|
-
const alignment = getAlignment(placement);
|
|
2475
|
-
const isYAxis = getSideAxis(placement) === "y";
|
|
2476
|
-
const {
|
|
2477
|
-
width,
|
|
2478
|
-
height
|
|
2479
|
-
} = rects.floating;
|
|
2480
|
-
let heightSide;
|
|
2481
|
-
let widthSide;
|
|
2482
|
-
if (side2 === "top" || side2 === "bottom") {
|
|
2483
|
-
heightSide = side2;
|
|
2484
|
-
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
2485
|
-
} else {
|
|
2486
|
-
widthSide = side2;
|
|
2487
|
-
heightSide = alignment === "end" ? "top" : "bottom";
|
|
2488
|
-
}
|
|
2489
|
-
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
2490
|
-
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
2491
|
-
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
2492
|
-
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
2493
|
-
const noShift = !state.middlewareData.shift;
|
|
2494
|
-
let availableHeight = overflowAvailableHeight;
|
|
2495
|
-
let availableWidth = overflowAvailableWidth;
|
|
2496
|
-
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
2497
|
-
availableWidth = maximumClippingWidth;
|
|
2498
|
-
}
|
|
2499
|
-
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
2500
|
-
availableHeight = maximumClippingHeight;
|
|
2501
|
-
}
|
|
2502
|
-
if (noShift && !alignment) {
|
|
2503
|
-
const xMin = max(overflow.left, 0);
|
|
2504
|
-
const xMax = max(overflow.right, 0);
|
|
2505
|
-
const yMin = max(overflow.top, 0);
|
|
2506
|
-
const yMax = max(overflow.bottom, 0);
|
|
2507
|
-
if (isYAxis) {
|
|
2508
|
-
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
2509
|
-
} else {
|
|
2510
|
-
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
await apply(__spreadProps(__spreadValues({}, state), {
|
|
2514
|
-
availableWidth,
|
|
2515
|
-
availableHeight
|
|
2516
|
-
}));
|
|
2517
|
-
const nextDimensions = await platform2.getDimensions(elements.floating);
|
|
2518
|
-
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
2519
|
-
return {
|
|
2520
|
-
reset: {
|
|
2521
|
-
rects: true
|
|
2522
|
-
}
|
|
2523
|
-
};
|
|
2524
|
-
}
|
|
2525
|
-
return {};
|
|
2526
|
-
}
|
|
2527
|
-
};
|
|
2528
|
-
};
|
|
2529
|
-
|
|
2530
|
-
// node_modules/.pnpm/@floating-ui+utils@0.2.9/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
2531
|
-
function hasWindow() {
|
|
2532
|
-
return typeof window !== "undefined";
|
|
2533
|
-
}
|
|
2534
|
-
function getNodeName(node) {
|
|
2535
|
-
if (isNode(node)) {
|
|
2536
|
-
return (node.nodeName || "").toLowerCase();
|
|
2537
|
-
}
|
|
2538
|
-
return "#document";
|
|
2539
|
-
}
|
|
2540
|
-
function getWindow(node) {
|
|
2541
|
-
var _node$ownerDocument;
|
|
2542
|
-
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
2543
|
-
}
|
|
2544
|
-
function getDocumentElement(node) {
|
|
2545
|
-
var _ref;
|
|
2546
|
-
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
2547
|
-
}
|
|
2548
|
-
function isNode(value) {
|
|
2549
|
-
if (!hasWindow()) {
|
|
2550
|
-
return false;
|
|
2551
|
-
}
|
|
2552
|
-
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
2553
|
-
}
|
|
2554
|
-
function isElement(value) {
|
|
2555
|
-
if (!hasWindow()) {
|
|
2556
|
-
return false;
|
|
2557
|
-
}
|
|
2558
|
-
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
2559
|
-
}
|
|
2560
|
-
function isHTMLElement(value) {
|
|
2561
|
-
if (!hasWindow()) {
|
|
2562
|
-
return false;
|
|
2563
|
-
}
|
|
2564
|
-
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
2565
|
-
}
|
|
2566
|
-
function isShadowRoot(value) {
|
|
2567
|
-
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
2568
|
-
return false;
|
|
2569
|
-
}
|
|
2570
|
-
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
2571
|
-
}
|
|
2572
|
-
function isOverflowElement(element) {
|
|
2573
|
-
const {
|
|
2574
|
-
overflow,
|
|
2575
|
-
overflowX,
|
|
2576
|
-
overflowY,
|
|
2577
|
-
display
|
|
2578
|
-
} = getComputedStyle(element);
|
|
2579
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
2580
|
-
}
|
|
2581
|
-
function isTableElement(element) {
|
|
2582
|
-
return ["table", "td", "th"].includes(getNodeName(element));
|
|
2583
|
-
}
|
|
2584
|
-
function isTopLayer(element) {
|
|
2585
|
-
return [":popover-open", ":modal"].some((selector) => {
|
|
2586
|
-
try {
|
|
2587
|
-
return element.matches(selector);
|
|
2588
|
-
} catch (e) {
|
|
2589
|
-
return false;
|
|
2590
|
-
}
|
|
2591
|
-
});
|
|
2592
|
-
}
|
|
2593
|
-
function isContainingBlock(elementOrCss) {
|
|
2594
|
-
const webkit = isWebKit();
|
|
2595
|
-
const css2 = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
2596
|
-
return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css2[value] ? css2[value] !== "none" : false) || (css2.containerType ? css2.containerType !== "normal" : false) || !webkit && (css2.backdropFilter ? css2.backdropFilter !== "none" : false) || !webkit && (css2.filter ? css2.filter !== "none" : false) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css2.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css2.contain || "").includes(value));
|
|
2597
|
-
}
|
|
2598
|
-
function getContainingBlock(element) {
|
|
2599
|
-
let currentNode = getParentNode(element);
|
|
2600
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2601
|
-
if (isContainingBlock(currentNode)) {
|
|
2602
|
-
return currentNode;
|
|
2603
|
-
} else if (isTopLayer(currentNode)) {
|
|
2604
|
-
return null;
|
|
2605
|
-
}
|
|
2606
|
-
currentNode = getParentNode(currentNode);
|
|
2607
|
-
}
|
|
2608
|
-
return null;
|
|
2609
|
-
}
|
|
2610
|
-
function isWebKit() {
|
|
2611
|
-
if (typeof CSS === "undefined" || !CSS.supports) return false;
|
|
2612
|
-
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
2613
|
-
}
|
|
2614
|
-
function isLastTraversableNode(node) {
|
|
2615
|
-
return ["html", "body", "#document"].includes(getNodeName(node));
|
|
2616
|
-
}
|
|
2617
|
-
function getComputedStyle(element) {
|
|
2618
|
-
return getWindow(element).getComputedStyle(element);
|
|
2619
|
-
}
|
|
2620
|
-
function getNodeScroll(element) {
|
|
2621
|
-
if (isElement(element)) {
|
|
2622
|
-
return {
|
|
2623
|
-
scrollLeft: element.scrollLeft,
|
|
2624
|
-
scrollTop: element.scrollTop
|
|
2625
|
-
};
|
|
2626
|
-
}
|
|
2627
|
-
return {
|
|
2628
|
-
scrollLeft: element.scrollX,
|
|
2629
|
-
scrollTop: element.scrollY
|
|
2630
|
-
};
|
|
2631
|
-
}
|
|
2632
|
-
function getParentNode(node) {
|
|
2633
|
-
if (getNodeName(node) === "html") {
|
|
2634
|
-
return node;
|
|
2635
|
-
}
|
|
2636
|
-
const result = (
|
|
2637
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
|
2638
|
-
node.assignedSlot || // DOM Element detected.
|
|
2639
|
-
node.parentNode || // ShadowRoot detected.
|
|
2640
|
-
isShadowRoot(node) && node.host || // Fallback.
|
|
2641
|
-
getDocumentElement(node)
|
|
2642
|
-
);
|
|
2643
|
-
return isShadowRoot(result) ? result.host : result;
|
|
2644
|
-
}
|
|
2645
|
-
function getNearestOverflowAncestor(node) {
|
|
2646
|
-
const parentNode = getParentNode(node);
|
|
2647
|
-
if (isLastTraversableNode(parentNode)) {
|
|
2648
|
-
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
2649
|
-
}
|
|
2650
|
-
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
2651
|
-
return parentNode;
|
|
2652
|
-
}
|
|
2653
|
-
return getNearestOverflowAncestor(parentNode);
|
|
2654
|
-
}
|
|
2655
|
-
function getOverflowAncestors(node, list, traverseIframes) {
|
|
2656
|
-
var _node$ownerDocument2;
|
|
2657
|
-
if (list === void 0) {
|
|
2658
|
-
list = [];
|
|
2659
|
-
}
|
|
2660
|
-
if (traverseIframes === void 0) {
|
|
2661
|
-
traverseIframes = true;
|
|
2662
|
-
}
|
|
2663
|
-
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
2664
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
2665
|
-
const win = getWindow(scrollableAncestor);
|
|
2666
|
-
if (isBody) {
|
|
2667
|
-
const frameElement = getFrameElement(win);
|
|
2668
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
2669
|
-
}
|
|
2670
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
2671
|
-
}
|
|
2672
|
-
function getFrameElement(win) {
|
|
2673
|
-
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
2674
|
-
}
|
|
2675
|
-
|
|
2676
|
-
// node_modules/.pnpm/@floating-ui+dom@1.6.13/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
|
2677
|
-
function getCssDimensions(element) {
|
|
2678
|
-
const css2 = getComputedStyle(element);
|
|
2679
|
-
let width = parseFloat(css2.width) || 0;
|
|
2680
|
-
let height = parseFloat(css2.height) || 0;
|
|
2681
|
-
const hasOffset = isHTMLElement(element);
|
|
2682
|
-
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
2683
|
-
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
2684
|
-
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
2685
|
-
if (shouldFallback) {
|
|
2686
|
-
width = offsetWidth;
|
|
2687
|
-
height = offsetHeight;
|
|
2688
|
-
}
|
|
2689
|
-
return {
|
|
2690
|
-
width,
|
|
2691
|
-
height,
|
|
2692
|
-
$: shouldFallback
|
|
2693
|
-
};
|
|
2694
|
-
}
|
|
2695
|
-
function unwrapElement(element) {
|
|
2696
|
-
return !isElement(element) ? element.contextElement : element;
|
|
2697
|
-
}
|
|
2698
|
-
function getScale(element) {
|
|
2699
|
-
const domElement = unwrapElement(element);
|
|
2700
|
-
if (!isHTMLElement(domElement)) {
|
|
2701
|
-
return createCoords(1);
|
|
2702
|
-
}
|
|
2703
|
-
const rect = domElement.getBoundingClientRect();
|
|
2704
|
-
const {
|
|
2705
|
-
width,
|
|
2706
|
-
height,
|
|
2707
|
-
$
|
|
2708
|
-
} = getCssDimensions(domElement);
|
|
2709
|
-
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
2710
|
-
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
2711
|
-
if (!x || !Number.isFinite(x)) {
|
|
2712
|
-
x = 1;
|
|
2713
|
-
}
|
|
2714
|
-
if (!y || !Number.isFinite(y)) {
|
|
2715
|
-
y = 1;
|
|
2716
|
-
}
|
|
2717
|
-
return {
|
|
2718
|
-
x,
|
|
2719
|
-
y
|
|
2720
|
-
};
|
|
2721
|
-
}
|
|
2722
|
-
var noOffsets = /* @__PURE__ */ createCoords(0);
|
|
2723
|
-
function getVisualOffsets(element) {
|
|
2724
|
-
const win = getWindow(element);
|
|
2725
|
-
if (!isWebKit() || !win.visualViewport) {
|
|
2726
|
-
return noOffsets;
|
|
2727
|
-
}
|
|
2728
|
-
return {
|
|
2729
|
-
x: win.visualViewport.offsetLeft,
|
|
2730
|
-
y: win.visualViewport.offsetTop
|
|
2731
|
-
};
|
|
2732
|
-
}
|
|
2733
|
-
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
2734
|
-
if (isFixed === void 0) {
|
|
2735
|
-
isFixed = false;
|
|
2736
|
-
}
|
|
2737
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
2738
|
-
return false;
|
|
2739
|
-
}
|
|
2740
|
-
return isFixed;
|
|
2741
|
-
}
|
|
2742
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
2743
|
-
if (includeScale === void 0) {
|
|
2744
|
-
includeScale = false;
|
|
2745
|
-
}
|
|
2746
|
-
if (isFixedStrategy === void 0) {
|
|
2747
|
-
isFixedStrategy = false;
|
|
2748
|
-
}
|
|
2749
|
-
const clientRect = element.getBoundingClientRect();
|
|
2750
|
-
const domElement = unwrapElement(element);
|
|
2751
|
-
let scale = createCoords(1);
|
|
2752
|
-
if (includeScale) {
|
|
2753
|
-
if (offsetParent) {
|
|
2754
|
-
if (isElement(offsetParent)) {
|
|
2755
|
-
scale = getScale(offsetParent);
|
|
2756
|
-
}
|
|
2757
|
-
} else {
|
|
2758
|
-
scale = getScale(element);
|
|
2759
|
-
}
|
|
2760
|
-
}
|
|
2761
|
-
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
2762
|
-
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
2763
|
-
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
2764
|
-
let width = clientRect.width / scale.x;
|
|
2765
|
-
let height = clientRect.height / scale.y;
|
|
2766
|
-
if (domElement) {
|
|
2767
|
-
const win = getWindow(domElement);
|
|
2768
|
-
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
2769
|
-
let currentWin = win;
|
|
2770
|
-
let currentIFrame = getFrameElement(currentWin);
|
|
2771
|
-
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
2772
|
-
const iframeScale = getScale(currentIFrame);
|
|
2773
|
-
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
2774
|
-
const css2 = getComputedStyle(currentIFrame);
|
|
2775
|
-
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css2.paddingLeft)) * iframeScale.x;
|
|
2776
|
-
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css2.paddingTop)) * iframeScale.y;
|
|
2777
|
-
x *= iframeScale.x;
|
|
2778
|
-
y *= iframeScale.y;
|
|
2779
|
-
width *= iframeScale.x;
|
|
2780
|
-
height *= iframeScale.y;
|
|
2781
|
-
x += left;
|
|
2782
|
-
y += top;
|
|
2783
|
-
currentWin = getWindow(currentIFrame);
|
|
2784
|
-
currentIFrame = getFrameElement(currentWin);
|
|
2785
|
-
}
|
|
2786
|
-
}
|
|
2787
|
-
return rectToClientRect({
|
|
2788
|
-
width,
|
|
2789
|
-
height,
|
|
2790
|
-
x,
|
|
2791
|
-
y
|
|
2792
|
-
});
|
|
2793
|
-
}
|
|
2794
|
-
function getWindowScrollBarX(element, rect) {
|
|
2795
|
-
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
2796
|
-
if (!rect) {
|
|
2797
|
-
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
2798
|
-
}
|
|
2799
|
-
return rect.left + leftScroll;
|
|
2800
|
-
}
|
|
2801
|
-
function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
|
|
2802
|
-
if (ignoreScrollbarX === void 0) {
|
|
2803
|
-
ignoreScrollbarX = false;
|
|
2804
|
-
}
|
|
2805
|
-
const htmlRect = documentElement.getBoundingClientRect();
|
|
2806
|
-
const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
|
|
2807
|
-
// RTL <body> scrollbar.
|
|
2808
|
-
getWindowScrollBarX(documentElement, htmlRect)
|
|
2809
|
-
));
|
|
2810
|
-
const y = htmlRect.top + scroll.scrollTop;
|
|
2811
|
-
return {
|
|
2812
|
-
x,
|
|
2813
|
-
y
|
|
2814
|
-
};
|
|
2815
|
-
}
|
|
2816
|
-
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
2817
|
-
let {
|
|
2818
|
-
elements,
|
|
2819
|
-
rect,
|
|
2820
|
-
offsetParent,
|
|
2821
|
-
strategy
|
|
2822
|
-
} = _ref;
|
|
2823
|
-
const isFixed = strategy === "fixed";
|
|
2824
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
2825
|
-
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
2826
|
-
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
2827
|
-
return rect;
|
|
2828
|
-
}
|
|
2829
|
-
let scroll = {
|
|
2830
|
-
scrollLeft: 0,
|
|
2831
|
-
scrollTop: 0
|
|
2832
|
-
};
|
|
2833
|
-
let scale = createCoords(1);
|
|
2834
|
-
const offsets = createCoords(0);
|
|
2835
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2836
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2837
|
-
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
2838
|
-
scroll = getNodeScroll(offsetParent);
|
|
2839
|
-
}
|
|
2840
|
-
if (isHTMLElement(offsetParent)) {
|
|
2841
|
-
const offsetRect = getBoundingClientRect(offsetParent);
|
|
2842
|
-
scale = getScale(offsetParent);
|
|
2843
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2844
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2845
|
-
}
|
|
2846
|
-
}
|
|
2847
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
|
|
2848
|
-
return {
|
|
2849
|
-
width: rect.width * scale.x,
|
|
2850
|
-
height: rect.height * scale.y,
|
|
2851
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
2852
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
2853
|
-
};
|
|
2854
|
-
}
|
|
2855
|
-
function getClientRects(element) {
|
|
2856
|
-
return Array.from(element.getClientRects());
|
|
2857
|
-
}
|
|
2858
|
-
function getDocumentRect(element) {
|
|
2859
|
-
const html3 = getDocumentElement(element);
|
|
2860
|
-
const scroll = getNodeScroll(element);
|
|
2861
|
-
const body = element.ownerDocument.body;
|
|
2862
|
-
const width = max(html3.scrollWidth, html3.clientWidth, body.scrollWidth, body.clientWidth);
|
|
2863
|
-
const height = max(html3.scrollHeight, html3.clientHeight, body.scrollHeight, body.clientHeight);
|
|
2864
|
-
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
2865
|
-
const y = -scroll.scrollTop;
|
|
2866
|
-
if (getComputedStyle(body).direction === "rtl") {
|
|
2867
|
-
x += max(html3.clientWidth, body.clientWidth) - width;
|
|
2868
|
-
}
|
|
2869
|
-
return {
|
|
2870
|
-
width,
|
|
2871
|
-
height,
|
|
2872
|
-
x,
|
|
2873
|
-
y
|
|
2874
|
-
};
|
|
2875
|
-
}
|
|
2876
|
-
function getViewportRect(element, strategy) {
|
|
2877
|
-
const win = getWindow(element);
|
|
2878
|
-
const html3 = getDocumentElement(element);
|
|
2879
|
-
const visualViewport = win.visualViewport;
|
|
2880
|
-
let width = html3.clientWidth;
|
|
2881
|
-
let height = html3.clientHeight;
|
|
2882
|
-
let x = 0;
|
|
2883
|
-
let y = 0;
|
|
2884
|
-
if (visualViewport) {
|
|
2885
|
-
width = visualViewport.width;
|
|
2886
|
-
height = visualViewport.height;
|
|
2887
|
-
const visualViewportBased = isWebKit();
|
|
2888
|
-
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
2889
|
-
x = visualViewport.offsetLeft;
|
|
2890
|
-
y = visualViewport.offsetTop;
|
|
2891
|
-
}
|
|
2892
|
-
}
|
|
2893
|
-
return {
|
|
2894
|
-
width,
|
|
2895
|
-
height,
|
|
2896
|
-
x,
|
|
2897
|
-
y
|
|
2898
|
-
};
|
|
2899
|
-
}
|
|
2900
|
-
function getInnerBoundingClientRect(element, strategy) {
|
|
2901
|
-
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
2902
|
-
const top = clientRect.top + element.clientTop;
|
|
2903
|
-
const left = clientRect.left + element.clientLeft;
|
|
2904
|
-
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
2905
|
-
const width = element.clientWidth * scale.x;
|
|
2906
|
-
const height = element.clientHeight * scale.y;
|
|
2907
|
-
const x = left * scale.x;
|
|
2908
|
-
const y = top * scale.y;
|
|
2909
|
-
return {
|
|
2910
|
-
width,
|
|
2911
|
-
height,
|
|
2912
|
-
x,
|
|
2913
|
-
y
|
|
2914
|
-
};
|
|
2915
|
-
}
|
|
2916
|
-
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
2917
|
-
let rect;
|
|
2918
|
-
if (clippingAncestor === "viewport") {
|
|
2919
|
-
rect = getViewportRect(element, strategy);
|
|
2920
|
-
} else if (clippingAncestor === "document") {
|
|
2921
|
-
rect = getDocumentRect(getDocumentElement(element));
|
|
2922
|
-
} else if (isElement(clippingAncestor)) {
|
|
2923
|
-
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
2924
|
-
} else {
|
|
2925
|
-
const visualOffsets = getVisualOffsets(element);
|
|
2926
|
-
rect = {
|
|
2927
|
-
x: clippingAncestor.x - visualOffsets.x,
|
|
2928
|
-
y: clippingAncestor.y - visualOffsets.y,
|
|
2929
|
-
width: clippingAncestor.width,
|
|
2930
|
-
height: clippingAncestor.height
|
|
2931
|
-
};
|
|
2932
|
-
}
|
|
2933
|
-
return rectToClientRect(rect);
|
|
2934
|
-
}
|
|
2935
|
-
function hasFixedPositionAncestor(element, stopNode) {
|
|
2936
|
-
const parentNode = getParentNode(element);
|
|
2937
|
-
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
2938
|
-
return false;
|
|
2939
|
-
}
|
|
2940
|
-
return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2941
|
-
}
|
|
2942
|
-
function getClippingElementAncestors(element, cache2) {
|
|
2943
|
-
const cachedResult = cache2.get(element);
|
|
2944
|
-
if (cachedResult) {
|
|
2945
|
-
return cachedResult;
|
|
2946
|
-
}
|
|
2947
|
-
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
2948
|
-
let currentContainingBlockComputedStyle = null;
|
|
2949
|
-
const elementIsFixed = getComputedStyle(element).position === "fixed";
|
|
2950
|
-
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
2951
|
-
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2952
|
-
const computedStyle = getComputedStyle(currentNode);
|
|
2953
|
-
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
2954
|
-
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
2955
|
-
currentContainingBlockComputedStyle = null;
|
|
2956
|
-
}
|
|
2957
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
2958
|
-
if (shouldDropCurrentNode) {
|
|
2959
|
-
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
2960
|
-
} else {
|
|
2961
|
-
currentContainingBlockComputedStyle = computedStyle;
|
|
2962
|
-
}
|
|
2963
|
-
currentNode = getParentNode(currentNode);
|
|
2964
|
-
}
|
|
2965
|
-
cache2.set(element, result);
|
|
2966
|
-
return result;
|
|
2967
|
-
}
|
|
2968
|
-
function getClippingRect(_ref) {
|
|
2969
|
-
let {
|
|
2970
|
-
element,
|
|
2971
|
-
boundary,
|
|
2972
|
-
rootBoundary,
|
|
2973
|
-
strategy
|
|
2974
|
-
} = _ref;
|
|
2975
|
-
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
2976
|
-
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
2977
|
-
const firstClippingAncestor = clippingAncestors[0];
|
|
2978
|
-
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
2979
|
-
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
2980
|
-
accRect.top = max(rect.top, accRect.top);
|
|
2981
|
-
accRect.right = min(rect.right, accRect.right);
|
|
2982
|
-
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
2983
|
-
accRect.left = max(rect.left, accRect.left);
|
|
2984
|
-
return accRect;
|
|
2985
|
-
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
2986
|
-
return {
|
|
2987
|
-
width: clippingRect.right - clippingRect.left,
|
|
2988
|
-
height: clippingRect.bottom - clippingRect.top,
|
|
2989
|
-
x: clippingRect.left,
|
|
2990
|
-
y: clippingRect.top
|
|
2991
|
-
};
|
|
2992
|
-
}
|
|
2993
|
-
function getDimensions(element) {
|
|
2994
|
-
const {
|
|
2995
|
-
width,
|
|
2996
|
-
height
|
|
2997
|
-
} = getCssDimensions(element);
|
|
2998
|
-
return {
|
|
2999
|
-
width,
|
|
3000
|
-
height
|
|
3001
|
-
};
|
|
3002
|
-
}
|
|
3003
|
-
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
3004
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
3005
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
3006
|
-
const isFixed = strategy === "fixed";
|
|
3007
|
-
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
3008
|
-
let scroll = {
|
|
3009
|
-
scrollLeft: 0,
|
|
3010
|
-
scrollTop: 0
|
|
3011
|
-
};
|
|
3012
|
-
const offsets = createCoords(0);
|
|
3013
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
3014
|
-
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
3015
|
-
scroll = getNodeScroll(offsetParent);
|
|
3016
|
-
}
|
|
3017
|
-
if (isOffsetParentAnElement) {
|
|
3018
|
-
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
3019
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
3020
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
3021
|
-
} else if (documentElement) {
|
|
3022
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
3023
|
-
}
|
|
3024
|
-
}
|
|
3025
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
3026
|
-
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
3027
|
-
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
3028
|
-
return {
|
|
3029
|
-
x,
|
|
3030
|
-
y,
|
|
3031
|
-
width: rect.width,
|
|
3032
|
-
height: rect.height
|
|
3033
|
-
};
|
|
3034
|
-
}
|
|
3035
|
-
function isStaticPositioned(element) {
|
|
3036
|
-
return getComputedStyle(element).position === "static";
|
|
3037
|
-
}
|
|
3038
|
-
function getTrueOffsetParent(element, polyfill) {
|
|
3039
|
-
if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
|
|
3040
|
-
return null;
|
|
3041
|
-
}
|
|
3042
|
-
if (polyfill) {
|
|
3043
|
-
return polyfill(element);
|
|
3044
|
-
}
|
|
3045
|
-
let rawOffsetParent = element.offsetParent;
|
|
3046
|
-
if (getDocumentElement(element) === rawOffsetParent) {
|
|
3047
|
-
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
3048
|
-
}
|
|
3049
|
-
return rawOffsetParent;
|
|
3050
|
-
}
|
|
3051
|
-
function getOffsetParent(element, polyfill) {
|
|
3052
|
-
const win = getWindow(element);
|
|
3053
|
-
if (isTopLayer(element)) {
|
|
3054
|
-
return win;
|
|
3055
|
-
}
|
|
3056
|
-
if (!isHTMLElement(element)) {
|
|
3057
|
-
let svgOffsetParent = getParentNode(element);
|
|
3058
|
-
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
3059
|
-
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
3060
|
-
return svgOffsetParent;
|
|
3061
|
-
}
|
|
3062
|
-
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
3063
|
-
}
|
|
3064
|
-
return win;
|
|
3065
|
-
}
|
|
3066
|
-
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
3067
|
-
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
3068
|
-
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
3069
|
-
}
|
|
3070
|
-
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
3071
|
-
return win;
|
|
3072
|
-
}
|
|
3073
|
-
return offsetParent || getContainingBlock(element) || win;
|
|
3074
|
-
}
|
|
3075
|
-
var getElementRects = async function(data) {
|
|
3076
|
-
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
3077
|
-
const getDimensionsFn = this.getDimensions;
|
|
3078
|
-
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
3079
|
-
return {
|
|
3080
|
-
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
3081
|
-
floating: {
|
|
3082
|
-
x: 0,
|
|
3083
|
-
y: 0,
|
|
3084
|
-
width: floatingDimensions.width,
|
|
3085
|
-
height: floatingDimensions.height
|
|
3086
|
-
}
|
|
3087
|
-
};
|
|
3088
|
-
};
|
|
3089
|
-
function isRTL(element) {
|
|
3090
|
-
return getComputedStyle(element).direction === "rtl";
|
|
3091
|
-
}
|
|
3092
|
-
var platform = {
|
|
3093
|
-
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
3094
|
-
getDocumentElement,
|
|
3095
|
-
getClippingRect,
|
|
3096
|
-
getOffsetParent,
|
|
3097
|
-
getElementRects,
|
|
3098
|
-
getClientRects,
|
|
3099
|
-
getDimensions,
|
|
3100
|
-
getScale,
|
|
3101
|
-
isElement,
|
|
3102
|
-
isRTL
|
|
3103
|
-
};
|
|
3104
|
-
var offset2 = offset;
|
|
3105
|
-
var shift2 = shift;
|
|
3106
|
-
var flip2 = flip;
|
|
3107
|
-
var size2 = size;
|
|
3108
|
-
var hide2 = hide;
|
|
3109
|
-
var arrow2 = arrow;
|
|
3110
|
-
var computePosition2 = (reference, floating, options) => {
|
|
3111
|
-
const cache2 = /* @__PURE__ */ new Map();
|
|
3112
|
-
const mergedOptions = __spreadValues({
|
|
3113
|
-
platform
|
|
3114
|
-
}, options);
|
|
3115
|
-
const platformWithCache = __spreadProps(__spreadValues({}, mergedOptions.platform), {
|
|
3116
|
-
_c: cache2
|
|
3117
|
-
});
|
|
3118
|
-
return computePosition(reference, floating, __spreadProps(__spreadValues({}, mergedOptions), {
|
|
3119
|
-
platform: platformWithCache
|
|
3120
|
-
}));
|
|
3121
|
-
};
|
|
3122
|
-
|
|
3123
|
-
// node_modules/.pnpm/@warp-ds+core@1.1.8_@floating-ui+dom@1.6.13/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
|
|
3124
|
-
var TOP_START = "top-start";
|
|
3125
|
-
var TOP = "top";
|
|
3126
|
-
var TOP_END = "top-end";
|
|
3127
|
-
var RIGHT_START = "right-start";
|
|
3128
|
-
var RIGHT = "right";
|
|
3129
|
-
var RIGHT_END = "right-end";
|
|
3130
|
-
var BOTTOM_START = "bottom-start";
|
|
3131
|
-
var BOTTOM = "bottom";
|
|
3132
|
-
var BOTTOM_END = "bottom-end";
|
|
3133
|
-
var LEFT_START = "left-start";
|
|
3134
|
-
var LEFT = "left";
|
|
3135
|
-
var LEFT_END = "left-end";
|
|
3136
|
-
var directions = [
|
|
3137
|
-
TOP_START,
|
|
3138
|
-
TOP,
|
|
3139
|
-
TOP_END,
|
|
3140
|
-
RIGHT_START,
|
|
3141
|
-
RIGHT,
|
|
3142
|
-
RIGHT_END,
|
|
3143
|
-
BOTTOM_START,
|
|
3144
|
-
BOTTOM,
|
|
3145
|
-
BOTTOM_END,
|
|
3146
|
-
LEFT_START,
|
|
3147
|
-
LEFT,
|
|
3148
|
-
LEFT_END
|
|
3149
|
-
];
|
|
3150
|
-
var opposites = {
|
|
3151
|
-
[TOP_START]: BOTTOM_START,
|
|
3152
|
-
[TOP]: BOTTOM,
|
|
3153
|
-
[TOP_END]: BOTTOM_END,
|
|
3154
|
-
[BOTTOM_START]: TOP_START,
|
|
3155
|
-
[BOTTOM]: TOP,
|
|
3156
|
-
[BOTTOM_END]: TOP_END,
|
|
3157
|
-
[LEFT_START]: RIGHT_START,
|
|
3158
|
-
[LEFT]: RIGHT,
|
|
3159
|
-
[LEFT_END]: RIGHT_END,
|
|
3160
|
-
[RIGHT_START]: LEFT_START,
|
|
3161
|
-
[RIGHT]: LEFT,
|
|
3162
|
-
[RIGHT_END]: LEFT_END
|
|
3163
|
-
};
|
|
3164
|
-
var rotation = {
|
|
3165
|
-
[LEFT_START]: -45,
|
|
3166
|
-
[LEFT]: -45,
|
|
3167
|
-
[LEFT_END]: -45,
|
|
3168
|
-
[TOP_START]: 45,
|
|
3169
|
-
[TOP]: 45,
|
|
3170
|
-
[TOP_END]: 45,
|
|
3171
|
-
[RIGHT_START]: 135,
|
|
3172
|
-
[RIGHT]: 135,
|
|
3173
|
-
[RIGHT_END]: 135,
|
|
3174
|
-
[BOTTOM_START]: -135,
|
|
3175
|
-
[BOTTOM]: -135,
|
|
3176
|
-
[BOTTOM_END]: -135
|
|
3177
|
-
};
|
|
3178
|
-
var arrowDirectionClassname = (dir) => {
|
|
3179
|
-
let direction;
|
|
3180
|
-
if (/-/.test(dir)) {
|
|
3181
|
-
direction = dir.split("-").map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join("");
|
|
3182
|
-
} else {
|
|
3183
|
-
direction = dir.charAt(0).toUpperCase() + dir.slice(1);
|
|
3184
|
-
}
|
|
3185
|
-
return direction;
|
|
3186
|
-
};
|
|
3187
|
-
var side = (dir) => dir.split("-")[0];
|
|
3188
|
-
var staticSide = (dir) => opposites[side(dir)];
|
|
3189
|
-
var arrowDirection = (dir) => opposites[dir];
|
|
3190
|
-
var arrowRotation = (dir) => rotation[arrowDirection(dir)];
|
|
3191
|
-
var applyArrowStyles = (arrowEl, arrowRotation2, dir) => {
|
|
3192
|
-
Object.assign(arrowEl == null ? void 0 : arrowEl.style, {
|
|
3193
|
-
borderTopLeftRadius: "4px",
|
|
3194
|
-
zIndex: 1,
|
|
3195
|
-
// border alignment is off by a fraction of a pixel, this fixes it
|
|
3196
|
-
[`margin${arrowDirectionClassname(staticSide(dir))}`]: "-0.5px",
|
|
3197
|
-
transform: `rotate(${arrowRotation2}deg)`
|
|
3198
|
-
});
|
|
3199
|
-
};
|
|
3200
|
-
var ELEMENT_PADDING = 8;
|
|
3201
|
-
var ARROW_OFFSET = 24;
|
|
3202
|
-
async function useRecompute(state) {
|
|
3203
|
-
var _a, _b, _c;
|
|
3204
|
-
if (!(state == null ? void 0 : state.isShowing))
|
|
3205
|
-
return;
|
|
3206
|
-
if (state == null ? void 0 : state.waitForDOM) {
|
|
3207
|
-
await (state == null ? void 0 : state.waitForDOM());
|
|
3208
|
-
}
|
|
3209
|
-
if (!(state == null ? void 0 : state.targetEl) || !(state == null ? void 0 : state.attentionEl))
|
|
3210
|
-
return;
|
|
3211
|
-
let targetEl = state == null ? void 0 : state.targetEl;
|
|
3212
|
-
const attentionEl = state.attentionEl;
|
|
3213
|
-
computePosition2(targetEl, attentionEl, {
|
|
3214
|
-
placement: (_a = state == null ? void 0 : state.directionName) != null ? _a : BOTTOM,
|
|
3215
|
-
middleware: [
|
|
3216
|
-
offset2({ mainAxis: (_b = state == null ? void 0 : state.distance) != null ? _b : 8, crossAxis: (_c = state == null ? void 0 : state.skidding) != null ? _c : 0 }),
|
|
3217
|
-
// offers flexibility over how to place the attentionEl towards its targetEl both on the x and y axis (horizontally and vertically).
|
|
3218
|
-
(state == null ? void 0 : state.flip) && flip2({
|
|
3219
|
-
// when flip is set to true it will move the attentionEl's placement to its opposite side or to the preferred placements if fallbackPlacements has a value
|
|
3220
|
-
crossAxis: state == null ? void 0 : state.crossAxis,
|
|
3221
|
-
// checks overflow to trigger a flip. When disabled, it will ignore overflow
|
|
3222
|
-
fallbackPlacements: state == null ? void 0 : state.fallbackPlacements
|
|
3223
|
-
}),
|
|
3224
|
-
(state == null ? void 0 : state.flip) && shift2({ crossAxis: true }),
|
|
3225
|
-
// shifts the attentionEl to make sure that it stays in view
|
|
3226
|
-
!(state == null ? void 0 : state.noArrow) && (state == null ? void 0 : state.arrowEl) && arrow2({ element: state == null ? void 0 : state.arrowEl }),
|
|
3227
|
-
hide2(),
|
|
3228
|
-
// will hide the attentionEl when it appears detached from the targetEl. Can be called multiple times in the middleware-array if you want to use several strategies. Default strategy is 'referenceHidden'.
|
|
3229
|
-
size2({
|
|
3230
|
-
apply() {
|
|
3231
|
-
Object.assign(attentionEl.style, {
|
|
3232
|
-
paddingRight: `${ELEMENT_PADDING}px`,
|
|
3233
|
-
paddingLeft: `${ELEMENT_PADDING}px`
|
|
3234
|
-
});
|
|
3235
|
-
}
|
|
3236
|
-
})
|
|
3237
|
-
]
|
|
3238
|
-
}).then(({ x, y, middlewareData, placement }) => {
|
|
3239
|
-
state.actualDirection = placement;
|
|
3240
|
-
if (!(state == null ? void 0 : state.isCallout)) {
|
|
3241
|
-
Object.assign(attentionEl.style, {
|
|
3242
|
-
left: `${x}px`,
|
|
3243
|
-
top: `${y}px`
|
|
3244
|
-
});
|
|
3245
|
-
}
|
|
3246
|
-
if ((middlewareData == null ? void 0 : middlewareData.hide) && !(state == null ? void 0 : state.isCallout)) {
|
|
3247
|
-
const { referenceHidden } = middlewareData.hide;
|
|
3248
|
-
Object.assign(attentionEl.style, {
|
|
3249
|
-
visibility: referenceHidden ? "hidden" : ""
|
|
3250
|
-
});
|
|
3251
|
-
}
|
|
3252
|
-
if ((middlewareData == null ? void 0 : middlewareData.arrow) && (state == null ? void 0 : state.arrowEl)) {
|
|
3253
|
-
const arrowEl = state == null ? void 0 : state.arrowEl;
|
|
3254
|
-
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
3255
|
-
const isRtl = window.getComputedStyle(attentionEl).direction === "rtl";
|
|
3256
|
-
const arrowPlacement = arrowDirection(placement).split("-")[1];
|
|
3257
|
-
let top = "", right = "", bottom = "", left = "";
|
|
3258
|
-
if (arrowPlacement === "start") {
|
|
3259
|
-
const value = typeof arrowX === "number" ? `calc(${ARROW_OFFSET}px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
3260
|
-
top = typeof arrowY === "number" ? `calc(${ARROW_OFFSET}px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
3261
|
-
right = isRtl ? value : "";
|
|
3262
|
-
left = isRtl ? "" : value;
|
|
3263
|
-
} else if (arrowPlacement === "end") {
|
|
3264
|
-
const value = typeof arrowX === "number" ? `calc(${ARROW_OFFSET}px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
3265
|
-
right = isRtl ? "" : value;
|
|
3266
|
-
left = isRtl ? value : "";
|
|
3267
|
-
bottom = typeof arrowY === "number" ? `calc(${ARROW_OFFSET}px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
3268
|
-
} else {
|
|
3269
|
-
left = typeof arrowX === "number" ? `${arrowX}px` : "";
|
|
3270
|
-
top = typeof arrowY === "number" ? `${arrowY}px` : "";
|
|
3271
|
-
}
|
|
3272
|
-
Object.assign(arrowEl.style, {
|
|
3273
|
-
top,
|
|
3274
|
-
right,
|
|
3275
|
-
bottom,
|
|
3276
|
-
left
|
|
3277
|
-
});
|
|
3278
|
-
applyArrowStyles(arrowEl, arrowRotation(placement), placement);
|
|
3279
|
-
}
|
|
3280
|
-
});
|
|
3281
|
-
return state;
|
|
3282
|
-
}
|
|
3283
|
-
|
|
3284
|
-
// node_modules/.pnpm/@warp-ds+css@2.1.1_@warp-ds+uno@2.1.0_unocss@0.62.0_postcss@8.5.1_rollup@4.32.1_vite@5._43dfacbc4a7d78ad84ef685a7085e344/node_modules/@warp-ds/css/component-classes/index.js
|
|
3285
|
-
var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
|
|
3286
|
-
var buttonColors = {
|
|
3287
|
-
primary: "s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",
|
|
3288
|
-
secondary: "s-text-link s-border s-bg hover:s-bg-hover hover:s-border-hover active:s-bg-active",
|
|
3289
|
-
utility: "s-text s-bg hover:s-bg-hover active:s-bg-active s-border hover:s-border-hover active:s-border-active",
|
|
3290
|
-
destructive: "s-bg-negative s-text-inverted hover:s-bg-negative-hover active:s-bg-negative-active",
|
|
3291
|
-
pill: "s-icon hover:s-icon-hover active:s-icon-active bg-transparent hover:bg-[--w-color-button-pill-background-hover] active:bg-[--w-color-button-pill-background-active]",
|
|
3292
|
-
disabled: "s-text-inverted s-bg-disabled",
|
|
3293
|
-
quiet: "bg-transparent s-text-link hover:s-bg-hover active:s-bg-active",
|
|
3294
|
-
utilityQuiet: "s-text bg-transparent hover:s-bg-hover active:s-bg-active",
|
|
3295
|
-
negativeQuiet: "bg-transparent s-text-negative hover:s-bg-negative-subtle-hover active:s-bg-negative-subtle-active",
|
|
3296
|
-
loading: "s-text s-bg-subtle",
|
|
3297
|
-
link: "s-text-link"
|
|
3298
|
-
};
|
|
3299
|
-
var buttonTypes = {
|
|
3300
|
-
primary: `border-0 rounded-8 ${buttonDefaultStyling}`,
|
|
3301
|
-
secondary: `border-2 rounded-8 ${buttonDefaultStyling}`,
|
|
3302
|
-
utility: `border rounded-4 ${buttonDefaultStyling}`,
|
|
3303
|
-
negative: `border-0 rounded-8 ${buttonDefaultStyling}`,
|
|
3304
|
-
pill: `p-4 rounded-full border-0 inline-flex items-center justify-center hover:bg-clip-padding ${buttonDefaultStyling}`,
|
|
3305
|
-
link: `bg-transparent focusable ease-in-out inline active:underline hover:underline focus:underline ${buttonColors.link}`
|
|
3306
|
-
};
|
|
3307
|
-
var buttonSizes = {
|
|
3308
|
-
xsmall: "py-6 px-16",
|
|
3309
|
-
small: "py-8 px-16",
|
|
3310
|
-
medium: "py-10 px-14",
|
|
3311
|
-
large: "py-12 px-16",
|
|
3312
|
-
utility: "py-[11px] px-[15px]",
|
|
3313
|
-
smallUtility: "py-[7px] px-[15px]",
|
|
3314
|
-
pill: "min-h-[44px] min-w-[44px]",
|
|
3315
|
-
pillSmall: "min-h-32 min-w-32",
|
|
3316
|
-
link: "p-0"
|
|
3317
|
-
};
|
|
3318
|
-
var buttonTextSizes = {
|
|
3319
|
-
medium: "text-m leading-[24]",
|
|
3320
|
-
xsmall: "text-xs"
|
|
3321
|
-
};
|
|
3322
|
-
var buttonVariants = {
|
|
3323
|
-
inProgress: `border-transparent animate-inprogress pointer-events-none ${buttonColors.loading}`,
|
|
3324
|
-
// .button--in-progress, a.button--in-progress:visited
|
|
3325
|
-
quiet: `border-0 rounded-8 ${buttonDefaultStyling}`,
|
|
3326
|
-
utilityQuiet: `border-0 rounded-4 ${buttonDefaultStyling}`,
|
|
3327
|
-
negativeQuiet: `border-0 rounded-8 ${buttonDefaultStyling}`,
|
|
3328
|
-
isDisabled: `font-bold justify-center transition-colors ease-in-out cursor-default pointer-events-none ${buttonColors.disabled}`
|
|
3329
|
-
// .button:disabled, .button--is-disabled
|
|
3330
|
-
};
|
|
3331
|
-
var button = {
|
|
3332
|
-
// Buttontypes
|
|
3333
|
-
secondary: `${buttonSizes.medium} ${buttonTextSizes.medium} ${buttonTypes.secondary} ${buttonColors.secondary}`,
|
|
3334
|
-
// .button--secondary, .button--default, .button
|
|
3335
|
-
secondaryHref: `${buttonSizes.medium} ${buttonTextSizes.medium} ${buttonTypes.secondary} ${buttonColors.secondary}`,
|
|
3336
|
-
secondaryDisabled: `${buttonSizes.medium} ${buttonTextSizes.medium} ${buttonTypes.secondary} ${buttonVariants.isDisabled}`,
|
|
3337
|
-
secondarySmall: `${buttonTextSizes.xsmall} ${buttonSizes.xsmall} ${buttonTypes.secondary} ${buttonColors.secondary}`,
|
|
3338
|
-
secondarySmallDisabled: `${buttonTextSizes.xsmall} ${buttonSizes.xsmall} ${buttonTypes.secondary} ${buttonVariants.isDisabled}`,
|
|
3339
|
-
secondaryQuiet: `${buttonSizes.medium} ${buttonTextSizes.medium} ${buttonVariants.quiet} ${buttonColors.quiet}`,
|
|
3340
|
-
secondaryQuietDisabled: `${buttonSizes.medium} ${buttonTextSizes.medium} ${buttonVariants.quiet} ${buttonVariants.isDisabled}`,
|
|
3341
|
-
secondarySmallQuiet: `${buttonTextSizes.xsmall} ${buttonSizes.xsmall} ${buttonVariants.quiet} ${buttonColors.quiet}`,
|
|
3342
|
-
secondarySmallQuietDisabled: `${buttonTextSizes.xsmall} ${buttonSizes.xsmall} ${buttonVariants.quiet} ${buttonVariants.isDisabled}`,
|
|
3343
|
-
secondaryLoading: `${buttonSizes.medium} ${buttonTextSizes.medium} ${buttonTypes.secondary} ${buttonVariants.inProgress}`,
|
|
3344
|
-
secondarySmallLoading: `${buttonTextSizes.xsmall} ${buttonSizes.xsmall} ${buttonTypes.secondary} ${buttonVariants.inProgress}`,
|
|
3345
|
-
secondarySmallQuietLoading: `${buttonTextSizes.xsmall} ${buttonSizes.xsmall} ${buttonVariants.quiet} ${buttonVariants.inProgress}`,
|
|
3346
|
-
secondaryQuietLoading: `${buttonSizes.medium} ${buttonTextSizes.medium} ${buttonVariants.quiet} ${buttonVariants.inProgress}`,
|
|
3347
|
-
primary: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonTypes.primary} ${buttonColors.primary}`,
|
|
3348
|
-
// .button--primary, .button--cta
|
|
3349
|
-
primaryDisabled: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonVariants.isDisabled} ${buttonTypes.primary}`,
|
|
3350
|
-
primarySmall: `${buttonSizes.small} ${buttonTextSizes.xsmall} ${buttonTypes.primary} ${buttonColors.primary}`,
|
|
3351
|
-
primarySmallDisabled: `${buttonSizes.small} ${buttonTextSizes.xsmall} ${buttonVariants.isDisabled} ${buttonTypes.primary} `,
|
|
3352
|
-
primaryQuiet: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonVariants.quiet} ${buttonColors.quiet}`,
|
|
3353
|
-
primaryQuietDisabled: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonVariants.quiet} ${buttonVariants.isDisabled}`,
|
|
3354
|
-
primarySmallQuiet: `${buttonSizes.small} ${buttonTextSizes.xsmall} ${buttonVariants.quiet} ${buttonColors.quiet}`,
|
|
3355
|
-
primarySmallQuietDisabled: `${buttonSizes.small} ${buttonTextSizes.xsmall} ${buttonVariants.quiet} ${buttonVariants.isDisabled}`,
|
|
3356
|
-
primaryLoading: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonVariants.inProgress} ${buttonTypes.primary}`,
|
|
3357
|
-
primarySmallLoading: `${buttonSizes.small} ${buttonTextSizes.xsmall} ${buttonVariants.inProgress} ${buttonTypes.primary}`,
|
|
3358
|
-
primarySmallQuietLoading: `${buttonSizes.small} ${buttonTextSizes.xsmall} ${buttonVariants.quiet} ${buttonVariants.inProgress} ${buttonTypes.primary}`,
|
|
3359
|
-
primaryQuietLoading: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonVariants.quiet} ${buttonVariants.inProgress}`,
|
|
3360
|
-
utility: `${buttonSizes.utility} ${buttonTextSizes.medium} ${buttonTypes.utility} ${buttonColors.utility}`,
|
|
3361
|
-
// .button--utility
|
|
3362
|
-
utilityDisabled: `${buttonSizes.utility} ${buttonTextSizes.medium} ${buttonTypes.utility} ${buttonVariants.isDisabled}`,
|
|
3363
|
-
utilityQuiet: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonVariants.utilityQuiet} ${buttonColors.utilityQuiet}`,
|
|
3364
|
-
// .button--utility-flat
|
|
3365
|
-
utilityQuietDisabled: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonVariants.utilityQuiet} ${buttonVariants.isDisabled}`,
|
|
3366
|
-
utilitySmall: `${buttonSizes.smallUtility} ${buttonTextSizes.xsmall} ${buttonTypes.utility} ${buttonColors.utility}`,
|
|
3367
|
-
utilitySmallDisabled: `${buttonSizes.smallUtility} ${buttonTextSizes.xsmall} ${buttonTypes.utility} ${buttonVariants.isDisabled}`,
|
|
3368
|
-
utilitySmallQuiet: `${buttonSizes.smallUtility} ${buttonTextSizes.xsmall} ${buttonVariants.utilityQuiet} ${buttonColors.utilityQuiet}`,
|
|
3369
|
-
utilitySmallQuietDisabled: `${buttonSizes.smallUtility} ${buttonTextSizes.xsmall} ${buttonVariants.utilityQuiet} ${buttonVariants.isDisabled}`,
|
|
3370
|
-
utilityLoading: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonTypes.utility} ${buttonVariants.inProgress}`,
|
|
3371
|
-
utilitySmallLoading: `${buttonSizes.smallUtility} ${buttonTextSizes.xsmall} ${buttonTypes.utility} ${buttonVariants.inProgress}`,
|
|
3372
|
-
utilityQuietLoading: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonVariants.inProgress} ${buttonVariants.utilityQuiet}`,
|
|
3373
|
-
utilitySmallQuietLoading: `${buttonSizes.smallUtility} ${buttonTextSizes.xsmall} ${buttonVariants.inProgress} ${buttonVariants.utilityQuiet}`,
|
|
3374
|
-
negative: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonTypes.negative} ${buttonColors.destructive}`,
|
|
3375
|
-
// .button--destructive
|
|
3376
|
-
negativeDisabled: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonTypes.negative} ${buttonVariants.isDisabled}`,
|
|
3377
|
-
negativeQuiet: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonVariants.negativeQuiet} ${buttonColors.negativeQuiet}`,
|
|
3378
|
-
// .button--destructive-flat
|
|
3379
|
-
negativeQuietDisabled: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonVariants.negativeQuiet}${buttonVariants.isDisabled}`,
|
|
3380
|
-
negativeSmall: `${buttonSizes.small} ${buttonTextSizes.xsmall} ${buttonTypes.negative} ${buttonColors.destructive}`,
|
|
3381
|
-
negativeSmallDisabled: `${buttonSizes.small} ${buttonTextSizes.xsmall} ${buttonTypes.negative} ${buttonVariants.isDisabled}`,
|
|
3382
|
-
negativeSmallQuiet: `${buttonSizes.small} ${buttonTextSizes.xsmall} ${buttonVariants.negativeQuiet} ${buttonColors.negativeQuiet}`,
|
|
3383
|
-
negativeSmallQuietDisabled: `${buttonSizes.small} ${buttonTextSizes.xsmall} ${buttonVariants.negativeQuiet} ${buttonVariants.isDisabled}`,
|
|
3384
|
-
negativeLoading: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonTypes.negative} ${buttonVariants.inProgress}`,
|
|
3385
|
-
negativeSmallLoading: `${buttonSizes.small} ${buttonTextSizes.xsmall} ${buttonVariants.inProgress} ${buttonTypes.negative}`,
|
|
3386
|
-
negativeQuietLoading: `${buttonSizes.large} ${buttonTextSizes.medium} ${buttonVariants.negativeQuiet} ${buttonTypes.negative} ${buttonVariants.inProgress}`,
|
|
3387
|
-
negativeSmallQuietLoading: `${buttonSizes.small} ${buttonTextSizes.xsmall} ${buttonVariants.negativeQuiet} ${buttonVariants.inProgress}`,
|
|
3388
|
-
pill: `${buttonSizes.pill} ${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill}`,
|
|
3389
|
-
// .button--pill
|
|
3390
|
-
pillSmall: `${buttonSizes.pillSmall} ${buttonTextSizes.xsmall} ${buttonTypes.pill} ${buttonColors.pill}`,
|
|
3391
|
-
pillLoading: `${buttonSizes.pill} ${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonVariants.inProgress}`,
|
|
3392
|
-
pillSmallLoading: `${buttonSizes.pillSmall} ${buttonTextSizes.xsmall} ${buttonTypes.pill} ${buttonVariants.inProgress}`,
|
|
3393
|
-
link: `${buttonSizes.link} ${buttonTextSizes.medium} ${buttonTypes.link}`,
|
|
3394
|
-
linkSmall: `${buttonSizes.link} ${buttonTextSizes.xsmall} ${buttonTypes.link}`,
|
|
3395
|
-
linkAsButton: "inline-block active:no-underline hover:no-underline focus:no-underline text-center",
|
|
3396
|
-
a11y: "sr-only",
|
|
3397
|
-
fullWidth: "w-full max-w-full",
|
|
3398
|
-
contentWidth: "max-w-max"
|
|
3399
|
-
};
|
|
3400
|
-
var modal = {
|
|
3401
|
-
backdrop: "fixed inset-0 flex sm:place-content-center sm:place-items-center items-end z-30 [--w-modal-max-height:80%] [--w-modal-width:640px] bg-[--w-black/25]",
|
|
3402
|
-
base: "pb-safe-[32] shadow-m max-h-[--w-modal-max-height] min-h-[--w-modal-min-height] w-[--w-modal-width] h-[--w-modal-height] relative transition-300 ease-in-out backface-hidden will-change-height rounded-8 mx-0 sm:mx-16 bg-[--w-s-color-surface-elevated-100] flex flex-col overflow-hidden outline-none space-y-16 pt-8 sm:pt-32 sm:pb-32 rounded-b-0 sm:rounded-b-8",
|
|
3403
|
-
content: "block overflow-y-auto overflow-x-hidden last-child:mb-0 grow shrink px-16 sm:px-32 relative",
|
|
3404
|
-
footer: "flex justify-end shrink-0 px-16 sm:px-32",
|
|
3405
|
-
transitionTitle: "transition-all duration-300",
|
|
3406
|
-
transitionTitleCenter: "justify-self-center self-center",
|
|
3407
|
-
transitionTitleColSpan: "col-span-2",
|
|
3408
|
-
title: "py-8 sm:py-0 -mt-4 sm:-mt-8 min-h-40 sm:min-h-48 grid gap-8 sm:gap-16 grid-cols-[auto_1fr_auto] items-start px-16 sm:px-32 border-b sm:border-b-0 shrink-0",
|
|
3409
|
-
titleText: "mb-0 h4 sm:h3",
|
|
3410
|
-
titleButton: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} sm:min-h-[44px] sm:min-w-[44px] min-h-[32px] min-w-[32px]`,
|
|
3411
|
-
titleButtonLeft: "-ml-8 sm:-ml-12 justify-self-start",
|
|
3412
|
-
titleButtonRight: "-mr-8 sm:-mr-12 justify-self-end",
|
|
3413
|
-
titleButtonIcon: "h-16 w-16 sm:h-24 sm:w-24",
|
|
3414
|
-
titleButtonIconRotated: "transform rotate-90"
|
|
3415
|
-
};
|
|
3416
|
-
var prefixSuffixWrapper = "absolute top-0 bottom-0 flex justify-center items-center focusable rounded-4 focus:[--w-outline-offset:-2px] bg-transparent ";
|
|
3417
|
-
var suffix = {
|
|
3418
|
-
wrapper: prefixSuffixWrapper + "right-0",
|
|
3419
|
-
wrapperWithLabel: "w-max pr-12",
|
|
3420
|
-
wrapperWithIcon: "w-40",
|
|
3421
|
-
label: "antialiased block relative cursor-default pb-0 font-bold text-xs s-text"
|
|
3422
|
-
};
|
|
3423
|
-
var prefix = {
|
|
3424
|
-
wrapper: prefixSuffixWrapper + "left-0",
|
|
3425
|
-
wrapperWithLabel: "w-max pl-12",
|
|
3426
|
-
wrapperWithIcon: "w-40",
|
|
3427
|
-
label: "antialiased block relative cursor-default pb-0 font-bold text-xs s-text"
|
|
3428
|
-
};
|
|
3429
|
-
var toggle = {
|
|
3430
|
-
// wrapper classes
|
|
3431
|
-
field: "relative text-m",
|
|
3432
|
-
// true
|
|
3433
|
-
wrapper: "relative py-1",
|
|
3434
|
-
// true
|
|
3435
|
-
wrapperRadioButtons: "inline-flex font-bold rounded-8 focus-within:focusable",
|
|
3436
|
-
// isRadioButton && !isEqualWidth
|
|
3437
|
-
wrapperRadioButtonsJustified: "flex font-bold rounded-8 focus-within:focusable",
|
|
3438
|
-
// isRadioButton && isEqualWidth,
|
|
3439
|
-
// group classes
|
|
3440
|
-
radioButtonsGroup: "group",
|
|
3441
|
-
// isRadioButton
|
|
3442
|
-
radioButtonsGroupJustified: "grow-1 shrink-0 basis-auto",
|
|
3443
|
-
// isRadioButton && isEqualWidth
|
|
3444
|
-
// input classes
|
|
3445
|
-
input: "peer",
|
|
3446
|
-
a11y: "sr-only",
|
|
3447
|
-
// label classes
|
|
3448
|
-
label: "peer-focus:focusable cursor-pointer text-m s-text s-border py-2 pl-28 select-none relative block before:border before:absolute before:transition-all before:left-0 before:w-20 before:h-20 before:top-2",
|
|
3449
|
-
// !isRadioButton
|
|
3450
|
-
labelBefore: 'before:content-[""] before:block',
|
|
3451
|
-
// !isRadioButton && !isIndeterminate
|
|
3452
|
-
checkbox: "before:s-bg before:rounded-2 hover:before:s-border-primary hover:before:s-bg-hover peer-checked:before:bg-center peer-checked:before:bg-[url(var(--w-icon-toggle-checked))] peer-checked:before:s-border-primary peer-checked:before:s-bg-primary peer-checked:peer-hover:before:s-border-primary-hover peer-checked:peer-hover:before:s-bg-primary-hover",
|
|
3453
|
-
// isCheckbox && !isIndeterminate && !isInvalid && !isDisabled
|
|
3454
|
-
checkboxInvalid: "before:s-bg before:s-border-negative before:rounded-2 hover:before:s-bg-negative-subtle-hover hover:before:s-border-negative-hover peer-checked:before:bg-center peer-checked:before:bg-[url(var(--w-icon-toggle-checked))] peer-checked:before:s-bg-negative peer-checked:before:s-border-negative peer-checked:peer-hover:before:s-bg-negative-hover peer-checked:peer-hover:before:s-border-negative-hover",
|
|
3455
|
-
// isCheckbox && !isIndeterminate && isInvalid && !isDisabled
|
|
3456
|
-
checkboxDisabled: "before:s-bg-disabled-subtle before:s-border-disabled pointer-events-none before:rounded-2 peer-checked:before:bg-center peer-checked:before:bg-[url(var(--w-icon-toggle-checked))] peer-checked:before:s-border-disabled peer-checked:before:s-bg-disabled",
|
|
3457
|
-
// isCheckbox && !isIndeterminate && !isInvalid && isDisabled
|
|
3458
|
-
indeterminate: 'before:content-["\u2013"] before:rounded-2 before:leading-xs before:text-center before:font-bold before:s-icon-inverted peer-indeterminate:before:s-border-primary peer-indeterminate:before:s-bg-primary peer-indeterminate:hover:before:s-border-primary-hover peer-indeterminate:hover:before:s-bg-primary-hover',
|
|
3459
|
-
// isCheckbox && isIndeterminate && !isInvalid && !isDisabled
|
|
3460
|
-
indeterminateInvalid: 'before:content-["\u2013"] before:rounded-2 before:leading-xs before:text-center before:font-bold before:s-icon-inverted peer-indeterminate:before:s-border-negative peer-indeterminate:before:s-bg-negative peer-indeterminate:hover:before:s-border-negative-hover peer-indeterminate:hover:before:s-bg-negative-hover',
|
|
3461
|
-
// isCheckbox && isIndeterminate && isInvalid && !isDisabled
|
|
3462
|
-
indeterminateDisabled: 'before:content-["\u2013"] before:rounded-2 before:leading-xs before:text-center before:font-bold pointer-events-none before:s-icon-inverted peer-indeterminate:before:s-border-disabled peer-indeterminate:before:s-bg-disabled',
|
|
3463
|
-
// isCheckbox && isIndeterminate && !isInvalid && isDisabled
|
|
3464
|
-
radio: "before:s-bg before:rounded-full peer-checked:before:border-[6] peer-checked:before:s-border-selected peer-checked:peer-hover:before:s-border-selected-hover peer-hover:before:s-border-primary peer-hover:before:s-bg-hover",
|
|
3465
|
-
// isRadio && !isDisabled && !isInvalid
|
|
3466
|
-
radioInvalid: "before:s-bg before:s-border-negative before:rounded-full peer-checked:before:border-[6] peer-hover:before:s-bg-negative-subtle peer-hover:before:s-border-negative-hover peer-checked:before:s-border-negative peer-checked:peer-hover:before:s-border-negative-hover",
|
|
3467
|
-
// isRadio && isInvalid && !isDisabled
|
|
3468
|
-
radioDisabled: "before:s-bg-disabled-subtle before:s-border-disabled pointer-events-none before:rounded-full peer-checked:before:border-[6]",
|
|
3469
|
-
// isRadio && !isInvalid && isDisabled
|
|
3470
|
-
radioButtonsLabel: "peer-hover:peer-not-checked:s-bg-hover peer-checked:s-text-inverted peer-checked:s-bg-primary peer-checked:s-border-primary block relative font-bold cursor-pointer s-text-link text-center s-bg border-2 s-border group-first-of-type:rounded-tl-8 group-first-of-type:rounded-bl-8 group-last-of-type:rounded-tr-8 group-last-of-type:rounded-br-8 group-not-last-of-type:border-r-0 peer-checked:z-10 group-not-first:-ml-2",
|
|
3471
|
-
// isRadioButtons
|
|
3472
|
-
radioButtonsRegular: "text-s py-8 pl-12 pr-14",
|
|
3473
|
-
// isRadioButtons && !isSmall
|
|
3474
|
-
radioButtonsSmall: "text-xs py-[5px] px-[8px]"
|
|
3475
|
-
// isRadioButtons && isSmall
|
|
3476
|
-
};
|
|
3477
|
-
var deadToggle = {
|
|
3478
|
-
wrapper: `${toggle.wrapper} h-20 w-20 pointer-events-none`,
|
|
3479
|
-
input: `${toggle.input} hidden`,
|
|
3480
|
-
inputVue: "hidden",
|
|
3481
|
-
labelVue: "-mt-2",
|
|
3482
|
-
labelRadio: `${toggle.label} ${toggle.labelBefore} ${toggle.radio}`,
|
|
3483
|
-
labelCheckbox: `${toggle.label} ${toggle.labelBefore} ${toggle.checkbox}`
|
|
3484
|
-
};
|
|
3485
|
-
var attention = {
|
|
3486
|
-
base: "border-2 relative flex items-start",
|
|
3487
|
-
tooltip: "s-bg-inverted border-[--w-s-color-background-inverted] shadow-m s-text-inverted-static rounded-4 py-6 px-8",
|
|
3488
|
-
callout: "bg-[--w-color-callout-background] border-[--w-color-callout-border] s-text py-8 px-16 rounded-8",
|
|
3489
|
-
highlight: "bg-[--w-color-callout-background] border-[--w-color-callout-border] s-text py-8 px-16 rounded-8 drop-shadow-m translate-z-0",
|
|
3490
|
-
popover: "bg-[--w-s-color-surface-elevated-300] border-[--w-s-color-surface-elevated-300] s-text rounded-8 p-16 drop-shadow-m translate-z-0",
|
|
3491
|
-
arrowBase: "absolute h-[14px] w-[14px] border-2 border-b-0 border-r-0 rounded-tl-4 transform",
|
|
3492
|
-
arrowDirectionLeftStart: "-left-[8px]",
|
|
3493
|
-
arrowDirectionLeft: "-left-[8px]",
|
|
3494
|
-
arrowDirectionLeftEnd: "-left-[8px]",
|
|
3495
|
-
arrowDirectionRightStart: "-right-[8px]",
|
|
3496
|
-
arrowDirectionRight: "-right-[8px]",
|
|
3497
|
-
arrowDirectionRightEnd: "-right-[8px]",
|
|
3498
|
-
arrowDirectionBottomStart: "-bottom-[8px]",
|
|
3499
|
-
arrowDirectionBottom: "-bottom-[8px]",
|
|
3500
|
-
arrowDirectionBottomEnd: "-bottom-[8px]",
|
|
3501
|
-
arrowDirectionTopStart: "-top-[8px]",
|
|
3502
|
-
arrowDirectionTop: "-top-[8px]",
|
|
3503
|
-
arrowDirectionTopEnd: "-top-[8px]",
|
|
3504
|
-
arrowTooltip: "s-bg-inverted border-[--w-s-color-background-inverted]",
|
|
3505
|
-
arrowCallout: "bg-[--w-color-callout-background] border-[--w-color-callout-border]",
|
|
3506
|
-
arrowPopover: "bg-[--w-s-color-surface-elevated-300] border-[--w-s-color-surface-elevated-300]",
|
|
3507
|
-
arrowHighlight: "bg-[--w-color-callout-background] border-[--w-color-callout-border]",
|
|
3508
|
-
content: "last-child:mb-0",
|
|
3509
|
-
notCallout: "absolute z-50",
|
|
3510
|
-
closeBtn: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} justify-self-end -mr-8 ml-8`
|
|
3511
|
-
};
|
|
3512
|
-
|
|
3513
|
-
// packages/attention/index.js
|
|
3514
|
-
import WarpElement from "@warp-ds/elements-core";
|
|
3515
|
-
import { ifDefined } from "lit/directives/if-defined.js";
|
|
3516
|
-
|
|
3517
|
-
// packages/i18n.ts
|
|
3518
|
-
var supportedLocales = ["en", "nb", "fi", "da", "sv"];
|
|
3519
|
-
var defaultLocale2 = "en";
|
|
3520
|
-
var getSupportedLocale = (usedLocale) => {
|
|
3521
|
-
return supportedLocales.find((locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)) || defaultLocale2;
|
|
3522
|
-
};
|
|
3523
|
-
function detectLocale() {
|
|
3524
|
-
if (typeof window === "undefined") {
|
|
3525
|
-
const serverLocale = process.env.NMP_LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale;
|
|
3526
|
-
return getSupportedLocale(serverLocale);
|
|
3527
|
-
}
|
|
3528
|
-
try {
|
|
3529
|
-
const htmlLocale = document.documentElement.lang;
|
|
3530
|
-
return getSupportedLocale(htmlLocale);
|
|
3531
|
-
} catch (e) {
|
|
3532
|
-
console.warn("could not detect locale, falling back to source locale", e);
|
|
3533
|
-
return defaultLocale2;
|
|
3534
|
-
}
|
|
3535
|
-
}
|
|
3536
|
-
var getMessages = (locale, enMsg, nbMsg, fiMsg, daMsg, svMsg) => {
|
|
3537
|
-
if (locale === "nb") return nbMsg;
|
|
3538
|
-
if (locale === "fi") return fiMsg;
|
|
3539
|
-
if (locale === "da") return daMsg;
|
|
3540
|
-
if (locale === "sv") return svMsg;
|
|
3541
|
-
return enMsg;
|
|
3542
|
-
};
|
|
3543
|
-
var activateI18n = (enMessages, nbMessages, fiMessages, daMessages, svMessages) => {
|
|
3544
|
-
const locale = detectLocale();
|
|
3545
|
-
const messages7 = getMessages(locale, enMessages, nbMessages, fiMessages, daMessages, svMessages);
|
|
3546
|
-
i18n.load(locale, messages7);
|
|
3547
|
-
i18n.activate(locale);
|
|
3548
|
-
};
|
|
3549
|
-
|
|
3550
|
-
// packages/utils/index.js
|
|
3551
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
3552
|
-
var camelCaseToKebabCase = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
3553
|
-
function kebabCaseAttributes(constructor) {
|
|
3554
|
-
return class extends constructor {
|
|
3555
|
-
static createProperty(name, options) {
|
|
3556
|
-
let customOptions = options;
|
|
3557
|
-
if (typeof (options == null ? void 0 : options.attribute) === "undefined" || (options == null ? void 0 : options.attribute) === true) {
|
|
3558
|
-
customOptions = Object.assign({}, options, {
|
|
3559
|
-
attribute: camelCaseToKebabCase(name.toString())
|
|
3560
|
-
});
|
|
3561
|
-
}
|
|
3562
|
-
super.createProperty(name, customOptions);
|
|
3563
|
-
}
|
|
3564
|
-
};
|
|
3565
|
-
}
|
|
3566
|
-
function generateRandomId() {
|
|
3567
|
-
return `m${Math.random().toString(36).slice(2)}`;
|
|
3568
|
-
}
|
|
3569
|
-
|
|
3570
|
-
// packages/attention/locales/da/messages.mjs
|
|
3571
|
-
var messages = JSON.parse('{"attention.aria.callout":["En gr\xF8n taleboble der introducerer noget nyt"],"attention.aria.close":["Luk"],"attention.aria.highlight":["En opm\xE6rksomhedsskabende taleboble med vigtig information"],"attention.aria.pointingDown":["peger nedad"],"attention.aria.pointingLeft":["peger til venstre"],"attention.aria.pointingRight":["peger til h\xF8jre"],"attention.aria.pointingUp":["peger opad"],"attention.aria.popover":["En hvid taleboble med mere information"],"attention.aria.tooltip":["En sort taleboble med flere oplysninger"]}');
|
|
3572
|
-
|
|
3573
|
-
// packages/attention/locales/en/messages.mjs
|
|
3574
|
-
var messages2 = JSON.parse('{"attention.aria.callout":["A green speech bubble introducing something new"],"attention.aria.close":["Close"],"attention.aria.highlight":["An attention speech bubble with important information"],"attention.aria.pointingDown":["pointing down"],"attention.aria.pointingLeft":["pointing left"],"attention.aria.pointingRight":["pointing right"],"attention.aria.pointingUp":["pointing up"],"attention.aria.popover":["A white speech bubble providing additional information"],"attention.aria.tooltip":["A black speech bubble providing complementary information"]}');
|
|
3575
|
-
|
|
3576
|
-
// packages/attention/locales/fi/messages.mjs
|
|
3577
|
-
var messages3 = JSON.parse('{"attention.aria.callout":["Vihre\xE4 puhekupla, joka esittelee jotain uutta"],"attention.aria.close":["Sulje"],"attention.aria.highlight":["Puhekupla, joka sis\xE4lt\xE4\xE4 t\xE4rke\xE4\xE4 tietoa"],"attention.aria.pointingDown":["osoittaa alas"],"attention.aria.pointingLeft":["osoittaa vasemmalle"],"attention.aria.pointingRight":["osoittaa oikealle"],"attention.aria.pointingUp":["osoittaa yl\xF6s"],"attention.aria.popover":["Valkoinen puhekupla, joka tarjoaa lis\xE4tietoa"],"attention.aria.tooltip":["Musta puhekupla, joka tarjoaa t\xE4ydent\xE4v\xE4\xE4 tietoa"]}');
|
|
3578
|
-
|
|
3579
|
-
// packages/attention/locales/nb/messages.mjs
|
|
3580
|
-
var messages4 = JSON.parse('{"attention.aria.callout":["Gr\xF8nn taleboble som introduserer noe nytt"],"attention.aria.close":["Lukk"],"attention.aria.highlight":["En uthevet taleboble med viktig informasjon"],"attention.aria.pointingDown":["peker ned"],"attention.aria.pointingLeft":["peker til venstre"],"attention.aria.pointingRight":["peker til h\xF8yre"],"attention.aria.pointingUp":["peker opp"],"attention.aria.popover":["En hvit taleboble som gir tilleggsinformasjon"],"attention.aria.tooltip":["En svart taleboble som forklarer konteksten"]}');
|
|
3581
|
-
|
|
3582
|
-
// packages/attention/locales/sv/messages.mjs
|
|
3583
|
-
var messages5 = JSON.parse('{"attention.aria.callout":["En gr\xF6n pratbubbla som introducerar n\xE5got nytt"],"attention.aria.close":["St\xE4ng"],"attention.aria.highlight":["En pratbubbla med viktig information"],"attention.aria.pointingDown":["pekar ned"],"attention.aria.pointingLeft":["pekar v\xE4nster"],"attention.aria.pointingRight":["pekar h\xF6ger"],"attention.aria.pointingUp":["pekar upp"],"attention.aria.popover":["En vit pratbubbla som ger ytterligare information"],"attention.aria.tooltip":["En svart pratbubbla som ger kompletterande information"]}');
|
|
3584
|
-
|
|
3585
|
-
// node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-p_f73b1d3c5bd9121d6f30248535f1f172/node_modules/@warp-ds/icons/dist/elements/close-16.js
|
|
3586
|
-
import { LitElement } from "lit";
|
|
3587
|
-
import { unsafeStatic, html } from "lit/static-html.js";
|
|
3588
|
-
var messages6 = JSON.parse('{"icon.title.close":["Kryss"]}');
|
|
3589
|
-
var messages22 = JSON.parse('{"icon.title.close":["Cross"]}');
|
|
3590
|
-
var messages32 = JSON.parse('{"icon.title.close":["Rasti"]}');
|
|
3591
|
-
var messages42 = JSON.parse('{"icon.title.close":["Kryds"]}');
|
|
3592
|
-
var messages52 = JSON.parse('{"icon.title.close":["Kryss"]}');
|
|
3593
|
-
var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
|
|
3594
|
-
var defaultLocale3 = "en";
|
|
3595
|
-
var detectByBrand = () => {
|
|
3596
|
-
var _a;
|
|
3597
|
-
let value;
|
|
3598
|
-
switch ((_a = process == null ? void 0 : process.env) == null ? void 0 : _a.NMP_BRAND) {
|
|
3599
|
-
case "FINN":
|
|
3600
|
-
value = "nb";
|
|
3601
|
-
break;
|
|
3602
|
-
case "TORI":
|
|
3603
|
-
value = "fi";
|
|
3604
|
-
break;
|
|
3605
|
-
case "BLOCKET":
|
|
3606
|
-
value = "sv";
|
|
3607
|
-
break;
|
|
3608
|
-
case "DBA":
|
|
3609
|
-
value = "da";
|
|
3610
|
-
break;
|
|
3611
|
-
default:
|
|
3612
|
-
value = "en";
|
|
3613
|
-
}
|
|
3614
|
-
return value;
|
|
3615
|
-
};
|
|
3616
|
-
var detectByHost = () => {
|
|
3617
|
-
var _a;
|
|
3618
|
-
const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
|
|
3619
|
-
if (hostname == null ? void 0 : hostname.includes("finn")) {
|
|
3620
|
-
return "nb";
|
|
3621
|
-
} else if (hostname.includes("tori")) {
|
|
3622
|
-
return "fi";
|
|
3623
|
-
} else if (hostname.includes("blocket")) {
|
|
3624
|
-
return "sv";
|
|
3625
|
-
} else if (hostname.includes("dba")) {
|
|
3626
|
-
return "da";
|
|
3627
|
-
} else {
|
|
3628
|
-
return defaultLocale3;
|
|
3629
|
-
}
|
|
3630
|
-
};
|
|
3631
|
-
var getSupportedLocale2 = (usedLocale) => {
|
|
3632
|
-
return supportedLocales2.find(
|
|
3633
|
-
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
3634
|
-
) || detectByHost();
|
|
3635
|
-
};
|
|
3636
|
-
function detectLocale2() {
|
|
3637
|
-
var _a;
|
|
3638
|
-
if (typeof window === "undefined") {
|
|
3639
|
-
const serverLocale = detectByBrand();
|
|
3640
|
-
return getSupportedLocale2(serverLocale);
|
|
3641
|
-
}
|
|
3642
|
-
try {
|
|
3643
|
-
const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
|
|
3644
|
-
const hostLocale = detectByHost();
|
|
3645
|
-
if (!supportedLocales2.includes(htmlLocale)) {
|
|
3646
|
-
console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
|
|
3647
|
-
return getSupportedLocale2(hostLocale);
|
|
3648
|
-
}
|
|
3649
|
-
return getSupportedLocale2(htmlLocale != null ? htmlLocale : hostLocale);
|
|
3650
|
-
} catch (e) {
|
|
3651
|
-
console.warn("could not detect locale, falling back to source locale", e);
|
|
3652
|
-
return defaultLocale3;
|
|
3653
|
-
}
|
|
3654
|
-
}
|
|
3655
|
-
var getMessages2 = (locale, enMsg, nbMsg, fiMsg, daMsg, svMsg) => {
|
|
3656
|
-
if (locale === "nb") return nbMsg;
|
|
3657
|
-
if (locale === "fi") return fiMsg;
|
|
3658
|
-
if (locale === "da") return daMsg;
|
|
3659
|
-
if (locale === "sv") return svMsg;
|
|
3660
|
-
return enMsg;
|
|
3661
|
-
};
|
|
3662
|
-
var activateI18n2 = (enMessages, nbMessages, fiMessages, daMessages, svMessages) => {
|
|
3663
|
-
const locale = detectLocale2();
|
|
3664
|
-
const messages62 = getMessages2(locale, enMessages, nbMessages, fiMessages, daMessages, svMessages);
|
|
3665
|
-
i18n.load(locale, messages62);
|
|
3666
|
-
i18n.activate(locale);
|
|
3667
|
-
};
|
|
3668
|
-
activateI18n2(messages22, messages6, messages32, messages42, messages52);
|
|
3669
|
-
var IconClose16 = class extends LitElement {
|
|
3670
|
-
render() {
|
|
3671
|
-
const title = i18n.t({ message: `Cross`, id: "icon.title.close", comment: "Title for close icon" });
|
|
3672
|
-
return html`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-close-16-part">${unsafeStatic(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m12.5 3.5-9 9m0-9 9 9"></path></svg>`;
|
|
3673
|
-
}
|
|
3674
|
-
};
|
|
3675
|
-
if (!customElements.get("w-icon-close-16")) {
|
|
3676
|
-
customElements.define("w-icon-close-16", IconClose16);
|
|
3677
|
-
}
|
|
3678
|
-
|
|
3679
|
-
// packages/attention/index.js
|
|
3680
|
-
var WarpAttention = class extends kebabCaseAttributes(WarpElement) {
|
|
3681
|
-
constructor() {
|
|
3682
|
-
super();
|
|
3683
|
-
activateI18n(messages2, messages4, messages3, messages, messages5);
|
|
3684
|
-
this.handleDone = this.handleDone.bind(this);
|
|
3685
|
-
this.show = false;
|
|
3686
|
-
this.placement = "bottom";
|
|
3687
|
-
this.tooltip = false;
|
|
3688
|
-
this.callout = false;
|
|
3689
|
-
this.popover = false;
|
|
3690
|
-
this.highlight = false;
|
|
3691
|
-
this.canClose = false;
|
|
3692
|
-
this.noArrow = false;
|
|
3693
|
-
this.distance = 8;
|
|
3694
|
-
this.skidding = 0;
|
|
3695
|
-
this.flip = false;
|
|
3696
|
-
this.crossAxis = false;
|
|
3697
|
-
this._initialPlacement = this.placement;
|
|
3698
|
-
this._actualDirection = this.placement;
|
|
3699
|
-
}
|
|
3700
|
-
connectedCallback() {
|
|
3701
|
-
super.connectedCallback();
|
|
3702
|
-
if (this.placement && !Object.keys(opposites).includes(this.placement)) {
|
|
3703
|
-
throw new Error(`Invalid "placement" attribute. Set its value to one of the following:
|
|
3704
|
-
${JSON.stringify(Object.keys(opposites))}`);
|
|
3705
|
-
}
|
|
3706
|
-
if (this.fallbackPlacements && !this.fallbackPlacements.every((fallbackPlacement) => directions.includes(fallbackPlacement))) {
|
|
3707
|
-
throw new Error(
|
|
3708
|
-
`Invalid "fallbackPlacements" attribute. Set its value to an array with one or more of the following:
|
|
3709
|
-
${JSON.stringify(directions)}`
|
|
3710
|
-
);
|
|
3711
|
-
}
|
|
3712
|
-
setTimeout(() => {
|
|
3713
|
-
this.requestUpdate();
|
|
3714
|
-
this.handleDone();
|
|
3715
|
-
}, 0);
|
|
3716
|
-
if (!this.callout) {
|
|
3717
|
-
window.addEventListener("click", this.handleDone);
|
|
3718
|
-
window.addEventListener("scroll", this.handleDone);
|
|
3719
|
-
window.addEventListener("resize", this.handleDone);
|
|
3720
|
-
window.addEventListener("touch", this.handleDone);
|
|
3721
|
-
}
|
|
3722
|
-
if (this.tooltip) {
|
|
3723
|
-
window.addEventListener("mouseover", this.handleDone);
|
|
3724
|
-
window.addEventListener("mouseout", this.handleDone);
|
|
3725
|
-
}
|
|
3726
|
-
}
|
|
3727
|
-
disconnectedCallback() {
|
|
3728
|
-
window.removeEventListener("click", this.handleDone);
|
|
3729
|
-
window.removeEventListener("scroll", this.handleDone);
|
|
3730
|
-
window.removeEventListener("resize", this.handleDone);
|
|
3731
|
-
window.removeEventListener("touch", this.handleDone);
|
|
3732
|
-
window.removeEventListener("mouseover", this.handleDone);
|
|
3733
|
-
window.removeEventListener("mouseout", this.handleDone);
|
|
3734
|
-
super.disconnectedCallback();
|
|
3735
|
-
}
|
|
3736
|
-
handleDone() {
|
|
3737
|
-
window.requestAnimationFrame(() => {
|
|
3738
|
-
if (this.show && this._targetEl && this._attentionEl) {
|
|
3739
|
-
useRecompute(this.attentionState).then((state) => {
|
|
3740
|
-
this._actualDirection = state == null ? void 0 : state.actualDirection;
|
|
3741
|
-
});
|
|
3742
|
-
} else {
|
|
3743
|
-
this._actualDirection = this._initialPlacement;
|
|
3744
|
-
}
|
|
3745
|
-
});
|
|
3746
|
-
}
|
|
3747
|
-
get _actualDirection() {
|
|
3748
|
-
return this.placement;
|
|
3749
|
-
}
|
|
3750
|
-
set _actualDirection(v) {
|
|
3751
|
-
this.placement = v;
|
|
3752
|
-
}
|
|
3753
|
-
get _arrowEl() {
|
|
3754
|
-
return this.renderRoot.querySelector("#arrow");
|
|
3755
|
-
}
|
|
3756
|
-
get _arrowDirection() {
|
|
3757
|
-
return opposites[this._actualDirection];
|
|
3758
|
-
}
|
|
3759
|
-
get _arrowClasses() {
|
|
3760
|
-
return r([
|
|
3761
|
-
attention.arrowBase,
|
|
3762
|
-
this._activeVariantClasses.arrow,
|
|
3763
|
-
attention[`arrowDirection${arrowDirectionClassname(this._arrowDirection)}`]
|
|
3764
|
-
]);
|
|
3765
|
-
}
|
|
3766
|
-
get _arrowHtml() {
|
|
3767
|
-
return this.noArrow ? "" : html2`<div id="arrow" class="${this._arrowClasses}"></div>`;
|
|
3768
|
-
}
|
|
3769
|
-
get _activeVariantClasses() {
|
|
3770
|
-
const variantProps = {
|
|
3771
|
-
callout: this.callout,
|
|
3772
|
-
popover: this.popover,
|
|
3773
|
-
tooltip: this.tooltip,
|
|
3774
|
-
highlight: this.highlight
|
|
3775
|
-
};
|
|
3776
|
-
const activeVariant = Object.keys(variantProps).find((b) => !!variantProps[b]) || "";
|
|
3777
|
-
return {
|
|
3778
|
-
wrapper: attention[activeVariant],
|
|
3779
|
-
arrow: attention[`arrow${activeVariant.charAt(0).toUpperCase() + activeVariant.slice(1)}`]
|
|
3780
|
-
};
|
|
3781
|
-
}
|
|
3782
|
-
get _attentionEl() {
|
|
3783
|
-
return this.renderRoot.querySelector("#attention");
|
|
3784
|
-
}
|
|
3785
|
-
get _targetEl() {
|
|
3786
|
-
var _a;
|
|
3787
|
-
const targetSlot = (_a = this.renderRoot) == null ? void 0 : _a.querySelector("slot[name='target']");
|
|
3788
|
-
return targetSlot ? targetSlot.assignedNodes()[0] : null;
|
|
3789
|
-
}
|
|
3790
|
-
get _messageEl() {
|
|
3791
|
-
const messageSlot = this.renderRoot.querySelector("slot[name='message']");
|
|
3792
|
-
return messageSlot ? messageSlot.assignedNodes()[0] : null;
|
|
3793
|
-
}
|
|
3794
|
-
get _wrapperClasses() {
|
|
3795
|
-
return r([attention.base, this._activeVariantClasses.wrapper]);
|
|
3796
|
-
}
|
|
3797
|
-
get _ariaClose() {
|
|
3798
|
-
return i18n._({
|
|
3799
|
-
id: "attention.aria.close",
|
|
3800
|
-
message: "Close",
|
|
3801
|
-
comment: "Aria label for the close button in attention"
|
|
3802
|
-
});
|
|
3803
|
-
}
|
|
3804
|
-
get _closeBtnHtml() {
|
|
3805
|
-
return html2`
|
|
3806
|
-
<button aria-label="${this._ariaClose}" @click="${this.close}" @keydown=${this.keypressed} class="${attention.closeBtn}">
|
|
10
|
+
`)),ee(l)&&xt.test(l)?JSON.parse(`"${l}"`):ee(l)?l:Uo(l,this._locale,this._locales)(o,r==null?void 0:r.formats)}date(t,o){return ot(this._locales||this._locale,t,o)}number(t,o){return Xe(this._locales||this._locale,t,o)}};function Ko(e={}){return new et(e)}var S=Ko();var Et=["top","right","bottom","left"];var q=Math.min,O=Math.max,we=Math.round;var j=e=>({x:e,y:e}),Yo={left:"right",right:"left",bottom:"top",top:"bottom"},Xo={start:"end",end:"start"};function Oe(e,t,o){return O(e,q(t,o))}function te(e,t){return typeof e=="function"?e(t):e}function J(e){return e.split("-")[0]}function ae(e){return e.split("-")[1]}function rt(e){return e==="x"?"y":"x"}function Le(e){return e==="y"?"height":"width"}var Zo=new Set(["top","bottom"]);function z(e){return Zo.has(J(e))?"y":"x"}function Te(e){return rt(z(e))}function _t(e,t,o){o===void 0&&(o=!1);let r=ae(e),n=Te(e),s=Le(n),i=n==="x"?r===(o?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=ve(i)),[i,ve(i)]}function St(e){let t=ve(e);return[Ce(e),t,Ce(t)]}function Ce(e){return e.replace(/start|end/g,t=>Xo[t])}var $t=["left","right"],kt=["right","left"],er=["top","bottom"],tr=["bottom","top"];function or(e,t,o){switch(e){case"top":case"bottom":return o?t?kt:$t:t?$t:kt;case"left":case"right":return t?er:tr;default:return[]}}function At(e,t,o,r){let n=ae(e),s=or(J(e),o==="start",r);return n&&(s=s.map(i=>i+"-"+n),t&&(s=s.concat(s.map(Ce)))),s}function ve(e){return e.replace(/left|right|bottom|top/g,t=>Yo[t])}function rr(e){return{top:0,right:0,bottom:0,left:0,...e}}function nt(e){return typeof e!="number"?rr(e):{top:e,right:e,bottom:e,left:e}}function le(e){let{x:t,y:o,width:r,height:n}=e;return{width:r,height:n,top:o,left:t,right:t+r,bottom:o+n,x:t,y:o}}function Dt(e,t,o){let{reference:r,floating:n}=e,s=z(t),i=Te(t),a=Le(i),l=J(t),c=s==="y",d=r.x+r.width/2-n.width/2,u=r.y+r.height/2-n.height/2,b=r[a]/2-n[a]/2,f;switch(l){case"top":f={x:d,y:r.y-n.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:u};break;case"left":f={x:r.x-n.width,y:u};break;default:f={x:r.x,y:r.y}}switch(ae(t)){case"start":f[i]-=b*(o&&c?-1:1);break;case"end":f[i]+=b*(o&&c?-1:1);break}return f}var Lt=async(e,t,o)=>{let{placement:r="bottom",strategy:n="absolute",middleware:s=[],platform:i}=o,a=s.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t)),c=await i.getElementRects({reference:e,floating:t,strategy:n}),{x:d,y:u}=Dt(c,r,l),b=r,f={},h=0;for(let v=0;v<a.length;v++){let{name:w,fn:y}=a[v],{x:$,y:k,data:A,reset:_}=await y({x:d,y:u,initialPlacement:r,placement:b,strategy:n,middlewareData:f,rects:c,platform:i,elements:{reference:e,floating:t}});d=$!=null?$:d,u=k!=null?k:u,f={...f,[w]:{...f[w],...A}},_&&h<=50&&(h++,typeof _=="object"&&(_.placement&&(b=_.placement),_.rects&&(c=_.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:n}):_.rects),{x:d,y:u}=Dt(c,b,l)),v=-1)}return{x:d,y:u,placement:b,strategy:n,middlewareData:f}};async function me(e,t){var o;t===void 0&&(t={});let{x:r,y:n,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:b=!1,padding:f=0}=te(t,e),h=nt(f),w=a[b?u==="floating"?"reference":"floating":u],y=le(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(w)))==null||o?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),$=u==="floating"?{x:r,y:n,width:i.floating.width,height:i.floating.height}:i.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),A=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},_=le(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:$,offsetParent:k,strategy:l}):$);return{top:(y.top-_.top+h.top)/A.y,bottom:(_.bottom-y.bottom+h.bottom)/A.y,left:(y.left-_.left+h.left)/A.x,right:(_.right-y.right+h.right)/A.x}}var Tt=e=>({name:"arrow",options:e,async fn(t){let{x:o,y:r,placement:n,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:c,padding:d=0}=te(e,t)||{};if(c==null)return{};let u=nt(d),b={x:o,y:r},f=Te(n),h=Le(f),v=await i.getDimensions(c),w=f==="y",y=w?"top":"left",$=w?"bottom":"right",k=w?"clientHeight":"clientWidth",A=s.reference[h]+s.reference[f]-b[f]-s.floating[h],_=b[f]-s.reference[f],K=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c)),M=K?K[k]:0;(!M||!await(i.isElement==null?void 0:i.isElement(K)))&&(M=a.floating[k]||s.floating[h]);let U=A/2-_/2,F=M/2-v[h]/2-1,T=q(u[y],F),Y=q(u[$],F),H=T,X=M-v[h]-Y,D=M/2-v[h]/2+U,ne=Oe(H,D,X),W=!l.arrow&&ae(n)!=null&&D!==ne&&s.reference[h]/2-(D<H?T:Y)-v[h]/2<0,B=W?D<H?D-H:D-X:0;return{[f]:b[f]+B,data:{[f]:ne,centerOffset:D-ne-B,...W&&{alignmentOffset:B}},reset:W}}});var Rt=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,r;let{placement:n,middlewareData:s,rects:i,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:b,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:v=!0,...w}=te(e,t);if((o=s.arrow)!=null&&o.alignmentOffset)return{};let y=J(n),$=z(a),k=J(a)===a,A=await(l.isRTL==null?void 0:l.isRTL(c.floating)),_=b||(k||!v?[ve(a)]:St(a)),K=h!=="none";!b&&K&&_.push(...At(a,v,h,A));let M=[a,..._],U=await me(t,w),F=[],T=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&F.push(U[y]),u){let D=_t(n,i,A);F.push(U[D[0]],U[D[1]])}if(T=[...T,{placement:n,overflows:F}],!F.every(D=>D<=0)){var Y,H;let D=(((Y=s.flip)==null?void 0:Y.index)||0)+1,ne=M[D];if(ne&&(!(u==="alignment"?$!==z(ne):!1)||T.every(N=>z(N.placement)===$?N.overflows[0]>0:!0)))return{data:{index:D,overflows:T},reset:{placement:ne}};let W=(H=T.filter(B=>B.overflows[0]<=0).sort((B,N)=>B.overflows[1]-N.overflows[1])[0])==null?void 0:H.placement;if(!W)switch(f){case"bestFit":{var X;let B=(X=T.filter(N=>{if(K){let Z=z(N.placement);return Z===$||Z==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(Z=>Z>0).reduce((Z,ko)=>Z+ko,0)]).sort((N,Z)=>N[1]-Z[1])[0])==null?void 0:X[0];B&&(W=B);break}case"initialPlacement":W=a;break}if(n!==W)return{reset:{placement:W}}}return{}}}};function Ct(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ot(e){return Et.some(t=>e[t]>=0)}var Pt=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){let{rects:o}=t,{strategy:r="referenceHidden",...n}=te(e,t);switch(r){case"referenceHidden":{let s=await me(t,{...n,elementContext:"reference"}),i=Ct(s,o.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Ot(i)}}}case"escaped":{let s=await me(t,{...n,altBoundary:!0}),i=Ct(s,o.floating);return{data:{escapedOffsets:i,escaped:Ot(i)}}}default:return{}}}}};var nr=new Set(["left","top"]);async function ir(e,t){let{placement:o,platform:r,elements:n}=e,s=await(r.isRTL==null?void 0:r.isRTL(n.floating)),i=J(o),a=ae(o),l=z(o)==="y",c=nr.has(i)?-1:1,d=s&&l?-1:1,u=te(t,e),{mainAxis:b,crossAxis:f,alignmentAxis:h}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof h=="number"&&(f=a==="end"?h*-1:h),l?{x:f*d,y:b*c}:{x:b*c,y:f*d}}var Mt=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,r;let{x:n,y:s,placement:i,middlewareData:a}=t,l=await ir(t,e);return i===((o=a.offset)==null?void 0:o.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:n+l.x,y:s+l.y,data:{...l,placement:i}}}}},Bt=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:o,y:r,placement:n}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:a={fn:w=>{let{x:y,y:$}=w;return{x:y,y:$}}},...l}=te(e,t),c={x:o,y:r},d=await me(t,l),u=z(J(n)),b=rt(u),f=c[b],h=c[u];if(s){let w=b==="y"?"top":"left",y=b==="y"?"bottom":"right",$=f+d[w],k=f-d[y];f=Oe($,f,k)}if(i){let w=u==="y"?"top":"left",y=u==="y"?"bottom":"right",$=h+d[w],k=h-d[y];h=Oe($,h,k)}let v=a.fn({...t,[b]:f,[u]:h});return{...v,data:{x:v.x-o,y:v.y-r,enabled:{[b]:s,[u]:i}}}}}};var Nt=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var o,r;let{placement:n,rects:s,platform:i,elements:a}=t,{apply:l=()=>{},...c}=te(e,t),d=await me(t,c),u=J(n),b=ae(n),f=z(n)==="y",{width:h,height:v}=s.floating,w,y;u==="top"||u==="bottom"?(w=u,y=b===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=u,w=b==="end"?"top":"bottom");let $=v-d.top-d.bottom,k=h-d.left-d.right,A=q(v-d[w],$),_=q(h-d[y],k),K=!t.middlewareData.shift,M=A,U=_;if((o=t.middlewareData.shift)!=null&&o.enabled.x&&(U=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(M=$),K&&!b){let T=O(d.left,0),Y=O(d.right,0),H=O(d.top,0),X=O(d.bottom,0);f?U=h-2*(T!==0||Y!==0?T+Y:O(d.left,d.right)):M=v-2*(H!==0||X!==0?H+X:O(d.top,d.bottom))}await l({...t,availableWidth:U,availableHeight:M});let F=await i.getDimensions(a.floating);return h!==F.width||v!==F.height?{reset:{rects:!0}}:{}}}};function Pe(){return typeof window!="undefined"}function ce(e){return It(e)?(e.nodeName||"").toLowerCase():"#document"}function L(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Q(e){var t;return(t=(It(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function It(e){return Pe()?e instanceof Node||e instanceof L(e).Node:!1}function R(e){return Pe()?e instanceof Element||e instanceof L(e).Element:!1}function I(e){return Pe()?e instanceof HTMLElement||e instanceof L(e).HTMLElement:!1}function jt(e){return!Pe()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof L(e).ShadowRoot}var sr=new Set(["inline","contents"]);function ge(e){let{overflow:t,overflowX:o,overflowY:r,display:n}=P(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+o)&&!sr.has(n)}var ar=new Set(["table","td","th"]);function Ft(e){return ar.has(ce(e))}var lr=[":popover-open",":modal"];function xe(e){return lr.some(t=>{try{return e.matches(t)}catch(o){return!1}})}var cr=["transform","translate","scale","rotate","perspective"],dr=["transform","translate","scale","rotate","perspective","filter"],ur=["paint","layout","strict","content"];function Me(e){let t=Be(),o=R(e)?P(e):e;return cr.some(r=>o[r]?o[r]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!t&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!t&&(o.filter?o.filter!=="none":!1)||dr.some(r=>(o.willChange||"").includes(r))||ur.some(r=>(o.contain||"").includes(r))}function Ht(e){let t=G(e);for(;I(t)&&!de(t);){if(Me(t))return t;if(xe(t))return null;t=G(t)}return null}function Be(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var fr=new Set(["html","body","#document"]);function de(e){return fr.has(ce(e))}function P(e){return L(e).getComputedStyle(e)}function ye(e){return R(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function G(e){if(ce(e)==="html")return e;let t=e.assignedSlot||e.parentNode||jt(e)&&e.host||Q(e);return jt(t)?t.host:t}function zt(e){let t=G(e);return de(t)?e.ownerDocument?e.ownerDocument.body:e.body:I(t)&&ge(t)?t:zt(t)}function Re(e,t,o){var r;t===void 0&&(t=[]),o===void 0&&(o=!0);let n=zt(e),s=n===((r=e.ownerDocument)==null?void 0:r.body),i=L(n);if(s){let a=Ne(i);return t.concat(i,i.visualViewport||[],ge(n)?n:[],a&&o?Re(a):[])}return t.concat(n,Re(n,[],o))}function Ne(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Wt(e){let t=P(e),o=parseFloat(t.width)||0,r=parseFloat(t.height)||0,n=I(e),s=n?e.offsetWidth:o,i=n?e.offsetHeight:r,a=we(o)!==s||we(r)!==i;return a&&(o=s,r=i),{width:o,height:r,$:a}}function Vt(e){return R(e)?e:e.contextElement}function be(e){let t=Vt(e);if(!I(t))return j(1);let o=t.getBoundingClientRect(),{width:r,height:n,$:s}=Wt(t),i=(s?we(o.width):o.width)/r,a=(s?we(o.height):o.height)/n;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}var pr=j(0);function qt(e){let t=L(e);return!Be()||!t.visualViewport?pr:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function mr(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==L(e)?!1:t}function $e(e,t,o,r){t===void 0&&(t=!1),o===void 0&&(o=!1);let n=e.getBoundingClientRect(),s=Vt(e),i=j(1);t&&(r?R(r)&&(i=be(r)):i=be(e));let a=mr(s,o,r)?qt(s):j(0),l=(n.left+a.x)/i.x,c=(n.top+a.y)/i.y,d=n.width/i.x,u=n.height/i.y;if(s){let b=L(s),f=r&&R(r)?L(r):r,h=b,v=Ne(h);for(;v&&r&&f!==h;){let w=be(v),y=v.getBoundingClientRect(),$=P(v),k=y.left+(v.clientLeft+parseFloat($.paddingLeft))*w.x,A=y.top+(v.clientTop+parseFloat($.paddingTop))*w.y;l*=w.x,c*=w.y,d*=w.x,u*=w.y,l+=k,c+=A,h=L(v),v=Ne(h)}}return le({width:d,height:u,x:l,y:c})}function st(e,t){let o=ye(e).scrollLeft;return t?t.left+o:$e(Q(e)).left+o}function Jt(e,t,o){o===void 0&&(o=!1);let r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-(o?0:st(e,r)),s=r.top+t.scrollTop;return{x:n,y:s}}function gr(e){let{elements:t,rect:o,offsetParent:r,strategy:n}=e,s=n==="fixed",i=Q(r),a=t?xe(t.floating):!1;if(r===i||a&&s)return o;let l={scrollLeft:0,scrollTop:0},c=j(1),d=j(0),u=I(r);if((u||!u&&!s)&&((ce(r)!=="body"||ge(i))&&(l=ye(r)),I(r))){let f=$e(r);c=be(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}let b=i&&!u&&!s?Jt(i,l,!0):j(0);return{width:o.width*c.x,height:o.height*c.y,x:o.x*c.x-l.scrollLeft*c.x+d.x+b.x,y:o.y*c.y-l.scrollTop*c.y+d.y+b.y}}function br(e){return Array.from(e.getClientRects())}function hr(e){let t=Q(e),o=ye(e),r=e.ownerDocument.body,n=O(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=O(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),i=-o.scrollLeft+st(e),a=-o.scrollTop;return P(r).direction==="rtl"&&(i+=O(t.clientWidth,r.clientWidth)-n),{width:n,height:s,x:i,y:a}}function vr(e,t){let o=L(e),r=Q(e),n=o.visualViewport,s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(n){s=n.width,i=n.height;let c=Be();(!c||c&&t==="fixed")&&(a=n.offsetLeft,l=n.offsetTop)}return{width:s,height:i,x:a,y:l}}function wr(e,t){let o=$e(e,!0,t==="fixed"),r=o.top+e.clientTop,n=o.left+e.clientLeft,s=I(e)?be(e):j(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=n*s.x,c=r*s.y;return{width:i,height:a,x:l,y:c}}function Qt(e,t,o){let r;if(t==="viewport")r=vr(e,o);else if(t==="document")r=hr(Q(e));else if(R(t))r=wr(t,o);else{let n=qt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return le(r)}function Gt(e,t){let o=G(e);return o===t||!R(o)||de(o)?!1:P(o).position==="fixed"||Gt(o,t)}function xr(e,t){let o=t.get(e);if(o)return o;let r=Re(e,[],!1).filter(a=>R(a)&&ce(a)!=="body"),n=null,s=P(e).position==="fixed",i=s?G(e):e;for(;R(i)&&!de(i);){let a=P(i),l=Me(i);!l&&a.position==="fixed"&&(n=null),(s?!l&&!n:!l&&a.position==="static"&&!!n&&["absolute","fixed"].includes(n.position)||ge(i)&&!l&&Gt(e,i))?r=r.filter(d=>d!==i):n=a,i=G(i)}return t.set(e,r),r}function yr(e){let{element:t,boundary:o,rootBoundary:r,strategy:n}=e,i=[...o==="clippingAncestors"?xe(t)?[]:xr(t,this._c):[].concat(o),r],a=i[0],l=i.reduce((c,d)=>{let u=Qt(t,d,n);return c.top=O(u.top,c.top),c.right=q(u.right,c.right),c.bottom=q(u.bottom,c.bottom),c.left=O(u.left,c.left),c},Qt(t,a,n));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function $r(e){let{width:t,height:o}=Wt(e);return{width:t,height:o}}function kr(e,t,o){let r=I(t),n=Q(t),s=o==="fixed",i=$e(e,!0,s,t),a={scrollLeft:0,scrollTop:0},l=j(0);if(r||!r&&!s)if((ce(t)!=="body"||ge(n))&&(a=ye(t)),r){let b=$e(t,!0,s,t);l.x=b.x+t.clientLeft,l.y=b.y+t.clientTop}else n&&(l.x=st(n));let c=n&&!r&&!s?Jt(n,a):j(0),d=i.left+a.scrollLeft-l.x-c.x,u=i.top+a.scrollTop-l.y-c.y;return{x:d,y:u,width:i.width,height:i.height}}function it(e){return P(e).position==="static"}function Ut(e,t){if(!I(e)||P(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return Q(e)===o&&(o=o.ownerDocument.body),o}function Kt(e,t){let o=L(e);if(xe(e))return o;if(!I(e)){let n=G(e);for(;n&&!de(n);){if(R(n)&&!it(n))return n;n=G(n)}return o}let r=Ut(e,t);for(;r&&Ft(r)&&it(r);)r=Ut(r,t);return r&&de(r)&&it(r)&&!Me(r)?o:r||Ht(e)||o}var Er=async function(e){let t=this.getOffsetParent||Kt,o=this.getDimensions,r=await o(e.floating);return{reference:kr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _r(e){return P(e).direction==="rtl"}var Sr={convertOffsetParentRelativeRectToViewportRelativeRect:gr,getDocumentElement:Q,getClippingRect:yr,getOffsetParent:Kt,getElementRects:Er,getClientRects:br,getDimensions:$r,getScale:be,isElement:R,isRTL:_r};var Yt=Mt;var Xt=Bt,Zt=Rt,eo=Nt,to=Pt,oo=Tt;var ro=(e,t,o)=>{let r=new Map,n={platform:Sr,...o},s={...n.platform,_c:r};return Lt(e,t,{...n,platform:s})};var Ie="top-start",Fe="top",He="top-end",ze="right-start",Qe="right",Ue="right-end",We="bottom-start",ke="bottom",Ve="bottom-end",qe="left-start",Je="left",Ge="left-end",at=[Ie,Fe,He,ze,Qe,Ue,We,ke,Ve,qe,Je,Ge],ue={[Ie]:We,[Fe]:ke,[He]:Ve,[We]:Ie,[ke]:Fe,[Ve]:He,[qe]:ze,[Je]:Qe,[Ge]:Ue,[ze]:qe,[Qe]:Je,[Ue]:Ge},Ar={[qe]:-45,[Je]:-45,[Ge]:-45,[Ie]:45,[Fe]:45,[He]:45,[ze]:135,[Qe]:135,[Ue]:135,[We]:-135,[ke]:-135,[Ve]:-135},lt=e=>{let t;return/-/.test(e)?t=e.split("-").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(""):t=e.charAt(0).toUpperCase()+e.slice(1),t},Dr=e=>e.split("-")[0],Cr=e=>ue[Dr(e)],io=e=>ue[e],Or=e=>Ar[io(e)],Lr=(e,t,o)=>{Object.assign(e==null?void 0:e.style,{borderTopLeftRadius:"4px",zIndex:1,[`margin${lt(Cr(o))}`]:"-0.5px",transform:`rotate(${t}deg)`})},no=8,je=24;async function ct(e){var r,n,s;if(!(e!=null&&e.isShowing)||(e!=null&&e.waitForDOM&&await(e==null?void 0:e.waitForDOM()),!(e!=null&&e.targetEl)||!(e!=null&&e.attentionEl)))return;let t=e==null?void 0:e.targetEl,o=e.attentionEl;return ro(t,o,{placement:(r=e==null?void 0:e.directionName)!=null?r:ke,middleware:[Yt({mainAxis:(n=e==null?void 0:e.distance)!=null?n:8,crossAxis:(s=e==null?void 0:e.skidding)!=null?s:0}),(e==null?void 0:e.flip)&&Zt({crossAxis:e==null?void 0:e.crossAxis,fallbackPlacements:e==null?void 0:e.fallbackPlacements}),(e==null?void 0:e.flip)&&Xt({crossAxis:!0}),!(e!=null&&e.noArrow)&&(e==null?void 0:e.arrowEl)&&oo({element:e==null?void 0:e.arrowEl}),to(),eo({apply(){Object.assign(o.style,{paddingRight:`${no}px`,paddingLeft:`${no}px`})}})]}).then(({x:i,y:a,middlewareData:l,placement:c})=>{if(e.actualDirection=c,e!=null&&e.isCallout||Object.assign(o.style,{left:`${i}px`,top:`${a}px`}),l!=null&&l.hide&&!(e!=null&&e.isCallout)){let{referenceHidden:d}=l.hide;Object.assign(o.style,{visibility:d?"hidden":""})}if(l!=null&&l.arrow&&(e!=null&&e.arrowEl)){let d=e==null?void 0:e.arrowEl,{x:u,y:b}=l.arrow,f=window.getComputedStyle(o).direction==="rtl",h=io(c).split("-")[1],v="",w="",y="",$="";if(h==="start"){let k=typeof u=="number"?`calc(${je}px - ${d.offsetWidth/2}px)`:"";v=typeof b=="number"?`calc(${je}px - ${d.offsetWidth/2}px)`:"",w=f?k:"",$=f?"":k}else if(h==="end"){let k=typeof u=="number"?`calc(${je}px - ${d.offsetWidth/2}px)`:"";w=f?"":k,$=f?k:"",y=typeof b=="number"?`calc(${je}px - ${d.offsetWidth/2}px)`:""}else $=typeof u=="number"?`${u}px`:"",v=typeof b=="number"?`${b}px`:"";Object.assign(d.style,{top:v,right:w,bottom:y,left:$}),Lr(d,Or(c),c)}}),e}var re="font-bold focusable justify-center transition-colors ease-in-out",E={primary:"s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",secondary:"s-text-link s-border s-bg hover:s-bg-hover hover:s-border-hover active:s-bg-active",utility:"s-text s-bg hover:s-bg-hover active:s-bg-active s-border hover:s-border-hover active:s-border-active",destructive:"s-bg-negative s-text-inverted hover:s-bg-negative-hover active:s-bg-negative-active",pill:"s-icon hover:s-icon-hover active:s-icon-active bg-transparent hover:bg-[--w-color-button-pill-background-hover] active:bg-[--w-color-button-pill-background-active]",disabled:"s-text-inverted s-bg-disabled",quiet:"bg-transparent s-text-link hover:s-bg-hover active:s-bg-active",utilityQuiet:"s-text bg-transparent hover:s-bg-hover active:s-bg-active",negativeQuiet:"bg-transparent s-text-negative hover:s-bg-negative-subtle-hover active:s-bg-negative-subtle-active",loading:"s-text s-bg-subtle",link:"s-text-link"},x={primary:`border-0 rounded-8 ${re}`,secondary:`border-2 rounded-8 ${re}`,utility:`border rounded-4 ${re}`,negative:`border-0 rounded-8 ${re}`,pill:`p-4 rounded-full border-0 inline-flex items-center justify-center hover:bg-clip-padding ${re}`,link:`bg-transparent focusable ease-in-out inline active:underline hover:underline focus:underline ${E.link}`},g={xsmall:"py-6 px-16",small:"py-8 px-16",medium:"py-10 px-14",large:"py-12 px-16",utility:"py-[11px] px-[15px]",smallUtility:"py-[7px] px-[15px]",pill:"min-h-[44px] min-w-[44px]",pillSmall:"min-h-32 min-w-32",link:"p-0"},m={medium:"text-m leading-[24]",xsmall:"text-xs"},p={inProgress:`border-transparent animate-inprogress pointer-events-none ${E.loading}`,quiet:`border-0 rounded-8 ${re}`,utilityQuiet:`border-0 rounded-4 ${re}`,negativeQuiet:`border-0 rounded-8 ${re}`,isDisabled:`font-bold justify-center transition-colors ease-in-out cursor-default pointer-events-none ${E.disabled}`},$n={secondary:`${g.medium} ${m.medium} ${x.secondary} ${E.secondary}`,secondaryHref:`${g.medium} ${m.medium} ${x.secondary} ${E.secondary}`,secondaryDisabled:`${g.medium} ${m.medium} ${x.secondary} ${p.isDisabled}`,secondarySmall:`${m.xsmall} ${g.xsmall} ${x.secondary} ${E.secondary}`,secondarySmallDisabled:`${m.xsmall} ${g.xsmall} ${x.secondary} ${p.isDisabled}`,secondaryQuiet:`${g.medium} ${m.medium} ${p.quiet} ${E.quiet}`,secondaryQuietDisabled:`${g.medium} ${m.medium} ${p.quiet} ${p.isDisabled}`,secondarySmallQuiet:`${m.xsmall} ${g.xsmall} ${p.quiet} ${E.quiet}`,secondarySmallQuietDisabled:`${m.xsmall} ${g.xsmall} ${p.quiet} ${p.isDisabled}`,secondaryLoading:`${g.medium} ${m.medium} ${x.secondary} ${p.inProgress}`,secondarySmallLoading:`${m.xsmall} ${g.xsmall} ${x.secondary} ${p.inProgress}`,secondarySmallQuietLoading:`${m.xsmall} ${g.xsmall} ${p.quiet} ${p.inProgress}`,secondaryQuietLoading:`${g.medium} ${m.medium} ${p.quiet} ${p.inProgress}`,primary:`${g.large} ${m.medium} ${x.primary} ${E.primary}`,primaryDisabled:`${g.large} ${m.medium} ${p.isDisabled} ${x.primary}`,primarySmall:`${g.small} ${m.xsmall} ${x.primary} ${E.primary}`,primarySmallDisabled:`${g.small} ${m.xsmall} ${p.isDisabled} ${x.primary} `,primaryQuiet:`${g.large} ${m.medium} ${p.quiet} ${E.quiet}`,primaryQuietDisabled:`${g.large} ${m.medium} ${p.quiet} ${p.isDisabled}`,primarySmallQuiet:`${g.small} ${m.xsmall} ${p.quiet} ${E.quiet}`,primarySmallQuietDisabled:`${g.small} ${m.xsmall} ${p.quiet} ${p.isDisabled}`,primaryLoading:`${g.large} ${m.medium} ${p.inProgress} ${x.primary}`,primarySmallLoading:`${g.small} ${m.xsmall} ${p.inProgress} ${x.primary}`,primarySmallQuietLoading:`${g.small} ${m.xsmall} ${p.quiet} ${p.inProgress} ${x.primary}`,primaryQuietLoading:`${g.large} ${m.medium} ${p.quiet} ${p.inProgress}`,utility:`${g.utility} ${m.medium} ${x.utility} ${E.utility}`,utilityDisabled:`${g.utility} ${m.medium} ${x.utility} ${p.isDisabled}`,utilityQuiet:`${g.large} ${m.medium} ${p.utilityQuiet} ${E.utilityQuiet}`,utilityQuietDisabled:`${g.large} ${m.medium} ${p.utilityQuiet} ${p.isDisabled}`,utilitySmall:`${g.smallUtility} ${m.xsmall} ${x.utility} ${E.utility}`,utilitySmallDisabled:`${g.smallUtility} ${m.xsmall} ${x.utility} ${p.isDisabled}`,utilitySmallQuiet:`${g.smallUtility} ${m.xsmall} ${p.utilityQuiet} ${E.utilityQuiet}`,utilitySmallQuietDisabled:`${g.smallUtility} ${m.xsmall} ${p.utilityQuiet} ${p.isDisabled}`,utilityLoading:`${g.large} ${m.medium} ${x.utility} ${p.inProgress}`,utilitySmallLoading:`${g.smallUtility} ${m.xsmall} ${x.utility} ${p.inProgress}`,utilityQuietLoading:`${g.large} ${m.medium} ${p.inProgress} ${p.utilityQuiet}`,utilitySmallQuietLoading:`${g.smallUtility} ${m.xsmall} ${p.inProgress} ${p.utilityQuiet}`,negative:`${g.large} ${m.medium} ${x.negative} ${E.destructive}`,negativeDisabled:`${g.large} ${m.medium} ${x.negative} ${p.isDisabled}`,negativeQuiet:`${g.large} ${m.medium} ${p.negativeQuiet} ${E.negativeQuiet}`,negativeQuietDisabled:`${g.large} ${m.medium} ${p.negativeQuiet}${p.isDisabled}`,negativeSmall:`${g.small} ${m.xsmall} ${x.negative} ${E.destructive}`,negativeSmallDisabled:`${g.small} ${m.xsmall} ${x.negative} ${p.isDisabled}`,negativeSmallQuiet:`${g.small} ${m.xsmall} ${p.negativeQuiet} ${E.negativeQuiet}`,negativeSmallQuietDisabled:`${g.small} ${m.xsmall} ${p.negativeQuiet} ${p.isDisabled}`,negativeLoading:`${g.large} ${m.medium} ${x.negative} ${p.inProgress}`,negativeSmallLoading:`${g.small} ${m.xsmall} ${p.inProgress} ${x.negative}`,negativeQuietLoading:`${g.large} ${m.medium} ${p.negativeQuiet} ${x.negative} ${p.inProgress}`,negativeSmallQuietLoading:`${g.small} ${m.xsmall} ${p.negativeQuiet} ${p.inProgress}`,pill:`${g.pill} ${m.medium} ${x.pill} ${E.pill}`,pillSmall:`${g.pillSmall} ${m.xsmall} ${x.pill} ${E.pill}`,pillLoading:`${g.pill} ${m.medium} ${x.pill} ${p.inProgress}`,pillSmallLoading:`${g.pillSmall} ${m.xsmall} ${x.pill} ${p.inProgress}`,link:`${g.link} ${m.medium} ${x.link}`,linkSmall:`${g.link} ${m.xsmall} ${x.link}`,linkAsButton:"inline-block active:no-underline hover:no-underline focus:no-underline text-center",a11y:"sr-only",fullWidth:"w-full max-w-full",contentWidth:"max-w-max"};var kn={backdrop:"fixed inset-0 flex sm:place-content-center sm:place-items-center items-end z-30 [--w-modal-max-height:80%] [--w-modal-width:640px] bg-[--w-black/25]",base:"pb-safe-[32] shadow-m max-h-[--w-modal-max-height] min-h-[--w-modal-min-height] w-[--w-modal-width] h-[--w-modal-height] relative transition-300 ease-in-out backface-hidden will-change-height rounded-8 mx-0 sm:mx-16 bg-[--w-s-color-surface-elevated-100] flex flex-col overflow-hidden outline-none space-y-16 pt-8 sm:pt-32 sm:pb-32 rounded-b-0 sm:rounded-b-8",content:"block overflow-y-auto overflow-x-hidden last-child:mb-0 grow shrink px-16 sm:px-32 relative",footer:"flex justify-end shrink-0 px-16 sm:px-32",transitionTitle:"transition-all duration-300",transitionTitleCenter:"justify-self-center self-center",transitionTitleColSpan:"col-span-2",title:"py-8 sm:py-0 -mt-4 sm:-mt-8 min-h-40 sm:min-h-48 grid gap-8 sm:gap-16 grid-cols-[auto_1fr_auto] items-start px-16 sm:px-32 border-b sm:border-b-0 shrink-0",titleText:"mb-0 h4 sm:h3",titleButton:`${m.medium} ${x.pill} ${E.pill} sm:min-h-[44px] sm:min-w-[44px] min-h-[32px] min-w-[32px]`,titleButtonLeft:"-ml-8 sm:-ml-12 justify-self-start",titleButtonRight:"-mr-8 sm:-mr-12 justify-self-end",titleButtonIcon:"h-16 w-16 sm:h-24 sm:w-24",titleButtonIconRotated:"transform rotate-90"};var so="absolute top-0 bottom-0 flex justify-center items-center focusable rounded-4 focus:[--w-outline-offset:-2px] bg-transparent ",En={wrapper:so+"right-0",wrapperWithLabel:"w-max pr-12",wrapperWithIcon:"w-40",label:"antialiased block relative cursor-default pb-0 font-bold text-xs s-text"},_n={wrapper:so+"left-0",wrapperWithLabel:"w-max pl-12",wrapperWithIcon:"w-40",label:"antialiased block relative cursor-default pb-0 font-bold text-xs s-text"};var oe={field:"relative text-m",wrapper:"relative py-1",wrapperRadioButtons:"inline-flex font-bold rounded-8 focus-within:focusable",wrapperRadioButtonsJustified:"flex font-bold rounded-8 focus-within:focusable",radioButtonsGroup:"group",radioButtonsGroupJustified:"grow-1 shrink-0 basis-auto",input:"peer",a11y:"sr-only",label:"peer-focus:focusable cursor-pointer text-m s-text s-border py-2 pl-28 select-none relative block before:border before:absolute before:transition-all before:left-0 before:w-20 before:h-20 before:top-2",labelBefore:'before:content-[""] before:block',checkbox:"before:s-bg before:rounded-2 hover:before:s-border-primary hover:before:s-bg-hover peer-checked:before:bg-center peer-checked:before:bg-[url(var(--w-icon-toggle-checked))] peer-checked:before:s-border-primary peer-checked:before:s-bg-primary peer-checked:peer-hover:before:s-border-primary-hover peer-checked:peer-hover:before:s-bg-primary-hover",checkboxInvalid:"before:s-bg before:s-border-negative before:rounded-2 hover:before:s-bg-negative-subtle-hover hover:before:s-border-negative-hover peer-checked:before:bg-center peer-checked:before:bg-[url(var(--w-icon-toggle-checked))] peer-checked:before:s-bg-negative peer-checked:before:s-border-negative peer-checked:peer-hover:before:s-bg-negative-hover peer-checked:peer-hover:before:s-border-negative-hover",checkboxDisabled:"before:s-bg-disabled-subtle before:s-border-disabled pointer-events-none before:rounded-2 peer-checked:before:bg-center peer-checked:before:bg-[url(var(--w-icon-toggle-checked))] peer-checked:before:s-border-disabled peer-checked:before:s-bg-disabled",indeterminate:'before:content-["\u2013"] before:rounded-2 before:leading-xs before:text-center before:font-bold before:s-icon-inverted peer-indeterminate:before:s-border-primary peer-indeterminate:before:s-bg-primary peer-indeterminate:hover:before:s-border-primary-hover peer-indeterminate:hover:before:s-bg-primary-hover',indeterminateInvalid:'before:content-["\u2013"] before:rounded-2 before:leading-xs before:text-center before:font-bold before:s-icon-inverted peer-indeterminate:before:s-border-negative peer-indeterminate:before:s-bg-negative peer-indeterminate:hover:before:s-border-negative-hover peer-indeterminate:hover:before:s-bg-negative-hover',indeterminateDisabled:'before:content-["\u2013"] before:rounded-2 before:leading-xs before:text-center before:font-bold pointer-events-none before:s-icon-inverted peer-indeterminate:before:s-border-disabled peer-indeterminate:before:s-bg-disabled',radio:"before:s-bg before:rounded-full peer-checked:before:border-[6] peer-checked:before:s-border-selected peer-checked:peer-hover:before:s-border-selected-hover peer-hover:before:s-border-primary peer-hover:before:s-bg-hover",radioInvalid:"before:s-bg before:s-border-negative before:rounded-full peer-checked:before:border-[6] peer-hover:before:s-bg-negative-subtle peer-hover:before:s-border-negative-hover peer-checked:before:s-border-negative peer-checked:peer-hover:before:s-border-negative-hover",radioDisabled:"before:s-bg-disabled-subtle before:s-border-disabled pointer-events-none before:rounded-full peer-checked:before:border-[6]",radioButtonsLabel:"peer-hover:peer-not-checked:s-bg-hover peer-checked:s-text-inverted peer-checked:s-bg-primary peer-checked:s-border-primary block relative font-bold cursor-pointer s-text-link text-center s-bg border-2 s-border group-first-of-type:rounded-tl-8 group-first-of-type:rounded-bl-8 group-last-of-type:rounded-tr-8 group-last-of-type:rounded-br-8 group-not-last-of-type:border-r-0 peer-checked:z-10 group-not-first:-ml-2",radioButtonsRegular:"text-s py-8 pl-12 pr-14",radioButtonsSmall:"text-xs py-[5px] px-[8px]"},Sn={wrapper:`${oe.wrapper} h-20 w-20 pointer-events-none`,input:`${oe.input} hidden`,inputVue:"hidden",labelVue:"-mt-2",labelRadio:`${oe.label} ${oe.labelBefore} ${oe.radio}`,labelCheckbox:`${oe.label} ${oe.labelBefore} ${oe.checkbox}`};var fe={base:"border-2 relative flex items-start",tooltip:"s-bg-inverted border-[--w-s-color-background-inverted] shadow-m s-text-inverted-static rounded-4 py-6 px-8",callout:"bg-[--w-color-callout-background] border-[--w-color-callout-border] s-text py-8 px-16 rounded-8",highlight:"bg-[--w-color-callout-background] border-[--w-color-callout-border] s-text py-8 px-16 rounded-8 drop-shadow-m translate-z-0",popover:"bg-[--w-s-color-surface-elevated-300] border-[--w-s-color-surface-elevated-300] s-text rounded-8 p-16 drop-shadow-m translate-z-0",arrowBase:"absolute h-[14px] w-[14px] border-2 border-b-0 border-r-0 rounded-tl-4 transform",arrowDirectionLeftStart:"-left-[8px]",arrowDirectionLeft:"-left-[8px]",arrowDirectionLeftEnd:"-left-[8px]",arrowDirectionRightStart:"-right-[8px]",arrowDirectionRight:"-right-[8px]",arrowDirectionRightEnd:"-right-[8px]",arrowDirectionBottomStart:"-bottom-[8px]",arrowDirectionBottom:"-bottom-[8px]",arrowDirectionBottomEnd:"-bottom-[8px]",arrowDirectionTopStart:"-top-[8px]",arrowDirectionTop:"-top-[8px]",arrowDirectionTopEnd:"-top-[8px]",arrowTooltip:"s-bg-inverted border-[--w-s-color-background-inverted]",arrowCallout:"bg-[--w-color-callout-background] border-[--w-color-callout-border]",arrowPopover:"bg-[--w-s-color-surface-elevated-300] border-[--w-s-color-surface-elevated-300]",arrowHighlight:"bg-[--w-color-callout-background] border-[--w-color-callout-border]",content:"last-child:mb-0",notCallout:"absolute z-50",closeBtn:`${m.medium} ${x.pill} ${E.pill} justify-self-end -mr-8 ml-8`};import $o from"@warp-ds/elements-core";import{ifDefined as Kr}from"lit/directives/if-defined.js";var Tr=["en","nb","fi","da","sv"],lo="en",ao=e=>Tr.find(t=>e===t||e.toLowerCase().includes(t))||lo;function Rr(){if(typeof window=="undefined"){let e=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return ao(e)}try{let e=document.documentElement.lang;return ao(e)}catch(e){return console.warn("could not detect locale, falling back to source locale",e),lo}}var Pr=(e,t,o,r,n,s)=>e==="nb"?o:e==="fi"?r:e==="da"?n:e==="sv"?s:t,co=(e,t,o,r,n)=>{let s=Rr(),i=Pr(s,e,t,o,r,n);S.load(s,i),S.activate(s)};import{classMap as Tn}from"lit/directives/class-map.js";var Mr=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function uo(e){return class extends e{static createProperty(t,o){let r=o;(typeof(o==null?void 0:o.attribute)=="undefined"||(o==null?void 0:o.attribute)===!0)&&(r=Object.assign({},o,{attribute:Mr(t.toString())})),super.createProperty(t,r)}}}function fo(){return`m${Math.random().toString(36).slice(2)}`}var po=JSON.parse('{"attention.aria.callout":["En gr\xF8n taleboble der introducerer noget nyt"],"attention.aria.close":["Luk"],"attention.aria.highlight":["En opm\xE6rksomhedsskabende taleboble med vigtig information"],"attention.aria.pointingDown":["peger nedad"],"attention.aria.pointingLeft":["peger til venstre"],"attention.aria.pointingRight":["peger til h\xF8jre"],"attention.aria.pointingUp":["peger opad"],"attention.aria.popover":["En hvid taleboble med mere information"],"attention.aria.tooltip":["En sort taleboble med flere oplysninger"]}');var mo=JSON.parse('{"attention.aria.callout":["A green speech bubble introducing something new"],"attention.aria.close":["Close"],"attention.aria.highlight":["An attention speech bubble with important information"],"attention.aria.pointingDown":["pointing down"],"attention.aria.pointingLeft":["pointing left"],"attention.aria.pointingRight":["pointing right"],"attention.aria.pointingUp":["pointing up"],"attention.aria.popover":["A white speech bubble providing additional information"],"attention.aria.tooltip":["A black speech bubble providing complementary information"]}');var go=JSON.parse('{"attention.aria.callout":["Vihre\xE4 puhekupla, joka esittelee jotain uutta"],"attention.aria.close":["Sulje"],"attention.aria.highlight":["Puhekupla, joka sis\xE4lt\xE4\xE4 t\xE4rke\xE4\xE4 tietoa"],"attention.aria.pointingDown":["osoittaa alas"],"attention.aria.pointingLeft":["osoittaa vasemmalle"],"attention.aria.pointingRight":["osoittaa oikealle"],"attention.aria.pointingUp":["osoittaa yl\xF6s"],"attention.aria.popover":["Valkoinen puhekupla, joka tarjoaa lis\xE4tietoa"],"attention.aria.tooltip":["Musta puhekupla, joka tarjoaa t\xE4ydent\xE4v\xE4\xE4 tietoa"]}');var bo=JSON.parse('{"attention.aria.callout":["Gr\xF8nn taleboble som introduserer noe nytt"],"attention.aria.close":["Lukk"],"attention.aria.highlight":["En uthevet taleboble med viktig informasjon"],"attention.aria.pointingDown":["peker ned"],"attention.aria.pointingLeft":["peker til venstre"],"attention.aria.pointingRight":["peker til h\xF8yre"],"attention.aria.pointingUp":["peker opp"],"attention.aria.popover":["En hvit taleboble som gir tilleggsinformasjon"],"attention.aria.tooltip":["En svart taleboble som forklarer konteksten"]}');var ho=JSON.parse('{"attention.aria.callout":["En gr\xF6n pratbubbla som introducerar n\xE5got nytt"],"attention.aria.close":["St\xE4ng"],"attention.aria.highlight":["En pratbubbla med viktig information"],"attention.aria.pointingDown":["pekar ned"],"attention.aria.pointingLeft":["pekar v\xE4nster"],"attention.aria.pointingRight":["pekar h\xF6ger"],"attention.aria.pointingUp":["pekar upp"],"attention.aria.popover":["En vit pratbubbla som ger ytterligare information"],"attention.aria.tooltip":["En svart pratbubbla som ger kompletterande information"]}');import{LitElement as Br}from"lit";import{unsafeStatic as Nr,html as jr}from"lit/static-html.js";var Ir=JSON.parse('{"icon.title.close":["Kryss"]}'),Fr=JSON.parse('{"icon.title.close":["Cross"]}'),Hr=JSON.parse('{"icon.title.close":["Rasti"]}'),zr=JSON.parse('{"icon.title.close":["Kryds"]}'),Qr=JSON.parse('{"icon.title.close":["Kryss"]}'),vo=["en","nb","fi","da","sv"],wo="en",Ur=()=>{var e;let t;switch((e=process==null?void 0:process.env)==null?void 0:e.NMP_BRAND){case"FINN":t="nb";break;case"TORI":t="fi";break;case"BLOCKET":t="sv";break;case"DBA":t="da";break;default:t="en"}return t},xo=()=>{var e;let t=(e=document==null?void 0:document.location)==null?void 0:e.hostname;return t!=null&&t.includes("finn")?"nb":t.includes("tori")?"fi":t.includes("blocket")?"sv":t.includes("dba")?"da":wo},dt=e=>vo.find(t=>e===t||e.toLowerCase().includes(t))||xo();function Wr(){var e;if(typeof window=="undefined"){let t=Ur();return dt(t)}try{let t=(e=document==null?void 0:document.documentElement)==null?void 0:e.lang,o=xo();return vo.includes(t)?dt(t!=null?t:o):(console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname"),dt(o))}catch(t){return console.warn("could not detect locale, falling back to source locale",t),wo}}var Vr=(e,t,o,r,n,s)=>e==="nb"?o:e==="fi"?r:e==="da"?n:e==="sv"?s:t,qr=(e,t,o,r,n)=>{let s=Wr(),i=Vr(s,e,t,o,r,n);S.load(s,i),S.activate(s)};qr(Fr,Ir,Hr,zr,Qr);var Jr=class extends Br{render(){let e=S.t({message:"Cross",id:"icon.title.close",comment:"Title for close icon"});return jr`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-close-16-part">${Nr(`<title>${e}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m12.5 3.5-9 9m0-9 9 9"></path></svg>`}};customElements.get("w-icon-close-16")||customElements.define("w-icon-close-16",Jr);var Ee=class extends uo($o){constructor(){super(),co(mo,bo,go,po,ho),this.handleDone=this.handleDone.bind(this),this.show=!1,this.placement="bottom",this.tooltip=!1,this.callout=!1,this.popover=!1,this.highlight=!1,this.canClose=!1,this.noArrow=!1,this.distance=8,this.skidding=0,this.flip=!1,this.crossAxis=!1,this._initialPlacement=this.placement,this._actualDirection=this.placement}connectedCallback(){if(super.connectedCallback(),this.placement&&!Object.keys(ue).includes(this.placement))throw new Error(`Invalid "placement" attribute. Set its value to one of the following:
|
|
11
|
+
${JSON.stringify(Object.keys(ue))}`);if(this.fallbackPlacements&&!this.fallbackPlacements.every(t=>at.includes(t)))throw new Error(`Invalid "fallbackPlacements" attribute. Set its value to an array with one or more of the following:
|
|
12
|
+
${JSON.stringify(at)}`);setTimeout(()=>{this.requestUpdate(),this.handleDone()},0),this.callout||(window.addEventListener("click",this.handleDone),window.addEventListener("scroll",this.handleDone),window.addEventListener("resize",this.handleDone),window.addEventListener("touch",this.handleDone)),this.tooltip&&(window.addEventListener("mouseover",this.handleDone),window.addEventListener("mouseout",this.handleDone))}disconnectedCallback(){window.removeEventListener("click",this.handleDone),window.removeEventListener("scroll",this.handleDone),window.removeEventListener("resize",this.handleDone),window.removeEventListener("touch",this.handleDone),window.removeEventListener("mouseover",this.handleDone),window.removeEventListener("mouseout",this.handleDone),super.disconnectedCallback()}handleDone(){window.requestAnimationFrame(()=>{this.show&&this._targetEl&&this._attentionEl?ct(this.attentionState).then(t=>{this._actualDirection=t==null?void 0:t.actualDirection}):this._actualDirection=this._initialPlacement})}get _actualDirection(){return this.placement}set _actualDirection(t){this.placement=t}get _arrowEl(){return this.renderRoot.querySelector("#arrow")}get _arrowDirection(){return ue[this._actualDirection]}get _arrowClasses(){return _e([fe.arrowBase,this._activeVariantClasses.arrow,fe[`arrowDirection${lt(this._arrowDirection)}`]])}get _arrowHtml(){return this.noArrow?"":he`<div id="arrow" class="${this._arrowClasses}"></div>`}get _activeVariantClasses(){let t={callout:this.callout,popover:this.popover,tooltip:this.tooltip,highlight:this.highlight},o=Object.keys(t).find(r=>!!t[r])||"";return{wrapper:fe[o],arrow:fe[`arrow${o.charAt(0).toUpperCase()+o.slice(1)}`]}}get _attentionEl(){return this.renderRoot.querySelector("#attention")}get _targetEl(){var o;let t=(o=this.renderRoot)==null?void 0:o.querySelector("slot[name='target']");return t?t.assignedNodes()[0]:null}get _messageEl(){let t=this.renderRoot.querySelector("slot[name='message']");return t?t.assignedNodes()[0]:null}get _wrapperClasses(){return _e([fe.base,this._activeVariantClasses.wrapper])}get _ariaClose(){return S._({id:"attention.aria.close",message:"Close",comment:"Aria label for the close button in attention"})}get _closeBtnHtml(){return he`
|
|
13
|
+
<button aria-label="${this._ariaClose}" @click="${this.close}" @keydown=${this.keypressed} class="${fe.closeBtn}">
|
|
3807
14
|
<w-icon-close-16></w-icon-close-16>
|
|
3808
15
|
</button>
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
if (!this.callout) {
|
|
3813
|
-
this._attentionEl.style.setProperty("--attention-visibility", this.show ? "" : "hidden");
|
|
3814
|
-
}
|
|
3815
|
-
if (!this.tooltip) {
|
|
3816
|
-
this._attentionEl.style.setProperty("--attention-display", this.show ? "flex" : "none");
|
|
3817
|
-
}
|
|
3818
|
-
this.attentionState = {
|
|
3819
|
-
isShowing: this.show,
|
|
3820
|
-
isCallout: this.callout,
|
|
3821
|
-
actualDirection: this._actualDirection,
|
|
3822
|
-
directionName: this.placement,
|
|
3823
|
-
arrowEl: this._arrowEl,
|
|
3824
|
-
attentionEl: this._attentionEl,
|
|
3825
|
-
targetEl: this._targetEl,
|
|
3826
|
-
noArrow: this.noArrow,
|
|
3827
|
-
distance: this.distance,
|
|
3828
|
-
skidding: this.skidding,
|
|
3829
|
-
flip: this.flip,
|
|
3830
|
-
crossAxis: this.crossAxis,
|
|
3831
|
-
fallbackPlacements: this.fallbackPlacements
|
|
3832
|
-
};
|
|
3833
|
-
useRecompute(this.attentionState);
|
|
3834
|
-
}
|
|
3835
|
-
pointingAtDirection() {
|
|
3836
|
-
switch (opposites[this._actualDirection]) {
|
|
3837
|
-
case "top-start":
|
|
3838
|
-
case "top":
|
|
3839
|
-
case "top-end":
|
|
3840
|
-
return i18n._({
|
|
3841
|
-
id: "attention.aria.pointingUp",
|
|
3842
|
-
message: "pointing up",
|
|
3843
|
-
comment: "Default screenreader message for top direction in the attention component"
|
|
3844
|
-
});
|
|
3845
|
-
case "right-start":
|
|
3846
|
-
case "right":
|
|
3847
|
-
case "right-end":
|
|
3848
|
-
return i18n._({
|
|
3849
|
-
id: "attention.aria.pointingRight",
|
|
3850
|
-
message: "pointing right",
|
|
3851
|
-
comment: "Default screenreader message for right direction in the attention component"
|
|
3852
|
-
});
|
|
3853
|
-
case "bottom-start":
|
|
3854
|
-
case "bottom":
|
|
3855
|
-
case "bottom-end":
|
|
3856
|
-
return i18n._({
|
|
3857
|
-
id: "attention.aria.pointingDown",
|
|
3858
|
-
message: "pointing down",
|
|
3859
|
-
comment: "Default screenreader message for bottom direction in the attention component"
|
|
3860
|
-
});
|
|
3861
|
-
case "left-start":
|
|
3862
|
-
case "left":
|
|
3863
|
-
case "left-end":
|
|
3864
|
-
return i18n._({
|
|
3865
|
-
id: "attention.aria.pointingLeft",
|
|
3866
|
-
message: "pointing left",
|
|
3867
|
-
comment: "Default screenreader message for left direction in the attention component"
|
|
3868
|
-
});
|
|
3869
|
-
default:
|
|
3870
|
-
return "";
|
|
3871
|
-
}
|
|
3872
|
-
}
|
|
3873
|
-
activeAttentionType() {
|
|
3874
|
-
switch (true) {
|
|
3875
|
-
case this.tooltip:
|
|
3876
|
-
return i18n._({
|
|
3877
|
-
id: "attention.aria.tooltip",
|
|
3878
|
-
message: "tooltip",
|
|
3879
|
-
comment: "Default screenreader message for tooltip in the attention component"
|
|
3880
|
-
});
|
|
3881
|
-
case this.callout:
|
|
3882
|
-
return i18n._({
|
|
3883
|
-
id: "attention.aria.callout",
|
|
3884
|
-
message: "callout speech bubble",
|
|
3885
|
-
comment: "Default screenreader message for callout speech bubble in the attention component"
|
|
3886
|
-
});
|
|
3887
|
-
case this.popover:
|
|
3888
|
-
return i18n._({
|
|
3889
|
-
id: "attention.aria.popover",
|
|
3890
|
-
message: "popover speech bubble",
|
|
3891
|
-
comment: "Default screenreader message for popover speech bubble in the attention component"
|
|
3892
|
-
});
|
|
3893
|
-
case this.highlight:
|
|
3894
|
-
return i18n._({
|
|
3895
|
-
id: "attention.aria.highlight",
|
|
3896
|
-
message: "highlighted speech bubble",
|
|
3897
|
-
comment: "Default screenreader message for highlighted speech bubble in the attention component"
|
|
3898
|
-
});
|
|
3899
|
-
default:
|
|
3900
|
-
return "";
|
|
3901
|
-
}
|
|
3902
|
-
}
|
|
3903
|
-
defaultAriaLabel() {
|
|
3904
|
-
return `${this.activeAttentionType()} ${!this.noArrow ? this.pointingAtDirection() : ""}`;
|
|
3905
|
-
}
|
|
3906
|
-
setAriaLabels() {
|
|
3907
|
-
if (this._targetEl && !this._targetEl.getAttribute("aria-details")) {
|
|
3908
|
-
const attentionMessageId = this._messageEl.id || (this._messageEl.id = generateRandomId());
|
|
3909
|
-
this._targetEl.setAttribute("aria-details", attentionMessageId);
|
|
3910
|
-
}
|
|
3911
|
-
}
|
|
3912
|
-
firstUpdated() {
|
|
3913
|
-
this._initialPlacement = this.placement;
|
|
3914
|
-
this.setAriaLabels();
|
|
3915
|
-
if (this.callout) {
|
|
3916
|
-
this._attentionEl.style.position = "relative";
|
|
3917
|
-
}
|
|
3918
|
-
}
|
|
3919
|
-
close() {
|
|
3920
|
-
const event = new CustomEvent("close", {
|
|
3921
|
-
bubbles: true,
|
|
3922
|
-
composed: true
|
|
3923
|
-
});
|
|
3924
|
-
this.updateComplete.then(() => this.dispatchEvent(event));
|
|
3925
|
-
}
|
|
3926
|
-
keypressed(e) {
|
|
3927
|
-
if (!this.canClose) return;
|
|
3928
|
-
if (e.key === "Escape") {
|
|
3929
|
-
e.preventDefault();
|
|
3930
|
-
this.close();
|
|
3931
|
-
}
|
|
3932
|
-
}
|
|
3933
|
-
render() {
|
|
3934
|
-
if (!this.callout && this._targetEl === void 0) return html2``;
|
|
3935
|
-
return html2`
|
|
3936
|
-
<div class=${ifDefined(this.className ? this.className : void 0)}>
|
|
3937
|
-
${this.placement === "right-start" || this.placement === "right" || this.placement === "right-end" || this.placement === "bottom-start" || this.placement === "bottom" || this.placement === "bottom-end" ? html2`
|
|
16
|
+
`}updated(){this.callout||this._attentionEl.style.setProperty("--attention-visibility",this.show?"":"hidden"),this.tooltip||this._attentionEl.style.setProperty("--attention-display",this.show?"flex":"none"),this.attentionState={isShowing:this.show,isCallout:this.callout,actualDirection:this._actualDirection,directionName:this.placement,arrowEl:this._arrowEl,attentionEl:this._attentionEl,targetEl:this._targetEl,noArrow:this.noArrow,distance:this.distance,skidding:this.skidding,flip:this.flip,crossAxis:this.crossAxis,fallbackPlacements:this.fallbackPlacements},ct(this.attentionState)}pointingAtDirection(){switch(ue[this._actualDirection]){case"top-start":case"top":case"top-end":return S._({id:"attention.aria.pointingUp",message:"pointing up",comment:"Default screenreader message for top direction in the attention component"});case"right-start":case"right":case"right-end":return S._({id:"attention.aria.pointingRight",message:"pointing right",comment:"Default screenreader message for right direction in the attention component"});case"bottom-start":case"bottom":case"bottom-end":return S._({id:"attention.aria.pointingDown",message:"pointing down",comment:"Default screenreader message for bottom direction in the attention component"});case"left-start":case"left":case"left-end":return S._({id:"attention.aria.pointingLeft",message:"pointing left",comment:"Default screenreader message for left direction in the attention component"});default:return""}}activeAttentionType(){switch(!0){case this.tooltip:return S._({id:"attention.aria.tooltip",message:"tooltip",comment:"Default screenreader message for tooltip in the attention component"});case this.callout:return S._({id:"attention.aria.callout",message:"callout speech bubble",comment:"Default screenreader message for callout speech bubble in the attention component"});case this.popover:return S._({id:"attention.aria.popover",message:"popover speech bubble",comment:"Default screenreader message for popover speech bubble in the attention component"});case this.highlight:return S._({id:"attention.aria.highlight",message:"highlighted speech bubble",comment:"Default screenreader message for highlighted speech bubble in the attention component"});default:return""}}defaultAriaLabel(){return`${this.activeAttentionType()} ${this.noArrow?"":this.pointingAtDirection()}`}setAriaLabels(){if(this._targetEl&&!this._targetEl.getAttribute("aria-details")){let t=this._messageEl.id||(this._messageEl.id=fo());this._targetEl.setAttribute("aria-details",t)}}firstUpdated(){this._initialPlacement=this.placement,this.setAriaLabels(),this.callout&&(this._attentionEl.style.position="relative")}close(){let t=new CustomEvent("close",{bubbles:!0,composed:!0});this.updateComplete.then(()=>this.dispatchEvent(t))}keypressed(t){this.canClose&&t.key==="Escape"&&(t.preventDefault(),this.close())}render(){return!this.callout&&this._targetEl===void 0?he``:he`
|
|
17
|
+
<div class=${Kr(this.className?this.className:void 0)}>
|
|
18
|
+
${this.placement==="right-start"||this.placement==="right"||this.placement==="right-end"||this.placement==="bottom-start"||this.placement==="bottom"||this.placement==="bottom-end"?he`
|
|
3938
19
|
<slot name="target"></slot>
|
|
3939
20
|
|
|
3940
21
|
<div id="attention" class="${this._wrapperClasses}">
|
|
3941
|
-
<div role="${this.tooltip
|
|
22
|
+
<div role="${this.tooltip?"tooltip":"img"}" aria-label="${this.defaultAriaLabel()}">${this._arrowHtml}</div>
|
|
3942
23
|
<slot name="message"></slot>
|
|
3943
|
-
${this.canClose
|
|
24
|
+
${this.canClose?this._closeBtnHtml:yo}
|
|
3944
25
|
</div>
|
|
3945
|
-
`
|
|
26
|
+
`:he`
|
|
3946
27
|
<div id="attention" class="${this._wrapperClasses}">
|
|
3947
28
|
<slot name="message"></slot>
|
|
3948
|
-
<div role="${this.tooltip
|
|
3949
|
-
${this.canClose
|
|
29
|
+
<div role="${this.tooltip?"tooltip":"img"}" aria-label="${this.defaultAriaLabel()}">${this._arrowHtml}</div>
|
|
30
|
+
${this.canClose?this._closeBtnHtml:yo}
|
|
3950
31
|
</div>
|
|
3951
32
|
<slot name="target"></slot>
|
|
3952
33
|
`}
|
|
3953
34
|
</div>
|
|
3954
|
-
|
|
3955
|
-
}
|
|
3956
|
-
};
|
|
3957
|
-
__publicField(WarpAttention, "properties", {
|
|
3958
|
-
// Whether Attention element should be visible.
|
|
3959
|
-
show: { type: Boolean, reflect: true },
|
|
3960
|
-
// Placement according to the target element
|
|
3961
|
-
// Arrow would be on the opposite side of this position
|
|
3962
|
-
placement: { type: String, reflect: true },
|
|
3963
|
-
// Whether Attention element is rendered as a tooltip
|
|
3964
|
-
tooltip: { type: Boolean, reflect: true },
|
|
3965
|
-
// Whether Attention element is rendered as an inline callout
|
|
3966
|
-
callout: { type: Boolean, reflect: true },
|
|
3967
|
-
// Whether Attention element is rendered as a popover
|
|
3968
|
-
popover: { type: Boolean, reflect: true },
|
|
3969
|
-
// Whether Attention element is rendered as a highlight
|
|
3970
|
-
highlight: { type: Boolean, reflect: true },
|
|
3971
|
-
// Render Attention element with a close button
|
|
3972
|
-
canClose: { type: Boolean, reflect: true },
|
|
3973
|
-
// Render Attention element without an arrow
|
|
3974
|
-
noArrow: { type: Boolean, reflect: true },
|
|
3975
|
-
// Distance from which to offset the attentionEl from the targetEl vertically
|
|
3976
|
-
distance: { type: Number, reflect: true },
|
|
3977
|
-
// Distance from which to offset the attentionEl along its targetEl horizontally
|
|
3978
|
-
skidding: { type: Number, reflect: true },
|
|
3979
|
-
// Whether Attention element should flip its placement in order to keep it in view
|
|
3980
|
-
flip: { type: Boolean, reflect: true },
|
|
3981
|
-
// Whether Attention element should ignore cross axis overflow when flip is enabled
|
|
3982
|
-
crossAxis: { type: Boolean, reflect: true },
|
|
3983
|
-
// Choose which preferred placements the Attention element should flip to
|
|
3984
|
-
fallbackPlacements: { type: Array, reflect: true }
|
|
3985
|
-
});
|
|
3986
|
-
__publicField(WarpAttention, "styles", [
|
|
3987
|
-
WarpElement.styles,
|
|
3988
|
-
css`
|
|
35
|
+
`}};Ye(Ee,"properties",{show:{type:Boolean,reflect:!0},placement:{type:String,reflect:!0},tooltip:{type:Boolean,reflect:!0},callout:{type:Boolean,reflect:!0},popover:{type:Boolean,reflect:!0},highlight:{type:Boolean,reflect:!0},canClose:{type:Boolean,reflect:!0},noArrow:{type:Boolean,reflect:!0},distance:{type:Number,reflect:!0},skidding:{type:Number,reflect:!0},flip:{type:Boolean,reflect:!0},crossAxis:{type:Boolean,reflect:!0},fallbackPlacements:{type:Array,reflect:!0}}),Ye(Ee,"styles",[$o.styles,Gr`
|
|
3989
36
|
#attention {
|
|
3990
37
|
position: absolute;
|
|
3991
38
|
z-index: 50;
|
|
@@ -3996,12 +43,5 @@ __publicField(WarpAttention, "styles", [
|
|
|
3996
43
|
:host([popover]:not(:popover-open):not(dialog[open])) {
|
|
3997
44
|
display: contents;
|
|
3998
45
|
}
|
|
3999
|
-
`
|
|
4000
|
-
]);
|
|
4001
|
-
if (!customElements.get("w-attention")) {
|
|
4002
|
-
customElements.define("w-attention", WarpAttention);
|
|
4003
|
-
}
|
|
4004
|
-
export {
|
|
4005
|
-
WarpAttention
|
|
4006
|
-
};
|
|
46
|
+
`]);customElements.get("w-attention")||customElements.define("w-attention",Ee);export{Ee as WarpAttention};
|
|
4007
47
|
//# sourceMappingURL=index.js.map
|