`shell
# Mujoco dependencies
sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3 patchelf
mkdir ~/.mujoco
cd ~/.mujoco
wget https://github.com/google-deepmind/mujoco/releases/download/2.1.0/mujoco210-linux-x86_64.tar.gz
tar -zxvf mujoco210-linux-x86_64.tar.gz

# Add to PATH
code ~/.bashrc
export LD_LIBRARY_PATH=~/.mujoco/mujoco210/bin
source ~/.bashrc

# Test
cd ~/.mujoco/mujoco210/bin
./simulate ../model/humanoid.xml

# Error 因为使用SSH连接的服务器没有图形化界面导致，实际已经可以使用，参考：https://zhuanlan.zhihu.com/p/486957504 评论区
MuJoCo Pro version 2.10
ERROR: could not initialize GLFW

Press Enter to exit ...
```

#### 1.2.2 安装Mujoco的Python库

直接用diffusion policy的conda环境

https://github.com/real-stanford/diffusion_policy?tab=readme-ov-file#%EF%B8%8F-simulation

https://blog.csdn.net/qq_47997583/article/details/125400418

```shell
gedit ~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia
```

```python
# Test
import mujoco_py
import os
mj_path = mujoco_py.utils.discover_mujoco()
xml_path = os.path.join(mj_path, 'model', 'humanoid.xml')
model = mujoco_py.load_model_from_path(xml_path)
sim = mujoco_py.MjSim(model)

print(sim.data.qpos)
# [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]

sim.step()
print(sim.data.qpos)

# 输出以下内容即可
# [-2.09531783e-19  2.72130735e-05  6.14480786e-22 -3.45474715e-06
#   7.42993721e-06 -1.40711141e-04 -3.04253586e-04 -2.07559344e-04
#   8.50646247e-05 -3.45474715e-06  7.42993721e-06 -1.40711141e-04
#  -3.04253586e-04 -2.07559344e-04 -8.50646247e-05  1.11317030e-04
#  -7.03465386e-05 -2.22862221e-05 -1.11317030e-04  7.03465386e-05
#  -2.22862221e-05]
```

## 2. Mujoco注意事项

设置 MUJOCO_GL 环境变量： 你可以通过设置 MUJOCO_GL 环境变量来选择不同的 OpenGL 后端。常见的选项有 osmesa（无头模


 (C) 2012-2015  Oleg Dolya
 *
 * Shattered Pixel Dungeon
 * Copyright (C) 2014-2016 Evan Debenham
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */
package com.egoal.darkestpixeldungeon.actors.buffs

import com.egoal.darkestpixeldungeon.Assets
import com.egoal.darkestpixeldungeon.Dungeon
import com.egoal.darkestpixeldungeon.actors.hero.Hero
import com.egoal.darkestpixeldungeon.effects.SpellSprite
import com.egoal.darkestpixeldungeon.messages.Messages
import com.egoal.darkestpixeldungeon.scenes.GameScene
import com.egoal.darkestpixeldungeon.ui.BuffIndicator
import com.watabou.noosa.audio.Sample
import com.watabou.utils.Bundle
import kotlin.math.max
import kotlin.math.min
import kotlin.math.pow
import kotlin.math.round

class Berserk : Buff() {
    private var state = State.NORMAL
    private var exhaustion: Int = 0
    private var levelRecovery: Float = 0f
    private var level: Int = 1

    private enum class State {
        NORMAL, BERSERK, EXHAUSTED, RECOVERING
    }

    override fun storeInBundle(bundle: Bundle) {
        super.storeInBundle(bundle)
        bundle.put(STATE, state)
        if (state == State.EXHAUSTED) bundle.put(EXHAUSTION, exhaustion)
        if (state == State.EXHAUSTED || state == State.RECOVERING)
            bundle.put(LEVEL_RECOVERY, levelRecovery)
        bundle.put(LEVEL, level)
    }

    override fun restoreFromBundle(bundle: Bundle) {
        super.restoreFromBundle(bundle)
        state = bundle.getEnum(STATE, State::class.java)
        if (state == State.EXHAUSTED) exhaustion = bundle.getInt(EXHAUSTION)
        if (state == State.EXHAUSTED || state == State.RECOVERING)
            levelRecovery = bundle.getFloat(LEVEL_RECOVERY)

        level = bundle.getInt(LEVEL)
        if (level == 0) level = 1
    }

    override fun act(): Boolean {
        if (berserking()) {
            target.SHLD -= min(target.SHLD, 1)
            if (target.SHLD == 0) {
                if (target.HP <= 0) {
                    target.die(this)
                    if (!target.isAlive) Dungeon.fail(javaClass)
                }
            }

            if (target.HP >= 5) {
                state = State.EXHAUSTED
                exhaustion = EXHAUSTION_START
                levelRecovery = LEVEL_RECOVER_START
                BuffIndicator.refreshHero()
                target.SHLD = 0
            }
        } else if (state == State.EXHAUSTED) {
            exhaustion--
            if (exhaustion == 0) {
                state = State.RECOVERING
                BuffIndicator.refreshHero()
                level += 1
            }
        }
        spend(TICK)
        return true
    }

    fun damageFactor(dmg: Int): Int {
        val bonus: Float

        bonus = if (state == State.EXHAUSTED) (50 - exhaustion) / 50f else {
            val per


	194,  // 1016: google.fhir.stu3.proto.Clinicaldocument.Event.extension:type_name -> google.fhir.stu3.proto.Extension
	194,  // 1017: google.fhir.stu3.proto.Clinicaldocument.Event.modifier_extension:type_name -> google.fhir.stu3.proto.Extension
	198,  // 1018: google.fhir.stu3.proto.Clinicaldocument.Event.code:type_name -> google.fhir.stu3.proto.CodeableConcept
	231,  // 1019: google.fhir.stu3.proto.Clinicaldocument.Event.period:type_name -> google.fhir.stu3.proto.Period
	196,  // 1020: google.fhir.stu3.proto.Clinicaldocument.Event.detail:type_name -> google.fhir.stu3.proto.Reference
	200,  // 1021: google.fhir.stu3.proto.Clinicaldocument.Section.id:type_name -> google.fhir.stu3.proto.String
	194,  // 1022: google.fhir.stu3.proto.Clinicaldocument.Section.extension:type_name -> google.fhir.stu3.proto.Extension
	194,  // 1023: google.fhir.stu3.proto.Clinicaldocument.Section.modifier_extension:type_name -> google.fhir.stu3.proto.Extension
	200,  // 1024: google.fhir.stu3.proto.Clinicaldocument.Section.title:type_name -> google.fhir.stu3.proto.String
	198,  // 1025: google.fhir.stu3.proto.Clinicaldocument.Section.code:type_name -> google.fhir.stu3.proto.CodeableConcept
	192,  // 1026: google.fhir.stu3.proto.Clinicaldocument.Section.text:type_name -> google.fhir.stu3.proto.Narrative
	241,  // 1027: google.fhir.stu3.proto.Clinicaldocument.Section.mode:type_name -> google.fhir.stu3.proto.ListModeCode
	198,  // 1028: google.fhir.stu3.proto.Clinicaldocument.Section.ordered_by:type_name -> google.fhir.stu3.proto.CodeableConcept
	196,  // 1029: google.fhir.stu3.proto.Clinicaldocument.Section.entry:type_name -> google.fhir.stu3.proto.Reference
	198,  // 1030: google.fhir.stu3.proto.Clinicaldocument.Section.empty_reason:type_name -> google.fhir.stu3.proto.CodeableConcept
	76,   // 1031: google.fhir.stu3.proto.Clinicaldocument.Section.section:type_name -> google.fhir.stu3.proto.Clinicaldocument.Section
	195,  // 1032: google.fhir.stu3.proto.Clinicaldocument.RelatesTo.Target.identifier:type_name -> google.fhir.stu3.proto.Identifier
	196,  // 1033: google.fhir.stu3.proto.Clinicaldocument.RelatesTo.Target.reference:type_name -> google.fhir.stu3.proto.Reference
	202,  // 1034: google.fhir.stu3.proto.Devicemetricobservation.Effective.date_time:type_name -> google.fhir.stu3.proto.DateTime
	232,  // 1035: google.fhir.stu3.proto.Devicemetricobservation.Value.quantity:type_name -> google.fhir.stu3.proto.Quantity
	198,  // 1036: google.fhir.stu3.proto.Devicemetricobservation.Value.codeable_concept:type_name -> google.fhir.stu3.proto.CodeableConcept
	200,  // 1037: google.fhir.stu3.proto.Devicemetricobservation.Value.str


rt # %d", port);
		return;
	}

	if (port >= NPCX_CEC_BITBANG_TIMER_COUNT) {
		CPRINTS("CEC ERR: NPCX does not support port # %d", port);
		return;
	}

	drv_config = cec_config[port].drv_config;
	if (drv_config->timer < 0 ||
	    drv_config->timer >= NPCX_CEC_BITBANG_TIMER_COUNT) {
		CPRINTS("CEC%d ERR: Invalid timer # %d", port,
			drv_config->timer);
		return;
	}

	/* APB1 is the clock we base the timers on */
	apb1_freq_div_10k = clock_get_apb1_freq() / 10000;

	/* Ensure Multi-Function timer is powered up. */
	CLEAR_BIT(NPCX_PWDWN_CTL(mdl), NPCX_PWDWN_CTL1_MFT1_PD);

	/* Mode 5 - Dual-independent input capture */
	SET_FIELD(NPCX_TMCTRL(mdl), NPCX_TMCTRL_MDSEL_FIELD, NPCX_MFT_MDSEL_5);

	/* Enable capture TCNTx into TCRx and preset TCNTx. */
	SET_BIT(NPCX_TMCTRL(mdl), npcx_cec_timer_cfg[drv_config->timer].enable);
}


    const MyComponent = class { };

    const node: any = { type: LayoutType.Component, data: { name: 'theComponentName' } };
    store.setOriginalComponentClassForName('theComponentName', MyComponent);
    uut.crawl(node);
    expect(node.data.options).toEqual({});
  });

  describe('navigation options', () => {
    let options;
    let node;

    beforeEach(() => {
      options = {};
      node = { type: LayoutType.Component, data: { name: 'theComponentName', options } };
    });

    it('processes colors into numeric AARRGGBB', () => {
      options.someKeyColor = 'red';
      uut.crawl(node);
      expect(node.data.options.someKeyColor).toEqual(0xffff0000);
    });

    it('processes colors into numeric AARRGGBB', () => {
      options.someKeyColor = 'yellow';
      uut.crawl(node);
      expect(node.data.options.someKeyColor).toEqual(0xffffff00);
    });

    it('processes numeric colors', () => {
      options.someKeyColor = '#123456';
      uut.crawl(node);
      expect(node.data.options.someKeyColor).toEqual(0xff123456);
    });

    it('processes numeric colors with rrggbbAA', () => {
      options.someKeyColor = 0x123456ff; // wut
      uut.crawl(node);
      expect(node.data.options.someKeyColor).toEqual(0xff123456);
    });

    it('process colors with rgb functions', () => {
      options.someKeyColor = 'rgb(255, 0, 255)';
      uut.crawl(node);
      expect(node.data.options.someKeyColor).toEqual(0xffff00ff);
    });

    it('process colors with special words', () => {
      options.someKeyColor = 'fuchsia';
      uut.crawl(node);
      expect(node.data.options.someKeyColor).toEqual(0xffff00ff);
    });

    it('process colors with hsla functions', () => {
      options.someKeyColor = 'hsla(360, 100%, 100%, 1.0)';
      uut.crawl(node);
      expect(node.data.options.someKeyColor).toEqual(0xffffffff);
    });

    it('unknown colors return undefined', () => {
      options.someKeyColor = 'wut';
      uut.crawl(node);
      expect(node.data.options.someKeyColor).toEqual(undefined);
    });

    it('any keys ending with Color', () => {
      options.otherKeyColor = 'red';
      options.yetAnotherColor = 'blue';
      options.andAnotherColor = 'rgb(0, 255, 0)';
      uut.crawl(node);
      expect(node.data.options.otherKeyColor).toEqual(0xffff0000);
      expect(node.data.options.yetAnotherColor).toEqual(0xff0000ff);


own, int yDown){
		this.g = g;
		this.xDown=xDown;
		this.yDown = yDown;
		xDrag = xDown;
		yDrag= yDown;
		this.component = component;
		drawRectangleDown();
	}
	public DragRectangle(){
	}
	public void drawFirstRectangle(Graphics g, int xDown, int yDown){
		this.g = g;
		this.xDown=xDown;
		this.yDown = yDown;
		xDrag = xDown;
		yDrag= yDown;
		drawRectangleDown();
	}
	/* ----------------------------------*/
	void drawRect(Graphics g, int x1, int y1, int x2, int y2){
		if (x1>x2){
			if (y1>y2)
				GraphicsUtil.drawXORRect(g, x2, y2, x1-x2, y1-y2);
			else
				GraphicsUtil.drawXORRect(g, x2, y1, x1-x2, y2-y1);
		}
		else {
			if (y1>y2)
				GraphicsUtil.drawXORRect(g, x1, y2, x2-x1, y1-y2);
			else
				GraphicsUtil.drawXORRect(g, x1, y1, x2-x1, y2-y1);
		}
	}
	/* ----------------------------------*/
	void undrawRect(Component c, Graphics g, int x1, int y1, int x2, int y2){
		if (x1>x2){
			if (y1>y2)
				GraphicsUtil.undrawXORRect(c, g, x2, y2, x1-x2, y1-y2);
			else
				GraphicsUtil.undrawXORRect(c, g, x2, y1, x1-x2, y2-y1);
		}
		else {
			if (y1>y2)
				GraphicsUtil.undrawXORRect(c, g, x1, y2, x2-x1, y1-y2);
			else
				GraphicsUtil.undrawXORRect(c, g, x1, y1, x2-x1, y2-y1);
		}
	}
	/* ----------------------------------*/
	public void drawRectangleDown(){
    		if (g!=null){
	   		g.setColor(Color.black);
			drawRect(g, xDown, yDown,  xDrag, yDrag);
		}
	}
	/* ----------------------------------*/
	public void drawRectangleUp(){
    		if (g!=null){
	   		g.setColor(Color.black);
			undrawRect(component, g, xDown, yDown,  xDrag, yDrag);
		}
	}
	/* ----------------------------------*/
	public void drawRectangleDrag(int xPixel, int yPixel){
    		if (g!=null){
	   		g.setColor(Color.black);
			undrawRect(component, g, xDown, yDown,  xDrag, yDrag);
			drawRect(g, xDown, yDown,  xPixel, yPixel);
			xDrag=xPixel;
			yDrag=yPixel;
		}
	}
	/* ----------------------------------*/
	public void dispose(){
    		if (g!=null){
	    		g.dispose();
		}
	}
}

/* Mesquite source code.  Copyright 2001 and onward, D. Maddison and W. Maddison.

Disclaimer:  The Mesquite source code is lengthy and we are few.  There are no doubt inefficiencies and goofs in this code.
The commenting leaves much to be desired. Please approach this source code with the spirit of helping out.
Perhaps with your help we can be more than a few, and make Mesquite better.

Mesquite is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
Mesquite's web site is http://mesquiteproject.org

This source code and its compiled class files are free and modifiable under the terms of
GNU Lesser General Public License.  (http://www.gnu.org/copyleft/lesser.html)
 */
package mesquite.lib.ui;

import java.awt.Dimension;
import java.awt.Font;

import javax.swing.JEditorPane;

//workaround for crashes on OS X && Linux  [Search for MQLINUX]
public class MQJEditorPane


href="conceptmap-definitions.html#ConceptMap.group.unmapped.url" title="The canonical reference to an additional ConceptMap resource instance to use for mapping if this ConceptMap resource contains no matching mapping for the source concept." class="dict">ConceptMap.group.unmapped.url [ canonical(ConceptMap) ]; # 0..1 canonical reference to an additional ConceptMap to use for mapping if the source concept is unmapped
    ];
  ], ...;
]

