t = 1 中/韩/日文, 2 英文/数字/符号('.', '@', '#', '+'), 3 ANSI符号 4 纯数字 5 非ANSI符号或不支持字符
339171
private function _optimize_result( &$smarr, $spos )
    {
        $newarr = array();
        $prePos = $spos - 1;
        $arlen = count($smarr);
        $i = $j = 0;
        //检测数量词
        if( $prePos > -1 && !isset($this->finallyResult[$prePos]) )
        {
            $lastw = $this->simpleResult[$prePos]['w'];
            $lastt = $this->simpleResult[$prePos]['t'];
              if( ($lastt==4 || isset( $this->addonDic['c'][$lastw] )) && isset( $this->addonDic['u'][$smarr[0]] ) )
              {
                 $this->simpleResult[$prePos]['w'] = $lastw.$smarr[0];
                 $this->simpleResult[$prePos]['t'] = 4;
                 if( !isset($this->newWords[ $this->simpleResult[$prePos]['w'] ]) )
                 {
                     $this->foundWordStr .= $this->_out_string_encoding( $this->simpleResult[$prePos]['w'] ).'/mu, ';
                     $this->SetWordInfos($this->simpleResult[$prePos]['w'], array('c'=>1, 'm'=>'mu'));
                 }
                 $smarr[0] = '';
                 $i++;
              }
       }
       for(; $i < $arlen; $i++)
       {
            
            if( !isset( $smarr[$i+1] ) )
            {
                $newarr[$j] = $smarr[$i];
                break;
            }
            $cw = $smarr[$i];
            $nw = $smarr[$i+1];
            $ischeck = false;
            //检测数量词
            if( isset( $this->addonDic['c'][$cw] ) && isset( $this->addonDic['u'][$nw] ) )
            {
                //最大切分时保留合并前的词
                if($this->differMax)
                {
                        $newarr[$j] = chr(0).chr(0x28);
                        $j++;
                        $newarr[$j] = $cw;
                        $j++;
                        $newarr[$j] = $nw;
                        $j++;
                        $newarr[$j] = chr(0).chr(0x29);
                        $j++;
                }
                $newarr[$j] = $cw.$nw;
                if( !isset($this->newWords[$newarr[$j]]) )
                {
                    $this->foundWordStr .= $this->_out_string_encoding( $newarr[$j] ).'/mu, ';
                    $this->SetWordInfos($newarr[$j], array('c'=>1, 'm'=>'mu'));
                }
                $j++; $i++; $ischeck = true;
            }
            //检测前导词(通常是姓)
            else if( isset( $this->addonDic['n'][ $smarr[$i] ] ) )
            {
                $is_rs = false;
                //词语是副词或介词或频率很高的词不作为人名
                if( strlen($nw)==4 )
                {
                    $winfos = $this->GetWordInfos($nw);
                    if(isset($winfos['m']) && ($winfos['m']=='r' || $winfos['m']=='c' || $winfos['c']>500) )
                    {
                         $is_rs = true;
                    }
                }
                if( !isset($this->addonDic['s'][$nw]) && strlen($nw)<5 && !$is_rs )
                {
                    $newarr[$j] = $cw.$nw;
                    //echo iconv(UCS2, 'utf-8', $newarr[$j])."<br />";
                    //尝试检测第三个词
                    if( strlen($nw)==2 && isset($smarr[$i+2]) && strlen($smarr[$i+2])==2 && !isset( $this->addonDic['s'][$smarr[$i+2]] ) )
                    {
                        $newarr[$j] .= $smarr[$i+2];
                        $i++;
                    }
                    if( !isset($this->newWords[$newarr[$j]]) )
                    {
                        $this->SetWordInfos($newarr[$j], array('c'=>1, 'm'=>'nr'));
                        $this->foundWordStr .= $this->_out_string_encoding($newarr[$j]).'/nr, ';
                    }
                    //为了防止错误，保留合并前的姓名
                    if(strlen($nw)==4)
                    {
                        $j++;
                        $newarr[$j] = chr(0).chr(0x28);
                        $j++;
                        $newarr[$j] = $cw;
                        $j++;
                        $newarr[$j] = $nw;
                        $j++;
                        $newarr[$j] = chr(0).chr(0x29);
                    }
                    
                    $j++; $i++; $ischeck = true;
                }
            }
            //检测后缀词(地名等)
            else if( isset($this->addonDic['a'][$nw]) )
            {
                $is_rs = false;
                //词语是副词或介词不作为前缀
                if( strlen($cw)>2 )
                {
                    $winfos = $this->GetWordInfos($cw);
                    if(isset($winfos['m']) && ($winfos['m']=='a' || $winfos['m']=='r' || $winfos['m']=='c' || $winfos['c']>500) )
                    {
                         $is_rs = true;
                    }
                }
                if( !isset($this->addonDic['s'][$cw]) && !$is_rs )
                {
                    $newarr[$j] = $cw.$nw;
                    if( !isset($this->newWords[$newarr[$j]]) )
                    {
                        $this->foundWordStr .= $this->_out_string_encoding($newarr[$j]).'/na, ';
                        $this->SetWordInfos($newarr[$j], array('c'=>1, 'm'=>'na'));
                    }
                    $i++; $j++; $ischeck = true;
                }
            }
            //新词识别（暂无规则）
            else if($this->unitWord)
            {
                if(strlen($cw)==2 && strlen($nw)==2 
                && !isset($this->addonDic['s'][$cw]) && !isset($this->addonDic['t'][$cw]) && !isset($this->addonDic['a'][$cw]) 
                && !isset($this->addonDic['s'][$nw]) && !isset($this->addonDic['c'][$nw]))
                {
                    $newarr[$j] = $cw.$nw;
                    //尝试检测第三个词
                    if( isset($smarr[$i+2]) && strlen($smarr[$i+2])==2 && (isset( $this->addonDic['a'][$smarr[$i+2]] ) || isset( $this->addonDic['u'][$smarr[$i+2]] )) )
                    {
                        $newarr[$j] .= $smarr[$i+2];
                        $i++;
                    }
                    if( !isset($this->newWords[$newarr[$j]]) )
                    {
                        $this->foundWordStr .= $this->_out_string_encoding($newarr[$j]).'/ms, ';
                        $this->SetWordInfos($newarr[$j], array('c'=>1, 'm'=>'ms'));
                    }
                    $i++; $j++; $ischeck = true;
                }
            }
            
            //不符合规则
            if( !$ischeck )
            {
                $newarr[$j] = $cw;
                  //二元消岐处理——最大切分模式
                if( $this->differMax && !isset($this->addonDic['s'][$cw]) && strlen($cw) < 5 && strlen($nw) < 7)
                {
                    $slen = strlen($nw);
                    $hasDiff = false;
                    for($y=2; $y <= $slen-2; $y=$y+2)
                    {
                        $nhead = substr($nw, $y-2, 2);
                        $nfont = $cw.substr($nw, 0, $y-2);
                        if( $this->IsWord( $nfont.$nhead ) )
                        {
                            if( strlen($cw) > 2 ) $j++;
                            $hasDiff = true;
                            $newarr[$j] = $nfont.$nhead;
                        }
                    }
                }
                $j++;
            }
            
       }//end for
       $smarr =  $newarr;
    }
