No Description

index.js 84KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150
  1. import { c as createCommonjsModule, g as getCjsExportFromNamespace, a as commonjsGlobal, u as unwrapExports } from './style-inject.es-7ed2769c.js';
  2. import 'react';
  3. import './test-4091af6f.js';
  4. export { C as ConsumeListView, P as PayPlatformOptions, a as PriceOptions, W as WaitPayInfoView } from './index-8e31d90e.js';
  5. import 'antd/es/input/style';
  6. import 'antd/es/input';
  7. import 'antd/es/button/style';
  8. import 'antd/es/button';
  9. /*
  10. Copyright (c) 2014, Yahoo! Inc. All rights reserved.
  11. Copyrights licensed under the New BSD License.
  12. See the accompanying LICENSE file for terms.
  13. */
  14. var extend_1 = extend;
  15. var hop = Object.prototype.hasOwnProperty;
  16. function extend(obj) {
  17. var sources = Array.prototype.slice.call(arguments, 1),
  18. i, len, source, key;
  19. for (i = 0, len = sources.length; i < len; i += 1) {
  20. source = sources[i];
  21. if (!source) { continue; }
  22. for (key in source) {
  23. if (hop.call(source, key)) {
  24. obj[key] = source[key];
  25. }
  26. }
  27. }
  28. return obj;
  29. }
  30. var hop_1 = hop;
  31. var utils = {
  32. extend: extend_1,
  33. hop: hop_1
  34. };
  35. var es5 = createCommonjsModule(function (module, exports) {
  36. // Purposely using the same implementation as the Intl.js `Intl` polyfill.
  37. // Copyright 2013 Andy Earnshaw, MIT License
  38. var realDefineProp = (function () {
  39. try { return !!Object.defineProperty({}, 'a', {}); }
  40. catch (e) { return false; }
  41. })();
  42. var defineProperty = realDefineProp ? Object.defineProperty :
  43. function (obj, name, desc) {
  44. if ('get' in desc && obj.__defineGetter__) {
  45. obj.__defineGetter__(name, desc.get);
  46. } else if (!utils.hop.call(obj, name) || 'value' in desc) {
  47. obj[name] = desc.value;
  48. }
  49. };
  50. var objCreate = Object.create || function (proto, props) {
  51. var obj, k;
  52. function F() {}
  53. F.prototype = proto;
  54. obj = new F();
  55. for (k in props) {
  56. if (utils.hop.call(props, k)) {
  57. defineProperty(obj, k, props[k]);
  58. }
  59. }
  60. return obj;
  61. };
  62. exports.defineProperty = defineProperty, exports.objCreate = objCreate;
  63. });
  64. var es5_1 = es5.defineProperty;
  65. var es5_2 = es5.objCreate;
  66. var compiler = createCommonjsModule(function (module, exports) {
  67. exports["default"] = Compiler;
  68. function Compiler(locales, formats, pluralFn) {
  69. this.locales = locales;
  70. this.formats = formats;
  71. this.pluralFn = pluralFn;
  72. }
  73. Compiler.prototype.compile = function (ast) {
  74. this.pluralStack = [];
  75. this.currentPlural = null;
  76. this.pluralNumberFormat = null;
  77. return this.compileMessage(ast);
  78. };
  79. Compiler.prototype.compileMessage = function (ast) {
  80. if (!(ast && ast.type === 'messageFormatPattern')) {
  81. throw new Error('Message AST is not of type: "messageFormatPattern"');
  82. }
  83. var elements = ast.elements,
  84. pattern = [];
  85. var i, len, element;
  86. for (i = 0, len = elements.length; i < len; i += 1) {
  87. element = elements[i];
  88. switch (element.type) {
  89. case 'messageTextElement':
  90. pattern.push(this.compileMessageText(element));
  91. break;
  92. case 'argumentElement':
  93. pattern.push(this.compileArgument(element));
  94. break;
  95. default:
  96. throw new Error('Message element does not have a valid type');
  97. }
  98. }
  99. return pattern;
  100. };
  101. Compiler.prototype.compileMessageText = function (element) {
  102. // When this `element` is part of plural sub-pattern and its value contains
  103. // an unescaped '#', use a `PluralOffsetString` helper to properly output
  104. // the number with the correct offset in the string.
  105. if (this.currentPlural && /(^|[^\\])#/g.test(element.value)) {
  106. // Create a cache a NumberFormat instance that can be reused for any
  107. // PluralOffsetString instance in this message.
  108. if (!this.pluralNumberFormat) {
  109. this.pluralNumberFormat = new Intl.NumberFormat(this.locales);
  110. }
  111. return new PluralOffsetString(
  112. this.currentPlural.id,
  113. this.currentPlural.format.offset,
  114. this.pluralNumberFormat,
  115. element.value);
  116. }
  117. // Unescape the escaped '#'s in the message text.
  118. return element.value.replace(/\\#/g, '#');
  119. };
  120. Compiler.prototype.compileArgument = function (element) {
  121. var format = element.format;
  122. if (!format) {
  123. return new StringFormat(element.id);
  124. }
  125. var formats = this.formats,
  126. locales = this.locales,
  127. pluralFn = this.pluralFn,
  128. options;
  129. switch (format.type) {
  130. case 'numberFormat':
  131. options = formats.number[format.style];
  132. return {
  133. id : element.id,
  134. format: new Intl.NumberFormat(locales, options).format
  135. };
  136. case 'dateFormat':
  137. options = formats.date[format.style];
  138. return {
  139. id : element.id,
  140. format: new Intl.DateTimeFormat(locales, options).format
  141. };
  142. case 'timeFormat':
  143. options = formats.time[format.style];
  144. return {
  145. id : element.id,
  146. format: new Intl.DateTimeFormat(locales, options).format
  147. };
  148. case 'pluralFormat':
  149. options = this.compileOptions(element);
  150. return new PluralFormat(
  151. element.id, format.ordinal, format.offset, options, pluralFn
  152. );
  153. case 'selectFormat':
  154. options = this.compileOptions(element);
  155. return new SelectFormat(element.id, options);
  156. default:
  157. throw new Error('Message element does not have a valid format type');
  158. }
  159. };
  160. Compiler.prototype.compileOptions = function (element) {
  161. var format = element.format,
  162. options = format.options,
  163. optionsHash = {};
  164. // Save the current plural element, if any, then set it to a new value when
  165. // compiling the options sub-patterns. This conforms the spec's algorithm
  166. // for handling `"#"` syntax in message text.
  167. this.pluralStack.push(this.currentPlural);
  168. this.currentPlural = format.type === 'pluralFormat' ? element : null;
  169. var i, len, option;
  170. for (i = 0, len = options.length; i < len; i += 1) {
  171. option = options[i];
  172. // Compile the sub-pattern and save it under the options's selector.
  173. optionsHash[option.selector] = this.compileMessage(option.value);
  174. }
  175. // Pop the plural stack to put back the original current plural value.
  176. this.currentPlural = this.pluralStack.pop();
  177. return optionsHash;
  178. };
  179. // -- Compiler Helper Classes --------------------------------------------------
  180. function StringFormat(id) {
  181. this.id = id;
  182. }
  183. StringFormat.prototype.format = function (value) {
  184. if (!value && typeof value !== 'number') {
  185. return '';
  186. }
  187. return typeof value === 'string' ? value : String(value);
  188. };
  189. function PluralFormat(id, useOrdinal, offset, options, pluralFn) {
  190. this.id = id;
  191. this.useOrdinal = useOrdinal;
  192. this.offset = offset;
  193. this.options = options;
  194. this.pluralFn = pluralFn;
  195. }
  196. PluralFormat.prototype.getOption = function (value) {
  197. var options = this.options;
  198. var option = options['=' + value] ||
  199. options[this.pluralFn(value - this.offset, this.useOrdinal)];
  200. return option || options.other;
  201. };
  202. function PluralOffsetString(id, offset, numberFormat, string) {
  203. this.id = id;
  204. this.offset = offset;
  205. this.numberFormat = numberFormat;
  206. this.string = string;
  207. }
  208. PluralOffsetString.prototype.format = function (value) {
  209. var number = this.numberFormat.format(value - this.offset);
  210. return this.string
  211. .replace(/(^|[^\\])#/g, '$1' + number)
  212. .replace(/\\#/g, '#');
  213. };
  214. function SelectFormat(id, options) {
  215. this.id = id;
  216. this.options = options;
  217. }
  218. SelectFormat.prototype.getOption = function (value) {
  219. var options = this.options;
  220. return options[value] || options.other;
  221. };
  222. });
  223. var parser = createCommonjsModule(function (module, exports) {
  224. exports["default"] = (function() {
  225. /*
  226. * Generated by PEG.js 0.9.0.
  227. *
  228. * http://pegjs.org/
  229. */
  230. function peg$subclass(child, parent) {
  231. function ctor() { this.constructor = child; }
  232. ctor.prototype = parent.prototype;
  233. child.prototype = new ctor();
  234. }
  235. function peg$SyntaxError(message, expected, found, location) {
  236. this.message = message;
  237. this.expected = expected;
  238. this.found = found;
  239. this.location = location;
  240. this.name = "SyntaxError";
  241. if (typeof Error.captureStackTrace === "function") {
  242. Error.captureStackTrace(this, peg$SyntaxError);
  243. }
  244. }
  245. peg$subclass(peg$SyntaxError, Error);
  246. function peg$parse(input) {
  247. var options = arguments.length > 1 ? arguments[1] : {},
  248. peg$FAILED = {},
  249. peg$startRuleFunctions = { start: peg$parsestart },
  250. peg$startRuleFunction = peg$parsestart,
  251. peg$c0 = function(elements) {
  252. return {
  253. type : 'messageFormatPattern',
  254. elements: elements,
  255. location: location()
  256. };
  257. },
  258. peg$c1 = function(text) {
  259. var string = '',
  260. i, j, outerLen, inner, innerLen;
  261. for (i = 0, outerLen = text.length; i < outerLen; i += 1) {
  262. inner = text[i];
  263. for (j = 0, innerLen = inner.length; j < innerLen; j += 1) {
  264. string += inner[j];
  265. }
  266. }
  267. return string;
  268. },
  269. peg$c2 = function(messageText) {
  270. return {
  271. type : 'messageTextElement',
  272. value: messageText,
  273. location: location()
  274. };
  275. },
  276. peg$c3 = /^[^ \t\n\r,.+={}#]/,
  277. peg$c4 = { type: "class", value: "[^ \\t\\n\\r,.+={}#]", description: "[^ \\t\\n\\r,.+={}#]" },
  278. peg$c5 = "{",
  279. peg$c6 = { type: "literal", value: "{", description: "\"{\"" },
  280. peg$c7 = ",",
  281. peg$c8 = { type: "literal", value: ",", description: "\",\"" },
  282. peg$c9 = "}",
  283. peg$c10 = { type: "literal", value: "}", description: "\"}\"" },
  284. peg$c11 = function(id, format) {
  285. return {
  286. type : 'argumentElement',
  287. id : id,
  288. format: format && format[2],
  289. location: location()
  290. };
  291. },
  292. peg$c12 = "number",
  293. peg$c13 = { type: "literal", value: "number", description: "\"number\"" },
  294. peg$c14 = "date",
  295. peg$c15 = { type: "literal", value: "date", description: "\"date\"" },
  296. peg$c16 = "time",
  297. peg$c17 = { type: "literal", value: "time", description: "\"time\"" },
  298. peg$c18 = function(type, style) {
  299. return {
  300. type : type + 'Format',
  301. style: style && style[2],
  302. location: location()
  303. };
  304. },
  305. peg$c19 = "plural",
  306. peg$c20 = { type: "literal", value: "plural", description: "\"plural\"" },
  307. peg$c21 = function(pluralStyle) {
  308. return {
  309. type : pluralStyle.type,
  310. ordinal: false,
  311. offset : pluralStyle.offset || 0,
  312. options: pluralStyle.options,
  313. location: location()
  314. };
  315. },
  316. peg$c22 = "selectordinal",
  317. peg$c23 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
  318. peg$c24 = function(pluralStyle) {
  319. return {
  320. type : pluralStyle.type,
  321. ordinal: true,
  322. offset : pluralStyle.offset || 0,
  323. options: pluralStyle.options,
  324. location: location()
  325. }
  326. },
  327. peg$c25 = "select",
  328. peg$c26 = { type: "literal", value: "select", description: "\"select\"" },
  329. peg$c27 = function(options) {
  330. return {
  331. type : 'selectFormat',
  332. options: options,
  333. location: location()
  334. };
  335. },
  336. peg$c28 = "=",
  337. peg$c29 = { type: "literal", value: "=", description: "\"=\"" },
  338. peg$c30 = function(selector, pattern) {
  339. return {
  340. type : 'optionalFormatPattern',
  341. selector: selector,
  342. value : pattern,
  343. location: location()
  344. };
  345. },
  346. peg$c31 = "offset:",
  347. peg$c32 = { type: "literal", value: "offset:", description: "\"offset:\"" },
  348. peg$c33 = function(number) {
  349. return number;
  350. },
  351. peg$c34 = function(offset, options) {
  352. return {
  353. type : 'pluralFormat',
  354. offset : offset,
  355. options: options,
  356. location: location()
  357. };
  358. },
  359. peg$c35 = { type: "other", description: "whitespace" },
  360. peg$c36 = /^[ \t\n\r]/,
  361. peg$c37 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
  362. peg$c38 = { type: "other", description: "optionalWhitespace" },
  363. peg$c39 = /^[0-9]/,
  364. peg$c40 = { type: "class", value: "[0-9]", description: "[0-9]" },
  365. peg$c41 = /^[0-9a-f]/i,
  366. peg$c42 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
  367. peg$c43 = "0",
  368. peg$c44 = { type: "literal", value: "0", description: "\"0\"" },
  369. peg$c45 = /^[1-9]/,
  370. peg$c46 = { type: "class", value: "[1-9]", description: "[1-9]" },
  371. peg$c47 = function(digits) {
  372. return parseInt(digits, 10);
  373. },
  374. peg$c48 = /^[^{}\\\0-\x1F \t\n\r]/,
  375. peg$c49 = { type: "class", value: "[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]" },
  376. peg$c50 = "\\\\",
  377. peg$c51 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },
  378. peg$c52 = function() { return '\\'; },
  379. peg$c53 = "\\#",
  380. peg$c54 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
  381. peg$c55 = function() { return '\\#'; },
  382. peg$c56 = "\\{",
  383. peg$c57 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
  384. peg$c58 = function() { return '\u007B'; },
  385. peg$c59 = "\\}",
  386. peg$c60 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
  387. peg$c61 = function() { return '\u007D'; },
  388. peg$c62 = "\\u",
  389. peg$c63 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
  390. peg$c64 = function(digits) {
  391. return String.fromCharCode(parseInt(digits, 16));
  392. },
  393. peg$c65 = function(chars) { return chars.join(''); },
  394. peg$currPos = 0,
  395. peg$savedPos = 0,
  396. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  397. peg$maxFailPos = 0,
  398. peg$maxFailExpected = [],
  399. peg$silentFails = 0,
  400. peg$result;
  401. if ("startRule" in options) {
  402. if (!(options.startRule in peg$startRuleFunctions)) {
  403. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  404. }
  405. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  406. }
  407. function location() {
  408. return peg$computeLocation(peg$savedPos, peg$currPos);
  409. }
  410. function peg$computePosDetails(pos) {
  411. var details = peg$posDetailsCache[pos],
  412. p, ch;
  413. if (details) {
  414. return details;
  415. } else {
  416. p = pos - 1;
  417. while (!peg$posDetailsCache[p]) {
  418. p--;
  419. }
  420. details = peg$posDetailsCache[p];
  421. details = {
  422. line: details.line,
  423. column: details.column,
  424. seenCR: details.seenCR
  425. };
  426. while (p < pos) {
  427. ch = input.charAt(p);
  428. if (ch === "\n") {
  429. if (!details.seenCR) { details.line++; }
  430. details.column = 1;
  431. details.seenCR = false;
  432. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  433. details.line++;
  434. details.column = 1;
  435. details.seenCR = true;
  436. } else {
  437. details.column++;
  438. details.seenCR = false;
  439. }
  440. p++;
  441. }
  442. peg$posDetailsCache[pos] = details;
  443. return details;
  444. }
  445. }
  446. function peg$computeLocation(startPos, endPos) {
  447. var startPosDetails = peg$computePosDetails(startPos),
  448. endPosDetails = peg$computePosDetails(endPos);
  449. return {
  450. start: {
  451. offset: startPos,
  452. line: startPosDetails.line,
  453. column: startPosDetails.column
  454. },
  455. end: {
  456. offset: endPos,
  457. line: endPosDetails.line,
  458. column: endPosDetails.column
  459. }
  460. };
  461. }
  462. function peg$fail(expected) {
  463. if (peg$currPos < peg$maxFailPos) { return; }
  464. if (peg$currPos > peg$maxFailPos) {
  465. peg$maxFailPos = peg$currPos;
  466. peg$maxFailExpected = [];
  467. }
  468. peg$maxFailExpected.push(expected);
  469. }
  470. function peg$buildException(message, expected, found, location) {
  471. function cleanupExpected(expected) {
  472. var i = 1;
  473. expected.sort(function(a, b) {
  474. if (a.description < b.description) {
  475. return -1;
  476. } else if (a.description > b.description) {
  477. return 1;
  478. } else {
  479. return 0;
  480. }
  481. });
  482. while (i < expected.length) {
  483. if (expected[i - 1] === expected[i]) {
  484. expected.splice(i, 1);
  485. } else {
  486. i++;
  487. }
  488. }
  489. }
  490. function buildMessage(expected, found) {
  491. function stringEscape(s) {
  492. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  493. return s
  494. .replace(/\\/g, '\\\\')
  495. .replace(/"/g, '\\"')
  496. .replace(/\x08/g, '\\b')
  497. .replace(/\t/g, '\\t')
  498. .replace(/\n/g, '\\n')
  499. .replace(/\f/g, '\\f')
  500. .replace(/\r/g, '\\r')
  501. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  502. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  503. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  504. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  505. }
  506. var expectedDescs = new Array(expected.length),
  507. expectedDesc, foundDesc, i;
  508. for (i = 0; i < expected.length; i++) {
  509. expectedDescs[i] = expected[i].description;
  510. }
  511. expectedDesc = expected.length > 1
  512. ? expectedDescs.slice(0, -1).join(", ")
  513. + " or "
  514. + expectedDescs[expected.length - 1]
  515. : expectedDescs[0];
  516. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  517. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  518. }
  519. if (expected !== null) {
  520. cleanupExpected(expected);
  521. }
  522. return new peg$SyntaxError(
  523. message !== null ? message : buildMessage(expected, found),
  524. expected,
  525. found,
  526. location
  527. );
  528. }
  529. function peg$parsestart() {
  530. var s0;
  531. s0 = peg$parsemessageFormatPattern();
  532. return s0;
  533. }
  534. function peg$parsemessageFormatPattern() {
  535. var s0, s1, s2;
  536. s0 = peg$currPos;
  537. s1 = [];
  538. s2 = peg$parsemessageFormatElement();
  539. while (s2 !== peg$FAILED) {
  540. s1.push(s2);
  541. s2 = peg$parsemessageFormatElement();
  542. }
  543. if (s1 !== peg$FAILED) {
  544. peg$savedPos = s0;
  545. s1 = peg$c0(s1);
  546. }
  547. s0 = s1;
  548. return s0;
  549. }
  550. function peg$parsemessageFormatElement() {
  551. var s0;
  552. s0 = peg$parsemessageTextElement();
  553. if (s0 === peg$FAILED) {
  554. s0 = peg$parseargumentElement();
  555. }
  556. return s0;
  557. }
  558. function peg$parsemessageText() {
  559. var s0, s1, s2, s3, s4, s5;
  560. s0 = peg$currPos;
  561. s1 = [];
  562. s2 = peg$currPos;
  563. s3 = peg$parse_();
  564. if (s3 !== peg$FAILED) {
  565. s4 = peg$parsechars();
  566. if (s4 !== peg$FAILED) {
  567. s5 = peg$parse_();
  568. if (s5 !== peg$FAILED) {
  569. s3 = [s3, s4, s5];
  570. s2 = s3;
  571. } else {
  572. peg$currPos = s2;
  573. s2 = peg$FAILED;
  574. }
  575. } else {
  576. peg$currPos = s2;
  577. s2 = peg$FAILED;
  578. }
  579. } else {
  580. peg$currPos = s2;
  581. s2 = peg$FAILED;
  582. }
  583. if (s2 !== peg$FAILED) {
  584. while (s2 !== peg$FAILED) {
  585. s1.push(s2);
  586. s2 = peg$currPos;
  587. s3 = peg$parse_();
  588. if (s3 !== peg$FAILED) {
  589. s4 = peg$parsechars();
  590. if (s4 !== peg$FAILED) {
  591. s5 = peg$parse_();
  592. if (s5 !== peg$FAILED) {
  593. s3 = [s3, s4, s5];
  594. s2 = s3;
  595. } else {
  596. peg$currPos = s2;
  597. s2 = peg$FAILED;
  598. }
  599. } else {
  600. peg$currPos = s2;
  601. s2 = peg$FAILED;
  602. }
  603. } else {
  604. peg$currPos = s2;
  605. s2 = peg$FAILED;
  606. }
  607. }
  608. } else {
  609. s1 = peg$FAILED;
  610. }
  611. if (s1 !== peg$FAILED) {
  612. peg$savedPos = s0;
  613. s1 = peg$c1(s1);
  614. }
  615. s0 = s1;
  616. if (s0 === peg$FAILED) {
  617. s0 = peg$currPos;
  618. s1 = peg$parsews();
  619. if (s1 !== peg$FAILED) {
  620. s0 = input.substring(s0, peg$currPos);
  621. } else {
  622. s0 = s1;
  623. }
  624. }
  625. return s0;
  626. }
  627. function peg$parsemessageTextElement() {
  628. var s0, s1;
  629. s0 = peg$currPos;
  630. s1 = peg$parsemessageText();
  631. if (s1 !== peg$FAILED) {
  632. peg$savedPos = s0;
  633. s1 = peg$c2(s1);
  634. }
  635. s0 = s1;
  636. return s0;
  637. }
  638. function peg$parseargument() {
  639. var s0, s1, s2;
  640. s0 = peg$parsenumber();
  641. if (s0 === peg$FAILED) {
  642. s0 = peg$currPos;
  643. s1 = [];
  644. if (peg$c3.test(input.charAt(peg$currPos))) {
  645. s2 = input.charAt(peg$currPos);
  646. peg$currPos++;
  647. } else {
  648. s2 = peg$FAILED;
  649. if (peg$silentFails === 0) { peg$fail(peg$c4); }
  650. }
  651. if (s2 !== peg$FAILED) {
  652. while (s2 !== peg$FAILED) {
  653. s1.push(s2);
  654. if (peg$c3.test(input.charAt(peg$currPos))) {
  655. s2 = input.charAt(peg$currPos);
  656. peg$currPos++;
  657. } else {
  658. s2 = peg$FAILED;
  659. if (peg$silentFails === 0) { peg$fail(peg$c4); }
  660. }
  661. }
  662. } else {
  663. s1 = peg$FAILED;
  664. }
  665. if (s1 !== peg$FAILED) {
  666. s0 = input.substring(s0, peg$currPos);
  667. } else {
  668. s0 = s1;
  669. }
  670. }
  671. return s0;
  672. }
  673. function peg$parseargumentElement() {
  674. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  675. s0 = peg$currPos;
  676. if (input.charCodeAt(peg$currPos) === 123) {
  677. s1 = peg$c5;
  678. peg$currPos++;
  679. } else {
  680. s1 = peg$FAILED;
  681. if (peg$silentFails === 0) { peg$fail(peg$c6); }
  682. }
  683. if (s1 !== peg$FAILED) {
  684. s2 = peg$parse_();
  685. if (s2 !== peg$FAILED) {
  686. s3 = peg$parseargument();
  687. if (s3 !== peg$FAILED) {
  688. s4 = peg$parse_();
  689. if (s4 !== peg$FAILED) {
  690. s5 = peg$currPos;
  691. if (input.charCodeAt(peg$currPos) === 44) {
  692. s6 = peg$c7;
  693. peg$currPos++;
  694. } else {
  695. s6 = peg$FAILED;
  696. if (peg$silentFails === 0) { peg$fail(peg$c8); }
  697. }
  698. if (s6 !== peg$FAILED) {
  699. s7 = peg$parse_();
  700. if (s7 !== peg$FAILED) {
  701. s8 = peg$parseelementFormat();
  702. if (s8 !== peg$FAILED) {
  703. s6 = [s6, s7, s8];
  704. s5 = s6;
  705. } else {
  706. peg$currPos = s5;
  707. s5 = peg$FAILED;
  708. }
  709. } else {
  710. peg$currPos = s5;
  711. s5 = peg$FAILED;
  712. }
  713. } else {
  714. peg$currPos = s5;
  715. s5 = peg$FAILED;
  716. }
  717. if (s5 === peg$FAILED) {
  718. s5 = null;
  719. }
  720. if (s5 !== peg$FAILED) {
  721. s6 = peg$parse_();
  722. if (s6 !== peg$FAILED) {
  723. if (input.charCodeAt(peg$currPos) === 125) {
  724. s7 = peg$c9;
  725. peg$currPos++;
  726. } else {
  727. s7 = peg$FAILED;
  728. if (peg$silentFails === 0) { peg$fail(peg$c10); }
  729. }
  730. if (s7 !== peg$FAILED) {
  731. peg$savedPos = s0;
  732. s1 = peg$c11(s3, s5);
  733. s0 = s1;
  734. } else {
  735. peg$currPos = s0;
  736. s0 = peg$FAILED;
  737. }
  738. } else {
  739. peg$currPos = s0;
  740. s0 = peg$FAILED;
  741. }
  742. } else {
  743. peg$currPos = s0;
  744. s0 = peg$FAILED;
  745. }
  746. } else {
  747. peg$currPos = s0;
  748. s0 = peg$FAILED;
  749. }
  750. } else {
  751. peg$currPos = s0;
  752. s0 = peg$FAILED;
  753. }
  754. } else {
  755. peg$currPos = s0;
  756. s0 = peg$FAILED;
  757. }
  758. } else {
  759. peg$currPos = s0;
  760. s0 = peg$FAILED;
  761. }
  762. return s0;
  763. }
  764. function peg$parseelementFormat() {
  765. var s0;
  766. s0 = peg$parsesimpleFormat();
  767. if (s0 === peg$FAILED) {
  768. s0 = peg$parsepluralFormat();
  769. if (s0 === peg$FAILED) {
  770. s0 = peg$parseselectOrdinalFormat();
  771. if (s0 === peg$FAILED) {
  772. s0 = peg$parseselectFormat();
  773. }
  774. }
  775. }
  776. return s0;
  777. }
  778. function peg$parsesimpleFormat() {
  779. var s0, s1, s2, s3, s4, s5, s6;
  780. s0 = peg$currPos;
  781. if (input.substr(peg$currPos, 6) === peg$c12) {
  782. s1 = peg$c12;
  783. peg$currPos += 6;
  784. } else {
  785. s1 = peg$FAILED;
  786. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  787. }
  788. if (s1 === peg$FAILED) {
  789. if (input.substr(peg$currPos, 4) === peg$c14) {
  790. s1 = peg$c14;
  791. peg$currPos += 4;
  792. } else {
  793. s1 = peg$FAILED;
  794. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  795. }
  796. if (s1 === peg$FAILED) {
  797. if (input.substr(peg$currPos, 4) === peg$c16) {
  798. s1 = peg$c16;
  799. peg$currPos += 4;
  800. } else {
  801. s1 = peg$FAILED;
  802. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  803. }
  804. }
  805. }
  806. if (s1 !== peg$FAILED) {
  807. s2 = peg$parse_();
  808. if (s2 !== peg$FAILED) {
  809. s3 = peg$currPos;
  810. if (input.charCodeAt(peg$currPos) === 44) {
  811. s4 = peg$c7;
  812. peg$currPos++;
  813. } else {
  814. s4 = peg$FAILED;
  815. if (peg$silentFails === 0) { peg$fail(peg$c8); }
  816. }
  817. if (s4 !== peg$FAILED) {
  818. s5 = peg$parse_();
  819. if (s5 !== peg$FAILED) {
  820. s6 = peg$parsechars();
  821. if (s6 !== peg$FAILED) {
  822. s4 = [s4, s5, s6];
  823. s3 = s4;
  824. } else {
  825. peg$currPos = s3;
  826. s3 = peg$FAILED;
  827. }
  828. } else {
  829. peg$currPos = s3;
  830. s3 = peg$FAILED;
  831. }
  832. } else {
  833. peg$currPos = s3;
  834. s3 = peg$FAILED;
  835. }
  836. if (s3 === peg$FAILED) {
  837. s3 = null;
  838. }
  839. if (s3 !== peg$FAILED) {
  840. peg$savedPos = s0;
  841. s1 = peg$c18(s1, s3);
  842. s0 = s1;
  843. } else {
  844. peg$currPos = s0;
  845. s0 = peg$FAILED;
  846. }
  847. } else {
  848. peg$currPos = s0;
  849. s0 = peg$FAILED;
  850. }
  851. } else {
  852. peg$currPos = s0;
  853. s0 = peg$FAILED;
  854. }
  855. return s0;
  856. }
  857. function peg$parsepluralFormat() {
  858. var s0, s1, s2, s3, s4, s5;
  859. s0 = peg$currPos;
  860. if (input.substr(peg$currPos, 6) === peg$c19) {
  861. s1 = peg$c19;
  862. peg$currPos += 6;
  863. } else {
  864. s1 = peg$FAILED;
  865. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  866. }
  867. if (s1 !== peg$FAILED) {
  868. s2 = peg$parse_();
  869. if (s2 !== peg$FAILED) {
  870. if (input.charCodeAt(peg$currPos) === 44) {
  871. s3 = peg$c7;
  872. peg$currPos++;
  873. } else {
  874. s3 = peg$FAILED;
  875. if (peg$silentFails === 0) { peg$fail(peg$c8); }
  876. }
  877. if (s3 !== peg$FAILED) {
  878. s4 = peg$parse_();
  879. if (s4 !== peg$FAILED) {
  880. s5 = peg$parsepluralStyle();
  881. if (s5 !== peg$FAILED) {
  882. peg$savedPos = s0;
  883. s1 = peg$c21(s5);
  884. s0 = s1;
  885. } else {
  886. peg$currPos = s0;
  887. s0 = peg$FAILED;
  888. }
  889. } else {
  890. peg$currPos = s0;
  891. s0 = peg$FAILED;
  892. }
  893. } else {
  894. peg$currPos = s0;
  895. s0 = peg$FAILED;
  896. }
  897. } else {
  898. peg$currPos = s0;
  899. s0 = peg$FAILED;
  900. }
  901. } else {
  902. peg$currPos = s0;
  903. s0 = peg$FAILED;
  904. }
  905. return s0;
  906. }
  907. function peg$parseselectOrdinalFormat() {
  908. var s0, s1, s2, s3, s4, s5;
  909. s0 = peg$currPos;
  910. if (input.substr(peg$currPos, 13) === peg$c22) {
  911. s1 = peg$c22;
  912. peg$currPos += 13;
  913. } else {
  914. s1 = peg$FAILED;
  915. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  916. }
  917. if (s1 !== peg$FAILED) {
  918. s2 = peg$parse_();
  919. if (s2 !== peg$FAILED) {
  920. if (input.charCodeAt(peg$currPos) === 44) {
  921. s3 = peg$c7;
  922. peg$currPos++;
  923. } else {
  924. s3 = peg$FAILED;
  925. if (peg$silentFails === 0) { peg$fail(peg$c8); }
  926. }
  927. if (s3 !== peg$FAILED) {
  928. s4 = peg$parse_();
  929. if (s4 !== peg$FAILED) {
  930. s5 = peg$parsepluralStyle();
  931. if (s5 !== peg$FAILED) {
  932. peg$savedPos = s0;
  933. s1 = peg$c24(s5);
  934. s0 = s1;
  935. } else {
  936. peg$currPos = s0;
  937. s0 = peg$FAILED;
  938. }
  939. } else {
  940. peg$currPos = s0;
  941. s0 = peg$FAILED;
  942. }
  943. } else {
  944. peg$currPos = s0;
  945. s0 = peg$FAILED;
  946. }
  947. } else {
  948. peg$currPos = s0;
  949. s0 = peg$FAILED;
  950. }
  951. } else {
  952. peg$currPos = s0;
  953. s0 = peg$FAILED;
  954. }
  955. return s0;
  956. }
  957. function peg$parseselectFormat() {
  958. var s0, s1, s2, s3, s4, s5, s6;
  959. s0 = peg$currPos;
  960. if (input.substr(peg$currPos, 6) === peg$c25) {
  961. s1 = peg$c25;
  962. peg$currPos += 6;
  963. } else {
  964. s1 = peg$FAILED;
  965. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  966. }
  967. if (s1 !== peg$FAILED) {
  968. s2 = peg$parse_();
  969. if (s2 !== peg$FAILED) {
  970. if (input.charCodeAt(peg$currPos) === 44) {
  971. s3 = peg$c7;
  972. peg$currPos++;
  973. } else {
  974. s3 = peg$FAILED;
  975. if (peg$silentFails === 0) { peg$fail(peg$c8); }
  976. }
  977. if (s3 !== peg$FAILED) {
  978. s4 = peg$parse_();
  979. if (s4 !== peg$FAILED) {
  980. s5 = [];
  981. s6 = peg$parseoptionalFormatPattern();
  982. if (s6 !== peg$FAILED) {
  983. while (s6 !== peg$FAILED) {
  984. s5.push(s6);
  985. s6 = peg$parseoptionalFormatPattern();
  986. }
  987. } else {
  988. s5 = peg$FAILED;
  989. }
  990. if (s5 !== peg$FAILED) {
  991. peg$savedPos = s0;
  992. s1 = peg$c27(s5);
  993. s0 = s1;
  994. } else {
  995. peg$currPos = s0;
  996. s0 = peg$FAILED;
  997. }
  998. } else {
  999. peg$currPos = s0;
  1000. s0 = peg$FAILED;
  1001. }
  1002. } else {
  1003. peg$currPos = s0;
  1004. s0 = peg$FAILED;
  1005. }
  1006. } else {
  1007. peg$currPos = s0;
  1008. s0 = peg$FAILED;
  1009. }
  1010. } else {
  1011. peg$currPos = s0;
  1012. s0 = peg$FAILED;
  1013. }
  1014. return s0;
  1015. }
  1016. function peg$parseselector() {
  1017. var s0, s1, s2, s3;
  1018. s0 = peg$currPos;
  1019. s1 = peg$currPos;
  1020. if (input.charCodeAt(peg$currPos) === 61) {
  1021. s2 = peg$c28;
  1022. peg$currPos++;
  1023. } else {
  1024. s2 = peg$FAILED;
  1025. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  1026. }
  1027. if (s2 !== peg$FAILED) {
  1028. s3 = peg$parsenumber();
  1029. if (s3 !== peg$FAILED) {
  1030. s2 = [s2, s3];
  1031. s1 = s2;
  1032. } else {
  1033. peg$currPos = s1;
  1034. s1 = peg$FAILED;
  1035. }
  1036. } else {
  1037. peg$currPos = s1;
  1038. s1 = peg$FAILED;
  1039. }
  1040. if (s1 !== peg$FAILED) {
  1041. s0 = input.substring(s0, peg$currPos);
  1042. } else {
  1043. s0 = s1;
  1044. }
  1045. if (s0 === peg$FAILED) {
  1046. s0 = peg$parsechars();
  1047. }
  1048. return s0;
  1049. }
  1050. function peg$parseoptionalFormatPattern() {
  1051. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  1052. s0 = peg$currPos;
  1053. s1 = peg$parse_();
  1054. if (s1 !== peg$FAILED) {
  1055. s2 = peg$parseselector();
  1056. if (s2 !== peg$FAILED) {
  1057. s3 = peg$parse_();
  1058. if (s3 !== peg$FAILED) {
  1059. if (input.charCodeAt(peg$currPos) === 123) {
  1060. s4 = peg$c5;
  1061. peg$currPos++;
  1062. } else {
  1063. s4 = peg$FAILED;
  1064. if (peg$silentFails === 0) { peg$fail(peg$c6); }
  1065. }
  1066. if (s4 !== peg$FAILED) {
  1067. s5 = peg$parse_();
  1068. if (s5 !== peg$FAILED) {
  1069. s6 = peg$parsemessageFormatPattern();
  1070. if (s6 !== peg$FAILED) {
  1071. s7 = peg$parse_();
  1072. if (s7 !== peg$FAILED) {
  1073. if (input.charCodeAt(peg$currPos) === 125) {
  1074. s8 = peg$c9;
  1075. peg$currPos++;
  1076. } else {
  1077. s8 = peg$FAILED;
  1078. if (peg$silentFails === 0) { peg$fail(peg$c10); }
  1079. }
  1080. if (s8 !== peg$FAILED) {
  1081. peg$savedPos = s0;
  1082. s1 = peg$c30(s2, s6);
  1083. s0 = s1;
  1084. } else {
  1085. peg$currPos = s0;
  1086. s0 = peg$FAILED;
  1087. }
  1088. } else {
  1089. peg$currPos = s0;
  1090. s0 = peg$FAILED;
  1091. }
  1092. } else {
  1093. peg$currPos = s0;
  1094. s0 = peg$FAILED;
  1095. }
  1096. } else {
  1097. peg$currPos = s0;
  1098. s0 = peg$FAILED;
  1099. }
  1100. } else {
  1101. peg$currPos = s0;
  1102. s0 = peg$FAILED;
  1103. }
  1104. } else {
  1105. peg$currPos = s0;
  1106. s0 = peg$FAILED;
  1107. }
  1108. } else {
  1109. peg$currPos = s0;
  1110. s0 = peg$FAILED;
  1111. }
  1112. } else {
  1113. peg$currPos = s0;
  1114. s0 = peg$FAILED;
  1115. }
  1116. return s0;
  1117. }
  1118. function peg$parseoffset() {
  1119. var s0, s1, s2, s3;
  1120. s0 = peg$currPos;
  1121. if (input.substr(peg$currPos, 7) === peg$c31) {
  1122. s1 = peg$c31;
  1123. peg$currPos += 7;
  1124. } else {
  1125. s1 = peg$FAILED;
  1126. if (peg$silentFails === 0) { peg$fail(peg$c32); }
  1127. }
  1128. if (s1 !== peg$FAILED) {
  1129. s2 = peg$parse_();
  1130. if (s2 !== peg$FAILED) {
  1131. s3 = peg$parsenumber();
  1132. if (s3 !== peg$FAILED) {
  1133. peg$savedPos = s0;
  1134. s1 = peg$c33(s3);
  1135. s0 = s1;
  1136. } else {
  1137. peg$currPos = s0;
  1138. s0 = peg$FAILED;
  1139. }
  1140. } else {
  1141. peg$currPos = s0;
  1142. s0 = peg$FAILED;
  1143. }
  1144. } else {
  1145. peg$currPos = s0;
  1146. s0 = peg$FAILED;
  1147. }
  1148. return s0;
  1149. }
  1150. function peg$parsepluralStyle() {
  1151. var s0, s1, s2, s3, s4;
  1152. s0 = peg$currPos;
  1153. s1 = peg$parseoffset();
  1154. if (s1 === peg$FAILED) {
  1155. s1 = null;
  1156. }
  1157. if (s1 !== peg$FAILED) {
  1158. s2 = peg$parse_();
  1159. if (s2 !== peg$FAILED) {
  1160. s3 = [];
  1161. s4 = peg$parseoptionalFormatPattern();
  1162. if (s4 !== peg$FAILED) {
  1163. while (s4 !== peg$FAILED) {
  1164. s3.push(s4);
  1165. s4 = peg$parseoptionalFormatPattern();
  1166. }
  1167. } else {
  1168. s3 = peg$FAILED;
  1169. }
  1170. if (s3 !== peg$FAILED) {
  1171. peg$savedPos = s0;
  1172. s1 = peg$c34(s1, s3);
  1173. s0 = s1;
  1174. } else {
  1175. peg$currPos = s0;
  1176. s0 = peg$FAILED;
  1177. }
  1178. } else {
  1179. peg$currPos = s0;
  1180. s0 = peg$FAILED;
  1181. }
  1182. } else {
  1183. peg$currPos = s0;
  1184. s0 = peg$FAILED;
  1185. }
  1186. return s0;
  1187. }
  1188. function peg$parsews() {
  1189. var s0, s1;
  1190. peg$silentFails++;
  1191. s0 = [];
  1192. if (peg$c36.test(input.charAt(peg$currPos))) {
  1193. s1 = input.charAt(peg$currPos);
  1194. peg$currPos++;
  1195. } else {
  1196. s1 = peg$FAILED;
  1197. if (peg$silentFails === 0) { peg$fail(peg$c37); }
  1198. }
  1199. if (s1 !== peg$FAILED) {
  1200. while (s1 !== peg$FAILED) {
  1201. s0.push(s1);
  1202. if (peg$c36.test(input.charAt(peg$currPos))) {
  1203. s1 = input.charAt(peg$currPos);
  1204. peg$currPos++;
  1205. } else {
  1206. s1 = peg$FAILED;
  1207. if (peg$silentFails === 0) { peg$fail(peg$c37); }
  1208. }
  1209. }
  1210. } else {
  1211. s0 = peg$FAILED;
  1212. }
  1213. peg$silentFails--;
  1214. if (s0 === peg$FAILED) {
  1215. s1 = peg$FAILED;
  1216. if (peg$silentFails === 0) { peg$fail(peg$c35); }
  1217. }
  1218. return s0;
  1219. }
  1220. function peg$parse_() {
  1221. var s0, s1, s2;
  1222. peg$silentFails++;
  1223. s0 = peg$currPos;
  1224. s1 = [];
  1225. s2 = peg$parsews();
  1226. while (s2 !== peg$FAILED) {
  1227. s1.push(s2);
  1228. s2 = peg$parsews();
  1229. }
  1230. if (s1 !== peg$FAILED) {
  1231. s0 = input.substring(s0, peg$currPos);
  1232. } else {
  1233. s0 = s1;
  1234. }
  1235. peg$silentFails--;
  1236. if (s0 === peg$FAILED) {
  1237. s1 = peg$FAILED;
  1238. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  1239. }
  1240. return s0;
  1241. }
  1242. function peg$parsedigit() {
  1243. var s0;
  1244. if (peg$c39.test(input.charAt(peg$currPos))) {
  1245. s0 = input.charAt(peg$currPos);
  1246. peg$currPos++;
  1247. } else {
  1248. s0 = peg$FAILED;
  1249. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  1250. }
  1251. return s0;
  1252. }
  1253. function peg$parsehexDigit() {
  1254. var s0;
  1255. if (peg$c41.test(input.charAt(peg$currPos))) {
  1256. s0 = input.charAt(peg$currPos);
  1257. peg$currPos++;
  1258. } else {
  1259. s0 = peg$FAILED;
  1260. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  1261. }
  1262. return s0;
  1263. }
  1264. function peg$parsenumber() {
  1265. var s0, s1, s2, s3, s4, s5;
  1266. s0 = peg$currPos;
  1267. if (input.charCodeAt(peg$currPos) === 48) {
  1268. s1 = peg$c43;
  1269. peg$currPos++;
  1270. } else {
  1271. s1 = peg$FAILED;
  1272. if (peg$silentFails === 0) { peg$fail(peg$c44); }
  1273. }
  1274. if (s1 === peg$FAILED) {
  1275. s1 = peg$currPos;
  1276. s2 = peg$currPos;
  1277. if (peg$c45.test(input.charAt(peg$currPos))) {
  1278. s3 = input.charAt(peg$currPos);
  1279. peg$currPos++;
  1280. } else {
  1281. s3 = peg$FAILED;
  1282. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  1283. }
  1284. if (s3 !== peg$FAILED) {
  1285. s4 = [];
  1286. s5 = peg$parsedigit();
  1287. while (s5 !== peg$FAILED) {
  1288. s4.push(s5);
  1289. s5 = peg$parsedigit();
  1290. }
  1291. if (s4 !== peg$FAILED) {
  1292. s3 = [s3, s4];
  1293. s2 = s3;
  1294. } else {
  1295. peg$currPos = s2;
  1296. s2 = peg$FAILED;
  1297. }
  1298. } else {
  1299. peg$currPos = s2;
  1300. s2 = peg$FAILED;
  1301. }
  1302. if (s2 !== peg$FAILED) {
  1303. s1 = input.substring(s1, peg$currPos);
  1304. } else {
  1305. s1 = s2;
  1306. }
  1307. }
  1308. if (s1 !== peg$FAILED) {
  1309. peg$savedPos = s0;
  1310. s1 = peg$c47(s1);
  1311. }
  1312. s0 = s1;
  1313. return s0;
  1314. }
  1315. function peg$parsechar() {
  1316. var s0, s1, s2, s3, s4, s5, s6, s7;
  1317. if (peg$c48.test(input.charAt(peg$currPos))) {
  1318. s0 = input.charAt(peg$currPos);
  1319. peg$currPos++;
  1320. } else {
  1321. s0 = peg$FAILED;
  1322. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  1323. }
  1324. if (s0 === peg$FAILED) {
  1325. s0 = peg$currPos;
  1326. if (input.substr(peg$currPos, 2) === peg$c50) {
  1327. s1 = peg$c50;
  1328. peg$currPos += 2;
  1329. } else {
  1330. s1 = peg$FAILED;
  1331. if (peg$silentFails === 0) { peg$fail(peg$c51); }
  1332. }
  1333. if (s1 !== peg$FAILED) {
  1334. peg$savedPos = s0;
  1335. s1 = peg$c52();
  1336. }
  1337. s0 = s1;
  1338. if (s0 === peg$FAILED) {
  1339. s0 = peg$currPos;
  1340. if (input.substr(peg$currPos, 2) === peg$c53) {
  1341. s1 = peg$c53;
  1342. peg$currPos += 2;
  1343. } else {
  1344. s1 = peg$FAILED;
  1345. if (peg$silentFails === 0) { peg$fail(peg$c54); }
  1346. }
  1347. if (s1 !== peg$FAILED) {
  1348. peg$savedPos = s0;
  1349. s1 = peg$c55();
  1350. }
  1351. s0 = s1;
  1352. if (s0 === peg$FAILED) {
  1353. s0 = peg$currPos;
  1354. if (input.substr(peg$currPos, 2) === peg$c56) {
  1355. s1 = peg$c56;
  1356. peg$currPos += 2;
  1357. } else {
  1358. s1 = peg$FAILED;
  1359. if (peg$silentFails === 0) { peg$fail(peg$c57); }
  1360. }
  1361. if (s1 !== peg$FAILED) {
  1362. peg$savedPos = s0;
  1363. s1 = peg$c58();
  1364. }
  1365. s0 = s1;
  1366. if (s0 === peg$FAILED) {
  1367. s0 = peg$currPos;
  1368. if (input.substr(peg$currPos, 2) === peg$c59) {
  1369. s1 = peg$c59;
  1370. peg$currPos += 2;
  1371. } else {
  1372. s1 = peg$FAILED;
  1373. if (peg$silentFails === 0) { peg$fail(peg$c60); }
  1374. }
  1375. if (s1 !== peg$FAILED) {
  1376. peg$savedPos = s0;
  1377. s1 = peg$c61();
  1378. }
  1379. s0 = s1;
  1380. if (s0 === peg$FAILED) {
  1381. s0 = peg$currPos;
  1382. if (input.substr(peg$currPos, 2) === peg$c62) {
  1383. s1 = peg$c62;
  1384. peg$currPos += 2;
  1385. } else {
  1386. s1 = peg$FAILED;
  1387. if (peg$silentFails === 0) { peg$fail(peg$c63); }
  1388. }
  1389. if (s1 !== peg$FAILED) {
  1390. s2 = peg$currPos;
  1391. s3 = peg$currPos;
  1392. s4 = peg$parsehexDigit();
  1393. if (s4 !== peg$FAILED) {
  1394. s5 = peg$parsehexDigit();
  1395. if (s5 !== peg$FAILED) {
  1396. s6 = peg$parsehexDigit();
  1397. if (s6 !== peg$FAILED) {
  1398. s7 = peg$parsehexDigit();
  1399. if (s7 !== peg$FAILED) {
  1400. s4 = [s4, s5, s6, s7];
  1401. s3 = s4;
  1402. } else {
  1403. peg$currPos = s3;
  1404. s3 = peg$FAILED;
  1405. }
  1406. } else {
  1407. peg$currPos = s3;
  1408. s3 = peg$FAILED;
  1409. }
  1410. } else {
  1411. peg$currPos = s3;
  1412. s3 = peg$FAILED;
  1413. }
  1414. } else {
  1415. peg$currPos = s3;
  1416. s3 = peg$FAILED;
  1417. }
  1418. if (s3 !== peg$FAILED) {
  1419. s2 = input.substring(s2, peg$currPos);
  1420. } else {
  1421. s2 = s3;
  1422. }
  1423. if (s2 !== peg$FAILED) {
  1424. peg$savedPos = s0;
  1425. s1 = peg$c64(s2);
  1426. s0 = s1;
  1427. } else {
  1428. peg$currPos = s0;
  1429. s0 = peg$FAILED;
  1430. }
  1431. } else {
  1432. peg$currPos = s0;
  1433. s0 = peg$FAILED;
  1434. }
  1435. }
  1436. }
  1437. }
  1438. }
  1439. }
  1440. return s0;
  1441. }
  1442. function peg$parsechars() {
  1443. var s0, s1, s2;
  1444. s0 = peg$currPos;
  1445. s1 = [];
  1446. s2 = peg$parsechar();
  1447. if (s2 !== peg$FAILED) {
  1448. while (s2 !== peg$FAILED) {
  1449. s1.push(s2);
  1450. s2 = peg$parsechar();
  1451. }
  1452. } else {
  1453. s1 = peg$FAILED;
  1454. }
  1455. if (s1 !== peg$FAILED) {
  1456. peg$savedPos = s0;
  1457. s1 = peg$c65(s1);
  1458. }
  1459. s0 = s1;
  1460. return s0;
  1461. }
  1462. peg$result = peg$startRuleFunction();
  1463. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  1464. return peg$result;
  1465. } else {
  1466. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  1467. peg$fail({ type: "end", description: "end of input" });
  1468. }
  1469. throw peg$buildException(
  1470. null,
  1471. peg$maxFailExpected,
  1472. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  1473. peg$maxFailPos < input.length
  1474. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  1475. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  1476. );
  1477. }
  1478. }
  1479. return {
  1480. SyntaxError: peg$SyntaxError,
  1481. parse: peg$parse
  1482. };
  1483. })();
  1484. });
  1485. var intlMessageformatParser = createCommonjsModule(function (module, exports) {
  1486. exports = module.exports = parser['default'];
  1487. exports['default'] = exports;
  1488. });
  1489. var core = createCommonjsModule(function (module, exports) {
  1490. exports["default"] = MessageFormat;
  1491. // -- MessageFormat --------------------------------------------------------
  1492. function MessageFormat(message, locales, formats) {
  1493. // Parse string messages into an AST.
  1494. var ast = typeof message === 'string' ?
  1495. MessageFormat.__parse(message) : message;
  1496. if (!(ast && ast.type === 'messageFormatPattern')) {
  1497. throw new TypeError('A message must be provided as a String or AST.');
  1498. }
  1499. // Creates a new object with the specified `formats` merged with the default
  1500. // formats.
  1501. formats = this._mergeFormats(MessageFormat.formats, formats);
  1502. // Defined first because it's used to build the format pattern.
  1503. es5.defineProperty(this, '_locale', {value: this._resolveLocale(locales)});
  1504. // Compile the `ast` to a pattern that is highly optimized for repeated
  1505. // `format()` invocations. **Note:** This passes the `locales` set provided
  1506. // to the constructor instead of just the resolved locale.
  1507. var pluralFn = this._findPluralRuleFunction(this._locale);
  1508. var pattern = this._compilePattern(ast, locales, formats, pluralFn);
  1509. // "Bind" `format()` method to `this` so it can be passed by reference like
  1510. // the other `Intl` APIs.
  1511. var messageFormat = this;
  1512. this.format = function (values) {
  1513. try {
  1514. return messageFormat._format(pattern, values);
  1515. } catch (e) {
  1516. if (e.variableId) {
  1517. throw new Error(
  1518. 'The intl string context variable \'' + e.variableId + '\'' +
  1519. ' was not provided to the string \'' + message + '\''
  1520. );
  1521. } else {
  1522. throw e;
  1523. }
  1524. }
  1525. };
  1526. }
  1527. // Default format options used as the prototype of the `formats` provided to the
  1528. // constructor. These are used when constructing the internal Intl.NumberFormat
  1529. // and Intl.DateTimeFormat instances.
  1530. es5.defineProperty(MessageFormat, 'formats', {
  1531. enumerable: true,
  1532. value: {
  1533. number: {
  1534. 'currency': {
  1535. style: 'currency'
  1536. },
  1537. 'percent': {
  1538. style: 'percent'
  1539. }
  1540. },
  1541. date: {
  1542. 'short': {
  1543. month: 'numeric',
  1544. day : 'numeric',
  1545. year : '2-digit'
  1546. },
  1547. 'medium': {
  1548. month: 'short',
  1549. day : 'numeric',
  1550. year : 'numeric'
  1551. },
  1552. 'long': {
  1553. month: 'long',
  1554. day : 'numeric',
  1555. year : 'numeric'
  1556. },
  1557. 'full': {
  1558. weekday: 'long',
  1559. month : 'long',
  1560. day : 'numeric',
  1561. year : 'numeric'
  1562. }
  1563. },
  1564. time: {
  1565. 'short': {
  1566. hour : 'numeric',
  1567. minute: 'numeric'
  1568. },
  1569. 'medium': {
  1570. hour : 'numeric',
  1571. minute: 'numeric',
  1572. second: 'numeric'
  1573. },
  1574. 'long': {
  1575. hour : 'numeric',
  1576. minute : 'numeric',
  1577. second : 'numeric',
  1578. timeZoneName: 'short'
  1579. },
  1580. 'full': {
  1581. hour : 'numeric',
  1582. minute : 'numeric',
  1583. second : 'numeric',
  1584. timeZoneName: 'short'
  1585. }
  1586. }
  1587. }
  1588. });
  1589. // Define internal private properties for dealing with locale data.
  1590. es5.defineProperty(MessageFormat, '__localeData__', {value: es5.objCreate(null)});
  1591. es5.defineProperty(MessageFormat, '__addLocaleData', {value: function (data) {
  1592. if (!(data && data.locale)) {
  1593. throw new Error(
  1594. 'Locale data provided to IntlMessageFormat is missing a ' +
  1595. '`locale` property'
  1596. );
  1597. }
  1598. MessageFormat.__localeData__[data.locale.toLowerCase()] = data;
  1599. }});
  1600. // Defines `__parse()` static method as an exposed private.
  1601. es5.defineProperty(MessageFormat, '__parse', {value: intlMessageformatParser["default"].parse});
  1602. // Define public `defaultLocale` property which defaults to English, but can be
  1603. // set by the developer.
  1604. es5.defineProperty(MessageFormat, 'defaultLocale', {
  1605. enumerable: true,
  1606. writable : true,
  1607. value : undefined
  1608. });
  1609. MessageFormat.prototype.resolvedOptions = function () {
  1610. // TODO: Provide anything else?
  1611. return {
  1612. locale: this._locale
  1613. };
  1614. };
  1615. MessageFormat.prototype._compilePattern = function (ast, locales, formats, pluralFn) {
  1616. var compiler$1 = new compiler["default"](locales, formats, pluralFn);
  1617. return compiler$1.compile(ast);
  1618. };
  1619. MessageFormat.prototype._findPluralRuleFunction = function (locale) {
  1620. var localeData = MessageFormat.__localeData__;
  1621. var data = localeData[locale.toLowerCase()];
  1622. // The locale data is de-duplicated, so we have to traverse the locale's
  1623. // hierarchy until we find a `pluralRuleFunction` to return.
  1624. while (data) {
  1625. if (data.pluralRuleFunction) {
  1626. return data.pluralRuleFunction;
  1627. }
  1628. data = data.parentLocale && localeData[data.parentLocale.toLowerCase()];
  1629. }
  1630. throw new Error(
  1631. 'Locale data added to IntlMessageFormat is missing a ' +
  1632. '`pluralRuleFunction` for :' + locale
  1633. );
  1634. };
  1635. MessageFormat.prototype._format = function (pattern, values) {
  1636. var result = '',
  1637. i, len, part, id, value, err;
  1638. for (i = 0, len = pattern.length; i < len; i += 1) {
  1639. part = pattern[i];
  1640. // Exist early for string parts.
  1641. if (typeof part === 'string') {
  1642. result += part;
  1643. continue;
  1644. }
  1645. id = part.id;
  1646. // Enforce that all required values are provided by the caller.
  1647. if (!(values && utils.hop.call(values, id))) {
  1648. err = new Error('A value must be provided for: ' + id);
  1649. err.variableId = id;
  1650. throw err;
  1651. }
  1652. value = values[id];
  1653. // Recursively format plural and select parts' option — which can be a
  1654. // nested pattern structure. The choosing of the option to use is
  1655. // abstracted-by and delegated-to the part helper object.
  1656. if (part.options) {
  1657. result += this._format(part.getOption(value), values);
  1658. } else {
  1659. result += part.format(value);
  1660. }
  1661. }
  1662. return result;
  1663. };
  1664. MessageFormat.prototype._mergeFormats = function (defaults, formats) {
  1665. var mergedFormats = {},
  1666. type, mergedType;
  1667. for (type in defaults) {
  1668. if (!utils.hop.call(defaults, type)) { continue; }
  1669. mergedFormats[type] = mergedType = es5.objCreate(defaults[type]);
  1670. if (formats && utils.hop.call(formats, type)) {
  1671. utils.extend(mergedType, formats[type]);
  1672. }
  1673. }
  1674. return mergedFormats;
  1675. };
  1676. MessageFormat.prototype._resolveLocale = function (locales) {
  1677. if (typeof locales === 'string') {
  1678. locales = [locales];
  1679. }
  1680. // Create a copy of the array so we can push on the default locale.
  1681. locales = (locales || []).concat(MessageFormat.defaultLocale);
  1682. var localeData = MessageFormat.__localeData__;
  1683. var i, len, localeParts, data;
  1684. // Using the set of locales + the default locale, we look for the first one
  1685. // which that has been registered. When data does not exist for a locale, we
  1686. // traverse its ancestors to find something that's been registered within
  1687. // its hierarchy of locales. Since we lack the proper `parentLocale` data
  1688. // here, we must take a naive approach to traversal.
  1689. for (i = 0, len = locales.length; i < len; i += 1) {
  1690. localeParts = locales[i].toLowerCase().split('-');
  1691. while (localeParts.length) {
  1692. data = localeData[localeParts.join('-')];
  1693. if (data) {
  1694. // Return the normalized locale string; e.g., we return "en-US",
  1695. // instead of "en-us".
  1696. return data.locale;
  1697. }
  1698. localeParts.pop();
  1699. }
  1700. }
  1701. var defaultLocale = locales.pop();
  1702. throw new Error(
  1703. 'No locale data has been added to IntlMessageFormat for: ' +
  1704. locales.join(', ') + ', or the default locale: ' + defaultLocale
  1705. );
  1706. };
  1707. });
  1708. var en = createCommonjsModule(function (module, exports) {
  1709. exports["default"] = {"locale":"en","pluralRuleFunction":function (n,ord){var s=String(n).split("."),v0=!s[1],t0=Number(s[0])==n,n10=t0&&s[0].slice(-1),n100=t0&&s[0].slice(-2);if(ord)return n10==1&&n100!=11?"one":n10==2&&n100!=12?"two":n10==3&&n100!=13?"few":"other";return n==1&&v0?"one":"other"}};
  1710. });
  1711. var main = createCommonjsModule(function (module, exports) {
  1712. core["default"].__addLocaleData(en["default"]);
  1713. core["default"].defaultLocale = 'en';
  1714. exports["default"] = core["default"];
  1715. });
  1716. var _nodeResolve_empty = {};
  1717. var _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({
  1718. __proto__: null,
  1719. 'default': _nodeResolve_empty
  1720. });
  1721. getCjsExportFromNamespace(_nodeResolve_empty$1);
  1722. var intlMessageformat = createCommonjsModule(function (module, exports) {
  1723. var IntlMessageFormat = main['default'];
  1724. // Add all locale data to `IntlMessageFormat`. This module will be ignored when
  1725. // bundling for the browser with Browserify/Webpack.
  1726. // Re-export `IntlMessageFormat` as the CommonJS default exports with all the
  1727. // locale data registered, and with English set as the default locale. Define
  1728. // the `default` prop for use with other compiled ES6 Modules.
  1729. exports = module.exports = IntlMessageFormat;
  1730. exports['default'] = exports;
  1731. });
  1732. /**
  1733. * lodash (Custom Build) <https://lodash.com/>
  1734. * Build: `lodash modularize exports="npm" -o ./`
  1735. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  1736. * Released under MIT license <https://lodash.com/license>
  1737. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1738. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1739. */
  1740. /** Used as the `TypeError` message for "Functions" methods. */
  1741. var FUNC_ERROR_TEXT = 'Expected a function';
  1742. /** Used to stand-in for `undefined` hash values. */
  1743. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  1744. /** Used as references for various `Number` constants. */
  1745. var INFINITY = 1 / 0;
  1746. /** `Object#toString` result references. */
  1747. var funcTag = '[object Function]',
  1748. genTag = '[object GeneratorFunction]',
  1749. symbolTag = '[object Symbol]';
  1750. /** Used to match property names within property paths. */
  1751. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  1752. reIsPlainProp = /^\w*$/,
  1753. reLeadingDot = /^\./,
  1754. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1755. /**
  1756. * Used to match `RegExp`
  1757. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1758. */
  1759. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  1760. /** Used to match backslashes in property paths. */
  1761. var reEscapeChar = /\\(\\)?/g;
  1762. /** Used to detect host constructors (Safari). */
  1763. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1764. /** Detect free variable `global` from Node.js. */
  1765. var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  1766. /** Detect free variable `self`. */
  1767. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1768. /** Used as a reference to the global object. */
  1769. var root = freeGlobal || freeSelf || Function('return this')();
  1770. /**
  1771. * Gets the value at `key` of `object`.
  1772. *
  1773. * @private
  1774. * @param {Object} [object] The object to query.
  1775. * @param {string} key The key of the property to get.
  1776. * @returns {*} Returns the property value.
  1777. */
  1778. function getValue(object, key) {
  1779. return object == null ? undefined : object[key];
  1780. }
  1781. /**
  1782. * Checks if `value` is a host object in IE < 9.
  1783. *
  1784. * @private
  1785. * @param {*} value The value to check.
  1786. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  1787. */
  1788. function isHostObject(value) {
  1789. // Many host objects are `Object` objects that can coerce to strings
  1790. // despite having improperly defined `toString` methods.
  1791. var result = false;
  1792. if (value != null && typeof value.toString != 'function') {
  1793. try {
  1794. result = !!(value + '');
  1795. } catch (e) {}
  1796. }
  1797. return result;
  1798. }
  1799. /** Used for built-in method references. */
  1800. var arrayProto = Array.prototype,
  1801. funcProto = Function.prototype,
  1802. objectProto = Object.prototype;
  1803. /** Used to detect overreaching core-js shims. */
  1804. var coreJsData = root['__core-js_shared__'];
  1805. /** Used to detect methods masquerading as native. */
  1806. var maskSrcKey = (function() {
  1807. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  1808. return uid ? ('Symbol(src)_1.' + uid) : '';
  1809. }());
  1810. /** Used to resolve the decompiled source of functions. */
  1811. var funcToString = funcProto.toString;
  1812. /** Used to check objects for own properties. */
  1813. var hasOwnProperty = objectProto.hasOwnProperty;
  1814. /**
  1815. * Used to resolve the
  1816. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  1817. * of values.
  1818. */
  1819. var objectToString = objectProto.toString;
  1820. /** Used to detect if a method is native. */
  1821. var reIsNative = RegExp('^' +
  1822. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  1823. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  1824. );
  1825. /** Built-in value references. */
  1826. var Symbol = root.Symbol,
  1827. splice = arrayProto.splice;
  1828. /* Built-in method references that are verified to be native. */
  1829. var Map = getNative(root, 'Map'),
  1830. nativeCreate = getNative(Object, 'create');
  1831. /** Used to convert symbols to primitives and strings. */
  1832. var symbolProto = Symbol ? Symbol.prototype : undefined,
  1833. symbolToString = symbolProto ? symbolProto.toString : undefined;
  1834. /**
  1835. * Creates a hash object.
  1836. *
  1837. * @private
  1838. * @constructor
  1839. * @param {Array} [entries] The key-value pairs to cache.
  1840. */
  1841. function Hash(entries) {
  1842. var index = -1,
  1843. length = entries ? entries.length : 0;
  1844. this.clear();
  1845. while (++index < length) {
  1846. var entry = entries[index];
  1847. this.set(entry[0], entry[1]);
  1848. }
  1849. }
  1850. /**
  1851. * Removes all key-value entries from the hash.
  1852. *
  1853. * @private
  1854. * @name clear
  1855. * @memberOf Hash
  1856. */
  1857. function hashClear() {
  1858. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1859. }
  1860. /**
  1861. * Removes `key` and its value from the hash.
  1862. *
  1863. * @private
  1864. * @name delete
  1865. * @memberOf Hash
  1866. * @param {Object} hash The hash to modify.
  1867. * @param {string} key The key of the value to remove.
  1868. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1869. */
  1870. function hashDelete(key) {
  1871. return this.has(key) && delete this.__data__[key];
  1872. }
  1873. /**
  1874. * Gets the hash value for `key`.
  1875. *
  1876. * @private
  1877. * @name get
  1878. * @memberOf Hash
  1879. * @param {string} key The key of the value to get.
  1880. * @returns {*} Returns the entry value.
  1881. */
  1882. function hashGet(key) {
  1883. var data = this.__data__;
  1884. if (nativeCreate) {
  1885. var result = data[key];
  1886. return result === HASH_UNDEFINED ? undefined : result;
  1887. }
  1888. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  1889. }
  1890. /**
  1891. * Checks if a hash value for `key` exists.
  1892. *
  1893. * @private
  1894. * @name has
  1895. * @memberOf Hash
  1896. * @param {string} key The key of the entry to check.
  1897. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1898. */
  1899. function hashHas(key) {
  1900. var data = this.__data__;
  1901. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  1902. }
  1903. /**
  1904. * Sets the hash `key` to `value`.
  1905. *
  1906. * @private
  1907. * @name set
  1908. * @memberOf Hash
  1909. * @param {string} key The key of the value to set.
  1910. * @param {*} value The value to set.
  1911. * @returns {Object} Returns the hash instance.
  1912. */
  1913. function hashSet(key, value) {
  1914. var data = this.__data__;
  1915. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  1916. return this;
  1917. }
  1918. // Add methods to `Hash`.
  1919. Hash.prototype.clear = hashClear;
  1920. Hash.prototype['delete'] = hashDelete;
  1921. Hash.prototype.get = hashGet;
  1922. Hash.prototype.has = hashHas;
  1923. Hash.prototype.set = hashSet;
  1924. /**
  1925. * Creates an list cache object.
  1926. *
  1927. * @private
  1928. * @constructor
  1929. * @param {Array} [entries] The key-value pairs to cache.
  1930. */
  1931. function ListCache(entries) {
  1932. var index = -1,
  1933. length = entries ? entries.length : 0;
  1934. this.clear();
  1935. while (++index < length) {
  1936. var entry = entries[index];
  1937. this.set(entry[0], entry[1]);
  1938. }
  1939. }
  1940. /**
  1941. * Removes all key-value entries from the list cache.
  1942. *
  1943. * @private
  1944. * @name clear
  1945. * @memberOf ListCache
  1946. */
  1947. function listCacheClear() {
  1948. this.__data__ = [];
  1949. }
  1950. /**
  1951. * Removes `key` and its value from the list cache.
  1952. *
  1953. * @private
  1954. * @name delete
  1955. * @memberOf ListCache
  1956. * @param {string} key The key of the value to remove.
  1957. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1958. */
  1959. function listCacheDelete(key) {
  1960. var data = this.__data__,
  1961. index = assocIndexOf(data, key);
  1962. if (index < 0) {
  1963. return false;
  1964. }
  1965. var lastIndex = data.length - 1;
  1966. if (index == lastIndex) {
  1967. data.pop();
  1968. } else {
  1969. splice.call(data, index, 1);
  1970. }
  1971. return true;
  1972. }
  1973. /**
  1974. * Gets the list cache value for `key`.
  1975. *
  1976. * @private
  1977. * @name get
  1978. * @memberOf ListCache
  1979. * @param {string} key The key of the value to get.
  1980. * @returns {*} Returns the entry value.
  1981. */
  1982. function listCacheGet(key) {
  1983. var data = this.__data__,
  1984. index = assocIndexOf(data, key);
  1985. return index < 0 ? undefined : data[index][1];
  1986. }
  1987. /**
  1988. * Checks if a list cache value for `key` exists.
  1989. *
  1990. * @private
  1991. * @name has
  1992. * @memberOf ListCache
  1993. * @param {string} key The key of the entry to check.
  1994. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1995. */
  1996. function listCacheHas(key) {
  1997. return assocIndexOf(this.__data__, key) > -1;
  1998. }
  1999. /**
  2000. * Sets the list cache `key` to `value`.
  2001. *
  2002. * @private
  2003. * @name set
  2004. * @memberOf ListCache
  2005. * @param {string} key The key of the value to set.
  2006. * @param {*} value The value to set.
  2007. * @returns {Object} Returns the list cache instance.
  2008. */
  2009. function listCacheSet(key, value) {
  2010. var data = this.__data__,
  2011. index = assocIndexOf(data, key);
  2012. if (index < 0) {
  2013. data.push([key, value]);
  2014. } else {
  2015. data[index][1] = value;
  2016. }
  2017. return this;
  2018. }
  2019. // Add methods to `ListCache`.
  2020. ListCache.prototype.clear = listCacheClear;
  2021. ListCache.prototype['delete'] = listCacheDelete;
  2022. ListCache.prototype.get = listCacheGet;
  2023. ListCache.prototype.has = listCacheHas;
  2024. ListCache.prototype.set = listCacheSet;
  2025. /**
  2026. * Creates a map cache object to store key-value pairs.
  2027. *
  2028. * @private
  2029. * @constructor
  2030. * @param {Array} [entries] The key-value pairs to cache.
  2031. */
  2032. function MapCache(entries) {
  2033. var index = -1,
  2034. length = entries ? entries.length : 0;
  2035. this.clear();
  2036. while (++index < length) {
  2037. var entry = entries[index];
  2038. this.set(entry[0], entry[1]);
  2039. }
  2040. }
  2041. /**
  2042. * Removes all key-value entries from the map.
  2043. *
  2044. * @private
  2045. * @name clear
  2046. * @memberOf MapCache
  2047. */
  2048. function mapCacheClear() {
  2049. this.__data__ = {
  2050. 'hash': new Hash,
  2051. 'map': new (Map || ListCache),
  2052. 'string': new Hash
  2053. };
  2054. }
  2055. /**
  2056. * Removes `key` and its value from the map.
  2057. *
  2058. * @private
  2059. * @name delete
  2060. * @memberOf MapCache
  2061. * @param {string} key The key of the value to remove.
  2062. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2063. */
  2064. function mapCacheDelete(key) {
  2065. return getMapData(this, key)['delete'](key);
  2066. }
  2067. /**
  2068. * Gets the map value for `key`.
  2069. *
  2070. * @private
  2071. * @name get
  2072. * @memberOf MapCache
  2073. * @param {string} key The key of the value to get.
  2074. * @returns {*} Returns the entry value.
  2075. */
  2076. function mapCacheGet(key) {
  2077. return getMapData(this, key).get(key);
  2078. }
  2079. /**
  2080. * Checks if a map value for `key` exists.
  2081. *
  2082. * @private
  2083. * @name has
  2084. * @memberOf MapCache
  2085. * @param {string} key The key of the entry to check.
  2086. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2087. */
  2088. function mapCacheHas(key) {
  2089. return getMapData(this, key).has(key);
  2090. }
  2091. /**
  2092. * Sets the map `key` to `value`.
  2093. *
  2094. * @private
  2095. * @name set
  2096. * @memberOf MapCache
  2097. * @param {string} key The key of the value to set.
  2098. * @param {*} value The value to set.
  2099. * @returns {Object} Returns the map cache instance.
  2100. */
  2101. function mapCacheSet(key, value) {
  2102. getMapData(this, key).set(key, value);
  2103. return this;
  2104. }
  2105. // Add methods to `MapCache`.
  2106. MapCache.prototype.clear = mapCacheClear;
  2107. MapCache.prototype['delete'] = mapCacheDelete;
  2108. MapCache.prototype.get = mapCacheGet;
  2109. MapCache.prototype.has = mapCacheHas;
  2110. MapCache.prototype.set = mapCacheSet;
  2111. /**
  2112. * Gets the index at which the `key` is found in `array` of key-value pairs.
  2113. *
  2114. * @private
  2115. * @param {Array} array The array to inspect.
  2116. * @param {*} key The key to search for.
  2117. * @returns {number} Returns the index of the matched value, else `-1`.
  2118. */
  2119. function assocIndexOf(array, key) {
  2120. var length = array.length;
  2121. while (length--) {
  2122. if (eq(array[length][0], key)) {
  2123. return length;
  2124. }
  2125. }
  2126. return -1;
  2127. }
  2128. /**
  2129. * The base implementation of `_.get` without support for default values.
  2130. *
  2131. * @private
  2132. * @param {Object} object The object to query.
  2133. * @param {Array|string} path The path of the property to get.
  2134. * @returns {*} Returns the resolved value.
  2135. */
  2136. function baseGet(object, path) {
  2137. path = isKey(path, object) ? [path] : castPath(path);
  2138. var index = 0,
  2139. length = path.length;
  2140. while (object != null && index < length) {
  2141. object = object[toKey(path[index++])];
  2142. }
  2143. return (index && index == length) ? object : undefined;
  2144. }
  2145. /**
  2146. * The base implementation of `_.isNative` without bad shim checks.
  2147. *
  2148. * @private
  2149. * @param {*} value The value to check.
  2150. * @returns {boolean} Returns `true` if `value` is a native function,
  2151. * else `false`.
  2152. */
  2153. function baseIsNative(value) {
  2154. if (!isObject(value) || isMasked(value)) {
  2155. return false;
  2156. }
  2157. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  2158. return pattern.test(toSource(value));
  2159. }
  2160. /**
  2161. * The base implementation of `_.toString` which doesn't convert nullish
  2162. * values to empty strings.
  2163. *
  2164. * @private
  2165. * @param {*} value The value to process.
  2166. * @returns {string} Returns the string.
  2167. */
  2168. function baseToString(value) {
  2169. // Exit early for strings to avoid a performance hit in some environments.
  2170. if (typeof value == 'string') {
  2171. return value;
  2172. }
  2173. if (isSymbol(value)) {
  2174. return symbolToString ? symbolToString.call(value) : '';
  2175. }
  2176. var result = (value + '');
  2177. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  2178. }
  2179. /**
  2180. * Casts `value` to a path array if it's not one.
  2181. *
  2182. * @private
  2183. * @param {*} value The value to inspect.
  2184. * @returns {Array} Returns the cast property path array.
  2185. */
  2186. function castPath(value) {
  2187. return isArray(value) ? value : stringToPath(value);
  2188. }
  2189. /**
  2190. * Gets the data for `map`.
  2191. *
  2192. * @private
  2193. * @param {Object} map The map to query.
  2194. * @param {string} key The reference key.
  2195. * @returns {*} Returns the map data.
  2196. */
  2197. function getMapData(map, key) {
  2198. var data = map.__data__;
  2199. return isKeyable(key)
  2200. ? data[typeof key == 'string' ? 'string' : 'hash']
  2201. : data.map;
  2202. }
  2203. /**
  2204. * Gets the native function at `key` of `object`.
  2205. *
  2206. * @private
  2207. * @param {Object} object The object to query.
  2208. * @param {string} key The key of the method to get.
  2209. * @returns {*} Returns the function if it's native, else `undefined`.
  2210. */
  2211. function getNative(object, key) {
  2212. var value = getValue(object, key);
  2213. return baseIsNative(value) ? value : undefined;
  2214. }
  2215. /**
  2216. * Checks if `value` is a property name and not a property path.
  2217. *
  2218. * @private
  2219. * @param {*} value The value to check.
  2220. * @param {Object} [object] The object to query keys on.
  2221. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  2222. */
  2223. function isKey(value, object) {
  2224. if (isArray(value)) {
  2225. return false;
  2226. }
  2227. var type = typeof value;
  2228. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  2229. value == null || isSymbol(value)) {
  2230. return true;
  2231. }
  2232. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  2233. (object != null && value in Object(object));
  2234. }
  2235. /**
  2236. * Checks if `value` is suitable for use as unique object key.
  2237. *
  2238. * @private
  2239. * @param {*} value The value to check.
  2240. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  2241. */
  2242. function isKeyable(value) {
  2243. var type = typeof value;
  2244. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  2245. ? (value !== '__proto__')
  2246. : (value === null);
  2247. }
  2248. /**
  2249. * Checks if `func` has its source masked.
  2250. *
  2251. * @private
  2252. * @param {Function} func The function to check.
  2253. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  2254. */
  2255. function isMasked(func) {
  2256. return !!maskSrcKey && (maskSrcKey in func);
  2257. }
  2258. /**
  2259. * Converts `string` to a property path array.
  2260. *
  2261. * @private
  2262. * @param {string} string The string to convert.
  2263. * @returns {Array} Returns the property path array.
  2264. */
  2265. var stringToPath = memoize(function(string) {
  2266. string = toString(string);
  2267. var result = [];
  2268. if (reLeadingDot.test(string)) {
  2269. result.push('');
  2270. }
  2271. string.replace(rePropName, function(match, number, quote, string) {
  2272. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  2273. });
  2274. return result;
  2275. });
  2276. /**
  2277. * Converts `value` to a string key if it's not a string or symbol.
  2278. *
  2279. * @private
  2280. * @param {*} value The value to inspect.
  2281. * @returns {string|symbol} Returns the key.
  2282. */
  2283. function toKey(value) {
  2284. if (typeof value == 'string' || isSymbol(value)) {
  2285. return value;
  2286. }
  2287. var result = (value + '');
  2288. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  2289. }
  2290. /**
  2291. * Converts `func` to its source code.
  2292. *
  2293. * @private
  2294. * @param {Function} func The function to process.
  2295. * @returns {string} Returns the source code.
  2296. */
  2297. function toSource(func) {
  2298. if (func != null) {
  2299. try {
  2300. return funcToString.call(func);
  2301. } catch (e) {}
  2302. try {
  2303. return (func + '');
  2304. } catch (e) {}
  2305. }
  2306. return '';
  2307. }
  2308. /**
  2309. * Creates a function that memoizes the result of `func`. If `resolver` is
  2310. * provided, it determines the cache key for storing the result based on the
  2311. * arguments provided to the memoized function. By default, the first argument
  2312. * provided to the memoized function is used as the map cache key. The `func`
  2313. * is invoked with the `this` binding of the memoized function.
  2314. *
  2315. * **Note:** The cache is exposed as the `cache` property on the memoized
  2316. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  2317. * constructor with one whose instances implement the
  2318. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  2319. * method interface of `delete`, `get`, `has`, and `set`.
  2320. *
  2321. * @static
  2322. * @memberOf _
  2323. * @since 0.1.0
  2324. * @category Function
  2325. * @param {Function} func The function to have its output memoized.
  2326. * @param {Function} [resolver] The function to resolve the cache key.
  2327. * @returns {Function} Returns the new memoized function.
  2328. * @example
  2329. *
  2330. * var object = { 'a': 1, 'b': 2 };
  2331. * var other = { 'c': 3, 'd': 4 };
  2332. *
  2333. * var values = _.memoize(_.values);
  2334. * values(object);
  2335. * // => [1, 2]
  2336. *
  2337. * values(other);
  2338. * // => [3, 4]
  2339. *
  2340. * object.a = 2;
  2341. * values(object);
  2342. * // => [1, 2]
  2343. *
  2344. * // Modify the result cache.
  2345. * values.cache.set(object, ['a', 'b']);
  2346. * values(object);
  2347. * // => ['a', 'b']
  2348. *
  2349. * // Replace `_.memoize.Cache`.
  2350. * _.memoize.Cache = WeakMap;
  2351. */
  2352. function memoize(func, resolver) {
  2353. if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
  2354. throw new TypeError(FUNC_ERROR_TEXT);
  2355. }
  2356. var memoized = function() {
  2357. var args = arguments,
  2358. key = resolver ? resolver.apply(this, args) : args[0],
  2359. cache = memoized.cache;
  2360. if (cache.has(key)) {
  2361. return cache.get(key);
  2362. }
  2363. var result = func.apply(this, args);
  2364. memoized.cache = cache.set(key, result);
  2365. return result;
  2366. };
  2367. memoized.cache = new (memoize.Cache || MapCache);
  2368. return memoized;
  2369. }
  2370. // Assign cache to `_.memoize`.
  2371. memoize.Cache = MapCache;
  2372. /**
  2373. * Performs a
  2374. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2375. * comparison between two values to determine if they are equivalent.
  2376. *
  2377. * @static
  2378. * @memberOf _
  2379. * @since 4.0.0
  2380. * @category Lang
  2381. * @param {*} value The value to compare.
  2382. * @param {*} other The other value to compare.
  2383. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  2384. * @example
  2385. *
  2386. * var object = { 'a': 1 };
  2387. * var other = { 'a': 1 };
  2388. *
  2389. * _.eq(object, object);
  2390. * // => true
  2391. *
  2392. * _.eq(object, other);
  2393. * // => false
  2394. *
  2395. * _.eq('a', 'a');
  2396. * // => true
  2397. *
  2398. * _.eq('a', Object('a'));
  2399. * // => false
  2400. *
  2401. * _.eq(NaN, NaN);
  2402. * // => true
  2403. */
  2404. function eq(value, other) {
  2405. return value === other || (value !== value && other !== other);
  2406. }
  2407. /**
  2408. * Checks if `value` is classified as an `Array` object.
  2409. *
  2410. * @static
  2411. * @memberOf _
  2412. * @since 0.1.0
  2413. * @category Lang
  2414. * @param {*} value The value to check.
  2415. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  2416. * @example
  2417. *
  2418. * _.isArray([1, 2, 3]);
  2419. * // => true
  2420. *
  2421. * _.isArray(document.body.children);
  2422. * // => false
  2423. *
  2424. * _.isArray('abc');
  2425. * // => false
  2426. *
  2427. * _.isArray(_.noop);
  2428. * // => false
  2429. */
  2430. var isArray = Array.isArray;
  2431. /**
  2432. * Checks if `value` is classified as a `Function` object.
  2433. *
  2434. * @static
  2435. * @memberOf _
  2436. * @since 0.1.0
  2437. * @category Lang
  2438. * @param {*} value The value to check.
  2439. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  2440. * @example
  2441. *
  2442. * _.isFunction(_);
  2443. * // => true
  2444. *
  2445. * _.isFunction(/abc/);
  2446. * // => false
  2447. */
  2448. function isFunction(value) {
  2449. // The use of `Object#toString` avoids issues with the `typeof` operator
  2450. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  2451. var tag = isObject(value) ? objectToString.call(value) : '';
  2452. return tag == funcTag || tag == genTag;
  2453. }
  2454. /**
  2455. * Checks if `value` is the
  2456. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  2457. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  2458. *
  2459. * @static
  2460. * @memberOf _
  2461. * @since 0.1.0
  2462. * @category Lang
  2463. * @param {*} value The value to check.
  2464. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  2465. * @example
  2466. *
  2467. * _.isObject({});
  2468. * // => true
  2469. *
  2470. * _.isObject([1, 2, 3]);
  2471. * // => true
  2472. *
  2473. * _.isObject(_.noop);
  2474. * // => true
  2475. *
  2476. * _.isObject(null);
  2477. * // => false
  2478. */
  2479. function isObject(value) {
  2480. var type = typeof value;
  2481. return !!value && (type == 'object' || type == 'function');
  2482. }
  2483. /**
  2484. * Checks if `value` is object-like. A value is object-like if it's not `null`
  2485. * and has a `typeof` result of "object".
  2486. *
  2487. * @static
  2488. * @memberOf _
  2489. * @since 4.0.0
  2490. * @category Lang
  2491. * @param {*} value The value to check.
  2492. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  2493. * @example
  2494. *
  2495. * _.isObjectLike({});
  2496. * // => true
  2497. *
  2498. * _.isObjectLike([1, 2, 3]);
  2499. * // => true
  2500. *
  2501. * _.isObjectLike(_.noop);
  2502. * // => false
  2503. *
  2504. * _.isObjectLike(null);
  2505. * // => false
  2506. */
  2507. function isObjectLike(value) {
  2508. return !!value && typeof value == 'object';
  2509. }
  2510. /**
  2511. * Checks if `value` is classified as a `Symbol` primitive or object.
  2512. *
  2513. * @static
  2514. * @memberOf _
  2515. * @since 4.0.0
  2516. * @category Lang
  2517. * @param {*} value The value to check.
  2518. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  2519. * @example
  2520. *
  2521. * _.isSymbol(Symbol.iterator);
  2522. * // => true
  2523. *
  2524. * _.isSymbol('abc');
  2525. * // => false
  2526. */
  2527. function isSymbol(value) {
  2528. return typeof value == 'symbol' ||
  2529. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  2530. }
  2531. /**
  2532. * Converts `value` to a string. An empty string is returned for `null`
  2533. * and `undefined` values. The sign of `-0` is preserved.
  2534. *
  2535. * @static
  2536. * @memberOf _
  2537. * @since 4.0.0
  2538. * @category Lang
  2539. * @param {*} value The value to process.
  2540. * @returns {string} Returns the string.
  2541. * @example
  2542. *
  2543. * _.toString(null);
  2544. * // => ''
  2545. *
  2546. * _.toString(-0);
  2547. * // => '-0'
  2548. *
  2549. * _.toString([1, 2, 3]);
  2550. * // => '1,2,3'
  2551. */
  2552. function toString(value) {
  2553. return value == null ? '' : baseToString(value);
  2554. }
  2555. /**
  2556. * Gets the value at `path` of `object`. If the resolved value is
  2557. * `undefined`, the `defaultValue` is returned in its place.
  2558. *
  2559. * @static
  2560. * @memberOf _
  2561. * @since 3.7.0
  2562. * @category Object
  2563. * @param {Object} object The object to query.
  2564. * @param {Array|string} path The path of the property to get.
  2565. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  2566. * @returns {*} Returns the resolved value.
  2567. * @example
  2568. *
  2569. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  2570. *
  2571. * _.get(object, 'a[0].b.c');
  2572. * // => 3
  2573. *
  2574. * _.get(object, ['a', '0', 'b', 'c']);
  2575. * // => 3
  2576. *
  2577. * _.get(object, 'a.b.c', 'default');
  2578. * // => 'default'
  2579. */
  2580. function get(object, path, defaultValue) {
  2581. var result = object == null ? undefined : baseGet(object, path);
  2582. return result === undefined ? defaultValue : result;
  2583. }
  2584. var lodash_get = get;
  2585. var Observer_1 = createCommonjsModule(function (module, exports) {
  2586. Object.defineProperty(exports, "__esModule", { value: true });
  2587. var Observer = function (obj) {
  2588. Object.keys(obj.__data__ || obj).forEach(function (key) {
  2589. defineReactive(obj, key);
  2590. });
  2591. return obj;
  2592. };
  2593. var observe = function (value) {
  2594. if (!value || typeof value !== 'object') {
  2595. return;
  2596. }
  2597. Observer(value);
  2598. };
  2599. var defineReactive = function (obj, key) {
  2600. var childObj = observe(obj[key]);
  2601. Object.defineProperty(obj, key, {
  2602. get: function () {
  2603. if (obj.__data__[key]) {
  2604. return obj.__data__[key];
  2605. }
  2606. else if (obj.__metas__['zh-CN'][key]) {
  2607. return obj.__metas__['zh-CN'][key];
  2608. }
  2609. },
  2610. set: function (newVal) {
  2611. if (obj[key] === newVal) {
  2612. return;
  2613. }
  2614. obj[key] = newVal;
  2615. var cb = obj.callback[key];
  2616. cb.call(obj);
  2617. childObj = observe(newVal);
  2618. }
  2619. });
  2620. };
  2621. exports.default = Observer;
  2622. });
  2623. unwrapExports(Observer_1);
  2624. var src = createCommonjsModule(function (module, exports) {
  2625. var __assign = (commonjsGlobal && commonjsGlobal.__assign) || Object.assign || function(t) {
  2626. for (var s, i = 1, n = arguments.length; i < n; i++) {
  2627. s = arguments[i];
  2628. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  2629. t[p] = s[p];
  2630. }
  2631. return t;
  2632. };
  2633. Object.defineProperty(exports, "__esModule", { value: true });
  2634. var I18N = (function () {
  2635. function I18N(lang, metas) {
  2636. this.__lang__ = lang;
  2637. this.__metas__ = metas;
  2638. this.__data__ = metas[lang];
  2639. }
  2640. I18N.prototype.setLang = function (lang) {
  2641. this.__lang__ = lang;
  2642. this.__data__ = this.__metas__[lang];
  2643. };
  2644. I18N.prototype.getProp = function (obj, is, value) {
  2645. if (typeof is === 'string') {
  2646. is = is.split('.');
  2647. }
  2648. if (is.length === 1 && value !== undefined) {
  2649. return (obj[is[0]] = value);
  2650. }
  2651. else if (is.length === 0) {
  2652. return obj;
  2653. }
  2654. else {
  2655. var prop = is.shift();
  2656. if (value !== undefined && obj[prop] === undefined) {
  2657. obj[prop] = {};
  2658. }
  2659. return this.getProp(obj[prop], is, value);
  2660. }
  2661. };
  2662. I18N.prototype.template = function (str, args) {
  2663. var _this = this;
  2664. if (!str) {
  2665. return '';
  2666. }
  2667. return str.replace(/\{(.+?)\}/g, function (match, p1) {
  2668. return _this.getProp(__assign({}, _this.__data__, args), p1);
  2669. });
  2670. };
  2671. I18N.prototype.get = function (str, args) {
  2672. var msg = lodash_get(this.__data__, str);
  2673. if (!msg) {
  2674. msg = lodash_get(this.__metas__['zh-CN'], str, str);
  2675. }
  2676. if (args) {
  2677. try {
  2678. msg = new intlMessageformat.default(msg, this.__lang__);
  2679. msg = msg.format(args);
  2680. return msg;
  2681. }
  2682. catch (err) {
  2683. console.warn("kiwi-intl format message failed for key='" + str + "'", err);
  2684. return '';
  2685. }
  2686. }
  2687. else {
  2688. return msg;
  2689. }
  2690. };
  2691. return I18N;
  2692. }());
  2693. var IntlFormat = {
  2694. init: function (lang, metas) {
  2695. var i18n = new I18N(lang, metas);
  2696. return Observer_1.default(i18n);
  2697. }
  2698. };
  2699. exports.IntlFormat = IntlFormat;
  2700. exports.default = IntlFormat;
  2701. });
  2702. var KiwiIntl = unwrapExports(src);
  2703. var src_1 = src.IntlFormat;
  2704. var priceOptions = {
  2705. "index": {
  2706. "others": "Others"
  2707. }
  2708. };
  2709. var payplatformoption = {
  2710. "platform": "支付平台"
  2711. };
  2712. var enUsLangs = Object.assign({}, {
  2713. priceOptions: priceOptions,
  2714. payplatformoption: payplatformoption
  2715. });
  2716. var priceOptions$1 = {
  2717. index: {
  2718. others: '其他金额'
  2719. }
  2720. };
  2721. var payplatformoption$1 = {
  2722. platform: '支付平台'
  2723. };
  2724. var zhCNLangs = Object.assign({}, {
  2725. priceOptions: priceOptions$1,
  2726. payplatformoption: payplatformoption$1
  2727. });
  2728. // type TransmitImgTxtData = {
  2729. // user_id?: string|number;
  2730. // anonymity?: boolean;
  2731. // avatar?: string;
  2732. // nickname?: string;
  2733. // is_long?: boolean;
  2734. // }
  2735. // interface TransmitCardProps {
  2736. // type: TransmitType;
  2737. // data: TransmitImgTxtData;
  2738. // }
  2739. // export class TransmitCard extends React.PureComponent<TransmitCardProps, {}> {
  2740. // renderVideo() {
  2741. // return <div className={styles.transmitVideoCard}>Video</div>;
  2742. // }
  2743. // renderImgTxt() {
  2744. // const { data } = this.props;
  2745. // const {
  2746. // user_id,
  2747. // anonymity,
  2748. // avatar,
  2749. // nickname,
  2750. // is_long,
  2751. // } = data;
  2752. // return (
  2753. // <div className={styles.transmitImgTxtCard}>
  2754. // <div className={styles.header}>
  2755. // <UserLink user_id={user_id} anonymity={anonymity}>
  2756. // <Avatar
  2757. // id={user_id}
  2758. // image={avatar}
  2759. // follow={false}
  2760. // size="cover"
  2761. // className={styles.ava}
  2762. // anonymity={anonymity}
  2763. // />
  2764. // </UserLink>
  2765. // <div className={styles.nickname}>
  2766. // <UserLink user_id={user_id} anonymity={anonymity}>
  2767. // {nickname}
  2768. // </UserLink>
  2769. // </div>
  2770. // <div className={styles.type}>
  2771. // {is_long
  2772. // ? intl.get('bilingually.imgtxt.article')
  2773. // : intl.get('bilingually.imgtxt')}
  2774. // </div>
  2775. // </div>
  2776. // </div>
  2777. // );
  2778. // }
  2779. // render() {
  2780. // const { type } = this.props;
  2781. // if (type === 'imgTxt') {
  2782. // this.renderImgTxt();
  2783. // }
  2784. // if (type === 'shortVideo' || type === 'microVideo') {
  2785. // this.renderVideo();
  2786. // }
  2787. // return null;
  2788. // }
  2789. // }
  2790. var Test = "TestComponent";
  2791. var langs = {
  2792. 'en_US': enUsLangs,
  2793. 'zh_CN': zhCNLangs
  2794. };
  2795. var kiwiIntl = KiwiIntl.init('en_US', langs);
  2796. export { Test, kiwiIntl };
  2797. //# sourceMappingURL=index.js.map