Changes since Release 3

      ConceptMap

    ConceptMap.status

Change value set from http://hl7.org/fhir/ValueSet/publication-status to http://hl7.org/fhir/ValueSet/publication-status|4.0.1

    ConceptMap.experimental

No longer marked as Modifier

    ConceptMap.source[x]

Add Type canonical(ValueSet)

Remove Type Reference(ValueSet)

    ConceptMap.target[x]

Add Type canonical(ValueSet)

Remove Type Reference(ValueSet)

    ConceptMap.group.element.target.equivalence

Min Cardinality changed from 0 to 1

Change value set from http://hl7.org/fhir/ValueSet/concept-map-equivalence to http://hl7.org/fhir/ValueSet/concept-map-equivalence|4.0.1

Default Value "equivalent" removed

    ConceptMap.group.element.target.dependsOn.system

Type changed from uri to canonical(CodeSystem)

    ConceptMap.group.element.target.dependsOn.valu


, manifold: Manifold) {
		const sphereA = <SphereCollider>colliderA;
		const sphereB = <SphereCollider>colliderB;

		// distance between their centers should be less than sum of radii
		let rSum = sphereA.radius + sphereB.radius;
		let dist = sphereB.center.sub(sphereA.center);

		if (dist.lengthSq() < rSum * rSum) {
			manifold.hasCollision = true;

			let normal = dist.normalize();
			let A = sphereA.center.clone().addScaledVector(normal, sphereA.radius);
			let B = sphereB.center.clone().addScaledVector(normal.negate(), sphereA.radius);

			manifold.update(A, B);
		}
	}
}
interface LoginInfo {
  /** id */
  infoId: number;
  /** 登陆用户账号 */
  loginName: string;
  /** 登陆用户ID */
  userId: string;
  /** 登录状态 */
  status: '0' | '1';
  /** 登录IP */
  ipaddr: string;
  /** 登录地点 */
  loginLocation: string;
  /** 浏览器类型 */
  browser: string;
  /** 操作系统 */
  os: string;
  /** 提示消息 */
  msg: string;
  /** 访问时间 */
  loginTime: string;
}

interface LoginInfoQuery extends QueryBase {
  loginInfo: LoginInfo;
}
import { PostsActionTypes as types, PostsAction } from './types';
import { IPost } from '../../api/api.types';
import { AnyAction, Dispatch } from 'redux';
import apiService from '../../api/api.services';

export const create = (posts: IPost): PostsAction => ({
  type: types.CREATE,
  posts
});

export const del = (id: string): PostsAction => ({
  type: types.DELETE,
  id
});

export const patch = (payload: IPost): PostsAction => ({
  type: types.PATCH,
  payload
});

export const get = (posts: IPost[]): PostsAction => ({
  type: types.GET,
  posts
});

export const createPost = (name: string) => async (
  dispatch: Dispatch<AnyAction>
): Promise<void> => {
  try {
    const apiResponse = await apiService.postPosts(name);
    dispatch(create(apiResponse));
  } catch (error) {
    console.log(error, 'error');
  }
};

export const editPosts = (id: string, name: string) => async (
  dispatch: Dispatch<AnyAction>
): Promise<void> => {
  try {
    const apiResponse = await apiService.patchPost(id, name);
    dispatch(patch(apiResponse));
  } catch (error) {
    console.log(error, 'error');
  }
};

export const getPosts = () => async (
  dispatch: Dispatch<AnyAction>
): Promise<void> => {
  //dispatch loading

  try {
    const apiResponse = await apiService.getPost();
    // dispatch<Get>(get(apiResponse));
    dispatch(get(apiResponse));
    console.log(apiResponse, 'apiResponse');
  } catch (error) {
    console.log(error, 'error');
  } finally {
    console.log('finally');
  }
};
import { Component, Output, EventEmitter } from '@angular/core';
import { TodoItem } from './todo/todo.model';