1099222
function replace(value) {

  // 漢数字、漢字、全角文字を半角数字に変換
  value = suji(value);

  // 和暦時西暦に変換
  value = value.replace(REG_ERA, (x, g, n, af) => {
    var era = ERA_MAP[g];
    return '' + (era.y + (n === '元' ?  1 : +n) - 1) + af;
  });

  // 午前午後を24時間表記に変換
  value = value.replace(REG_AMPM, (x, ampm, n) => {
    var pm = ampm === '午後' || ampm.toLowerCase() === 'pm';
    return pm ? +n + 12 : n;
  });

  return value;
}
331793
public static void removePhraseFromDic(String phrasePath, String dicPath) {
        try(Stream<String> phrases = Files.lines(Paths.get(phrasePath), Charset.forName("utf-8"));
            Stream<String> words = Files.lines(Paths.get(dicPath), Charset.forName("utf-8"))){
            Set<String> set = new HashSet<>();
            phrases.forEach(phrase -> {
                String[] attr = phrase.split("=");
                if (attr != null && attr.length == 2) {
                    set.add(attr[0]);
                }
            });
            List<String> list = new ArrayList<>();
            AtomicInteger len = new AtomicInteger();
            words.forEach(word -> {
                len.incrementAndGet();
                if(!set.contains(word)){
                    list.add(word);
                }
            });
            set.clear();
            Files.write(Paths.get(dicPath), list, Charset.forName("utf-8"));
            LOGGER.info("移除短语结构数目："+(len.get() - list.size()));
        }catch(Exception e){
            LOGGER.error("移除短语结构失败：", e);
        }
    }
