@danielhaim/titlecaser 1.2.39 → 1.2.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -310,4 +310,4 @@ Useful materials for improving your knowledge of writing and language style guid
310
310
 
311
311
  If you encounter any bugs or issues while using the library or the demo page, please report them by opening a new issue in the repository's issue tracker.
312
312
 
313
- When reporting a bug, please provide as much detail as possible, including the steps to reproduce the issue and any error messages that you see. I appreciate any contribution to improving this library.
313
+ When reporting a bug, please provide as much detail as possible, including the steps to reproduce the issue and any error messages that you see. I appreciate any contribution to improving this library.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielhaim/titlecaser",
3
- "version": "1.2.39",
3
+ "version": "1.2.40",
4
4
  "description": "Converts a string to title case with multiple style options, ability to ignore certain words, and handle acronyms",
5
5
  "keywords": [
6
6
  "title case",
@@ -37,15 +37,13 @@
37
37
  "release": "npm version patch && npm run build-package && npm run copy-package-to-docs && git add package.json package-lock.json dist/ docs/assets/js && git commit -m 'Bump version and build package for release' && git push"
38
38
  },
39
39
  "files": [
40
- "LICENSE",
41
- "README.md",
42
40
  "package.json",
43
41
  "src/TitleCaserConsts.js",
44
42
  "src/TitleCaserUtils.js",
45
43
  "src/TitleCaser.js",
46
44
  "src/index.js",
47
- "dist/titlecaser.min.js",
48
- "dist/titlecaser.amd.js"
45
+ "LICENSE",
46
+ "README.md"
49
47
  ],