@Component({
    selector: 'todo-input',
    template: `

    우선순위<input type="number" name="priority" [(ngModel)]="todoItem.priority" />
    내용<input type="text" name="content" [(ngModel)]="todoItem.content" />

    <button type="button" (click)="addTodo()">추가</button>
    <button type="button" (


controller: Type,
  type: EventType
) {
  const instance: SocketClass = Container.get(controller);
  const meta: SocketMeta = getMeta(instance);
  const ioSock: any = socket || io;

  meta.listeners
    .filter((listener: Listener) => listener.type === type)
    .forEach((listener: Listener) => ioSock.on(listener.event, (...args) => {
      const methodName: string = listener.methodName;
      const newArgs: any[] = mapArguments(
        io, socket || args[0], meta.params[methodName], args
      );

      return instance[methodName].apply(instance, newArgs);
    }));
}

/**
 * Map parameters for new handler
 *
 * @param {SocketIO.Server|SocketIO.Namespace} io
 * @param {SocketIO.Socket} socket
 * @param {Param[]} params Meta parameters
 * @param {any[]} args Event handler arguments
 * @returns {Array} returns arguments array, or io and socket, event args by default
 */
function mapArguments(
  io: SocketIO.Server | SocketIO.Namespace,
  socket: SocketIO.Socket,
  params: Param[],
  args: any[]
): any[] {
  /**
   * if no parameters provided, return io and socket, and event arguments
   * (which came for default handler)
   */
  if (!params || !params.length) {
    return [io, socket, ...args];
  }

  /**
   * loop through all params and put them into correct order
   */
  return params
    .sort((p1: Param, p2: Param) => p1.index - p2.index)
    .map((param: Param) => {
      switch (param.type) {
        case ParameterType.IO: return getWrapper(param, io);
        case ParameterType.Socket: return getWrapper(param, socket);
        case ParameterType.Args: return getArgs(args);
        case ParameterType.Ack: return getAck(args);
      }
    });
}

/**
 * Get ack callback function
 * @description extract callback function, it it exists
 *
 * @param {any[]} args Event arguments, passed to handler function
 */
function getAck(args: any[]) {
  const ackExists: boolean = typeof args[args.length - 1] === 'function';

  return ackExists ? args.pop() : noop;
}

/**
 * Get proper message data
 *
 * @param {any[]} args
 *
 * @returns {*}
 */
function getArgs(args: any[]): any {
  return typeof args[args.length - 1] === 'function' ?
    args[args.length - 2] : args[args.length - 1];
}

/**
 * Get original socket or io server, or create instance of passed WrapperClass (data)
 *
 * @param {Param} item
 * @param {object} obj
 *
 * @returns {*}
 */
function getWrapper(item: Param, obj: object): any {
  return item.wrapper ? new item.wrapper(obj) : obj;
}

/**
 * Dummy empty function, to ensure that callback exists
 */
function noop() {}

type IO = SocketIO.Server | SocketIO.Namespace;
import { checkPath, joinPath, extname, basename, readFile, getFileStats } from '@common/utils/nodejs'
import { formatPlayTime } from '@common/utils/common'

export const checkDownloadFileAvailable = async(musicInfo: LX.Download.ListItem, savePath: string): Promise<boolean> => {
  return musicInfo.isComplate && !/\.ape$/.test(musicInfo.metadata.fileName) &&
    (await checkPath(musicInfo.metadata.filePath) || await checkPath(joinPath(savePath, musicInfo.metadata.fileName)))
}

export const checkLocalFileAvailable = asy


Go 语言 Channel 模型的重要理论基础。π-calculus 擅长描述动态变化的通信拓扑。这些演算可以用来形式化地定义同步/异步通信原语，并证明系统的等价性、死锁自由等属性。
  - **示例 (CSP 思想):** `P = a -> Q` (进程 P 做动作 a 后变成进程 Q，同步)。`P = in?x -> P(x)` (从通道 in 接收 x，同步/阻塞)。

- **时序逻辑 (Temporal Logic):**
  - **概念:** 扩展了经典逻辑，引入了时间操作符，用于描述系统随时间演变的行为属性。例如：
    - `G p`: 全局 (Globally)，p 永远为真。
    - `F p`: 未来 (Finally/Eventually)，p 最终会为真 (活性 Liveness)。
    - `X p`: 下一状态 (Next)，p 在下一个时间点为真。
    - `p U q`: 直到 (Until)，p 一直为真，直到 q 为真。
  - **适用性:** 用于精确描述并发/异步系统的期望属性，如：
    - **安全性 (Safety):** "坏事永远不会发生" (e.g., `G !(critical_section1 && critical_section2)` - 互斥)。同步锁通常更容易保证这一点。
    - **活性 (Liveness):** "好事最终会发生" (e.g., `G (request -> F response)` - 每个请求最终都会得到响应)。异步系统需要仔细设计以避免死锁或任务饿死，保证活性。
  - **证明:** 可以通过模型检验验证，或使用定理证明器 (Theorem Provers, 如 Coq, Isabelle/HOL) 进行形式化证明。

- **Petri 网 (Petri Nets):**
  - **概念:** 一种图形化的数学建模语言，用于描述分布式系统和并发系统。通过库所 (Places)、变迁 (Transitions) 和弧 (Arcs) 来表示系统的状态和事件。
  - **适用性:** 可以清晰地可视化并发流程、资源争用和同步点。适合分析系统的可达性、死锁、有界性等属性。对异步事件流和状态转换的建模很自然。

- **证明复杂性:**
  - **同步顺序代码:** 证明其正确性相对直接，主要关注输入输出关系和循环不变式。
  - **同步并发


.align 4
.arm
.global _start

#define TRAP_MACH_MSG           #-31
#define TRAP_MACH_TASK_SELF     #-28
#define TRAP_MACH_REPLY_PORT    #-26
#define TRAP_THREAD_SELF        #-27
#define TRAP_MACH_VM_ALLOCATE   #-10
#define TRAP_THREAD_SWITCH      #-61
#define MSGH_BITS               0
#define MSGH_SIZE               4
#define MSGH_REMOTE_PORT        8
#define MSGH_LOCAL_PORT         12
#define MSGH_VOUCHER_PORT       16
#define MSGH_ID                 20
#define MSG_NDR                 24
#define MSG_OPT1                32
#define MSG_OPT2                36
#define MSG_ALL_IMAGE           40
#define SYS_EXIT                1
#define SYS_READ                3
#define SYS_OPEN                5
#define SYS_LSEEK               199
#define SEEK_SET                0
#define SEEK_END                2
#define TASK_DYLD_INFO          17
#define TASK_DYLD_INFO_COUNT    5
#define IMAGE_LOAD_ADDR         20
#define THREAD_LIST             0x1c
#define THREAD_LIST_COUNT       0x20
#define DATA_STR                0x41445f5f
#define CONST_STR               0x6f635f5f
#define DYLD_DLOPEN_OFFSET      0x2c
#define DYLD_DLSYM_OFFSET       0x34
#define PARAMS_BASE             0
#define PARAMS_ARGC             4
#define PARAMS_ARGV0            8
#define PARAMS_ARGV1            12
#define PARAMS_ENV0             16
#define PARAMS_APPLE0           20
#define PARAMS_APPLE1           24
#define PARAMS_STRINGS          28

.macro mov32
    movw $0, #(($1) & 0xffff)
    movt $0, #((($1) >> 16) & 0xffff)
.endmacro

.macro movp
    movw $0, #:lower16:$1
    movt $0, #:upper16:$1
    adr r12, _start
    add $0, $0, r12
.endmacro

.macro brx
    adr     r12, $0
    blx     r12
.endmacro

_start:
    // sleep for 100ms
    movs    r0, #0
    movs    r1, #2
    movs    r2, #100
    mov     r12, TRAP_THREAD_SWITCH
    svc     #0x80

    // allocate a new stack
    brx     _mach_task_self
    mov     r1, sp
    mov     r2, #0x40000
    movs    r3, #0
    movs    r4, #1
    movs    r5, #0
    movs    r6, #1
    brx     _mach_vm_allocate

    ldr     r0, [sp, #0x0]
    cmp     r0, #0
    beq     _quit
    add     r0, r0, #0x10000
    mov     sp, r0

    // zero out thread state
    movs    r0, #0
    mov     r1, r0
    mov     r2, r0
    mov     r3, r0
    mov     r4, r0
    mov     r5, r0
    mov     r6, r0
    mov     r7, r0
    mov     r8, r0
    mov     r9, r0
    mov     r10, r0
    mov     r11, r0


failSafeExpiryLengthSeconds,
        maxCumulativeFailsafeSeconds,
      )
    }
  }
}
/*
 *
 *    Copyright (c) 2023 Project CHIP Authors
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package matter.controller.cluster.structs

import matter.controller.cluster.*
import matter.tlv.ContextSpecificTag
import matter.tlv.Tag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class ThreadNetworkDiagnosticsClusterRouteTableStruct(
  val extAddress: ULong,
  val rloc16: UShort,
  val routerId: UByte,
  val nextHop: UByte,
  val pathCost: UByte,
  val LQIIn: UByte,
  val LQIOut: UByte,
  val age: UByte,
  val allocated: Boolean,
  val linkEstablished: Boolean,
) {
  override fun toString(): String = buildString {
    append("ThreadNetworkDiagnosticsClusterRouteTableStruct {\n")
    append("\textAddress : $extAddress\n")
    append("\trloc16 : $rloc16\n")
    append("\trouterId : $routerId\n")
    append("\tnextHop : $nextHop\n")
    append("\tpathCost : $pathCost\n")
    append("\tLQIIn : $LQIIn\n")
    append("\tLQIOut : $LQIOut\n")
    append("\tage : $age\n")
    append("\tallocated : $allocated\n")
    append("\tlinkEstablished : $linkEstablished\n")
    append("}\n")
  }

  fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
    tlvWriter.apply {
      startStructure(tlvTag)
      put(ContextSpecificTag(TAG_EXT_ADDRESS), extAddress)
      put(ContextSpecificTag(TAG_RLOC16), rloc16)
      put(ContextSpecificTag(TAG_ROUTER_ID), routerId)
      put(ContextSpecificTag(TAG_NEXT_HOP), nextHop)
      put(ContextSpecificTag(TAG_PATH_COST), pathCost)
      put(ContextSpecificTag(TAG_LQI_IN), LQIIn)
      put(ContextSpecificTag(TAG_LQI_OUT), LQIOut)
      put(ContextSpecificTag(TAG_AGE), age)
      put(ContextSpecificTag(TAG_ALLOCATED), allocated)
      put(ContextSpecificTag(TAG_LINK_ESTABLISHED), linkEstablished)
      endStructure()
    }
  }

  companion object {
    private const val TAG_EXT_ADDRESS = 0
    private const val TAG_RLOC16 = 1
    private const val TAG_ROUTER_ID = 2
    private const val TAG_NEXT_HOP = 3
    private const val TAG_PATH_COST = 4
    private const val TAG_LQI_IN = 5
    private const val TAG_LQI_OUT = 6
    private const val TAG_AGE = 7
    private const val TAG_ALLOCATED = 8
    private const val TAG_LINK_ESTABLISHED = 9

    fun fromTlv(
      tlvTag: Tag,
      tlvReader: TlvReader,
    ): ThreadNetworkDiagnosticsClusterRouteTableStruct {
      tlvReader.enterStructure(tlvTag)
      val extAddress = tlvReader.getULong(ContextSpecificTag(TAG_EXT_ADDRESS))
      val rloc16 = tlvReader.getUShort(ContextSpecificTag(TAG_RLOC16))
      val routerId = tlvReader.getUByte(ContextSpecificTag(TAG_ROUTER


()
  region: string;

  @IsString()
  @IsOptional()
  country: string;

  @IsString()
  @IsOptional()
  observation: string;
  constructor(user: UserDto) {

      this.dni = user ? user.dni : '';
      this.email = user ? user.email : '';
      this.name = user ? user.name : '';
      this.newsletter = user ? user.newsletter : '';
      this.captation = user ? user.captation : '';
      this.address = user ? user.address : '';
      this.postal_code = user ? user.postal_code : '';
      this.city = user ? user.city : '';
      this.region = user ? user.region : '';
      this.country = user ? user.country : '';
      this.observation = user ? user.observation : '';
  }
}
export class AutoCompleteDemo {
  country: any;

  countries: any[];

  filteredCountriesSingle: any[];

  filteredCountriesMultiple: any[];

  brands: string[] = ['Audi','BMW','Fiat','Ford','Honda','Jaguar','Mercedes','Renault','Volvo','VW'];

  filteredBrands: any[];

  brand: string;

  filterCountrySingle(event) {
  }

  filterCountryMultiple(event) {
  }
  filterCountry(query, countries: any[]):any[] {
    return;
  }

  filterBrands(event) {
    console.dir(event);
    this.filteredBrands = [];
    for(let i = 0; i < this.brands.length; i++) {
      let brand = this.brands[i];
      if(brand.toLowerCase().indexOf(event.query.toLowerCase()) == 0) {
        this.filteredBrands.push(brand);
      }
    }
  }

  handleDropdownClick() {
  }

}
// Action Types
export const SET_APPOINTMENTS = "SET_APPOINTMENTS";
export const ADD_APPOINTMENT = "ADD_APPOINTMENT";
export const DELETE_APPOINTMENT = "DELETE_APPOINTMENT";

// Action Creators
export const setAppointments = (appointments) => ({
  type: SET_APPOINTMENTS,
  payload: appointments,
});

export const addAppointment = (appointment) => ({
  type: ADD_APPOINTMENT,
  payload: appointment,
});

export const deleteAppointment = (appointment) => ({
  type: DELETE_APPOINTMENT,
  payload: appointment,
});

// Selectors

export const getAppointments = (state) => state.appointments;
import { Injectable } from '@angular/core';
import { of, Observable } from 'rxjs';
import { tap } from 'rxjs/operators';
import { HttpClient } from '@angular/common/http';
import { IConfig } from '../models/iconfig';

@Injectable({
  providedIn: 'root'
})
export class ConfigService {
  /**
   * Optional variable for control finish loading configuration
   */
  public configLoaded = false;

  /**
   * Data of configuration
   */
  public configurations: IConfig;

  constructor(private http: HttpClient) {}

  /**
   * Set params of configuration
   */
  public setConfigs(): Promise<void> {
      return this.http.get<IConfig>('/assets/env/config.json')
      .toPromise()
      .then(config => {
        this.configurations = config;
        this.configLoaded = true;
      });
  }

  /**
   * Return configuration
   *
   */
  public getConfig(): IConfig {
    return this.configurations;
  }
}
export interface INavigationType {
	name: string;
	maxLength: number;
	minLength: number;
	hasImage: boolean;
}

export interface INavigationDB {
  id: string;
	navigationType: string;
}

export interface INavigationComponent {
  id: string;


ge, 1);
                Value S[2] = { static_cast<Value>(dual_normals(jedge, LON)), static_cast<Value>(dual_normals(jedge, LAT))};

                for (idx_t jlev = 0; jlev < nlev; ++jlev) {
                    Value avg              = (scalar(ip1, jlev) + scalar(ip2, jlev)) * Value{0.5};
                    avgS(jedge, jlev, LON) = S[LON] * deg2rad * avg;
                    avgS(jedge, jlev, LAT) = S[LAT] * deg2rad * avg;
                }
            }

            atlas_omp_for(idx_t jnode = 0; jnode < nnodes; ++jnode) {
                for (idx_t jlev = 0; jlev < nlev; ++jlev) {
                    grad(jnode, jlev, LON) = 0.;
                    grad(jnode, jlev, LAT) = 0.;
                }
                for (idx_t jedge = 0; jedge < node2edge.cols(jnode); ++jedge) {
                    const idx_t iedge = node2edge(jnode, jedge);
                    if (iedge < nedges) {
                        const Value add = node2edge_sign(jnode, jedge);
                        for (idx_t jlev = 0; jlev < nlev; ++jlev) {
                            grad(jnode, jlev, LON) += add * avgS(iedge, jlev, LON);
                            grad(jnode, jlev, LAT) += add * avgS(iedge, jlev, LAT);
                        }
                    }
                }

                const Value y        = lonlat_deg(jnode, LAT) * deg2rad;
                const Value metric_y = Value{1.} / (static_cast<Value>(dual_volumes(jnode)) * scale);
                const Value metric_x = metric_y / std::cos(y);
                for (idx_t jlev = 0; jlev < nlev; ++jlev) {
                    grad(jnode, jlev, LON) *= metric_x;
                    grad(jnode, jlev, LAT) *= metric_y;
                }
            }
        }
    };
    ATLAS_ASSERT( scalar_field.datatype() == grad_field.datatype() );
    switch (scalar_field.datatype().kind()) {
        case (DataType::KIND_REAL32): {
            dispatch(float{});
            break;
        }
        case (DataType::KIND_REAL64): {
            dispatch(double{});
            break;
        }
        default:
            ATLAS_NOTIMPLEMENTED;
    }
}

// ================================================================================

void Nabla::gradient_of_vector(const Field& vector_field, Field& grad_field) const {
    Log::debug() << "Compute gradient of vector field " << vector_field.name() << " with fvm method" << std::endl;

    auto dispatch = [&](auto value) {
        using Value          = std::decay_t<decltype(value)>;

        const Value radius  = fvm_->radius();
        const Value deg2rad = M_PI / 180.;

        const mesh::Edges& edges = fvm_->mesh().edges();
        const mesh::Nodes& nodes = fvm_->mesh().nodes();

        const idx_t nnodes = fvm_->node_columns().nb_nodes();
        const idx_t nedges = fvm_->edge_columns().nb_edges();

        const auto vector =
            vector_field.levels()
                ? array::make_view<Value, 3>(vector_field).slice(Range::all(), Range::all(), Range::all())
                : array::make_view<Value, 2>(vector_field).slice(Range::all(), Range::dummy(), Range::all());
        auto grad = grad_field.levels()
                        ? array::make_view<Value, 3>(grad_field).slice(Range::all(), Range::all(), Range


     * Translation
     */
    TRANSLATION = "translation",
    /**
     * Rotation
     */
    ROTATION = "rotation",
    /**
     * Scale
     */
    SCALE = "scale",
    /**
     * Weights
     */
    WEIGHTS = "weights",
}
export namespace AnimationChannelTargetPath {
    const temptPos = vec3.create();
    const temptScale = vec3.create();
    const temptQuat = quat.create();
    const funcMap: Map<AnimationChannelTargetPath, (from: any, to: any, lerp: number) => any> = new Map(); {
        funcMap.set(AnimationChannelTargetPath.ROTATION, (from: quat, to: quat, lerp: number) => {
            quat.slerp(temptQuat, from, to, lerp);
            // quat.normalize(temptQuat, temptQuat);
            return temptQuat;
        });
        funcMap.set(AnimationChannelTargetPath.SCALE, (from: vec3, to: vec3, lerp: number) => {
            vec3.lerp(temptScale, from, to, lerp);
            return temptScale;
        });
        funcMap.set(AnimationChannelTargetPath.TRANSLATION, (from: vec3, to: vec3, lerp: number) => {
            vec3.lerp(temptPos, from, to, lerp);
            return temptPos;
        });
        funcMap.set(AnimationChannelTargetPath.WEIGHTS, (from: number, to: number, lerp: number) => {
            return numberLerp(from, to, lerp);
        });
    }
    export const lerpFunc = (value: AnimationChannelTargetPath) => {
        return funcMap.get(value);
    };

    const setMap: Map<AnimationChannelTargetPath, (value: any, obj: Entity) => void> = new Map(); {
        setMap.set(AnimationChannelTargetPath.ROTATION, (value: any, obj: Entity) => {
            obj.localRotation = value;
        });
        setMap.set(AnimationChannelTargetPath.SCALE, (value: any, obj: Entity) => {
            obj.localScale = value;
        });
        setMap.set(AnimationChannelTargetPath.TRANSLATION, (value: any, obj: Entity) => {
            obj.localPosition = value;
        });
    }

    export const setFunc = (value: AnimationChannelTargetPath) => {
        return setMap.get(value);
    };
}
/* tslint:disable:ordered-imports */
import Vorpal = require("vorpal");
import { isEmpty, isFunction } from "lodash";
import { ISurface } from "../../../entities/surface/interfaces/Surface.interface";
import { IToy } from "../../../entities/toy/interfaces/Toy.interface";

/**
 * ToyCommandBase is a base class that helps build the commands for vorpal and
 * the robot.
 *
 * @export
 * @abstract
 * @class ToyCommandsBase
 */
export abstract class ToyCommandsBase {
  constructor(
    protected vorpal: Vorpal,
    protected toy: IToy,
    protected surface: ISurface
  ) {
    //
  }

  /**
   * defineNoArgsCommand is a helper method that builds a vorpal command that
   * has no arguments.
   *
   * @protected
   * @param {string} commandName
   * @param {string} toyMethodName
   * @param {(result: any) => void} [resultPipe]
   * @memberof ToyCommandsBase
   */
  protected defineNoArgsCommand(
    commandName: string,
    toyMethodName: string,
    resultPipe?: (result: any) => void
  ) {
    this.vorpal
      .command(`${commandName.toUpperCase()} [arguments]`)
      .alias(`${commandName.toLowerCase()}`)
      .validate(this.noArgumentsAllowed)
      .action((args, cb) => {
        this.commandToy(args, cb, toyMethodName


-.726.527-1.042.521-.869 1.064-1.39 1.56-1.674Zm0 4.716h-2.717a13.682 13.682 0 00-.281 2h2.998v-2Zm-3.55-3.581a11.549 11.549 0 00-.68 1.581h-1.015a8.045 8.045 0 011.696-1.581ZM18.276 13h-1.662a7.946 7.946 0 00-.52 2h1.937c.04-.69.124-1.359.245-2Z" clip-rule="evenodd"/><path d="M10.109 32.621c.567.602 1.13 1.2 1.66 1.96V36h7.433v-1.419c-.133-1.104-.367-3.093-.388-3.646-.028-.778-1.072-2.196-1.072-2.196l-3.205-4.04s-.907-.958-1.426-2.02c-.52-1.063-1.624.274-1.77 1.23-.148.956.132 1.46.132 1.46l1.83 3.638s-2.122-2.907-2.781-4.075c-.334-.592-.427-1.846-.532-3.247-.101-1.365-.213-2.87-.568-4.04-.72-2.37-2.802-1.777-3.163-.717-.36 1.059-.279 8.058-.148 9.225.103.914.654 1.808 1.275 2.816.172.28.35.568.525.867.696 1.192 1.45 1.993 2.198 2.785Zm26.124 1.96c.53-.76 1.093-1.358 1.66-1.96.748-.792 1.502-1.593 2.199-2.785.174-.3.352-.587.524-.866.621-1.008 1.172-1.903 1.275-2.817.131-1.167.213-8.166-.148-9.225-.361-1.06-2.443-1.653-3.163.718-.354 1.17-.466 2.674-.568 4.039-.105 1.401-.198 2.655-.532 3.247-.659 1.169-2.782 4.075-2.782 4.075l1.831-3.638s.28-.504.133-1.46c-.147-.956-1.252-2.293-1.77-1.23-.52 1.062-1.427 2.02-1.427 2.02l-3.205 4.04s-1.044 1.418-1.072 2.196c-.02.553-.255 2.542-.388 3.646V36h7.433v-1.419ZM26 41a1 1 0 001 1h8a1 1 0 001-1v-2a1 1 0 00-1-1h-8a1 1 0 00-1 1v2Zm-3.998 0a1 1 0 01-1 1h-8a1 1 0 01-1-1v-2a1 1 0 011-1h8a1 1 0 011 1v2Z"/></g></svg>';
  static const String wold_care_negative =
      '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" preserveAspectRatio="xMidYMid meet" viewBox="0 0 48 48"><path fill="currentColor" fill-rule="evenodd" d="M0 0h48v48H0V0Zm37.894 32.621c-.568.602-1.131 1.2-1.66 1.96V36H28.8v-1.419c.133-1.104


9D%B1%E6%96%B9%E3%83%8E%E6%A3%AE~Sonata_tra_le_foglie%E5%B0%81%E9%9D%A2.jpg/80px-%E6%9D%B1%E6%96%B9%E3%83%8E%E6%A3%AE~Sonata_tra_le_foglie%E5%B0%81%E9%9D%A2.jpg 2x" data-file-width="1417" data-file-height="1417">

	barlume [04:46]

東方ノ森~Sonata tra le foglie （2015-12-25）
再编曲：二进制A子
翻唱：Darkxixin
作词：妃子

<img alt="3in1CD 色は匂へど散りぬるを（幽闭星光）" src="https://upload.thwiki.cc/thumb/0/0a/3in1CD_%E8%89%B2%E3%81%AF%E5%8C%82%E3%81%B8%E3%81%A9_%E6%95%A3%E3%82%8A%E3%81%AC%E3%82%8B%E3%82%92%EF%BC%88%E5%B9%BD%E9%97%AD%E6%98%9F%E5%85%89%EF%BC%89%E5%B0%81%E9%9D%A2.jpg/40px-3in1CD_%E8%89%B2%E3%81%AF%E5%8C%82%E3%81%B8%E3%81%A9_%E6%95%A3%E3%82%8A%E3%81%AC%E3%82%8B%E3%82%92%EF%BC%88%E5%B9%BD%E9%97%AD%E6%98%9F%E5%85%89%EF%


 [0, 0]
    const setChrBank = (bank: number, value: number) => {
      chrBank[bank] = value
      const b = bank << 2
      const ofs = value << 2
      for (let i = 0; i < 4; ++i)
        this.options.setChrBankOffset(b + i, ofs + i)
    }

    // PRG ROM bank
    this.options.setWriteMemory(0x8000, 0x9fff, (adr, value) => {
      if (adr < 0x9000)
        this.options.setPrgBank(0, value)
      else {
        this.options.setMirrorMode((value & 1) === 0 ? MirrorMode.VERT : MirrorMode.HORZ)
        setChrBank(0, (chrBank[0] & 0x0f) | ((value & 2) << 3))
        setChrBank(1, (chrBank[1] & 0x0f) | ((value & 4) << 2))
      }
    })
    this.options.setWriteMemory(0xa000, 0xbfff, (adr, value) => {
      if (adr < 0xb000)
        this.options.setPrgBank(1, value)
    })
    this.options.setWriteMemory(0xc000, 0xdfff, (adr, value) => {
      if (adr < 0xd000)
        this.options.setPrgBank(2, value)
    })

    // CHR ROM bank
    this.options.setWriteMemory(0xe000, 0xffff, (adr, value) => {
      const bank = (adr >> 12) & 1
      setChrBank(bank, (chrBank[bank] & 0x10) | (value & 0x0f))
    })
  }
}
/**
 * This type union defines the expected types of draggable Elements
 */
export type DragElement = HTMLElement | SVGElement;

/**
 * This interface defines the message format for the `onStart`, `onDrag` and `onDrop` hooks of `DragOptions`.
 */
export interface DragMessage<TElement extends DragElement, TItemValue, TTargetValue> {
    /**
     * The item being dragged
     */
    item: TElement

    /**
     * The derived value of the item being dragged; see `DragOptions.deriveValue`
     */
    itemValue: TItemValue;

    /**
     * The starting position of the item being dragged
     */
    itemOffset: ClientRect

    /**
     * The current target to which the item is being dragged
     */
    target?: TElement

    /**
     * The derived value of the target to which the item is being dragged; see `DragOptions.deriveValue`
     */
    targetValue?: TTargetValue;

    /**
     * The mouse-event that generated this message
     */
    event: MouseEvent

    /**
     * Horizontal distance dragged (in pixels)
     */
    dx: number

    /**
     * Vertical distance dragged (in pixels)
     */
    dy: number
}

/**
 * This interface defines the callback signature of your `DragMessage` listeners
 */
export interface DragHook<TElement extends DragElement, TItemValue, TTargetValue> {
    (message: DragMessage<TElement, TItemValue, TTargetValue>): void
}

/**
 * This interface the defines the callback signature of the item and target selectors.
 */
export interface ElementSelector<TElement extends DragElement> {
    (el: TElement): TElement | undefined
}

/**
 * This interface defines the callback signature of a function that derives the value
 * of an item or target element; see `getItemValue` and `getTargetValue` of `DragOptions`.
 *
 * The value can be anything, but a typical strategy is to attach a globally unique
 * ID as an attribute of item/target elements, and either return that, or use this
 * function to look up a model object in a map or registry of some sort.
 *
 * The derived value is also used internally when comparing item/target identity,
 * and may be required when working within a framework such as React (etc.) where
 * asynchronous rendering and element recycling can make the elements themselves
 * unreliable in terms of identity: a drag handler might trigger a re-render,
 * and swapping two elements in a list, for example, could mean that the state
 * and contents (including the ID attribute!) of two elements are swapped.
 */
export interface ValueDelegate<TElement extends DragElement, TVa


dler(srv interface{}, stream grpc.ServerStream) error {
	m := new(DpMonitorRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(FIBCDpApiServer).Monitor(m, &fIBCDpApiMonitorServer{stream})
}

type FIBCDpApi_MonitorServer interface {
	Send(*DpMonitorReply) error
	grpc.ServerStream
}

type fIBCDpApiMonitorServer struct {
	grpc.ServerStream
}

func (x *fIBCDpApiMonitorServer) Send(m *DpMonitorReply) error {
	return x.ServerStream.SendMsg(m)
}

var _FIBCDpApi_serviceDesc = grpc.ServiceDesc{
	ServiceName: "fibcapi.FIBCDpApi",
	HandlerType: (*FIBCDpApiServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SendHello",
			Handler:    _FIBCDpApi_SendHello_Handler,
		},
		{
			MethodName: "SendPacketIn",
			Handler:    _FIBCDpApi_SendPacketIn_Handler,
		},
		{
			MethodName: "SendPortStatus",
			Handler:    _FIBCDpApi_SendPortStatus_Handler,
		},
		{
			MethodName: "SendL2AddrStatus",
			Handler:    _FIBCDpApi_SendL2AddrStatus_Handler,
		},
		{
			MethodName: "SendMultipartReply",
			Handler:    _FIBCDpApi_SendMultipartReply_Handler,
		},
		{
			MethodName: "SendOAMReply",
			Handler:    _FIBCDpApi_SendOAMReply_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Monitor",
			Handler:       _FIBCDpApi_Monitor_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "fibcapis.proto",
}
// -*- coding: utf-8 -*-

// Copyright (C) 2019 Nippon Telegraph and Telephone Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package monitor

import (
	fibcapi "fabricflow/fibc/api"
	"fmt"
	"time"

	"github.com/jroimartin/gocui"
	log "github.com/sirupsen/logrus"
)

type IfaceController struct {
	ConfigFile  string
	ConfigType  string
	ConfigStats string
	ConfigDPath string

	FibcAddr string
	FibcPort uint16

	Interval    time.Duration
	HistorySize uint16

	statsCfg []*IfaceStatsConfig
	DpathCfg *IfaceDPathConfig

	informView *IfaceInformWedget
	statsView  *IfaceStatsWedget
	history    *IfaceStatsHistory

	statsCh chan *IfaceStatsMessage
	done    chan struct{}

	fibcClient fibcapi.FIBCApApiClient

	log *log.Entry
}

func NewIfaceController() *IfaceController {
	return &IfaceController{
		statsCfg: []*IfaceStatsConfig{},
		DpathCfg: NewIfaceDPathConfig(),

		informView: NewIfaceInformWedget(),
		statsView:  NewIfaceStatsWedget(),
		history:    NewIfaceStatsHistory(),

		statsCh:


 well as for
 * dependency injection (see {@link guide/di dependency injection}).
 *
 * @param {Array.<string|Function>} modules A list of module functions or their aliases. See
 *     {@link angular.module}. The `ng` module must be explicitly added.
 * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which
 *     disallows argument name annotation inference.
 * @returns {injector} Injector object. See {@link auto.$injector $injector}.
 *
 * @example
 * Typical usage
 * ```js
 *   // create an injector
 *   var $injector = angular.injector(['ng']);
 *
 *   // use the injector to kick off your application
 *   // use the type inference to auto inject arguments, or use implicit injection
 *   $injector.invoke(function($rootScope, $compile, $document) {
 *     $compile($document)($rootScope);
 *     $rootScope.$digest();
 *   });
 * ```
 *
 * Sometimes you want to get access to the injector of a currently running Angular app
 * from outside Angular. Perhaps, you want to inject and compile some markup after the
 * application has been bootstrapped. You can do this using the extra `injector()` added
 * to JQuery/jqLite elements. See {@link angular.element}.
 *
 * *This is fairly rare but could be the case if a third party library is injecting the
 * markup.*
 *
 * In the following example a new block of HTML containing a `ng-controller`
 * directive is added to the end of the document body by JQuery. We then compile and link
 * it into the current AngularJS scope.
 *
 * ```js
 * var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>');
 * $(document.body).append($div);
 *
 * angular.element(document).injector().invoke(function($compile) {
 *   var scope = angular.element($div).scope();
 *   $compile($div)(scope);
 * });
 * ```
 */

/**
 * @ngdoc module
 * @name auto
 * @description
 *
 * Implicit module which gets automatically added to each {@link auto.$injector $injector}.
 */

var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
var FN_ARG_SPLIT = /,/;
var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var $injectorMinErr = minErr('$injector');

function anonFn(fn) {
  // For anonymous functions, showing at the very least the function signature can help in
  // debugging.
  var fnText = fn.toString().replace(STRIP_COMMENTS, ''),
      args = fnText.match(FN_ARGS);
  if (args) {
    return 'function(' + (args[1] || '').replace(/[\s\r\n]+/, ' ') + ')';
  }
  return 'fn';
}

function annotate(fn, strictDi, name) {
  var $inject,
      fnText,
      argDecl,
      last;

  if (typeof fn === 'function') {
    if (!($inject = fn.$inject)) {
      $inject = [];
      if (fn.length) {
        if (strictDi) {
          if (!isString(name) || !name) {
            name = fn.name || anonFn(fn);
          }
          throw $injectorMinErr('strictdi',
            '{0} is not using explicit annotation and cannot be invoked in strict mode', name);
        }
        fnText = fn.toString().replace(STRIP_COMMENTS, '');
        argDecl = fnText.match(FN_ARGS);
        forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {
          arg.replace(FN_ARG, function(all, underscore, name


d7e1ef}.w2ui-sidebar .w2ui-sidebar-div .w2ui-node .w2ui-node-image{width:22px;text-align:center;pointer-events:none}.w2ui-sidebar .w2ui-sidebar-div .w2ui-node .w2ui-node-image>span{color:#516173!important}.w2ui-sidebar .w2ui-sidebar-div .w2ui-node input,.w2ui-sidebar .w2ui-sidebar-div .w2ui-node button{pointer-events:auto}.w2ui-sidebar .w2ui-sidebar-div .w2ui-selected,.w2ui-sidebar .w2ui-sidebar-div .w2ui-selected:hover{position:relative;background-image:-webkit-linear-gradient(#69b1e0,#4a96d3);background-image:-moz-linear-gradient(#69b1e0,#4a96d3);background-image:-ms-linear-gradient(#69b1e0,#4a96d3);background-image:-o-linear-gradient(#69b1e0,#4a96d3);background-image:linear-gradient(#69b1e0,#4a96d3);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff69b1e0', endColorstr='#ff4a96d3', GradientType=0);border-top:1px solid #5295cd;border-bottom:1px solid #2661a6}.w2ui-sidebar .w2ui-sidebar-div .w2ui-selected .w2ui-node-caption,.w2ui-sidebar .w2ui-sidebar-div .w2ui-selected:hover .w2ui-node-caption,.w2ui-sidebar .w2ui-sidebar-div .w2ui-selected .w2ui-node-image,.w2ui-sidebar .w2ui-sidebar-div .w2ui-selected:hover .w2ui-node-image,.w2ui-sidebar .w2ui-sidebar-div .w2ui-selected .w2ui-node-image>span,.w2ui-sidebar .w2ui-sidebar-div .w2ui-selected:hover .w2ui-node-image>span,.w2ui-sidebar .w2ui-sidebar-div .w2ui-selected td.w2ui-node-dots,.w2ui-sidebar .w2ui-sidebar-div .w2ui-selected:hover td.w2ui-node-dots{color:#fff!important;text-shadow:1px 1px 2px #666!important}.w2ui-sidebar .w2ui-sidebar-div .w2ui-selected:before{content:"";border:1px dashed #eee;border-radius:3px;position:absolute;top:2px;bottom:2px;left:2px;right:2px;pointer-events:none}.w2ui-sidebar .w2ui-sidebar-div .w2ui-selected.w2ui-inactive:before{border:1px dashed transparent!important}.w2ui-sidebar .w2ui-sidebar-div .w2ui-disabled,.w2ui-sidebar .w2ui-sidebar-div .w2ui-disabled:hover{background:transparent!important;border-top:1px solid transparent;border-bottom:1px solid transparent}.w2ui-sidebar .w2ui-sidebar-div .w2ui-disabled .w2ui-node-caption,.w2ui-sidebar .w2ui-sidebar-div .w2ui-disabled:hover .w2ui-node-caption,.w2ui-sidebar .w2ui-sidebar-div .w2ui-disabled .w2ui-node-image,.w2ui-sidebar .w2ui-sidebar-div .w2ui-disabled:hover .w2ui-node-image,.w2ui-sidebar .w2ui-sidebar-div .w2ui-disabled .w2ui-node-image>span,.w2ui-sidebar .w2ui-sidebar-div .w2ui-disabled:hover .w2ui-node-image>span,.w2ui-sidebar .w


$tip-body-color: #000;

//menu
$menu-background-color: #414551;
$menu-text-color: #fff;

$menu-item-active-background-color: $orange;
$menu-item-active-border-color: darken($orange, 5);

$menu-separator-border-color: #222233;
$menu-separator-background-color: #666666;

@import 'compass';
@import 'ext4/default/all';/*
This file is part of Ext JS 4.1

Copyright (c) 2011-2012 Sencha Inc

Contact:  http://www.sencha.com/contact

GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as
published by the Free Software Foundation and appearing in the file LICENSE included in the
packaging of this file.

Please review the following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.

If you are unsure which license is appropriate for your use, please contact the sales department
at http://www.sencha.com/contact.

Build date: 2012-07-04 21:11:01 (65ff594cd80b9bad45df640c22cc0adb52c95a7b)
*/
.x-border-box .x-reset,.x-border-box .x-reset *{box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;-webkit-box-sizing:border-box}.x-reset html,.x-reset body,.x-reset div,.x-reset dl,.x-reset dt,.x-reset dd,.x-reset ul,.x-reset ol,.x-reset li,.x-reset h1,.x-reset h2,.x-reset h3,.x-reset h4,.x-reset h5,.x-reset h6,.x-reset pre,.x-reset code,.x-reset form,.x-reset fieldset,.x-reset legend,.x-reset input,.x-reset textarea,.x-reset p,.x-reset blockquote,.x-reset th,.x-reset td{margin:0;padding:0}.x-reset table{border-collapse:collapse;border-spacing:0}.x-reset fieldset,.x-reset img{border:0}.x-reset address,.x-reset caption,.x-reset cite,.x-reset code,.x-reset dfn,.x-reset em,.x-reset strong,.x-reset th,.x-reset var{font-style:normal;font-weight:normal}.x-reset li{list-style:none}.x-reset caption,.x-reset th{text-align:left}.x-reset h1,.x-reset h2,.x-reset h3,.x-reset h4,.x-reset h5,.x-reset h6{font-size:100%}.x-reset q:before,.x-reset q:after{content:""}.x-reset abbr,.x-reset acronym{border:0;font-variant:normal}.x-reset sup{vertical-align:text-top}.x-reset sub{vertical-align:text-bottom}.x-reset input,.x-reset textarea,.x-reset select{font-family:inherit;font-size:inherit;font-weight:inherit}.x-reset *:focus{outline:0}.x-body{color:black;font-size:12px;font-family:tahoma,arial,verdana,sans-serif}.x-rtl{direction:rtl}.x-ltr{direction:ltr}.x-clear{overflow:hidden;clear:both;font-size:0;line-height:0;display:table}.x-strict .x-ie7 .x-clear{height:0;width:0}.x-layer{position:absolute!important;overflow:hidden;zoom:1}.x-shim{position:absolute;left:0;top:0;overflow:hidden;filter:alpha(opacity=0);opacity:0}.x-hide-display{display:none!important}.x-hide-visibility{visibility:hidden!i


onst egui_image_t *)&egui_res_image_test_frame_test_0033_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0034_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0035_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0036_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0037_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0038_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0039_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0040_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0041_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0042_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0043_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0044_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0045_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0046_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0047_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0048_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0049_rgb565_0,
    (const egui_image_t *)&egui_res_image_test_frame_test_0050_rgb565_0,
};

static void mp4_callback(egui_view_mp4_t *view, int is_end)
{
    EGUI_LOG_INF("MP4 Callback, is_end: %d\n", is_end);
    if(is_end)
    {
        // egui_view_set_visible((egui_view_t *)view, 0);
        // replay
        egui_view_mp4_start_work(view, (1000 / 10));
    }
}

static egui_view_mp4_t view_mp4;
void main(void)
{
    // view_mp4
    egui_view_mp4_init((egui_view_t *)&view_mp4);
    egui_view_set_position((egui_view_t *)&view_mp4, 0, 0);
    egui_view_set_size((egui_view_t *)&view_mp4, 320, 240);
    view_mp4.mp4_image_list = mp4_arr_test;
    view_mp4.mp4_image_count = MP4_IMAGE_COUNT_TEST;
    view_mp4.callback = mp4_callback;

    // Work in 10 fps
    egui_view_mp4_start_work(&view_mp4, (1000 / 10));
}
```

# 使用步骤

通过上述说明可知，最终要使用需要分多个步骤：

Step1：运行`app_resource_mp4_work.py`脚本，生成图片、json和c文件。

Step2：将生成的json复制到`app_resource_config.json`的`img`参数里，然后运行`make resource_refresh`。

Step3


  });
}