270967
function (lang) {
        if (lang == "es") {
            monthsAbbr = [
                'Ene',
                'Feb',
                'Mar',
                'Abr',
                'May',
                'Jun',
                'Jul',
                'Ago',
                'Sep',
                'Oct',
                'Nov',
                'Dic'
            ];

            monthsFull = [
                'Enero',
                'Febrero',
                'Marzo',
                'Abril',
                'Mayo',
                'Junio',
                'Julio',
                'Agosto',
                'Septiembre',
                'Octubre',
                'Noviembre',
                'Diciembre'
            ];

            daysAbbr = [
                'Dom',
                'Lun',
                'Mar',
                'Mie',
                'Jue',
                'Vie',
                'Sab'
            ];

            daysFull = [
                'Domingo',
                'Lunes',
                'Martes',
                'Miércoles',
                'Jueves',
                'Viernes',
                'Sábado'
            ];

            dayNames = {
                'do': 0,
                'dom': 0,
                'domingo': 0,
                'lu': 1,
                'lun': 1,
                'lunes': 1,
                'ma': 2,
                'mar': 2,
                'martes': 2,
                'mi': 3,
                'mie': 3,
                'miercoles': 3,
                'ju': 4,
                'jue': 4,
                'jueves': 4,
                'vi': 5,
                'vie': 5,
                'viernes': 5,
                'sa': 6,
                'sab': 6,
                'sabado': 6
            };
            monthsAll = monthsFull.concat(monthsAbbr);
            daysAll = [
                'do',
                'dom',
                'domingo',
                'lu',
                'lun',
                'lunes',
                'ma',
                'mar',
                'martes',
                'mi',
                'mie',
                'miércoles',
                'ju',
                'jue',
                'jueves',
                'vi',
                'vie',
                'viernes',
                'sa',
                'sab',
                'sábado'
            ];

            monthNames = {
                'ene': 0,
                'enero': 0,
                'feb': 1,
                'febrero': 1,
                'mar': 2,
                'marzo': 2,
                'abr': 3,
                'abril': 3,
                'may': 4,
                'mayo':4,
                'jun': 5,
                'junio': 5,
                'jul': 6,
                'julio': 6,
                'ago': 7,
                'agosto': 7,
                'sep': 8,
                'septiembre': 8,
                'oct': 9,
                'octubre': 9,
                'nov': 10,
                'noviembre': 10,
                'dic': 11,
                'diciembre': 11
            };
        } else if (lang == "fr") {
            monthsAbbr = [
                'Jan',
                'Fév',
                'Mar',
                'Avr',
                'Mai',
                'Jui',
                'Jul',
                'Aoû',
                'Sep',
                'Oct',
                'Nov',
                'Déc'
            ];

            monthsFull = [
                'Janvier',
                'Février',
                'Mars',
                'Avril',
                'Mai',
                'Juin',
                'Juillet',
                'Août',
                'Septembre',
                'Octobre',
                'Novembre',
                'Décembre'
            ];

            daysAbbr = [
                'Dim',
                'Lun',
                'Mar',
                'Mer',
                'Jeu',
                'Ven',
                'Sam'
            ];

            daysFull = [
                'Dimanchi',
                'Lundi',
                'Mardi',
                'Mercredi',
                'Jeudi',
                'Vendredi',
                'Samedi'
            ];

            dayNames = {
                'di': 0,
                'dim': 0,
                'dimanchi': 0,
                'lu': 1,
                'lun': 1,
                'lundi': 1,
                'ma': 2,
                'mar': 2,
                'mardi': 2,
                'me': 3,
                'mer': 3,
                'mercredi': 3,
                'je': 4,
                'jeu': 4,
                'jeudi': 4,
                've': 5,
                'ven': 5,
                'vendredi': 5,
                'sa': 6,
                'sam': 6,
                'samedi': 6
            };
            monthsAll = monthsFull.concat(monthsAbbr);
            daysAll = [
                'di',
                'dim',
                'dimanchi',
                'lu',
                'lun',
                'lundi',
                'ma',
                'mar',
                'mardi',
                'me',
                'mer',
                'mercredi',
                'je',
                'jeu',
                'jeudi',
                've',
                'ven',
                'vendredi',
                'sa',
                'sam',
                'samedi'
            ];

            monthNames = {
                'jan': 0,
                'janvier': 0,
                'fév': 1,
                'février': 1,
                'mar': 2,
                'mars': 2,
                'avr': 3,
                'avril': 3,
                'mai': 4,
                'jui': 5,
                'juin': 5,
                'jul': 6,
                'juillet': 6,
                'aoû': 7,
                'août': 7,
                'sep': 8,
                'septembre': 8,
                'oct': 9,
                'octobre': 9,
                'nov': 10,
                'novembre': 10,
                'déc': 11,
                'décembre': 11
            };
        } else if (lang == "pt-BR") {
            monthsAbbr = [
                'Jan',
                'Fev',
                'Mar',
                'Abr',
                'Mai',
                'Jun',
                'Jul',
                'Ago',
                'Set',
                'Out',
                'Nov',
                'Dez'
            ];

            monthsFull = [
                'Janeiro',
                'Fevereiro',
                'Março',
                'Abril',
                'Maio',
                'Junho',
                'Julho',
                'Agosto',
                'Setembro',
                'Outubro',
                'Novembro',
                'Dezembro'
            ];

            daysAbbr = [
                'Dom',
                'Seg',
                'Ter',
                'Qua',
                'Qui',
                'Sex',
                'Sab'
            ];

            daysFull = [
                'Domingo',
                'Segunda',
                'Terça',
                'Quarta',
                'Quinta',
                'Sexta',
                'Sábado'
            ];

            dayNames = {
                'do': 0,
                'dom': 0,
                'domingo': 0,
                'se': 1,
                'seg': 1,
                'segunda': 1,
                'te': 2,
                'ter': 2,
                'terca': 2,
                'qa': 3,
                'qua': 3,
                'quarta': 3,
                'qi': 4,
                'qui': 4,
                'quinta': 4,
                'se': 5,
                'sex': 5,
                'sexta': 5,
                'sa': 6,
                'sab': 6,
                'sabado': 6
            };
            monthsAll = monthsFull.concat(monthsAbbr);
            daysAll = [
                'do',
                'dom',
                'domingo',
                'se',
                'seg',
                'segunda',
                'te',
                'ter',
                'terça',
                'qa',
                'qua',
                'quarta',
                'qi',
                'qui',
                'quinta',
                'se',
                'sex',
                'sexta',
                'sa',
                'sab',
                'sábado'
            ];

            monthNames = {
                'jan': 0,
                'janeiro': 0,
                'fev': 1,
                'fevereiro': 1,
                'mar': 2,
                'março': 2,
                'abr': 3,
                'abril': 3,
                'mai': 4,
                'jun': 5,
                'junho': 5,
                'jul': 6,
                'julho': 6,
                'ago': 7,
                'agosto': 7,
                'set': 8,
                'setembro': 8,
                'out': 9,
                'outubro': 9,
                'nov': 10,
                'novembro': 10,
                'dez': 11,
                'dezembro': 11
            };
        }
    }