50
48
  "author": {
51
49
  "name": "Daniel Haim",
@@ -1 +0,0 @@
1
- (()=>{var e={429:(e,t,r)=>{var n,o;e=r.nmd(e),n=[t,r(485),r(858)],void 0===(o=function(r,n,o){"use strict";function i(e,t,r){return(t=f(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||u(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function f(e){var t=function(e,t){if("object"!==c(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===c(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),t.TitleCaser=void 0;var y=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=t,this.wordReplacementsList=n.wordReplacementsList}var t,r,l;return t=e,(r=[{key:"toTitleCase",value:function(e){try{if(0===e.trim().length)throw new TypeError("Invalid input: input must not be empty.");if("string"!=typeof e)throw new TypeError("Invalid input: input must be a string.");if(void 0!==this.options&&"object"!==c(this.options))throw new TypeError("Invalid options: options must be an object.");var t=this.options,r=t.style,i=void 0===r?"ap":r,a=t.neverCapitalize,l=void 0===a?[]:a,p=t.replaceTermList,f=void 0===p?n.wordReplacementsList:p,y=["nl2br"].concat(s(l)),d=o.TitleCaserUtils.getTitleCaseOptions(this.options,n.commonAbbreviationList,n.wordReplacementsList),m=(d.articlesList,d.shortConjunctionsList,d.shortPrepositionsList,d.neverCapitalizedList,d.replaceTerms,f.map((function(e){return Object.keys(e)[0].toLowerCase()}))),C=Object.fromEntries(f.map((function(e){return[Object.keys(e)[0].toLowerCase(),Object.values(e)[0]]}))),h=e.trim(),v=(h=(h=h.replace(/ {2,}/g,(function(e){return e.slice(0,1)}))).replace(/<br\s*\/?>/gi,"nl2br ")).split(" ");h=v.map((function(e,t){switch(!0){case o.TitleCaserUtils.isWordAmpersand(e):case o.TitleCaserUtils.hasHtmlBreak(e):case o.TitleCaserUtils.isWordIgnored(e,y):return e;case m.includes(e.toLowerCase()):return C[e.toLowerCase()];case o.TitleCaserUtils.isWordInArray(e,n.correctTitleCasingList):return o.TitleCaserUtils.correctTerm(e,n.correctTitleCasingList);case o.TitleCaserUtils.hasSuffix(e,i):return o.TitleCaserUtils.correctSuffix(e,n.correctTitleCasingList);case o.TitleCaserUtils.hasHyphen(e):return o.TitleCaserUtils.correctTermHyphenated(e,i);case o.TitleCaserUtils.hasUppercaseIntentional(e):return e;case o.TitleCaserUtils.isShortWord(e,i)&&0!==t:return t>0&&o.TitleCaserUtils.endsWithSymbol(v[t-1],[":","?","!","."])?e.charAt(0).toUpperCase()+e.slice(1):e.toLowerCase();case o.TitleCaserUtils.endsWithSymbol(e):var r=e.split(/([.,\/#!$%\^&\*;:{}=\-_`~()])/g).map((function(e,t){return o.TitleCaserUtils.isWordInArray(e,n.correctTitleCasingList)?o.TitleCaserUtils.correctTerm(e,n.correctTitleCasingList):(t>0&&o.TitleCaserUtils.endsWithSymbol(e),e.charAt(0).toUpperCase()+e.slice(1))}));return r.join("");case o.TitleCaserUtils.startsWithSymbol(e):return o.TitleCaserUtils.isWordInArray(e,n.correctTitleCasingList)?o.TitleCaserUtils.correctTerm(e):e;case o.TitleCaserUtils.hasRomanNumeral(e):return e.toUpperCase();case o.TitleCaserUtils.hasNumbers(e):return e;default:return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}})).join(" ");var b,w=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=u(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(n.correctPhraseCasingList);try{for(w.s();!(b=w.n()).done;){var g=b.value;h.toLowerCase().includes(g.toLowerCase())&&(h=h.replace(new RegExp(g,"gi"),g))}}catch(e){w.e(e)}finally{w.f()}return h=h.replace(/nl2br /gi,"<br />")}catch(e){throw new Error(e)}}},{key:"setReplaceTerms",value:function(e){if("object"!==c(e))throw new TypeError("Invalid argument: replace terms must be an object.");Object.entries(e).forEach((function(e){var t=a(e,2),r=t[0],o=t[1],s=n.wordReplacementsList.findIndex((function(e){return e[r]}));-1!==s?n.wordReplacementsList[s][r]=o:n.wordReplacementsList.push(i({},r,o))})),this.options.wordReplacementsList=n.wordReplacementsList}},{key:"addReplaceTerm",value:function(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Invalid argument: term and replacement must be strings.");var r=this.wordReplacementsList.findIndex((function(t){return t[e]}));-1!==r?this.wordReplacementsList[r][e]=t:this.wordReplacementsList.push(i({},e,t)),this.options.wordReplacementsList=this.wordReplacementsList}},{key:"removeReplaceTerm",value:function(e){if("string"!=typeof e)throw new TypeError("Invalid argument: term must be a string.");var t=this.wordReplacementsList.findIndex((function(t){return Object.keys(t)[0]===e}));if(-1===t)throw new Error("Term '".concat(e,"' not found in word replacements list."));this.wordReplacementsList.splice(t,1),this.options.wordReplacementsList=this.wordReplacementsList}},{key:"setStyle",value:function(e){if("string"!=typeof e)throw new TypeError("Invalid argument: style must be a string.");this.options.style=e}}])&&p(t.prototype,r),l&&p(t,l),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.TitleCaser=y,"object"===c(e)&&e.exports&&(e.exports={TitleCaser:y})}.apply(t,n))||(e.exports=o)},485:(e,t)=>{var r;void 0===(r=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),t.wordReplacementsList=t.titleCaseStylesList=t.titleCaseDefaultOptionsList=t.ignoredWordList=t.correctTitleCasingList=t.correctPhraseCasingList=t.commonAbbreviationList=t.allowedTitleCaseStylesList=void 0;t.commonAbbreviationList=["a","an","the","as","at","by","for","in","of","on","to","up","yet","so","but","nor","or","and"];t.correctTitleCasingList=["AJAX","CSS","DOM","ES6","HTML","JavaScript","jQuery","MobX","SCSS","TypeScript","Vue.js",".NET","ASP","ASPX","MySQL","PHP","PostgresQL","Python","SQL","GraphQL","HTML5","API","APIs","ASCII","CI","CircleCI","CLI","DLL","DNS","EC2","FTP","HTTP","HTTPs","ICMP","IDE","IP","ISP","JSON","JSP","LPWAN","M2M","MQTT","OOP","REST","SSH","SSL","TCP","UDP","URL","WLAN","WYSIWYG","XML","YAML","YML","IMAP","RSS","IaaS","PaaS","SaaS","CaaS","FaaS","XaaS","RaaS","IoE","IoT","LoRa","NB-IoT","RFID","RF","RFI","RFQ","ECMAScript","IO","I/O","DevOps","SecOps","DDoS","VoIP","AI","AR","ML","VR","w/","w/o","e-Book","e-Books","eBook","eBooks","eCommerce","eMarket","eMarketplace","eMarketplaces","eMarkets","eReader","eShop","eShops","eStore","eStores","E-commerce","AP","COGS","EBIT","EPS","FIFO","GAAP","LIFO","P&L","ROI","SOX","TCO","VAT","CAGR","DCF","ETF","IPO","IRR","M&A","NAV","PE","PEG","PPE","ROE","S&P","TVM","VC","B2B","B2C","CMO","CPA","CPC","CPL","CPM","CRM","CTA","CTR","SEO","SEM","SMM","USP","A/B","CTA","CTOR","CTR","KPI","PWA","SEM","SERP","SERPs","SMM","SMO","FAQ","FAQA","FAQS","UI","UI/UX","UX","T&C","TOS","PP","CRM","PoE","PoW","PoC","A11Y","PR","BANT","KPI","MQL","NPS","POS","SPIN","SQL","SWOT","AFA","ADR","CCPA","CFAA","CISG","DMCA","EULA","GDPR","HIPAA","NDA","SOW","TOS","CEO","CEOs","CFO","CFOs","CIO","CIOs","CMO","CMOs","COO","COOs","CPO","CPOs","CRO","CROs","CSO","CSOs","CTO","CTOs","EVP","EVPs","HR","HRs","SVP","SVPs","VP","VPs","NGO","NPO","NGOs","NPOs","UN","UNESCO","UNICEF","UNHCR","UNODC","UNDP","UNFPA","UNEP","Adobe","Airbnb","Alibaba","Allstate","American Express","Apple","AT&T","BMW","Boeing","Cisco","Citigroup","Coca","Deloitte","Disney","Dropbox","ExxonMobil","Ford","GE","General","Goldman Sachs","Google","Hilton","HP","IBM","Intel","JPMorgan","Johnson & Johnson","LinkedIn","McDonald's","Mercedes-Benz","Microsoft","Nestle","Nike","Nissan","Oracle","PepsiCo","Pfizer","Salesforce","Samsung","Shell","Sony","Tesla","Toyota","Uber","Verizon","Visa","Walmart","Wells Fargo","Yahoo","Zara","IKEA","Facebook","YouTube","Instagram","Twitter","TensorFlow","Amazon","Netflix","eBay","iPhone","iPad","iPod","PlayStation","PayPal","GitHub","GitLab","CodeIgniter","WordPress","WooCommerce","MongoDB","JIRA","HubSpot","AirDrop","AirPlay","AirPods","AirTags","FinalCut","GarageBand","iBooks","iCloud","iLife","iMac","iMessage","iMovie","iPhoto","iWatch","iWork","LogicPro","macOS","ProTools","QuickTime","AdWords","AdSense","TikTok","Slack","Trello","Zoom","Twitch","Snapchat","WhatsApp","Telegram","Discord","Reddit","Quora","StackOverflow","StackExchange","Coca-Cola","AWS","GCP","VMware","CVS","ESL","EE","NBA","NCAA","NFL","WWE","WWF","FIFA","a.m.","p.m.","ca.","cc.","fig.","pl.","pt.","rev.","sr.","v.","vol.","et al.","pp.","p.","ph.d.","m.d.","d.d.s.","d.m.d.","d.o.","d.c.","d.v.m.","d.n.p.","d.p.m.","d.s.w.","d.s.n.","d.n.sc.","d.n.a.","d.n.t.","d.n.p.t.","d.n.o.","d.n.m.","d.n.e.","d.n.s.","d.n.p.s.","adj.","adv.","cf.","cm.","co.","corp.","dept.","dist.","ed.","edn.","esp.","etc.","ex.","i.e.","e.g.","op. cit.","vs.","Ltd.","Co.","Inc.","St.","Ave.","Bldg.","No."];t.wordReplacementsList=[{"a.k.a":"AKA"},{"a.s.a.p":"ASAP"},{angularjs:"Angular.js"},{"back-end":"Backend"},{"d.i.y":"DIY"},{"e-book":"eBook"},{"e-books":"eBooks"},{"e-commerce":"eCommerce"},{ecom:"eCommerce"},{ecommerce:"eCommerce"},{"f.a.q":"FAQ"},{"f.a.q.a":"FAQs"},{"f.a.q.s":"FAQs"},{"f.y.i":"FYI"},{"front-end":"Frontend"},{"full-stack":"Fullstack"},{nextjs:"Next.js"},{nodejs:"Node.js"},{nuxtjs:"Nuxt.js"},{reactjs:"React.js"},{"t.b.d":"TBD"},{vuejs:"Vue.js"},{phd:"ph.d."}];var r=Object.freeze({AP:"ap",APA:"apa",BRITISH:"british",CHICAGO:"chicago",NYT:"nyt",WIKIPEDIA:"wikipedia"});t.titleCaseStylesList=r;var n=Object.values(r);t.allowedTitleCaseStylesList=n;var o=Object.freeze({ap:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},apa:{shortConjunctionsList:["and","as","but","by","for","in","nor","of","on","or","so","to","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","on","to","up","via"],neverCapitalizedList:[]},british:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},chicago:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","on","to","up","with","via"],neverCapitalizedList:["etc."]},nyt:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},wikipedia:{shortConjunctionsList:["and","as","but","for","if","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]}});t.titleCaseDefaultOptionsList=o;t.ignoredWordList=[];t.correctPhraseCasingList=["The Cybersmile Foundation","CO. by Colgate","The Simpsons"]}.apply(t,[t]))||(e.exports=r)},858:(e,t,r)=>{var n,o;n=[t,r(485)],void 0===(o=function(e,r){"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||l(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){f(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function u(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=l(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function f(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}Object.defineProperty(e,"__esModule",{value:!0}),t.TitleCaserUtils=void 0;var d=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,a,l;return t=e,l=[{key:"validateOption",value:function(e,t){if(!Array.isArray(t))throw new TypeError("Invalid option: ".concat(e," must be an array"));if(!t.every((function(e){return"string"==typeof e})))throw new TypeError("Invalid option: ".concat(e," must be an array of strings"))}},{key:"validateOptions",value:function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var o=n[t];if("style"!==o)if("wordReplacementsList"!==o){if(!r.titleCaseDefaultOptionsList.hasOwnProperty(o))throw new TypeError("Invalid option: ".concat(o));this.TitleCaseValidator.validateOption(o,e[o])}else{if(!Array.isArray(e.wordReplacementsList))throw new TypeError("Invalid option: ".concat(o," must be an array"));var i,a=u(e.wordReplacementsList);try{for(a.s();!(i=a.n()).done;)if("string"!=typeof i.value)throw new TypeError("Invalid option: ".concat(o," must contain only strings"))}catch(e){a.e(e)}finally{a.f()}}else{if("string"!=typeof e.style)throw new TypeError("Invalid option: ".concat(o," must be a string"));if(!r.allowedTitleCaseStylesList.includes(e.style))throw new TypeError("Invalid option: ".concat(o," must be a string"))}}}},{key:"getTitleCaseOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=JSON.stringify({options:t,lowercaseWords:n});if(e.titleCaseOptionsCache.has(a))return e.titleCaseOptionsCache.get(a);var u=s(s({},r.titleCaseDefaultOptionsList[t.style||"ap"]),t),l=u.articlesList.concat(n).filter((function(e,t,r){return r.indexOf(e)===t})),c=u.shortConjunctionsList.concat(n).filter((function(e,t,r){return r.indexOf(e)===t})),p=u.shortPrepositionsList.concat(n).filter((function(e,t,r){return r.indexOf(e)===t})),f=[].concat(i((u.replaceTerms||[]).map((function(e){var t=o(e,2),r=t[0],n=t[1];return[r.toLowerCase(),n]}))),i(r.wordReplacementsList)),y={articlesList:l,shortConjunctionsList:c,shortPrepositionsList:p,neverCapitalizedList:i(u.neverCapitalizedList),replaceTerms:f};return e.titleCaseOptionsCache.set(a,y),y}},{key:"isShortConjunction",value:function(t,r){var n=i(e.getTitleCaseOptions({style:r}).shortConjunctionsList),o=t.toLowerCase();return n.includes(o)}},{key:"isArticle",value:function(t,r){return e.getTitleCaseOptions({style:r}).articlesList.includes(t.toLowerCase())}},{key:"isShortPreposition",value:function(t,r){return e.getTitleCaseOptions({style:r}).shortPrepositionsList.includes(t.toLowerCase())}},{key:"isNeverCapitalized",value:function(t,r){var n="".concat(r,"_").concat(t.toLowerCase());if(e.isNeverCapitalizedCache.has(n))return e.isNeverCapitalizedCache.get(n);var o=e.getTitleCaseOptions({style:r}).neverCapitalizedList.includes(t.toLowerCase());return e.isNeverCapitalizedCache.set(n,o),o}},{key:"isShortWord",value:function(t,o){if("string"!=typeof t)throw new TypeError("Invalid input: word must be a string. Received ".concat(n(t),"."));if(!r.allowedTitleCaseStylesList.includes(o))throw new Error("Invalid option: style must be one of ".concat(r.allowedTitleCaseStylesList.join(", "),"."));return e.isShortConjunction(t,o)||e.isArticle(t,o)||e.isShortPreposition(t,o)||e.isNeverCapitalized(t,o)}},{key:"hasNumbers",value:function(e){return/\d/.test(e)}},{key:"hasUppercaseMultiple",value:function(e){for(var t=0,r=0;r<e.length&&t<2;r++)/[A-Z]/.test(e[r])&&t++;return t>=2}},{key:"hasUppercaseIntentional",value:function(e){return/[A-Z]/.test(e.slice(1))&&/[a-z]/.test(e.slice(0,-1))}},{key:"hasSuffix",value:function(e){return e.length>"'s".length&&e.endsWith("'s")}},{key:"hasApostrophe",value:function(e){return-1!==e.indexOf("'")}},{key:"hasHyphen",value:function(e){return-1!==e.indexOf("-")||-1!==e.indexOf("–")||-1!==e.indexOf("—")}},{key:"hasRomanNumeral",value:function(e){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");return/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(e)}},{key:"hasHyphenRomanNumeral",value:function(t){if("string"!=typeof t||""===t)throw new TypeError("Invalid input: word must be a non-empty string.");for(var r=t.split("-"),n=0;n<r.length;n++)if(!e.hasRomanNumeral(r[n]))return!1;return!0}},{key:"hasHtmlBreak",value:function(e){return"nl2br"===e}},{key:"hasUnicodeSymbols",value:function(e){return/[^\x00-\x7F\u00A0-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u02B0-\u02FF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0800-\u083F\u0840-\u085F\u0860-\u087F\u0880-\u08AF\u08B0-\u08FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF]/.test(e)}},{key:"hasCurrencySymbols",value:function(e){return/[^\x00-\x7F\u00A0-\u00FF\u20AC\u20A0-\u20B9\u20BD\u20A1-\u20A2\u00A3-\u00A5\u058F\u060B\u09F2-\u09F3\u0AF1\u0BF9\u0E3F\u17DB\u20A6\u20A8\u20B1\u2113\u20AA-\u20AB\u20AA\u20AC-\u20AD\u20B9]/.test(e)}},{key:"isWordAmpersand",value:function(e){return/&amp;|&/.test(e)}},{key:"startsWithSymbol",value:function(e){if("string"!=typeof e)throw new Error("Parameter 'word' must be a string. Received '".concat(n(e),"' instead."));if(0===e.length)return!1;var t=e.charAt(0);return"#"===t||"@"===t||"."===t}},{key:"escapeSpecialCharacters",value:function(e){return e.replace(/[&<>"']/g,(function(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&#x27;";default:return e}}))}},{key:"unescapeSpecialCharacters",value:function(e){return e.replace(/&amp;|&lt;|&gt;|&quot;|&#x27;/g,(function(e){switch(e){case"&amp;":return"&";case"&lt;":return"<";case"&gt;":return">";case"&quot;":return'"';case"&#x27;":return"'";default:return e}}))}},{key:"endsWithSymbol",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[".",",",";",":","?","!"];if("string"!=typeof e||!Array.isArray(t))throw new Error("Invalid arguments");return t.some((function(t){return e.endsWith(t)}))||t.includes(e.slice(-2))}},{key:"isWordIgnored",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.ignoredWordList;if(!Array.isArray(n))throw new TypeError("Invalid input: ignoredWords must be an array.");if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");return t=e.toLowerCase().trim(),n.includes(t)}},{key:"isWordInArray",value:function(e,t){return!!Array.isArray(t)&&t.some((function(t){return t.toLowerCase()===e.toLowerCase()}))}},{key:"replaceTerm",value:function(e,t){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||"object"!==n(t))throw new TypeError("Invalid input: replaceTermObj must be a non-null object.");var r;if(r=e.toLowerCase(),t.hasOwnProperty(r))return t[r];if(t.hasOwnProperty(e))return t[e];var o=e.toUpperCase();return t.hasOwnProperty(o)?t[o]:e}},{key:"correctSuffix",value:function(e,t){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||!Array.isArray(t)||t.some((function(e){return"string"!=typeof e})))throw new TypeError("Invalid input: correctTerms must be an array of strings.");if(/'s$/i.test(e)){var r=e.slice(0,-2),n=t.findIndex((function(e){return e.toLowerCase()===r.toLowerCase()}));if(n>=0){var o=t[n];return"".concat(o,"'s")}var i=r.charAt(0).toUpperCase()+r.slice(1);return"".concat(i,"'s")}return e}},{key:"correctTerm",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/[-']/;if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||!Array.isArray(t))throw new TypeError("Invalid input: correctTerms must be an array.");if(!("string"==typeof r||Array.isArray(r)||r instanceof RegExp))throw new TypeError("Invalid input: delimiters must be a string, an array of strings, or a regular expression.");"string"==typeof r?r=new RegExp("[".concat(r,"]")):Array.isArray(r)&&(r=new RegExp("[".concat(r.join(""),"]")));for(var n=e.split(r),o=n.length,i=function(){var e=n[a].toLowerCase(),r=t.findIndex((function(t){return t.toLowerCase()===e}));r>=0&&(n[a]=t[r])},a=0;a<o;a++)i();return n.join(r.source.charAt(0))}},{key:"correctTermHyphenated",value:function(t,n){var o=t.split("-"),i=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},a=function(e){return e.charAt(0)+e.slice(1).toLowerCase()},s={ap:function(e,t){return 0===t?i(e):a(e)},chicago:i,apa:function(t,r,o){return e.isShortWord(t,n)&&r>0&&r<o-1?t.toLowerCase():i(t)},nyt:function(e,t){return 0===t?i(e):a(e)},wikipedia:function(e,t){return 0===t?i(e):a(e)}},u=s[n]||a,l=o.map((function(e,t){if(/^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(e))return e.toUpperCase();var n=e,i=e.toLowerCase(),a=r.correctTitleCasingList.findIndex((function(e){return e.toLowerCase()===i}));if(a>=0)n=r.correctTitleCasingList[a];else if(i.endsWith("'s")){var s=i.substring(0,i.length-2),l=r.correctTitleCasingList.findIndex((function(e){return e.toLowerCase()===s}));l>=0&&(n="".concat(r.correctTitleCasingList[l],"'s"))}return u(n,t,o.length)}));return l.join("-")}}],(a=null)&&p(t.prototype,a),l&&p(t,l),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.TitleCaserUtils=d,f(d,"TitleCaseValidator",void 0),f(d,"titleCaseOptionsCache",new Map),f(d,"isNeverCapitalizedCache",new Map)}.apply(t,n))||(e.exports=o)},352:(e,t,r)=>{var n,o;n=[t,r(429)],void 0===(o=function(e,t){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"TitleCaser",{enumerable:!0,get:function(){return t.TitleCaser}}),"function"!=typeof String.prototype.toTitleCase&&(String.prototype.toTitleCase=function(e){return new t.TitleCaser(e).toTitleCase(this)}),"object"===("undefined"==typeof window?"undefined":r(window))&&(window.TitleCaser=t.TitleCaser)}.apply(t,n))||(e.exports=o)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n](i,i.exports,r),i.loaded=!0,i.exports}r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);r(352)})();
@@ -1 +0,0 @@
1
- (()=>{"use strict";var e={429:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TitleCaser=void 0;var s=r(485),i=r(858);class o{constructor(e={}){this.options=e,this.wordReplacementsList=s.wordReplacementsList}toTitleCase(e){try{if(0===e.trim().length)throw new TypeError("Invalid input: input must not be empty.");if("string"!=typeof e)throw new TypeError("Invalid input: input must be a string.");if(void 0!==this.options&&"object"!=typeof this.options)throw new TypeError("Invalid options: options must be an object.");const{style:t="ap",neverCapitalize:r=[],replaceTermList:o=s.wordReplacementsList}=this.options,a=["nl2br",...r],{articlesList:n,shortConjunctionsList:l,shortPrepositionsList:c,neverCapitalizedList:u,replaceTerms:p}=i.TitleCaserUtils.getTitleCaseOptions(this.options,s.commonAbbreviationList,s.wordReplacementsList),d=o.map((e=>Object.keys(e)[0].toLowerCase())),C=Object.fromEntries(o.map((e=>[Object.keys(e)[0].toLowerCase(),Object.values(e)[0]])));let h=e.trim();h=h.replace(/ {2,}/g,(e=>e.slice(0,1))),h=h.replace(/<br\s*\/?>/gi,"nl2br ");const m=h.split(" ");h=m.map(((e,r)=>{switch(!0){case i.TitleCaserUtils.isWordAmpersand(e):case i.TitleCaserUtils.hasHtmlBreak(e):case i.TitleCaserUtils.isWordIgnored(e,a):return e;case d.includes(e.toLowerCase()):return C[e.toLowerCase()];case i.TitleCaserUtils.isWordInArray(e,s.correctTitleCasingList):return i.TitleCaserUtils.correctTerm(e,s.correctTitleCasingList);case i.TitleCaserUtils.hasSuffix(e,t):return i.TitleCaserUtils.correctSuffix(e,s.correctTitleCasingList);case i.TitleCaserUtils.hasHyphen(e):return i.TitleCaserUtils.correctTermHyphenated(e,t);case i.TitleCaserUtils.hasUppercaseIntentional(e):return e;case i.TitleCaserUtils.isShortWord(e,t)&&0!==r:return r>0&&i.TitleCaserUtils.endsWithSymbol(m[r-1],[":","?","!","."])?e.charAt(0).toUpperCase()+e.slice(1):e.toLowerCase();case i.TitleCaserUtils.endsWithSymbol(e):const o=e.split(/([.,\/#!$%\^&\*;:{}=\-_`~()])/g).map(((e,t)=>i.TitleCaserUtils.isWordInArray(e,s.correctTitleCasingList)?i.TitleCaserUtils.correctTerm(e,s.correctTitleCasingList):(t>0&&i.TitleCaserUtils.endsWithSymbol(e),e.charAt(0).toUpperCase()+e.slice(1))));return o.join("");case i.TitleCaserUtils.startsWithSymbol(e):return i.TitleCaserUtils.isWordInArray(e,s.correctTitleCasingList)?i.TitleCaserUtils.correctTerm(e):e;case i.TitleCaserUtils.hasRomanNumeral(e):return e.toUpperCase();case i.TitleCaserUtils.hasNumbers(e):return e;default:return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}})).join(" ");for(const e of s.correctPhraseCasingList)h.toLowerCase().includes(e.toLowerCase())&&(h=h.replace(new RegExp(e,"gi"),e));return h=h.replace(/nl2br /gi,"<br />"),h}catch(e){throw new Error(e)}}setReplaceTerms(e){if("object"!=typeof e)throw new TypeError("Invalid argument: replace terms must be an object.");Object.entries(e).forEach((([e,t])=>{const r=s.wordReplacementsList.findIndex((t=>t[e]));-1!==r?s.wordReplacementsList[r][e]=t:s.wordReplacementsList.push({[e]:t})})),this.options.wordReplacementsList=s.wordReplacementsList}addReplaceTerm(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Invalid argument: term and replacement must be strings.");const r=this.wordReplacementsList.findIndex((t=>t[e]));-1!==r?this.wordReplacementsList[r][e]=t:this.wordReplacementsList.push({[e]:t}),this.options.wordReplacementsList=this.wordReplacementsList}removeReplaceTerm(e){if("string"!=typeof e)throw new TypeError("Invalid argument: term must be a string.");const t=this.wordReplacementsList.findIndex((t=>Object.keys(t)[0]===e));if(-1===t)throw new Error(`Term '${e}' not found in word replacements list.`);this.wordReplacementsList.splice(t,1),this.options.wordReplacementsList=this.wordReplacementsList}setStyle(e){if("string"!=typeof e)throw new TypeError("Invalid argument: style must be a string.");this.options.style=e}}t.TitleCaser=o,e.exports&&(e.exports={TitleCaser:o})},485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.wordReplacementsList=t.titleCaseStylesList=t.titleCaseDefaultOptionsList=t.ignoredWordList=t.correctTitleCasingList=t.correctPhraseCasingList=t.commonAbbreviationList=t.allowedTitleCaseStylesList=void 0;t.commonAbbreviationList=["a","an","the","as","at","by","for","in","of","on","to","up","yet","so","but","nor","or","and"];t.correctTitleCasingList=["AJAX","CSS","DOM","ES6","HTML","JavaScript","jQuery","MobX","SCSS","TypeScript","Vue.js",".NET","ASP","ASPX","MySQL","PHP","PostgresQL","Python","SQL","GraphQL","HTML5","API","APIs","ASCII","CI","CircleCI","CLI","DLL","DNS","EC2","FTP","HTTP","HTTPs","ICMP","IDE","IP","ISP","JSON","JSP","LPWAN","M2M","MQTT","OOP","REST","SSH","SSL","TCP","UDP","URL","WLAN","WYSIWYG","XML","YAML","YML","IMAP","RSS","IaaS","PaaS","SaaS","CaaS","FaaS","XaaS","RaaS","IoE","IoT","LoRa","NB-IoT","RFID","RF","RFI","RFQ","ECMAScript","IO","I/O","DevOps","SecOps","DDoS","VoIP","AI","AR","ML","VR","w/","w/o","e-Book","e-Books","eBook","eBooks","eCommerce","eMarket","eMarketplace","eMarketplaces","eMarkets","eReader","eShop","eShops","eStore","eStores","E-commerce","AP","COGS","EBIT","EPS","FIFO","GAAP","LIFO","P&L","ROI","SOX","TCO","VAT","CAGR","DCF","ETF","IPO","IRR","M&A","NAV","PE","PEG","PPE","ROE","S&P","TVM","VC","B2B","B2C","CMO","CPA","CPC","CPL","CPM","CRM","CTA","CTR","SEO","SEM","SMM","USP","A/B","CTA","CTOR","CTR","KPI","PWA","SEM","SERP","SERPs","SMM","SMO","FAQ","FAQA","FAQS","UI","UI/UX","UX","T&C","TOS","PP","CRM","PoE","PoW","PoC","A11Y","PR","BANT","KPI","MQL","NPS","POS","SPIN","SQL","SWOT","AFA","ADR","CCPA","CFAA","CISG","DMCA","EULA","GDPR","HIPAA","NDA","SOW","TOS","CEO","CEOs","CFO","CFOs","CIO","CIOs","CMO","CMOs","COO","COOs","CPO","CPOs","CRO","CROs","CSO","CSOs","CTO","CTOs","EVP","EVPs","HR","HRs","SVP","SVPs","VP","VPs","NGO","NPO","NGOs","NPOs","UN","UNESCO","UNICEF","UNHCR","UNODC","UNDP","UNFPA","UNEP","Adobe","Airbnb","Alibaba","Allstate","American Express","Apple","AT&T","BMW","Boeing","Cisco","Citigroup","Coca","Deloitte","Disney","Dropbox","ExxonMobil","Ford","GE","General","Goldman Sachs","Google","Hilton","HP","IBM","Intel","JPMorgan","Johnson & Johnson","LinkedIn","McDonald's","Mercedes-Benz","Microsoft","Nestle","Nike","Nissan","Oracle","PepsiCo","Pfizer","Salesforce","Samsung","Shell","Sony","Tesla","Toyota","Uber","Verizon","Visa","Walmart","Wells Fargo","Yahoo","Zara","IKEA","Facebook","YouTube","Instagram","Twitter","TensorFlow","Amazon","Netflix","eBay","iPhone","iPad","iPod","PlayStation","PayPal","GitHub","GitLab","CodeIgniter","WordPress","WooCommerce","MongoDB","JIRA","HubSpot","AirDrop","AirPlay","AirPods","AirTags","FinalCut","GarageBand","iBooks","iCloud","iLife","iMac","iMessage","iMovie","iPhoto","iWatch","iWork","LogicPro","macOS","ProTools","QuickTime","AdWords","AdSense","TikTok","Slack","Trello","Zoom","Twitch","Snapchat","WhatsApp","Telegram","Discord","Reddit","Quora","StackOverflow","StackExchange","Coca-Cola","AWS","GCP","VMware","CVS","ESL","EE","NBA","NCAA","NFL","WWE","WWF","FIFA","a.m.","p.m.","ca.","cc.","fig.","pl.","pt.","rev.","sr.","v.","vol.","et al.","pp.","p.","ph.d.","m.d.","d.d.s.","d.m.d.","d.o.","d.c.","d.v.m.","d.n.p.","d.p.m.","d.s.w.","d.s.n.","d.n.sc.","d.n.a.","d.n.t.","d.n.p.t.","d.n.o.","d.n.m.","d.n.e.","d.n.s.","d.n.p.s.","adj.","adv.","cf.","cm.","co.","corp.","dept.","dist.","ed.","edn.","esp.","etc.","ex.","i.e.","e.g.","op. cit.","vs.","Ltd.","Co.","Inc.","St.","Ave.","Bldg.","No."];t.wordReplacementsList=[{"a.k.a":"AKA"},{"a.s.a.p":"ASAP"},{angularjs:"Angular.js"},{"back-end":"Backend"},{"d.i.y":"DIY"},{"e-book":"eBook"},{"e-books":"eBooks"},{"e-commerce":"eCommerce"},{ecom:"eCommerce"},{ecommerce:"eCommerce"},{"f.a.q":"FAQ"},{"f.a.q.a":"FAQs"},{"f.a.q.s":"FAQs"},{"f.y.i":"FYI"},{"front-end":"Frontend"},{"full-stack":"Fullstack"},{nextjs:"Next.js"},{nodejs:"Node.js"},{nuxtjs:"Nuxt.js"},{reactjs:"React.js"},{"t.b.d":"TBD"},{vuejs:"Vue.js"},{phd:"ph.d."}];const r=Object.freeze({AP:"ap",APA:"apa",BRITISH:"british",CHICAGO:"chicago",NYT:"nyt",WIKIPEDIA:"wikipedia"});t.titleCaseStylesList=r;const s=Object.values(r);t.allowedTitleCaseStylesList=s;const i=Object.freeze({ap:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},apa:{shortConjunctionsList:["and","as","but","by","for","in","nor","of","on","or","so","to","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","on","to","up","via"],neverCapitalizedList:[]},british:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},chicago:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","on","to","up","with","via"],neverCapitalizedList:["etc."]},nyt:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},wikipedia:{shortConjunctionsList:["and","as","but","for","if","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]}});t.titleCaseDefaultOptionsList=i;t.ignoredWordList=[];t.correctPhraseCasingList=["The Cybersmile Foundation","CO. by Colgate","The Simpsons"]},858:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TitleCaserUtils=void 0;var s=r(485);function i(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class o{static validateOption(e,t){if(!Array.isArray(t))throw new TypeError(`Invalid option: ${e} must be an array`);if(!t.every((e=>"string"==typeof e)))throw new TypeError(`Invalid option: ${e} must be an array of strings`)}static validateOptions(e){for(const t of Object.keys(e))if("style"!==t)if("wordReplacementsList"!==t){if(!s.titleCaseDefaultOptionsList.hasOwnProperty(t))throw new TypeError(`Invalid option: ${t}`);this.TitleCaseValidator.validateOption(t,e[t])}else{if(!Array.isArray(e.wordReplacementsList))throw new TypeError(`Invalid option: ${t} must be an array`);for(const r of e.wordReplacementsList)if("string"!=typeof r)throw new TypeError(`Invalid option: ${t} must contain only strings`)}else{if("string"!=typeof e.style)throw new TypeError(`Invalid option: ${t} must be a string`);if(!s.allowedTitleCaseStylesList.includes(e.style))throw new TypeError(`Invalid option: ${t} must be a string`)}}static getTitleCaseOptions(e={},t=[]){const r=JSON.stringify({options:e,lowercaseWords:t});if(o.titleCaseOptionsCache.has(r))return o.titleCaseOptionsCache.get(r);const i={...s.titleCaseDefaultOptionsList[e.style||"ap"],...e},a=i.articlesList.concat(t).filter(((e,t,r)=>r.indexOf(e)===t)),n=i.shortConjunctionsList.concat(t).filter(((e,t,r)=>r.indexOf(e)===t)),l=i.shortPrepositionsList.concat(t).filter(((e,t,r)=>r.indexOf(e)===t)),c=[...(i.replaceTerms||[]).map((([e,t])=>[e.toLowerCase(),t])),...s.wordReplacementsList],u={articlesList:a,shortConjunctionsList:n,shortPrepositionsList:l,neverCapitalizedList:[...i.neverCapitalizedList],replaceTerms:c};return o.titleCaseOptionsCache.set(r,u),u}static isShortConjunction(e,t){const r=[...o.getTitleCaseOptions({style:t}).shortConjunctionsList],s=e.toLowerCase();return r.includes(s)}static isArticle(e,t){return o.getTitleCaseOptions({style:t}).articlesList.includes(e.toLowerCase())}static isShortPreposition(e,t){const{shortPrepositionsList:r}=o.getTitleCaseOptions({style:t});return r.includes(e.toLowerCase())}static isNeverCapitalized(e,t){const r=`${t}_${e.toLowerCase()}`;if(o.isNeverCapitalizedCache.has(r))return o.isNeverCapitalizedCache.get(r);const{neverCapitalizedList:s}=o.getTitleCaseOptions({style:t}),i=s.includes(e.toLowerCase());return o.isNeverCapitalizedCache.set(r,i),i}static isShortWord(e,t){if("string"!=typeof e)throw new TypeError(`Invalid input: word must be a string. Received ${typeof e}.`);if(!s.allowedTitleCaseStylesList.includes(t))throw new Error(`Invalid option: style must be one of ${s.allowedTitleCaseStylesList.join(", ")}.`);return o.isShortConjunction(e,t)||o.isArticle(e,t)||o.isShortPreposition(e,t)||o.isNeverCapitalized(e,t)}static hasNumbers(e){return/\d/.test(e)}static hasUppercaseMultiple(e){let t=0;for(let r=0;r<e.length&&t<2;r++)/[A-Z]/.test(e[r])&&t++;return t>=2}static hasUppercaseIntentional(e){return/[A-Z]/.test(e.slice(1))&&/[a-z]/.test(e.slice(0,-1))}static hasSuffix(e){return e.length>"'s".length&&e.endsWith("'s")}static hasApostrophe(e){return-1!==e.indexOf("'")}static hasHyphen(e){return-1!==e.indexOf("-")||-1!==e.indexOf("–")||-1!==e.indexOf("—")}static hasRomanNumeral(e){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");return/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(e)}static hasHyphenRomanNumeral(e){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");const t=e.split("-");for(let e=0;e<t.length;e++)if(!o.hasRomanNumeral(t[e]))return!1;return!0}static hasHtmlBreak(e){return"nl2br"===e}static hasUnicodeSymbols(e){return/[^\x00-\x7F\u00A0-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u02B0-\u02FF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0800-\u083F\u0840-\u085F\u0860-\u087F\u0880-\u08AF\u08B0-\u08FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF]/.test(e)}static hasCurrencySymbols(e){return/[^\x00-\x7F\u00A0-\u00FF\u20AC\u20A0-\u20B9\u20BD\u20A1-\u20A2\u00A3-\u00A5\u058F\u060B\u09F2-\u09F3\u0AF1\u0BF9\u0E3F\u17DB\u20A6\u20A8\u20B1\u2113\u20AA-\u20AB\u20AA\u20AC-\u20AD\u20B9]/.test(e)}static isWordAmpersand(e){return/&amp;|&/.test(e)}static startsWithSymbol(e){if("string"!=typeof e)throw new Error(`Parameter 'word' must be a string. Received '${typeof e}' instead.`);if(0===e.length)return!1;const t=e.charAt(0);return"#"===t||"@"===t||"."===t}static escapeSpecialCharacters(e){return e.replace(/[&<>"']/g,(function(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&#x27;";default:return e}}))}static unescapeSpecialCharacters(e){return e.replace(/&amp;|&lt;|&gt;|&quot;|&#x27;/g,(function(e){switch(e){case"&amp;":return"&";case"&lt;":return"<";case"&gt;":return">";case"&quot;":return'"';case"&#x27;":return"'";default:return e}}))}static endsWithSymbol(e,t=[".",",",";",":","?","!"]){if("string"!=typeof e||!Array.isArray(t))throw new Error("Invalid arguments");return t.some((t=>e.endsWith(t)))||t.includes(e.slice(-2))}static isWordIgnored(e,t=s.ignoredWordList){if(!Array.isArray(t))throw new TypeError("Invalid input: ignoredWords must be an array.");if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");let r;return r=e.toLowerCase().trim(),t.includes(r)}static isWordInArray(e,t){return!!Array.isArray(t)&&t.some((t=>t.toLowerCase()===e.toLowerCase()))}static replaceTerm(e,t){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||"object"!=typeof t)throw new TypeError("Invalid input: replaceTermObj must be a non-null object.");let r;if(r=e.toLowerCase(),t.hasOwnProperty(r))return t[r];if(t.hasOwnProperty(e))return t[e];const s=e.toUpperCase();return t.hasOwnProperty(s)?t[s]:e}static correctSuffix(e,t){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||!Array.isArray(t)||t.some((e=>"string"!=typeof e)))throw new TypeError("Invalid input: correctTerms must be an array of strings.");if(/'s$/i.test(e)){const r=e.slice(0,-2),s=t.findIndex((e=>e.toLowerCase()===r.toLowerCase()));if(s>=0){return`${t[s]}'s`}return`${r.charAt(0).toUpperCase()+r.slice(1)}'s`}return e}static correctTerm(e,t,r=/[-']/){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||!Array.isArray(t))throw new TypeError("Invalid input: correctTerms must be an array.");if(!("string"==typeof r||Array.isArray(r)||r instanceof RegExp))throw new TypeError("Invalid input: delimiters must be a string, an array of strings, or a regular expression.");"string"==typeof r?r=new RegExp(`[${r}]`):Array.isArray(r)&&(r=new RegExp(`[${r.join("")}]`));const s=e.split(r),i=s.length;for(let e=0;e<i;e++){const r=s[e].toLowerCase(),i=t.findIndex((e=>e.toLowerCase()===r));i>=0&&(s[e]=t[i])}return s.join(r.source.charAt(0))}static correctTermHyphenated(e,t){const r=e.split("-"),i=e=>e.charAt(0).toUpperCase()+e.slice(1),a=e=>e.charAt(0)+e.slice(1).toLowerCase(),n={ap:(e,t)=>0===t?i(e):a(e),chicago:i,apa:(e,r,s)=>o.isShortWord(e,t)&&r>0&&r<s-1?e.toLowerCase():i(e),nyt:(e,t)=>0===t?i(e):a(e),wikipedia:(e,t)=>0===t?i(e):a(e)},l=n[t]||a,c=r.map(((e,t)=>{if(/^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(e))return e.toUpperCase();let i=e;const o=e.toLowerCase(),a=s.correctTitleCasingList.findIndex((e=>e.toLowerCase()===o));if(a>=0)i=s.correctTitleCasingList[a];else if(o.endsWith("'s")){const e=o.substring(0,o.length-2),t=s.correctTitleCasingList.findIndex((t=>t.toLowerCase()===e));t>=0&&(i=`${s.correctTitleCasingList[t]}'s`)}return l(i,t,r.length)}));return c.join("-")}}t.TitleCaserUtils=o,i(o,"TitleCaseValidator",void 0),i(o,"titleCaseOptionsCache",new Map),i(o,"isNeverCapitalizedCache",new Map)}},t={};function r(s){var i=t[s];if(void 0!==i)return i.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,r),o.exports}var s={};(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"TitleCaser",{enumerable:!0,get:function(){return t.TitleCaser}});var t=r(429);"function"!=typeof String.prototype.toTitleCase&&(String.prototype.toTitleCase=function(e){return new t.TitleCaser(e).toTitleCase(this)}),"object"==typeof window&&(window.TitleCaser=t.TitleCaser)})(),module.exports=s})();