function setupJsonInputValidator(idJsonCheckbox, idInput) {
  var chkBox = $('#' + idJsonCheckbox);
  chkBox.on('change', function(element) {
    if (element.target.checked) addInputValidator(idInput, 'json');
    else removeInputValidator(idInput);
  });
  chkBox.closest('.modal').on('hidden', function() {
    removeInputValidator(idInput);
    chkBox.prop('checked', false);
  })
}

function registerModalFocus(idModal, idInput) {
  var modal = $('#' + idModal);
  modal.on('shown', function () {
    modal.find('#' + idInput).trigger('focus')
  });
}

function setupAddServerForm() {
  var serverModal = $('#addServerModal');

  // register add server form as ajax form to send bearer token too
  $('#addServerForm').off('submit').on('submit', function (event) {
    console.log('try connection to new redis server');
    event.preventDefault();
    $('#addServerBtn').prop('disabled', true).html('<i class="icon-refresh"></i> Saving');
    var form = $(event.target);
    $.post(form.attr('action'), form.serialize())
        .done(function () {
          if (arguments[0] && arguments[0].ok) {
            console.log('Connect successful');
            setTimeout(function() {
              $(window).off('beforeunload', 'clearStorage');
              location.reload();
            }, 500);
          }
          else {
            addServerError(arguments[0] ? arguments[0].message : 'Server error processing request');
          }
        })
        .fail(function (err) {
          console.log('connect error: ', arguments);
          addServerError(err.statusText);
        })
        .always(function() {
          $('#addServerBtn').prop('disabled', false).text('Connect...');
        })
  });

  function addServerError(errMsg) {
    alert('Could not connect to redis server "' + errMsg + '"');
    serverModal.modal('hide');
  }

  // prepare all input elements
  serverModal.find('#addServerGroupSentinel').hide();
  serverModal.find('#addServerGroupCluster').hide();
  serverModal.find('#serverType').on('change', function () {
    switch ($(this).val()) {
      case 'sentinel':
        serverModal.find('#addServerGroupRedis').hide();
        serverModal.find('#addServerGroupSentinel').show();
        serverModal.find('#addServerGroupCluster').hide();
        break;
      case 'cluster':
        serverModal.find('#addServerGroupRedis').hide();
        serverModal.find('#addServerGroupSentinel').hide();
        serverModal.find('#addServerGroupCluster').show();
        break;
      default: // 'redis'
        serverModal.find('#addServerGroupRedis').show();
        serverModal.find('#addServerGroupSentinel').hide();
        serverModal.find('#addServerGroupCluster').hide();
    }
  });
  serverModal.find('input:radio[name=sentinelPWType]').on('change', function() {
    if ($(this).val() === 'sentinel') {
      serverModal.find('#sentinelPassword').prop('disabled', false)
        .prev('label').removeClass('muted');
    }
    else {
      serverModal.find('#sentinelPassword').prop('disabled', true)
        .prev('label').addClass('muted');
    }
  });
  serverModal.find('input:radio[name=sentinelTLS]').on('change', function() {
    if ($(this).val() === 'custom') {
      serverModal.find('#sentinelTLSCA').prop('disabled', false)
        .prev('label').removeClass('muted');
      serverModal.find('#sentinelTLSPublicKey').prop('disabled', false)
        .prev('label').rem


        if (Rejected) { Flags = Flags.SetBit(2); }
        if (Price != null) { Flags = Flags.SetBit(3); }
        if (/*ScheduleDate != 0 && */ScheduleDate.HasValue) { Flags = Flags.SetBit(0); }
    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Flags);
        if (Flags.IsBitSet(3)) { writer.Write(Price); }
        if (Flags.IsBitSet(0)) { writer.Write(ScheduleDate.Value); }
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Flags = buffer.ReadInt32();
        if (Flags.IsBitSet(1)) { Accepted = true; }
        if (Flags.IsBitSet(2)) { Rejected = true; }
        if (Flags.IsBitSet(3)) { Price = buffer.Read<MyTelegram.Schema.IStarsAmount>(); }
        if (Flags.IsBitSet(0)) { ScheduleDate = buffer.ReadInt32(); }
    }
}


> createState() => _DetailPageButtonState();
}