437630
function(){
		// とりあえず盤面全部の対応だけ
		var d0 = this.area, d = {x1:d0.x1,y1:d0.y1,x2:d0.x2,y2:d0.y2};
		var key_undo = this.board.exec.boardtype[this.old][0];
		if(key_undo & this.TURN){ var tmp=d.x1;d.x1=d.y1;d.y1=tmp;}
		this.exec(key_undo,d);
	}
256637
function parseValue (num) {
  if (num === '') return '0'

  const numStr = _toString(num)
  if (numStr.indexOf('0') === 0
    && numStr.indexOf('.') === -1) {
    // 处理01变成1,并且不处理1.
    return _toString(parseFloat(num))
  }
  return _toString(num)
}
407934
function bbsReader(data) {
    var i = 0, match, result = "";
        
    var author, title, time, label, board;
    
    if ((match = /^(\xa7@\xaa\xcc:.*)\n(.*)\n(.*)\n/.exec(data))) {
        // draw header    
        author = stripColon(match[1]);
        title = stripColon(match[2]);
        time = stripColon(match[3]);
        
        // find board
        var t = splitLabel(author);
        author = t[0];
        label = t[1];
        board = t[2];
        
        // 作者
        result += makeHead("\xa7@\xaa\xcc", author, label, board);
        // 標題
        result += makeHead("\xbc\xd0\xc3D", title);
        // 時間
        result += makeHead("\xae\xc9\xb6\xa1", time);
        
        // ─
        result += "<div class='line'><span class='f6'>" + "\xa2w".repeat(39) + "</span></div>";
        
        i += match[0].length;
    }
    
    var span = new Span(7, 0, false),
        pos = 0, cleanLine = false, cjk = false;
    
    result += "<div class='line'>";
    
    for (; i < data.length; i++) {
        // Special color
        if (pos == 0) {
            var ch = data.substr(i, 2);
            if (ch == "\xa1\xb0") {
                // ※
                cleanLine = true;
                span.reset();
                span.f = 2;
            } else if (ch == ": ") {
                // : 
                cleanLine = true;
                span.reset();
                span.f = 6;
            }
        }
        if (data[i] == "\x1b") {
            // ESC
            var span2 = extractColor(data, i, span);
            if (!span2) {
                span.text += data[i];
                pos++;
            } else if (cjk && data[span2.i] != "\n") {
                span.text += data[span2.i];
                span.halfEnd = true;
                
                result += span.toString();
                
                span2.text += span.text.substring(span.text.length - 2);
                span2.halfStart = true;
                
                pos++;
                i = span2.i;
                span = span2;
                cjk = false;
            } else {
                cjk = false;
                result += span.toString();
				if (span2.i <= i) {
					throw new Error("bbs-reader crashed! infinite loop");
				}
                i = span2.i - 1;
                span = span2;
            }
        } else if (data[i] == "\r" && data[i + 1] == "\n") {
            continue;
        } else if (data[i] == "\r" || data[i] == "\n") {
            result += span.toString() + "</div><div class='line'>";
            span.text = "";
            span.halfStart = false;
            span.halfEnd = false;
            cjk = false;
            
            if (cleanLine) {
                span.reset();
                cleanLine = false;
            }
            
            pos = 0;
        } else {
            if (cjk) {
                cjk = false;
            } else if (data.charCodeAt(i) & 0x80) {
                cjk = true;
            }
            span.text += data[i];
            pos++;
        }
    }
    
    result += span.toString() + "</div>";
    
    return {
        html: result,
        title: title,
        author: author,
        time: time
    };
}
326531
private static String loadtxt(String path){
		String rules = "";
		try {		
			InputStreamReader  read = new InputStreamReader (new FileInputStream(path),"utf-8");
			BufferedReader bin = new BufferedReader(read);
			String _ruleunit = bin.readLine();
			while (_ruleunit!=null)
			{
				if (!_ruleunit.startsWith("-"))
				{
					if(rules.equals(""))
						rules=rules+"("+_ruleunit+")";
					else
						rules=rules+"|("+_ruleunit+")";
				}	
				_ruleunit=bin.readLine();
			}
		}catch(Exception e){
			System.out.println("正则表达式文件未找到！");
		}
		return rules;
	}
