@sarmay/character-shaper
Version:
This is a Kazakh Arabic character shaper, which assists developers in correcting text in areas where the text is confusing. It is often used to enter Kazakh text normally on PhotoShop, PR and other software; it can also be used in nodejs image synthesis.
1 lines • 2.52 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.sarmayCharacterShaper=t():e.sarmayCharacterShaper=t()}(this,(function(){return(()=>{var e=[,e=>{e.exports={kzMap:{ا:{3:"ﺎ",4:"ﺍ"},ب:{1:"ﺑ",2:"ﺒ",3:"ﺐ",4:"ﺏ"},ۆ:{3:"ﯚ",4:"ﯙ"},گ:{1:"ﮔ",2:"ﮕ",3:"ﮓ",4:"ﮒ"},ع:{1:"ﻋ",2:"ﻌ",3:"ﻊ",4:"ﻉ"},د:{3:"ﺪ",4:"ﺩ"},ە:{3:"ﻪ",4:"ﻩ"},ج:{1:"ﺟ",2:"ﺠ",3:"ﺞ",4:"ﺝ"},ز:{3:"ﺰ",4:"ﺯ"},ي:{1:"ﻳ",2:"ﻴ",3:"ﻲ",4:"ﻱ"},ك:{1:"ﻛ",2:"ﻜ",3:"ﻚ",4:"ﻙ"},ق:{1:"ﻗ",2:"ﻘ",3:"ﻖ",4:"ﻕ"},ل:{1:"ﻟ",2:"ﻠ",3:"ﻞ",4:"ﻝ"},م:{1:"ﻣ",2:"ﻤ",3:"ﻢ",4:"ﻡ"},ن:{1:"ﻧ",2:"ﻨ",3:"ﻦ",4:"ﻥ"},ڭ:{1:"ﯕ",2:"ﯖ",3:"ﯔ",4:"ﯓ"},و:{3:"ﻮ",4:"ﻭ"},پ:{1:"ﭘ",2:"ﭙ",3:"ﭗ",4:"ﭖ"},ر:{3:"ﺮ",4:"ﺭ"},س:{1:"ﺳ",2:"ﺴ",3:"ﺲ",4:"ﺱ"},ت:{1:"ﺗ",2:"ﺘ",3:"ﺖ",4:"ﺕ"},ۋ:{3:"ﯟ",4:"ﯞ"},ۇ:{3:"ﯘ",4:"ﯗ"},ف:{1:"ﻓ",2:"ﻔ",3:"ﻒ",4:"ﻑ"},ح:{1:"ﺣ",2:"ﺤ",3:"ﺢ",4:"ﺡ"},چ:{1:"ﭼ",2:"ﭽ",3:"ﭻ",4:"ﭺ"},ش:{1:"ﺷ",2:"ﺸ",3:"ﺶ",4:"ﺵ"},ى:{1:"ﯨ",2:"ﯩ",3:"ﻰ",4:"ﻯ"},ء:{4:"ﺀ"},ھ:{1:"ﮬ"}}}}],t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,r),a.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";r.r(o),r.d(o,{default:()=>i});const{kzMap:e}=r(1),t=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n=(e,t,r)=>t&&r&&"ل"===t&&"ا"===r?e?0:1:-1,a=(r,o,n)=>o&&t(e,o)?n&&t(e,n)?r?t(e[o],"1")&&(t(e[n],"2")||t(e[n],"3"))?1:4:t(e[o],"2")&&(t(e[n],"2")||t(e[n],"3"))?2:t(e[o],"3")?3:void 0:t(e[o],"3")&&!r?3:4:0;function i(t){if("string"!=typeof t)return t;let r=0;const o=t.length;let i=t.charAt(r++),c=!0,f="",p=null;const s=["ﻻ","ﻼ"];for(;r<=o;r++){const l=r!==o?t.charAt(r):void 0;if("ھ"===i){f+="ﮬ",i=l,c=!1;continue}const u=n(c,i,l);if(-1===u)p=a(c,i,l),f+=0===p?i:e[i][p],c=!(1===p||2===p),i=l;else{if(f+=s[u],r===o-1)break;c=!0,i=t.charAt(++r)}}const l=f.split("\n").filter((e=>e.trim()));let u="";return l.forEach(((e,t)=>{if(e.trim()){const r=t<l.length-1?"\n":"";u+=e.split("").reverse().join("")+r}})),u}})(),o=o.default})()}));