class _DetailPageButtonState extends State<_DetailPageButton> {
  bool tapInProgress = false;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTapDown: (details) {
        setState(() => tapInProgress = true);
      },
      onTapUp: (details) {
        setState(() => tapInProgress = false);
        widget.onPressed();
      },
      onTapCancel: () {
        setState(() => tapInProgress = false);
      },
      child: ClipOval(
        child: FrostedBox(
          child: Container(
            width: 30,
            height: 30,
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(15),
            ),
            child: Center(
              child: ColorChangingIcon(
                widget.icon,
                duration: const Duration(milliseconds: 300),
                color: tapInProgress
                    ? Styles.closeButtonPressed
                    : Styles.closeButtonUnpressed,
                size: 20,
              ),
            ),
          ),
        ),
      ),
    );
  }
}
// Copyright 2019 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

import 'dart:async';
import 'package:intl/intl.dart';

class Logging {
  Logging() {
    model = TimeModel(this)..start();
  }

  late final TimeModel model;

  static Logging? _theLogging;

  static Logging get logging {
    _theLogging ??= Logging();
    return _theLogging!;
  }

  final _logs = <String>[];

  void add(String entry) {
    final newTimeStamp = TimeStamp.record(DateTime.now());

    _logs.add('[${model.log.length}] : ${newTimeStamp.time}] $entry');
  }

  List<String> get logs => _logs;
}

class TimeStamp {
  TimeStamp({
    time = '',
    date = '',
    meridiem = '',
  });

  factory TimeStamp.record(DateTime now) {
    return TimeStamp(
      time: currentTime.format(now),
      date: currentDate.format(now),
      meridiem: currentMeridiem.format(now),
    );
  }

  late String time;
  late String date;
  late String meridiem;

  static DateFormat currentTime = DateFormat('H:mm:ss', 'en_US');
  static DateFormat currentDate = DateFormat('EEEE, MMM d', 'en_US');
  static DateFormat currentMeridiem = DateFormat('aaa', 'en_US');
}

class TimeModel {
  TimeModel(this._logging);

  final Logging _logging;

  List<TimeStamp> log = <TimeStamp>[];