447041
function parseParam(content, reg) {
    var marched = content.match(reg);
    var ret = {};
	
    if (marched && marched[1]) {
		marched[1].replace(/[\n\r]/g, '');
		var tcontent = delPageParamArea(content);
		try {
			var to = JSON.parse(marched[1]);
			for(var k in to){
				ret[k] = to[k];
			}
		} catch (e) {
			console.log('格式错误的模板变量:%s', marched[1]);
			return parseParam(tcontent,reg);
		}
		var otheret = parseParam(tcontent,reg);
		for(var j in otheret){
			ret[j] = otheret[j];
		}
		return ret;
	}
	return {};
}
165888
function smartDate($time, $ymd = 'Y-m-d', $his = 'H:i:s') 
	{
		$r = '';
	
		if (abs(time() - $time) < 24*3600) {
			$seconds = time() - $time;
			if($seconds > 0) {
				if ($seconds > 3600) {
					$r .= floor($seconds/3600) . "小时";
				}
				$r .= ceil($seconds%3600/60) . "分钟前";
			} else {
				$seconds =  -$seconds;
				if ($seconds > 3600) {
					$r .= floor($seconds/3600) . "小时";
				}
				$r .=  ceil($seconds%3600/60) . "分钟后";
			}
		} else {
			if (date('Y-m-d', strtotime('-1 day')) == date('Y-m-d', $time)) {
				$r = '昨天';
			} elseif (date('Y-m-d', strtotime('-2 day')) == date('Y-m-d', $time)) {
				$r = '前天';
			} elseif (date('Y-m-d', strtotime('+1 day')) == date('Y-m-d', $time)) {
				$r = '明天';
			} elseif (date('Y-m-d', strtotime('+2 day')) == date('Y-m-d', $time)) {
				$r = '后天';
			} else {
				$r = date($ymd, $time);
			}
	
			$his && $r .= ' ' . date($his);
		}
	
		return $r;
	}
