@danielhaim/titlecaser 1.7.12 → 1.7.14
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 +196 -414
- package/dist/titlecaser.amd.js +2 -2
- package/dist/titlecaser.esm.js +2 -2
- package/dist/titlecaser.module.js +2 -2
- package/index.d.ts +1 -3
- package/package.json +1 -1
- package/src/TitleCaser.js +128 -60
- package/src/TitleCaserUtils.js +97 -128
package/dist/titlecaser.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielhaim/titlecaser - v1.7.
|
|
2
|
+
* @danielhaim/titlecaser - v1.7.14 - 2026-02-17
|
|
3
3
|
* https://github.com/danielhaim1/titlecaser.git
|
|
4
4
|
* Copyright (c) 2026 Daniel Haim, Licensed Apache-2.0
|
|
5
|
-
*/var e=function(){for(var e=[],r=arguments.length,t=new Array(r),a=0;a<r;a++)t[a]=arguments[a];return t.forEach((r=>{Array.isArray(r)?r.forEach((r=>{Object.values(r).forEach((r=>{e.push(...r)}))})):"object"==typeof r&&Object.values(r).forEach((r=>{e.push(...r)}))})),[...new Set(e)]}(JSON.parse('{"sports":["FIFA","UEFA","NBA","NFL","MLB","NHL","NASCAR","IOC","FIBA","ATP","WTA","PGA","LPGA","FIA","WADA","ITF","AFL","NRL","ICC","IRB","IHF","FIVB","FINA","UCI","IAAF","ISU","WSF","BWF","WBC","WBO","IBF","IBO","UEFA","CONMEBOL","CONCACAF","CAF","AFC","OFC","CPL","MLS","LaLiga","Bundesliga","Ligue1","Eredivisie","JLeague","KLeague","Ryder Cup","Davis Cup","FedCup","XGames","Olympics","Paralympics","Dakar"],"apple":["Apple","AirDrop","AirPlay","AirPods","AirTags","FinalCut","GarageBand","iBooks","iCloud","iLife","iMac","iMessage","iMovie","iPhoto","iWatch","iWork","LogicPro","macOS","ProTools","QuickTime","iPhone","iPad","iPod","iOS","macOS","tvOS","watchOS"],"corporate":["Deloitte","Devoteam","ExxonMobil","GE","Boeing","Shell","Chevron"],"tech":["Bing","Salesforce","Asus","Acer","Lenovo","Huawei","Xiaomi","Epson","Nvidia","AMD","Qualcomm","Logitech","Panasonic","Sharp","Toshiba","Philips","Fujitsu","Netgear","Lexmark","Razer","SAP","Symantec","Kaspersky","Avast","McAfee","Siemens","Canon","Nikon","Garmin","GoPro","Oculus","Zoom","Slack","Trello","WeChat","Alibaba","Tencent","Baidu","Roku","Fitbit","Dropbox","Reddit","TikTok","Slack","Trello","Uber","Zoom","Reddit","Quora","JIRA","ZoomInfo","HubSpot","Mailchimp","WeChat","Dropbox","Uber","Telegram","Discord","StackOverflow","Quora","Reddit","ZoomInfo","Airbnb","LinkedIn","Snapchat","GitHub","GitLab","Nginx","OpenSSL","Webpack","Unity3D","Figma","JIRA","Kubernetes","TensorFlow","NPM","WooCommerce","WordPress","Slack","Trello","Uber","Zoom","Reddit","Quora","WeChat","Dropbox","Telegram","Discord","StackOverflow","Airbnb","LinkedIn","Snapchat","JIRA","MobX","VMware","Google"],"business":["Visa","Mastercard","Citibank","JPMorgan","Barclay","AMEX","Citigroup","PayPal","BNP","HSBC","Santander","UBS","Allianz","Prudential","Vanguard","BlackRock","CapitalOne","TD","Robinhood","MoneyGram","SoFi","Experian","Equifax","TransUnion","MasterCard","Blockchain","Coinbase","Binance","Kraken","Ethereum","Bitcoin"],"automotive":["BMW","Ford","Mercedes","Nissan","Tesla","Toyota","Audi","Chevrolet","Chrysler","Dodge","Ferrari","Fiat","Honda","Hyundai","Infiniti","Jaguar","Jeep","Kia","Lamborghini","LandRover","Lexus","Maserati","Mazda","McLaren","Mitsubishi","Peugeot","Porsche","Renault","RollsRoyce","Saab","Subaru","Suzuki","Volkswagen","Volvo","Alfa Romeo","Bentley","Bugatti","Cadillac","Citroen","Daewoo","Daihatsu","Datsun","DeLorean","Fiat Chrysler","GMC","Holden","Hummer","Isuzu","Koenigsegg","Lancia","Lincoln","Lotus","Mahindra","Suzuki","Opel","Pagani","Perodua","Proton","Rover","Scania","Skoda","SsangYong","Tata","Vauxhall","VinFast","Yugo","Zenvo"],"media":["Disney","Netflix","YouTube","Instagram","Twitter","Facebook","Spotify","Hulu","TikTok","Snapchat","Vimeo","Twitch","Reddit","HBO","Showtime","Starz","Crunchyroll","Audible","Pixar","DreamWorks","MGM","Lionsgate","Miramax","EpicGames","Ubisoft","Blizzard","Capcom","Bethesda","Sega","Roku","Fandango","IMDb","Shazam","SoundCloud","Vevo","Vine","Zynga","Tidal","Quibi","Crave","Gaia","PlutoTV","Vudu","Kanopy","Mubi","BritBox"],"telecom":["Verizon","Sprint","Nokia","Ericsson","Vodafone","AT&T","Huawei","Xiaomi","Orange","NTT","T-Mobile","Telefonica","Airtel","Telstra","Rogers","Bell","MTN","ZTE","Qualcomm","Motorola","Telus","BT","Swisscom","SoftBank","KDDI"],"entertainment":["Disney","Netflix","YouTube","Instagram","Twitter","Facebook","Spotify","Hulu","TikTok","Snapchat","Vimeo","Twitch","Reddit","Pandora","HBO","Showtime","Starz","Paramount","Peacock","Crunchyroll","Audible","Pixar","DreamWorks","MGM","Lionsgate","Miramax","EpicGames","Ubisoft","Blizzard","Capcom","Bethesda","Sega","Roku","Fandango","IMDb","Shazam","SoundCloud","Vevo","Zynga","Tidal","Oscars"],"retail":["Amazon","eBay","IKEA","Walmart","Zara","Target","Costco","Sephora","Nordstrom","Tesco","Asda","Aldi","Lidl","Carrefour","Uniqlo","H&M","Gap","Cabela’s","BassPro","REI","Ulta","Saks","JCPenney","Belk","Argos","Safeway","Kroger","Publix","HomeDepot","Woolworths","Staples","OfficeMax","B&H","Newegg","MicroCenter","Frys","Monoprix","Waitrose","Morrisons","Ocado","Flipkart","Rakuten","Alibaba","JD","Taobao","Tmall","Guomei","Suning"],"food":["Nestle","Pepsi","Coca-Cola","PepsiCo","Starbucks","KFC","BurgerKing","PizzaHut","TacoBell","Kroger","Costco","Woolworths","Carrefour","Tesco","Aldi","Lidl","Walmart","Safeway","Publix","WholeFoods","RedBull","Monster","Nespresso","Heineken","Budweiser","Corona","Guinness","GeneralMills","Unilever","Kraft","Heinz","Danone","Campbell","Tyson","Conagra","Mondelez","Suntory","Diageo","Pernod"],"pharmaceutical":["Pfizer","Moderna","Gilead","Merck","Novartis","Sanofi","Roche","AbbVie","Amgen","Bayer","Biogen","BristolMyers","Celgene","GSK","Janssen","Lilly","Medtronic","Mylan","NovoNordisk","Regeneron","Teva","AstraZeneca","Boehringer","Daiichi","Eisai","Genentech","Grifols","Ipsen","Mundipharma","Otsuka","Purdue","Sandoz","Servier","SunPharma","Takeda","UCB","Viatris","Wockhardt","Zydus","Alkem"],"nonprofit":["NGO","NPO","NGOs","NPOs","UN","UNESCO","UNICEF","UNHCR","UNODC","UNDP","UNFPA","UNEP","UNRWA"]}'),JSON.parse('{"commercial":["Ltd.","LLC","PLC","Co.","Inc.","St.","Ave.","Bldg.","No.","GmbH"],"titles":["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","CMTO","CDO"],"accounting":["AP","COGS","EBIT","EPS","FIFO","GAAP","LIFO","P&L","ROI","SOX","TCO","VAT","EBITDA","NPV","WACC","AR"],"finance":["CAGR","DCF","ETF","IPO","IRR","M&A","NAV","PE","PEG","PPE","ROE","S&P","TVM","VC","FOMC","FX","ETF"],"legal":["AFA","ADR","CCPA","CFAA","CISG","DMCA","EULA","GDPR","HIPAA","NDA","SOW","TOS","LLM","JD","Esq.","AG","SARL","KYC","AML","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."]}'),JSON.parse('{"eterms":["eBook","eBooks","eMarket","eMarketplace","eMarketplaces","eMarkets","eReader","eShop","eShops","eStore","eStores","E-commerce","E-com"]}'),JSON.parse('{"countries":["Afghanistan","Albania","Algeria","Andorra","Angola","Antigua and Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burundi","Cabo Verde","Cambodia","Cameroon","Canada","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo","Costa Rica","Cote d\'Ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Eswatini","Ethiopia","Fiji","Finland","France","Gabon","Gambia","Georgia","Germany","Ghana","Greece","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Jordan","Kazakhstan","Kenya","Kiribati","Korea","Kosovo","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","New Zealand","Nicaragua","Niger","Nigeria","North Macedonia","Norway","Oman","Pakistan","Palau","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Qatar","Romania","Russia","Rwanda","Saint Kitts and Nevis","Saint Lucia","Saint Vincent and the Grenadines","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Korea","South Sudan","Spain","Sri Lanka","Sudan","Suriname","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Timor-Leste","Togo","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Yemen","Zambia","Zimbabwe"],"alpha2":["UK"],"alpha3":["USA"]}'),JSON.parse('{"advertising":["AdWords","AdSense","AdMob","DoubleClick","SpotX"],"digitalMarketing":["DSP","SSP","CTR","CPA","CPC","CPL","CPM","CRM","SEO","SEM","SMM","A/B","CTOR","KPI","SERP","FAQ","PR"],"general":["B2B","B2C","CMO","USP","PWA","SMO","T&C","TOS","PP","UI","UX","UI/UX"],"blockchain":["PoE","PoW","PoC"],"accessibility":["A11Y"]}'),JSON.parse('{"miscellaneous":["w/","w/o","Open Source","Cybersecurity","Ecosystem","Biodiversity","LGBT","LGBTQ+","LGBTQIA+","2SLGBTQ+","BIPOC"]}'),JSON.parse('{"terms":["API","APIs","ASCII","CI","CLI","DLL","DNS","EC2","FTP","HTTP","HTTPS","ICMP","IDE","IP","ISP","LPWAN","M2M","MQTT","OOP","REST","SSH","SSL","TCP","UDP","URL","WLAN","WYSIWYG","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","CI/CD","DevSecOps","UI/UX","UX/UI","UI","UX","MVC","ORM","3G","4G","5G","NumPy","VPN","PKI","WAN","NAT","GPU","SSD","HDD","RAM","Frontend","Backend","Fullstack"],"legal":["DMCA","GDPR","HIPAA","NDA","SOW","TOS"],"languages":["JavaScript","TypeScript","Java","PHP","SQL","CSS",".NET","ES5","ES6","NoSQL","DynamoDB","Terraform","CloudFormation","RDS","Python","Ruby","Go","Swift","Kotlin","Perl"],"formats":["JSON","XML","YAML","GraphQL","WebSocket","RESTful"],"secops":["RaaS","DevSecOps","SecOps","Cybersecurity","DDoS"],"technologies":["AWS","Azure","GCP","VMware","Docker","Ansible","Chef","Puppet","Git","Subversion","Jenkins","CircleCI","Hadoop","Spark","BigQuery","PowerBI","Tableau"],"os":["Android","macOS","Windows","Linux","iOS","Ubuntu","CentOS","Fedora","Debian","SUSE","HarmonyOS","FreeRTOS","BeOS","BSD","Cordova","Flutter"],"programming":["Angular","Bootstrap","CodeIgniter","jQuery","Laravel","Redux","Vue.js","VueX","SCSS","AJAX","GraphQL","HTML","HTML5","MySQL","MongoDB","PostgresQL","SQLite","ASP","ASPX","Elasticsearch","Nginx","OpenSSL","Webpack","Unity3D","Kubernetes","TensorFlow","NPM","cURL"]}'),JSON.parse('{"timeRelated":["a.m.","p.m.","ca.","cc.","fig.","pl.","pt.","rev.","sr.","v.","vol.","et al.","pp.","p."],"academic":["adj.","adv.","cf.","cm.","co.","corp.","dept.","dist.","ed.","edn.","esp.","etc.","ex.","i.e.","e.g.","op. cit.","vs."]}'),JSON.parse('{"ranks":["Pvt.","Cpl.","Sgt.","SSgt.","GySgt.","MSgt.","1stSgt.","SgtMaj.","WO1","CW2","CW3","CW4","CW5","2ndLt.","1stLt.","Capt.","Maj.","LtCol.","Col.","BrigGen.","MajGen.","LtGen.","Gen.","Adm.","Cpt.","Cmdr.","Lt.","Ens."],"branches":["Army","Navy","Air Force","Marines","Coast Guard","Space Force","National Guard","People\'s Liberation Army","Russian Ground Forces","JASDF","ROKA"],"units":["Platoon","Company","Battalion","Regiment","Brigade","Division","Corps","Squad","Fleet","Wing","Squadron","Task Force","Eurocorps","Battlegroup","Rapid Reaction Force","Joint Expeditionary Force"],"acronyms":["DoD","NATO","EUFOR","EUTM","OSCE","UNSC","JAG","ROTC","AFB","MOS","AWOL","MRE","IED","FOB","TOC","CONUS","OCONUS","UCMJ","USMC","USAF","USN","USA","SOCOM","CENTCOM","NORAD","PACOM","JTF","RPG","SAM","ASEAN","AUKUS","QUAD","CSTO","SCO","CFSP","EEAS","EUMS","Frontex","GRU","FSB","PLAN","PLAAF"],"equipment":["Humvee","MRAP","Apache","Black Hawk","Bradley","Abrams","F-16","F-22","F-35","B-2","B-52","C-130","LCAC","MRE"],"operations":["Operation Desert Storm","Operation Enduring Freedom","Operation Iraqi Freedom","Operation Inherent Resolve"],"treaties":["Lisbon Treaty","Maastricht Treaty","Treaty of Rome","Nice Treaty","Schengen Agreement"],"regions":["South China Sea","Taiwan Strait","Korean DMZ","Kashmir","Kuril Islands","Senkaku Islands"],"alliances":["NATO","AUKUS","QUAD","ASEAN","SCO","CSTO","Five Eyes"]}')),r=["the","in","to","within","towards","into","at","of","for","by","on","from","with","through","about","across","over","under","between"],t=[{"a.k.a":"AKA"},{"a.s.a.p":"ASAP"},{"f.a.q":"FAQ"},{"f.a.q.s":"FAQs"},{FAQS:"FAQs"},{"f.y.i":"FYI"},{"d.i.y":"DIY"},{"t.b.d":"TBD"},{"back-end":"Backend"},{"front-end":"Frontend"},{"full-stack":"Fullstack"},{nodejs:"Node.js"},{nextjs:"Next.js"},{nuxtjs:"Nuxt.js"},{reactjs:"React"},{"react.js":"React"},{"cyber-security":"Cybersecurity"}],a=Object.freeze({AP:"ap",APA:"apa",BRITISH:"british",CHICAGO:"chicago",NYT:"nyt",WIKIPEDIA:"wikipedia"}),i=Object.values(a),o=Object.freeze({ap:{caseStyle:"title",shortConjunctionsList:["and","but","or","nor","yet","so","for"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]},apa:{caseStyle:"title",shortConjunctionsList:["and","as","but","for","if","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","off","on","per","to","via"],neverCapitalizedList:[]},british:{caseStyle:"title",shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]},chicago:{caseStyle:"title",shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:["etc."]},nyt:{caseStyle:"title",shortConjunctionsList:["and","but","or","nor","yet","so","for"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]},wikipedia:{caseStyle:"sentence",shortConjunctionsList:["and","as","but","for","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]}}),n=[],s={"the cybersmile foundation":"The Cybersmile Foundation","co. by colgate":"CO. by Colgate","on & off":"On & Off","on and off":"On and Off"},c=Object.freeze({TRAILING_PUNCTUATION:/[.,!?;:]+$/,SPLIT_AT_PUNCTUATION:/([.,\/#!$%\^&\*;:{}=\-_`~()?])/g,HTML_BREAK:/<\s*br\s*\/?\s*>/gi,MULTIPLE_SPACES:/ {2,}/g,REGEX_ESCAPE:/[.*+?^${}()|[\]\\]/g}),l=["usa","us","u.s.a","u.s.","u.s","u.s.a.","eu","e.u.","e.u","uk","u.k.","u.k"],u=["the","via","among","across","beyond","outside","alongside","throughout","despite","unlike","upon"],p=["act","acts","administration","administrations","agency","agencies","agreement","agreements","airforce","airforces","aid","alliance","alliances","ambassador","ambassadors","authority","authorities","bill","bills","bloc","blocs","budget","budgets","bureau","bureaus","cabinet","cabinets","charter","charters","command","commands","commission","commissions","conference","conferences","congress","congresses","convention","conventions","council","councils","court","courts","defense","defences","defence","defenses","delegation","delegations","democracy","democracies","department","departments","development","developments","directive","directives","diplomacy","division","divisions","economy","economies","embassy","embassies","engagement","engagements","envoy","envoys","exports","federation","federations","finance","finances","forces","framework","frameworks","funding","government","governments","hearing","hearings","imports","initiative","initiatives","intel","intelligence","intervention","interventions","jurisdiction","jurisdictions","law","laws","leadership","leaders","legislation","liaison","liaisons","mandate","mandates","markets","marines","military","militaries","ministry","ministries","mission","missions","navy","navies","negotiations","office","offices","operations","oversight","parliament","parliaments","plan","plans","policies","policy","policy-makers","precedent","precedents","presence","program","programme","programmes","programs","project","projects","protocol","protocols","province","provinces","reform","reforms","regulation","regulations","regulator","regulators","relations","representation","representations","republic","republics","resolution","resolutions","ruling","rulings","sanctions","security","securities","senate","senates","service","services","state","states","statute","statutes","strategy","strategies","summit","summits","summitry","surveillance","talks","tariffs","territory","territories","trade","trades","treasury","treasuries","treaty","treaties","tribunal","tribunals","troops","union","unions","veterans","warships","zone","zones"];function d(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function m(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?d(Object(t),!0).forEach((function(r){h(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function h(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,r||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}class g{static validateOption(e,r){if(!Array.isArray(r))throw new TypeError("Invalid option: ".concat(e," must be an array"));if(!r.every((e=>"string"==typeof e)))throw new TypeError("Invalid option: ".concat(e," must be an array of strings"))}static validateOptions(e){for(var r of Object.keys(e))if("style"!==r)if("wordReplacementsList"!==r){if(!o.hasOwnProperty(r))throw new TypeError("Invalid option: ".concat(r));g.validateOption(r,e[r])}else{if(!Array.isArray(e.wordReplacementsList))throw new TypeError("Invalid option: ".concat(r," must be an array"));for(var t of e.wordReplacementsList)if("string"!=typeof t)throw new TypeError("Invalid option: ".concat(r," must contain only strings"))}else{if("string"!=typeof e.style)throw new TypeError("Invalid option: ".concat(r," must be a string"));if(!i.includes(e.style))throw new TypeError("Invalid option: ".concat(r," must be a string"))}}static getTitleCaseOptions(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=e.style||"ap",i=!!e.hasOwnProperty("smartQuotes")&&e.smartQuotes,n="".concat(a,"|").concat(i,"|").concat(r.length>0?r.sort().join(","):"");if(g.titleCaseOptionsCache.has(n))return g.titleCaseOptionsCache.get(n);var s=m(m(m({},o[e.style||"ap"]),e),{},{smartQuotes:!!e.hasOwnProperty("smartQuotes")&&e.smartQuotes}),c=[...new Set([...s.articlesList,...r])],l=[...new Set([...s.shortConjunctionsList,...r])],u=[...new Set([...s.shortPrepositionsList,...r])],p=[...(s.replaceTerms||[]).map((e=>{var[r,t]=e;return[r.toLowerCase(),t]})),...t],d={articlesList:c,shortConjunctionsList:l,shortPrepositionsList:u,neverCapitalizedList:[...s.neverCapitalizedList],replaceTerms:p,smartQuotes:s.smartQuotes};return g.titleCaseOptionsCache.set(n,d),d}static capitalizeFirstLetter(e){return e.charAt(0).toUpperCase()+e.slice(1)}static isShortConjunction(e,r){var t=[...g.getTitleCaseOptions({style:r}).shortConjunctionsList],a=e.toLowerCase();return t.includes(a)}static isArticle(e,r){return g.getTitleCaseOptions({style:r}).articlesList.includes(e.toLowerCase())}static isShortPreposition(e,r){var{shortPrepositionsList:t}=g.getTitleCaseOptions({style:r});return t.includes(e.toLowerCase())}static isNeverCapitalized(e,r){var t="".concat(r,"_").concat(e.toLowerCase());if(g.isNeverCapitalizedCache.has(t))return g.isNeverCapitalizedCache.get(t);var{neverCapitalizedList:a}=g.getTitleCaseOptions({style:r}),i=a.includes(e.toLowerCase());return g.isNeverCapitalizedCache.set(t,i),i}static isShortWord(e,r){if("string"!=typeof e)throw new TypeError("Invalid input: word must be a string. Received ".concat(typeof e,"."));if(!i.includes(r))throw new Error("Invalid option: style must be one of ".concat(i.join(", "),"."));return g.isShortConjunction(e,r)||g.isArticle(e,r)||g.isShortPreposition(e,r)||g.isNeverCapitalized(e,r)}static hasNumbers(e){return/\d/.test(e)}static hasUppercaseMultiple(e){for(var r=0,t=0;t<e.length&&r<2;t++)/[A-Z]/.test(e[t])&&r++;return r>=2}static hasUppercaseIntentional(e){if(e.length<=4)return/[A-Z]/.test(e.slice(1));var r=/[A-Z]/.test(e.slice(1)),t=/[a-z]/.test(e.slice(1));return r&&t}static isEntirelyUppercase(e){return e===e.toUpperCase()&&e!==e.toLowerCase()&&e.length>1}static isRegionalAcronym(e){if("string"!=typeof e)throw new TypeError("Invalid input: word must be a string.");if(e.length<2)return!1;var r=e.toLowerCase();return l.includes(r)}static isRegionalAcronymNoDot(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("string"!=typeof e||"string"!=typeof r)return!1;var a=e.toLowerCase().replace(/[^\w\s]/g,""),i=r.toLowerCase().replace(/[^\w\s]/g,"");return!!(t&&l.includes(a)&&["the"].includes(t.toLowerCase()))||l.includes(a)&&p.includes(i)}static isFinalWordRegionalAcronym(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("string"!=typeof e||"string"!=typeof r)return!1;var a=e.toLowerCase().replace(/[^\w]/g,""),i=r.toLowerCase().replace(/[^\w]/g,""),o="string"==typeof t?t.toLowerCase().replace(/[^\w]/g,""):null;return!!l.includes(a)&&(!!u.includes(i)||!("the"!==i||!o||!u.includes(o)))}static normalizeRegionalAcronym(e){if("string"!=typeof e)throw new TypeError("Invalid input: word must be a string.");return e.toUpperCase()}static normalizeAcronymKey(e){return e.toLowerCase().replace(/\./g,"")}static normalizeCasingForWordByStyle(e,r){if(!e||!r||!o[r])return!1;var t=e.toLowerCase(),{shortConjunctionsList:a,articlesList:i,shortPrepositionsList:n,neverCapitalizedList:s}=o[r];return!![...a,...i,...n,...s].includes(t)&&e}static hasSuffix(e){return e.length>2&&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.");var r=e.includes("'")?e.split("'"):[e],t=/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i;return r.every((e=>t.test(e)))}static hasHyphenRomanNumeral(e){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");for(var r=e.split("-"),t=0;t<r.length;t++)if(!g.hasRomanNumeral(r[t]))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/&|&/.test(e)}static startsWithSymbol(e){if("string"!=typeof e)throw new Error("Parameter 'word' must be a string. Received '".concat(typeof e,"' instead."));if(0===e.length)return!1;var r=e.charAt(0);return"#"===r||"@"===r||"."===r}static escapeSpecialCharacters(e){return e.replace(/[&<>"']/g,(function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";case"'":return"'";default:return e}}))}static unescapeSpecialCharacters(e){return e.replace(/&|<|>|"|'/g,(function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case""":return'"';case"'":return"'";default:return e}}))}static endsWithSymbol(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[".",",",";",":","?","!"];if("string"!=typeof e||!Array.isArray(r))throw new Error("Invalid arguments");return r.some((r=>e.endsWith(r)))||r.includes(e.slice(-2))}static isWordIgnored(e){var r,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;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.");return r=e.toLowerCase().trim(),t.includes(r)}static isWordInArray(e,r){return!!Array.isArray(r)&&r.some((r=>r.toLowerCase()===e.toLowerCase()))}static convertQuotesToCurly(e){for(var r={"'":["‘","’"],'"':["“","”"]},t="",a=0;a<e.length;a++){var i=e[a],o=r[i];if(o){var n=e[a-1],s=e[a+1],c=!n||" "===n||"\n"===n?o[0]:o[1];t+=c,c===o[1]&&/[.,;!?()\[\]{}:]/.test(s)&&(t+=s,a++)}else t+=i}return t}static replaceTerm(e,r){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!r||"object"!=typeof r)throw new TypeError("Invalid input: replaceTermObj must be a non-null object.");var t;if(t=e.toLowerCase(),r.hasOwnProperty(t))return r[t];if(r.hasOwnProperty(e))return r[e];var a=e.toUpperCase();return r.hasOwnProperty(a)?r[a]:e}static isElidedWord(e){if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");var r=new Set(["o’","fo’","ne’er","e’er","’tis","’twas","’n’"]),t=e.trim().toLowerCase().replace(/'/g,"’");for(var a of r)if(t.startsWith(a))return!0;return!1}static normalizeElidedWord(e){if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");var r=new Set(["o’","fo’","ne’er","e’er","’tis","’twas","’n’"]),t=e.trim(),a=t.replace(/'/g,"’").toLowerCase();for(var i of r)if(a.startsWith(i)){var o=i.length,n=t.slice(o);return i.charAt(0).toUpperCase()+i.slice(1)+(n.length>0?n.charAt(0).toUpperCase()+n.slice(1):"")}return!1}static correctSuffix(e,r){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!r||!Array.isArray(r)||r.some((e=>"string"!=typeof e)))throw new TypeError("Invalid input: correctTerms must be an array of strings.");if(/'s$/i.test(e)){var t=e.slice(0,-2),a=r.findIndex((e=>e.toLowerCase()===t.toLowerCase()));if(a>=0){var i=r[a];return"".concat(i,"'s")}var o=t.charAt(0).toUpperCase()+t.slice(1);return"".concat(o,"'s")}return e}static correctTerm(e,r){var t=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(!r||!Array.isArray(r))throw new TypeError("Invalid input: correctTerms must be an array.");if(!("string"==typeof t||Array.isArray(t)||t instanceof RegExp))throw new TypeError("Invalid input: delimiters must be a string, an array of strings, or a regular expression.");"string"==typeof t?t=new RegExp("[".concat(t,"]")):Array.isArray(t)&&(t=new RegExp("[".concat(t.join(""),"]")));for(var a=e.split(t),i=a.length,o=function(){var e=a[n].toLowerCase(),t=r.findIndex((r=>r.toLowerCase()===e));a[n]=t>=0?r[t]:a[n].charAt(0).toUpperCase()+a[n].slice(1).toLowerCase()},n=0;n<i;n++)o();var s=t.source.charAt(0);return e.includes("-")?s="-":e.includes("'")&&(s="'"),a.join(s)}static correctTermHyphenated(r,t){var a=r.split("-"),i=e=>e.charAt(0).toUpperCase()+e.slice(1),o=e=>e.charAt(0)+e.slice(1).toLowerCase(),n={ap:(e,r)=>0===r?i(e):o(e),chicago:i,apa:(e,r,a)=>g.isShortWord(e,t)&&r>0&&r<a-1?e.toLowerCase():i(e),nyt:(e,r)=>0===r?i(e):o(e),wikipedia:(e,r)=>0===r?i(e):o(e)},s=n[t]||o,c=a.map(((r,t)=>{var i=r;if(/^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})'s$/i.test(r))return i.toUpperCase().replace(/'S$/,"'s");var o=/^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i;if(o.test(r))return r.toUpperCase();if(r.includes("'")){var n=r.split("'");return n.every((e=>o.test(e)))?i=n.map((e=>e.toUpperCase())).join("'"):s(i,t,a.length)}var c=r.toLowerCase(),l=e.findIndex((e=>e.toLowerCase()===c));if(l>=0)i=e[l];else if(c.endsWith("'s")){var u=c.substring(0,c.length-2),p=e.findIndex((e=>e.toLowerCase()===u));p>=0&&(i="".concat(e[p],"'s"))}return s(i,t,a.length)}));return c.join("-")}}h(g,"TitleCaseValidator",void 0),h(g,"titleCaseOptionsCache",new Map),h(g,"isNeverCapitalizedCache",new Map);class y{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=e,this.debug=e.debug||!1,this.wordReplacementsList=t,this.phraseReplacementMap=s}logWarning(e){this.debug&&console.warn("Warning: ".concat(e))}toTitleCase(a){try{if(0===a.trim().length)throw new TypeError("Invalid input: input must not be empty.");if("string"!=typeof a)throw new TypeError("Invalid input: input must be a string.");if(a.length>1e5)throw new TypeError("Invalid input: input exceeds maximum length of 100,000 characters.");if(void 0!==this.options&&"object"!=typeof this.options)throw new TypeError("Invalid options: options must be an object.");var{style:i="ap",neverCapitalize:n=[],replaceTermList:s=this.wordReplacementsList,smartQuotes:l=!1}=this.options,u=o[i]||{},p=["nl2br",...n],{articlesList:d,shortConjunctionsList:m,shortPrepositionsList:h,neverCapitalizedList:C,replaceTerms:f,smartQuotes:S}=g.getTitleCaseOptions(this.options,r,t),A=s.map((e=>Object.keys(e)[0].toLowerCase())),w=Object.fromEntries(s.map((e=>[Object.keys(e)[0].toLowerCase(),Object.values(e)[0]])));this.logWarning("replaceTermsArray: ".concat(A)),this.logWarning("this.wordReplacementsList: ".concat(this.wordReplacementsList));var v=a.trim();v=(v=v.replace(c.HTML_BREAK," nl2br ")).replace(c.MULTIPLE_SPACES," "),g.isEntirelyUppercase(v.replace(/[^a-zA-Z]/g,""))&&(this.logWarning("Input string is entirely uppercase, normalizing to lowercase first"),v=v.toLowerCase());var b=v.split(" "),L=b.map(((r,t)=>{switch(!0){case g.isWordAmpersand(r):case g.hasHtmlBreak(r):case g.isWordIgnored(r,p):return r;case A.includes(r.toLowerCase()):return w[r.toLowerCase()];case g.isWordInArray(r,e):return g.correctTerm(r,e);case g.isElidedWord(r):return g.normalizeElidedWord(r);case g.hasHyphen(r):var a=r.replace(/[\W_]+$/,""),o=r.slice(a.length),n=a.split("-"),s=n.map((e=>{var r=e.toLowerCase();return A.includes(r)?w[r]:e})),l=!s.every(((e,r)=>e===n[r])),u=l?s.join("-"):g.correctTermHyphenated(r,i);return u.endsWith(o)?u:u+o;case g.hasSuffix(r,i):return g.correctSuffix(r,e);case g.hasUppercaseIntentional(r):return r;case g.isShortWord(r,i)&&0!==t:return t>0&&g.endsWithSymbol(b[t-1],[":","?","!","."])?r.charAt(0).toUpperCase()+r.slice(1):g.normalizeCasingForWordByStyle(r,i);case g.endsWithSymbol(r):this.logWarning("Check if the word ends with a symbol: ".concat(r));var d=r.split(c.SPLIT_AT_PUNCTUATION);this.logWarning("Splitting word at symbols, result: ".concat(d));var m=d.map((r=>{if(this.logWarning("Processing part: ".concat(r)),g.endsWithSymbol(r))return this.logWarning("Part is a symbol: ".concat(r)),r;if(this.logWarning("Part is a word: ".concat(r)),g.isWordInArray(r,e)){var t=g.correctTerm(r,e);return this.logWarning("Word is in specialTermsList, corrected term: ".concat(t)),t}if(A.includes(r)){var a=w[r];return this.logWarning("Word is in replaceTermsArray, replacement: ".concat(a)),a}var i=r.charAt(0).toUpperCase()+r.slice(1).toLowerCase();return this.logWarning("Applying title casing to word: ".concat(i)),i}));return m.join("");case g.startsWithSymbol(r):return g.isWordInArray(r,e)?g.correctTerm(r):r;case g.hasRomanNumeral(r):return r.toUpperCase();case g.hasNumbers(r):return r;default:return r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()}}));v=(v=L.join(" ")).replace(/nl2br/gi,"<br>"),l&&(v=g.convertQuotesToCurly(v));for(var T=v.split(" "),O=T[0],P=T[1]||null,I=0;I<T.length;I++){I>0&&T[I-1];var F=T[I],E=I<T.length-1?T[I+1]:null,R=F.match(c.TRAILING_PUNCTUATION),M="";R&&(M=R[0],F=F.replace(c.TRAILING_PUNCTUATION,"")),g.isRegionalAcronym(F)&&(F=g.normalizeRegionalAcronym(F)),g.isRegionalAcronymNoDot(F,E)&&(F=g.normalizeRegionalAcronym(F)),""!==M&&(F+=M)}for(var B=(v=T.join(" ")).split(" "),N=1;N<B.length-1;N++){var k=B[N];B[N-1],B[N+1];k===k.toUpperCase()||g.hasUppercaseIntentional(k)||g.isWordInArray(k,r)&&(B[N]=k.length<=3?k.toLowerCase():k)}for(var U=(v=B.join(" ")).split(" "),D=0;D<U.length;D++){var W=U[D],j=U[D+1],G=U[D-1];j&&g.isRegionalAcronymNoDot(W,j,G)&&(U[D]=W.toUpperCase())}var z=U[U.length-1],x=U[U.length-2],H=U[U.length-3];for(var[V,K]of(g.isRegionalAcronym(O)&&(this.logWarning("firstWord is a regional acronym: ".concat(O)),U[0]=O.toUpperCase()),g.isRegionalAcronymNoDot(O,P)&&(U[0]=O.toUpperCase()),g.isFinalWordRegionalAcronym(z,x,H)&&(U[U.length-1]=z.toUpperCase()),v=U.join(" "),Object.entries(this.phraseReplacementMap))){var Q=new RegExp(V.replace(c.REGEX_ESCAPE,"\\$&"),"gi");v=v.replace(Q,K)}if("sentence"===u.caseStyle){for(var J=v.split(" "),X=!1,Z=0;Z<J.length;Z++){var _=J[Z];X||!/[A-Za-z]/.test(_)?y.shouldKeepCasing(_,e)||(J[Z]=_.toLowerCase()):(y.shouldKeepCasing(_,e)||(J[Z]=_.charAt(0).toUpperCase()+_.slice(1).toLowerCase()),X=!0)}v=J.join(" ")}return v}catch(e){throw e instanceof Error?e:new Error(String(e))}}setReplaceTerms(e){if(!Array.isArray(e))throw new TypeError("Invalid argument: setReplaceTerms must be an array of objects.");e.forEach((e=>{if(e&&"object"==typeof e){var[r,t]=Object.entries(e)[0],a=this.wordReplacementsList.findIndex((e=>e.hasOwnProperty(r)));-1!==a?this.wordReplacementsList[a][r]=t:this.wordReplacementsList.push({[r]:t})}else console.warn("Invalid entry in terms array:",e)})),this.options.wordReplacementsList=this.wordReplacementsList,this.logWarning("Log the updated this.wordReplacementsList: ".concat(this.wordReplacementsList))}addReplaceTerm(e,r){if("string"!=typeof e||"string"!=typeof r)throw new TypeError("Invalid argument: term and replacement must be strings.");var t=this.wordReplacementsList.findIndex((r=>Object.keys(r)[0]===e));-1!==t?this.wordReplacementsList[t][e]=r:this.wordReplacementsList.push({[e]:r}),this.options.wordReplacementsList=this.wordReplacementsList}removeReplaceTerm(e){if("string"!=typeof e)throw new TypeError("Invalid argument: term must be a string.");var r=this.wordReplacementsList.findIndex((r=>Object.keys(r)[0]===e));if(-1===r)throw new Error("Term '".concat(e,"' not found in word replacements list."));this.wordReplacementsList.splice(r,1),this.options.wordReplacementsList=this.wordReplacementsList,this.logWarning("Log the updated this.wordReplacementsList: ".concat(this.wordReplacementsList))}addExactPhraseReplacements(e){if(!Array.isArray(e))throw new TypeError("Invalid argument: newPhrases must be an array.");e.forEach((e=>{if("object"!=typeof e||Array.isArray(e)||1!==Object.keys(e).length){if("object"!=typeof e||Array.isArray(e))throw new TypeError("Invalid argument: Each item must be an object with a single key-value pair.");Object.entries(e).forEach((e=>{var[r,t]=e;if("string"!=typeof r||"string"!=typeof t)throw new TypeError("Invalid argument: Each key-value pair must contain strings.");this.phraseReplacementMap[r]=t}))}else{var r=Object.keys(e)[0],t=e[r];if("string"!=typeof r||"string"!=typeof t)throw new TypeError("Invalid argument: Each key-value pair must contain strings.");this.phraseReplacementMap[r]=t}})),this.logWarning("Log the this.phraseReplacementMap: ".concat(this.phraseReplacementMap))}setStyle(e){if("string"!=typeof e)throw new TypeError("Invalid argument: style must be a string.");this.options.style=e}static shouldKeepCasing(e,r){return!!g.isRegionalAcronym(e)||(!!g.hasUppercaseIntentional(e)||!!g.isWordInArray(e,r))}}void 0===String.prototype.toTitleCase&&(String.prototype.toTitleCase=function(e){return new y(e).toTitleCase(this)}),"undefined"!=typeof window&&window.document&&(window.TitleCaser=y);const C=y;export{y as TitleCaser,C as default};
|
|
5
|
+
*/var e=function(){for(var e=[],r=arguments.length,t=new Array(r),a=0;a<r;a++)t[a]=arguments[a];return t.forEach((r=>{Array.isArray(r)?r.forEach((r=>{Object.values(r).forEach((r=>{e.push(...r)}))})):"object"==typeof r&&Object.values(r).forEach((r=>{e.push(...r)}))})),[...new Set(e)]}(JSON.parse('{"sports":["FIFA","UEFA","NBA","NFL","MLB","NHL","NASCAR","IOC","FIBA","ATP","WTA","PGA","LPGA","FIA","WADA","ITF","AFL","NRL","ICC","IRB","IHF","FIVB","FINA","UCI","IAAF","ISU","WSF","BWF","WBC","WBO","IBF","IBO","UEFA","CONMEBOL","CONCACAF","CAF","AFC","OFC","CPL","MLS","LaLiga","Bundesliga","Ligue1","Eredivisie","JLeague","KLeague","Ryder Cup","Davis Cup","FedCup","XGames","Olympics","Paralympics","Dakar"],"apple":["Apple","AirDrop","AirPlay","AirPods","AirTags","FinalCut","GarageBand","iBooks","iCloud","iLife","iMac","iMessage","iMovie","iPhoto","iWatch","iWork","LogicPro","macOS","ProTools","QuickTime","iPhone","iPad","iPod","iOS","macOS","tvOS","watchOS"],"corporate":["Deloitte","Devoteam","ExxonMobil","GE","Boeing","Shell","Chevron"],"tech":["Bing","Salesforce","Asus","Acer","Lenovo","Huawei","Xiaomi","Epson","Nvidia","AMD","Qualcomm","Logitech","Panasonic","Sharp","Toshiba","Philips","Fujitsu","Netgear","Lexmark","Razer","SAP","Symantec","Kaspersky","Avast","McAfee","Siemens","Canon","Nikon","Garmin","GoPro","Oculus","Zoom","Slack","Trello","WeChat","Alibaba","Tencent","Baidu","Roku","Fitbit","Dropbox","Reddit","TikTok","Slack","Trello","Uber","Zoom","Reddit","Quora","JIRA","ZoomInfo","HubSpot","Mailchimp","WeChat","Dropbox","Uber","Telegram","Discord","StackOverflow","Quora","Reddit","ZoomInfo","Airbnb","LinkedIn","Snapchat","GitHub","GitLab","Nginx","OpenSSL","Webpack","Unity3D","Figma","JIRA","Kubernetes","TensorFlow","NPM","WooCommerce","WordPress","Slack","Trello","Uber","Zoom","Reddit","Quora","WeChat","Dropbox","Telegram","Discord","StackOverflow","Airbnb","LinkedIn","Snapchat","JIRA","MobX","VMware","Google"],"business":["Visa","Mastercard","Citibank","JPMorgan","Barclay","AMEX","Citigroup","PayPal","BNP","HSBC","Santander","UBS","Allianz","Prudential","Vanguard","BlackRock","CapitalOne","TD","Robinhood","MoneyGram","SoFi","Experian","Equifax","TransUnion","MasterCard","Blockchain","Coinbase","Binance","Kraken","Ethereum","Bitcoin"],"automotive":["BMW","Ford","Mercedes","Nissan","Tesla","Toyota","Audi","Chevrolet","Chrysler","Dodge","Ferrari","Fiat","Honda","Hyundai","Infiniti","Jaguar","Jeep","Kia","Lamborghini","LandRover","Lexus","Maserati","Mazda","McLaren","Mitsubishi","Peugeot","Porsche","Renault","RollsRoyce","Saab","Subaru","Suzuki","Volkswagen","Volvo","Alfa Romeo","Bentley","Bugatti","Cadillac","Citroen","Daewoo","Daihatsu","Datsun","DeLorean","Fiat Chrysler","GMC","Holden","Hummer","Isuzu","Koenigsegg","Lancia","Lincoln","Lotus","Mahindra","Suzuki","Opel","Pagani","Perodua","Proton","Rover","Scania","Skoda","SsangYong","Tata","Vauxhall","VinFast","Yugo","Zenvo"],"media":["Disney","Netflix","YouTube","Instagram","Twitter","Facebook","Spotify","Hulu","TikTok","Snapchat","Vimeo","Twitch","Reddit","HBO","Showtime","Starz","Crunchyroll","Audible","Pixar","DreamWorks","MGM","Lionsgate","Miramax","EpicGames","Ubisoft","Blizzard","Capcom","Bethesda","Sega","Roku","Fandango","IMDb","Shazam","SoundCloud","Vevo","Vine","Zynga","Tidal","Quibi","Crave","Gaia","PlutoTV","Vudu","Kanopy","Mubi","BritBox"],"telecom":["Verizon","Sprint","Nokia","Ericsson","Vodafone","AT&T","Huawei","Xiaomi","Orange","NTT","T-Mobile","Telefonica","Airtel","Telstra","Rogers","Bell","MTN","ZTE","Qualcomm","Motorola","Telus","BT","Swisscom","SoftBank","KDDI"],"entertainment":["Disney","Netflix","YouTube","Instagram","Twitter","Facebook","Spotify","Hulu","TikTok","Snapchat","Vimeo","Twitch","Reddit","Pandora","HBO","Showtime","Starz","Paramount","Peacock","Crunchyroll","Audible","Pixar","DreamWorks","MGM","Lionsgate","Miramax","EpicGames","Ubisoft","Blizzard","Capcom","Bethesda","Sega","Roku","Fandango","IMDb","Shazam","SoundCloud","Vevo","Zynga","Tidal","Oscars"],"retail":["Amazon","eBay","IKEA","Walmart","Zara","Target","Costco","Sephora","Nordstrom","Tesco","Asda","Aldi","Lidl","Carrefour","Uniqlo","H&M","Gap","Cabela’s","BassPro","REI","Ulta","Saks","JCPenney","Belk","Argos","Safeway","Kroger","Publix","HomeDepot","Woolworths","Staples","OfficeMax","B&H","Newegg","MicroCenter","Frys","Monoprix","Waitrose","Morrisons","Ocado","Flipkart","Rakuten","Alibaba","JD","Taobao","Tmall","Guomei","Suning"],"food":["Nestle","Pepsi","Coca-Cola","PepsiCo","Starbucks","KFC","BurgerKing","PizzaHut","TacoBell","Kroger","Costco","Woolworths","Carrefour","Tesco","Aldi","Lidl","Walmart","Safeway","Publix","WholeFoods","RedBull","Monster","Nespresso","Heineken","Budweiser","Corona","Guinness","GeneralMills","Unilever","Kraft","Heinz","Danone","Campbell","Tyson","Conagra","Mondelez","Suntory","Diageo","Pernod"],"pharmaceutical":["Pfizer","Moderna","Gilead","Merck","Novartis","Sanofi","Roche","AbbVie","Amgen","Bayer","Biogen","BristolMyers","Celgene","GSK","Janssen","Lilly","Medtronic","Mylan","NovoNordisk","Regeneron","Teva","AstraZeneca","Boehringer","Daiichi","Eisai","Genentech","Grifols","Ipsen","Mundipharma","Otsuka","Purdue","Sandoz","Servier","SunPharma","Takeda","UCB","Viatris","Wockhardt","Zydus","Alkem"],"nonprofit":["NGO","NPO","NGOs","NPOs","UN","UNESCO","UNICEF","UNHCR","UNODC","UNDP","UNFPA","UNEP","UNRWA"]}'),JSON.parse('{"commercial":["Ltd.","LLC","PLC","Co.","Inc.","St.","Ave.","Bldg.","No.","GmbH"],"titles":["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","CMTO","CDO"],"accounting":["AP","COGS","EBIT","EPS","FIFO","GAAP","LIFO","P&L","ROI","SOX","TCO","VAT","EBITDA","NPV","WACC","AR"],"finance":["CAGR","DCF","ETF","IPO","IRR","M&A","NAV","PE","PEG","PPE","ROE","S&P","TVM","VC","FOMC","FX","ETF"],"legal":["AFA","ADR","CCPA","CFAA","CISG","DMCA","EULA","GDPR","HIPAA","NDA","SOW","TOS","LLM","JD","Esq.","AG","SARL","KYC","AML","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."]}'),JSON.parse('{"eterms":["eBook","eBooks","eMarket","eMarketplace","eMarketplaces","eMarkets","eReader","eShop","eShops","eStore","eStores","E-commerce","E-com"]}'),JSON.parse('{"countries":["Afghanistan","Albania","Algeria","Andorra","Angola","Antigua and Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burundi","Cabo Verde","Cambodia","Cameroon","Canada","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo","Costa Rica","Cote d\'Ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Eswatini","Ethiopia","Fiji","Finland","France","Gabon","Gambia","Georgia","Germany","Ghana","Greece","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Jordan","Kazakhstan","Kenya","Kiribati","Korea","Kosovo","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","New Zealand","Nicaragua","Niger","Nigeria","North Macedonia","Norway","Oman","Pakistan","Palau","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Qatar","Romania","Russia","Rwanda","Saint Kitts and Nevis","Saint Lucia","Saint Vincent and the Grenadines","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Korea","South Sudan","Spain","Sri Lanka","Sudan","Suriname","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Timor-Leste","Togo","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Yemen","Zambia","Zimbabwe"],"alpha2":["UK"],"alpha3":["USA"]}'),JSON.parse('{"advertising":["AdWords","AdSense","AdMob","DoubleClick","SpotX"],"digitalMarketing":["DSP","SSP","CTR","CPA","CPC","CPL","CPM","CRM","SEO","SEM","SMM","A/B","CTOR","KPI","SERP","FAQ","PR"],"general":["B2B","B2C","CMO","USP","PWA","SMO","T&C","TOS","PP","UI","UX","UI/UX"],"blockchain":["PoE","PoW","PoC"],"accessibility":["A11Y"]}'),JSON.parse('{"miscellaneous":["w/","w/o","Open Source","Cybersecurity","Ecosystem","Biodiversity","LGBT","LGBTQ+","LGBTQIA+","2SLGBTQ+","BIPOC"]}'),JSON.parse('{"terms":["API","APIs","ASCII","CI","CLI","DLL","DNS","EC2","FTP","HTTP","HTTPS","ICMP","IDE","IP","ISP","LPWAN","M2M","MQTT","OOP","REST","SSH","SSL","TCP","UDP","URL","WLAN","WYSIWYG","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","CI/CD","DevSecOps","UI/UX","UX/UI","UI","UX","MVC","ORM","3G","4G","5G","NumPy","VPN","PKI","WAN","NAT","GPU","SSD","HDD","RAM","Frontend","Backend","Fullstack"],"legal":["DMCA","GDPR","HIPAA","NDA","SOW","TOS"],"languages":["JavaScript","TypeScript","Java","PHP","SQL","CSS",".NET","ES5","ES6","NoSQL","DynamoDB","Terraform","CloudFormation","RDS","Python","Ruby","Go","Swift","Kotlin","Perl"],"formats":["JSON","XML","YAML","GraphQL","WebSocket","RESTful"],"secops":["RaaS","DevSecOps","SecOps","Cybersecurity","DDoS"],"technologies":["AWS","Azure","GCP","VMware","Docker","Ansible","Chef","Puppet","Git","Subversion","Jenkins","CircleCI","Hadoop","Spark","BigQuery","PowerBI","Tableau"],"os":["Android","macOS","Windows","Linux","iOS","Ubuntu","CentOS","Fedora","Debian","SUSE","HarmonyOS","FreeRTOS","BeOS","BSD","Cordova","Flutter"],"programming":["Angular","Bootstrap","CodeIgniter","jQuery","Laravel","Redux","Vue.js","VueX","SCSS","AJAX","GraphQL","HTML","HTML5","MySQL","MongoDB","PostgresQL","SQLite","ASP","ASPX","Elasticsearch","Nginx","OpenSSL","Webpack","Unity3D","Kubernetes","TensorFlow","NPM","cURL"]}'),JSON.parse('{"timeRelated":["a.m.","p.m.","ca.","cc.","fig.","pl.","pt.","rev.","sr.","v.","vol.","et al.","pp.","p."],"academic":["adj.","adv.","cf.","cm.","co.","corp.","dept.","dist.","ed.","edn.","esp.","etc.","ex.","i.e.","e.g.","op. cit.","vs."]}'),JSON.parse('{"ranks":["Pvt.","Cpl.","Sgt.","SSgt.","GySgt.","MSgt.","1stSgt.","SgtMaj.","WO1","CW2","CW3","CW4","CW5","2ndLt.","1stLt.","Capt.","Maj.","LtCol.","Col.","BrigGen.","MajGen.","LtGen.","Gen.","Adm.","Cpt.","Cmdr.","Lt.","Ens."],"branches":["Army","Navy","Air Force","Marines","Coast Guard","Space Force","National Guard","People\'s Liberation Army","Russian Ground Forces","JASDF","ROKA"],"units":["Platoon","Company","Battalion","Regiment","Brigade","Division","Corps","Squad","Fleet","Wing","Squadron","Task Force","Eurocorps","Battlegroup","Rapid Reaction Force","Joint Expeditionary Force"],"acronyms":["DoD","NATO","EUFOR","EUTM","OSCE","UNSC","JAG","ROTC","AFB","MOS","AWOL","MRE","IED","FOB","TOC","CONUS","OCONUS","UCMJ","USMC","USAF","USN","USA","SOCOM","CENTCOM","NORAD","PACOM","JTF","RPG","SAM","ASEAN","AUKUS","QUAD","CSTO","SCO","CFSP","EEAS","EUMS","Frontex","GRU","FSB","PLAN","PLAAF"],"equipment":["Humvee","MRAP","Apache","Black Hawk","Bradley","Abrams","F-16","F-22","F-35","B-2","B-52","C-130","LCAC","MRE"],"operations":["Operation Desert Storm","Operation Enduring Freedom","Operation Iraqi Freedom","Operation Inherent Resolve"],"treaties":["Lisbon Treaty","Maastricht Treaty","Treaty of Rome","Nice Treaty","Schengen Agreement"],"regions":["South China Sea","Taiwan Strait","Korean DMZ","Kashmir","Kuril Islands","Senkaku Islands"],"alliances":["NATO","AUKUS","QUAD","ASEAN","SCO","CSTO","Five Eyes"]}')),r=["the","in","to","within","towards","into","at","of","for","by","on","from","with","through","about","across","over","under","between"],t=[{"a.k.a":"AKA"},{"a.s.a.p":"ASAP"},{"f.a.q":"FAQ"},{"f.a.q.s":"FAQs"},{FAQS:"FAQs"},{"f.y.i":"FYI"},{"d.i.y":"DIY"},{"t.b.d":"TBD"},{"back-end":"Backend"},{"front-end":"Frontend"},{"full-stack":"Fullstack"},{nodejs:"Node.js"},{nextjs:"Next.js"},{nuxtjs:"Nuxt.js"},{reactjs:"React"},{"react.js":"React"},{"cyber-security":"Cybersecurity"}],a=Object.freeze({AP:"ap",APA:"apa",BRITISH:"british",CHICAGO:"chicago",NYT:"nyt",WIKIPEDIA:"wikipedia"}),i=Object.values(a),o=Object.freeze({ap:{caseStyle:"title",shortConjunctionsList:["and","but","or","nor","yet","so","for"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]},apa:{caseStyle:"title",shortConjunctionsList:["and","as","but","for","if","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","off","on","per","to","via"],neverCapitalizedList:[]},british:{caseStyle:"title",shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]},chicago:{caseStyle:"title",shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:["etc."]},nyt:{caseStyle:"title",shortConjunctionsList:["and","but","or","nor","yet","so","for"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]},wikipedia:{caseStyle:"sentence",shortConjunctionsList:["and","as","but","for","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]}}),n=[],s={"the cybersmile foundation":"The Cybersmile Foundation","co. by colgate":"CO. by Colgate","on & off":"On & Off","on and off":"On and Off"},l=Object.freeze({TRAILING_PUNCTUATION:/[.,!?;:]+$/,SPLIT_AT_PUNCTUATION:/([.,\/#!$%\^&\*;:{}=\-_`~()?])/g,HTML_BREAK:/<\s*br\s*\/?\s*>/gi,MULTIPLE_SPACES:/ {2,}/g,REGEX_ESCAPE:/[.*+?^${}()|[\]\\]/g}),c=["usa","us","u.s.a","u.s.","u.s","u.s.a.","eu","e.u.","e.u","uk","u.k.","u.k"],u=["the","via","among","across","beyond","outside","alongside","throughout","despite","unlike","upon"],p=["act","acts","administration","administrations","agency","agencies","agreement","agreements","airforce","airforces","aid","alliance","alliances","ambassador","ambassadors","authority","authorities","bill","bills","bloc","blocs","budget","budgets","bureau","bureaus","cabinet","cabinets","charter","charters","command","commands","commission","commissions","conference","conferences","congress","congresses","convention","conventions","council","councils","court","courts","defense","defences","defence","defenses","delegation","delegations","democracy","democracies","department","departments","development","developments","directive","directives","diplomacy","division","divisions","economy","economies","embassy","embassies","engagement","engagements","envoy","envoys","exports","federation","federations","finance","finances","forces","framework","frameworks","funding","government","governments","hearing","hearings","imports","initiative","initiatives","intel","intelligence","intervention","interventions","jurisdiction","jurisdictions","law","laws","leadership","leaders","legislation","liaison","liaisons","mandate","mandates","markets","marines","military","militaries","ministry","ministries","mission","missions","navy","navies","negotiations","office","offices","operations","oversight","parliament","parliaments","plan","plans","policies","policy","policy-makers","precedent","precedents","presence","program","programme","programmes","programs","project","projects","protocol","protocols","province","provinces","reform","reforms","regulation","regulations","regulator","regulators","relations","representation","representations","republic","republics","resolution","resolutions","ruling","rulings","sanctions","security","securities","senate","senates","service","services","state","states","statute","statutes","strategy","strategies","summit","summits","summitry","surveillance","talks","tariffs","territory","territories","trade","trades","treasury","treasuries","treaty","treaties","tribunal","tribunals","troops","union","unions","veterans","warships","zone","zones"];function d(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function m(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?d(Object(t),!0).forEach((function(r){h(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function h(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,r||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}class g{static validateOption(e,r){if(!Array.isArray(r))throw new TypeError("Invalid option: ".concat(e," must be an array"));if(!r.every((e=>"string"==typeof e)))throw new TypeError("Invalid option: ".concat(e," must be an array of strings"))}static validateOptions(e){for(var r of Object.keys(e))if("style"!==r)if("wordReplacementsList"!==r){if(!o.hasOwnProperty(r))throw new TypeError("Invalid option: ".concat(r));g.validateOption(r,e[r])}else{if(!Array.isArray(e.wordReplacementsList))throw new TypeError("Invalid option: ".concat(r," must be an array"));for(var t of e.wordReplacementsList)if("string"!=typeof t)throw new TypeError("Invalid option: ".concat(r," must contain only strings"))}else{if("string"!=typeof e.style)throw new TypeError("Invalid option: ".concat(r," must be a string"));if(!i.includes(e.style))throw new TypeError("Invalid option: ".concat(r," must be a string"))}}static getTitleCaseOptions(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=e.style||"ap",i=!!e.hasOwnProperty("smartQuotes")&&e.smartQuotes,n="".concat(a,"|").concat(i,"|").concat(r.length>0?r.sort().join(","):"");if(g.titleCaseOptionsCache.has(n))return g.titleCaseOptionsCache.get(n);var s=m(m(m({},o[e.style||"ap"]),e),{},{smartQuotes:!!e.hasOwnProperty("smartQuotes")&&e.smartQuotes}),l=[...new Set([...s.articlesList,...r])],c=[...new Set([...s.shortConjunctionsList,...r])],u=[...new Set([...s.shortPrepositionsList,...r])],p=[...(s.replaceTerms||[]).map((e=>{var[r,t]=e;return[r.toLowerCase(),t]})),...t],d={articlesList:l,shortConjunctionsList:c,shortPrepositionsList:u,neverCapitalizedList:[...s.neverCapitalizedList],replaceTerms:p,smartQuotes:s.smartQuotes};return g.titleCaseOptionsCache.set(n,d),d}static capitalizeFirstLetter(e){return e.charAt(0).toUpperCase()+e.slice(1)}static isShortConjunction(e,r){var t=[...g.getTitleCaseOptions({style:r}).shortConjunctionsList],a=e.toLowerCase();return t.includes(a)}static isArticle(e,r){return g.getTitleCaseOptions({style:r}).articlesList.includes(e.toLowerCase())}static isShortPreposition(e,r){var{shortPrepositionsList:t}=g.getTitleCaseOptions({style:r});return t.includes(e.toLowerCase())}static isNeverCapitalized(e,r){var t="".concat(r,"_").concat(e.toLowerCase());if(g.isNeverCapitalizedCache.has(t))return g.isNeverCapitalizedCache.get(t);var{neverCapitalizedList:a}=g.getTitleCaseOptions({style:r}),i=a.includes(e.toLowerCase());return g.isNeverCapitalizedCache.set(t,i),i}static isShortWord(e,r){if("string"!=typeof e)throw new TypeError("Invalid input: word must be a string. Received ".concat(typeof e,"."));if(!i.includes(r))throw new Error("Invalid option: style must be one of ".concat(i.join(", "),"."));return g.isShortConjunction(e,r)||g.isArticle(e,r)||g.isShortPreposition(e,r)||g.isNeverCapitalized(e,r)}static hasNumbers(e){return/\d/.test(e)}static hasUppercaseMultiple(e){for(var r=0,t=0;t<e.length&&r<2;t++)/[A-Z]/.test(e[t])&&r++;return r>=2}static hasUppercaseIntentional(e){if(e.length<=4)return/[A-Z]/.test(e.slice(1));var r=/[A-Z]/.test(e.slice(1)),t=/[a-z]/.test(e.slice(1));return r&&t}static isEntirelyUppercase(e){return e===e.toUpperCase()&&e!==e.toLowerCase()&&e.length>1}static isRegionalAcronym(e){if("string"!=typeof e)throw new TypeError("Invalid input: word must be a string.");if(e.length<2)return!1;var r=e.toLowerCase();return c.includes(r)}static isRegionalAcronymNoDot(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("string"!=typeof e||"string"!=typeof r)return!1;var a=e.toLowerCase().replace(/[^\w\s]/g,""),i=r.toLowerCase().replace(/[^\w\s]/g,"");return!!(t&&c.includes(a)&&["the"].includes(t.toLowerCase()))||c.includes(a)&&p.includes(i)}static isFinalWordRegionalAcronym(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("string"!=typeof e||"string"!=typeof r)return!1;var a=e.toLowerCase().replace(/[^\w]/g,""),i=r.toLowerCase().replace(/[^\w]/g,""),o="string"==typeof t?t.toLowerCase().replace(/[^\w]/g,""):null;return!!c.includes(a)&&(!!u.includes(i)||!("the"!==i||!o||!u.includes(o)))}static normalizeRegionalAcronym(e){if("string"!=typeof e)throw new TypeError("Invalid input: word must be a string.");return e.toUpperCase()}static normalizeAcronymKey(e){return e.toLowerCase().replace(/\./g,"")}static normalizeCasingForWordByStyle(e,r){if(!e||!r||!o[r])return!1;var t=e.toLowerCase(),{shortConjunctionsList:a,articlesList:i,shortPrepositionsList:n,neverCapitalizedList:s}=o[r];return!![...a,...i,...n,...s].includes(t)&&e}static hasSuffix(e){return e.length>2&&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.");var r=e.includes("'")?e.split("'"):[e],t=/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i;return r.every((e=>t.test(e)))}static hasHyphenRomanNumeral(e){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");for(var r=e.split("-"),t=0;t<r.length;t++)if(!g.hasRomanNumeral(r[t]))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/&|&/.test(e)}static startsWithSymbol(e){if("string"!=typeof e)throw new Error("Parameter 'word' must be a string. Received '".concat(typeof e,"' instead."));if(0===e.length)return!1;var r=e.charAt(0);return"#"===r||"@"===r||"."===r}static escapeSpecialCharacters(e){return e.replace(/[&<>"']/g,(function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";case"'":return"'";default:return e}}))}static unescapeSpecialCharacters(e){return e.replace(/&|<|>|"|'/g,(function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case""":return'"';case"'":return"'";default:return e}}))}static endsWithSymbol(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[".",",",";",":","?","!"];if("string"!=typeof e||!Array.isArray(r))throw new Error("Invalid arguments");return r.some((r=>e.endsWith(r)))||r.includes(e.slice(-2))}static isWordIgnored(e){var r,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;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.");return r=e.toLowerCase().trim(),t.includes(r)}static isWordInArray(e,r){return!!Array.isArray(r)&&r.some((r=>r.toLowerCase()===e.toLowerCase()))}static convertQuotesToCurly(e){for(var r={"'":["‘","’"],'"':["“","”"]},t="",a=0;a<e.length;a++){var i=e[a],o=r[i];if(o){var n=e[a-1],s=e[a+1],l=!n||" "===n||"\n"===n?o[0]:o[1];t+=l,l===o[1]&&/[.,;!?()\[\]{}:]/.test(s)&&(t+=s,a++)}else t+=i}return t}static replaceTerm(e,r){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!r||"object"!=typeof r)throw new TypeError("Invalid input: replaceTermObj must be a non-null object.");var t;if(t=e.toLowerCase(),r.hasOwnProperty(t))return r[t];if(r.hasOwnProperty(e))return r[e];var a=e.toUpperCase();return r.hasOwnProperty(a)?r[a]:e}static isElidedWord(e){if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");var r=new Set(["o’","fo’","ne’er","e’er","’tis","’twas","’n’"]),t=e.trim().toLowerCase().replace(/'/g,"’");for(var a of r)if(t.startsWith(a))return!0;return!1}static normalizeElidedWord(e){if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");var r=new Set(["o’","fo’","ne’er","e’er","’tis","’twas","’n’"]),t=e.trim(),a=t.replace(/'/g,"’").toLowerCase();for(var i of r)if(a.startsWith(i)){var o=i.length,n=t.slice(o);return i.charAt(0).toUpperCase()+i.slice(1)+(n.length>0?n.charAt(0).toUpperCase()+n.slice(1):"")}return!1}static correctSuffix(e,r){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!r||!Array.isArray(r)||r.some((e=>"string"!=typeof e)))throw new TypeError("Invalid input: correctTerms must be an array of strings.");if(/'s$/i.test(e)){var t=e.slice(0,-2),a=r.findIndex((e=>e.toLowerCase()===t.toLowerCase()));if(a>=0){var i=r[a];return"".concat(i,"'s")}var o=t.charAt(0).toUpperCase()+t.slice(1);return"".concat(o,"'s")}return e}static correctTerm(e,r){var t=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(!r||!Array.isArray(r))throw new TypeError("Invalid input: correctTerms must be an array.");if(!("string"==typeof t||Array.isArray(t)||t instanceof RegExp))throw new TypeError("Invalid input: delimiters must be a string, an array of strings, or a regular expression.");"string"==typeof t?t=new RegExp("[".concat(t,"]")):Array.isArray(t)&&(t=new RegExp("[".concat(t.join(""),"]")));for(var a=e.split(t),i=a.length,o=function(){var e=a[n].toLowerCase(),t=r.findIndex((r=>r.toLowerCase()===e));a[n]=t>=0?r[t]:a[n].charAt(0).toUpperCase()+a[n].slice(1).toLowerCase()},n=0;n<i;n++)o();var s=t.source.charAt(0);return e.includes("-")?s="-":e.includes("'")&&(s="'"),a.join(s)}static correctTermHyphenated(r,t){var a=r.match(/[-–—]/);if(!a)return r;var i=a[0],o=r.split(/[-–—]/),n=o.some((e=>c.includes(e.toLowerCase().replace(/[^\w]/g,"")))),s=e=>e.charAt(0).toUpperCase()+e.slice(1),l=e=>e.charAt(0)+e.slice(1).toLowerCase(),u={ap:(e,r)=>n||0===r?s(e):l(e),chicago:s,apa:(e,r,a)=>!n&&g.isShortWord(e,t)&&r>0&&r<a-1?e.toLowerCase():s(e),nyt:s,wikipedia:(e,r)=>0===r?s(e):l(e)},p=u[t]||l;return o.map(((r,t)=>{var a=r,i=r.toLowerCase().replace(/[^\w]/g,"");if(c.includes(i))return r.toUpperCase();if(/^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(r))return r.toUpperCase();var n=r.toLowerCase(),s=e.findIndex((e=>e.toLowerCase()===n));return s>=0&&(a=e[s]),p(a,t,o.length)})).join(i)}}h(g,"TitleCaseValidator",void 0),h(g,"titleCaseOptionsCache",new Map),h(g,"isNeverCapitalizedCache",new Map);class y{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=e,this.debug=e.debug||!1,this.wordReplacementsList=JSON.parse(JSON.stringify(t)),this.phraseReplacementMap=JSON.parse(JSON.stringify(s))}logWarning(e){this.debug&&console.warn("Warning: ".concat(e))}toTitleCase(t){try{if("string"!=typeof t)throw new TypeError("Invalid input: input must be a string.");if(0===t.length)throw new TypeError("Invalid input: input must not be empty.");if(t.length>1e5)throw new TypeError("Invalid input: input exceeds maximum length of 100,000 characters.");if(void 0!==this.options&&"object"!=typeof this.options)throw new TypeError("Invalid options: options must be an object.");var{style:a="ap",neverCapitalize:i=[],wordReplacementsList:n=this.wordReplacementsList,smartQuotes:s=!1,normalizeWhitespace:c=!0}=this.options,u=o[a]||{},p=["nl2br",...i],{articlesList:d,shortConjunctionsList:m,shortPrepositionsList:h,neverCapitalizedList:C,replaceTerms:f,smartQuotes:S}=g.getTitleCaseOptions(this.options,r,n),A=n.map((e=>Object.keys(e)[0].toLowerCase())),w=Object.fromEntries(n.map((e=>[Object.keys(e)[0].toLowerCase(),Object.values(e)[0]])));this.logWarning("replaceTermsArray: ".concat(A)),this.logWarning("this.wordReplacementsList: ".concat(this.wordReplacementsList));var v=t;v=v.replace(l.HTML_BREAK," nl2br "),g.isEntirelyUppercase(v.replace(/[^a-zA-Z]/g,""))&&(this.logWarning("Input string is entirely uppercase, normalizing to lowercase first"),v=v.toLowerCase());var b=v.split(/(\s+)/),L=b.map(((r,t)=>{if(!r||/^\s+$/.test(r))return r;var i=r;switch(!0){case g.isWordAmpersand(i):case g.hasHtmlBreak(i):case g.isWordIgnored(i,p):return i;case A.includes(i.toLowerCase()):return w[i.toLowerCase()];case g.isWordInArray(i,e):return g.correctTerm(i,e);case g.isElidedWord(i):return g.normalizeElidedWord(i);case g.hasHyphen(i):var o=i.replace(/[\W_]+$/,""),n=i.slice(o.length),s=o.split("-"),c=s.map((e=>{var r=e.toLowerCase();return A.includes(r)?w[r]:e})),u=!c.every(((e,r)=>e===s[r])),d=u?c.join("-"):g.correctTermHyphenated(i,a);return d.endsWith(n)?d:d+n;case g.hasSuffix(i,a):return g.correctSuffix(i,e);case g.hasUppercaseIntentional(i):return i;case g.isShortWord(i,a)&&0!==t:for(var m=null,h=t-1;h>=0;h--)if(!/^\s+$/.test(b[h])){m=b[h];break}return m&&g.endsWithSymbol(m,[":","?","!","."])?i.charAt(0).toUpperCase()+i.slice(1):g.normalizeCasingForWordByStyle(i,a);case g.endsWithSymbol(i):this.logWarning("Check if the word ends with a symbol: ".concat(i));var y=i.split(l.SPLIT_AT_PUNCTUATION);this.logWarning("Splitting word at symbols, result: ".concat(y));var C=y.map((r=>{if(this.logWarning("Processing part: ".concat(r)),g.endsWithSymbol(r))return this.logWarning("Part is a symbol: ".concat(r)),r;if(this.logWarning("Part is a word: ".concat(r)),g.isWordInArray(r,e)){var t=g.correctTerm(r,e);return this.logWarning("Word is in specialTermsList, corrected term: ".concat(t)),t}if(A.includes(r)){var a=w[r];return this.logWarning("Word is in replaceTermsArray, replacement: ".concat(a)),a}var i=r.charAt(0).toUpperCase()+r.slice(1).toLowerCase();return this.logWarning("Applying title casing to word: ".concat(i)),i}));return C.join("");case g.startsWithSymbol(i):return g.isWordInArray(i,e)?g.correctTerm(i):i;case g.hasRomanNumeral(i):return i.toUpperCase();case g.hasNumbers(i):return i;default:return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}}));v=(v=L.join("")).replace(/nl2br/gi,"<br>"),s&&(v=g.convertQuotesToCurly(v));for(var T=v.split(/(\s+)/),O=T.filter((e=>!/^\s+$/.test(e))),P=O[0]||null,I=O[1]||null,F=0;F<T.length;F++)if(!/^\s+$/.test(T[F])){for(var E=null,R=F-1;R>=0;R--)if(!/^\s+$/.test(T[R])){E=T[R];break}for(var M=null,N=F+1;N<T.length;N++)if(!/^\s+$/.test(T[N])){M=T[N];break}var B=T[F],k=B.match(l.TRAILING_PUNCTUATION),U="";k&&(U=k[0],B=B.replace(l.TRAILING_PUNCTUATION,"")),g.isRegionalAcronymNoDot(B,M,E)&&(B=g.normalizeRegionalAcronym(B)),""!==U&&(B+=U),T[F]=B}for(var D=(v=T.join("")).split(/(\s+)/),W=1;W<D.length-1;W++){var j=D[W];D[W-1],D[W+1];j===j.toUpperCase()||g.hasUppercaseIntentional(j)||g.isWordInArray(j,r)&&(D[W]=j.length<=3?j.toLowerCase():j)}for(var G=(v=D.join("")).split(/(\s+)/),z=0;z<G.length;z++)if(!/^\s+$/.test(G[z])){for(var x=G[z],H=null,V=z-1;V>=0;V--)if(!/^\s+$/.test(G[V])){H=G[V];break}for(var K=null,Q=z+1;Q<G.length;Q++)if(!/^\s+$/.test(G[Q])){K=G[Q];break}K&&g.isRegionalAcronymNoDot(x,K,H)&&(G[z]=x.toUpperCase())}var J=G.filter((e=>!/^\s+$/.test(e))),X=J[J.length-1],Z=J[J.length-2],$=J[J.length-3];for(var[q,_]of(P&&g.isRegionalAcronym(P)&&(this.logWarning("firstWord is a regional acronym: ".concat(P)),G[0]=P.toUpperCase()),P&&I&&g.isRegionalAcronymNoDot(P,I)&&(G[0]=P.toUpperCase()),X&&Z&&g.isFinalWordRegionalAcronym(X,Z,$)&&(G[G.length-1]=X.toUpperCase()),v=G.join(""),Object.entries(this.phraseReplacementMap))){var Y=new RegExp(q.replace(l.REGEX_ESCAPE,"\\$&"),"gi");v=v.replace(Y,_)}if("sentence"===u.caseStyle){for(var ee=v.split(/(\s+)/),re=!1,te=0;te<ee.length;te++){var ae=ee[te];re||!/[A-Za-z]/.test(ae)?y.shouldKeepCasing(ae,e)||(ee[te]=ae.toLowerCase()):(y.shouldKeepCasing(ae,e)||(ee[te]=ae.charAt(0).toUpperCase()+ae.slice(1).toLowerCase()),re=!0)}v=ee.join("")}return c&&(v=v.replace(/\s+/g," ").trim()),v}catch(e){throw e instanceof Error?e:new Error(String(e))}}setReplaceTerms(e){if(!Array.isArray(e))throw new TypeError("Invalid argument: setReplaceTerms must be an array of objects.");if(e.forEach((e=>{if(e&&"object"==typeof e){var[r,t]=Object.entries(e)[0],a=this.wordReplacementsList.findIndex((e=>e.hasOwnProperty(r)));-1!==a?this.wordReplacementsList[a][r]=t:this.wordReplacementsList.push({[r]:t})}else console.warn("Invalid entry in terms array:",e)})),this.wordReplacementsList.length>2e3)throw new Error("Too many replacement rules.");this.options.wordReplacementsList=this.wordReplacementsList,this.logWarning("Log the updated this.wordReplacementsList: ".concat(this.wordReplacementsList))}addReplaceTerm(e,r){if("string"!=typeof e||"string"!=typeof r)throw new TypeError("Invalid argument: term and replacement must be strings.");var t=this.wordReplacementsList.findIndex((r=>Object.keys(r)[0]===e));if(-1!==t?this.wordReplacementsList[t][e]=r:this.wordReplacementsList.push({[e]:r}),this.wordReplacementsList.length>2e3)throw new Error("Too many replacement rules.");this.options.wordReplacementsList=this.wordReplacementsList}removeReplaceTerm(e){if("string"!=typeof e)throw new TypeError("Invalid argument: term must be a string.");var r=this.wordReplacementsList.findIndex((r=>Object.keys(r)[0]===e));if(-1===r)throw new Error("Term '".concat(e,"' not found in word replacements list."));this.wordReplacementsList.splice(r,1),this.options.wordReplacementsList=this.wordReplacementsList,this.logWarning("Log the updated this.wordReplacementsList: ".concat(this.wordReplacementsList))}addExactPhraseReplacements(e){if(!Array.isArray(e))throw new TypeError("Invalid argument: newPhrases must be an array.");e.forEach((e=>{if("object"!=typeof e||Array.isArray(e)||1!==Object.keys(e).length){if("object"!=typeof e||Array.isArray(e))throw new TypeError("Invalid argument: Each item must be an object with a single key-value pair.");Object.entries(e).forEach((e=>{var[r,t]=e;if("string"!=typeof r||"string"!=typeof t)throw new TypeError("Invalid argument: Each key-value pair must contain strings.");this.phraseReplacementMap[r]=t}))}else{var r=Object.keys(e)[0],t=e[r];if("string"!=typeof r||"string"!=typeof t)throw new TypeError("Invalid argument: Each key-value pair must contain strings.");this.phraseReplacementMap[r]=t}})),this.logWarning("Log the this.phraseReplacementMap: ".concat(this.phraseReplacementMap))}setStyle(e){if("string"!=typeof e)throw new TypeError("Invalid argument: style must be a string.");this.options.style=e}static shouldKeepCasing(e,r){return!!g.isRegionalAcronym(e)||(!!g.hasUppercaseIntentional(e)||!!g.isWordInArray(e,r))}}void 0===String.prototype.toTitleCase&&(String.prototype.toTitleCase=function(e){return new y(e).toTitleCase(this)}),"undefined"!=typeof window&&window.document&&(window.TitleCaser=y);const C=y;export{y as TitleCaser,C as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielhaim/titlecaser - v1.7.
|
|
2
|
+
* @danielhaim/titlecaser - v1.7.14 - 2026-02-17
|
|
3
3
|
* https://github.com/danielhaim1/titlecaser.git
|
|
4
4
|
* Copyright (c) 2026 Daniel Haim, Licensed Apache-2.0
|
|
5
|
-
*/(()=>{"use strict";var e={388(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.TitleCaser=void 0;var a=r(416),i=r(279);class s{constructor(e={}){this.options=e,this.debug=e.debug||!1,this.wordReplacementsList=a.wordReplacementsList,this.phraseReplacementMap=a.phraseReplacementMap}logWarning(e){this.debug&&console.warn(`Warning: ${e}`)}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(e.length>1e5)throw new TypeError("Invalid input: input exceeds maximum length of 100,000 characters.");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=this.wordReplacementsList,smartQuotes:n=!1}=this.options,l=a.styleConfigMap[t]||{},c=["nl2br",...r],{articlesList:u,shortConjunctionsList:p,shortPrepositionsList:d,neverCapitalizedList:m,replaceTerms:g,smartQuotes:C}=i.TitleCaserUtils.getTitleCaseOptions(this.options,a.shortWordsList,a.wordReplacementsList),y=o.map((e=>Object.keys(e)[0].toLowerCase())),h=Object.fromEntries(o.map((e=>[Object.keys(e)[0].toLowerCase(),Object.values(e)[0]])));this.logWarning(`replaceTermsArray: ${y}`),this.logWarning(`this.wordReplacementsList: ${this.wordReplacementsList}`);let f=e.trim();f=f.replace(a.REGEX_PATTERNS.HTML_BREAK," nl2br "),f=f.replace(a.REGEX_PATTERNS.MULTIPLE_SPACES," ");i.TitleCaserUtils.isEntirelyUppercase(f.replace(/[^a-zA-Z]/g,""))&&(this.logWarning("Input string is entirely uppercase, normalizing to lowercase first"),f=f.toLowerCase());const A=f.split(" ");f=A.map(((e,r)=>{switch(!0){case i.TitleCaserUtils.isWordAmpersand(e):case i.TitleCaserUtils.hasHtmlBreak(e):case i.TitleCaserUtils.isWordIgnored(e,c):return e;case y.includes(e.toLowerCase()):return h[e.toLowerCase()];case i.TitleCaserUtils.isWordInArray(e,a.specialTermsList):return i.TitleCaserUtils.correctTerm(e,a.specialTermsList);case i.TitleCaserUtils.isElidedWord(e):return i.TitleCaserUtils.normalizeElidedWord(e);case i.TitleCaserUtils.hasHyphen(e):const s=e.replace(/[\W_]+$/,""),o=e.slice(s.length),n=s.split("-"),l=n.map((e=>{const t=e.toLowerCase();return y.includes(t)?h[t]:e})),u=!l.every(((e,t)=>e===n[t]))?l.join("-"):i.TitleCaserUtils.correctTermHyphenated(e,t);return u.endsWith(o)?u:u+o;case i.TitleCaserUtils.hasSuffix(e,t):return i.TitleCaserUtils.correctSuffix(e,a.specialTermsList);case i.TitleCaserUtils.hasUppercaseIntentional(e):return e;case i.TitleCaserUtils.isShortWord(e,t)&&0!==r:if(r>0&&i.TitleCaserUtils.endsWithSymbol(A[r-1],[":","?","!","."]))return e.charAt(0).toUpperCase()+e.slice(1);return i.TitleCaserUtils.normalizeCasingForWordByStyle(e,t);case i.TitleCaserUtils.endsWithSymbol(e):this.logWarning(`Check if the word ends with a symbol: ${e}`);const p=e.split(a.REGEX_PATTERNS.SPLIT_AT_PUNCTUATION);this.logWarning(`Splitting word at symbols, result: ${p}`);return p.map((e=>{if(this.logWarning(`Processing part: ${e}`),i.TitleCaserUtils.endsWithSymbol(e))return this.logWarning(`Part is a symbol: ${e}`),e;if(this.logWarning(`Part is a word: ${e}`),i.TitleCaserUtils.isWordInArray(e,a.specialTermsList)){const t=i.TitleCaserUtils.correctTerm(e,a.specialTermsList);return this.logWarning(`Word is in specialTermsList, corrected term: ${t}`),t}if(y.includes(e)){const t=h[e];return this.logWarning(`Word is in replaceTermsArray, replacement: ${t}`),t}{const t=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase();return this.logWarning(`Applying title casing to word: ${t}`),t}})).join("");case i.TitleCaserUtils.startsWithSymbol(e):return i.TitleCaserUtils.isWordInArray(e,a.specialTermsList)?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(" "),f=f.replace(/nl2br/gi,"<br>"),n&&(f=i.TitleCaserUtils.convertQuotesToCurly(f));const S=f.split(" ");let T=S[0],w=S[1]||null;for(let e=0;e<S.length;e++){e>0&&S[e-1];let t=S[e];const r=e<S.length-1?S[e+1]:null,s=t.match(a.REGEX_PATTERNS.TRAILING_PUNCTUATION);let o="";s&&(o=s[0],t=t.replace(a.REGEX_PATTERNS.TRAILING_PUNCTUATION,"")),i.TitleCaserUtils.isRegionalAcronym(t)&&(t=i.TitleCaserUtils.normalizeRegionalAcronym(t)),i.TitleCaserUtils.isRegionalAcronymNoDot(t,r)&&(t=i.TitleCaserUtils.normalizeRegionalAcronym(t)),""!==o&&(t+=o)}f=S.join(" ");const L=f.split(" ");for(let e=1;e<L.length-1;e++){const t=L[e];L[e-1],L[e+1];t===t.toUpperCase()||i.TitleCaserUtils.hasUppercaseIntentional(t)||i.TitleCaserUtils.isWordInArray(t,a.shortWordsList)&&(L[e]=t.length<=3?t.toLowerCase():t)}f=L.join(" ");const b=f.split(" ");for(let e=0;e<b.length;e++){let t=b[e],r=b[e+1],a=b[e-1];r&&i.TitleCaserUtils.isRegionalAcronymNoDot(t,r,a)&&(b[e]=t.toUpperCase())}let P=b[b.length-1],O=b[b.length-2],v=b[b.length-3];i.TitleCaserUtils.isRegionalAcronym(T)&&(this.logWarning(`firstWord is a regional acronym: ${T}`),b[0]=T.toUpperCase()),i.TitleCaserUtils.isRegionalAcronymNoDot(T,w)&&(b[0]=T.toUpperCase()),i.TitleCaserUtils.isFinalWordRegionalAcronym(P,O,v)&&(b[b.length-1]=P.toUpperCase()),f=b.join(" ");for(const[e,t]of Object.entries(this.phraseReplacementMap)){const r=new RegExp(e.replace(a.REGEX_PATTERNS.REGEX_ESCAPE,"\\$&"),"gi");f=f.replace(r,t)}if("sentence"===l.caseStyle){const e=f.split(" ");let t=!1;for(let r=0;r<e.length;r++){let i=e[r];t||!/[A-Za-z]/.test(i)?s.shouldKeepCasing(i,a.specialTermsList)||(e[r]=i.toLowerCase()):(s.shouldKeepCasing(i,a.specialTermsList)||(e[r]=i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()),t=!0)}f=e.join(" ")}return f}catch(e){throw e instanceof Error?e:new Error(String(e))}}setReplaceTerms(e){if(!Array.isArray(e))throw new TypeError("Invalid argument: setReplaceTerms must be an array of objects.");e.forEach((e=>{if(e&&"object"==typeof e){const[t,r]=Object.entries(e)[0],a=this.wordReplacementsList.findIndex((e=>e.hasOwnProperty(t)));-1!==a?this.wordReplacementsList[a][t]=r:this.wordReplacementsList.push({[t]:r})}else console.warn("Invalid entry in terms array:",e)})),this.options.wordReplacementsList=this.wordReplacementsList,this.logWarning(`Log the updated this.wordReplacementsList: ${this.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=>Object.keys(t)[0]===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,this.logWarning(`Log the updated this.wordReplacementsList: ${this.wordReplacementsList}`)}addExactPhraseReplacements(e){if(!Array.isArray(e))throw new TypeError("Invalid argument: newPhrases must be an array.");e.forEach((e=>{if("object"!=typeof e||Array.isArray(e)||1!==Object.keys(e).length){if("object"!=typeof e||Array.isArray(e))throw new TypeError("Invalid argument: Each item must be an object with a single key-value pair.");Object.entries(e).forEach((([e,t])=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Invalid argument: Each key-value pair must contain strings.");this.phraseReplacementMap[e]=t}))}else{const t=Object.keys(e)[0],r=e[t];if("string"!=typeof t||"string"!=typeof r)throw new TypeError("Invalid argument: Each key-value pair must contain strings.");this.phraseReplacementMap[t]=r}})),this.logWarning(`Log the this.phraseReplacementMap: ${this.phraseReplacementMap}`)}setStyle(e){if("string"!=typeof e)throw new TypeError("Invalid argument: style must be a string.");this.options.style=e}static shouldKeepCasing(e,t){return!!i.TitleCaserUtils.isRegionalAcronym(e)||(!!i.TitleCaserUtils.hasUppercaseIntentional(e)||!!i.TitleCaserUtils.isWordInArray(e,t))}}t.TitleCaser=s},416(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.wordReplacementsList=t.styleConfigMap=t.specialTermsList=t.shortWordsList=t.regionalAcronymPrecedingWordsList=t.regionalAcronymList=t.regionalAcronymFollowingWordsList=t.phraseReplacementMap=t.ignoredWordList=t.allowedStylesList=t.TITLE_CASE_STYLES=t.REGEX_PATTERNS=void 0;var a=d(r(223)),i=d(r(814)),s=d(r(661)),o=d(r(157)),n=d(r(321)),l=d(r(742)),c=d(r(501)),u=d(r(491)),p=d(r(16));function d(e){return e&&e.__esModule?e:{default:e}}const m=function(...e){const t=[];return e.forEach((e=>{Array.isArray(e)?e.forEach((e=>{Object.values(e).forEach((e=>{t.push(...e)}))})):"object"==typeof e&&Object.values(e).forEach((e=>{t.push(...e)}))})),[...new Set(t)]}(a.default,i.default,s.default,o.default,n.default,l.default,c.default,u.default,p.default),g=(t.specialTermsList=m,t.shortWordsList=["the","in","to","within","towards","into","at","of","for","by","on","from","with","through","about","across","over","under","between"],t.wordReplacementsList=[{"a.k.a":"AKA"},{"a.s.a.p":"ASAP"},{"f.a.q":"FAQ"},{"f.a.q.s":"FAQs"},{FAQS:"FAQs"},{"f.y.i":"FYI"},{"d.i.y":"DIY"},{"t.b.d":"TBD"},{"back-end":"Backend"},{"front-end":"Frontend"},{"full-stack":"Fullstack"},{nodejs:"Node.js"},{nextjs:"Next.js"},{nuxtjs:"Nuxt.js"},{reactjs:"React"},{"react.js":"React"},{"cyber-security":"Cybersecurity"}],t.TITLE_CASE_STYLES=Object.freeze({AP:"ap",APA:"apa",BRITISH:"british",CHICAGO:"chicago",NYT:"nyt",WIKIPEDIA:"wikipedia"}));t.allowedStylesList=Object.values(g),t.styleConfigMap=Object.freeze({ap:{caseStyle:"title",shortConjunctionsList:["and","but","or","nor","yet","so","for"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]},apa:{caseStyle:"title",shortConjunctionsList:["and","as","but","for","if","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","off","on","per","to","via"],neverCapitalizedList:[]},british:{caseStyle:"title",shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]},chicago:{caseStyle:"title",shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:["etc."]},nyt:{caseStyle:"title",shortConjunctionsList:["and","but","or","nor","yet","so","for"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]},wikipedia:{caseStyle:"sentence",shortConjunctionsList:["and","as","but","for","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]}}),t.ignoredWordList=[],t.phraseReplacementMap={"the cybersmile foundation":"The Cybersmile Foundation","co. by colgate":"CO. by Colgate","on & off":"On & Off","on and off":"On and Off"},t.REGEX_PATTERNS=Object.freeze({TRAILING_PUNCTUATION:/[.,!?;:]+$/,SPLIT_AT_PUNCTUATION:/([.,\/#!$%\^&\*;:{}=\-_`~()?])/g,HTML_BREAK:/<\s*br\s*\/?\s*>/gi,MULTIPLE_SPACES:/ {2,}/g,REGEX_ESCAPE:/[.*+?^${}()|[\]\\]/g}),t.regionalAcronymList=["usa","us","u.s.a","u.s.","u.s","u.s.a.","eu","e.u.","e.u","uk","u.k.","u.k"],t.regionalAcronymPrecedingWordsList=["the","via","among","across","beyond","outside","alongside","throughout","despite","unlike","upon"],t.regionalAcronymFollowingWordsList=["act","acts","administration","administrations","agency","agencies","agreement","agreements","airforce","airforces","aid","alliance","alliances","ambassador","ambassadors","authority","authorities","bill","bills","bloc","blocs","budget","budgets","bureau","bureaus","cabinet","cabinets","charter","charters","command","commands","commission","commissions","conference","conferences","congress","congresses","convention","conventions","council","councils","court","courts","defense","defences","defence","defenses","delegation","delegations","democracy","democracies","department","departments","development","developments","directive","directives","diplomacy","division","divisions","economy","economies","embassy","embassies","engagement","engagements","envoy","envoys","exports","federation","federations","finance","finances","forces","framework","frameworks","funding","government","governments","hearing","hearings","imports","initiative","initiatives","intel","intelligence","intervention","interventions","jurisdiction","jurisdictions","law","laws","leadership","leaders","legislation","liaison","liaisons","mandate","mandates","markets","marines","military","militaries","ministry","ministries","mission","missions","navy","navies","negotiations","office","offices","operations","oversight","parliament","parliaments","plan","plans","policies","policy","policy-makers","precedent","precedents","presence","program","programme","programmes","programs","project","projects","protocol","protocols","province","provinces","reform","reforms","regulation","regulations","regulator","regulators","relations","representation","representations","republic","republics","resolution","resolutions","ruling","rulings","sanctions","security","securities","senate","senates","service","services","state","states","statute","statutes","strategy","strategies","summit","summits","summitry","surveillance","talks","tariffs","territory","territories","trade","trades","treasury","treasuries","treaty","treaties","tribunal","tribunals","troops","union","unions","veterans","warships","zone","zones"]},279(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.TitleCaserUtils=void 0;var a=r(416);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class n{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(!a.styleConfigMap.hasOwnProperty(t))throw new TypeError(`Invalid option: ${t}`);n.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(!a.allowedStylesList.includes(e.style))throw new TypeError(`Invalid option: ${t} must be a string`)}}static getTitleCaseOptions(e={},t=[]){const r=`${e.style||"ap"}|${!!e.hasOwnProperty("smartQuotes")&&e.smartQuotes}|${t.length>0?t.sort().join(","):""}`;if(n.titleCaseOptionsCache.has(r))return n.titleCaseOptionsCache.get(r);const i=s(s(s({},a.styleConfigMap[e.style||"ap"]),e),{},{smartQuotes:!!e.hasOwnProperty("smartQuotes")&&e.smartQuotes}),o=[...new Set([...i.articlesList,...t])],l=[...new Set([...i.shortConjunctionsList,...t])],c=[...new Set([...i.shortPrepositionsList,...t])],u=[...(i.replaceTerms||[]).map((([e,t])=>[e.toLowerCase(),t])),...a.wordReplacementsList],p={articlesList:o,shortConjunctionsList:l,shortPrepositionsList:c,neverCapitalizedList:[...i.neverCapitalizedList],replaceTerms:u,smartQuotes:i.smartQuotes};return n.titleCaseOptionsCache.set(r,p),p}static capitalizeFirstLetter(e){return e.charAt(0).toUpperCase()+e.slice(1)}static isShortConjunction(e,t){const r=[...n.getTitleCaseOptions({style:t}).shortConjunctionsList],a=e.toLowerCase();return r.includes(a)}static isArticle(e,t){return n.getTitleCaseOptions({style:t}).articlesList.includes(e.toLowerCase())}static isShortPreposition(e,t){const{shortPrepositionsList:r}=n.getTitleCaseOptions({style:t});return r.includes(e.toLowerCase())}static isNeverCapitalized(e,t){const r=`${t}_${e.toLowerCase()}`;if(n.isNeverCapitalizedCache.has(r))return n.isNeverCapitalizedCache.get(r);const{neverCapitalizedList:a}=n.getTitleCaseOptions({style:t}),i=a.includes(e.toLowerCase());return n.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(!a.allowedStylesList.includes(t))throw new Error(`Invalid option: style must be one of ${a.allowedStylesList.join(", ")}.`);return n.isShortConjunction(e,t)||n.isArticle(e,t)||n.isShortPreposition(e,t)||n.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){if(e.length<=4)return/[A-Z]/.test(e.slice(1));const t=/[A-Z]/.test(e.slice(1)),r=/[a-z]/.test(e.slice(1));return t&&r}static isEntirelyUppercase(e){return e===e.toUpperCase()&&e!==e.toLowerCase()&&e.length>1}static isRegionalAcronym(e){if("string"!=typeof e)throw new TypeError("Invalid input: word must be a string.");if(e.length<2)return!1;const t=e.toLowerCase();return a.regionalAcronymList.includes(t)}static isRegionalAcronymNoDot(e,t,r=null){if("string"!=typeof e||"string"!=typeof t)return!1;const i=e.toLowerCase().replace(/[^\w\s]/g,""),s=t.toLowerCase().replace(/[^\w\s]/g,"");return!!(r&&a.regionalAcronymList.includes(i)&&["the"].includes(r.toLowerCase()))||a.regionalAcronymList.includes(i)&&a.regionalAcronymFollowingWordsList.includes(s)}static isFinalWordRegionalAcronym(e,t,r=null){if("string"!=typeof e||"string"!=typeof t)return!1;const i=e.toLowerCase().replace(/[^\w]/g,""),s=t.toLowerCase().replace(/[^\w]/g,""),o="string"==typeof r?r.toLowerCase().replace(/[^\w]/g,""):null;return!!a.regionalAcronymList.includes(i)&&(!!a.regionalAcronymPrecedingWordsList.includes(s)||!("the"!==s||!o||!a.regionalAcronymPrecedingWordsList.includes(o)))}static normalizeRegionalAcronym(e){if("string"!=typeof e)throw new TypeError("Invalid input: word must be a string.");return e.toUpperCase()}static normalizeAcronymKey(e){return e.toLowerCase().replace(/\./g,"")}static normalizeCasingForWordByStyle(e,t){if(!e||!t||!a.styleConfigMap[t])return!1;const r=e.toLowerCase(),{shortConjunctionsList:i,articlesList:s,shortPrepositionsList:o,neverCapitalizedList:n}=a.styleConfigMap[t];return!![...i,...s,...o,...n].includes(r)&&e}static hasSuffix(e){return e.length>2&&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.");const t=e.includes("'")?e.split("'"):[e],r=/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i;return t.every((e=>r.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(!n.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/&|&/.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"&";case"<":return"<";case">":return">";case'"':return""";case"'":return"'";default:return e}}))}static unescapeSpecialCharacters(e){return e.replace(/&|<|>|"|'/g,(function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case""":return'"';case"'":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=a.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 convertQuotesToCurly(e){const t={"'":["‘","’"],'"':["“","”"]};let r="";for(let a=0;a<e.length;a++){const i=e[a],s=t[i];if(s){const t=e[a-1],i=e[a+1],o=!t||" "===t||"\n"===t?s[0]:s[1];r+=o,o===s[1]&&/[.,;!?()\[\]{}:]/.test(i)&&(r+=i,a++)}else r+=i}return r}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 a=e.toUpperCase();return t.hasOwnProperty(a)?t[a]:e}static isElidedWord(e){if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");const t=new Set(["o’","fo’","ne’er","e’er","’tis","’twas","’n’"]),r=e.trim().toLowerCase().replace(/'/g,"’");for(const e of t)if(r.startsWith(e))return!0;return!1}static normalizeElidedWord(e){if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");const t=new Set(["o’","fo’","ne’er","e’er","’tis","’twas","’n’"]),r=e.trim(),a=r.replace(/'/g,"’").toLowerCase();for(const e of t)if(a.startsWith(e)){const t=e.length,a=r.slice(t);return e.charAt(0).toUpperCase()+e.slice(1)+(a.length>0?a.charAt(0).toUpperCase()+a.slice(1):"")}return!1}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),a=t.findIndex((e=>e.toLowerCase()===r.toLowerCase()));if(a>=0){return`${t[a]}'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 a=e.split(r),i=a.length;for(let e=0;e<i;e++){const r=a[e].toLowerCase(),i=t.findIndex((e=>e.toLowerCase()===r));a[e]=i>=0?t[i]:a[e].charAt(0).toUpperCase()+a[e].slice(1).toLowerCase()}let s=r.source.charAt(0);return e.includes("-")?s="-":e.includes("'")&&(s="'"),a.join(s)}static correctTermHyphenated(e,t){const r=e.split("-"),i=e=>e.charAt(0).toUpperCase()+e.slice(1),s=e=>e.charAt(0)+e.slice(1).toLowerCase(),o={ap:(e,t)=>0===t?i(e):s(e),chicago:i,apa:(e,r,a)=>n.isShortWord(e,t)&&r>0&&r<a-1?e.toLowerCase():i(e),nyt:(e,t)=>0===t?i(e):s(e),wikipedia:(e,t)=>0===t?i(e):s(e)},l=o[t]||s,c=r.map(((e,t)=>{let i=e;if(/^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})'s$/i.test(e)){return i.toUpperCase().replace(/'S$/,"'s")}const s=/^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i;if(s.test(e))return e.toUpperCase();if(e.includes("'")){const a=e.split("'");return a.every((e=>s.test(e)))?(i=a.map((e=>e.toUpperCase())).join("'"),i):l(i,t,r.length)}const o=e.toLowerCase(),n=a.specialTermsList.findIndex((e=>e.toLowerCase()===o));if(n>=0)i=a.specialTermsList[n];else if(o.endsWith("'s")){const e=o.substring(0,o.length-2),t=a.specialTermsList.findIndex((t=>t.toLowerCase()===e));t>=0&&(i=`${a.specialTermsList[t]}'s`)}return l(i,t,r.length)}));return c.join("-")}}t.TitleCaserUtils=n,o(n,"TitleCaseValidator",void 0),o(n,"titleCaseOptionsCache",new Map),o(n,"isNeverCapitalizedCache",new Map)},223(e){e.exports=JSON.parse('{"sports":["FIFA","UEFA","NBA","NFL","MLB","NHL","NASCAR","IOC","FIBA","ATP","WTA","PGA","LPGA","FIA","WADA","ITF","AFL","NRL","ICC","IRB","IHF","FIVB","FINA","UCI","IAAF","ISU","WSF","BWF","WBC","WBO","IBF","IBO","UEFA","CONMEBOL","CONCACAF","CAF","AFC","OFC","CPL","MLS","LaLiga","Bundesliga","Ligue1","Eredivisie","JLeague","KLeague","Ryder Cup","Davis Cup","FedCup","XGames","Olympics","Paralympics","Dakar"],"apple":["Apple","AirDrop","AirPlay","AirPods","AirTags","FinalCut","GarageBand","iBooks","iCloud","iLife","iMac","iMessage","iMovie","iPhoto","iWatch","iWork","LogicPro","macOS","ProTools","QuickTime","iPhone","iPad","iPod","iOS","macOS","tvOS","watchOS"],"corporate":["Deloitte","Devoteam","ExxonMobil","GE","Boeing","Shell","Chevron"],"tech":["Bing","Salesforce","Asus","Acer","Lenovo","Huawei","Xiaomi","Epson","Nvidia","AMD","Qualcomm","Logitech","Panasonic","Sharp","Toshiba","Philips","Fujitsu","Netgear","Lexmark","Razer","SAP","Symantec","Kaspersky","Avast","McAfee","Siemens","Canon","Nikon","Garmin","GoPro","Oculus","Zoom","Slack","Trello","WeChat","Alibaba","Tencent","Baidu","Roku","Fitbit","Dropbox","Reddit","TikTok","Slack","Trello","Uber","Zoom","Reddit","Quora","JIRA","ZoomInfo","HubSpot","Mailchimp","WeChat","Dropbox","Uber","Telegram","Discord","StackOverflow","Quora","Reddit","ZoomInfo","Airbnb","LinkedIn","Snapchat","GitHub","GitLab","Nginx","OpenSSL","Webpack","Unity3D","Figma","JIRA","Kubernetes","TensorFlow","NPM","WooCommerce","WordPress","Slack","Trello","Uber","Zoom","Reddit","Quora","WeChat","Dropbox","Telegram","Discord","StackOverflow","Airbnb","LinkedIn","Snapchat","JIRA","MobX","VMware","Google"],"business":["Visa","Mastercard","Citibank","JPMorgan","Barclay","AMEX","Citigroup","PayPal","BNP","HSBC","Santander","UBS","Allianz","Prudential","Vanguard","BlackRock","CapitalOne","TD","Robinhood","MoneyGram","SoFi","Experian","Equifax","TransUnion","MasterCard","Blockchain","Coinbase","Binance","Kraken","Ethereum","Bitcoin"],"automotive":["BMW","Ford","Mercedes","Nissan","Tesla","Toyota","Audi","Chevrolet","Chrysler","Dodge","Ferrari","Fiat","Honda","Hyundai","Infiniti","Jaguar","Jeep","Kia","Lamborghini","LandRover","Lexus","Maserati","Mazda","McLaren","Mitsubishi","Peugeot","Porsche","Renault","RollsRoyce","Saab","Subaru","Suzuki","Volkswagen","Volvo","Alfa Romeo","Bentley","Bugatti","Cadillac","Citroen","Daewoo","Daihatsu","Datsun","DeLorean","Fiat Chrysler","GMC","Holden","Hummer","Isuzu","Koenigsegg","Lancia","Lincoln","Lotus","Mahindra","Suzuki","Opel","Pagani","Perodua","Proton","Rover","Scania","Skoda","SsangYong","Tata","Vauxhall","VinFast","Yugo","Zenvo"],"media":["Disney","Netflix","YouTube","Instagram","Twitter","Facebook","Spotify","Hulu","TikTok","Snapchat","Vimeo","Twitch","Reddit","HBO","Showtime","Starz","Crunchyroll","Audible","Pixar","DreamWorks","MGM","Lionsgate","Miramax","EpicGames","Ubisoft","Blizzard","Capcom","Bethesda","Sega","Roku","Fandango","IMDb","Shazam","SoundCloud","Vevo","Vine","Zynga","Tidal","Quibi","Crave","Gaia","PlutoTV","Vudu","Kanopy","Mubi","BritBox"],"telecom":["Verizon","Sprint","Nokia","Ericsson","Vodafone","AT&T","Huawei","Xiaomi","Orange","NTT","T-Mobile","Telefonica","Airtel","Telstra","Rogers","Bell","MTN","ZTE","Qualcomm","Motorola","Telus","BT","Swisscom","SoftBank","KDDI"],"entertainment":["Disney","Netflix","YouTube","Instagram","Twitter","Facebook","Spotify","Hulu","TikTok","Snapchat","Vimeo","Twitch","Reddit","Pandora","HBO","Showtime","Starz","Paramount","Peacock","Crunchyroll","Audible","Pixar","DreamWorks","MGM","Lionsgate","Miramax","EpicGames","Ubisoft","Blizzard","Capcom","Bethesda","Sega","Roku","Fandango","IMDb","Shazam","SoundCloud","Vevo","Zynga","Tidal","Oscars"],"retail":["Amazon","eBay","IKEA","Walmart","Zara","Target","Costco","Sephora","Nordstrom","Tesco","Asda","Aldi","Lidl","Carrefour","Uniqlo","H&M","Gap","Cabela’s","BassPro","REI","Ulta","Saks","JCPenney","Belk","Argos","Safeway","Kroger","Publix","HomeDepot","Woolworths","Staples","OfficeMax","B&H","Newegg","MicroCenter","Frys","Monoprix","Waitrose","Morrisons","Ocado","Flipkart","Rakuten","Alibaba","JD","Taobao","Tmall","Guomei","Suning"],"food":["Nestle","Pepsi","Coca-Cola","PepsiCo","Starbucks","KFC","BurgerKing","PizzaHut","TacoBell","Kroger","Costco","Woolworths","Carrefour","Tesco","Aldi","Lidl","Walmart","Safeway","Publix","WholeFoods","RedBull","Monster","Nespresso","Heineken","Budweiser","Corona","Guinness","GeneralMills","Unilever","Kraft","Heinz","Danone","Campbell","Tyson","Conagra","Mondelez","Suntory","Diageo","Pernod"],"pharmaceutical":["Pfizer","Moderna","Gilead","Merck","Novartis","Sanofi","Roche","AbbVie","Amgen","Bayer","Biogen","BristolMyers","Celgene","GSK","Janssen","Lilly","Medtronic","Mylan","NovoNordisk","Regeneron","Teva","AstraZeneca","Boehringer","Daiichi","Eisai","Genentech","Grifols","Ipsen","Mundipharma","Otsuka","Purdue","Sandoz","Servier","SunPharma","Takeda","UCB","Viatris","Wockhardt","Zydus","Alkem"],"nonprofit":["NGO","NPO","NGOs","NPOs","UN","UNESCO","UNICEF","UNHCR","UNODC","UNDP","UNFPA","UNEP","UNRWA"]}')},814(e){e.exports=JSON.parse('{"commercial":["Ltd.","LLC","PLC","Co.","Inc.","St.","Ave.","Bldg.","No.","GmbH"],"titles":["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","CMTO","CDO"],"accounting":["AP","COGS","EBIT","EPS","FIFO","GAAP","LIFO","P&L","ROI","SOX","TCO","VAT","EBITDA","NPV","WACC","AR"],"finance":["CAGR","DCF","ETF","IPO","IRR","M&A","NAV","PE","PEG","PPE","ROE","S&P","TVM","VC","FOMC","FX","ETF"],"legal":["AFA","ADR","CCPA","CFAA","CISG","DMCA","EULA","GDPR","HIPAA","NDA","SOW","TOS","LLM","JD","Esq.","AG","SARL","KYC","AML","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."]}')},661(e){e.exports=JSON.parse('{"eterms":["eBook","eBooks","eMarket","eMarketplace","eMarketplaces","eMarkets","eReader","eShop","eShops","eStore","eStores","E-commerce","E-com"]}')},157(e){e.exports=JSON.parse('{"countries":["Afghanistan","Albania","Algeria","Andorra","Angola","Antigua and Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burundi","Cabo Verde","Cambodia","Cameroon","Canada","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo","Costa Rica","Cote d\'Ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Eswatini","Ethiopia","Fiji","Finland","France","Gabon","Gambia","Georgia","Germany","Ghana","Greece","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Jordan","Kazakhstan","Kenya","Kiribati","Korea","Kosovo","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","New Zealand","Nicaragua","Niger","Nigeria","North Macedonia","Norway","Oman","Pakistan","Palau","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Qatar","Romania","Russia","Rwanda","Saint Kitts and Nevis","Saint Lucia","Saint Vincent and the Grenadines","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Korea","South Sudan","Spain","Sri Lanka","Sudan","Suriname","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Timor-Leste","Togo","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Yemen","Zambia","Zimbabwe"],"alpha2":["UK"],"alpha3":["USA"]}')},321(e){e.exports=JSON.parse('{"advertising":["AdWords","AdSense","AdMob","DoubleClick","SpotX"],"digitalMarketing":["DSP","SSP","CTR","CPA","CPC","CPL","CPM","CRM","SEO","SEM","SMM","A/B","CTOR","KPI","SERP","FAQ","PR"],"general":["B2B","B2C","CMO","USP","PWA","SMO","T&C","TOS","PP","UI","UX","UI/UX"],"blockchain":["PoE","PoW","PoC"],"accessibility":["A11Y"]}')},16(e){e.exports=JSON.parse('{"ranks":["Pvt.","Cpl.","Sgt.","SSgt.","GySgt.","MSgt.","1stSgt.","SgtMaj.","WO1","CW2","CW3","CW4","CW5","2ndLt.","1stLt.","Capt.","Maj.","LtCol.","Col.","BrigGen.","MajGen.","LtGen.","Gen.","Adm.","Cpt.","Cmdr.","Lt.","Ens."],"branches":["Army","Navy","Air Force","Marines","Coast Guard","Space Force","National Guard","People\'s Liberation Army","Russian Ground Forces","JASDF","ROKA"],"units":["Platoon","Company","Battalion","Regiment","Brigade","Division","Corps","Squad","Fleet","Wing","Squadron","Task Force","Eurocorps","Battlegroup","Rapid Reaction Force","Joint Expeditionary Force"],"acronyms":["DoD","NATO","EUFOR","EUTM","OSCE","UNSC","JAG","ROTC","AFB","MOS","AWOL","MRE","IED","FOB","TOC","CONUS","OCONUS","UCMJ","USMC","USAF","USN","USA","SOCOM","CENTCOM","NORAD","PACOM","JTF","RPG","SAM","ASEAN","AUKUS","QUAD","CSTO","SCO","CFSP","EEAS","EUMS","Frontex","GRU","FSB","PLAN","PLAAF"],"equipment":["Humvee","MRAP","Apache","Black Hawk","Bradley","Abrams","F-16","F-22","F-35","B-2","B-52","C-130","LCAC","MRE"],"operations":["Operation Desert Storm","Operation Enduring Freedom","Operation Iraqi Freedom","Operation Inherent Resolve"],"treaties":["Lisbon Treaty","Maastricht Treaty","Treaty of Rome","Nice Treaty","Schengen Agreement"],"regions":["South China Sea","Taiwan Strait","Korean DMZ","Kashmir","Kuril Islands","Senkaku Islands"],"alliances":["NATO","AUKUS","QUAD","ASEAN","SCO","CSTO","Five Eyes"]}')},742(e){e.exports=JSON.parse('{"miscellaneous":["w/","w/o","Open Source","Cybersecurity","Ecosystem","Biodiversity","LGBT","LGBTQ+","LGBTQIA+","2SLGBTQ+","BIPOC"]}')},501(e){e.exports=JSON.parse('{"terms":["API","APIs","ASCII","CI","CLI","DLL","DNS","EC2","FTP","HTTP","HTTPS","ICMP","IDE","IP","ISP","LPWAN","M2M","MQTT","OOP","REST","SSH","SSL","TCP","UDP","URL","WLAN","WYSIWYG","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","CI/CD","DevSecOps","UI/UX","UX/UI","UI","UX","MVC","ORM","3G","4G","5G","NumPy","VPN","PKI","WAN","NAT","GPU","SSD","HDD","RAM","Frontend","Backend","Fullstack"],"legal":["DMCA","GDPR","HIPAA","NDA","SOW","TOS"],"languages":["JavaScript","TypeScript","Java","PHP","SQL","CSS",".NET","ES5","ES6","NoSQL","DynamoDB","Terraform","CloudFormation","RDS","Python","Ruby","Go","Swift","Kotlin","Perl"],"formats":["JSON","XML","YAML","GraphQL","WebSocket","RESTful"],"secops":["RaaS","DevSecOps","SecOps","Cybersecurity","DDoS"],"technologies":["AWS","Azure","GCP","VMware","Docker","Ansible","Chef","Puppet","Git","Subversion","Jenkins","CircleCI","Hadoop","Spark","BigQuery","PowerBI","Tableau"],"os":["Android","macOS","Windows","Linux","iOS","Ubuntu","CentOS","Fedora","Debian","SUSE","HarmonyOS","FreeRTOS","BeOS","BSD","Cordova","Flutter"],"programming":["Angular","Bootstrap","CodeIgniter","jQuery","Laravel","Redux","Vue.js","VueX","SCSS","AJAX","GraphQL","HTML","HTML5","MySQL","MongoDB","PostgresQL","SQLite","ASP","ASPX","Elasticsearch","Nginx","OpenSSL","Webpack","Unity3D","Kubernetes","TensorFlow","NPM","cURL"]}')},491(e){e.exports=JSON.parse('{"timeRelated":["a.m.","p.m.","ca.","cc.","fig.","pl.","pt.","rev.","sr.","v.","vol.","et al.","pp.","p."],"academic":["adj.","adv.","cf.","cm.","co.","corp.","dept.","dist.","ed.","edn.","esp.","etc.","ex.","i.e.","e.g.","op. cit.","vs."]}')}},t={};function r(a){var i=t[a];if(void 0!==i)return i.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,r),s.exports}var a={};(()=>{var e=a;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"TitleCaser",{enumerable:!0,get:function(){return t.TitleCaser}}),e.default=void 0;var t=r(388);void 0===String.prototype.toTitleCase&&(String.prototype.toTitleCase=function(e){return new t.TitleCaser(e).toTitleCase(this)}),"undefined"!=typeof window&&window.document&&(window.TitleCaser=t.TitleCaser);e.default=t.TitleCaser})(),module.exports=a})();
|
|
5
|
+
*/(()=>{"use strict";var e={388(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.TitleCaser=void 0;var a=r(416),i=r(279);class s{constructor(e={}){this.options=e,this.debug=e.debug||!1,this.wordReplacementsList=JSON.parse(JSON.stringify(a.wordReplacementsList)),this.phraseReplacementMap=JSON.parse(JSON.stringify(a.phraseReplacementMap))}logWarning(e){this.debug&&console.warn(`Warning: ${e}`)}toTitleCase(e){try{if("string"!=typeof e)throw new TypeError("Invalid input: input must be a string.");if(0===e.length)throw new TypeError("Invalid input: input must not be empty.");if(e.length>1e5)throw new TypeError("Invalid input: input exceeds maximum length of 100,000 characters.");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=[],wordReplacementsList:o=this.wordReplacementsList,smartQuotes:n=!1,normalizeWhitespace:l=!0}=this.options,c=a.styleConfigMap[t]||{},u=["nl2br",...r],{articlesList:p,shortConjunctionsList:d,shortPrepositionsList:m,neverCapitalizedList:g,replaceTerms:h,smartQuotes:C}=i.TitleCaserUtils.getTitleCaseOptions(this.options,a.shortWordsList,o),y=o.map((e=>Object.keys(e)[0].toLowerCase())),f=Object.fromEntries(o.map((e=>[Object.keys(e)[0].toLowerCase(),Object.values(e)[0]])));this.logWarning(`replaceTermsArray: ${y}`),this.logWarning(`this.wordReplacementsList: ${this.wordReplacementsList}`);let S=e;S=S.replace(a.REGEX_PATTERNS.HTML_BREAK," nl2br ");i.TitleCaserUtils.isEntirelyUppercase(S.replace(/[^a-zA-Z]/g,""))&&(this.logWarning("Input string is entirely uppercase, normalizing to lowercase first"),S=S.toLowerCase());const A=S.split(/(\s+)/);S=A.map(((e,r)=>{if(!e||/^\s+$/.test(e))return e;const s=e;switch(!0){case i.TitleCaserUtils.isWordAmpersand(s):case i.TitleCaserUtils.hasHtmlBreak(s):case i.TitleCaserUtils.isWordIgnored(s,u):return s;case y.includes(s.toLowerCase()):return f[s.toLowerCase()];case i.TitleCaserUtils.isWordInArray(s,a.specialTermsList):return i.TitleCaserUtils.correctTerm(s,a.specialTermsList);case i.TitleCaserUtils.isElidedWord(s):return i.TitleCaserUtils.normalizeElidedWord(s);case i.TitleCaserUtils.hasHyphen(s):const e=s.replace(/[\W_]+$/,""),o=s.slice(e.length),n=e.split("-"),l=n.map((e=>{const t=e.toLowerCase();return y.includes(t)?f[t]:e})),c=!l.every(((e,t)=>e===n[t]))?l.join("-"):i.TitleCaserUtils.correctTermHyphenated(s,t);return c.endsWith(o)?c:c+o;case i.TitleCaserUtils.hasSuffix(s,t):return i.TitleCaserUtils.correctSuffix(s,a.specialTermsList);case i.TitleCaserUtils.hasUppercaseIntentional(s):return s;case i.TitleCaserUtils.isShortWord(s,t)&&0!==r:let p=null;for(let e=r-1;e>=0;e--)if(!/^\s+$/.test(A[e])){p=A[e];break}if(p&&i.TitleCaserUtils.endsWithSymbol(p,[":","?","!","."]))return s.charAt(0).toUpperCase()+s.slice(1);return i.TitleCaserUtils.normalizeCasingForWordByStyle(s,t);case i.TitleCaserUtils.endsWithSymbol(s):this.logWarning(`Check if the word ends with a symbol: ${s}`);const d=s.split(a.REGEX_PATTERNS.SPLIT_AT_PUNCTUATION);this.logWarning(`Splitting word at symbols, result: ${d}`);return d.map((e=>{if(this.logWarning(`Processing part: ${e}`),i.TitleCaserUtils.endsWithSymbol(e))return this.logWarning(`Part is a symbol: ${e}`),e;if(this.logWarning(`Part is a word: ${e}`),i.TitleCaserUtils.isWordInArray(e,a.specialTermsList)){const t=i.TitleCaserUtils.correctTerm(e,a.specialTermsList);return this.logWarning(`Word is in specialTermsList, corrected term: ${t}`),t}if(y.includes(e)){const t=f[e];return this.logWarning(`Word is in replaceTermsArray, replacement: ${t}`),t}{const t=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase();return this.logWarning(`Applying title casing to word: ${t}`),t}})).join("");case i.TitleCaserUtils.startsWithSymbol(s):return i.TitleCaserUtils.isWordInArray(s,a.specialTermsList)?i.TitleCaserUtils.correctTerm(s):s;case i.TitleCaserUtils.hasRomanNumeral(s):return s.toUpperCase();case i.TitleCaserUtils.hasNumbers(s):return s;default:return s.charAt(0).toUpperCase()+s.slice(1).toLowerCase()}})).join(""),S=S.replace(/nl2br/gi,"<br>"),n&&(S=i.TitleCaserUtils.convertQuotesToCurly(S));const T=S.split(/(\s+)/),w=T.filter((e=>!/^\s+$/.test(e)));let L=w[0]||null,b=w[1]||null;for(let e=0;e<T.length;e++){if(/^\s+$/.test(T[e]))continue;let t=null;for(let r=e-1;r>=0;r--)if(!/^\s+$/.test(T[r])){t=T[r];break}let r=null;for(let t=e+1;t<T.length;t++)if(!/^\s+$/.test(T[t])){r=T[t];break}let s=T[e];const o=s.match(a.REGEX_PATTERNS.TRAILING_PUNCTUATION);let n="";o&&(n=o[0],s=s.replace(a.REGEX_PATTERNS.TRAILING_PUNCTUATION,"")),i.TitleCaserUtils.isRegionalAcronymNoDot(s,r,t)&&(s=i.TitleCaserUtils.normalizeRegionalAcronym(s)),""!==n&&(s+=n),T[e]=s}S=T.join("");const O=S.split(/(\s+)/);for(let e=1;e<O.length-1;e++){const t=O[e];O[e-1],O[e+1];t===t.toUpperCase()||i.TitleCaserUtils.hasUppercaseIntentional(t)||i.TitleCaserUtils.isWordInArray(t,a.shortWordsList)&&(O[e]=t.length<=3?t.toLowerCase():t)}S=O.join("");const P=S.split(/(\s+)/);for(let e=0;e<P.length;e++){if(/^\s+$/.test(P[e]))continue;let t=P[e],r=null;for(let t=e-1;t>=0;t--)if(!/^\s+$/.test(P[t])){r=P[t];break}let a=null;for(let t=e+1;t<P.length;t++)if(!/^\s+$/.test(P[t])){a=P[t];break}a&&i.TitleCaserUtils.isRegionalAcronymNoDot(t,a,r)&&(P[e]=t.toUpperCase())}const v=P.filter((e=>!/^\s+$/.test(e)));let E=v[v.length-1],R=v[v.length-2],I=v[v.length-3];L&&i.TitleCaserUtils.isRegionalAcronym(L)&&(this.logWarning(`firstWord is a regional acronym: ${L}`),P[0]=L.toUpperCase()),L&&b&&i.TitleCaserUtils.isRegionalAcronymNoDot(L,b)&&(P[0]=L.toUpperCase()),E&&R&&i.TitleCaserUtils.isFinalWordRegionalAcronym(E,R,I)&&(P[P.length-1]=E.toUpperCase()),S=P.join("");for(const[e,t]of Object.entries(this.phraseReplacementMap)){const r=new RegExp(e.replace(a.REGEX_PATTERNS.REGEX_ESCAPE,"\\$&"),"gi");S=S.replace(r,t)}if("sentence"===c.caseStyle){const e=S.split(/(\s+)/);let t=!1;for(let r=0;r<e.length;r++){let i=e[r];t||!/[A-Za-z]/.test(i)?s.shouldKeepCasing(i,a.specialTermsList)||(e[r]=i.toLowerCase()):(s.shouldKeepCasing(i,a.specialTermsList)||(e[r]=i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()),t=!0)}S=e.join("")}return l&&(S=S.replace(/\s+/g," ").trim()),S}catch(e){throw e instanceof Error?e:new Error(String(e))}}setReplaceTerms(e){if(!Array.isArray(e))throw new TypeError("Invalid argument: setReplaceTerms must be an array of objects.");if(e.forEach((e=>{if(e&&"object"==typeof e){const[t,r]=Object.entries(e)[0],a=this.wordReplacementsList.findIndex((e=>e.hasOwnProperty(t)));-1!==a?this.wordReplacementsList[a][t]=r:this.wordReplacementsList.push({[t]:r})}else console.warn("Invalid entry in terms array:",e)})),this.wordReplacementsList.length>2e3)throw new Error("Too many replacement rules.");this.options.wordReplacementsList=this.wordReplacementsList,this.logWarning(`Log the updated this.wordReplacementsList: ${this.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=>Object.keys(t)[0]===e));if(-1!==r?this.wordReplacementsList[r][e]=t:this.wordReplacementsList.push({[e]:t}),this.wordReplacementsList.length>2e3)throw new Error("Too many replacement rules.");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,this.logWarning(`Log the updated this.wordReplacementsList: ${this.wordReplacementsList}`)}addExactPhraseReplacements(e){if(!Array.isArray(e))throw new TypeError("Invalid argument: newPhrases must be an array.");e.forEach((e=>{if("object"!=typeof e||Array.isArray(e)||1!==Object.keys(e).length){if("object"!=typeof e||Array.isArray(e))throw new TypeError("Invalid argument: Each item must be an object with a single key-value pair.");Object.entries(e).forEach((([e,t])=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Invalid argument: Each key-value pair must contain strings.");this.phraseReplacementMap[e]=t}))}else{const t=Object.keys(e)[0],r=e[t];if("string"!=typeof t||"string"!=typeof r)throw new TypeError("Invalid argument: Each key-value pair must contain strings.");this.phraseReplacementMap[t]=r}})),this.logWarning(`Log the this.phraseReplacementMap: ${this.phraseReplacementMap}`)}setStyle(e){if("string"!=typeof e)throw new TypeError("Invalid argument: style must be a string.");this.options.style=e}static shouldKeepCasing(e,t){return!!i.TitleCaserUtils.isRegionalAcronym(e)||(!!i.TitleCaserUtils.hasUppercaseIntentional(e)||!!i.TitleCaserUtils.isWordInArray(e,t))}}t.TitleCaser=s},416(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.wordReplacementsList=t.styleConfigMap=t.specialTermsList=t.shortWordsList=t.regionalAcronymPrecedingWordsList=t.regionalAcronymList=t.regionalAcronymFollowingWordsList=t.phraseReplacementMap=t.ignoredWordList=t.allowedStylesList=t.TITLE_CASE_STYLES=t.REGEX_PATTERNS=void 0;var a=d(r(223)),i=d(r(814)),s=d(r(661)),o=d(r(157)),n=d(r(321)),l=d(r(742)),c=d(r(501)),u=d(r(491)),p=d(r(16));function d(e){return e&&e.__esModule?e:{default:e}}const m=function(...e){const t=[];return e.forEach((e=>{Array.isArray(e)?e.forEach((e=>{Object.values(e).forEach((e=>{t.push(...e)}))})):"object"==typeof e&&Object.values(e).forEach((e=>{t.push(...e)}))})),[...new Set(t)]}(a.default,i.default,s.default,o.default,n.default,l.default,c.default,u.default,p.default),g=(t.specialTermsList=m,t.shortWordsList=["the","in","to","within","towards","into","at","of","for","by","on","from","with","through","about","across","over","under","between"],t.wordReplacementsList=[{"a.k.a":"AKA"},{"a.s.a.p":"ASAP"},{"f.a.q":"FAQ"},{"f.a.q.s":"FAQs"},{FAQS:"FAQs"},{"f.y.i":"FYI"},{"d.i.y":"DIY"},{"t.b.d":"TBD"},{"back-end":"Backend"},{"front-end":"Frontend"},{"full-stack":"Fullstack"},{nodejs:"Node.js"},{nextjs:"Next.js"},{nuxtjs:"Nuxt.js"},{reactjs:"React"},{"react.js":"React"},{"cyber-security":"Cybersecurity"}],t.TITLE_CASE_STYLES=Object.freeze({AP:"ap",APA:"apa",BRITISH:"british",CHICAGO:"chicago",NYT:"nyt",WIKIPEDIA:"wikipedia"}));t.allowedStylesList=Object.values(g),t.styleConfigMap=Object.freeze({ap:{caseStyle:"title",shortConjunctionsList:["and","but","or","nor","yet","so","for"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]},apa:{caseStyle:"title",shortConjunctionsList:["and","as","but","for","if","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","off","on","per","to","via"],neverCapitalizedList:[]},british:{caseStyle:"title",shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]},chicago:{caseStyle:"title",shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:["etc."]},nyt:{caseStyle:"title",shortConjunctionsList:["and","but","or","nor","yet","so","for"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]},wikipedia:{caseStyle:"sentence",shortConjunctionsList:["and","as","but","for","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["at","by","for","in","of","off","on","out","per","to","via"],neverCapitalizedList:[]}}),t.ignoredWordList=[],t.phraseReplacementMap={"the cybersmile foundation":"The Cybersmile Foundation","co. by colgate":"CO. by Colgate","on & off":"On & Off","on and off":"On and Off"},t.REGEX_PATTERNS=Object.freeze({TRAILING_PUNCTUATION:/[.,!?;:]+$/,SPLIT_AT_PUNCTUATION:/([.,\/#!$%\^&\*;:{}=\-_`~()?])/g,HTML_BREAK:/<\s*br\s*\/?\s*>/gi,MULTIPLE_SPACES:/ {2,}/g,REGEX_ESCAPE:/[.*+?^${}()|[\]\\]/g}),t.regionalAcronymList=["usa","us","u.s.a","u.s.","u.s","u.s.a.","eu","e.u.","e.u","uk","u.k.","u.k"],t.regionalAcronymPrecedingWordsList=["the","via","among","across","beyond","outside","alongside","throughout","despite","unlike","upon"],t.regionalAcronymFollowingWordsList=["act","acts","administration","administrations","agency","agencies","agreement","agreements","airforce","airforces","aid","alliance","alliances","ambassador","ambassadors","authority","authorities","bill","bills","bloc","blocs","budget","budgets","bureau","bureaus","cabinet","cabinets","charter","charters","command","commands","commission","commissions","conference","conferences","congress","congresses","convention","conventions","council","councils","court","courts","defense","defences","defence","defenses","delegation","delegations","democracy","democracies","department","departments","development","developments","directive","directives","diplomacy","division","divisions","economy","economies","embassy","embassies","engagement","engagements","envoy","envoys","exports","federation","federations","finance","finances","forces","framework","frameworks","funding","government","governments","hearing","hearings","imports","initiative","initiatives","intel","intelligence","intervention","interventions","jurisdiction","jurisdictions","law","laws","leadership","leaders","legislation","liaison","liaisons","mandate","mandates","markets","marines","military","militaries","ministry","ministries","mission","missions","navy","navies","negotiations","office","offices","operations","oversight","parliament","parliaments","plan","plans","policies","policy","policy-makers","precedent","precedents","presence","program","programme","programmes","programs","project","projects","protocol","protocols","province","provinces","reform","reforms","regulation","regulations","regulator","regulators","relations","representation","representations","republic","republics","resolution","resolutions","ruling","rulings","sanctions","security","securities","senate","senates","service","services","state","states","statute","statutes","strategy","strategies","summit","summits","summitry","surveillance","talks","tariffs","territory","territories","trade","trades","treasury","treasuries","treaty","treaties","tribunal","tribunals","troops","union","unions","veterans","warships","zone","zones"]},279(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.TitleCaserUtils=void 0;var a=r(416);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class n{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(!a.styleConfigMap.hasOwnProperty(t))throw new TypeError(`Invalid option: ${t}`);n.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(!a.allowedStylesList.includes(e.style))throw new TypeError(`Invalid option: ${t} must be a string`)}}static getTitleCaseOptions(e={},t=[]){const r=`${e.style||"ap"}|${!!e.hasOwnProperty("smartQuotes")&&e.smartQuotes}|${t.length>0?t.sort().join(","):""}`;if(n.titleCaseOptionsCache.has(r))return n.titleCaseOptionsCache.get(r);const i=s(s(s({},a.styleConfigMap[e.style||"ap"]),e),{},{smartQuotes:!!e.hasOwnProperty("smartQuotes")&&e.smartQuotes}),o=[...new Set([...i.articlesList,...t])],l=[...new Set([...i.shortConjunctionsList,...t])],c=[...new Set([...i.shortPrepositionsList,...t])],u=[...(i.replaceTerms||[]).map((([e,t])=>[e.toLowerCase(),t])),...a.wordReplacementsList],p={articlesList:o,shortConjunctionsList:l,shortPrepositionsList:c,neverCapitalizedList:[...i.neverCapitalizedList],replaceTerms:u,smartQuotes:i.smartQuotes};return n.titleCaseOptionsCache.set(r,p),p}static capitalizeFirstLetter(e){return e.charAt(0).toUpperCase()+e.slice(1)}static isShortConjunction(e,t){const r=[...n.getTitleCaseOptions({style:t}).shortConjunctionsList],a=e.toLowerCase();return r.includes(a)}static isArticle(e,t){return n.getTitleCaseOptions({style:t}).articlesList.includes(e.toLowerCase())}static isShortPreposition(e,t){const{shortPrepositionsList:r}=n.getTitleCaseOptions({style:t});return r.includes(e.toLowerCase())}static isNeverCapitalized(e,t){const r=`${t}_${e.toLowerCase()}`;if(n.isNeverCapitalizedCache.has(r))return n.isNeverCapitalizedCache.get(r);const{neverCapitalizedList:a}=n.getTitleCaseOptions({style:t}),i=a.includes(e.toLowerCase());return n.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(!a.allowedStylesList.includes(t))throw new Error(`Invalid option: style must be one of ${a.allowedStylesList.join(", ")}.`);return n.isShortConjunction(e,t)||n.isArticle(e,t)||n.isShortPreposition(e,t)||n.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){if(e.length<=4)return/[A-Z]/.test(e.slice(1));const t=/[A-Z]/.test(e.slice(1)),r=/[a-z]/.test(e.slice(1));return t&&r}static isEntirelyUppercase(e){return e===e.toUpperCase()&&e!==e.toLowerCase()&&e.length>1}static isRegionalAcronym(e){if("string"!=typeof e)throw new TypeError("Invalid input: word must be a string.");if(e.length<2)return!1;const t=e.toLowerCase();return a.regionalAcronymList.includes(t)}static isRegionalAcronymNoDot(e,t,r=null){if("string"!=typeof e||"string"!=typeof t)return!1;const i=e.toLowerCase().replace(/[^\w\s]/g,""),s=t.toLowerCase().replace(/[^\w\s]/g,"");return!!(r&&a.regionalAcronymList.includes(i)&&["the"].includes(r.toLowerCase()))||a.regionalAcronymList.includes(i)&&a.regionalAcronymFollowingWordsList.includes(s)}static isFinalWordRegionalAcronym(e,t,r=null){if("string"!=typeof e||"string"!=typeof t)return!1;const i=e.toLowerCase().replace(/[^\w]/g,""),s=t.toLowerCase().replace(/[^\w]/g,""),o="string"==typeof r?r.toLowerCase().replace(/[^\w]/g,""):null;return!!a.regionalAcronymList.includes(i)&&(!!a.regionalAcronymPrecedingWordsList.includes(s)||!("the"!==s||!o||!a.regionalAcronymPrecedingWordsList.includes(o)))}static normalizeRegionalAcronym(e){if("string"!=typeof e)throw new TypeError("Invalid input: word must be a string.");return e.toUpperCase()}static normalizeAcronymKey(e){return e.toLowerCase().replace(/\./g,"")}static normalizeCasingForWordByStyle(e,t){if(!e||!t||!a.styleConfigMap[t])return!1;const r=e.toLowerCase(),{shortConjunctionsList:i,articlesList:s,shortPrepositionsList:o,neverCapitalizedList:n}=a.styleConfigMap[t];return!![...i,...s,...o,...n].includes(r)&&e}static hasSuffix(e){return e.length>2&&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.");const t=e.includes("'")?e.split("'"):[e],r=/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i;return t.every((e=>r.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(!n.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/&|&/.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"&";case"<":return"<";case">":return">";case'"':return""";case"'":return"'";default:return e}}))}static unescapeSpecialCharacters(e){return e.replace(/&|<|>|"|'/g,(function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case""":return'"';case"'":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=a.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 convertQuotesToCurly(e){const t={"'":["‘","’"],'"':["“","”"]};let r="";for(let a=0;a<e.length;a++){const i=e[a],s=t[i];if(s){const t=e[a-1],i=e[a+1],o=!t||" "===t||"\n"===t?s[0]:s[1];r+=o,o===s[1]&&/[.,;!?()\[\]{}:]/.test(i)&&(r+=i,a++)}else r+=i}return r}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 a=e.toUpperCase();return t.hasOwnProperty(a)?t[a]:e}static isElidedWord(e){if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");const t=new Set(["o’","fo’","ne’er","e’er","’tis","’twas","’n’"]),r=e.trim().toLowerCase().replace(/'/g,"’");for(const e of t)if(r.startsWith(e))return!0;return!1}static normalizeElidedWord(e){if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");const t=new Set(["o’","fo’","ne’er","e’er","’tis","’twas","’n’"]),r=e.trim(),a=r.replace(/'/g,"’").toLowerCase();for(const e of t)if(a.startsWith(e)){const t=e.length,a=r.slice(t);return e.charAt(0).toUpperCase()+e.slice(1)+(a.length>0?a.charAt(0).toUpperCase()+a.slice(1):"")}return!1}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),a=t.findIndex((e=>e.toLowerCase()===r.toLowerCase()));if(a>=0){return`${t[a]}'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 a=e.split(r),i=a.length;for(let e=0;e<i;e++){const r=a[e].toLowerCase(),i=t.findIndex((e=>e.toLowerCase()===r));a[e]=i>=0?t[i]:a[e].charAt(0).toUpperCase()+a[e].slice(1).toLowerCase()}let s=r.source.charAt(0);return e.includes("-")?s="-":e.includes("'")&&(s="'"),a.join(s)}static correctTermHyphenated(e,t){const r=e.match(/[-–—]/);if(!r)return e;const i=r[0],s=e.split(/[-–—]/),o=s.some((e=>a.regionalAcronymList.includes(e.toLowerCase().replace(/[^\w]/g,"")))),l=e=>e.charAt(0).toUpperCase()+e.slice(1),c=e=>e.charAt(0)+e.slice(1).toLowerCase(),u={ap:(e,t)=>o||0===t?l(e):c(e),chicago:l,apa:(e,r,a)=>!o&&n.isShortWord(e,t)&&r>0&&r<a-1?e.toLowerCase():l(e),nyt:l,wikipedia:(e,t)=>0===t?l(e):c(e)}[t]||c;return s.map(((e,t)=>{let r=e;const i=e.toLowerCase().replace(/[^\w]/g,"");if(a.regionalAcronymList.includes(i))return e.toUpperCase();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();const o=e.toLowerCase(),n=a.specialTermsList.findIndex((e=>e.toLowerCase()===o));return n>=0&&(r=a.specialTermsList[n]),u(r,t,s.length)})).join(i)}}t.TitleCaserUtils=n,o(n,"TitleCaseValidator",void 0),o(n,"titleCaseOptionsCache",new Map),o(n,"isNeverCapitalizedCache",new Map)},223(e){e.exports=JSON.parse('{"sports":["FIFA","UEFA","NBA","NFL","MLB","NHL","NASCAR","IOC","FIBA","ATP","WTA","PGA","LPGA","FIA","WADA","ITF","AFL","NRL","ICC","IRB","IHF","FIVB","FINA","UCI","IAAF","ISU","WSF","BWF","WBC","WBO","IBF","IBO","UEFA","CONMEBOL","CONCACAF","CAF","AFC","OFC","CPL","MLS","LaLiga","Bundesliga","Ligue1","Eredivisie","JLeague","KLeague","Ryder Cup","Davis Cup","FedCup","XGames","Olympics","Paralympics","Dakar"],"apple":["Apple","AirDrop","AirPlay","AirPods","AirTags","FinalCut","GarageBand","iBooks","iCloud","iLife","iMac","iMessage","iMovie","iPhoto","iWatch","iWork","LogicPro","macOS","ProTools","QuickTime","iPhone","iPad","iPod","iOS","macOS","tvOS","watchOS"],"corporate":["Deloitte","Devoteam","ExxonMobil","GE","Boeing","Shell","Chevron"],"tech":["Bing","Salesforce","Asus","Acer","Lenovo","Huawei","Xiaomi","Epson","Nvidia","AMD","Qualcomm","Logitech","Panasonic","Sharp","Toshiba","Philips","Fujitsu","Netgear","Lexmark","Razer","SAP","Symantec","Kaspersky","Avast","McAfee","Siemens","Canon","Nikon","Garmin","GoPro","Oculus","Zoom","Slack","Trello","WeChat","Alibaba","Tencent","Baidu","Roku","Fitbit","Dropbox","Reddit","TikTok","Slack","Trello","Uber","Zoom","Reddit","Quora","JIRA","ZoomInfo","HubSpot","Mailchimp","WeChat","Dropbox","Uber","Telegram","Discord","StackOverflow","Quora","Reddit","ZoomInfo","Airbnb","LinkedIn","Snapchat","GitHub","GitLab","Nginx","OpenSSL","Webpack","Unity3D","Figma","JIRA","Kubernetes","TensorFlow","NPM","WooCommerce","WordPress","Slack","Trello","Uber","Zoom","Reddit","Quora","WeChat","Dropbox","Telegram","Discord","StackOverflow","Airbnb","LinkedIn","Snapchat","JIRA","MobX","VMware","Google"],"business":["Visa","Mastercard","Citibank","JPMorgan","Barclay","AMEX","Citigroup","PayPal","BNP","HSBC","Santander","UBS","Allianz","Prudential","Vanguard","BlackRock","CapitalOne","TD","Robinhood","MoneyGram","SoFi","Experian","Equifax","TransUnion","MasterCard","Blockchain","Coinbase","Binance","Kraken","Ethereum","Bitcoin"],"automotive":["BMW","Ford","Mercedes","Nissan","Tesla","Toyota","Audi","Chevrolet","Chrysler","Dodge","Ferrari","Fiat","Honda","Hyundai","Infiniti","Jaguar","Jeep","Kia","Lamborghini","LandRover","Lexus","Maserati","Mazda","McLaren","Mitsubishi","Peugeot","Porsche","Renault","RollsRoyce","Saab","Subaru","Suzuki","Volkswagen","Volvo","Alfa Romeo","Bentley","Bugatti","Cadillac","Citroen","Daewoo","Daihatsu","Datsun","DeLorean","Fiat Chrysler","GMC","Holden","Hummer","Isuzu","Koenigsegg","Lancia","Lincoln","Lotus","Mahindra","Suzuki","Opel","Pagani","Perodua","Proton","Rover","Scania","Skoda","SsangYong","Tata","Vauxhall","VinFast","Yugo","Zenvo"],"media":["Disney","Netflix","YouTube","Instagram","Twitter","Facebook","Spotify","Hulu","TikTok","Snapchat","Vimeo","Twitch","Reddit","HBO","Showtime","Starz","Crunchyroll","Audible","Pixar","DreamWorks","MGM","Lionsgate","Miramax","EpicGames","Ubisoft","Blizzard","Capcom","Bethesda","Sega","Roku","Fandango","IMDb","Shazam","SoundCloud","Vevo","Vine","Zynga","Tidal","Quibi","Crave","Gaia","PlutoTV","Vudu","Kanopy","Mubi","BritBox"],"telecom":["Verizon","Sprint","Nokia","Ericsson","Vodafone","AT&T","Huawei","Xiaomi","Orange","NTT","T-Mobile","Telefonica","Airtel","Telstra","Rogers","Bell","MTN","ZTE","Qualcomm","Motorola","Telus","BT","Swisscom","SoftBank","KDDI"],"entertainment":["Disney","Netflix","YouTube","Instagram","Twitter","Facebook","Spotify","Hulu","TikTok","Snapchat","Vimeo","Twitch","Reddit","Pandora","HBO","Showtime","Starz","Paramount","Peacock","Crunchyroll","Audible","Pixar","DreamWorks","MGM","Lionsgate","Miramax","EpicGames","Ubisoft","Blizzard","Capcom","Bethesda","Sega","Roku","Fandango","IMDb","Shazam","SoundCloud","Vevo","Zynga","Tidal","Oscars"],"retail":["Amazon","eBay","IKEA","Walmart","Zara","Target","Costco","Sephora","Nordstrom","Tesco","Asda","Aldi","Lidl","Carrefour","Uniqlo","H&M","Gap","Cabela’s","BassPro","REI","Ulta","Saks","JCPenney","Belk","Argos","Safeway","Kroger","Publix","HomeDepot","Woolworths","Staples","OfficeMax","B&H","Newegg","MicroCenter","Frys","Monoprix","Waitrose","Morrisons","Ocado","Flipkart","Rakuten","Alibaba","JD","Taobao","Tmall","Guomei","Suning"],"food":["Nestle","Pepsi","Coca-Cola","PepsiCo","Starbucks","KFC","BurgerKing","PizzaHut","TacoBell","Kroger","Costco","Woolworths","Carrefour","Tesco","Aldi","Lidl","Walmart","Safeway","Publix","WholeFoods","RedBull","Monster","Nespresso","Heineken","Budweiser","Corona","Guinness","GeneralMills","Unilever","Kraft","Heinz","Danone","Campbell","Tyson","Conagra","Mondelez","Suntory","Diageo","Pernod"],"pharmaceutical":["Pfizer","Moderna","Gilead","Merck","Novartis","Sanofi","Roche","AbbVie","Amgen","Bayer","Biogen","BristolMyers","Celgene","GSK","Janssen","Lilly","Medtronic","Mylan","NovoNordisk","Regeneron","Teva","AstraZeneca","Boehringer","Daiichi","Eisai","Genentech","Grifols","Ipsen","Mundipharma","Otsuka","Purdue","Sandoz","Servier","SunPharma","Takeda","UCB","Viatris","Wockhardt","Zydus","Alkem"],"nonprofit":["NGO","NPO","NGOs","NPOs","UN","UNESCO","UNICEF","UNHCR","UNODC","UNDP","UNFPA","UNEP","UNRWA"]}')},814(e){e.exports=JSON.parse('{"commercial":["Ltd.","LLC","PLC","Co.","Inc.","St.","Ave.","Bldg.","No.","GmbH"],"titles":["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","CMTO","CDO"],"accounting":["AP","COGS","EBIT","EPS","FIFO","GAAP","LIFO","P&L","ROI","SOX","TCO","VAT","EBITDA","NPV","WACC","AR"],"finance":["CAGR","DCF","ETF","IPO","IRR","M&A","NAV","PE","PEG","PPE","ROE","S&P","TVM","VC","FOMC","FX","ETF"],"legal":["AFA","ADR","CCPA","CFAA","CISG","DMCA","EULA","GDPR","HIPAA","NDA","SOW","TOS","LLM","JD","Esq.","AG","SARL","KYC","AML","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."]}')},661(e){e.exports=JSON.parse('{"eterms":["eBook","eBooks","eMarket","eMarketplace","eMarketplaces","eMarkets","eReader","eShop","eShops","eStore","eStores","E-commerce","E-com"]}')},157(e){e.exports=JSON.parse('{"countries":["Afghanistan","Albania","Algeria","Andorra","Angola","Antigua and Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burundi","Cabo Verde","Cambodia","Cameroon","Canada","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo","Costa Rica","Cote d\'Ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Eswatini","Ethiopia","Fiji","Finland","France","Gabon","Gambia","Georgia","Germany","Ghana","Greece","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Jordan","Kazakhstan","Kenya","Kiribati","Korea","Kosovo","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","New Zealand","Nicaragua","Niger","Nigeria","North Macedonia","Norway","Oman","Pakistan","Palau","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Qatar","Romania","Russia","Rwanda","Saint Kitts and Nevis","Saint Lucia","Saint Vincent and the Grenadines","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Korea","South Sudan","Spain","Sri Lanka","Sudan","Suriname","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Timor-Leste","Togo","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Yemen","Zambia","Zimbabwe"],"alpha2":["UK"],"alpha3":["USA"]}')},321(e){e.exports=JSON.parse('{"advertising":["AdWords","AdSense","AdMob","DoubleClick","SpotX"],"digitalMarketing":["DSP","SSP","CTR","CPA","CPC","CPL","CPM","CRM","SEO","SEM","SMM","A/B","CTOR","KPI","SERP","FAQ","PR"],"general":["B2B","B2C","CMO","USP","PWA","SMO","T&C","TOS","PP","UI","UX","UI/UX"],"blockchain":["PoE","PoW","PoC"],"accessibility":["A11Y"]}')},16(e){e.exports=JSON.parse('{"ranks":["Pvt.","Cpl.","Sgt.","SSgt.","GySgt.","MSgt.","1stSgt.","SgtMaj.","WO1","CW2","CW3","CW4","CW5","2ndLt.","1stLt.","Capt.","Maj.","LtCol.","Col.","BrigGen.","MajGen.","LtGen.","Gen.","Adm.","Cpt.","Cmdr.","Lt.","Ens."],"branches":["Army","Navy","Air Force","Marines","Coast Guard","Space Force","National Guard","People\'s Liberation Army","Russian Ground Forces","JASDF","ROKA"],"units":["Platoon","Company","Battalion","Regiment","Brigade","Division","Corps","Squad","Fleet","Wing","Squadron","Task Force","Eurocorps","Battlegroup","Rapid Reaction Force","Joint Expeditionary Force"],"acronyms":["DoD","NATO","EUFOR","EUTM","OSCE","UNSC","JAG","ROTC","AFB","MOS","AWOL","MRE","IED","FOB","TOC","CONUS","OCONUS","UCMJ","USMC","USAF","USN","USA","SOCOM","CENTCOM","NORAD","PACOM","JTF","RPG","SAM","ASEAN","AUKUS","QUAD","CSTO","SCO","CFSP","EEAS","EUMS","Frontex","GRU","FSB","PLAN","PLAAF"],"equipment":["Humvee","MRAP","Apache","Black Hawk","Bradley","Abrams","F-16","F-22","F-35","B-2","B-52","C-130","LCAC","MRE"],"operations":["Operation Desert Storm","Operation Enduring Freedom","Operation Iraqi Freedom","Operation Inherent Resolve"],"treaties":["Lisbon Treaty","Maastricht Treaty","Treaty of Rome","Nice Treaty","Schengen Agreement"],"regions":["South China Sea","Taiwan Strait","Korean DMZ","Kashmir","Kuril Islands","Senkaku Islands"],"alliances":["NATO","AUKUS","QUAD","ASEAN","SCO","CSTO","Five Eyes"]}')},742(e){e.exports=JSON.parse('{"miscellaneous":["w/","w/o","Open Source","Cybersecurity","Ecosystem","Biodiversity","LGBT","LGBTQ+","LGBTQIA+","2SLGBTQ+","BIPOC"]}')},501(e){e.exports=JSON.parse('{"terms":["API","APIs","ASCII","CI","CLI","DLL","DNS","EC2","FTP","HTTP","HTTPS","ICMP","IDE","IP","ISP","LPWAN","M2M","MQTT","OOP","REST","SSH","SSL","TCP","UDP","URL","WLAN","WYSIWYG","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","CI/CD","DevSecOps","UI/UX","UX/UI","UI","UX","MVC","ORM","3G","4G","5G","NumPy","VPN","PKI","WAN","NAT","GPU","SSD","HDD","RAM","Frontend","Backend","Fullstack"],"legal":["DMCA","GDPR","HIPAA","NDA","SOW","TOS"],"languages":["JavaScript","TypeScript","Java","PHP","SQL","CSS",".NET","ES5","ES6","NoSQL","DynamoDB","Terraform","CloudFormation","RDS","Python","Ruby","Go","Swift","Kotlin","Perl"],"formats":["JSON","XML","YAML","GraphQL","WebSocket","RESTful"],"secops":["RaaS","DevSecOps","SecOps","Cybersecurity","DDoS"],"technologies":["AWS","Azure","GCP","VMware","Docker","Ansible","Chef","Puppet","Git","Subversion","Jenkins","CircleCI","Hadoop","Spark","BigQuery","PowerBI","Tableau"],"os":["Android","macOS","Windows","Linux","iOS","Ubuntu","CentOS","Fedora","Debian","SUSE","HarmonyOS","FreeRTOS","BeOS","BSD","Cordova","Flutter"],"programming":["Angular","Bootstrap","CodeIgniter","jQuery","Laravel","Redux","Vue.js","VueX","SCSS","AJAX","GraphQL","HTML","HTML5","MySQL","MongoDB","PostgresQL","SQLite","ASP","ASPX","Elasticsearch","Nginx","OpenSSL","Webpack","Unity3D","Kubernetes","TensorFlow","NPM","cURL"]}')},491(e){e.exports=JSON.parse('{"timeRelated":["a.m.","p.m.","ca.","cc.","fig.","pl.","pt.","rev.","sr.","v.","vol.","et al.","pp.","p."],"academic":["adj.","adv.","cf.","cm.","co.","corp.","dept.","dist.","ed.","edn.","esp.","etc.","ex.","i.e.","e.g.","op. cit.","vs."]}')}},t={};function r(a){var i=t[a];if(void 0!==i)return i.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,r),s.exports}var a={};(()=>{var e=a;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"TitleCaser",{enumerable:!0,get:function(){return t.TitleCaser}}),e.default=void 0;var t=r(388);void 0===String.prototype.toTitleCase&&(String.prototype.toTitleCase=function(e){return new t.TitleCaser(e).toTitleCase(this)}),"undefined"!=typeof window&&window.document&&(window.TitleCaser=t.TitleCaser);e.default=t.TitleCaser})(),module.exports=a})();
|
package/index.d.ts
CHANGED
|
@@ -2,10 +2,8 @@ export interface TitleCaserOptions {
|
|
|
2
2
|
style?: 'ap' | 'apa' | 'chicago' | 'wikipedia' | 'nyt' | 'british';
|
|
3
3
|
smartQuotes?: boolean;
|
|
4
4
|
neverCapitalize?: string[];
|
|
5
|
-
|
|
5
|
+
wordReplacementsList?: Array<{ [key: string]: string }>;
|
|
6
6
|
debug?: boolean;
|
|
7
|
-
ignoreWords?: string[];
|
|
8
|
-
acronyms?: string[];
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
export class TitleCaser {
|
package/package.json
CHANGED