  final _time = '';
  final _date = '';
  final _meridiem = '';
  Timer? _clockUpdateTimer;
  DateTime now = DateTime.now();

  /// Start updating.
  void start() {
    log.add(TimeStamp());
    _updateLog();
    _clockUpdateTimer = Timer.periodic(
      const Duration(milliseconds: 100),
      (_) => _updateLog(),
    );
  }

  /// Stop updating.
  void stop() {
    _clockUpdateTimer?.cancel();
    _clockUpdateTimer = null;
  }

  /// The current time in the ambient format.
  String get time => _time;

  /// The current date in the ambient format.
  String get date => _date;

  /// The current meridiem in the ambient format.
  String get meridiem => _meridiem;

  String get partOfDay {
    if (now.hour < 5) {
      return 'night';
    }
    if (now.hour < 12) {
      return 'morning';
    }
    if (now.hour < 12 + 5) {
      return 'afternoon';
    }
    if (now.hour < 12 + 8) {
      return 'evening';
    }
    return 'night';
  }

  void _updat


      timeout client 60000ms
        timeout server 60000ms

    listen http-in
        bind *:8000{{range .c}}
        {{.}}{{end}}

Now, we can run the following to get our output configuration:

    consul-haproxy -addr=demo.consul.io -in in.conf -backend "c=consul@nyc3:80" -backend "c=consul@sfo1:80" -dry

When this runs, we should see something like the following:

    global
        daemon
        maxconn 256

    defaults
        mode tcp
        timeout connect 5000ms
        timeout client 60000ms
        timeout server 60000ms

    listen http-in
        bind *:8000
        server 0_nyc3-consul-1_consul 192.241.159.115:80
        server 0_nyc3-consul-2_consul 192.241.158.205:80
        server 0_nyc3-consul-3_consul 198.199.77.133:80
        server 1_sfo1-consul-2_consul 162.243.155.82:80
        server 1_sfo1-consul-1_consul 107.170.195.169:80
        server 1_sfo1-consul-3_consul 107.170.195.158:80

## Varnish Example

derived from the varnish director example from the varnish page: https://www.varnish-cache.org/docs/trunk/users-guide/vcl-backends.html#directors

	import directors;    # load the directors
	{{range .c}}
	backend {{.Node}}_{{.ID}} {
	    .host = "{{.IP}}";
	    .port = "{{.Port}}";
	}{{end}}

	sub vcl_init {
	    new bar = directors.round_robin();
	{{range .c}}
	    bar.add_backend({{.Node}}_{{.ID}});{{end}}
	}

	sub vcl_recv {
	    # send all traffic to the bar director:
	    set req.backend_hint = bar.backend();
	}

Now, we run the following command:

    consul-haproxy -addr=demo.consul.io -in in.conf -backend "c=consul@nyc1:80" -backend "c=consul@sfo1:80" -dry

The following should return:

	backend 0_nyc1-server-1_consul {
	    .host = "192.241.159.115";
	    .port = "80";
	}
	backend 0_nyc1-server-3_consul {
	    .host = "198.199.77.133";
	    .port = "80";
	}
	backend 0_nyc1-server-2_consul {
	    .host = "162.243.162.228";
	    .port = "80";
	}
	backend 1_sfo1-server-3_consul {
	    .host = "107.170.196.151";
	    .port = "80";
	}
	backend 1_sfo1-server-2_consul {
	    .host = "107.170.195.154";
	    .port = "80";
	}
	backend 1_sfo1-server-1_consul {
	    .host = "162.243.153.242";
	    .port = "80";
	}

	sub vcl_init {
	    new bar = directors.round_robin();

	    bar.add_backend(0_nyc1-server-1_consul);
	    bar.add_backend(0_nyc1-server-3_consul);
	    bar.add_backend(0_nyc1-server-2_consul);
	    bar.add_backend(1_sfo1-server-3_consul);
	    bar.add_backend(1_sfo1-server-2_consul);
	    bar.add_backend(1_sfo1-server-1_consul);
	}

	sub vcl_recv {
	    # send all traffic to the bar director:
	    set req.backend_hint = bar.backend();
	}

## Consul Replicate CHANGELOG

## Unreleased

IMPROVEMENTS:

  - Update to go 1.20 [[GH-112]](https://github.com/hashicorp/consul-replicate/pull/112)

## v0.4.0 (August 10, 2017)

IMPROVEMENTS:

  - Updated internal APIs and shared libraries

## v0.3.1.dev (January 28, 2017)

BUG FIXES:

  - Pass along the datacenter in parsed queries [GH-66]
  - Fix config file prefix parsing of the datacenter [GH


1, '4': 1, '5': 9, '10': 'toAddress'},
    const {'1': 'amount', '3': 2, '4': 1, '5': 4, '10': 'amount'},
  ],
};

/// Descriptor for `Transfer`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List transferDescriptor = $convert.base64Decode('CghUcmFuc2ZlchIdCgp0b19hZGRyZXNzGAEgASgJUgl0b0FkZHJlc3MSFgoGYW1vdW50GAIgASgEUgZhbW91bnQ=');
@$core.Deprecated('Use assetTransferDescriptor instead')
const AssetTransfer$json = const {
  '1': 'AssetTransfer',
  '2': const [
    const {'1': 'to_address', '3': 1, '4': 1, '5': 9, '10': 'toAddress'},
    const {'1': 'amount', '3': 2, '4': 1, '5': 4, '10': 'amount'},
    const {'1': 'asset_id', '3': 3, '4': 1, '5': 4, '10': 'assetId'},
  ],
};

/// Descriptor for `AssetTransfer`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List assetTransferDescriptor = $convert.base64Decode('Cg1Bc3NldFRyYW5zZmVyEh0KCnRvX2FkZHJlc3MYASABKAlSCXRvQWRkcmVzcxIWCgZhbW91bnQYAiABKARSBmFtb3VudBIZCghhc3NldF9pZBgDIAEoBFIHYXNzZXRJZA==');
@$core.Deprecated('Use assetOptInDescriptor instead')
const AssetOptIn$json = const {
  '1': 'AssetOptIn',
  '2': const [
    const {'1': 'asset_id', '3': 1, '4': 1, '5': 4, '10': 'assetId'},
  ],
};

/// Descriptor for `AssetOptIn`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List assetOptInDescriptor = $convert.base64Decode('CgpBc3NldE9wdEluEhkKCGFzc2V0X2lkGAEgASgEUgdhc3NldElk');
@$core.Deprecated('Use signingInputDescriptor instead')
const SigningInput$json = const {
  '1': 'SigningInput',
  '2': const [
    const {'1': 'genesis_id', '3': 1, '4': 1, '5': 9, '10': 'genesisId'},
    const {'1': 'genesis_hash', '3': 2, '4': 1, '5': 12, '10': 'genesisHash'},
    const {'1': 'note', '3': 3, '4': 1, '5': 12, '10': 'note'},
    const {'1': 'private_key', '3': 4, '4': 1, '5': 12, '10': 'privateKey'},
    const {'1': 'first_round', '3': 5, '4': 1, '5': 4, '10': 'firstRound'},
    const {'1': 'last_round', '3': 6, '4': 1, '5': 4, '10': 'lastRound'},
    const {'1': 'fee', '3': 7, '4': 1, '5': 4, '10': 'fee'},
    const {'1': 'transfer', '3': 10, '4': 1, '5': 11, '6': '.TW.Algorand.Proto.Transfer', '9': 0, '10': 'transfer'},
    const {'1': 'asset_transfer', '3': 11, '4': 1, '5': 11, '6': '.TW.Algorand.Proto.AssetTransfer', '9': 0, '10': 'assetTransfer'},
    const {'1': 'asset_opt_in', '3': 12, '4': 1, '5': 11, '6': '.TW.Algorand.Proto.AssetOptIn', '9': 0, '10': 'assetOptIn'},
  ],
  '8': const [
    const {'1': 'message_oneof'},
  ],
};

/// Descriptor for `SigningInput`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List signingInputDescriptor = $convert.base64Decode('CgxTaWduaW5nSW5wd


//
// This program simply display a picture on the hires screen
//
//#include <demosystem.h>
#include <lib.h>

// irq.s
extern void System_InstallIRQ_SimpleVbl();
extern void System_RemoveIRQ();
extern void VSync();

// player.s
extern void Player_Initialize();
extern void Player_PlayFrame();
extern void Player_PlayNote();
extern void Player_PlayPause();
extern void Player_Silence();

extern unsigned int player_note;

extern unsigned char LabelPicture[];
extern unsigned char LabelPictureXnitzy[];
extern unsigned char LabelPictureOops[];

extern unsigned char RedRasters[];
extern unsigned char BlackRasters[];
extern unsigned char MultiRasters[];

unsigned char RasterPos=0;
unsigned char GlobalShowY;

void Rasters()
{
	if (GlobalShowY<44)
	{
		unsigned char* screen;
		int y,maxy;
		int i,j,k;

		screen=(unsigned char*)0xa000+40*44;

		i=RasterPos;
		j=RasterPos;
		k=RasterPos;

		maxy=(44-GlobalShowY)/2;
		if (maxy>18)
		{
			maxy=18;
		}

		for (y=0;y<maxy;y++)
		{
			screen[1]=RedRasters[j&15];
			screen[15]=MultiRasters[k&31];
			screen-=40;
			k++;

			screen[1]=BlackRasters[i&15];
			screen[15]=MultiRasters[k&31];
			screen-=40;
			k++;

			i++;
			j--;
		}
		RasterPos++;
	}
}

void Pause()
{
	VSync();
	/*
	int i;

	for (i=0;i<500;i++)
	{

	}
	*/
}

void PatchPicture()
{
	unsigned char* ptr;
	int y;
	ptr=LabelPicture;
	for (y=0;y<200;y++)
	{
		ptr[0]=0;
		//ptr[1]=7;
		ptr+=40;
	}
}

void ShowPicture()
{
	unsigned char* ptr;

	ptr=(unsigned char*)0xa000+200*40;

	GlobalShowY=200;
	while (GlobalShowY)
	{
		Pause();
		ptr-=40;

		ptr[0-40*4]=16+4;
		ptr[1-40*4]=1;

		ptr[0-40*3]=16+4;
		ptr[1-40*3]=1;

		ptr[0-40*2]=16+6;
		ptr[1-40*2]=3;

		ptr[0-40*1]=16+6;
		ptr[1-40*1]=3;

		ptr[0]=16+7;
		ptr[1]=0;

		Rasters();

		GlobalShowY--;
	}
}

unsigned char StarOffsets[]=
{
10,
22,
24,
16,
12,
19,
34,
 8,
32,
 3,
 2,
39,
28,
35,
 4,
14,
 5,
 7,
 0,
25,
23,
37,
20,
13,
 6,
36,
29,
18,
33,
11,
27,
31,
15,
17,
21,
 1,
 9,
38,
30,
26,
};

unsigned char StarColors[]=
{
	16+7,
	16+6,
	16+4,
	16+0,
};

int StarGlobalOffset;

void StarField()
{
   	int y;
	unsigned char* ptr;
	int x,xx,color;
	int xxx;

	memset((unsigned char*)0xa000,0,8000);
	memcpy((unsigned char*)0xa000,LabelPictureXnitzy,8000);

	while (StarGlobalOffset>-150)
	{
		ptr=(unsigned char*)0xa000+4;
   		for (y=0;y<20;y++)
   		{
   			x=(StarOffsets[y]+StarGlobalOffset);
   			for (xx=0;xx<4;xx++)
   			{
   				xxx=x+xx;
   				if (xxx>39)
   				{
   					xxx=0;
   				}
   				color=StarColors[xx];
				ptr[xxx]=color;
   			}
   			ptr+=40*10;
   		}

		StarGlobalOffset--;
   	}

	memcpy((unsigned char*)0xa000,LabelPictureOops,8000);
	for (y=0;y<100;y++)
	{
		VSync();
	}
}

extern void Player_SetMusic_Birthday();

void main()
{
	int y;
	/*
	if (!is_overlay_enabled())
	{
		hires();
	}
	*/
	System_InstallIRQ_SimpleVbl();

    // Show the Xnitzy && Xnutzi animation
    StarField();

	// Hide all the colors of the picture
	PatchPicture();

	// Display the black picture
	memcpy((unsigned char*)0xa000,LabelPicture,8000);

    // Change the music to HappyBirthday
	Player_SetMusic_Birthday();

	// Make the picture appear with some gradient
	ShowPicture();

	for (y=0;y<200;y++)
	{
		Rasters();
		Pause();
	}
	memset((unsigned char*)0xa000,0,8000);

	System_RemoveIRQ();
}