360312
private static String format(String x) {
		int z = x.indexOf("."); // 取小数点位置
		String lstr = "", rstr = "";
		if (z > -1) { // 看是否有小数，如果有，则分别取左边和右边
			lstr = x.substring(0, z);
			rstr = x.substring(z + 1);
		} else {
			// 否则就是全部
			lstr = x;
		}

		String lstrrev = StrUtil.reverse(lstr); // 对左边的字串取反
		String[] a = new String[5]; // 定义5个字串变量来存放解析出来的叁位一组的字串

		switch (lstrrev.length() % 3) {
		case 1:
			lstrrev += "00";
			break;
		case 2:
			lstrrev += "0";
			break;
		}
		String lm = ""; // 用来存放转换後的整数部分
		for (int i = 0; i < lstrrev.length() / 3; i++) {
			a[i] = StrUtil.reverse(lstrrev.substring(3 * i, 3 * i + 3)); // 截取第一个叁位
			if (!a[i].equals("000")) { // 用来避免这种情况：1000000 = one million
										// thousand only
				if (i != 0) {
					lm = transThree(a[i]) + " " + parseMore(String.valueOf(i)) + " " + lm; // 加:
																							// thousand、million、billion
				} else {
					lm = transThree(a[i]); // 防止i=0时， 在多加两个空格.
				}
			} else {
				lm += transThree(a[i]);
			}
		}

		String xs = ""; // 用来存放转换後小数部分
		if (z > -1) {
			xs = "AND CENTS " + transTwo(rstr) + " "; // 小数部分存在时转换小数
		}

		return lm.trim() + " " + xs + "ONLY";
	}
