@indexea/widgets
Version:
This is the web components of Indexea, which contains multiple components such as SearchBox, SearchDialog, RecommListBox, etc
4 lines • 515 kB
JavaScript
(function(e,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(e=typeof globalThis<"u"?globalThis:e||self,y(e["@indexea/widgets"]={}))})(this,function(exports){"use strict";var Ce=Object.defineProperty;var Me=(e,y,n)=>y in e?Ce(e,y,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[y]=n;var Re=(e,y,n)=>(Me(e,typeof y!="symbol"?y+"":y,n),n);function noop(){}const identity=e=>e;function assign(e,y){for(const n in y)e[n]=y[n];return e}function is_promise(e){return e&&typeof e=="object"&&typeof e.then=="function"}function run(e){return e()}function blank_object(){return Object.create(null)}function run_all(e){e.forEach(run)}function is_function(e){return typeof e=="function"}function safe_not_equal(e,y){return e!=e?y==y:e!==y||e&&typeof e=="object"||typeof e=="function"}let src_url_equal_anchor;function src_url_equal(e,y){return src_url_equal_anchor||(src_url_equal_anchor=document.createElement("a")),src_url_equal_anchor.href=y,e===src_url_equal_anchor.href}function is_empty(e){return Object.keys(e).length===0}function subscribe(e,...y){if(e==null)return noop;const n=e.subscribe(...y);return n.unsubscribe?()=>n.unsubscribe():n}function component_subscribe(e,y,n){e.$$.on_destroy.push(subscribe(y,n))}function create_slot(e,y,n,S){if(e){const f=get_slot_context(e,y,n,S);return e[0](f)}}function get_slot_context(e,y,n,S){return e[1]&&S?assign(n.ctx.slice(),e[1](S(y))):n.ctx}function get_slot_changes(e,y,n,S){if(e[2]&&S){const f=e[2](S(n));if(y.dirty===void 0)return f;if(typeof f=="object"){const t=[],F=Math.max(y.dirty.length,f.length);for(let N=0;N<F;N+=1)t[N]=y.dirty[N]|f[N];return t}return y.dirty|f}return y.dirty}function update_slot_base(e,y,n,S,f,t){if(f){const F=get_slot_context(y,n,S,t);e.p(F,f)}}function get_all_dirty_from_scope(e){if(e.ctx.length>32){const y=[],n=e.ctx.length/32;for(let S=0;S<n;S++)y[S]=-1;return y}return-1}function exclude_internal_props(e){const y={};for(const n in e)n[0]!=="$"&&(y[n]=e[n]);return y}const is_client=typeof window<"u";let now$2=is_client?()=>window.performance.now():()=>Date.now(),raf=is_client?e=>requestAnimationFrame(e):noop;const tasks=new Set;function run_tasks(e){tasks.forEach(y=>{y.c(e)||(tasks.delete(y),y.f())}),tasks.size!==0&&raf(run_tasks)}function loop(e){let y;return tasks.size===0&&raf(run_tasks),{promise:new Promise(n=>{tasks.add(y={c:e,f:n})}),abort(){tasks.delete(y)}}}function append(e,y){e.appendChild(y)}function append_styles(e,y,n){const S=get_root_for_style(e);if(!S.getElementById(y)){const f=element("style");f.id=y,f.textContent=n,append_stylesheet(S,f)}}function get_root_for_style(e){if(!e)return document;const y=e.getRootNode?e.getRootNode():e.ownerDocument;return y&&y.host?y:e.ownerDocument}function append_empty_stylesheet(e){const y=element("style");return append_stylesheet(get_root_for_style(e),y),y.sheet}function append_stylesheet(e,y){return append(e.head||e,y),y.sheet}function insert(e,y,n){e.insertBefore(y,n||null)}function detach(e){e.parentNode&&e.parentNode.removeChild(e)}function destroy_each(e,y){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(y)}function element(e){return document.createElement(e)}function svg_element(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function text(e){return document.createTextNode(e)}function space(){return text(" ")}function empty(){return text("")}function listen(e,y,n,S){return e.addEventListener(y,n,S),()=>e.removeEventListener(y,n,S)}function prevent_default(e){return function(y){return y.preventDefault(),e.call(this,y)}}function attr(e,y,n){n==null?e.removeAttribute(y):e.getAttribute(y)!==n&&e.setAttribute(y,n)}function children(e){return Array.from(e.childNodes)}function set_data(e,y){y=""+y,e.wholeText!==y&&(e.data=y)}function set_input_value(e,y){e.value=y??""}function toggle_class(e,y,n){e.classList[n?"add":"remove"](y)}function custom_event(e,y,{bubbles:n=!1,cancelable:S=!1}={}){const f=document.createEvent("CustomEvent");return f.initCustomEvent(e,n,S,y),f}class HtmlTag{constructor(y=!1){this.is_svg=!1,this.is_svg=y,this.e=this.n=null}c(y){this.h(y)}m(y,n,S=null){this.e||(this.is_svg?this.e=svg_element(n.nodeName):this.e=element(n.nodeName),this.t=n,this.c(y)),this.i(S)}h(y){this.e.innerHTML=y,this.n=Array.from(this.e.childNodes)}i(y){for(let n=0;n<this.n.length;n+=1)insert(this.t,this.n[n],y)}p(y){this.d(),this.h(y),this.i(this.a)}d(){this.n.forEach(detach)}}const managed_styles=new Map;let active=0;function hash(e){let y=5381,n=e.length;for(;n--;)y=(y<<5)-y^e.charCodeAt(n);return y>>>0}function create_style_information(e,y){const n={stylesheet:append_empty_stylesheet(y),rules:{}};return managed_styles.set(e,n),n}function create_rule(e,y,n,S,f,t,F,N=0){const I=16.666/S;let A=`{
`;for(let se=0;se<=1;se+=I){const le=y+(n-y)*t(se);A+=se*100+`%{${F(le,1-le)}}
`}const P=A+`100% {${F(n,1-n)}}
}`,Y=`__svelte_${hash(P)}_${N}`,ee=get_root_for_style(e),{stylesheet:ne,rules:ae}=managed_styles.get(ee)||create_style_information(ee,e);ae[Y]||(ae[Y]=!0,ne.insertRule(`@keyframes ${Y} ${P}`,ne.cssRules.length));const pe=e.style.animation||"";return e.style.animation=`${pe?`${pe}, `:""}${Y} ${S}ms linear ${f}ms 1 both`,active+=1,Y}function delete_rule(e,y){const n=(e.style.animation||"").split(", "),S=n.filter(y?t=>t.indexOf(y)<0:t=>t.indexOf("__svelte")===-1),f=n.length-S.length;f&&(e.style.animation=S.join(", "),active-=f,active||clear_rules())}function clear_rules(){raf(()=>{active||(managed_styles.forEach(e=>{const{ownerNode:y}=e.stylesheet;y&&detach(y)}),managed_styles.clear())})}let current_component;function set_current_component(e){current_component=e}function get_current_component(){if(!current_component)throw new Error("Function called outside component initialization");return current_component}function onMount(e){get_current_component().$$.on_mount.push(e)}function afterUpdate(e){get_current_component().$$.after_update.push(e)}function onDestroy(e){get_current_component().$$.on_destroy.push(e)}const dirty_components=[],binding_callbacks=[],render_callbacks=[],flush_callbacks=[],resolved_promise=Promise.resolve();let update_scheduled=!1;function schedule_update(){update_scheduled||(update_scheduled=!0,resolved_promise.then(flush))}function add_render_callback(e){render_callbacks.push(e)}function add_flush_callback(e){flush_callbacks.push(e)}const seen_callbacks=new Set;let flushidx=0;function flush(){const e=current_component;do{for(;flushidx<dirty_components.length;){const y=dirty_components[flushidx];flushidx++,set_current_component(y),update(y.$$)}for(set_current_component(null),dirty_components.length=0,flushidx=0;binding_callbacks.length;)binding_callbacks.pop()();for(let y=0;y<render_callbacks.length;y+=1){const n=render_callbacks[y];seen_callbacks.has(n)||(seen_callbacks.add(n),n())}render_callbacks.length=0}while(dirty_components.length);for(;flush_callbacks.length;)flush_callbacks.pop()();update_scheduled=!1,seen_callbacks.clear(),set_current_component(e)}function update(e){if(e.fragment!==null){e.update(),run_all(e.before_update);const y=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,y),e.after_update.forEach(add_render_callback)}}let promise;function wait(){return promise||(promise=Promise.resolve(),promise.then(()=>{promise=null})),promise}function dispatch(e,y,n){e.dispatchEvent(custom_event(`${y?"intro":"outro"}${n}`))}const outroing=new Set;let outros;function group_outros(){outros={r:0,c:[],p:outros}}function check_outros(){outros.r||run_all(outros.c),outros=outros.p}function transition_in(e,y){e&&e.i&&(outroing.delete(e),e.i(y))}function transition_out(e,y,n,S){if(e&&e.o){if(outroing.has(e))return;outroing.add(e),outros.c.push(()=>{outroing.delete(e),S&&(n&&e.d(1),S())}),e.o(y)}else S&&S()}const null_transition={duration:0};function create_in_transition(e,y,n){const S={direction:"in"};let f=y(e,n,S),t=!1,F,N,I=0;function A(){F&&delete_rule(e,F)}function P(){const{delay:ee=0,duration:ne=300,easing:ae=identity,tick:pe=noop,css:se}=f||null_transition;se&&(F=create_rule(e,0,1,ne,ee,ae,se,I++)),pe(0,1);const le=now$2()+ee,me=le+ne;N&&N.abort(),t=!0,add_render_callback(()=>dispatch(e,!0,"start")),N=loop(fe=>{if(t){if(fe>=me)return pe(1,0),dispatch(e,!0,"end"),A(),t=!1;if(fe>=le){const ge=ae((fe-le)/ne);pe(ge,1-ge)}}return t})}let Y=!1;return{start(){Y||(Y=!0,delete_rule(e),is_function(f)?(f=f(S),wait().then(P)):P())},invalidate(){Y=!1},end(){t&&(A(),t=!1)}}}function create_out_transition(e,y,n){const S={direction:"out"};let f=y(e,n,S),t=!0,F;const N=outros;N.r+=1;function I(){const{delay:A=0,duration:P=300,easing:Y=identity,tick:ee=noop,css:ne}=f||null_transition;ne&&(F=create_rule(e,1,0,P,A,Y,ne));const ae=now$2()+A,pe=ae+P;add_render_callback(()=>dispatch(e,!1,"start")),loop(se=>{if(t){if(se>=pe)return ee(0,1),dispatch(e,!1,"end"),--N.r||run_all(N.c),!1;if(se>=ae){const le=Y((se-ae)/P);ee(1-le,le)}}return t})}return is_function(f)?wait().then(()=>{f=f(S),I()}):I(),{end(A){A&&f.tick&&f.tick(1,0),t&&(F&&delete_rule(e,F),t=!1)}}}function create_bidirectional_transition(e,y,n,S){const f={direction:"both"};let t=y(e,n,f),F=S?0:1,N=null,I=null,A=null;function P(){A&&delete_rule(e,A)}function Y(ne,ae){const pe=ne.b-F;return ae*=Math.abs(pe),{a:F,b:ne.b,d:pe,duration:ae,start:ne.start,end:ne.start+ae,group:ne.group}}function ee(ne){const{delay:ae=0,duration:pe=300,easing:se=identity,tick:le=noop,css:me}=t||null_transition,fe={start:now$2()+ae,b:ne};ne||(fe.group=outros,outros.r+=1),N||I?I=fe:(me&&(P(),A=create_rule(e,F,ne,pe,ae,se,me)),ne&&le(0,1),N=Y(fe,pe),add_render_callback(()=>dispatch(e,ne,"start")),loop(ge=>{if(I&&ge>I.start&&(N=Y(I,pe),I=null,dispatch(e,N.b,"start"),me&&(P(),A=create_rule(e,F,N.b,N.duration,0,se,t.css))),N){if(ge>=N.end)le(F=N.b,1-F),dispatch(e,N.b,"end"),I||(N.b?P():--N.group.r||run_all(N.group.c)),N=null;else if(ge>=N.start){const oe=ge-N.start;F=N.a+N.d*se(oe/N.duration),le(F,1-F)}}return!!(N||I)}))}return{run(ne){is_function(t)?wait().then(()=>{t=t(f),ee(ne)}):ee(ne)},end(){P(),N=I=null}}}function handle_promise(e,y){const n=y.token={};function S(f,t,F,N){if(y.token!==n)return;y.resolved=N;let I=y.ctx;F!==void 0&&(I=I.slice(),I[F]=N);const A=f&&(y.current=f)(I);let P=!1;y.block&&(y.blocks?y.blocks.forEach((Y,ee)=>{ee!==t&&Y&&(group_outros(),transition_out(Y,1,1,()=>{y.blocks[ee]===Y&&(y.blocks[ee]=null)}),check_outros())}):y.block.d(1),A.c(),transition_in(A,1),A.m(y.mount(),y.anchor),P=!0),y.block=A,y.blocks&&(y.blocks[t]=A),P&&flush()}if(is_promise(e)){const f=get_current_component();if(e.then(t=>{set_current_component(f),S(y.then,1,y.value,t),set_current_component(null)},t=>{if(set_current_component(f),S(y.catch,2,y.error,t),set_current_component(null),!y.hasCatch)throw t}),y.current!==y.pending)return S(y.pending,0),!0}else{if(y.current!==y.then)return S(y.then,1,y.value,e),!0;y.resolved=e}}function update_await_block_branch(e,y,n){const S=y.slice(),{resolved:f}=e;e.current===e.then&&(S[e.value]=f),e.current===e.catch&&(S[e.error]=f),e.block.p(S,n)}function bind(e,y,n,S){const f=e.$$.props[y];f!==void 0&&(e.$$.bound[f]=n,S===void 0&&n(e.$$.ctx[f]))}function create_component(e){e&&e.c()}function mount_component(e,y,n,S){const{fragment:f,after_update:t}=e.$$;f&&f.m(y,n),S||add_render_callback(()=>{const F=e.$$.on_mount.map(run).filter(is_function);e.$$.on_destroy?e.$$.on_destroy.push(...F):run_all(F),e.$$.on_mount=[]}),t.forEach(add_render_callback)}function destroy_component(e,y){const n=e.$$;n.fragment!==null&&(run_all(n.on_destroy),n.fragment&&n.fragment.d(y),n.on_destroy=n.fragment=null,n.ctx=[])}function make_dirty(e,y){e.$$.dirty[0]===-1&&(dirty_components.push(e),schedule_update(),e.$$.dirty.fill(0)),e.$$.dirty[y/31|0]|=1<<y%31}function init(e,y,n,S,f,t,F,N=[-1]){const I=current_component;set_current_component(e);const A=e.$$={fragment:null,ctx:[],props:t,update:noop,not_equal:f,bound:blank_object(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(y.context||(I?I.$$.context:[])),callbacks:blank_object(),dirty:N,skip_bound:!1,root:y.target||I.$$.root};F&&F(A.root);let P=!1;if(A.ctx=n?n(e,y.props||{},(Y,ee,...ne)=>{const ae=ne.length?ne[0]:ee;return A.ctx&&f(A.ctx[Y],A.ctx[Y]=ae)&&(!A.skip_bound&&A.bound[Y]&&A.bound[Y](ae),P&&make_dirty(e,Y)),ee}):[],A.update(),P=!0,run_all(A.before_update),A.fragment=S?S(A.ctx):!1,y.target){if(y.hydrate){const Y=children(y.target);A.fragment&&A.fragment.l(Y),Y.forEach(detach)}else A.fragment&&A.fragment.c();y.intro&&transition_in(e.$$.fragment),mount_component(e,y.target,y.anchor,y.customElement),flush()}set_current_component(I)}class SvelteComponent{$destroy(){destroy_component(this,1),this.$destroy=noop}$on(y,n){if(!is_function(n))return noop;const S=this.$$.callbacks[y]||(this.$$.callbacks[y]=[]);return S.push(n),()=>{const f=S.indexOf(n);f!==-1&&S.splice(f,1)}}$set(y){this.$$set&&!is_empty(y)&&(this.$$.skip_bound=!0,this.$$set(y),this.$$.skip_bound=!1)}}const subscriber_queue=[];function readable(e,y){return{subscribe:writable(e,y).subscribe}}function writable(e,y=noop){let n;const S=new Set;function f(N){if(safe_not_equal(e,N)&&(e=N,n)){const I=!subscriber_queue.length;for(const A of S)A[1](),subscriber_queue.push(A,e);if(I){for(let A=0;A<subscriber_queue.length;A+=2)subscriber_queue[A][0](subscriber_queue[A+1]);subscriber_queue.length=0}}}function t(N){f(N(e))}function F(N,I=noop){const A=[N,I];return S.add(A),S.size===1&&(n=y(f)||noop),N(e),()=>{S.delete(A),S.size===0&&(n(),n=null)}}return{set:f,update:t,subscribe:F}}function derived(e,y,n){const S=!Array.isArray(e),f=S?[e]:e,t=y.length<2;return readable(n,F=>{let N=!1;const I=[];let A=0,P=noop;const Y=()=>{if(A)return;P();const ne=y(S?I[0]:I,F);t?F(ne):P=is_function(ne)?ne:noop},ee=f.map((ne,ae)=>subscribe(ne,pe=>{I[ae]=pe,A&=~(1<<ae),N&&Y()},()=>{A|=1<<ae}));return N=!0,Y(),function(){run_all(ee),P()}})}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},isMergeableObject=function(y){return isNonNullObject(y)&&!isSpecial(y)};function isNonNullObject(e){return!!e&&typeof e=="object"}function isSpecial(e){var y=Object.prototype.toString.call(e);return y==="[object RegExp]"||y==="[object Date]"||isReactElement(e)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(e){return e.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(e){return Array.isArray(e)?[]:{}}function cloneUnlessOtherwiseSpecified(e,y){return y.clone!==!1&&y.isMergeableObject(e)?deepmerge(emptyTarget(e),e,y):e}function defaultArrayMerge(e,y,n){return e.concat(y).map(function(S){return cloneUnlessOtherwiseSpecified(S,n)})}function getMergeFunction(e,y){if(!y.customMerge)return deepmerge;var n=y.customMerge(e);return typeof n=="function"?n:deepmerge}function getEnumerableOwnPropertySymbols(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(y){return e.propertyIsEnumerable(y)}):[]}function getKeys(e){return Object.keys(e).concat(getEnumerableOwnPropertySymbols(e))}function propertyIsOnObject(e,y){try{return y in e}catch{return!1}}function propertyIsUnsafe(e,y){return propertyIsOnObject(e,y)&&!(Object.hasOwnProperty.call(e,y)&&Object.propertyIsEnumerable.call(e,y))}function mergeObject(e,y,n){var S={};return n.isMergeableObject(e)&&getKeys(e).forEach(function(f){S[f]=cloneUnlessOtherwiseSpecified(e[f],n)}),getKeys(y).forEach(function(f){propertyIsUnsafe(e,f)||(propertyIsOnObject(e,f)&&n.isMergeableObject(y[f])?S[f]=getMergeFunction(f,n)(e[f],y[f],n):S[f]=cloneUnlessOtherwiseSpecified(y[f],n))}),S}function deepmerge(e,y,n){n=n||{},n.arrayMerge=n.arrayMerge||defaultArrayMerge,n.isMergeableObject=n.isMergeableObject||isMergeableObject,n.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var S=Array.isArray(y),f=Array.isArray(e),t=S===f;return t?S?n.arrayMerge(e,y,n):mergeObject(e,y,n):cloneUnlessOtherwiseSpecified(y,n)}deepmerge.all=function(y,n){if(!Array.isArray(y))throw new Error("first argument should be an array");return y.reduce(function(S,f){return deepmerge(S,f,n)},{})};var deepmerge_1=deepmerge,cjs=deepmerge_1,extendStatics=function(e,y){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,S){n.__proto__=S}||function(n,S){for(var f in S)Object.prototype.hasOwnProperty.call(S,f)&&(n[f]=S[f])},extendStatics(e,y)};function __extends$d(e,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");extendStatics(e,y);function n(){this.constructor=e}e.prototype=y===null?Object.create(y):(n.prototype=y.prototype,new n)}var __assign=function(){return __assign=Object.assign||function(y){for(var n,S=1,f=arguments.length;S<f;S++){n=arguments[S];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(y[t]=n[t])}return y},__assign.apply(this,arguments)};function __spreadArray(e,y,n){if(n||arguments.length===2)for(var S=0,f=y.length,t;S<f;S++)(t||!(S in y))&&(t||(t=Array.prototype.slice.call(y,0,S)),t[S]=y[S]);return e.concat(t||Array.prototype.slice.call(y))}var ErrorKind;(function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",e[e.INVALID_TAG=23]="INVALID_TAG",e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"})(ErrorKind||(ErrorKind={}));var TYPE;(function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound",e[e.tag=8]="tag"})(TYPE||(TYPE={}));var SKELETON_TYPE;(function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"})(SKELETON_TYPE||(SKELETON_TYPE={}));function isLiteralElement(e){return e.type===TYPE.literal}function isArgumentElement(e){return e.type===TYPE.argument}function isNumberElement(e){return e.type===TYPE.number}function isDateElement(e){return e.type===TYPE.date}function isTimeElement(e){return e.type===TYPE.time}function isSelectElement(e){return e.type===TYPE.select}function isPluralElement(e){return e.type===TYPE.plural}function isPoundElement(e){return e.type===TYPE.pound}function isTagElement(e){return e.type===TYPE.tag}function isNumberSkeleton(e){return!!(e&&typeof e=="object"&&e.type===SKELETON_TYPE.number)}function isDateTimeSkeleton(e){return!!(e&&typeof e=="object"&&e.type===SKELETON_TYPE.dateTime)}var SPACE_SEPARATOR_REGEX=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,DATE_TIME_REGEX=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function parseDateTimeSkeleton(e){var y={};return e.replace(DATE_TIME_REGEX,function(n){var S=n.length;switch(n[0]){case"G":y.era=S===4?"long":S===5?"narrow":"short";break;case"y":y.year=S===2?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":y.month=["numeric","2-digit","short","long","narrow"][S-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":y.day=["numeric","2-digit"][S-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":y.weekday=S===4?"short":S===5?"narrow":"short";break;case"e":if(S<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");y.weekday=["short","long","narrow","short"][S-4];break;case"c":if(S<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");y.weekday=["short","long","narrow","short"][S-4];break;case"a":y.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":y.hourCycle="h12",y.hour=["numeric","2-digit"][S-1];break;case"H":y.hourCycle="h23",y.hour=["numeric","2-digit"][S-1];break;case"K":y.hourCycle="h11",y.hour=["numeric","2-digit"][S-1];break;case"k":y.hourCycle="h24",y.hour=["numeric","2-digit"][S-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":y.minute=["numeric","2-digit"][S-1];break;case"s":y.second=["numeric","2-digit"][S-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":y.timeZoneName=S<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""}),y}var WHITE_SPACE_REGEX=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;function parseNumberSkeletonFromString(e){if(e.length===0)throw new Error("Number skeleton cannot be empty");for(var y=e.split(WHITE_SPACE_REGEX).filter(function(ee){return ee.length>0}),n=[],S=0,f=y;S<f.length;S++){var t=f[S],F=t.split("/");if(F.length===0)throw new Error("Invalid number skeleton");for(var N=F[0],I=F.slice(1),A=0,P=I;A<P.length;A++){var Y=P[A];if(Y.length===0)throw new Error("Invalid number skeleton")}n.push({stem:N,options:I})}return n}function icuUnitToEcma(e){return e.replace(/^(.*?)-/,"")}var FRACTION_PRECISION_REGEX=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,SIGNIFICANT_PRECISION_REGEX=/^(@+)?(\+|#+)?[rs]?$/g,INTEGER_WIDTH_REGEX=/(\*)(0+)|(#+)(0+)|(0+)/g,CONCISE_INTEGER_WIDTH_REGEX=/^(0+)$/;function parseSignificantPrecision(e){var y={};return e[e.length-1]==="r"?y.roundingPriority="morePrecision":e[e.length-1]==="s"&&(y.roundingPriority="lessPrecision"),e.replace(SIGNIFICANT_PRECISION_REGEX,function(n,S,f){return typeof f!="string"?(y.minimumSignificantDigits=S.length,y.maximumSignificantDigits=S.length):f==="+"?y.minimumSignificantDigits=S.length:S[0]==="#"?y.maximumSignificantDigits=S.length:(y.minimumSignificantDigits=S.length,y.maximumSignificantDigits=S.length+(typeof f=="string"?f.length:0)),""}),y}function parseSign(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function parseConciseScientificAndEngineeringStem(e){var y;if(e[0]==="E"&&e[1]==="E"?(y={notation:"engineering"},e=e.slice(2)):e[0]==="E"&&(y={notation:"scientific"},e=e.slice(1)),y){var n=e.slice(0,2);if(n==="+!"?(y.signDisplay="always",e=e.slice(2)):n==="+?"&&(y.signDisplay="exceptZero",e=e.slice(2)),!CONCISE_INTEGER_WIDTH_REGEX.test(e))throw new Error("Malformed concise eng/scientific notation");y.minimumIntegerDigits=e.length}return y}function parseNotationOptions(e){var y={},n=parseSign(e);return n||y}function parseNumberSkeleton(e){for(var y={},n=0,S=e;n<S.length;n++){var f=S[n];switch(f.stem){case"percent":case"%":y.style="percent";continue;case"%x100":y.style="percent",y.scale=100;continue;case"currency":y.style="currency",y.currency=f.options[0];continue;case"group-off":case",_":y.useGrouping=!1;continue;case"precision-integer":case".":y.maximumFractionDigits=0;continue;case"measure-unit":case"unit":y.style="unit",y.unit=icuUnitToEcma(f.options[0]);continue;case"compact-short":case"K":y.notation="compact",y.compactDisplay="short";continue;case"compact-long":case"KK":y.notation="compact",y.compactDisplay="long";continue;case"scientific":y=__assign(__assign(__assign({},y),{notation:"scientific"}),f.options.reduce(function(I,A){return __assign(__assign({},I),parseNotationOptions(A))},{}));continue;case"engineering":y=__assign(__assign(__assign({},y),{notation:"engineering"}),f.options.reduce(function(I,A){return __assign(__assign({},I),parseNotationOptions(A))},{}));continue;case"notation-simple":y.notation="standard";continue;case"unit-width-narrow":y.currencyDisplay="narrowSymbol",y.unitDisplay="narrow";continue;case"unit-width-short":y.currencyDisplay="code",y.unitDisplay="short";continue;case"unit-width-full-name":y.currencyDisplay="name",y.unitDisplay="long";continue;case"unit-width-iso-code":y.currencyDisplay="symbol";continue;case"scale":y.scale=parseFloat(f.options[0]);continue;case"integer-width":if(f.options.length>1)throw new RangeError("integer-width stems only accept a single optional option");f.options[0].replace(INTEGER_WIDTH_REGEX,function(I,A,P,Y,ee,ne){if(A)y.minimumIntegerDigits=P.length;else{if(Y&&ee)throw new Error("We currently do not support maximum integer digits");if(ne)throw new Error("We currently do not support exact integer digits")}return""});continue}if(CONCISE_INTEGER_WIDTH_REGEX.test(f.stem)){y.minimumIntegerDigits=f.stem.length;continue}if(FRACTION_PRECISION_REGEX.test(f.stem)){if(f.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");f.stem.replace(FRACTION_PRECISION_REGEX,function(I,A,P,Y,ee,ne){return P==="*"?y.minimumFractionDigits=A.length:Y&&Y[0]==="#"?y.maximumFractionDigits=Y.length:ee&&ne?(y.minimumFractionDigits=ee.length,y.maximumFractionDigits=ee.length+ne.length):(y.minimumFractionDigits=A.length,y.maximumFractionDigits=A.length),""});var t=f.options[0];t==="w"?y=__assign(__assign({},y),{trailingZeroDisplay:"stripIfInteger"}):t&&(y=__assign(__assign({},y),parseSignificantPrecision(t)));continue}if(SIGNIFICANT_PRECISION_REGEX.test(f.stem)){y=__assign(__assign({},y),parseSignificantPrecision(f.stem));continue}var F=parseSign(f.stem);F&&(y=__assign(__assign({},y),F));var N=parseConciseScientificAndEngineeringStem(f.stem);N&&(y=__assign(__assign({},y),N))}return y}var timeData={AX:["H"],BQ:["H"],CP:["H"],CZ:["H"],DK:["H"],FI:["H"],ID:["H"],IS:["H"],ML:["H"],NE:["H"],RU:["H"],SE:["H"],SJ:["H"],SK:["H"],AS:["h","H"],BT:["h","H"],DJ:["h","H"],ER:["h","H"],GH:["h","H"],IN:["h","H"],LS:["h","H"],PG:["h","H"],PW:["h","H"],SO:["h","H"],TO:["h","H"],VU:["h","H"],WS:["h","H"],"001":["H","h"],AL:["h","H","hB"],TD:["h","H","hB"],"ca-ES":["H","h","hB"],CF:["H","h","hB"],CM:["H","h","hB"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],LU:["H","h","hB"],NP:["H","h","hB"],PF:["H","h","hB"],SC:["H","h","hB"],SM:["H","h","hB"],SN:["H","h","hB"],TF:["H","h","hB"],VA:["H","h","hB"],CY:["h","H","hb","hB"],GR:["h","H","hb","hB"],CO:["h","H","hB","hb"],DO:["h","H","hB","hb"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],NA:["h","H","hB","hb"],PA:["h","H","hB","hb"],PR:["h","H","hB","hb"],VE:["h","H","hB","hb"],AC:["H","h","hb","hB"],AI:["H","h","hb","hB"],BW:["H","h","hb","hB"],BZ:["H","h","hb","hB"],CC:["H","h","hb","hB"],CK:["H","h","hb","hB"],CX:["H","h","hb","hB"],DG:["H","h","hb","hB"],FK:["H","h","hb","hB"],GB:["H","h","hb","hB"],GG:["H","h","hb","hB"],GI:["H","h","hb","hB"],IE:["H","h","hb","hB"],IM:["H","h","hb","hB"],IO:["H","h","hb","hB"],JE:["H","h","hb","hB"],LT:["H","h","hb","hB"],MK:["H","h","hb","hB"],MN:["H","h","hb","hB"],MS:["H","h","hb","hB"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],PN:["H","h","hb","hB"],SH:["H","h","hb","hB"],SX:["H","h","hb","hB"],TA:["H","h","hb","hB"],ZA:["H","h","hb","hB"],"af-ZA":["H","h","hB","hb"],AR:["H","h","hB","hb"],CL:["H","h","hB","hb"],CR:["H","h","hB","hb"],CU:["H","h","hB","hb"],EA:["H","h","hB","hb"],"es-BO":["H","h","hB","hb"],"es-BR":["H","h","hB","hb"],"es-EC":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"es-PE":["H","h","hB","hb"],GT:["H","h","hB","hb"],HN:["H","h","hB","hb"],IC:["H","h","hB","hb"],KG:["H","h","hB","hb"],KM:["H","h","hB","hb"],LK:["H","h","hB","hb"],MA:["H","h","hB","hb"],MX:["H","h","hB","hb"],NI:["H","h","hB","hb"],PY:["H","h","hB","hb"],SV:["H","h","hB","hb"],UY:["H","h","hB","hb"],JP:["H","h","K"],AD:["H","hB"],AM:["H","hB"],AO:["H","hB"],AT:["H","hB"],AW:["H","hB"],BE:["H","hB"],BF:["H","hB"],BJ:["H","hB"],BL:["H","hB"],BR:["H","hB"],CG:["H","hB"],CI:["H","hB"],CV:["H","hB"],DE:["H","hB"],EE:["H","hB"],FR:["H","hB"],GA:["H","hB"],GF:["H","hB"],GN:["H","hB"],GP:["H","hB"],GW:["H","hB"],HR:["H","hB"],IL:["H","hB"],IT:["H","hB"],KZ:["H","hB"],MC:["H","hB"],MD:["H","hB"],MF:["H","hB"],MQ:["H","hB"],MZ:["H","hB"],NC:["H","hB"],NL:["H","hB"],PM:["H","hB"],PT:["H","hB"],RE:["H","hB"],RO:["H","hB"],SI:["H","hB"],SR:["H","hB"],ST:["H","hB"],TG:["H","hB"],TR:["H","hB"],WF:["H","hB"],YT:["H","hB"],BD:["h","hB","H"],PK:["h","hB","H"],AZ:["H","hB","h"],BA:["H","hB","h"],BG:["H","hB","h"],CH:["H","hB","h"],GE:["H","hB","h"],LI:["H","hB","h"],ME:["H","hB","h"],RS:["H","hB","h"],UA:["H","hB","h"],UZ:["H","hB","h"],XK:["H","hB","h"],AG:["h","hb","H","hB"],AU:["h","hb","H","hB"],BB:["h","hb","H","hB"],BM:["h","hb","H","hB"],BS:["h","hb","H","hB"],CA:["h","hb","H","hB"],DM:["h","hb","H","hB"],"en-001":["h","hb","H","hB"],FJ:["h","hb","H","hB"],FM:["h","hb","H","hB"],GD:["h","hb","H","hB"],GM:["h","hb","H","hB"],GU:["h","hb","H","hB"],GY:["h","hb","H","hB"],JM:["h","hb","H","hB"],KI:["h","hb","H","hB"],KN:["h","hb","H","hB"],KY:["h","hb","H","hB"],LC:["h","hb","H","hB"],LR:["h","hb","H","hB"],MH:["h","hb","H","hB"],MP:["h","hb","H","hB"],MW:["h","hb","H","hB"],NZ:["h","hb","H","hB"],SB:["h","hb","H","hB"],SG:["h","hb","H","hB"],SL:["h","hb","H","hB"],SS:["h","hb","H","hB"],SZ:["h","hb","H","hB"],TC:["h","hb","H","hB"],TT:["h","hb","H","hB"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],VC:["h","hb","H","hB"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],ZM:["h","hb","H","hB"],BO:["H","hB","h","hb"],EC:["H","hB","h","hb"],ES:["H","hB","h","hb"],GQ:["H","hB","h","hb"],PE:["H","hB","h","hb"],AE:["h","hB","hb","H"],"ar-001":["h","hB","hb","H"],BH:["h","hB","hb","H"],DZ:["h","hB","hb","H"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],HK:["h","hB","hb","H"],IQ:["h","hB","hb","H"],JO:["h","hB","hb","H"],KW:["h","hB","hb","H"],LB:["h","hB","hb","H"],LY:["h","hB","hb","H"],MO:["h","hB","hb","H"],MR:["h","hB","hb","H"],OM:["h","hB","hb","H"],PH:["h","hB","hb","H"],PS:["h","hB","hb","H"],QA:["h","hB","hb","H"],SA:["h","hB","hb","H"],SD:["h","hB","hb","H"],SY:["h","hB","hb","H"],TN:["h","hB","hb","H"],YE:["h","hB","hb","H"],AF:["H","hb","hB","h"],LA:["H","hb","hB","h"],CN:["H","hB","hb","h"],LV:["H","hB","hb","h"],TL:["H","hB","hb","h"],"zu-ZA":["H","hB","hb","h"],CD:["hB","H"],IR:["hB","H"],"hi-IN":["hB","h","H"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"te-IN":["hB","h","H"],KH:["hB","h","H","hb"],"ta-IN":["hB","h","hb","H"],BN:["hb","hB","h","H"],MY:["hb","hB","h","H"],ET:["hB","hb","h","H"],"gu-IN":["hB","hb","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],TW:["hB","hb","h","H"],KE:["hB","hb","H","h"],MM:["hB","hb","H","h"],TZ:["hB","hb","H","h"],UG:["hB","hb","H","h"]};function getBestPattern(e,y){for(var n="",S=0;S<e.length;S++){var f=e.charAt(S);if(f==="j"){for(var t=0;S+1<e.length&&e.charAt(S+1)===f;)t++,S++;var F=1+(t&1),N=t<2?1:3+(t>>1),I="a",A=getDefaultHourSymbolFromLocale(y);for((A=="H"||A=="k")&&(N=0);N-- >0;)n+=I;for(;F-- >0;)n=A+n}else f==="J"?n+="H":n+=f}return n}function getDefaultHourSymbolFromLocale(e){var y=e.hourCycle;if(y===void 0&&e.hourCycles&&e.hourCycles.length&&(y=e.hourCycles[0]),y)switch(y){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var n=e.language,S;n!=="root"&&(S=e.maximize().region);var f=timeData[S||""]||timeData[n||""]||timeData["".concat(n,"-001")]||timeData["001"];return f[0]}var _a,SPACE_SEPARATOR_START_REGEX=new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source,"*")),SPACE_SEPARATOR_END_REGEX=new RegExp("".concat(SPACE_SEPARATOR_REGEX.source,"*$"));function createLocation(e,y){return{start:e,end:y}}var hasNativeStartsWith=!!String.prototype.startsWith,hasNativeFromCodePoint=!!String.fromCodePoint,hasNativeFromEntries=!!Object.fromEntries,hasNativeCodePointAt=!!String.prototype.codePointAt,hasTrimStart=!!String.prototype.trimStart,hasTrimEnd=!!String.prototype.trimEnd,hasNativeIsSafeInteger=!!Number.isSafeInteger,isSafeInteger=hasNativeIsSafeInteger?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},REGEX_SUPPORTS_U_AND_Y=!0;try{var re=RE("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");REGEX_SUPPORTS_U_AND_Y=((_a=re.exec("a"))===null||_a===void 0?void 0:_a[0])==="a"}catch(e){REGEX_SUPPORTS_U_AND_Y=!1}var startsWith=hasNativeStartsWith?function(y,n,S){return y.startsWith(n,S)}:function(y,n,S){return y.slice(S,S+n.length)===n},fromCodePoint=hasNativeFromCodePoint?String.fromCodePoint:function(){for(var y=[],n=0;n<arguments.length;n++)y[n]=arguments[n];for(var S="",f=y.length,t=0,F;f>t;){if(F=y[t++],F>1114111)throw RangeError(F+" is not a valid code point");S+=F<65536?String.fromCharCode(F):String.fromCharCode(((F-=65536)>>10)+55296,F%1024+56320)}return S},fromEntries=hasNativeFromEntries?Object.fromEntries:function(y){for(var n={},S=0,f=y;S<f.length;S++){var t=f[S],F=t[0],N=t[1];n[F]=N}return n},codePointAt=hasNativeCodePointAt?function(y,n){return y.codePointAt(n)}:function(y,n){var S=y.length;if(!(n<0||n>=S)){var f=y.charCodeAt(n),t;return f<55296||f>56319||n+1===S||(t=y.charCodeAt(n+1))<56320||t>57343?f:(f-55296<<10)+(t-56320)+65536}},trimStart=hasTrimStart?function(y){return y.trimStart()}:function(y){return y.replace(SPACE_SEPARATOR_START_REGEX,"")},trimEnd=hasTrimEnd?function(y){return y.trimEnd()}:function(y){return y.replace(SPACE_SEPARATOR_END_REGEX,"")};function RE(e,y){return new RegExp(e,y)}var matchIdentifierAtIndex;if(REGEX_SUPPORTS_U_AND_Y){var IDENTIFIER_PREFIX_RE_1=RE("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");matchIdentifierAtIndex=function(y,n){var S;IDENTIFIER_PREFIX_RE_1.lastIndex=n;var f=IDENTIFIER_PREFIX_RE_1.exec(y);return(S=f[1])!==null&&S!==void 0?S:""}}else matchIdentifierAtIndex=function(y,n){for(var S=[];;){var f=codePointAt(y,n);if(f===void 0||_isWhiteSpace(f)||_isPatternSyntax(f))break;S.push(f),n+=f>=65536?2:1}return fromCodePoint.apply(void 0,S)};var Parser=function(){function e(y,n){n===void 0&&(n={}),this.message=y,this.position={offset:0,line:1,column:1},this.ignoreTag=!!n.ignoreTag,this.locale=n.locale,this.requiresOtherClause=!!n.requiresOtherClause,this.shouldParseSkeletons=!!n.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(y,n,S){for(var f=[];!this.isEOF();){var t=this.char();if(t===123){var F=this.parseArgument(y,S);if(F.err)return F;f.push(F.val)}else{if(t===125&&y>0)break;if(t===35&&(n==="plural"||n==="selectordinal")){var N=this.clonePosition();this.bump(),f.push({type:TYPE.pound,location:createLocation(N,this.clonePosition())})}else if(t===60&&!this.ignoreTag&&this.peek()===47){if(S)break;return this.error(ErrorKind.UNMATCHED_CLOSING_TAG,createLocation(this.clonePosition(),this.clonePosition()))}else if(t===60&&!this.ignoreTag&&_isAlpha(this.peek()||0)){var F=this.parseTag(y,n);if(F.err)return F;f.push(F.val)}else{var F=this.parseLiteral(y,n);if(F.err)return F;f.push(F.val)}}}return{val:f,err:null}},e.prototype.parseTag=function(y,n){var S=this.clonePosition();this.bump();var f=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:TYPE.literal,value:"<".concat(f,"/>"),location:createLocation(S,this.clonePosition())},err:null};if(this.bumpIf(">")){var t=this.parseMessage(y+1,n,!0);if(t.err)return t;var F=t.val,N=this.clonePosition();if(this.bumpIf("</")){if(this.isEOF()||!_isAlpha(this.char()))return this.error(ErrorKind.INVALID_TAG,createLocation(N,this.clonePosition()));var I=this.clonePosition(),A=this.parseTagName();return f!==A?this.error(ErrorKind.UNMATCHED_CLOSING_TAG,createLocation(I,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:TYPE.tag,value:f,children:F,location:createLocation(S,this.clonePosition())},err:null}:this.error(ErrorKind.INVALID_TAG,createLocation(N,this.clonePosition())))}else return this.error(ErrorKind.UNCLOSED_TAG,createLocation(S,this.clonePosition()))}else return this.error(ErrorKind.INVALID_TAG,createLocation(S,this.clonePosition()))},e.prototype.parseTagName=function(){var y=this.offset();for(this.bump();!this.isEOF()&&_isPotentialElementNameChar(this.char());)this.bump();return this.message.slice(y,this.offset())},e.prototype.parseLiteral=function(y,n){for(var S=this.clonePosition(),f="";;){var t=this.tryParseQuote(n);if(t){f+=t;continue}var F=this.tryParseUnquoted(y,n);if(F){f+=F;continue}var N=this.tryParseLeftAngleBracket();if(N){f+=N;continue}break}var I=createLocation(S,this.clonePosition());return{val:{type:TYPE.literal,value:f,location:I},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!_isAlphaOrSlash(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(y){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(y==="plural"||y==="selectordinal")break;return null;default:return null}this.bump();var n=[this.char()];for(this.bump();!this.isEOF();){var S=this.char();if(S===39)if(this.peek()===39)n.push(39),this.bump();else{this.bump();break}else n.push(S);this.bump()}return fromCodePoint.apply(void 0,n)},e.prototype.tryParseUnquoted=function(y,n){if(this.isEOF())return null;var S=this.char();return S===60||S===123||S===35&&(n==="plural"||n==="selectordinal")||S===125&&y>0?null:(this.bump(),fromCodePoint(S))},e.prototype.parseArgument=function(y,n){var S=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE,createLocation(S,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(ErrorKind.EMPTY_ARGUMENT,createLocation(S,this.clonePosition()));var f=this.parseIdentifierIfPossible().value;if(!f)return this.error(ErrorKind.MALFORMED_ARGUMENT,createLocation(S,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE,createLocation(S,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:TYPE.argument,value:f,location:createLocation(S,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE,createLocation(S,this.clonePosition())):this.parseArgumentOptions(y,n,f,S);default:return this.error(ErrorKind.MALFORMED_ARGUMENT,createLocation(S,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var y=this.clonePosition(),n=this.offset(),S=matchIdentifierAtIndex(this.message,n),f=n+S.length;this.bumpTo(f);var t=this.clonePosition(),F=createLocation(y,t);return{value:S,location:F}},e.prototype.parseArgumentOptions=function(y,n,S,f){var t,F=this.clonePosition(),N=this.parseIdentifierIfPossible().value,I=this.clonePosition();switch(N){case"":return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE,createLocation(F,I));case"number":case"date":case"time":{this.bumpSpace();var A=null;if(this.bumpIf(",")){this.bumpSpace();var P=this.clonePosition(),Y=this.parseSimpleArgStyleIfPossible();if(Y.err)return Y;var ee=trimEnd(Y.val);if(ee.length===0)return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE,createLocation(this.clonePosition(),this.clonePosition()));var ne=createLocation(P,this.clonePosition());A={style:ee,styleLocation:ne}}var ae=this.tryParseArgumentClose(f);if(ae.err)return ae;var pe=createLocation(f,this.clonePosition());if(A&&startsWith(A==null?void 0:A.style,"::",0)){var se=trimStart(A.style.slice(2));if(N==="number"){var Y=this.parseNumberSkeletonFromString(se,A.styleLocation);return Y.err?Y:{val:{type:TYPE.number,value:S,location:pe,style:Y.val},err:null}}else{if(se.length===0)return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON,pe);var le=se;this.locale&&(le=getBestPattern(se,this.locale));var ee={type:SKELETON_TYPE.dateTime,pattern:le,location:A.styleLocation,parsedOptions:this.shouldParseSkeletons?parseDateTimeSkeleton(le):{}},me=N==="date"?TYPE.date:TYPE.time;return{val:{type:me,value:S,location:pe,style:ee},err:null}}}return{val:{type:N==="number"?TYPE.number:N==="date"?TYPE.date:TYPE.time,value:S,location:pe,style:(t=A==null?void 0:A.style)!==null&&t!==void 0?t:null},err:null}}case"plural":case"selectordinal":case"select":{var fe=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS,createLocation(fe,__assign({},fe)));this.bumpSpace();var ge=this.parseIdentifierIfPossible(),oe=0;if(N!=="select"&&ge.value==="offset"){if(!this.bumpIf(":"))return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,createLocation(this.clonePosition(),this.clonePosition()));this.bumpSpace();var Y=this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(Y.err)return Y;this.bumpSpace(),ge=this.parseIdentifierIfPossible(),oe=Y.val}var te=this.tryParsePluralOrSelectOptions(y,N,n,ge);if(te.err)return te;var ae=this.tryParseArgumentClose(f);if(ae.err)return ae;var ie=createLocation(f,this.clonePosition());return N==="select"?{val:{type:TYPE.select,value:S,options:fromEntries(te.val),location:ie},err:null}:{val:{type:TYPE.plural,value:S,options:fromEntries(te.val),offset:oe,pluralType:N==="plural"?"cardinal":"ordinal",location:ie},err:null}}default:return this.error(ErrorKind.INVALID_ARGUMENT_TYPE,createLocation(F,I))}},e.prototype.tryParseArgumentClose=function(y){return this.isEOF()||this.char()!==125?this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE,createLocation(y,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var y=0,n=this.clonePosition();!this.isEOF();){var S=this.char();switch(S){case 39:{this.bump();var f=this.clonePosition();if(!this.bumpUntil("'"))return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,createLocation(f,this.clonePosition()));this.bump();break}case 123:{y+=1,this.bump();break}case 125:{if(y>0)y-=1;else return{val:this.message.slice(n.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(n.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(y,n){var S=[];try{S=parseNumberSkeletonFromString(y)}catch{return this.error(ErrorKind.INVALID_NUMBER_SKELETON,n)}return{val:{type:SKELETON_TYPE.number,tokens:S,location:n,parsedOptions:this.shouldParseSkeletons?parseNumberSkeleton(S):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(y,n,S,f){for(var t,F=!1,N=[],I=new Set,A=f.value,P=f.location;;){if(A.length===0){var Y=this.clonePosition();if(n!=="select"&&this.bumpIf("=")){var ee=this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR,ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);if(ee.err)return ee;P=createLocation(Y,this.clonePosition()),A=this.message.slice(Y.offset,this.offset())}else break}if(I.has(A))return this.error(n==="select"?ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR:ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,P);A==="other"&&(F=!0),this.bumpSpace();var ne=this.clonePosition();if(!this.bumpIf("{"))return this.error(n==="select"?ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,createLocation(this.clonePosition(),this.clonePosition()));var ae=this.parseMessage(y+1,n,S);if(ae.err)return ae;var pe=this.tryParseArgumentClose(ne);if(pe.err)return pe;N.push([A,{value:ae.val,location:createLocation(ne,this.clonePosition())}]),I.add(A),this.bumpSpace(),t=this.parseIdentifierIfPossible(),A=t.value,P=t.location}return N.length===0?this.error(n==="select"?ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR:ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR,createLocation(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!F?this.error(ErrorKind.MISSING_OTHER_CLAUSE,createLocation(this.clonePosition(),this.clonePosition())):{val:N,err:null}},e.prototype.tryParseDecimalInteger=function(y,n){var S=1,f=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(S=-1);for(var t=!1,F=0;!this.isEOF();){var N=this.char();if(N>=48&&N<=57)t=!0,F=F*10+(N-48),this.bump();else break}var I=createLocation(f,this.clonePosition());return t?(F*=S,isSafeInteger(F)?{val:F,err:null}:this.error(n,I)):this.error(y,I)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var y=this.position.offset;if(y>=this.message.length)throw Error("out of bound");var n=codePointAt(this.message,y);if(n===void 0)throw Error("Offset ".concat(y," is at invalid UTF-16 code unit boundary"));return n},e.prototype.error=function(y,n){return{val:null,err:{kind:y,message:this.message,location:n}}},e.prototype.bump=function(){if(!this.isEOF()){var y=this.char();y===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=y<65536?1:2)}},e.prototype.bumpIf=function(y){if(startsWith(this.message,y,this.offset())){for(var n=0;n<y.length;n++)this.bump();return!0}return!1},e.prototype.bumpUntil=function(y){var n=this.offset(),S=this.message.indexOf(y,n);return S>=0?(this.bumpTo(S),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(y){if(this.offset()>y)throw Error("targetOffset ".concat(y," must be greater than or equal to the current offset ").concat(this.offset()));for(y=Math.min(y,this.message.length);;){var n=this.offset();if(n===y)break;if(n>y)throw Error("targetOffset ".concat(y," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&_isWhiteSpace(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var y=this.char(),n=this.offset(),S=this.message.charCodeAt(n+(y>=65536?2:1));return S??null},e}();function _isAlpha(e){return e>=97&&e<=122||e>=65&&e<=90}function _isAlphaOrSlash(e){return _isAlpha(e)||e===47}function _isPotentialElementNameChar(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function _isWhiteSpace(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function _isPatternSyntax(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=