.bp5-minimal:disabled .bp5-icon-large{color:#5f6b7c99!important}.bp5-input-group.bp5-disabled{cursor:not-allowed}.bp5-input-group.bp5-disabled .bp5-icon{color:#5f6b7c99}.bp5-input-group.bp5-large .bp5-button{min-height:30px;min-width:30px;margin:5px}.bp5-input-group.bp5-large>.bp5-input-left-container>.bp5-icon,.bp5-input-group.bp5-large>.bp5-icon,.bp5-input-group.bp5-large .bp5-input-action>.bp5-spinner{margin:12px}.bp5-input-group.bp5-large .bp5-input{font-size:16px;height:40px;line-height:40px}.bp5-input-group.bp5-large .bp5-input[type=search],.bp5-input-group.bp5-large .bp5-input.bp5-round{padding:0 15px}.bp5-input-group.bp5-large .bp5-input:not(:first-child){padding-left:40px}.bp5-input-group.bp5-large .bp5-input:not(:last-child){padding-right:40px}.bp5-input-group.bp5-small .bp5-button,.bp5-input-group.bp5-small .bp5-tag{min-height:20px;min-width:20px;margin:2px}.bp5-input-group.bp5-small>.bp5-input-left-container>.bp5-icon,.bp5-input-group.bp5-small>.bp5-icon,.bp5-input-group.bp5-small .bp5-input-action>.bp5-spinner{margin:4px}.bp5-input-group.bp5-small .bp5-input{font-size:12px;height:24px;line-height:24px;padding-left:8px;padding-right:8px}.bp5-input-group.bp5-small .bp5-input[type=search],.bp5-input-group.bp5-small .bp5-input.bp5-round{padding:0 12px}.bp5-input-group.bp5-small .bp5-input:not(:first-child){padding-left:24px}.bp5-input-group.bp5-small .bp5-input:not(:last-child){padding-right:24px}.bp5-input-group.bp5-fill{flex:1 1 auto;width:100%}.bp5-input-group.bp5-round .bp5-button,.bp5-input-group.bp5-round .bp5-input,.bp5-input-group.bp5-round .bp5-tag{border-radius:30px}.bp5-dark .bp5-input-group .bp5-icon{color:#abb3bf}.bp5-dark .bp5-input-group.bp5-disabled .bp5-icon{color:#abb3bf99}.bp5-input-group.bp5-intent-primary .bp5-input{box-shadow:0 0 #2d72d200,0 0 #2d72d200,inset 0 0 0 1px #2d72d2,inset 0 0 0 1px #11141833,inset 0 1px 1px #11141880}.bp5-input-group.bp5-intent-primary .bp5-input:focus{box-shadow:inset 0 0 0 1px #2d72d2,0 0 0 2px #2d72d24d,inset 0 1px 1px #11141833}.bp5-input-group.bp5-intent-primary .bp5-input[readonly]{box-shadow:inset 0 0 0 1px #2d72d2}.bp5-input-group.bp5-intent-primary .bp5-input:disabled,.bp5-input-group.bp5-intent-primary .bp5-input.bp5-disabled{box-shadow:none}.bp5-dark .bp5-input-group.bp5-int


#include "common.h"
#include "1CCCF0.h"

void func_800F65E0_MarioBandstand(void) {
    s32 i;

    func_80029090(4);
    func_8001DE70(0x48);
    omInitObjMan(0x10, 0);
    D_800FD286_MarioBandstand = D_800C597C;
    D_800C597C &= ~0x10;
    func_80060088();
    func_800FC930_MarioBandstand(1150.0f, -10.0f, 0, 0, 0, 50.0f, 445.0f);
    func_80017660(0, 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT);
    func_800176C4(0, 640.0f, 480.0f, 511.0f, 640.0f, 480.0f, 511.0f);
    func_8001D494(0, 25.0f, 80.0f, 8000.0f);
    func_8002890C(0, 0, 0);
    omSetStatBit(omAddObj(0x7FDA, 0, 0, -1, omOutView), 0xA0);
    omAddObj(0, 0, 0, -1, &func_800F6808_MarioBandstand);
    omSetStatBit(omAddObj(6, 0, 0, -1, &func_800FB4D8_MarioBandstand), 0xA0);

    for (i = 0; i < 16; i++) {
        D_800FD6E0_MarioBandstand[i] = -1;
    }

    D_800FD714_MarioBandstand = -1;
    func_800F6F70_MarioBandstand();
    func_800F97D0_MarioBandstand();
    func_800FB1D0_MarioBandstand();
    omAddObj(0x2710, 0, 0, -1, &func_800F6F10_MarioBandstand);
    SetFadeInTypeAndTime(0, 0x10);
    D_800FD282_MarioBandstand = 1;
}

void func_800F6808_MarioBandstand(omObjData* arg0) {
    D_800FD280_MarioBandstand = 0;
    D_800ED430 = 0;
    arg0->func_ptr = &func_800F6828_MarioBandstand;
}

void func_800F6828_MarioBandstand(void) {
    if (D_800C5982 != 1) {
        switch (D_800FD280_MarioBandstand) {
        case 0:
            func_800F68D4_MarioBandstand();
            return;
        case 1:
            if (func_800FC8A8_MarioBandstand(0x4000) != 0) {
                D_800FD280_MarioBandstand = 2;
                D_800FD284_MarioBandstand = 1;
                D_800ED430 = 2;
                return;
            }
            break;
        case 2:
            func_800F6B04_MarioBandstand();
            break;
        }
    }
}

INCLUDE_ASM("asm/nonmatchings/overlays/ovl_26_MarioBandstand/1CCCF0", func_800F68D4_MarioBandstand);

INCLUDE_ASM("asm/nonmatchings/overlays/ovl_26_MarioBandstand/1CCCF0", func_800F6B04_MarioBandstand);

INCLUDE_ASM("asm/nonmatchings/overlays/ovl_26_MarioBandstand/1CCCF0", func_800F6F10_MarioBandstand);


       return content

    async def _send_or_update_dm(self, result: Optional[str] = None):
        """Sends or updates the DM with FEN and PGN for the human player."""
        player = self.player
        dm_message = self.player_dm_message

        try:
            content = await self._get_dm_content(result=result)
            dm_channel = player.dm_channel or await player.create_dm()

            if dm_message:
                try:
                    await dm_message.edit(content=content)
                    return  # Edited successfully
                except discord.NotFound:
                    print(
                        f"DM message for {player.display_name} not found, will send a new one."
                    )
                    self.player_dm_message = None
                    dm_message = None
                except discord.Forbidden:
                    print(f"Cannot edit DM for {player.display_name} (Forbidden).")
                    self.player_dm_message = None
                    dm_message = None
                except discord.HTTPException as e:
                    print(
                        f"HTTP error editing DM for {player.display_name}: {e}. Will try sending."
                    )
                    self.player_dm_message = None
                    dm_message = None

            if dm_message is None:
                new_dm_message = await dm_channel.send(content=content)
                self.player_dm_message = new_dm_message

        except discord.Forbidden:
            print(
                f"Cannot send DM to {player.display_name} (Forbidden). User likely has DMs disabled."
            )
            self.player_dm_message = None
        except discord.HTTPException as e:
            print(f"Failed to send/edit DM for {player.display_name}: {e}")
            self.player_dm_message = None
        except Exception as e:
            print(
                f"Unexpected error sending/updating DM for {player.display_name}: {e}"
            )
            self.player_dm_message = None


8C FC */	addi r4, r4, lbl_80018CFC@l
/* 80018DD0 00014310  38 A0 00 00 */	li r5, 0
/* 80018DD4 00014314  38 C0 00 70 */	li r6, 0x70
/* 80018DD8 00014318  48 4F E1 ED */	bl __construct_new_array
/* 80018DDC 0001431C  90 7D 00 14 */	stw r3, 0x14(r29)
/* 80018DE0 00014320  3B E0 00 00 */	li r31, 0
/* 80018DE4 00014324  3B 80 00 00 */	li r28, 0
/* 80018DE8 00014328  48 00 00 B0 */	b lbl_80018E98
lbl_80018DEC:
/* 80018DEC 0001432C  80 9E 00 28 */	lwz r4, 0x28(r30)
/* 80018DF0 00014330  57 E0 13 BA */	rlwinm r0, r31, 2, 0xe, 0x1d
/* 80018DF4 00014334  80 7D 00 14 */	lwz r3, 0x14(r29)
/* 80018DF8 00014338  7F 64 00 2E */	lwzx r27, r4, r0
/* 80018DFC 0001433C  7F 63 E1 2E */	stwx r27, r3, r28
/* 80018E00 00014340  38 9B 00 18 */	addi r4, r27, 0x18
/* 80018E04 00014344  80 1D 00 14 */	lwz r0, 0x14(r29)
/* 80018E08 00014348  7C 60 E2 14 */	add r3, r0, r28
/* 80018E0C 0001434C  38 63 00 44 */	addi r3, r3, 0x44
/* 80018E10 00014350  48 00 1F 75 */	bl func_8001AD84
/* 80018E14 00014354  80 9D 00 14 */	lwz r4, 0x14(r29)
/* 80018E18 00014358  7C E4 E2 14 */	add r7, r4, r28
/* 80018E1C 0001435C  A0 07 00 04 */	lhz r0, 4(r7)
/* 80018E20 00014360  28 00 FF FF */	cmplwi r0, 0xffff
/* 80018E24 00014364  40 82 00 6C */	bne lbl_80018E90
/* 80018E28 00014368  80 1D 00 08 */	lwz r0, 8(r29)
/* 80018E2C 0001436C  39 00 00 00 */	li r8, 0
/* 80018E30 00014370  38 60 00 00 */	li r3, 0
/* 80018E34 00014374  7C 09 03 A6 */	mtctr r0
/* 80018E38 00014378  28 00 00 00 */	cmplwi r0, 0
/* 80018E3C 0001437C  40 81 00 54 */	ble lbl_80018E90
lbl_80018E40:
/* 80018E40 00014380  7C C4 18 2E */	lwzx r6, r4, r3
/* 80018E44 00014384  7C A4 1A 14 */	add r5, r4, r3
/* 80018E48 00014388  2C 06 00 00 */	cmpwi r6, 0
/* 80018E4C 0001438C  41 82 00 38 */	beq lbl_80018E84
/* 80018E50 00014390  80 06 00 0C */	lwz r0, 0xc(r6)
/* 80018E54 00014394  7C 00 D8 40 */	cmplw r0, r27
/* 80018E58 00014398  40 82 00 0C */	bn


d{4})|\d{3}[Xx])$)$/;
  return reg.test(val);
};

// 护照号码验证
export const isPassport = (val: string): boolean => {
  const reg = /(P\d{7})|(G\d{8})/;
  return reg.test(val);
};

// 手机号验证
export const isMobile = (val: string): boolean => {
  const reg = /^1[345789]\d{9}$/
  return reg.test(val);
};

// 邮箱验证
export const isEmail = (val: string): boolean => {
  const reg = /^[0-9A-Za-zd]+([-_.][0-9A-Za-zd]+)*@([0-9A-Za-zd]+[-.])+[0-9A-Za-zd]{2,5}$/;
  return reg.test(val);
};

/* 金额校验 */
export const moneyReg = (obj: any) => {
  obj.value = obj.value.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
  obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
  obj.value = obj.value
    .replace(".", "$#$")
    .replace(/\./g, "")
    .replace("$#$", ".");
  obj.value = obj.value.replace(/^(-)*(\d+)\.(\d\d).*$/, "$1$2.$3"); //只能输入两个小数
  // 如果没有小数点，首位不能为类似于 01、02的金额
  if (obj.value.indexOf(".") < 0 && obj.value != "") {
    obj.value = parseFloat(obj.value);
  }
};
import * as crawler from "npm-license-crawler";
import thenify from "thenify";
import * as fs from "mz/fs";
import * as got from "got";

async function writeLicenses(licenseJson: any, outputDir: string): Promise<void> {
  let result = [];
  for (let p of Object.keys(licenseJson)) {
    let info = licenseJson[p];
    let license = await fetchLicense(p, info.licenses, info.licenseUrl, info.repository);
    // await fs.write(o, `# ${p}\n\n${license}\n\n`)
    // const explodeAt = p.split("@");
    let cleanName;
    if (p.startsWith('@')) {
      cleanName = '@' + p.slice(1).split("@")[0];

    } else {
      cleanName = p.split("@")[0];
    }

    if (cleanName) {
      result.push({ name: cleanName, license });
    } else {
      console.log("skipping " + p);
    }
  }

  fs.writeFile(outputDir, JSON.stringify(result), "utf8", function(err) {
    if (err) {
      return console.log(err);
    }

    console.log("The file is saved!");
  });
}

const overrides = new Map<string, string>([
  ["json-schema@0.2.3", "BSD-3-Clause"],
  ["jsonify@0.0.0", "Public domain"],
  ["buffers@0.1.1", "MIT"],
  ["string-to-js@0.0.1", "MIT"],
  ["indexof@0.0.1", "MIT"],
  ["rgb@0.1.0", "MIT"]
]);