712111
static public function str_cut($string, $length=4, $dot = '', $charset='utf-8')
	{
	    if(strtolower($charset) == 'utf-8') {
	        $length = $length * 2;   // 取其2倍为最长值
	    }
	    $strlen = strlen($string);
	    if($strlen <= $length) return $string;
	    $string = str_replace(array(' ','&nbsp;', '&amp;', '&quot;', '&#039;', '&ldquo;', '&rdquo;', '&mdash;', '&lt;', '&gt;', '&middot;', '&hellip;'), array('∵',' ', '&', '"', "'", '“', '”', '—', '<', '>', '·', '…'), $string);
	    $strcut = '';
	    if(strtolower($charset) == 'utf-8') {
	        //$length = intval($length-strlen($dot)-$length/3);
	        $n = $tn = $noc = 0;
	        while($n < strlen($string)) {
	            $t = ord($string[$n]);
	            if($t == 9 || $t == 10 || (32 <= $t && $t <= 126)) {
	                $tn = 1; $n++; $noc++;
	            } elseif(194 <= $t && $t <= 223) {
	                $tn = 2; $n += 2; $noc += 2;
	            } elseif(224 <= $t && $t <= 239) {
	                $tn = 3; $n += 3; $noc += 2;
	            } elseif(240 <= $t && $t <= 247) {
	                $tn = 4; $n += 4; $noc += 2;
	            } elseif(248 <= $t && $t <= 251) {
	                $tn = 5; $n += 5; $noc += 2;
	            } elseif($t == 252 || $t == 253) {
	                $tn = 6; $n += 6; $noc += 2;
	            } else {
	                $n++;
	            }
	            if($noc >= $length) {
	                break;
	            }
	        }
	        if($noc > $length) {
	            $n -= $tn;
	        }
	        $strcut = substr($string, 0, $n);
	        $strcut = str_replace(array('∵', '&', '"', "'", '“', '”', '—', '<', '>', '·', '…'), array(' ', '&amp;', '&quot;', '&#039;', '&ldquo;', '&rdquo;', '&mdash;', '&lt;', '&gt;', '&middot;', '&hellip;'), $strcut);
	    } else {
	        $dotlen = strlen($dot);
	        $maxi = $length - $dotlen - 1;
	        $current_str = '';
	        $search_arr = array('&',' ', '"', "'", '“', '”', '—', '<', '>', '·', '…','∵');
	        $replace_arr = array('&amp;','&nbsp;', '&quot;', '&#039;', '&ldquo;', '&rdquo;', '&mdash;', '&lt;', '&gt;', '&middot;', '&hellip;',' ');
	        $search_flip = array_flip($search_arr);
	        for ($i = 0; $i < $maxi; $i++) {
	            $current_str = ord($string[$i]) > 127 ? $string[$i].$string[++$i] : $string[$i];
	            if (in_array($current_str, $search_arr)) {
	                $key = $search_flip[$current_str];
	                $current_str = str_replace($search_arr[$key], $replace_arr[$key], $current_str);
	            }
	            $strcut .= $current_str;
	        }
	    }
	    return $strcut.$dot;
	}
547795
def parse_stupid_date(c):
    
    start_time = {
        1: { "hour": 8, "minute": 40 },
        2: { "hour": 10, "minute": 10 },
        3: { "hour": 12, "minute": 15 },
        4: { "hour": 13, "minute": 45 },
        5: { "hour": 15, "minute": 15 },
        6: { "hour": 16, "minute": 45 },
    }

    end_time = {
        1: { "hour": 9, "minute": 55 },
        2: { "hour": 11, "minute": 25 },
        3: { "hour": 13, "minute": 30 },
        4: { "hour": 15, "minute": 0 },
        5: { "hour": 16, "minute": 30 },
        6: { "hour": 18, "minute": 0 },
    }

    periods = c['periods']
    dates = []
    while len(periods) > 0:
        m = re.search('((?:.・)*(?:.))([0-9])([,-])([0-9])', periods)
        assert(m is not None)

        groups = list(reversed(list(m.groups())))
        weekdays = groups.pop().split('・')
        period_start = int(groups.pop())

        if len(groups) == 0:
            sep = ','
            period_end = period_start
        else:
            sep = groups.pop()
            period_end = int(groups.pop())

        assert(sep in ['-', ','])
        assert(1 <= period_start <= 6)
        assert(1 <= period_end <= 6)

        if sep == ',':
            assert(period_end - period_start == 1)

        for weekday in weekdays:
            dt = get_start_date(c['modules'], weekday)
            dt_start = dt.replace(**start_time[period_start])
            dt_end = dt.replace(**end_time[period_end])
            dates.append((dt_start, dt_end))

        periods = periods[m.span()[1]:]

    return dates
