ray-template/js/@intlify_message-compiler@9.13.1-4K4Nd_mc.js

8 lines
19 KiB
JavaScript
Raw Permalink Blame History

/*!
* message-compiler v9.13.1
* (c) 2024 kazuya kawaguchi
* Released under the MIT License.
*/function me(r,n,u){return{line:r,column:n,offset:u}}function B(r,n,u){return{start:r,end:n}}const ye=/\{([0-9a-zA-Z]+)\}/g;function se(r,...n){return n.length===1&&be(n[0])&&(n=n[0]),(!n||!n.hasOwnProperty)&&(n={}),r.replace(ye,(u,o)=>n.hasOwnProperty(o)?n[o]:"")}const ue=Object.assign,te=r=>typeof r=="string",be=r=>r!==null&&typeof r=="object";function ce(r,n=""){return r.reduce((u,o,N)=>N===0?u+o:u+n+o,"")}const ae={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},Ue={[ae.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function Re(r,n,...u){const o=se(Ue[r],...u||[]),N={message:String(o),code:r};return n&&(N.location=n),N}const L={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},Me={[L.EXPECTED_TOKEN]:"Expected token: '{0}'",[L.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[L.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[L.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[L.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[L.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[L.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[L.EMPTY_PLACEHOLDER]:"Empty placeholder",[L.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[L.INVALID_LINKED_FORMAT]:"Invalid linked format",[L.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[L.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[L.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[L.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[L.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[L.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function V(r,n,u={}){const{domain:o,messages:N,args:f}=u,h=se((N||Me)[r]||"",...f||[]),_=new SyntaxError(String(h));return _.code=r,n&&(_.location=n),_.domain=o,_}function nt(r){throw r}const Y=" ",ve="\r",y=`
`,Xe="\u2028",we="\u2029";function Ye(r){const n=r;let u=0,o=1,N=1,f=0;const h=l=>n[l]===ve&&n[l+1]===y,_=l=>n[l]===y,O=l=>n[l]===we,m=l=>n[l]===Xe,b=l=>h(l)||_(l)||O(l)||m(l),S=()=>u,I=()=>o,M=()=>N,v=()=>f,T=l=>h(l)||O(l)||m(l)?y:n[l],C=()=>T(u),X=()=>T(u+f);function x(){return f=0,b(u)&&(o++,N=0),h(u)&&u++,u++,N++,n[u]}function s(){return h(u+f)&&f++,f++,n[u+f]}function a(){u=0,o=1,N=1,f=0}function d(l=0){f=l}function c(){const l=u+f;for(;l!==u;)x();f=0}return{index:S,line:I,column:M,peekOffset:v,charAt:T,currentChar:C,currentPeek:X,next:x,peek:s,reset:a,resetPeek:d,skipToPeek:c}}const K=void 0,ge=".",ne="'",Ke="tokenizer";function He(r,n={}){const u=n.location!==!1,o=Ye(r),N=()=>o.index(),f=()=>me(o.line(),o.column(),o.index()),h=f(),_=N(),O={currentType:14,offset:_,startLoc:h,endLoc:h,lastType:14,lastOffset:_,lastStartLoc:h,lastEndLoc:h,braceNest:0,inLinked:!1,text:""},m=()=>O,{onError:b}=n;function S(e,t,i,...E){const k=m();if(t.column+=i,t.offset+=i,b){const A=u?B(k.startLoc,t):null,g=V(e,A,{domain:Ke,args:E});b(g)}}function I(e,t,i){e.endLoc=f(),e.currentType=t;const E={type:t};return u&&(E.loc=B(e.startLoc,e.endLoc)),i!=null&&(E.value=i),E}const M=e=>I(e,14);function v(e,t){return e.currentChar()===t?(e.next(),t):(S(L.EXPECTED_TOKEN,f(),0,t),"")}function T(e){let t="";for(;e.currentPeek()===Y||e.currentPeek()===y;)t+=e.currentPeek(),e.peek();return t}function C(e){const t=T(e);return e.skipToPeek(),t}function X(e){if(e===K)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t===95}function x(e){if(e===K)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}function s(e,t){const{currentType:i}=t;if(i!==2)return!1;T(e);const E=X(e.currentPeek());return e.resetPeek(),E}function a(e,t){const{currentType:i}=t;if(i!==2)return!1;T(e);const E=e.currentPeek()==="-"?e.peek():e.currentPeek(),k=x(E);return e.resetPeek(),k}function d(e,t){const{currentType:i}=t;if(i!==2)return!1;T(e);const E=e.currentPeek()===ne;return e.resetPeek(),E}function c(e,t){const{currentType:i}=t;if(i!==8)return!1;T(e);const E=e.currentPeek()===".";return e.resetPeek(),E}function l(e,t){const{currentType:i}=t;if(i!==9)return!1;T(e);const E=X(e.currentPeek());return e.resetPeek(),E}function p(e,t){const{currentType:i}=t;if(!(i===8||i===12))return!1;T(e);const E=e.currentPeek()===":";return e.resetPeek(),E}function P(e,t){const{currentType:i}=t;if(i!==10)return!1;const E=()=>{const A=e.currentPeek();return A==="{"?X(e.peek()):A==="@"||A==="%"||A==="|"||A===":"||A==="."||A===Y||!A?!1:A===y?(e.peek(),E()):D(e,!1)},k=E();return e.resetPeek(),k}function U(e){T(e);const t=e.currentPeek()==="|";return e.resetPeek(),t}function W(e){const t=T(e),i=e.currentPeek()==="%"&&e.peek()==="{";return e.resetPeek(),{isModulo:i,hasSpace:t.length>0}}function D(e,t=!0){const i=(k=!1,A="",g=!1)=>{const H=e.currentPeek();return H==="{"?A==="%"?!1:k:H==="@"||!H?A==="%"?!0:k:H==="%"?(e.peek(),i(k,"%",!0)):H==="|"?A==="%"||g?!0:!(A===Y||A===y):H===Y?(e.peek(),i(!0,Y,g)):H===y?(e.peek(),i(!0,y,g)):!0},E=i();return t&&e.resetPeek(),E}function w(e,t){const i=e.currentChar();return i===K?K:t(i)?(e.next(),i):null}function oe(e){const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||t===95||t===36}function le(e){return w(e,oe)}function fe(e){const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||t===95||t===36||t===45}function Ee(e){return w(e,fe)}function de(e){const t=e.charCodeAt(0);return t>=48&&t<=57}function Le(e){return w(e,de)}function Ne(e){const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function _e(e){return w(e,Ne)}function Z(e){let t="",i="";for(;t=Le(e);)i+=t;return i}function pe(e){C(e);const t=e.currentChar();return t!=="%"&&S(L.EXPECTED_TOKEN,f(),0,t),e.next(),"%"}function z(e){let t="";for(;;){const i=e.currentChar();if(i==="{"||i==="}"||i==="@"||i==="|"||!i)break;if(i==="%")if(D(e))t+=i,e.next();else break;else if(i===Y||i===y)if(D(e))t+=i,e.next();else{if(U(e))break;t+=i,e.next()}else t+=i,e.next()}return t}function he(e){C(e);let t="",i="";for(;t=Ee(e);)i+=t;return e.currentChar()===K&&S(L.UNTERMINATED_CLOSING_BRACE,f(),0),i}function Ce(e){C(e);let t="";return e.currentChar()==="-"?(e.next(),t+=`-${Z(e)}`):t+=Z(e),e.currentChar()===K&&S(L.UNTERMINATED_CLOSING_BRACE,f(),0),t}function Ie(e){return e!==ne&&e!==y}function Te(e){C(e),v(e,"'");let t="",i="";for(;t=w(e,Ie);)t==="\\"?i+=Ae(e):i+=t;const E=e.currentChar();return E===y||E===K?(S(L.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,f(),0),E===y&&(e.next(),v(e,"'")),i):(v(e,"'"),i)}function Ae(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return ee(e,t,4);case"U":return ee(e,t,6);default:return S(L.UNKNOWN_ESCAPE_SEQUENCE,f(),0,t),""}}function ee(e,t,i){v(e,t);let E="";for(let k=0;k<i;k++){const A=_e(e);if(!A){S(L.INVALID_UNICODE_ESCAPE_SEQUENCE,f(),0,`\\${t}${E}${e.currentChar()}`);break}E+=A}return`\\${t}${E}`}function Se(e){return e!=="{"&&e!=="}"&&e!==Y&&e!==y}function ke(e){C(e);let t="",i="";for(;t=w(e,Se);)i+=t;return i}function Pe(e){let t="",i="";for(;t=le(e);)i+=t;return i}function Oe(e){const t=i=>{const E=e.currentChar();return E==="{"||E==="%"||E==="@"||E==="|"||E==="("||E===")"||!E||E===Y?i:(i+=E,e.next(),t(i))};return t("")}function Q(e){C(e);const t=v(e,"|");return C(e),t}function q(e,t){let i=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&S(L.NOT_ALLOW_NEST_PLACEHOLDER,f(),0),e.next(),i=I(t,2,"{"),C(e),t.braceNest++,i;case"}":return t.braceNest>0&&t.currentType===2&&S(L.EMPTY_PLACEHOLDER,f(),0),e.next(),i=I(t,3,"}"),t.braceNest--,t.braceNest>0&&C(e),t.inLinked&&t.braceNest===0&&(t.inLinked=!1),i;case"@":return t.braceNest>0&&S(L.UNTERMINATED_CLOSING_BRACE,f(),0),i=F(e,t)||M(t),t.braceNest=0,i;default:{let k=!0,A=!0,g=!0;if(U(e))return t.braceNest>0&&S(L.UNTERMINATED_CLOSING_BRACE,f(),0),i=I(t,1,Q(e)),t.braceNest=0,t.inLinked=!1,i;if(t.braceNest>0&&(t.currentType===5||t.currentType===6||t.currentType===7))return S(L.UNTERMINATED_CLOSING_BRACE,f(),0),t.braceNest=0,j(e,t);if(k=s(e,t))return i=I(t,5,he(e)),C(e),i;if(A=a(e,t))return i=I(t,6,Ce(e)),C(e),i;if(g=d(e,t))return i=I(t,7,Te(e)),C(e),i;if(!k&&!A&&!g)return i=I(t,13,ke(e)),S(L.INVALID_TOKEN_IN_PLACEHOLDER,f(),0,i.value),C(e),i;break}}return i}function F(e,t){const{currentType:i}=t;let E=null;const k=e.currentChar();switch((i===8||i===9||i===12||i===10)&&(k===y||k===Y)&&S(L.INVALID_LINKED_FORMAT,f(),0),k){case"@":return e.next(),E=I(t,8,"@"),t.inLinked=!0,E;case".":return C(e),e.next(),I(t,9,".");case":":return C(e),e.next(),I(t,10,":");default:return U(e)?(E=I(t,1,Q(e)),t.braceNest=0,t.inLinked=!1,E):c(e,t)||p(e,t)?(C(e),F(e,t)):l(e,t)?(C(e),I(t,12,Pe(e))):P(e,t)?(C(e),k==="{"?q(e,t)||E:I(t,11,Oe(e))):(i===8&&S(L.INVALID_LINKED_FORMAT,f(),0),t.braceNest=0,t.inLinked=!1,j(e,t))}}function j(e,t){let i={type:14};if(t.braceNest>0)return q(e,t)||M(t);if(t.inLinked)return F(e,t)||M(t);switch(e.currentChar()){case"{":return q(e,t)||M(t);case"}":return S(L.UNBALANCED_CLOSING_BRACE,f(),0),e.next(),I(t,3,"}");case"@":return F(e,t)||M(t);default:{if(U(e))return i=I(t,1,Q(e)),t.braceNest=0,t.inLinked=!1,i;const{isModulo:k,hasSpace:A}=W(e);if(k)return A?I(t,0,z(e)):I(t,4,pe(e));if(D(e))return I(t,0,z(e));break}}return i}function De(){const{currentType:e,offset:t,startLoc:i,endLoc:E}=O;return O.lastType=e,O.lastOffset=t,O.lastStartLoc=i,O.lastEndLoc=E,O.offset=N(),O.startLoc=f(),o.currentChar()===K?I(O,14):j(o,O)}return{nextToken:De,currentOffset:N,currentPosition:f,context:m}}const xe="parser",$e=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function Ge(r,n,u){switch(r){case"\\\\":return"\\";case"\\'":return"'";default:{const o=parseInt(n||u,16);return o<=55295||o>=57344?String.fromCodePoint(o):"<22>"}}}function Fe(r={}){const n=r.location!==!1,{onError:u,onWarn:o}=r;function N(s,a,d,c,...l){const p=s.currentPosition();if(p.offset+=c,p.column+=c,u){const P=n?B(d,p):null,U=V(a,P,{domain:xe,args:l});u(U)}}function f(s,a,d,c,...l){const p=s.currentPosition();if(p.offset+=c,p.column+=c,o){const P=n?B(d,p):null;o(Re(a,P,l))}}function h(s,a,d){const c={type:s};return n&&(c.start=a,c.end=a,c.loc={start:d,end:d}),c}function _(s,a,d,c){n&&(s.end=a,s.loc&&(s.loc.end=d))}function O(s,a){const d=s.context(),c=h(3,d.offset,d.startLoc);return c.value=a,_(c,s.currentOffset(),s.currentPosition()),c}function m(s,a){const d=s.context(),{lastOffset:c,lastStartLoc:l}=d,p=h(5,c,l);return p.index=parseInt(a,10),s.nextToken(),_(p,s.currentOffset(),s.currentPosition()),p}function b(s,a,d){const c=s.context(),{lastOffset:l,lastStartLoc:p}=c,P=h(4,l,p);return P.key=a,d===!0&&(P.modulo=!0),s.nextToken(),_(P,s.currentOffset(),s.currentPosition()),P}function S(s,a){const d=s.context(),{lastOffset:c,lastStartLoc:l}=d,p=h(9,c,l);return p.value=a.replace($e,Ge),s.nextToken(),_(p,s.currentOffset(),s.currentPosition()),p}function I(s){const a=s.nextToken(),d=s.context(),{lastOffset:c,lastStartLoc:l}=d,p=h(8,c,l);return a.type!==12?(N(s,L.UNEXPECTED_EMPTY_LINKED_MODIFIER,d.lastStartLoc,0),p.value="",_(p,c,l),{nextConsumeToken:a,node:p}):(a.value==null&&N(s,L.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,R(a)),p.value=a.value||"",_(p,s.currentOffset(),s.currentPosition()),{node:p})}function M(s,a){const d=s.context(),c=h(7,d.offset,d.startLoc);return c.value=a,_(c,s.currentOffset(),s.currentPosition()),c}function v(s){const a=s.context(),d=h(6,a.offset,a.startLoc);let c=s.nextToken();if(c.type===9){const l=I(s);d.modifier=l.node,c=l.nextConsumeToken||s.nextToken()}switch(c.type!==10&&N(s,L.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,0,R(c)),c=s.nextToken(),c.type===2&&(c=s.nextToken()),c.type){case 11:c.value==null&&N(s,L.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,0,R(c)),d.key=M(s,c.value||"");break;case 5:c.value==null&&N(s,L.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,0,R(c)),d.key=b(s,c.value||"");break;case 6:c.value==null&&N(s,L.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,0,R(c)),d.key=m(s,c.value||"");break;case 7:c.value==null&&N(s,L.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,0,R(c)),d.key=S(s,c.value||"");break;default:{N(s,L.UNEXPECTED_EMPTY_LINKED_KEY,a.lastStartLoc,0);const l=s.context(),p=h(7,l.offset,l.startLoc);return p.value="",_(p,l.offset,l.startLoc),d.key=p,_(d,l.offset,l.startLoc),{nextConsumeToken:c,node:d}}}return _(d,s.currentOffset(),s.currentPosition()),{node:d}}function T(s){const a=s.context(),d=a.currentType===1?s.currentOffset():a.offset,c=a.currentType===1?a.endLoc:a.startLoc,l=h(2,d,c);l.items=[];let p=null,P=null;do{const D=p||s.nextToken();switch(p=null,D.type){case 0:D.value==null&&N(s,L.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,0,R(D)),l.items.push(O(s,D.value||""));break;case 6:D.value==null&&N(s,L.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,0,R(D)),l.items.push(m(s,D.value||""));break;case 4:P=!0;break;case 5:D.value==null&&N(s,L.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,0,R(D)),l.items.push(b(s,D.value||"",!!P)),P&&(f(s,ae.USE_MODULO_SYNTAX,a.lastStartLoc,0,R(D)),P=null);break;case 7:D.value==null&&N(s,L.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,0,R(D)),l.items.push(S(s,D.value||""));break;case 8:{const w=v(s);l.items.push(w.node),p=w.nextConsumeToken||null;break}}}while(a.currentType!==14&&a.currentType!==1);const U=a.currentType===1?a.lastOffset:s.currentOffset(),W=a.currentType===1?a.lastEndLoc:s.currentPosition();return _(l,U,W),l}function C(s,a,d,c){const l=s.context();let p=c.items.length===0;const P=h(1,a,d);P.cases=[],P.cases.push(c);do{const U=T(s);p||(p=U.items.length===0),P.cases.push(U)}while(l.currentType!==14);return p&&N(s,L.MUST_HAVE_MESSAGES_IN_PLURAL,d,0),_(P,s.currentOffset(),s.currentPosition()),P}function X(s){const a=s.context(),{offset:d,startLoc:c}=a,l=T(s);return a.currentType===14?l:C(s,d,c,l)}function x(s){const a=He(s,ue({},r)),d=a.context(),c=h(0,d.offset,d.startLoc);return n&&c.loc&&(c.loc.source=s),c.body=X(a),r.onCacheKey&&(c.cacheKey=r.onCacheKey(s)),d.currentType!==14&&N(a,L.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,s[d.offset]||""),_(c,a.currentOffset(),a.currentPosition()),c}return{parse:x}}function R(r){if(r.type===14)return"EOF";const n=(r.value||"").replace(/\r?\n/gu,"\\n");return n.length>10?n.slice(0,9)+"…":n}function Be(r,n={}){const u={ast:r,helpers:new Set};return{context:()=>u,helper:f=>(u.helpers.add(f),f)}}function re(r,n){for(let u=0;u<r.length;u++)J(r[u],n)}function J(r,n){switch(r.type){case 1:re(r.cases,n),n.helper("plural");break;case 2:re(r.items,n);break;case 6:{J(r.key,n),n.helper("linked"),n.helper("type");break}case 5:n.helper("interpolate"),n.helper("list");break;case 4:n.helper("interpolate"),n.helper("named");break}}function Ve(r,n={}){const u=Be(r);u.helper("normalize"),r.body&&J(r.body,u);const o=u.context();r.helpers=Array.from(o.helpers)}function We(r){const n=r.body;return n.type===2?ie(n):n.cases.forEach(u=>ie(u)),r}function ie(r){if(r.items.length===1){const n=r.items[0];(n.type===3||n.type===9)&&(r.static=n.value,delete n.value)}else{const n=[];for(let u=0;u<r.items.length;u++){const o=r.items[u];if(!(o.type===3||o.type===9)||o.value==null)break;n.push(o.value)}if(n.length===r.items.length){r.static=ce(n);for(let u=0;u<r.items.length;u++){const o=r.items[u];(o.type===3||o.type===9)&&delete o.value}}}}const Qe="minifier";function $(r){switch(r.t=r.type,r.type){case 0:{const n=r;$(n.body),n.b=n.body,delete n.body;break}case 1:{const n=r,u=n.cases;for(let o=0;o<u.length;o++)$(u[o]);n.c=u,delete n.cases;break}case 2:{const n=r,u=n.items;for(let o=0;o<u.length;o++)$(u[o]);n.i=u,delete n.items,n.static&&(n.s=n.static,delete n.static);break}case 3:case 9:case 8:case 7:{const n=r;n.value&&(n.v=n.value,delete n.value);break}case 6:{const n=r;$(n.key),n.k=n.key,delete n.key,n.modifier&&($(n.modifier),n.m=n.modifier,delete n.modifier);break}case 5:{const n=r;n.i=n.index,delete n.index;break}case 4:{const n=r;n.k=n.key,delete n.key;break}default:throw V(L.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:Qe,args:[r.type]})}delete r.type}const qe="parser";function je(r,n){const{filename:u,breakLineCode:o,needIndent:N}=n,f=n.location!==!1,h={filename:u,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:N,indentLevel:0};f&&r.loc&&(h.source=r.loc.source);const _=()=>h;function O(T,C){h.code+=T}function m(T,C=!0){const X=C?o:"";O(N?X+" ".repeat(T):X)}function b(T=!0){const C=++h.indentLevel;T&&m(C)}function S(T=!0){const C=--h.indentLevel;T&&m(C)}function I(){m(h.indentLevel)}return{context:_,push:O,indent:b,deindent:S,newline:I,helper:T=>`_${T}`,needIndent:()=>h.needIndent}}function Je(r,n){const{helper:u}=r;r.push(`${u("linked")}(`),G(r,n.key),n.modifier?(r.push(", "),G(r,n.modifier),r.push(", _type")):r.push(", undefined, _type"),r.push(")")}function Ze(r,n){const{helper:u,needIndent:o}=r;r.push(`${u("normalize")}([`),r.indent(o());const N=n.items.length;for(let f=0;f<N&&(G(r,n.items[f]),f!==N-1);f++)r.push(", ");r.deindent(o()),r.push("])")}function ze(r,n){const{helper:u,needIndent:o}=r;if(n.cases.length>1){r.push(`${u("plural")}([`),r.indent(o());const N=n.cases.length;for(let f=0;f<N&&(G(r,n.cases[f]),f!==N-1);f++)r.push(", ");r.deindent(o()),r.push("])")}}function et(r,n){n.body?G(r,n.body):r.push("null")}function G(r,n){const{helper:u}=r;switch(n.type){case 0:et(r,n);break;case 1:ze(r,n);break;case 2:Ze(r,n);break;case 6:Je(r,n);break;case 8:r.push(JSON.stringify(n.value),n);break;case 7:r.push(JSON.stringify(n.value),n);break;case 5:r.push(`${u("interpolate")}(${u("list")}(${n.index}))`,n);break;case 4:r.push(`${u("interpolate")}(${u("named")}(${JSON.stringify(n.key)}))`,n);break;case 9:r.push(JSON.stringify(n.value),n);break;case 3:r.push(JSON.stringify(n.value),n);break;default:throw V(L.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:qe,args:[n.type]})}}const tt=(r,n={})=>{const u=te(n.mode)?n.mode:"normal",o=te(n.filename)?n.filename:"message.intl";n.sourceMap;const N=n.breakLineCode!=null?n.breakLineCode:u==="arrow"?";":`
`,f=n.needIndent?n.needIndent:u!=="arrow",h=r.helpers||[],_=je(r,{filename:o,breakLineCode:N,needIndent:f});_.push(u==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),_.indent(f),h.length>0&&(_.push(`const { ${ce(h.map(b=>`${b}: _${b}`),", ")} } = ctx`),_.newline()),_.push("return "),G(_,r),_.deindent(f),_.push("}"),delete r.helpers;const{code:O,map:m}=_.context();return{ast:r,code:O,map:m?m.toJSON():void 0}};function rt(r,n={}){const u=ue({},n),o=!!u.jit,N=!!u.minify,f=u.optimize==null?!0:u.optimize,_=Fe(u).parse(r);return o?(f&&We(_),N&&$(_),{ast:_,code:""}):(Ve(_,u),tt(_,u))}export{ae as C,L as a,rt as b,V as c,nt as d};