async function fetchLicense(
  module: string,
  licenseId: string | undefined,
  licenseUrl: string | undefined,
  repositoryUrl: string | undefined
): Promise<string> {
  console.error(`Processing ${module} (${licenseUrl})`);

  if (overrides.has(module)) {
    console.error(`Using override for ${module}`);
    licenseId = overrides.get(module);
    licenseUrl = undefined;
    repositoryUrl = undefined;

    if (licenseId === "Public domain") {
      return "public domain";
    }
  }

  if (licenseUrl) {


                "<stream:error>" +
                "<conflict xmlns='urn:ietf:params:xml:ns:xmpp-streams' />" +
                "<text xml:lang='' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>" +
                    "Replaced by new connection" +
                "</text>" +
                "<appSpecificElement xmlns='myns'>" +
                    "Text contents of application-specific condition element: Foo Bar" +
                "</appSpecificElement>" +
                "</stream:error>" +
                "</stream:stream>";

        XmlPullParser parser = SmackTestUtil.getParserFor(xml, "error", parserKind);
        StreamError error = ElementParserUtils.parseStreamError(parser);

        assertNotNull(error);
        assertEquals(Condition.conflict, error.getCondition());
        assertEquals("Replaced by new connection", error.getDescriptiveText());
        XmlElement appSpecificElement = error.getExtension("appSpecificElement", "myns");
        assertNotNull(appSpecificElement);
    }

    @ParameterizedTest
    @EnumSource(SmackTestUtil.XmlPullParserKind.class)
    public void testStreamErrorXmlNotWellFormed(SmackTestUtil.XmlPullParserKind parserKind)
                    throws XmlPullParserException, IOException, SmackParsingException {
        final String xml =
                // Usually the stream:stream element has more attributes (to, version, ...)
                // We omit those, since they are not relevant for testing
                "<stream:stream from='im.example.com' id='++TR84Sm6A3hnt3Q065SnAbbk3Y=' xmlns:stream='http://etherx.jabber.org/streams'>" +
                        "<stream:error><xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>" +
                        "</stream:stream>";

        XmlPullParser parser = SmackTestUtil.getParserFor(xml, "error", parserKind);
        StreamError error = ElementParserUtils.parseStreamError(parser);

        assertNotNull(error);
        assertEquals(Condition.not_well_formed, error.getCondition());
    }
}
/*
 *
 * Copyright © 2014 Florian Schmaus
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jivesoftware.smack.util.stringencoder;

import static org.junit.Assert.assertEquals;

// TODO those tests should be run with the Java7 and Android impl
public class Base64Test {
    /**
     * This method tests 2 StringUtil methods - encodeBase64(String) and encodeBase64(byte[]).
     */
    public void testEncodeBase64() {
        String input = "";
        String output = "";
        assertEquals(Base64.encode(input), output);

        input = "foo bar 123";
        output = "Zm9vIGJhciAxMjM=";
        assertEquals(Base64.encode(input), output);

        input = "=";
        output = "PQ==";
        assertEquals(Base64.encode(input), output);

        input = "abcdefghijklmnopqrstuvwxyz0123456789\n\t\"?!.@{}[]();',./<>#$%^&*";
        output = "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5CgkiPyEuQHt9W10oKTsnLC4vPD4jJCVeJio=";
        assertEquals(Base64.encode(input), output);
    }

    /***
     * This method tests 2 StringUtil methods - decodeBase64(String


          Ok(client) => client,
            Err(_) => return Err(anyhow!("could not connect to tracker")),
        };

        // Send GET request to the tracker
        let response = match client.get(&tracker_url).send() {
            Ok(response) => match response.bytes() {
                Ok(bytes) => bytes,
                Err(_) => return Err(anyhow!("could not read response from tracker")),
            },
            Err(_) => return Err(anyhow!("could not send request to tracker")),
        };

        // Deserialize bencoded tracker response
        let tracker_bencode = match de::from_bytes::<BencodeTracker>(&response) {
            Ok(bencode) => bencode,
            Err(_) => return Err(anyhow!("could not decode tracker response")),
        };

        // Build peers from tracker response
        let peers: Vec<Peer> = match self.build_peers(tracker_bencode.peers.to_vec()) {
            Ok(peers) => peers,
            Err(_) => return Err(anyhow!("could not build peers")),
        };

        Ok(peers)
    }

    /// Build tracker URL.
    ///
    /// # Arguments
    ///
    /// * `peer_id` - Urlencoded 20-byte string used as a unique ID for the client.
    /// * `port` - Port number that the client is listening on.
    ///
    fn build_tracker_url(&self, peer_id: Vec<u8>, port: u16) -> Result<String> {
        // Parse tracker URL from torrent
        let mut base_url = match Url::parse(&self.announce) {
            Ok(url) => url,
            Err(_) => return Err(anyhow!("could not parse tracker url")),
        };

        // Add parameters to the tracker URL
        base_url
            // Add info hash
            .query_pairs_mut()
            .encoding_override(Some(&|input| {
                if input != "!" {
                    Cow::Borrowed(input.as_bytes())
                } else {
                    Cow::Owned(self.info_hash.clone())
                }
            }))
            .append_pair("info_hash", "!");
        base_url
            // Add peer id
            .query_pairs_mut()
            .encoding_override(Some(&|input| {
                if input != "!" {
                    Cow::Borrowed(input.as_bytes())
                } else {
                    Cow::Owned(peer_id.clone())
                }
            }))
            .append_pair("peer_id", "!");
        base_url
            .query_pairs_mut()
            // Add port
            .append_pair("port", &port.to_string())
            // Add uploaded
            .append_pair("uploaded", "0")
            // Add downloaded
            .append_pair("downloaded", "0")
            // Add compact
            .append_pair("compact", "1")
            // Add left
            .append_pair("left", &self.length.to_string());

        Ok(base_url.to_string())
    }

    /// Download torrent.
    pub fn download(&self) -> Result<Vec<u8>> {
        println!(
            "Downloading {:?} ({:?} pieces)",
            self.name,
            self.pieces_hashes.len(),
        );

        // Create work pieces channel
        let work_chan: (Sender<PieceWork>, Receiver<PieceWork>) = unbounded();

        // Create result pieces channel
        let result_chan: (Sender<PieceResult>, Receiver<PieceResult>) = unbounded();

        // Create and send pieces to work channel
        for index in 0..self.pieces_hashes.len() {
            // Create piece
            let piece_index = index as u32;
            let piece_hash =


_2 = i__ * 6 - 6) < 120 && 0 <= i__2 ?
		    i__2 : s_rnge("starg", i__2, "spkgps_", (ftnlen)981)],
		    stemp);
	    vadd_(stemp, &starg[(i__2 = (i__ + 1) * 6 - 6) < 120 && 0 <= i__2
		    ? i__2 : s_rnge("starg", i__2, "spkgps_", (ftnlen)982)],
		    vtemp);
	    moved_(vtemp, &c__3, &starg[(i__2 = (i__ + 1) * 6 - 6) < 120 && 0
		    <= i__2 ? i__2 : s_rnge("starg", i__2, "spkgps_", (ftnlen)
		    983)]);
	}
    }

/*     To avoid unnecessary frame transformations we'll do */
/*     a bit of extra decision making here.  It's a lot */
/*     faster to make logical checks than it is to compute */
/*     frame transformations. */

    if (tframe[(i__1 = ctpos - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge("tframe",
	    i__1, "spkgps_", (ftnlen)996)] == cframe) {
	vsub_(&starg[(i__1 = ctpos * 6 - 6) < 120 && 0 <= i__1 ? i__1 :
		s_rnge("starg", i__1, "spkgps_", (ftnlen)998)], sobs, pos);
    } else if (tframe[(i__1 = ctpos - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge(
	    "tframe", i__1, "spkgps_", (ftnlen)1000)] == refid) {

/*        If the last frame associated with the target is already */
/*        in the requested output frame, we convert the position of */
/*        the observer to that frame and then subtract the position */
/*        of the observer from the position of the target. */

	if (refid > 0 && refid <= 21 && cframe > 0 && cframe <= 21) {
	    irfrot_(&cframe, &refid, rot);
	    mxv_(rot, sobs, stemp);
	} else {
	    refchg_(&cframe, &refid, et, psxfrm);
	    if (failed_()) {
		chkout_("SPKGPS", (ftnlen)6);
		return 0;
	    }
	    mxv_(psxfrm, sobs, stemp);
	}

/*        We've now transformed SOBS into the requested reference frame. */
/*        Set CFRAME to reflect this. */

	cframe = refid;
	vsub_(&starg[(i__1 = ctpos * 6 - 6) < 120 && 0 <= i__1 ? i__1 :
		s_rnge("starg", i__1, "spkgps_", (ftnlen)1031)], stemp, pos);
    } else if (cframe > 0 && cframe <= 21 && tframe[(i__1 = ctpos - 1) < 20 &&
	     0 <= i__1 ? i__1 : s_rnge("tframe", i__1, "spkgps_", (ftnlen)
	    1034)] > 0 && tframe[(i__1 = ctpos - 1) < 20 && 0 <= i__1 ? i__1 :
	     s_rnge("tframe", i__1, "spkgps_", (ftnlen)1034)] <= 21) {

/*        If both frames are inertial we use IRFROT instead of */
/*        REFCHG to get things into a common frame. */

	irfrot_(&tframe[(i__1 = ctpos - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge(
		"tframe", i__1, "spkgps_", (ftnlen)1040)], &cframe, rot);
	mxv_(rot, &starg[(i__1 = ctpos * 6 - 6) < 120 && 0 <= i__1 ? i__1 :
		s_rnge("starg", i__1, "spkgps_", (ftnlen)1041)], stemp);
	vsub_(stemp, sobs, pos);
    } else {

/*        Use the more general routine REFCHG to make the transformation. */

	refchg_(&tframe[(i__1 = ctpos - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge(
		"tframe", i__1, "spkgps_", (ftnlen)1048)], &cframe, et,
		psxfrm);
	if (failed_()) {
	    chkout_("SPKGPS", (ftnlen)6);
	    return 0;
	}
	mxv_(psxfrm, &starg[(i__1 = ctpos * 6 - 6) < 120 && 0 <= i__1 ? i__1 :
		 s_rnge("starg", i__1, "spkgps_", (ftnlen)1055)], stemp);
	vsub_(stemp, sobs, pos);
    }

/*     Finally, rotate as needed into the requested frame. */

    if (cframe == refid) {

/*        We don't have to do anything in this case. */

    } else if (refid > 0 && refid <= 21 && cframe > 0 && cframe <= 21) {

/*        Since both frames are inertial, we use the more direct */
/*        routine IRFROT to get the transformation to REFID. */

	irfrot_(&cframe, &refid, rot);
	mxv_(rot, pos, stemp);
	moved_(stemp, &c__3, pos);
    } else {
	refchg_(&cframe, &refid, et, psxfrm);
	if (failed_()) {
	    chkout_("SPKGPS", (ftnlen)6);
	    return 0;
	}
	mxv_(psxfrm, pos, stemp);
	moved_(stemp, &c__3, pos);
    }
    *lt = vnorm_(pos) / clight_();
    chkout_("SPKGPS", (ftnlen)6);
    return 0;
} /* spkgps_ */


e.

If <var>doc</var>’s fullscreen element is not connected:

Append (fullscreenchange, <var>doc</var>’s
   fullscreen element) to <var>doc</var>’s
   list of pending fullscreen events.

Return <var>promise</var>, and run the remaining steps in parallel.

If <var>resize</var> is true, resize <var>doc</var>’s viewport to its "normal" dimensions.

If <var>doc</var>’s fullscreen element is null, then resolve <var>promise</var> with
 undefined and terminate these steps.

Let <var>exitDocs</var> be the result of
 collecting documents to unfullscreen given
 <var>doc</var>.

Let <var>descendantDocs</var> be an ordered set consisting of <var>doc</var>’s
 descendant browsing contexts' active documents whose fullscreen element is
 non-null, if any, in tree order.

For each <var>exitDoc</var> in <var>exitDocs</var>:

<a data-link-type="dfn" href="https://infra.spec.whatwg.org


            InputModeSwitcherManager.MASK_SKB_LAYOUT_STROKE -> {  // 7000  笔画键盘
                var keyBeans: MutableList<SoftKey> = LinkedList()
                val keys =  KeyboardData.layoutStrokeCn[skbStyleMode]!!
                var t9Key = createT9Keys(keys[0])
                t9Key.first().apply {
                    widthF = 0.18f
                    heightF = 0.75f
                }
                t9Key.last().widthF = 0.18f
                keyBeans.addAll(t9Key)
                rows.add(keyBeans)
                keyBeans = LinkedList()
                t9Key = createT9Keys(keys[1])
                t9Key.first().mLeftF = 0.185f
                t9Key.last().widthF = 0.18f
                keyBeans.addAll(t9Key)
                rows.add(keyBeans)
                keyBeans = LinkedList()
                t9Key = createT9Keys(keys[2])
                t9Key.first().mLeftF = 0.185f
                t9Key.last().widthF = 0.18f
                keyBeans.addAll(t9Key)
                rows.add(keyBeans)
                keyBeans = lastRows(skbValue)
                rows.add(keyBeans)
            }
            InputModeSwitcherManager.MASK_SKB_LAYOUT_TEXTEDIT -> {     // 8000 文本编辑键盘
                var keyBeans: MutableList<SoftKey> = LinkedList()
                val keys =  KeyboardData.layoutTextEdit[skbStyleMode]!!
                var editKeys = createTextEditKeys(keys[0])
                editKeys[0].heightF = 0.75f
                editKeys[2].heightF = 0.75f
                keyBeans.addAll(editKeys)
                rows.add(keyBeans)
                keyBeans = LinkedList()
                editKeys = createTextEditKeys(keys[1])
                editKeys[0].mLeftF = 0.25f
                editKeys[1].mLeftF = 0.75f
                keyBeans.addAll(editKeys)
                rows.add(keyBeans)
                keyBeans = LinkedList()
                editKeys = createTextEditKeys(keys[2])
                editKeys[0].mLeftF = 0.25f
                editKeys[1].mLeftF = 0.75f
                keyBeans.addAll(editKeys)
                rows.add(keyBeans)
                keyBeans = LinkedList()
                editKeys = createTextEditKeys(keys[3])
                editKeys[0].widthF = 0.33f
                editKeys[1].widthF = 0.33f
                editKeys[2].widthF = 0.33f
                keyBeans.addAll(editKeys)
                rows.add(keyBeans)
            }
        }
        val numberLineSkb = when(skbStyleMode){
            SkbStyleMode.Yuyan -> numberLine
            SkbStyleMode.Samsung -> numberLine
            SkbStyleMode.Google -> numberLine
        }
        softKeyboard = getSoftKeyboard(rows, numberLineSkb)
        mSoftKeyboardMap[skbValue] = softKeyboard
        return softKeyboard
    }

    // 键盘最后一行（各键盘统一，数字键盘稍微不同）
    private fun lastRows(skbValue: Int): MutableList<SoftKey> {
        val enterToggleStates = listOf(ToggleState("去往", 0), ToggleState("搜索", 1), ToggleState("发送", 2),
            ToggleState("下一个", 3), ToggleState("完成", 4))
        val softKeyToggle = createKeyToggle(KeyEvent.KEYCODE_ENTER)
        softKeyToggle.widthF = 0.18f
        softKeyToggle.stateId = 0
        softKeyToggle.setToggleStates(enterToggleStates)