1081876
function ze(pt,ut,bt,ht){var It=pt.indexOf("."),At=We,wt=Xe,mt,yt,_t,vt,xt,St,kt;// Remove trailing zeros.
for(37>bt&&(pt=pt.toLowerCase()),0<=It&&(_t=dt,dt=0,pt=pt.replace(".",""),kt=new Le(bt),xt=kt.pow(pt.length-It),dt=_t,kt.c=ue(he(ce(xt.c),xt.e),10,ut),kt.e=kt.c.length),St=ue(pt,bt,ut),yt=_t=St.length;0==St[--_t];St.pop());if(!St[0])return"0";if(0>It?--yt:(xt.c=St,xt.e=yt,xt.s=ht,xt=qe(xt,kt,At,wt,ut),St=xt.c,vt=xt.r,yt=xt.e),mt=yt+At+1,It=St[mt],_t=ut/2,vt=vt||0>mt||null!=St[mt+1],vt=4>wt?(null!=It||vt)&&(0==wt||wt==(0>xt.s?3:2)):It>_t||It==_t&&(4==wt||vt||6==wt&&1&St[mt-1]||wt==(0>xt.s?8:7)),1>mt||!St[0])pt=vt?he("1",-At):"0";else{if(St.length=mt,vt)// Rounding up may mean the previous digit has to be rounded up and so on.
for(--ut;++St[--mt]>ut;)St[mt]=0,mt||(++yt,St.unshift(1));// Determine trailing zeros.
for(_t=St.length;!St[--_t];);// E.g. [4, 11, 15] becomes 4bf.
for(It=0,pt="";It<=_t;pt+=Pe.charAt(St[It++]));pt=he(pt,yt)}// The caller will add the sign.
return pt}
127269
function getISOWeekNumber (date) {
  var wn = getWeekNumber(date, 1, 1);
  var d1_1 = new Date(date.getFullYear(), 0, 1);
  var w1_1 = d1_1.getDay();
  // 初週の日数が少ない場合は週番号がひとつ前にずれる
  if (!w1_1 || 4 < w1_1) {
    wn--;
  }
  if (wn === 0) {
    return 53;
  } else if (wn === 53) {
    // 最終週の場合も多いほうの年の週番号とする
    var d12_31 = new Date(date.getFullYear(), 11, 31);
    var w12_31 = d12_31.getDay();
    return w12_31 && w12_31 < 4 ? 1 : wn;
  } else {
    return wn;
  }
}
942472
private function TL($a)
    {
        $tkk = $this->TKK();
        $b = $tkk[0];

        for ($d = [], $e = 0, $f = 0; $f < $this->JS_length($a); $f++) {
            $g = $this->JS_charCodeAt($a, $f);
            if (128 > $g) {
                $d[$e++] = $g;
            } else {
                if (2048 > $g) {
                    $d[$e++] = $g >> 6 | 192;
                } else {
                    if (55296 == ($g & 64512) && $f + 1 < $this->JS_length($a) && 56320 == ($this->JS_charCodeAt($a, $f + 1) & 64512)) {
                        $g = 65536 + (($g & 1023) << 10) + ($this->JS_charCodeAt($a, ++$f) & 1023);
                        $d[$e++] = $g >> 18 | 240;
                        $d[$e++] = $g >> 12 & 63 | 128;
                    } else {
                        $d[$e++] = $g >> 12 | 224;
                    }
                    $d[$e++] = $g >> 6 & 63 | 128;
                }
                $d[$e++] = $g & 63 | 128;
            }
        }
        $a = $b;
        for ($e = 0; $e < count($d); $e++) {
            $a += $d[$e];
            $a = $this->RL($a, '+-a^+6');
        }
        $a = $this->RL($a, '+-3^+b+-f');
        $a ^= $tkk[1] ? $tkk[1] + 0 : 0;
        if (0 > $a) {
            $a = ($a & 2147483647) + 2147483648;
        }
        $a = fmod($a, pow(10, 6));

        return $a.'.'.($a ^ $b);
    }
1072419
function getCustomDeps(info) {
    var res = [];

    if (info.modules && Array.isArray(info.modules)) {
        info = info.modules;
    }
    else {
        info = [];
    }

    info.forEach(function (item) {
        // 只包含额外需要包含的模块
        // 对额外排除的模块不做处理
        if (item.charAt(0) === '~') {
            res.push(item.substring(1));
        }
    });

    return res;
}