(0,' + (deltaY < 0 ? 0 : deltaY) + 'px,0)'
      this.pullDownCanvas.style.opacity = ratioPI
      this.pullDownCanvas.style.webkitTransform = 'rotate(' + 300 * ratio + 'deg)'
      var canvas = this.pullDownCanvas
      var ctx = this.pullDownCanvasCtx
      var size = this.options.down.tips.size
      ctx.lineWidth = this.options.down.tips.lineWidth
      ctx.fillStyle = '#' + this.options.down.tips.color
      ctx.strokeStyle = '#' + this.options.down.tips.color
      ctx.stroke()
      ctx.clearRect(0, 0, size, size)
      // fixed android 4.1.x
      canvas.style.display = 'none' // Detach from DOM
      canvas.offsetHeight // Force the detach
      canvas.style.display = 'inherit' // Reattach to DOM
      this.canvasUtils.drawArcedArrow(ctx, size / 2 + 0.5, size / 2, size / 4, 0 * Math.PI, 5 / 3 * Math.PI * ratioPI, false, 1, 2, 0.7853981633974483, 25, this.options.down.tips.lineWidth, this.options.down.tips.lineWidth)
    },

    beforeChangeOffset: function (deltaY) {},
    afterChangeOffset: function (deltaY) {},
    dragEndAfterChangeOffset: function (isNeedRefresh) {
      if (isNeedRefresh) {
        this.canvasUtils.startSpin()
        this.pullDownLoading()
      } else {
        this.canvasUtils.stopSpin()
        this.endPullDownToRefresh()
      }
    },
    canvasUtils: (function () {
      var canvasObj = null,
        ctx = null,
        size = 200,
        lineWidth = 15,
        tick = 0,
        startTime = 0,
        frameTime = 0,
        timeLast = 0,
        oldStep = 0,
        acc = 0,
        head = 0,
        tail = 180,
        rad = Math.PI / 180,
        duration = 1000,
        tail_duration = 1000 * 2.5,
        colors = ['35ad0e', 'd8ad44', 'd00324', 'dc00b8', '017efc'],
        rAF = null

      function easeLinear (currentIteration, startValue, changeInValue, totalIterations) {
        return changeInValue * currentIteration / totalIterations + startValue
      }

      function easeInOutQuad (currentIteration, startValue, changeInValue, totalIterations) {
        if ((currentIteration /= totalIterations / 2) < 1) {
          return changeInValue / 2 * currentIteration * currentIteration + startValue
        }
        return -changeInValue / 2 * ((--currentIteration) * (currentIteration - 2) - 1) + startValue
      }

      function minmax (value, v0, v1) {
        var min = Math.min(v0, v1)
        var max = Math.max(v0, v1)
        if (value < min)
          return min
        if (value > max)
          return min
        return value
      }

      var drawHead = function (ctx, x0, y0, x1, y1, x2, y2, style) {
        'use strict'
        if (typeof(x0) == 'string') x0 = parseInt(x0)
        if (typeof(y0) == 'string') y0 = parseInt(y0)
        if (typeof(x1) == 'string') x1 = parseInt(x1)
        if (typeof(y1) == 'string') y1 = parseInt(y1)
        if (typeof(x2) == 'string') x2 = parseInt(x2)
        if (typeof(y2) == 'string') y2 = parseInt(y2)
        var radius = 3
        va


80000080|0] = 0x9;
Videox86.aEGADWToByte[0x80008000|0] = 0xa;
Videox86.aEGADWToByte[0x80008080|0] = 0xb;
Videox86.aEGADWToByte[0x80800000|0] = 0xc;
Videox86.aEGADWToByte[0x80800080|0] = 0xd;
Videox86.aEGADWToByte[0x80808000|0] = 0xe;
Videox86.aEGADWToByte[0x80808080|0] = 0xf;

/*
 * Card Specifications
 *
 * We support dynamically switching between MDA and CGA cards by simply flipping switches on
 * the virtual SW1 switch block and resetting the machine.  However, I'm not sure I'll support
 * dynamically switching the EGA card the same way; there's certainly no UI for it at this point.
 *
 * For each supported card, there is a cardSpec array that the Card class uses to initialize the
 * card's defaults:
 *
 *      [0]: card descriptor
 *      [1]: default CRTC port address
 *      [2]: default video buffer address
 *      [3]: default video buffer size
 *      [4]: total on-board memory (if no "memory" parm was specified)
 *      [5]: default monitor type
 *
 * If total on-board memory is zero, then addMemory() will simply add the specified video buffer
 * to the address space; otherwise, we will allocate an internal buffer (adwMemory) and tell addMemory()
 * to map it to the video buffer address.  The latter approach gives us total control over the buffer;
 * refer to getMemoryAccess().
 */
Videox86.cardSpecs = [];
Videox86.cardSpecs[Videox86.CARD.MDA] = ["MDA", Card.MDA.CRTC.INDX.PORT, 0xB0000, 0x01000, 0x01000, ChipSet.MONITOR.MONO];
Videox86.cardSpecs[Videox86.CARD.CGA] = ["CGA", Card.CGA.CRTC.INDX.PORT, 0xB8000, 0x04000, 0x04000, ChipSet.MONITOR.COLOR];
Videox86.cardSpecs[Videox86.CARD.EGA] = ["EGA", Card.CGA.CRTC.INDX.PORT, 0xB8000, 0x04000, 0x10000, ChipSet.MONITOR.EGACOLOR];
Videox86.cardSpecs[Videox86.CARD.VGA] = ["VGA", Card.CGA.CRTC.INDX.PORT, 0xB8000, 0x04000, 0x40000, ChipSet.MONITOR.VGACOLOR];

/*
 * Values for nTouchConfig; a value will be selected based on the sTouchScreen configuration parameter.
 */
Videox86.TOUCH = {
    NONE:       0,
    DEFAULT:    1,
    KEYGRID:    2,
    MOUSE:      3
};

/*
 * Why simulate a SPACE if the tap is in the middle third (center) of the screen?  Well, apparently
 * I didn't explain earlier that the WHOLE reason I originally added KEYGRID support (before it was
 * even called KEYGRID support) was to make the 1985 game "Rogue" (pcjs.org/apps/pcx86/1985/rogue)
 * more fun to play on an iPad (the space-bar is a commonly required key).
 */
Videox86.KEYGRID = [
    [Kbdx86.SIMCODE.HOME, Kbdx86.SIMCODE.UP,    Kbdx86.SIMCODE.PGUP],
    [Kbdx86.SIMCODE.LEFT, Kbdx86.SIMCODE.SPACE, Kbdx86.SIMCODE.RIGHT],
    [Kbdx86.SIMCODE.END,  Kbdx86.SIMCODE.DOWN,  Kbdx86.SIMCODE.PGDN],
];

/*
 * Port input/output notification ta


l);
static esp_err_t panel_rm67162_init(esp_lcd_panel_t *panel);
static esp_err_t panel_rm67162_draw_bitmap(esp_lcd_panel_t *panel, int x_start, int y_start, int x_end, int y_end, const void *color_data);
static esp_err_t panel_rm67162_set_rotation(esp_lcd_panel_t *panel, uint8_t r);

static esp_err_t esp_lcd_new_panel_rm67162(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel)
{
    esp_err_t ret = ESP_OK;
    rm67162_panel_t *rm67162 = NULL;
    uint8_t fb_bits_per_pixel = 0;

    ESP_GOTO_ON_FALSE(io && panel_dev_config && ret_panel, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");
    rm67162 = (rm67162_panel_t *)calloc(1, sizeof(rm67162_panel_t));
    ESP_GOTO_ON_FALSE(rm67162, ESP_ERR_NO_MEM, err, TAG, "no mem for rm67162 panel");
    if (panel_dev_config->reset_gpio_num >= 0) {
        pinMode(panel_dev_config->reset_gpio_num, OUTPUT);
    }
    switch (panel_dev_config->bits_per_pixel) {
    case 16: // RGB565
        rm67162->colmod_cal = 0x55;
        fb_bits_per_pixel = 16;
        break;
    case 18: // RGB666
        rm67162->colmod_cal = 0x66;
        // each color component (R/G/B) should occupy the 6 high bits of a byte, which means 3 full bytes are required for a pixel
        fb_bits_per_pixel = 24;
        break;
    default:
        ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported pixel width");
        break;
    }
    rm67162->io = io;
    rm67162->fb_bits_per_pixel = fb_bits_per_pixel;
    rm67162->reset_gpio_num = panel_dev_config->reset_gpio_num;
    rm67162->reset_level = panel_dev_config->flags.reset_active_high;
    rm67162->base.del = panel_rm67162_del;
    rm67162->base.reset = panel_rm67162_reset;
    rm67162->base.init = panel_rm67162_init;
    rm67162->base.draw_bitmap = panel_rm67162_draw_bitmap;
    rm67162->base.invert_color = NULL;
    rm67162->base.set_gap = NULL;
    rm67162->base.mirror = NULL;
    rm67162->base.swap_xy = NULL;
    *ret_panel = &(rm67162->base);
    log_d("new rm67162 panel @%p", rm67162);
    return ESP_OK;
err:
    if (rm67162) {
        if (panel_dev_config->reset_gpio_num >= 0) {
            pinMode(panel_dev_config->reset_gpio_num, OPEN_DRAIN);
        }
        free(rm67162);
    }
    return ret;
}

static esp_err_t panel_rm67162_del(esp_lcd_panel_t *panel)
{
    rm67162_panel_t *rm67162 = __containerof(panel, rm67162_panel_t, base);
    if (rm67162->reset_gpio_num >= 0) {
        pinMode(rm67162->reset_gpio_num, OPEN_DRAIN);
    }
    log_d("del rm67162 panel @%p", rm67162);
    free(rm67162);
    return ESP_OK;
}

static esp_err_t panel_rm67162_reset(esp_lcd_panel_t *panel)
{
    rm67162_panel_t *rm67162 = __containerof(panel, rm67162_panel_t, base);
    esp_lcd_panel_io_handle


(!o||a.compare(u)===1)&&(o=u,a=new u5e(o,r))}),o};Dz.exports=f5e});var bz=_((dQt,xz)=>{var lN=Po(),p5e=Ml(),Sz=dI(),h5e=(t,e)=>{t=new p5e(t,e);let r=new lN("0.0.0");if(t.test(r)||(r=new lN("0.0.0-0"),t.test(r)))return r;r=null;for(let o=0;o<t.set.length;++o){let a=t.set[o],n=null;a.forEach(u=>{let A=new lN(u.semver.version);switch(u.operator){case">":A.prerelease.length===0?A.patch++:A.prerelease.push(0),A.raw=A.format();case"":case">=":(!n||Sz(A,n))&&(n=A);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${u.operator}`)}}),n&&(!r||Sz(r,n))&&(r=n)}return r&&t.test(r)?r:null};xz.exports=h5e});var Qz=_((mQt,kz)=>{var g5e=Ml(),d5e=(t,e)=>{try{return new g5e(t,e).range||"*"}catch{return null}};kz.exports=d5e});var DP=_((yQt,Nz)=>{var m5e=Po(),Rz=EI(),{ANY:y5e}=Rz,E5e=Ml(),C5e=wI(),Fz=dI(),Tz=yP(),w5e=CP(),I5e=EP(),B5e=(t,e,r,o)=>{t=new m5e(t,o),e=new E5e(e,o);let a,n,u,A,p;switch(r){case">":a=Fz,n=w5e,u=Tz,A=">",p=">=";break;case"<":a=Tz,n=I5e,u=Fz,A="<",p="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(C5e(t,e,o))return!1;for(let h=0;h<e.set.length;++h){let E=e.set[h],I=null,v=null;if(E.forEach(b=>{b.semver===y5e&&(b=new Rz(">=0.0.0")),I=I||b,v=v||b,a(b.semver,I.semver,o)?I=b:u(b.semver,v.semver,o)&&(v=b)}),I.operator===A||I.operator===p||(!v.operator||v.operator===A)&&n(t,v.semver))return!1;if(v.operator===p&&u(t,v.semver))return!1}return!0};Nz.exports=B5e});var Mz=_((EQt,Lz)=>{var v5e=DP(),D5e=(t,e,r)=>v5e(t,e,">",r);Lz.exports=D5e});var Uz=_((CQt,Oz)=>{var P5e=DP(),S5e=(t,e,r)=>P5e(t,e,"<",r);Oz.exports=S5e});var jz=_((wQt,Hz)=>{var _z=Ml(),x5e=(t,e,r)=>(t=new _z(t,r),e=new _z(e,r),t.intersects(e,r));Hz.exports=x5e});var Gz=_((IQt,qz)=>{var b5e=wI(),k5e=Ll();qz.exports=(t,e,r)=>{let o=[],a=null,n=null,u=t.sort((E,I)=>k5e(E,I,r));for(let E of u)b5e(E,e,r)?(n=E,a||(a=E)):(n&&o.push([a,n]),n=null,a=null);a&&o.push([a,null]);let A=[];for(


/
	getcon	TEA, r5
	_ptar	call_do_page_fault, t0
	beq	ZERO, ZERO, tr0

tlb_miss_store:
	or	SP, ZERO, r2
	movi	1, r3			/* Write */
	or	ZERO, ZERO, r4		/* Data */
	getcon	TEA, r5
	_ptar	call_do_page_fault, t0
	beq	ZERO, ZERO, tr0

itlb_miss_or_IRQ:
	_ptar	its_IRQ, t0
	beqi/u	r4, EVENT_INTERRUPT, t0
	or	SP, ZERO, r2
	or	ZERO, ZERO, r3		/* Read */
	movi	1, r4			/* Text */
	getcon	TEA, r5
	/* Fall through */

call_do_page_fault:
	_loada	do_page_fault, r6
        ptabs	r6, t0
        blink	t0, ZERO

fpu_error_or_IRQA:
	_ptar	its_IRQ, t0
	beqi/l	r4, EVENT_INTERRUPT, t0
#ifndef CONFIG_NOFPU_SUPPORT
	_loada	do_fpu_state_restore, r6
#else
	_loada	do_exception_error, r6
#endif
	ptabs	r6, t0
	blink	t0, ZERO

fpu_error_or_IRQB:
	_ptar	its_IRQ, t0
	beqi/l	r4, EVENT_INTERRUPT, t0
#ifndef CONFIG_NOFPU_SUPPORT
	_loada	do_fpu_state_restore, r6
#else
	_loada	do_exception_error, r6
#endif
	ptabs	r6, t0
	blink	t0, ZERO

its_IRQ:
	_loada	do_IRQ, r6
	ptabs	r6, t0
	blink	t0, ZERO

/*
 * system_call/unknown_trap third level handler:
 *
 * Inputs:
 * (r2)   fault/interrupt code, entry number (TRAP = 11)
 * (r3)   struct pt_regs *, original register's frame pointer
 * (r4)   Not used. Event (0=interrupt, 1=TLB miss fault, 2=Not TLB miss fault)
 * (r5)   TRA Control Reg (0x00xyzzzz: x=1 SYSCALL, y = #args, z=nr)
 * (SP)   = r3
 * (LINK) return address: ret_from_exception
 * (*r3)  Syscall parms: SC#, arg0, arg1, ..., arg5 in order (Saved r2/r7)
 *
 * Outputs:
 * (*r3)  Syscall reply (Saved r2)
 * (LINK) In case of syscall only it can be scrapped.
 *        Common second level post handler will be ret_from_syscall.
 *        Common (non-trace) exit point to that is syscall_ret (saving
 *        result to r2). Common bad exit point is syscall_bad (returning
 *        ENOSYS then saved to r2).
 *
 */

unknown_trap:
	/* Unknown Trap or User Trace */
	_loada	do_unknown_trapa, r6
	ptabs	r6, t0
        ld.q    r3, FRAME_R(9), r2	/* r2 = #arg << 16 | syscall # */
        andi    r2, 0x1ff, r2		/* r2 = syscall # */
	blink	t0, LINK

	_ptar	syscall_ret, t0
	blink	t0, ZERO

        /* New syscall implementation*/
system_call:
	_ptar	unknown_trap, t0
        or      r5, ZERO, r4            /* TRA (=r5) ->


_SEARCH: u16 = 217;
pub const KEY_CONNECT: u16 = 218;
pub const KEY_FINANCE: u16 = 219;
pub const KEY_SPORT: u16 = 220;
pub const KEY_SHOP: u16 = 221;
pub const KEY_ALTERASE: u16 = 222;
pub const KEY_CANCEL: u16 = 223;
pub const KEY_BRIGHTNESSDOWN: u16 = 224;
pub const KEY_BRIGHTNESSUP: u16 = 225;
pub const KEY_MEDIA: u16 = 226;
pub const KEY_SWITCHVIDEOMODE: u16 = 227;
pub const KEY_KBDILLUMTOGGLE: u16 = 228;
pub const KEY_KBDILLUMDOWN: u16 = 229;
pub const KEY_KBDILLUMUP: u16 = 230;
pub const KEY_SEND: u16 = 231;
pub const KEY_REPLY: u16 = 232;
pub const KEY_FORWARDMAIL: u16 = 233;
pub const KEY_SAVE: u16 = 234;
pub const KEY_DOCUMENTS: u16 = 235;
pub const KEY_BATTERY: u16 = 236;
pub const KEY_BLUETOOTH: u16 = 237;
pub const KEY_WLAN: u16 = 238;
pub const KEY_UWB: u16 = 239;
pub const KEY_UNKNOWN: u16 = 240;
pub const KEY_VIDEO_NEXT: u16 = 241;
pub const KEY_VIDEO_PREV: u16 = 242;
pub const KEY_BRIGHTNESS_CYCLE: u16 = 243;
pub const KEY_BRIGHTNESS_AUTO: u16 = 244;
pub const KEY_BRIGHTNESS_ZERO: u16 = KEY_BRIGHTNESS_AUTO;
pub const KEY_DISPLAY_OFF: u16 = 245;
pub const KEY_WWAN: u16 = 246;
pub const KEY_WIMAX: u16 = KEY_WWAN;
pub const KEY_RFKILL: u16 = 247;
pub const KEY_MICMUTE: u16 = 248;
extern crate wsdclient;

use wsdclient::config::Config;
use crate::wsdclient::types::WSDEnum;
use wsdclient::client::get_diagram;
use std::fs::File;
use std::io::{Read, Write, stdin};
use std::error::Error;

fn main() -> Result<(), Box<Error>> {
    // TODO(mkl): add option to print requests and responses
    let config = Config::from_command_line()
        .map_err(|err| format!("error parsing command line options: {:?}", err))?;

    let mut diagram: Vec<u8> = vec![];
    if let Some(ref input_file) = config.input_file {
        File::open(input_file)
            .map_err(|err| format!("error opening input file {} : {:?}", input_file, err))?
            .read_to_end(&mut diagram)
            .map_err(|err| format!("error reading input file {} : {:?}", input_file, err))?;
    } else {
        stdin()
            .read_to_end(& mut diagram)
            .map_err(|err| format!("error reading from STDIN: {:?}", err))?;
    }

    let diagram_str = String::from_utf8_lossy(&diagram[..]);
    let result = get_diagram(&diagram_str, &config.plot_parameters)
        .map_err(|err| format!("error getting diagram: {:?}", err))?;

    if result.actual_format != config.plot_parameters.format {
        let error_msg = format!("WARNING: Actual format `{}` is different from requested format `{}`\nMaybe you do not provide correct api_key for premium features (like pdf or svg formats)", result.actual_format.wsd_value(), config.plot_parameters.format.wsd_value());
        if config.is_errors_fatal {
            return Err(error_msg.into())
        } else {
            eprintln!("{}", error_msg);
        }
    }

    if !result.errors.is_empty() {
        let lines = diagram_str.split('\n').collect::<Vec<&str>>();
        // There is a bug in websequencediagrams
        // i


(0), $129 = Math_fround(0), $130 = Math_fround(0), $131 = Math_fround(0), $132 = Math_fround(0), $133 = Math_fround(0), $134 = Math_fround(0), $135 = Math_fround(0), $136 = Math_fround(0), $137 = Math_fround(0), $138 = Math_fround(0), $139 = Math_fround(0), $140 = Math_fround(0), $141 = Math_fround(0), $142 = Math_fround(0), $143 = Math_fround(0), $144 = Math_fround(0), $145 = Math_fround(0), $146 = Math_fround(0);
  $5 = global$0 - 16 | 0;
  global$0 = $5;
  HEAP32[$5 + 12 >> 2] = $0;
  label$1 : {
   if (!(($2 | 0) != ($4 | 0) | $2 >>> 0 < 31)) {
    $4 = $2;
    $0 = $5 + 12 | 0;
    $86 = global$0 - 16 | 0;
    global$0 = $86;
    $102 = $2;
    if (!($2 >>> 0 < 31 | $2 >>> 0 < 31)) {
     label$10 : {
      $25 = HEAP32[$0 >> 2];
      $0 = $2;
      while (1) {
       HEAP32[$86 + 12 >> 2] = 31;
       HEAP32[$86 + 4 >> 2] = 31;
       HEAP32[$86 + 8 >> 2] = $3 + $103;
       HEAP32[$86 >> 2] = $1 + $103;
       $10 = HEAPF32[$25 + 116 >> 2];
       $26 = HEAPF32[$25 + 108 >> 2];
       $27 = HEAPF32[$25 + 100 >> 2];
       $28 = HEAPF32[$25 + 92 >> 2];
       $29 = HEAPF32[$25 + 84 >> 2];
       $30 = HEAPF32[$25 + 76 >> 2];
       $31 = HEAPF32[$25 + 68 >> 2];
       $32 = HEAPF32[$25 + 60 >> 2];
       $33 = HEAPF32[$25 + 52 >> 2];
       $34 = HEAPF32[$25 + 44 >> 2];
       $35 = HEAPF32[$25 + 36 >> 2];
       $36 = HEAPF32[$25 + 28 >> 2];
       $37 = HEAPF32[$25 + 20 >> 2];
       $38 = HEAPF32[$25 + 12 >> 2];
       $6 = HEAP32[$86 >> 2];
       $54 = HEAPF32[$6 + 132 >> 2];
       $87 = HEAPF32[$6 + 124 >> 2];
       $55 = HEAPF32[$6 + 140 >> 2];
       $88 = HEAPF32[$6 + 116 >> 2];
       $56 = HEAPF32[$6 + 148 >> 2];
       $89 = HEAPF32[$6 + 108 >> 2];
       $57 = HEAPF32[$6 + 156 >> 2];
       $90 = HEAPF32[$6 + 100 >> 2];
       $58 = HEAPF32[$6 + 164 >> 2];
       $91 = HEAPF32[$6 + 92 >> 2];
       $59 = HEAPF32[$6 + 172 >> 2];
       $92 = HEAPF32[$6 + 84 >> 2];
       $60 = HEAPF32[$6 + 180 >> 2];
       $93 = HEAPF32[$6 + 76 >> 2];
       $61 = HEAPF32[$6 + 188 >> 2];
       $94 = HEAPF32[$6 + 68 >> 2];
       $62 = HEAPF32[$6 + 196 >> 2];
       $95 = HEAPF32[$6 + 60 >> 2];
       $63 = HEAPF32[$6 + 204 >> 2];
       $96 = HEAPF32[$6 + 52 >> 2];
       $64 = HEAPF32[$6 + 212 >> 2];
       $97 = HEAPF32[$6 + 44 >> 2];
       $65 = HEAPF32[$6 + 220 >


<typename _Tp, int n>
inline void v_store_aligned_nocache(_Tp* ptr, const v_reg<_Tp, n>& a)
{
    CV_Assert(isAligned<sizeof(v_reg<_Tp, n>)>(ptr));
    v_store(ptr, a);
}

template<typename _Tp, int n>
inline void v_store_aligned(_Tp* ptr, const v_reg<_Tp, n>& a, hal::StoreMode /*mode*/)
{
    CV_Assert(isAligned<sizeof(v_reg<_Tp, n>)>(ptr));
    v_store(ptr, a);
}

/** @brief Combine vector from first elements of two vectors

Scheme:
@code
  {A1 A2 A3 A4}
  {B1 B2 B3 B4}
---------------
  {A1 A2 B1 B2}
@endcode
For all types except 64-bit. */
template<typename _Tp, int n>
inline v_reg<_Tp, n> v_combine_low(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
{
    v_reg<_Tp, n> c;
    for( int i = 0; i < (n/2); i++ )
    {
        c.s[i] = a.s[i];
        c.s[i+(n/2)] = b.s[i];
    }
    return c;
}

/** @brief Combine vector from last elements of two vectors

Scheme:
@code
  {A1 A2 A3 A4}
  {B1 B2 B3 B4}
---------------
  {A3 A4 B3 B4}
@endcode
For all types except 64-bit. */
template<typename _Tp, int n>
inline v_reg<_Tp, n> v_combine_high(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
{
    v_reg<_Tp, n> c;
    for( int i = 0; i < (n/2); i++ )
    {
        c.s[i] = a.s[i+(n/2)];
        c.s[i+(n/2)] = b.s[i+(n/2)];
    }
    return c;
}

/** @brief Combine two vectors from lower and higher parts of two other vectors

@code{.cpp}
low = cv::v_combine_low(a, b);
high = cv::v_combine_high(a, b);
@endcode */
template<typename _Tp, int n>
inline void v_recombine(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b,
                        v_reg<_Tp, n>& low, v_reg<_Tp, n>& high)
{
    for( int i = 0; i < (n/2); i++ )
    {
        low.s[i] = a.s[i];
        low.s[i+(n/2)] = b.s[i];
        high.s[i] = a.s[i+(n/2)];
        high.s[i+(n/2)] = b.s[i+(n/2)];
    }
}

/** @brief Vector reverse order

Reverse the order of the vector
Scheme:
@code
  REG {A1 ... An} ==> REG {An ... A1}
@endcode
For all types. */
template<typename _Tp, int n>
inline v_reg<_Tp, n> v_reverse(const v_reg<_Tp, n>& a)
{
    v_reg<_Tp, n> c;
    for( int i = 0; i < n; i++ )
        c.s[i] = a.s[n-i-1];
    return c;
}

/** @brief Vector extract

Scheme:
@code
  {A1 A2 A3 A4}
  {B1 B2 B3 B4}
========================
shift = 1  {A2 A3 A4 B1}
shift = 2  {A3 A4 B1 B2}
shift = 3  {A4 B1 B2 B3}
@endcode
Rest


LS 和 PPT 加载器](https://github.com/langchain4j/langchain4j-examples/blob/main/other-examples/src/main/java/DocumentLoaderExamples.java) 由 [@oognuyh](https://github.com/oognuyh) 贡献
- [每个用户的单独聊天记忆](https://github.com/langchain4j/langchain4j-examples/blob/main/other-examples/src/main/java/ServiceWithMemoryForEachUserExample.java)
- [自定义进程内嵌入模型](https://github.com/langchain4j/langchain4j-examples/blob/main/other-examples/src/main/java/embedding/model/InProcessEmbeddingModelExamples.java)
- 添加了大量 Javadoc
- 添加了 `DocumentTransformer` 及其第一个实现：`HtmlTextExtractor`
- `OpenAiTokenizer` 现在更加精确，可以估计工具/函数的 token
- 在 `OpenAiChatModel` 和 `OpenAiStreamingChatModel` 中添加了强制执行工具/函数的选项
- 一些 bug 修复和改进

### 详细解释

1. **Weaviate 集成**：
   - Weaviate 是一个开源的向量搜索引擎，用于存储和查询嵌入向量。通过与 Weaviate 的集成，`langchain4j` 项目现在可以使用 Weaviate 作为嵌入存储，从而增强了向量搜索和检索的能力。

2. **DOC、XLS 和 PPT 加载器**：
   - 这些加载器（Document Loaders）用于从 DOC、XLS 和 PPT 文件中加载文档。通过添加这些加载器，`langchain4j` 项目现在可以处理更多类型的文档，从而扩展了其应用范围。

3. **每个用户的单独聊天记忆**：
   - 通过为每个用户提供单独的聊天记忆，系统可以更好地管理用户之间的对话历史，确保每个用户的对话上下文独立且一致。

4. **自定义进程内嵌入模型**：
   - 自定义进程内嵌入模型允许开发者使用自定义的嵌入模型，而无需外部依赖。这提高了系统的灵活性和可定制性。

5. **添加了大量 Javadoc**：
   - Javadoc 是 Java 的文档生成工具，用于生成代码文档。通过添加大量 Javadoc，`langchain4j` 项目的文档更加完善，有助于开发者更好地理解和使用项目。

6. **DocumentTransformer 及其第一个实现：HtmlTextExtractor**：
   - `DocumentTransformer` 是一个用于转换文档的接口，`HtmlTextExtractor` 是其第一个实现，用于从 HTML 文档中提取文本。这增强了项目处理不同格式文档的能力。

7. **Open


can also control volume of both.
 *
 * @author Almas Baimagambetov (AlmasB) (almaslvl@gmail.com)
 */
class AudioPlayer : EngineService() {

    private val log = Logger.get(javaClass)

    private val activeMusic = UnorderedArray<Music>()
    private val activeSounds = UnorderedArray<Sound>()

    @Inject("globalMusicVolumeProperty")
    private lateinit var musicVolume: DoubleProperty

    @Inject("globalSoundVolumeProperty")
    private lateinit var soundVolume: DoubleProperty

    @Inject("isPauseMusicWhenMinimized")
    private var isPauseMusicWhenMinimized = true

    private val loader = DesktopAndMobileAudioLoader()

    override fun onMainLoopStarting() {
        musicVolume.addListener { _, _, newVolume ->
            activeMusic.forEach { it.audio.setVolume(newVolume.toDouble()) }
        }

        soundVolume.addListener { _, _, newVolume ->
            activeSounds.forEach { it.audio.setVolume(newVolume.toDouble()) }
        }
    }

    override fun onMainLoopPausing() {
        if (isPauseMusicWhenMinimized) {
            pauseAllMusic()
        }
    }

    override fun onMainLoopResumed() {
        if (isPauseMusicWhenMinimized) {
            resumeAllMusic()
        }
    }

    override fun onUpdate(tpf: Double) {
        activeMusic.removeAll { it.isDisposed }
        activeSounds.removeAll { it.isDisposed }
    }

    /**
     * Plays given sound based on its properties.
     *
     * @param sound sound to play
     */
    fun playSound(sound: Sound) {
        if (!activeSounds.containsByIdentity(sound))
            activeSounds.add(sound)

        sound.audio.setVolume(soundVolume.value)
        sound.audio.play()
    }

    /**
     * Stops playing given sound.
     *
     * @param sound sound to stop
     */
    fun stopSound(sound: Sound) {
        sound.audio.stop()
    }

    /**
     * Stops all sounds from playing
     */
    fun stopAllSounds() {
        activeSounds.forEach { stopSound(it) }
    }

    /**
     * Plays given music based on its properties.
     *
     * @param music music to play
     */
    fun playMusic(music: Music) {
        log.debug("Playing music $music")

        if (!activeMusic.containsByIdentity(music)) {
            activeMusic.add(music)
        }

        music.audio.setVolume(musicVolume.value)
        music.audio.play()
    }

    /**
     * Pauses given music if it was previously started with [playMusic].
     * It can then be restarted by [resumeMusic].
     *
     * @param music music to pause
     */
    fun pauseMusic(music: Music) {
        log.debug("Pausing music $music")

        music.audio.pause()
    }

    /**
     * Resumes previously paused with [pauseMusic] music.
     *
     * @param music music to resume
     */
    fun resumeMusic(music: Music) {
        log.debug("Resuming music $music")

        music.audio.play()
    }

    /**
     * Stops currently playing music. It cannot be restarted
     * using [resumeMusic]. The music object needs
     * to be started again by [playMusic].


dinal(self)]

	// This primitive type is a supertype of aSetType if and only if this
	// primitive type is a supertype of NONTYPE.
	override fun o_IsSupertypeOfSetType(
		self: AvailObject,
		aSetType: A_Type): Boolean =
			self.isSupertypeOfPrimitiveTypeEnum(NONTYPE)

	// This primitive type is a supertype of aTupleType if and only if this
	// primitive type is a supertype of NONTYPE.
	override fun o_IsSupertypeOfTupleType(
		self: AvailObject,
		aTupleType: A_Type): Boolean =
			self.isSupertypeOfPrimitiveTypeEnum(NONTYPE)

	override fun o_IsSupertypeOfEnumerationType(
		self: AvailObject,
		anEnumerationType: A_Type): Boolean =
			topMeta().isSubtypeOf(self)

	@ThreadSafe
	override fun o_IsTop(self: AvailObject): Boolean = self.sameAddressAs(TOP.o)

	override fun o_MarshalToJava(self: AvailObject, classHint: Class<*>?): Any?
	{
		for (type in all)
		{
			if (self.equals(type.o))
			{
				return when (type)
				{
					TOP -> Void::class.java
					ANY -> Any::class.java
					DOUBLE -> Double::class.javaPrimitiveType
					FLOAT -> Float::class.javaPrimitiveType
					ABSTRACT_DEFINITION, ATOM, CHARACTER,
					DEFINITION_PARSING_PLAN, FORWARD_DEFINITION,
					LEXER, MACRO_DEFINITION, MESSAGE_BUNDLE,
					MESSAGE_BUNDLE_TREE, METHOD,
					METHOD_DEFINITION, MODULE, NONTYPE,
					NUMBER, PARSING_PLAN_IN_PROGRESS,
					RAW_POJO, DEFINITION, TOKEN ->
						super.o_MarshalToJava(self, classHint)
				}
			}
		}
		assert(false) {
			"All cases have been dealt with, and each forces a return"
		}
		throw RuntimeException()
	}

	override fun o_RangeIncludesLong(self: AvailObject, aLong: Long): Boolean =
		self.isSupertypeOfPrimitiveTypeEnum(NUMBER)

	// Most of the primitive types are already handled as special objects,
	// so this only kicks in as a backup.
	override fun o_SerializerOperation(self: AvailObject): SerializerOperation =
		SerializerOperation.ARBITRARY_PRIMITIVE_TYPE

	override fun o_TypeIntersection(self: AvailObject, another: A_Type): A_Type =
		another.typeIntersectionOfPrimitiveTypeEnum(extractEnum(self))

	override fun o_TypeIntersectionOfListNodeType(
		self: AvailObject,
		aListNodeType: A_Type): A_Type =
			if (NONTYPE.superTests[extractOrdinal(self)]) aListNodeType
			else bottom

	override fun o_TypeIntersectionOfPhraseType(
		self: AvailObject,
		aPhraseType: A_Type): A_Type =
			if (NONTYPE.superTests[extractOrdinal(self)]) aPhraseType
			else bottom

	override fun o_TypeIntersectionOfPrimitiveTypeEnum(
		self: AvailObject,
		primitiveTypeEnum: Types): A_Type =
			primitiveTypeEnum.intersectionTypes[extractOrdinal(self)]!!

	override fun o_TypeUnion(self: AvailObject, another: A_Type): A_Type =
		another.typeUnionOfPrimitiveTypeEnum(extractEnum(self))

	override fun o_TypeUnionOfPrimitiveTypeEnum(
		self: AvailObject,
		primitiveTypeEnum: Types): A_Type =
			primitiveTypeEnum.unionTypes[extractOrdinal(self)]!!

	override fun o_WriteTo(self: AvailObject, writer: JSONWriter)
	{
		writer.startObject()
		writer.write("kind")
		writer.write("${self[NAME].asNativeString().lowercase()} type")
		writer.endObject()
	}

	/**
	 * Complete the given partially-


pdating values
	local data = {
		values = {}
	}

	-- Create custom widget
	--------------------------------------------------------------------------------
	local chartwidg = wibox.widget.base.make_widget()

	-- User functions
	------------------------------------------------------------
	function chartwidg:set_value(x)
		if barnum then
			count = count % barnum + 1
			data.values[count] = x
			self:emit_signal("widget::redraw_needed")
		end
	end

	-- Fit function
	------------------------------------------------------------
	function chartwidg:fit(_, width, height)
		return style.width or width, style.height or height
	end

	-- Draw function
	------------------------------------------------------------
	function chartwidg:draw(_, cr, width, height)

		--scale
		if style.autoscale then
			current_maxm = style.maxm

			for _, v in ipairs(data.values) do
				if v > current_maxm then current_maxm = v end
			end
		end

		-- chart
		barnum = math.floor((width + style.bar.gap) / (style.bar.width + style.bar.gap))
		while #data.values < barnum do
			table.insert(data.values, 0)
		end
		local real_gap = style.bar.gap + (width - (barnum - 1) * (style.bar.width + style.bar.gap)
		                 - style.bar.width) / (barnum - 1)

		cr:set_source(color(style.color))
		for i = 0, barnum - 1 do
			local n = (count + i) % barnum + 1
			local k = data.values[n] / current_maxm
			if k > 1 then k = 1 end
			local bar_height = - k * (height - style.zero_height)
			cr:rectangle(i * (style.bar.width + real_gap), height, style.bar.width, - style.zero_height)
			cr:rectangle(i * (style.bar.width + real_gap), height - style.zero_height, style.bar.width, bar_height)
		end

		cr:fill()
	end

	--------------------------------------------------------------------------------
	return chartwidg
end

-- Config metatable to call chart module as function
-----------------------------------------------------------------------------------------------------------------------
function chart.mt:__call(...)
	return chart.new(...)
end

return setmetatable(chart, chart.mt)


}",
		{ label = "Life Flask Charges/s", modName = "LifeFlaskChargesGenerated", modType = "BASE"},
		{ label = "Generic Flask Charges/s", modName = "FlaskChargesGenerated", modType = "BASE" }}, },
} }, { defaultCollapsed = true, label = "Mana Flasks", color = colorCodes.MANA, data = {
	extra = "{2:output:ManaFlaskChargeGen}/s",
	{ label = "Inc. Recovery", { format = "{0:mod:1}%", { modName = "FlaskManaRecovery", modType = "INC"}}, },
	{ label = "More Recovery", { format = "{0:mod:1}%", { modName = "FlaskManaRecovery", modType = "MORE"}}, },
	{ label = "Inc. Recovery Rate", { format = "{0:mod:1,2}%",
		{ label = "Mana Flask Recovery Rate", modName = "FlaskManaRecoveryRate", modType = "INC"},
		{ label = "Generic Flask Recovery Rate", modName = "FlaskRecoveryRate", modType = "INC" }}, },
	{ label = "Inc. Charges Gain", { format = "{0:mod:1}%", { modName = { "FlaskChargesGained", "ManaFlaskChargesGained" }, modType = "INC" }, }, },
	{ label = "Inc. Charges Used", { format = "{0:mod:1}%", { modName = { "FlaskChargesUsed", "ManaFlaskChargesUsed" }, modType = "INC" }, }, },
	{ label = "Charges/s", { format = "{2:mod:1,2}",
		{ label = "Mana Flask Charges/s", modName = "ManaFlaskChargesGenerated", modType = "BASE"},
		{ label = "Generic Flask Charges/s", modName = "FlaskChargesGenerated", modType = "BASE" }}, },
} }, { defaultCollapsed = true, label = "Charms", data = {
	extra = "+{0:output:CharmEffect}%, {0:output:CharmLimit}",
	{ label = "Charm Limit", { format = "{0:mod:1}", { modName = "CharmLimit", modType = "BASE"}, }, },
	{ label = "Inc. Effect", { format = "{0:mod:1}%", { modName = "CharmEffect", modType = "INC", actor = "player"}, }, },
	{ label = "Inc. Duration", { format = "{0:mod:1}%", { modName = "CharmDuration", modType = "INC" }, }, },
	{ label = "Inc. Charges Gain", { format = "{0:mod:1}%", { modName = "CharmChargesGained", modType = "INC" }, }, },
	{ label = "Inc. Charges Used", { format = "{0:mod:1}%", { modName = "CharmChargesUsed", modType = "INC" }, }, },
	{ label = "Charges/s", { format = "{2:mod:1}", { modName = "CharmChargesGenerated", modType = "BASE" }, }, },
} },
} },
{ 1, "Rage", 3, colorCodes.RAGE, {{ defaultCollapsed = true, label = "Rage", data = {
	extra = "{0:output:Rage} ({1:output:RageEffect})",
	{ label = "Total", { format = "{0:output:Rage}", }, },
	{ label = "Rage Effect", { format = "{1:output:RageEffect}", { modName = "RageEffect" }, }, },
	{ label = "Maximum Rage", { format = "{0:output:MaximumRage}", { modName = "MaximumRage" }, }, },
	{ label = "Recovery", { format = "{1:output:RageRegenRecovery} ({1:output:RageRegenPercent}%)",
		{ breakdown = "RageRegenRecovery" },
		{ label = "Sources", modName = { "RageRegen", "Ra


lear: both;
      content: "";
      background-color: var(--pure-theme-menu-active-before);
      transition: all var(--pure-transition-duration) ease-in-out;
      transform: translateY(0);
    }

    .el-menu--collapse .outer-most.el-sub-menu > .el-sub-menu__title::before {
      position: absolute;
      top: 50%;
      display: block;
      width: 3px;
      height: 0;
      content: "";
      transform: translateY(-50%);
    }

    /* 无子集的激活菜单背景 */
    .is-active.submenu-title-noDropdown.outer-most > * {
      z-index: 1;
      color: #fff;
    }

    .is-active.submenu-title-noDropdown.outer-most::before {
      position: absolute;
      inset: 0 8px;
      margin: 4px 0;
      clear: both;
      content: "";
      background: var(--el-color-primary) !important;
      border-radius: 3px;
    }
  }

  /* vertical 菜单折叠 */
  .el-menu--vertical {
    .el-menu--popup {
      background-color: var(--pure-theme-sub-menu-bg) !important;

      .el-menu-item {
        span {
          font-size: 14px;
        }
      }
    }

    & > .el-menu {
      i,
      svg {
        margin-right: 5px;
      }
    }

    .is-active > .el-sub-menu__title,
    .is-active.submenu-title-noDropdown {
      color: var(--pure-theme-sub-menu-active-text) !important;

      i {
        color: var(--pure-theme-sub-menu-active-text) !important;
      }
    }

    /* 子菜单中还有子菜单 */
    .el-menu .el-sub-menu__title {
      min-width: $sideBarWidth !important;
      font-size: 14px;
      background-color: var(--pure-theme-sub-menu-bg) !important;
    }

    .el-menu-item,
    .el-sub-menu__title {
      height: 50px;
      line-height: 50px;
      color: var(--pure-theme-menu-text);
      background-color: var(--pure-theme-sub-menu-bg);

      &:hover {
        color: var(--pure-theme-menu-title-hover) !important;
      }
    }

    .is-active {
      color: var(--pure-theme-sub-menu-active-text) !important;
      transition: color 0.3s;
    }

    .el-menu-item.is-active.nest-menu > * {
      z-index: 1;
      color: #fff;
    }

    .el-menu-item.is-active.nest-menu::before {
      position: absolute;
      inset: 0 8px;
      clear: both;
      content: "";
      background: var(--el-color-primary) !important;
      border-radius: 3px;
    }

    .el-menu-item,
    .el-sub-menu {
      .iconfont {
        font-size: 18px;
      }

      .el-menu-tooltip__trigger {
        width: 54px;
        padding: 0;
      }
    }
  }

  /* horizontal 菜单 */
  .el-menu--horizontal {
    & > .el-sub-menu .el-sub-menu__icon-arrow {
      position: static !important;
      margin-top: 0;
    }

    /* 无子菜单时激活 border-bottom */
    a > .is-active.submenu-title-noDropdown {
      border-bottom: 2px solid var(--el-menu-active-color);
    }

    .el-menu--


 4, 5]，3 是不好的数，则 3，4，5 都是不好的数。求第一个出现的不好的数
 * （已提供一个函数 isBadVersion，代入数字即可判断是否是不好的数）
 */

/**
 * 思路：
 * 二分法
 */

/**
 * Definition for isBadVersion()
 *
 * @param {integer} version number
 * @return {boolean} whether the version is bad
 * isBadVersion = function(version) {
 *     ...
 * };
 */

// [1., 2]
// start = 0, end = 1, mid = (1 - 0) / 2 + 0 -> 1
// start = 0, end = 0, mid = 0

// [1, 2, 3, 4, 5, 6, 7, 8., 9., 10., 11.]
// start = 0; end = 10; mid = (10 - 0) / 2 + 0 -> 5
// start = 6, end = 10, mid = (9 - 6) / 2 + 6 -> 8
// start = 6, end = 7
// start = 9, end = 9, mid = (9 - 9) / 2 + 8 => 9
/**
 * @param {function} isBadVersion()
 * @return {function}
 */
var solution = function(isBadVersion) {
  /**
   * @param {integer} n Total versions
   * @return {integer} The first bad version
   */
  return function(n) {
    var start = 0;
    var end = n - 1;
    var result = 0;
    while(true) {
      var mid = Math.ceil((end - start) / 2) + start;
      var isBad = isBadVersion(mid + 1);
      if (!isBad) {
        start = mid + 1;
      } else {
        result = mid + 1;
        end = mid - 1;
      }
      if (start > end) {
        result = isBad ? mid + 1 : result;
        break;
      }
    }
    return result;
  };
};/**
 * Difficulty:
 * Easy
 *
 * Desc:
 * In a deck of cards, each card has an integer written on it.
 * Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more groups of cards, where:
 *
 * Each group has exactly X cards.
 * All the cards in each group have the same integer.
 *
 * Example 1:
 * Input: deck = [1,2,3,4,4,3,2,1]
 * Output: true
 * Explanation: Possible partition [1,1],[2,2],[3,3],[4,4].
 *
 * Example 2:
 * Input: deck = [1,1,1,2,2,2,3,3]
 * Output: false´
 * Explanation: No possible partition.
 *
 * Example 3:
 * Input: deck = [1]
 * Output: false
 * Explanation: No possible partition.
 *
 * Example 4:
 * Input: deck = [1,1]
 * Output: true
 * Explanation: Possible partition [1,1].
 *
 * Example 5:
 * Input: deck = [1,1,2,2,2,2]
 * Output: true
 * Explanation: Possible partition [1,1],[2,2],[2,2].
 *
 * Constraints:
 * 1. 1 <= deck.length <= 10^4
 * 2. 0 <= deck[i] < 10^4
 *
 * 给定一副牌，每张牌上都写着一个整数。
 * 此时，你需要选定一个数字 X，使我们可以将整副牌按下述规则分成 1 组或更多组：
 * 1. 每组都有 X 张牌。
 * 2. 组内所有的牌上都写着相同的整数。
 * 仅当你可选的 X >= 2 时返回 true。
 */

/**
 * @param {number[]} deck
 * @return {boolean}
 */
var hasGroupsSizeX = function(deck) {
  deck.sort((n1, n2) => n1 - n2)
  let i


    max_range_ = _sdf->GetElement("max_range")->Get<double>();
  }

  if (!_sdf->HasElement("topicName")) {
    ROS_INFO("Velodyne laser plugin missing <topicName>, defaults to /world");
    topic_name_ = "/world";
  } else {
    topic_name_ = _sdf->GetElement("topicName")->Get<std::string>();
  }

  if (!_sdf->HasElement("gaussianNoise")) {
    ROS_INFO("Velodyne laser plugin missing <gaussianNoise>, defaults to 0.0");
    gaussian_noise_ = 0;
  } else {
    gaussian_noise_ = _sdf->GetElement("gaussianNoise")->Get<double>();
  }

  // Make sure the ROS node for Gazebo has already been initialized
  if (!ros::isInitialized()) {
    ROS_FATAL_STREAM("A ROS node for Gazebo has not been initialized, unable to load plugin. "
      << "Load the Gazebo system plugin 'libgazebo_ros_api_plugin.so' in the gazebo_ros package)");
    return;
  }

  rosnode_ = new ros::NodeHandle(robot_namespace_);

  // resolve tf prefix
  std::string prefix;
  rosnode_->getParam(std::string("tf_prefix"), prefix);
  frame_name_ = tf::resolve(prefix, frame_name_);

  if (topic_name_ != "") {
    // Custom Callback Queue
    ros::AdvertiseOptions ao = ros::AdvertiseOptions::create<sensor_msgs::PointCloud2>(
      topic_name_,1,
      boost::bind( &GazeboRosVelodyneLaser::laserConnect,this),
      boost::bind( &GazeboRosVelodyneLaser::laserDisconnect,this), ros::VoidPtr(), &laser_queue_);
    pub_ = rosnode_->advertise(ao);
  }

  // sensor generation off by default
  parent_ray_sensor_->SetActive(false);
  // start custom queue for laser
  callback_laser_queue_thread_ = boost::thread( boost::bind( &GazeboRosVelodyneLaser::laserQueueThread,this ) );

#if GAZEBO_MAJOR_VERSION >= 7
  ROS_INFO("Velodyne laser plugin ready, %i lasers", parent_ray_sensor_->VerticalRangeCount());
#else
  ROS_INFO("Velodyne laser plugin ready, %i lasers", parent_ray_sensor_->GetVerticalRangeCount());
#endif
}

////////////////////////////////////////////////////////////////////////////////
// Increment count
void GazeboRosVelodyneLaser::laserConnect()
{
  laser_connect_count_++;
  parent_ray_sensor_->SetActive(true);
}
////////////////////////////////////////////////////////////////////////////////
// Decrement count
void GazeboRosVelodyneLaser::laserDisconnect()
{
  laser_connect_count_--;
  if (laser_connect_count_ == 0) {
    parent_ray_sensor_->SetActive(false);
  }
}

////////////////////////////////////////////////////////////////////////////////
// Update the controller
void GazeboRosVelodyneLaser::OnNewLaserScans()
{
  if (topic_name_ != "") {
#if GAZEBO_MAJOR_VERSION >= 7
    common::Time sensor_update_time = parent_sensor_->LastUpdateTime();
#else
    common::Time sensor_update_time = parent_sensor_->GetLastUpdateTime();
#endif
    if (last_update_time_ < sensor_update_time) {
      putLaserData(sensor_update_time);
      last_update_time_ = sensor_update_time;
    }
  } else {
    ROS_INFO("gazebo_ros_velodyne_laser topic name not set");
  }
}

////////////////////////////////////////////////////////////////////////////////
// Put laser data to the interface
void GazeboRosVelodyneLaser::putLaserData(common::Time &_updateTime)
{
  int i, hja, hjb;
  int j, vja, vjb;
  double


82007|M|64.46,18.86|Z|2215;Hallowfall|N|From Attica Whiskervale.|
A Tale of Tails|QID|82007|M|64.46,18.86|Z|2215;Hallowfall|N|From Attica Whiskervale. Ask about Captain Lancekat and continue to ask questions until this quest comes up.|

C Tale of Tails|QID|82007|M|66.66,21.08|Z|2215;Hallowfall|QO|4|T|Cap'n Elaena|
C Glow in the Dark|QID|76169|M|65.79,18.84|Z|2215;Hallowfall|QO|1|U|219198|
C Glow in the Dark|QID|76169|M|0.0,0.0|Z|2215;Hallowfall|QO|3|S|
C Lizard Looters|QID|81632|M|0.0,0.0|Z|2215;Hallowfall|QO|1|N|Camp Supplies recovered.|S|

C Tale of Tails|QID|82007|M|66.31,15.69|Z|2215;Hallowfall|QO|1|T|Beef|U|219198|

C Glow in the Dark|QID|76169|M|66.18,15.14;65.96,16.23;65.79,18.84|Z|2215;Hallowfall|QO|2|CC|U|219198|
C Glow in the Dark|QID|76169|M|65.79,18.84|Z|2215;Hallowfall|QO|3|US|U|219198|

C Lizard Looters|QID|81632|M|65.75,18.81;65.80,20.45;64.47,21.08;63.98,21.16;63.60,18.43;63.44,19.65|Z|2215;Hallowfall|QO|2|CS|
C Tale of Tails|QID|82007|M|63.90,19.70|Z|2215;Hallowfall|QO|2|CS|T|Beans|
C Lizard Looters|QID|81632|M|62.68,20.24|Z|2215;Hallowfall|QO|2|CS|

C Lizard Looters|QID|81632|M|61.67,20.94|Z|2215;Hallowfall|QO|2|N|Reekscale slain.|
C Lizard Looters|QID|81632|M|61.64,20.26|Z|2215;Hallowfall|QO|1|NC|N|Camp Supplies recovered.|US|
C Tale of Tails|QID|82007|M|61.95,20.83|Z|2215;Hallowfall|QO|3|T|Thunder|
T Lizard Looters|QID|81632|M|64.45,18.83|Z|2215;Hallowfall|N|To Attica Whiskervale.|
T Glow in the Dark|QID|76169|M|64.45,18.83|Z|2215;Hallowfall|N|To Attica Whiskervale.|
T Tale of Tails|QID|82007|M|64.45,18.83|Z|2215;Hallowfall|N|To Attica Whiskervale.|

A Crab Grab - Activate|QID|80005|M|61.48,17.49|Z|2215;Hallowfall|N|Add 3 Shards to the lesser flame.|
T Crab Grab - Activate|QID|80005|M|61.48,17.49|Z|2215;Hallowfall|N|Continue to add shards.|

A Crab Grab|QID|80004|M|61.48,17.49|Z|2215;Hallowfall|
C Crab Grab|QID|80004|M|59.99,15.87|Z|2215;Hallowfall|QO|1|NC|N|Shadowtide Crab.|
T Crab Grab|QID|80004|M|59.99,15.87|Z|2215;


.rgb
        }
    }
    val darkVibrantSwatch = palette.darkVibrantSwatch
    if (darkVibrantSwatch != null) {
        if (hasEnoughContrast(i, darkVibrantSwatch.rgb)) {
            return darkVibrantSwatch.rgb
        }
    }
    val lightVibrantSwatch = palette.lightVibrantSwatch
    if (lightVibrantSwatch != null) {
        if (hasEnoughContrast(i, lightVibrantSwatch.rgb)) {
            return lightVibrantSwatch.rgb
        }
    }
    val darkMutedSwatch = palette.darkMutedSwatch
    if (darkMutedSwatch != null) {
        if (hasEnoughContrast(i, darkMutedSwatch.rgb)) {
            return darkMutedSwatch.rgb
        }
    }
    val lightMutedSwatch = palette.lightMutedSwatch
    if (lightMutedSwatch != null) {
        if (hasEnoughContrast(i, lightMutedSwatch.rgb)) {
            return lightMutedSwatch.rgb
        }
    }
    val mutedSwatch = palette.mutedSwatch
    if (mutedSwatch != null) {
        if (hasEnoughContrast(i, mutedSwatch.rgb)) {
            return mutedSwatch.rgb
        }
    }
    return i2
}

fun hasEnoughContrast(i: Int, i2: Int): Boolean {
    return ColorUtils.calculateContrast(i2, i) >= 2.toDouble()
}

fun hasEnoughLuminance(i: Int): Boolean {
    return ColorUtils.calculateLuminance(i) >= 0.4f.toDouble()
}

fun isBlack(fArr: FloatArray): Boolean {
    return fArr[2] <= 0.035f
}

fun isNearRedLine(fArr: FloatArray): Boolean {
    val f = fArr[0]
    return f in 10.0f..37.0f && fArr[1] <= 0.82f
}

fun isDark(@ColorInt i: Int): Boolean {
    return ColorUtils.calculateLuminance(i) < 0.5
}
/*
 * Copyright (c) 2024 lingyicute
 *
 * Licensed under the GNU General Public License v3
 *
 * This 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 software 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.
 *
 */
package code.name.monkey.retromusic.glide

import android.graphics.drawable.Drawable
import android.widget.ImageView
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.glide.palette.BitmapPaletteTarget
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import com.bumptech.glide.request.transition.Transition

abstract class RetroMusicColoredTarget(view: ImageView) : BitmapPaletteTarget(view) {

    protected val defaultFooterColor: Int
        get() = getView().context.colorControlNormal()

    abstract fun onColorReady(colors: MediaNotificationProcessor)

    override fun onLoadFailed(errorDrawable: Drawable?) {
        super.onLoadFailed(errorDrawable)
        onColorReady(MediaNotificationProcessor.errorColor(App.getContext()))
    }

    override fun onResourceReady(
        resource: BitmapPaletteWrapper,
        transition: Transition<in BitmapPaletteWrapper>?
    ) {
        super.onResourceReady(resource, transition)
        MediaNotificationProcessor(App.getContext()).getPaletteAsync({
            onColorReady(it)
        }, resource.bitmap)
    }
}
/*
 * Copyright (c) 2024 lingyicute
 *
 * Licensed under the GNU General Public License v3
 *
 * This is free software: you can r


[1] ]
							if tq:getproperty("collision", x1, y1) and tq.leftslant and not tq.downslant then
								x = x1
								stick = true
							end
						end
						if ismaptile(x2, y1) and v.speedx > 0 then --check for right slope under left edge
							local tq = tilequads[map[x2][y1][1] ]
							if tq:getproperty("collision", x2, y1) and tq.rightslant and not tq.downslant then
								x = x2
								stick = true
							end
						end
						if ismaptile(x1, y1+1) and v.speedx < 0 and not x then --check for left slope under right edge
							local tq = tilequads[map[x1][y1+1][1] ]
							if tq:getproperty("collision", x1, y1+1) and tq.leftslant and not tq.downslant then
								x = x1
								y = y1+1
								stick = true
							end
						end
						if ismaptile(x2, y1+1) and v.speedx > 0 and not x then --check for right slope under left edge
							local tq = tilequads[map[x2][y1+1][1] ]
							if tq:getproperty("collision", x2, y1+1) and tq.rightslant and not tq.downslant then
								x = x2
								y = y1+1
								stick = true
							end
						end
						local t
						if x then --try to stick
							if ismaptile(x, y) then
								t = objects["tile"][tilemap(x,y)]
								if t and t.SLOPE then
									local tq = tilequads[map[x][y][1] ]
									local inside, diff, angle, realangle = insideslope(v.x,v.y,v.width,v.height, t.x,t.y+t.y1,t.x+t.width,t.y+t.y2, t.UPSIDEDOWNSLOPE)
									local location, flocation
									if tq.leftslant then
										location = rightedge-t.x
										flocation = frightedge-t.x
									elseif tq.rightslant then
										location = leftedge-t.x
										flocation = fleftedge-t.x
									end
									--location = math.max(0, math.min(1, location))
									flocation2 = flocation --unbounded
									--flocation = math.max(0, math.min(1, flocation)) --bounded to tile
									local targety = t.y+getslopey(flocation, t.y1, t.y2)
									local targety2 = t.y+getslopey(flocation2, t.y1, t.y2)
									local currentground = (t.y+getslopey(location, t.y1, t.y2))
									local rangey = targety2-currentground --make sure it only sticks if reasonably close to slope
									local platformpass = true
									local onlyplatform = (t.PLATFORM == true and t.PLATFORMDOWN == nil and t.PLATFORMLEFT == nil and t.PLATFORMRIGHT == nil)
									if onlyplatform and not (diff <= 1e-1) then
										platformpass = false
									end
									if v.y+v.height >= currentground-rangey-0.00001 and platformpass then
										stucktoslope = targety-v.height
										v.slopeangle = realangle
									end
								end
							end
						end
						if stucktoslope then
							if v.floorcollide then
								v:floorcollide("tile", t, dt)
							end
							if v.speedy > 0 then
								v.speedy = 0
							end
						end
					end

					--Move the object
					if vercollision == false and not v.activestatic then
						v.y = v.y + v.speedy*dt
						--if not stucktoslope then
							if


-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v584z"])})),t.ZoomOutOutline=l("zoom-out",a,c(o,"M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z")),t.AlertTwoTone=l("alert",s,(function(e,t){return c(o,[t,"M340 585c0-5.5 4.5-10 10-10h44c5.5 0 10 4.5 10 10v171h355V563c0-136.4-110.6-247-247-247S265 426.6 265 563v193h75V585z"],[e,"M216.9 310.5l39.6-39.6c3.1-3.1 3.1-8.2 0-11.3l-67.9-67.9a8.03 8.03 0 0 0-11.3 0l-39.6 39.6a8.03 8.03 0 0 0 0 11.3l67.9 67.9c3.1 3.1 8.1 3.1 11.3 0zm669.6-79.2l-39.6-39.6a8.03 8.03 0 0 0-11.3 0l-67.9 67.9a8.03 8.03 0 0 0 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l67.9-67.9c3.1-3.2 3.1-8.2 0-11.3zM484 180h56c4.4 0 8-3.6 8-8V76c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v96c0 4.4 3.6 8 8 8zm348 712H192c-17.7 0-32 14.3-32 32v24c0 4.4 3.6 8 8 8h688c4.4 0 8-3.6 8-8v-24c0-17.7-14.3-32-32-32zm-639-96c0 17.7 14.3 32 32 32h574c17.7 0 32-14.3 32-32V563c0-176.2-142.8-319-319-319S193 386.8 193 563v233zm72-233c0-136.4 110.6-247 247-247s247 110.6 247 247v193H404V585c0-5.5-4.5-10-10-10h-44c-5.5 0-10 4.5-10 10v171h-75V563z"])})),t.ApiTwoTone=l("api",s,(function(e,t){return c(o,[t,"M148.2 674.6zm106.7-92.3c-25 25-38.7 58.1-38.7 93.4s13.8 68.5


   returnedErrorCode = (TestTypes.ErrorCode)result2.ErrorCode;
            Assert.True(returnedErrorCode.Equals(TestTypes.ErrorCode.Ok), String.Format("Expected Error Code: {0}/nActual Error Code: {1}", TestTypes.ErrorCode.Ok, returnedErrorCode));
            Assert.True(result2.HttpStatusCode.Equals(System.Net.HttpStatusCode.OK), String.Format("Expected HttpStatusCode: {0}/nActual HttpStatusCode: {1}", System.Net.HttpStatusCode.OK, result2.HttpStatusCode));

            // *** CLEANUP *** \\
            ((ICommunicationObject)mi_ClientBase_ClientAuth1).Close();
            ((ICommunicationObject)mi_ClientBase_ClientAuth2).Close();
        }
        finally
        {
            // *** ENSURE CLEANUP *** \\
            ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)mi_ClientBase_ClientAuth1, (ICommunicationObject)mi_ClientBase_ClientAuth2);
        }
    }

    [WcfFact]
    [OuterLoop]
    public static void MessageInspector_RoundtripCustomHeaders()
    {
        MI_ClientBase_ClientAuth mi_ClientBase_ClientAuth = null;
        BasicHttpBinding binding = null;
        string accessToken = "Allow";

        try
        {
            // *** SETUP *** \\
            binding = new BasicHttpBinding((BasicHttpSecurityMode)BasicHttpSecurityMode.None);

            AuthenticationType authType = AuthenticationType.None;

            EndpointAddress endPoint = new EndpointAddress(Endpoints.HttpBaseAddress_Basic_Text);

            mi_ClientBase_ClientAuth = new MI_ClientBase_ClientAuth(authType.ToString(), accessToken, binding, endPoint);

            // *** EXECUTE *** \\
            Dictionary<string, string> headers = mi_ClientBase_ClientAuth.ValidateHeaders();

            // *** VALIDATE *** \\
            string authorizationHeaderValue, authTypeHeaderValue = "";
            if (headers.TryGetValue("Authorization", out authorizationHeaderValue) && (headers.TryGetValue("authType", out authTypeHeaderValue)))
            {
                Assert.True(String.Equals(authorizationHeaderValue, accessToken), String.Format("Expected Authorization Header value: {0}/nActual Authorization Header value: {1}", accessToken, authorizationHeaderValue));
                Assert.True(String.Equals(authTypeHeaderValue, authType.ToString()), String.Format("Expected AuthType Header value: {0}/nActual AuthType Header value: {1}", authType.ToString(), authTypeHeaderValue));
            }
            else
            {
                Assert.Fail(String.Format("One or both of the expected headers were not found.\nHeader: \"authType\" had value: {0}\nHeader: \"HttpRequestHeader.Authorization\" had value: {1}", authorizationHeaderValue, authTypeHeaderValue));
            }

            // *** CLEANUP *** \\
            ((ICommunicationObject)mi_ClientBase_ClientAuth).Close();
        }
        finally
        {
            // *** ENSURE CLEANUP *** \\
            ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)mi_ClientBase_ClientAuth);
        }

    }
}


g{color:var(--text-faint);margin-right:6px}.NLT__menu .NLT__selectable:hover,.NLT__menu .NLT__selected{background:0 0}.NLT__menu .NLT__selected>.NLT__selectable{background-color:var(--background-modifier-hover)}.NLT__menu .NLT__selectable{cursor:var(--cursor)}.NLT__menu div.NLT__selectable{min-width:110px;border-radius:var(--radius-m);padding:3px 8px 3px 4px;margin:1px 2px 1px;cursor:var(--cursor);height:auto;line-height:20px}.NLT__menu div.NLT__selectable:hover{background-color:var(--background-modifier-hover)}.NLT__menu .NLT__textarea{font-size:var(--table-text-size)}.NLT__tfoot tr:hover td{background-color:transparent}.modal .quickAddPrompt>h1,.modal .quickAddYesNoPrompt h1{margin-top:0;text-align:left!important;font-size:var(--h1);font-weight:600}.modal .quickAddYesNoPrompt p{text-align:left!important}.modal .quickAddYesNoPrompt button{font-size:var(--font-ui-small)}.modal .yesNoPromptButtonContainer{font-size:var(--font-ui-small);justify-content:flex-end}.quickAddModal .modal-content{padding:20px 2px 5px}div#quick-explorer{display:flex}div#quick-explorer span.explorable{align-items:center;color:var(--text-muted);display:flex;font-size:var(--font-adaptive-smaller);line-height:16px}div#quick-explorer span.explorable:last-of-type{font-size:var(--font-adaptive-smaller)}div#quick-explorer span.explorable.selected,div#quick-explorer span.explorable:hover{background-color:unset!important}div#quick-explorer span.explorable.selected .explorable-name,div#quick-explorer span.explorable:hover .explorable-name{color:var(--text-normal)}div#quick-explorer span.explorable.selected .explorable-separator,div#quick-explorer span.explorable:hover .explorable-separator{color:var(--text-normal)}div#quick-explorer .explorable-name{padding:0 4px;border-radius:4px}div#quick-explorer .explorable-separator::before{content:"\00a0›"!important;font-size:1.3em;font-weight:400;margin:0}body:not(.colorful-active) .qe-popup-menu .menu-item:not(.is-disabled):not(.is-label).selected,body:not(.colorful-active) .qe-popup-menu .menu-item:not(.is-disabled):not(.is-label):hover{background-color:var(--background-modifier-hover);color:var(--text-normal)}body:not(.colorful-active) .qe-popup-menu .menu-item:not(.is-disabled):not(.is-label).selected .menu-item-icon,body:not(.colorful-active) .qe-popup-menu .menu-item:not(.is-disabled):not(.is-label):hover .menu-item-icon{color:var(--text-normal)}.workspace-leaf-content[data-type=recent-files] .view-content{padding-top:10px}.mod-root .workspace-leaf-content[data-type=reminder-list] main{max-width:var(--max-width);margin:0 auto;padding:0}.modal .reminder-actions .later-select{font-size:var(--font-settings-small);vertic


.next(line)
                line++
            }
        }

        const executionPromise = execute()

        // 実行は止まっている。
        await nextTick()
        is(line, 0)

        // ステップインを指示すると、実行が開始される。
        step.stepIn()
        await nextTick()
        is(line, 1)

        // 実行はまだ止まっている。
        await nextTick()
        is(line, 1)

        // 次のステップインでもう1周進む。
        step.stepIn()
        await nextTick()
        is(line, 2)

        // 実行を再開すると最後まで進む。
        step.continue()

        await executionPromise
        is(line, 10)
    })
}
import { ErrorSeverity, BaseError } from '../infrastructure';
import { ExceptionCode } from './exceptionCode'

export default class UserNotFoundException extends BaseError {
  constructor(error: Error, data?: any) {
    super(
      {
        code: ExceptionCode.USER_NOT_FOUND,
        message: error.message ? error.message : 'user not found',
        severity: ErrorSeverity.ERROR,
        error,
      },
      data,
    );
  }
}

//conversion to pure JS after compilation
var hello = (()=>{
     "Hello Wolrd";
});

var world = function(){
    return "Hello Abdu"
}

//declaration
let a:number=3;
let b:number=4;
let c:boolean=false;
let d:string="abdu";

//
()=>{
    a+b;
}
console.log(a+" "+b+" "+ " "+ c +" "+d);

//null  undefined
let x:undefined;
let y=undefined;
let xx:null;
let yy:null;

//Array
let myArr=[3,4,5,6];

let myArray:number[];
myArray=[1,2,3];
myArray=[];
myArray=[];
myArray.push(1,2,3);
myArray.push(1);

// b=myArray.pop();

//Tuples
let arr:[number, string, boolean]= [2,"Abdu", true];
//arr=[3];

//function

//any
let abc:any;
abc=3;
abc="Abdu";
abc=true;

//union
let bcd:number|boolean;
// bcd="abdu";
bcd=true;
bcd=4;

let cde:number|boolean|string;
 cde="abdu";

import {Component} from 'angular2/core';
import {CORE_DIRECTIVES} from "angular2/common";
import {FORMAT_PROVIDERS} from './Format';
import {CodeHighlighter} from '../../directives/CodeHighlighter/CodeHighlighter';
import {TableSortable, TableSortableColumn, TableSortableSorting} from '../../components/TableSortable/TableSortable';
import {Attribute, AttributeColumns, AttributesDefaultSort} from '../../utilities/demoUtilities';
import {TAB_PROVIDERS} from '../../components/Tab/Tab';

export class DataType{
    public Type: string;
    public Parameters: string;
    public Input: string;
    public Output: string;

    constructor(Type: string, Parameters: string, Input: string, Output: string) {
        this.Type = Type;
        this.Parameters = Parameters;
        this.Input = Input;
        this.Output = Output;
    }
}

@Component({
  template: `

Format

Format is a custom pipe to format any string into a type by an identifying


.Reader)
	if err != nil {
		t.Fatal(err)
	}
	ma := Ga.Marshal()

	Gb := new(G2)
	_, err = Gb.Unmarshal(ma)
	if err != nil {
		t.Fatal(err)
	}
	mb := Gb.Marshal()

	if !bytes.Equal(ma, mb) {
		t.Fatal("bytes are different")
	}
}

func TestBilinearity(t *testing.T) {
	for i := 0; i < 2; i++ {
		a, p1, _ := RandomG1(rand.Reader)
		b, p2, _ := RandomG2(rand.Reader)
		e1 := Pair(p1, p2)

		e2 := Pair(&G1{curveGen}, &G2{twistGen})
		e2.ScalarMult(e2, a)
		e2.ScalarMult(e2, b)

		if *e1.p != *e2.p {
			t.Fatalf("bad pairing result: %s", e1)
		}
	}
}

func TestTripartiteDiffieHellman(t *testing.T) {
	a, _ := rand.Int(rand.Reader, Order)
	b, _ := rand.Int(rand.Reader, Order)
	c, _ := rand.Int(rand.Reader, Order)

	pa, pb, pc := new(G1), new(G1), new(G1)
	qa, qb, qc := new(G2), new(G2), new(G2)

	pa.Unmarshal(new(G1).ScalarBaseMult(a).Marshal())
	qa.Unmarshal(new(G2).ScalarBaseMult(a).Marshal())
	pb.Unmarshal(new(G1).ScalarBaseMult(b).Marshal())
	qb.Unmarshal(new(G2).ScalarBaseMult(b).Marshal())
	pc.Unmarshal(new(G1).ScalarBaseMult(c).Marshal())
	qc.Unmarshal(new(G2).ScalarBaseMult(c).Marshal())

	k1 := Pair(pb, qc)
	k1.ScalarMult(k1, a)
	k1Bytes := k1.Marshal()

	k2 := Pair(pc, qa)
	k2.ScalarMult(k2, b)
	k2Bytes := k2.Marshal()

	k3 := Pair(pa, qb)
	k3.ScalarMult(k3, c)
	k3Bytes := k3.Marshal()

	if !bytes.Equal(k1Bytes, k2Bytes) || !bytes.Equal(k2Bytes, k3Bytes) {
		t.Errorf("keys didn't agree")
	}
}

func BenchmarkG1(b *testing.B) {
	x, _ := rand.Int(rand.Reader, Order)
	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		new(G1).ScalarBaseMult(x)
	}
}

func BenchmarkG2(b *testing.B) {
	x, _ := rand.Int(rand.Reader, Order)
	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		new(G2).ScalarBaseMult(x)
	}
}
func BenchmarkPairing(b *testing.B) {
	for i := 0; i < b.N; i++ {
		Pair(&G1{curveGen}, &G2{twistGen})
	}
}
package bn256

// For details of the algorithms used, see "Multiplication and Squaring on
// Pairing-Friendly


calcula no estado da aplicação. Por
     * fim, retorna o salarioLiquido obtido após o cálculo.
     *
     */
    const obs$ = interval(1).pipe(
      /**
       * Transformação de dados (map)
       */
      map(() => {
        /**
         * Obtendo o salário líquido do momento
         */
        const currentValue = +this.salario.salarioLiquido;

        /**
         * Calculando a diferença entre o salário líquido do momento
         * e o salário líquido desejado
         */
        const difference = Math.abs(currentValue - salarioLiquidoDesejado);

        /**
         * Quando a diferença for menor que 5 reais, o
         * incremento passa a ser de 1 centavo (0.01)
         * para uma melhor precisão no cálculo sem que
         * o mesmo se torne lento, ou seja, enquanto a
         * diferença for maior que 5 reais o incremento
         * é de "1 em 1 real"
         */
        const increment = difference >= 5 ? 1 : 0.01;

        /**
         * Incrementando o valor no salário bruto
         * e formatando para 2 casas decimais
         */
        const novoSalario = +this.salario.salarioBruto + increment;

        inputSalarioBruto.value = novoSalario.toFixed(2);

        /**
         * Atualizando o salário bruto. Quando atualizamos o valor
         * "na mão", o Vue não consegue monitorar as
         * mudanças
         */
        this.salario = new Salario(novoSalario);

        /**
         * Por fim, retornamos o salário líquido atual
         */
        return this.salario.salarioLiquido;
      })
    );

    /**
     * Observable para ser utilizado com takeUntil,
     * que será a condição de término da execução
     * (salarioLiquido do estado maior ou igual ao salarioLiquido desejado)
     */
    const match$ = obs$.pipe(
      filter(currentValue => +currentValue >= salarioLiquidoDesejado)
    );

    /**
     * Acionamos, por fim, a execução do observable com
     * subscribe()
     */
    obs$
      .pipe(takeUntil(match$))
      .subscribe(null, null, () => (this.calculandoDados = false));
  }
}
import { isArray, isIntegerKey } from "@vue/shared";
import { TriggerOrTypes } from "./operators";
export function effect(fn, options: any = {}) {
  // effect-->响应的effect(数据变化重新执行)
  const effect = createReactiveEffect(fn, options);
  if (!options.lazy) {
    effect();
  }
  return effect;
}

let uid = 0;
let activeEffect;
let effectStack = [];
function createReactiveEffect(fn, options) {
  const effect = function reactiveEffect() {
    if (effectStack.includes(effect)) return;
    try {
      activeEffect = effect;
      effectStack.push(effect); // 这里放的是effect函数的引用地址
      return fn(); // fn执行时会取值-->执行get方法
    } finally {
      effectStack.pop();
      activeEffect = effectStack[effectStack.length - 1];
    }
  };
  effect.id = uid++;
  effect._isEffect = true;
  effect.raw = fn;
  effect.options = options;
  return effect;
}

// 让某个对象中的属性收集对应的effect函数
const targetMap = new WeakMap();
export function track(target, type, key) {
  if (activeEffect === undefined) return; // 此属性不用收集依赖，因为没在effect中使用
  let depsMap = targetMap.


= adventlib::read_input_raw("day07input.txt");

    let phases = vec![0, 1, 2, 3, 4];
    let phase_permutations = get_permutations_of(phases);

    let mut max_signal = 0;
    for perm in phase_permutations {
        let signal = run_all_amplifiers(&raw_program, perm);

        if signal > max_signal {
            max_signal = signal;
        }
    }

    println!("Max signal (part 2): {}", max_signal);

    let phases = vec![5, 6, 7, 8, 9];
    let phase_permutations = get_permutations_of(phases);

    let mut max_signal = 0;
    for perm in phase_permutations {
        let signal = run_amplifiers_in_loop(&raw_program, perm);

        if signal > max_signal {
            max_signal = signal;
        }
    }

    println!("Max signal (part 2): {}", max_signal);
}

fn get_permutations_of(mut phases: Vec<u8>) -> Vec<Vec<u8>> {
    let mut phase_permutations = Vec::new();
    let size = phases.len();
    collect_permutations(&mut phases, size, &mut phase_permutations);
    return phase_permutations;
}

fn collect_permutations(phases: &mut Vec<u8>, size: usize, permutations: &mut Vec<Vec<u8>>) {
    if size == 1 {
        permutations.push(phases.clone());
        return;
    }

    for i in 0..size {
        collect_permutations(phases, size - 1, permutations);

        // if size is odd, swap first and last element
        if size % 2 == 1 {
            let temp = phases[0];
            phases[0] = phases[size - 1];
            phases[size - 1] = temp;
        }
        // If size is even, swap ith and last element
        else {
            let temp = phases[i];
            phases[i] = phases[size - 1];
            phases[size - 1] = temp;
        }
    }
}

fn run_all_amplifiers(raw_program: &String, phases: Vec<u8>) -> i64 {
    let first_input_value = 0;

    let mut output = run_amplifier_returning_output(raw_program, phases[0], first_input_value);
    output = run_amplifier_returning_output(raw_program, phases[1], output);
    output = run_amplifier_returning_output(raw_program, phases[2], output);
    output = run_amplifier_returning_output(raw_program, phases[3], output);
    return run_amplifier_returning_output(raw_program, phases[4], output);
}

fn run_amplifiers_in_loop(raw_program: &String, phases: Vec<u8>) -> i64 {
    let first_input_value = 0;
    let mut is_first_run = true;
    let mut computers = vec![
        create_computer(raw_program),
        create_computer(raw_program),
        create_computer(raw_program),
        create_computer(raw_program),
        create_computer(raw_program),
    ];

    let mut next_input = first_input_value;
    while computers[4].run_state != RunState::Halted {
        for i in 0..5 {
            let input = if is_first_run {
                vec![phases[i] as i64, next_input]
            } else {
                vec![next_input]
            };
            next_input = run_computer_for_input(&mut computers[i], input);
        }
        is_first


	for i := 1; i < 50; i++ { /* 2^250 - 2^50 */
		square(&t, &t)
	}
	mul(&t, &t, &z2_50_0) /* 2^250 - 2^0 */

	square(&t, &t) /* 2^251 - 2^1 */
	square(&t, &t) /* 2^252 - 2^2 */
	square(&t, &t) /* 2^253 - 2^3 */

	square(&t, &t) /* 2^254 - 2^4 */

	square(&t, &t)   /* 2^255 - 2^5 */
	mul(r, &t, &z11) /* 2^255 - 21 */
}
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package cast5

import (
	"bytes"
	"encoding/hex"
	"testing"
)

// This test vector is taken from RFC 2144, App B.1.
// Since the other two test vectors are for reduced-round variants, we can't
// use them.
var basicTests = []struct {
	key, plainText, cipherText string
}{
	{
		"0123456712345678234567893456789a",
		"0123456789abcdef",
		"238b4fe5847e44b2",
	},
}

func TestBasic(t *testing.T) {
	for i, test := range basicTests {
		key, _ := hex.DecodeString(test.key)
		plainText, _ := hex.DecodeString(test.plainText)
		expected, _ := hex.DecodeString(test.cipherText)

		c, err := NewCipher(key)
		if err != nil {
			t.Errorf("#%d: failed to create Cipher: %s", i, err)
			continue
		}
		var cipherText [BlockSize]byte
		c.Encrypt(cipherText[:], plainText)
		if !bytes.Equal(cipherText[:], expected) {
			t.Errorf("#%d: got:%x want:%x", i, cipherText, expected)
		}

		var plainTextAgain [BlockSize]byte
		c.Decrypt(plainTextAgain[:], cipherText[:])
		if !bytes.Equal(plainTextAgain[:], plainText) {
			t.Errorf("#%d: got:%x want:%x", i, plainTextAgain, plainText)
		}
	}
}

// TestFull performs the test specified in RFC 2144, App B.2.
// However, due to the length of time taken, it's disabled here and a more
// limited version is included, below.
func TestFull(t *testing.T) {
	if testing.Short() {
		// This is too slow for normal testing
		return
	}

	a, b := iterate(1000000)

	const expectedA = "eea9d0a249fd3ba6b3436fb89d6dca92"
	const expectedB = "b2c95eb00c31ad7180ac05b8e83d696e"

	if hex.EncodeToString(a) != expectedA {
		t.Errorf("a: got:%x want:%s", a, expectedA)
	}
	if hex.EncodeToString(b) != expectedB {
		t.Errorf("b: got:%x want:%s", b, expectedB)
	}
}

func iterate(iterations int) ([]byte, []byte) {
	const initValueHex = "0123456712345678234567893456789a"

	initValue, _ := h


TEXT

	include	d:\centinel\both\define.s
	output	d:\centinel\40\main.inc\r_total.o
	incdir	d:\centinel\40
	include	d:\centinel\both\LOCALMAC.S
	include	d:\centinel\both\GEM.EQU
	xref	COL_ADR,COL_NOR,COL_LAB,COL_FCT,COL_REG,COL_CHG,COL_BKPT,COL_ERR_L,ATTRIBUTE,COL_MENU,COL_DSP
	xref	bkpt,m,TRACE,nombre,affiche_nombre_zero
	xref	dessas_one,affiche_nombre_2,num_func
	xref	ADR_VBR
	xref	ERR_MEM,p_c,get_function_trap
	xref	adr_label,nb_symbols,hash_table,excep,fonction_type,s_a7,LIGNE_BRA,type_excep
	xref	FLAG_EV,is_break,dessas_one_bk,s_buf,pile_test,eval_bkpt,calcule_adresse,ASCII_BUF,forme_curseur
	xref	buffer_r,buffer_r_anc,affiche_nombre,CPU_TYPE,buffer_int,buffer_int_anc,COL_PC,chaine_ascii
	xref	ADR_CHARGE

	xref	MES_ERREUR_LOAD,MESSAGE_ADR,WORK_BUF,ADR_CHARGE,buf_label,buf_nom,taille_fichier,fichier
	xref	MES_SYM_LOAD_U,MES_TRI,MES_PAS_EXEC,flush_k_sys,buf_dta,PETIT_MESSAGE,MES_LOAD_SYM
	xref	set_all_flags,GET_CHAINE,name,traite_le_pc,CHARGE_AUTO,CMD_L,Com_line
	xref	adr_trace,ACTIVE_WINDOW

	xref	buffer_cou_t,LANCE_A,t_buf,COL_ERR,COL_NOR,restore_reg,rec_history,etat_trace,COL_NOR
	xref	adr_t_until,anc_touche,replay_macro,record_macro,s_a0,get_key
	xref	break_point,a_pile,s_d6,flag_w,gestion_exeptions,teste_fin,recommence,sauve_anc_reg,perm_bkpt
	xref	type_ex,gestion_des_ins_exep,table_fct_det,nb_fct_det,forme_bra,MES_NOP_ERR,MES_BAD_PC,bkpt_flag
	xref	Restore_reg,voir_ctrl_a,user_int,temp,MES_TRACED,MES_NOP,MES_IMP_040,set_40_flags,tempo,a_p_c
	xref	table_autori,MES_MACRO,MES_RB,MES_OK,MES_REINST_EXCEP,EVALUATEUR,adresse,put_pc
	xref	MES_KILL_BKPT,BKPT_IMP,MES_BKPT_USER,temp1,MES_OK_KILL_BKPT,MES_SPACE,MES,MES_BKPT_USER_LINE,eval
	xref	MES_PC,MES_EXP,clear_bkpt_liste,MES_UNTIL,MES_SKIPPED,s_a6,pile_prog,MES_SKIPED,RESIDENT,MES_CENT_RESI
	xref	MES_LOAD,COMMU,tempo1,load,MES_PROG_EXIST,MES_LOAD_OK,prog_launch,WINDOW_LIST,MES_COM

	xref	MES_VBR_SHIFT,MES_VBR_UNSHIFT,MES_VBR_CAN_UNSHIFT,MES_FONC_DET,MES_INCONNU,table_au_t,MES_FONC_DET_D
	xref	table_trap,MES_DET,MES_DET_PERM,MES_UPDATED,MES_EFF_TRAP,MES_PUT_HIS,table_num_max_ex
	xref	MESS_ERRE


 48-92h111zm-692-608l-53-92 53-92h107l53 92-53 92h-107zm-696 53l-53-92 53-91h107l52 91-52 92h-107zm-240-53l-53-92 53-92h107l52 92-52 92H779zm574 1520l54 92-54 92h-105l-53-92 53-92h105zm922-770l54 92-54 92h-105l-53-92 53-92h105zM357 882l-53-92 53-92h106l53 92-53 92H357zm1118-174l-53-92 53-91h106l53 91-53 92h-106zm-459 1282l-53 92H857l-53-92 53-91h106zm-585-401H326l-54-92 54-92h105l54 92zm-180-481l-52-92 52-91h106l52 91-52 92H251zm101 247H246l-53-92 53-92h106l53 92zm896-566l-53-92 53-92h105l54 92-54 92h-105zm-51 1363l-52 92h-107l-52-92 52-92h107zm887-1362l53-92h106l53 92-53 92h-106zm-341 1109l53 91-53 92h-106l-53-92 53-91h106z"},"children":[]}]};

export const u1F4A0 = {"viewBox":"0 0 2600 2760.837","children":[{"name":"path","attribs":{"d":"M2287.5 1518Q2186 1635 2021 1682q52 66 87.5 141t35.5 161q0 180-130.5 318.5T1700 2441q-125 0-228-62t-172-173q-73 115-177 175t-223 60q-176 0-310-134t-134-312q0-90 33.5-167t88.5-146q-178-46-272.5-166.5T211 1248q0-178 129.5-317T649 792q53 0 104 11t100 31q0-10-1-31 0-213 130-344t318-131q186 0 316.5 131.5T1747 803q0 21-2 31 50-20 101-31t103-11q179 0 309.5 135.5T2389 1248q0 153-101.5 270zm-806-250.5Q1405 1191 1300 1191q-106 0-182 75t-76 182q0 106 76 181t182 75q101 0 179.5-76t78.5-178q0-106-76.5-182.5z"},"children":[]}]};

export const u1F4A1 = {"viewBox":"0 0 2600 2760.837","children":[{"name":"path","attribs":{"d":"M2273 2080q-9 28-9 66 0 76-34.5 103.5T2163 2279t-47 9l-24 12q-11 6-25 11t-32 5q-28 0-52.5-13.5T1943 2289q-11 0-22.5 1.5t-22.5 1.5q-18 0-31-8.5t-24-19.5l-20-19q-10-8-20-8-39 0-53.5-3.5t-38-20-23.5-24.5q-27 6-55 6-20 0-39-2.5t-38-8.5l-112-35q-201-60-396-89t-342-117.5-248.5-265T356 1292q0-211 104.5-392T748 613.5 1140 508q117 0 224.5 32.5T1559 630t151 126 112 172 82.5 235 62 173.5 84.5 151 57 213.5l-1 21q2


/*
 * Copyright (C) 2015 Freie Universität Berlin
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 */

/**
 * @ingroup     sys_crypto
 * @{
 *
 * @file
 * @brief       Crypto mode - electronic code book
 *
 * @author      Nico von Geyso <nico.geyso@fu-berlin.de>
 *
 * @}
 */

#include <stddef.h>
#include <stdint.h>

#include "crypto/modes/ecb.h"

int cipher_encrypt_ecb(const cipher_t *cipher, const uint8_t *input,
                       size_t length, uint8_t *output)
{
    size_t offset;
    uint8_t block_size;

    block_size = cipher_get_block_size(cipher);
    if (length % block_size != 0) {
        return CIPHER_ERR_INVALID_LENGTH;
    }

    offset = 0;
    do {
        if (cipher_encrypt(cipher, input + offset, output + offset) != 1) {
            return CIPHER_ERR_ENC_FAILED;
        }

        offset += block_size;
    } while (offset < length);

    return offset;
}

int cipher_decrypt_ecb(const cipher_t *cipher, const uint8_t *input,
                       size_t length, uint8_t *output)
{
    size_t offset = 0;
    uint8_t block_size;

    block_size = cipher_get_block_size(cipher);
    if (length % block_size != 0) {
        return CIPHER_ERR_INVALID_LENGTH;
    }

    do {
        if (cipher_decrypt(cipher, input + offset, output + offset) != 1) {
            return CIPHER_ERR_DEC_FAILED;
        }

        offset += block_size;
    } while (offset < length);

    return offset;
}


 2264.9, y = 216.1, z = -893.4 }, rot = { x = 0.0, y = 0.0, z = 0.0 } },
	["Q357NPC4"] = { pos = { x = 2267.5, y = 214.1, z = -911.3 }, rot = { x = 0.0, y = 326.6, z = 0.0 } },
	["Q357NPC5"] = { pos = { x = 2238.8, y = 210.0, z = -931.0 }, rot = { x = 0.0, y = 345.9, z = 0.0 } },
	["Q357NPC6"] = { pos = { x = 2242.7, y = 212.1, z = -917.6 }, rot = { x = 0.0, y = 69.9, z = 0.0 } },
	["Q46108Paimon"] = { pos = { x = 2248.8, y = 236.1, z = -791.6 }, rot = { x = 0.0, y = 292.8, z = 0.0 } },
	["Q46108Player"] = { pos = { x = 2247.9, y = 236.1, z = -792.5 }, rot = { x = 0.0, y = 11.8, z = 0.0 } },
	["Q46204Paimon"] = { pos = { x = 2214.4, y = 245.5, z = -841.2 }, rot = { x = 0.0, y = 119.4, z = 0.0 } },
	["Q46204Player"] = { pos = { x = 2217.4, y = 245.5, z = -843.2 }, rot = { x = 0.0, y = 307.9, z = 0.0 } },
	["Q46102Kaeya"] = { pos = { x = 2186.8, y = 230.2, z = -796.2 }, rot = { x = 0.0, y = 100.2, z = 0.0 } },
	["Q466Trigger1"] = { pos = { x = 2312.0, y = 215.0, z = -919.0 }, rot = { x = 0.0, y = 0.0, z = 0.0 } },
	["Q466Trigger2"] = { pos = { x = 2261.0, y = 212.2, z = -954.0 }, rot = { x = 0.0, y = 0.0, z = 0.0 } },
	["Q357Target4"] = { pos = { x = 2284.9, y = 248.7, z = -837.6 }, rot = { x = 0.0, y = 0.0, z = 0.0 } },
	["Q371WendyFootPrint3x1"] = { pos = { x = 2256.1, y = 220.1, z = -845.0 }, rot = { x = 0.0, y = 150.0, z = 0.0 } },
	["Q371WendyFootPrint4x1"] = { pos = { x = 2309.4, y = 222.0, z = -844.9 }, rot = { x = 0.0, y = 60.0, z = 0.0 } },
	["Q35601Ambor"] = { pos = { x = 2228.5, y = 210.0, z = -935.9 }, rot = { x = 0.0, y = 164.0, z = 0.0 } },
	["Q371WendyFootPrint5x1"] = { pos = { x = 2331.0, y = 234.0, z = -816.5 }, rot = { x = 0.0, y = 20.0, z = 0.0 } },
	["Q371WendyFootPrint8x1"] = { pos = { x = 2367.5, y = 250.0, z = -745.9 }, rot = { x = 0.0, y = 310.0, z = 0.0 } },
	["Q371WendyFootPrint7x1"] = { pos = { x = 2359.4, y = 244.0, z = -775.3 }, rot = { x = 0.0, y = 30.0,


: props['semanticLabel'],
  ),
  'DrawerController': (props) => DrawerController(
    key: props['key'],
    child: props['child'],
    alignment: props['alignment'],
    isDrawerOpen: props['isDrawerOpen'] ?? false,
    drawerCallback: props['drawerCallback'],
    dragStartBehavior:
    props['dragStartBehavior'] ?? DragStartBehavior.start,
    scrimColor: props['scrimColor'],
    edgeDragWidth: props['edgeDragWidth']?.toDouble(),
    enableOpenDragGesture: props['enableOpenDragGesture'] ?? true,
  ),
  'DrawerController#drawerCallback': (props) => (
      bool isOpened,
      ) {
    return (props['block']);
  },
  'DrawerAlignment': {
    'values': DrawerAlignment.values,
    'start': DrawerAlignment.start,
    'end': DrawerAlignment.end,
  },
  'MergeableMaterial': (props) => MergeableMaterial(
    key: props['key'],
    mainAxis: props['mainAxis'] ?? Axis.vertical,
    elevation: props['elevation']?.toDouble() ?? 2,
    hasDividers: props['hasDividers'] ?? false,
    children: as<MergeableMaterialItem>(props['children']) ??
        const <MergeableMaterialItem>[],
    dividerColor: props['dividerColor'],
  ),
  'MaterialState': {
    'values': MaterialState.values,
    'hovered': MaterialState.hovered,
    'focused': MaterialState.focused,
    'pressed': MaterialState.pressed,
    'dragged': MaterialState.dragged,
    'selected': MaterialState.selected,
    'scrolledUnder': MaterialState.scrolledUnder,
    'disabled': MaterialState.disabled,
    'error': MaterialState.error,
  },
};
library services.server_cache;

import 'dart:async';
import 'dart:math';

import 'package:quiver/cache.dart';
import 'package:resp_client/resp_client.dart';
import 'package:resp_client/resp_commands.dart';
import 'package:resp_client/resp_server.dart';

import 'common_server_impl.dart' show log;
import 'sdk.dart';

abstract class ServerCache {
  Future<String?> get(String key);

  Future<void> set(String key, String value, {Duration expiration});

  Future<void> remove(String key);

  Future<void> shutdown();
}

/// A redis-backed implementation of [ServerCache].
class RedisCache implements ServerCache {
  RespClient? redisClient;
  RespServerConnection? _connection;

  final Uri redisUri;

  final Sdk _sdk;

  // Version of the server to add with keys.
  final String? serverVersion;

  // pseudo-random is good enough.
  final Random randomSource = Random();
  static const int _connectionRetryBaseMs = 250;
  static const int _connectionRetryMaxMs = 60000;
  static const Duration cacheOperationTimeout = Duration(milliseconds: 10000);

  RedisCache(String redisUriString, this._sdk, this.serverVersion)
      : redisUri = Uri.parse(redisUriString) {
    _reconnect();
  }

  Completer<void> _connected = Completer<void>();

  /// Completes when and if the redis server connects.  This future is reset
  /// on disconnection.  Mostly for testing.
  Future<void> get connected => _connected.future;

  Completer<void> _disconnected = Completer<void>()..complete();

  /// Completes when the server is disconnected (begins completed).  This
  /// future is reset on


servable =
                with(testPresenter) {
                    action.observable.test()
                }

        testConsumer =
                with(testView) {
                    action.consumer
                }
    }

    @Test
    @Throws(Exception::class)
    fun test() {
        testObservable
                .assertNoValues()
                .assertNoErrors()

        assertFalse(action.hasValue)

        testConsumer.accept("TEST")

        testObservable
                .assertValueCount(1)

        assertTrue(action.hasValue)
        with(testView) {
            assertEquals("TEST", action.value)
        }
    }

    @Test
    @Throws(Exception::class)
    fun testInitialValue() {
        with(testPresenter) {
            val action = Action("Initial")
            var newValue = ""
            action bindTo { newValue = it }
            assertEquals("Initial", newValue)
        }
    }

    @Test
    @Throws(Exception::class)
    fun update() {
        with(testPresenter) {
            val action = Action("Update")
            var newValue = ""
            action bindTo { newValue += it }
            action.update()
            assertEquals("UpdateUpdate", newValue)

            disposables.dispose()
            action.observable.test().dispose()
            assert(action.observable.test().isDisposed.not())
        }
    }
}package ru.surfstudio.android.core.mvp.binding.rx.request.state

import io.reactivex.Observable
import ru.surfstudio.android.core.mvp.binding.rx.extensions.Optional
import ru.surfstudio.android.core.mvp.binding.rx.relation.BehaviorRelation
import ru.surfstudio.android.core.mvp.binding.rx.relation.mvp.PRESENTER
import ru.surfstudio.android.core.mvp.binding.rx.relation.mvp.StateTarget
import ru.surfstudio.android.core.mvp.binding.rx.request.data.Loading
import ru.surfstudio.android.core.mvp.binding.rx.request.data.RequestUi

/**
 * UI-State запроса на загрузку данных.
 * Содержит в себе неизменяемый экземпляр [RequestUi], который отражает текущее значение загрузки данных.
 *
 * Перед тем, как помещать Request в RequestState, необходимо трансформировать его в RequestUi,
 * то есть, произвести трансформацию i-слой -> ui-слой.
 */
open class RequestState<T>(
        initialResponse: RequestUi<T>
) : BehaviorRelation<RequestUi<T>, PRESENTER, StateTarget>(initialResponse) {

    constructor(initialData: T) : this(RequestUi(data = initialData))

    constructor(initialLoading: Loading) : this(RequestUi(load = initialLoading))

    constructor() : this(RequestUi())

    override fun getConsumer(source: PRESENTER) = relay

    override fun getObservable(target: StateTarget) = relay.share()

    fun observeData(): Observable<T> = relay.share()
            .flatMap { skipIfNull(it.data) }

    fun observeOptionalData(): Observable<Optional<T>> = relay.share()
            .map { if (it.data == null) Optional.empty() else Optional.of<T>(it.data) }
            .distinctUntilChanged()

    fun observeLoading(): Observable<Loading> = relay.share()
            .flatMap { skipIfNull(it.load) }
            .distinctUntilChanged()

    fun observeIsLoading(): Observable<Boolean> = observeLoading()
            .map { it.isLoading }

    fun observeError(): Observable<Throwable> = relay.share()
            .flatMap { skipIfNull(it.error) }

    fun observeOptionalError(): Observable<Optional<Throwable>> = relay.share()
            .map { if (it.error == null) Optional.empty() else Optional.of(it.error) }


// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

//
//
//
// Description: DRT test suite for transform methods on the Visual class
//

using System;
using System.Collections;

using System.Windows;
using System.Windows.Data;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;

namespace DRT
{
    public sealed class TestVisualTransforms : DrtTestSuite
    {
        public TestVisualTransforms () : base("VisualTransforms")
        {
            Contact = "Microsoft";
        }

        #region Setup

        public override DrtTest[] PrepareTests()
        {
            // load the markup
            DRT.LoadXamlFile(@"DrtFiles\PropertyEngine\TestVisualTransforms.xaml");

            return new DrtTest[]
            {
                new DrtTest(VerifyPointToScreen),
            };
        }

        #endregion Setup

        #region Tests for PointToScreen / PointFromScreen

        // A bit of roundoff error is expected during the transforms.  Deal with it.
        bool CloseEnough(Point p1, Point p2)
        {
            return Math.Abs(p1.X - p2.X) < 1 && Math.Abs(p1.Y - p2.Y) < 1;
        }

        // PointToScreen and PointFromScreen should be inverses
        void VerifyPointToScreen(FrameworkElement visual)
        {
            for (int i=0; i<VisualPoints.Length; ++i)
            {
                Point screenPoint = visual.PointToScreen(VisualPoints[i]);
                Point visualPoint = visual.PointFromScreen(screenPoint);
                DRT.Assert(CloseEnough(VisualPoints[i], visualPoint),
                    "PointToScreen failed at point {0} for {1}  Expected: {2}  Got: {3}",
                    i, visual.Name, VisualPoints[i],


agHistory(true)
    , m_hasRareData(false)
    , m_isForPage(false)
    , m_tagIsForNamespaceRule(tagIsForNamespaceRule)
    , m_relationIsAffectedByPseudoContent(false)
{
    m_data.m_tagQName = tagQName.impl();
    m_data.m_tagQName->ref();
}

inline CSSSelector::CSSSelector(const CSSSelector& o)
    : m_relation(o.m_relation)
    , m_match(o.m_match)
    , m_pseudoType(o.m_pseudoType)
    , m_parsedNth(o.m_parsedNth)
    , m_isLastInSelectorList(o.m_isLastInSelectorList)
    , m_isLastInTagHistory(o.m_isLastInTagHistory)
    , m_hasRareData(o.m_hasRareData)
    , m_isForPage(o.m_isForPage)
    , m_tagIsForNamespaceRule(o.m_tagIsForNamespaceRule)
    , m_relationIsAffectedByPseudoContent(o.m_relationIsAffectedByPseudoContent)
{
    if (o.m_match == Tag) {
        m_data.m_tagQName = o.m_data.m_tagQName;
        m_data.m_tagQName->ref();
    } else if (o.m_hasRareData) {
        m_data.m_rareData = o.m_data.m_rareData;
        m_data.m_rareData->ref();
    } else if (o.m_data.m_value) {
        m_data.m_value = o.m_data.m_value;
        m_data.m_value->ref();
    }
}

inline CSSSelector::~CSSSelector()
{
    if (m_match == Tag)
        m_data.m_tagQName->deref();
    else if (m_hasRareData)
        m_data.m_rareData->deref();
    else if (m_data.m_value)
        m_data.m_value->deref();
}

inline const QualifiedName& CSSSelector::tagQName() const
{
    ASSERT(m_match == Tag);
    return *reinterpret_cast<const QualifiedName*>(&m_data.m_tagQName);
}

inline const AtomicString& CSSSelector::value() const
{
    ASSERT(m_match != Tag);
    if (m_hasRareData)
        return m_data.m_rareData->m_value;
    // AtomicString is really just a StringImpl* so the cast below is safe.
    // FIXME: Perhaps call sites could be changed to accept StringImpl?
    return *reinterpret_cast<const AtomicString*>(&m_data.m_value);
}

} // namespace blink

#endif // CSSSelector_h


bfonts/fa-brands-400.eot);src:url(../webfonts/fa-brands-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-brands-400.woff2) format("woff2"),url(../webfonts/fa-brands-400.woff) format("woff"),url(../webfonts/fa-brands-400.ttf) format("truetype"),url(../webfonts/fa-brands-400.svg#fontawesome) format("svg")}.fab{font-family:"Font Awesome 5 Brands"}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-regular-400.eot);src:url(../webfonts/fa-regular-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.woff) format("woff"),url(../webfonts/fa-regular-400.ttf) format("truetype"),url(../webfonts/fa-regular-400.svg#fontawesome) format("svg")}.fab,.far{font-weight:400}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:900;font-display:block;src:url(../webfonts/fa-solid-900.eot);src:url(../webfonts/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.woff) format("woff"),url(../webfonts/fa-solid-900.ttf) format("truetype"),url(../webfonts/fa-solid-900.svg#fontawesome) format("svg")}.fa,.far,.fas{font-family:"Font Awesome 5 Free"}.fa,.fas{font-weight:900}.sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.main-menu-btn{position:relative;display:inline-block;width:36px;height:36px;text-indent:36px;margin-left:8px;white-space:nowrap;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.main-menu-btn-icon,.main-menu-btn-icon:before,.main-menu-btn-icon:after{position:absolute;top:50%;left:2px;height:2px;width:24px;background:var(--nav-menu-button-color);-webkit-transition:all .25s;transition:all .25s}.main-menu-btn-icon:before{content:'';top:-7px;l


{margin-top:.5em}}</style>

Module auton_survival.models.dsm

Deep Survival Machines

Deep Survival Machines (DSM) is a fully parametric approach to model
Time-to-Event outcomes in the presence of Censoring first introduced in
[1].
In the context of Healthcare ML and Biostatistics, this is known as 'Survival
Analysis'. The key idea behind Deep Survival Machines is to model the
underlying event outcome distribution as a mixure of some fixed  k
parametric distributions. The parameters of these mixture distributions as
well as the mixing weights are modelled using Neural Networks.

Example Usage

>>> from dsm import DeepSurvivalMachines
>>> from dsm import datasets
>>> # load the SUPPORT dataset.
>>> x, t, e = datasets.load_dataset('SUPPORT')
>>> # instantiate a DeepSurvivalMachines model.


0.1074338
```

![image-20210924211135207](.\typora-user-images\image-20210924211135207.png)

还可以直接绘制时间序列的图像：

```R
> plot(ts(x))
```

![image-20210924211220048](.\typora-user-images\image-20210924211220048.png)

为了将多幅图画在一起，可以使用 `par()` 函数：

```R
> op <- par(mfrow=c(2, 1), mar=c(5, 4, 2, 2) + .1) # mfrow 指定了图像矩阵为两行一列，即画两幅图，每行一幅；mar 指定了图像的边界，分别是下、左、上、右，可以根据喜好指定
> plot(ts(x))
> acf(z, main = "") # 计算 acf 函数
```

![image-20210924211736213](.\typora-user-images\image-20210924211736213.png)# 手算时间序列

## 简单移动平均

我们先来自己实现一个计算简单移动平均的函数：

```R
mySMA <- function (x, n) {
  sma <- c()
  sma[1:(n-1)] <- NA
  for (i in n:length(x)) {
    sma[i] <- mean(x[(i-n+1):i])
  }
  return(sma)
}

> x = c(2, 3, 3, 4, 2, 3, 3, 5, 2, 3)
> mySMA(x, n = 4)
 [1]   NA   NA   NA 3.00 3.00 3.00 3.00 3.25 3.25 3.25
```

R 语言中的 TTR 包提供的 SMA 函数也可以实现简单移动平均的计算。首先确保 R 语言解释器的版本在 4.2.0以上（在 RStudio 中键入 `R.version` 中可查看 R 解释器的版本）。进入 https://cran.r-project.org/web/packages/TTR/index.html ，下载系统对应的 xts, zoo, curl 和 TTR 包所需要的包，并在 RStudio -> Tools -> Installs Packages 中选择下载的包进行安装。随后通过 `library(xts)` , `library(zoo)`, `library(curl)` 和 `library(TTR)` 导入相应的包。

例如对于数据 $2, 3, 3, 4, 2, 3, 3, 5, 2, 3$ 。 假设当前观测值只受到过去4期数值影响，可以通过如下的方法计算：

```R
> x = c(2, 3, 3, 4, 2, 3, 3, 5, 2, 3)
> SMA(x, n = 4)
 [1]   NA   NA   NA 3.00 3.00 3.00 3.00 3.25 3.25 3.25
```

## 指数移动平均

老样子，我们先来试着自己实现一下指数移动平均：

```R
myEMA <- function (price,n){
  ema <- c()
  ema[1:(n-1)] <- NA
  ema[n]<- mean(price[1:n])
  beta <- 2/(n+1)
  for (i in (n+1):length(


 0,
    title: '',
};

export default (state = initialState, action: AnyAction) => {
    switch (action.type) {
        case SEARCH_SUCCESS:
            return { ...state, error: false, subjects: action.payload.rows, count: action.payload.count, loading: false };
        case SEARCH_ERROR:
            return { ...state, error: true, subjects: [], loading: false };
        case REQUEST_STARTED:
            return { ...state, loading: true };
        case TITLE:
            return { ...state, title: action.payload };
        default:
            return state;
    }
};
import { DirList } from '../interface/dirlist'

const stringifyList = function (list: DirList): string {
  const length = Object.keys(list).length
  let output = ''

  // Construct the header first - it's a bit tricky because we should handle empty lists but we also need to check if we are displaying long fields
  if (length > 0 && 'mode' in list[0])
    output += 'Mode\tModified\t\t\t\t\t\t\t'

  output += 'Name\n'

  for (let i = 0; i < length; i++) {
    let dirent = list[i]

    if('mode' in dirent)
      output += dirent.mode + '\t'

    if ('dateModified' in dirent)
      output += dirent.dateModified + '\t'

    output += dirent.name + '\n'
  }

  return output
}

export { stringifyList }import { Injectable } from '@angular/core';
import { ErrorHandler } from '../services/errorHandler';
import { Observable } from 'rxjs';
import { Picture } from '../models/picture';
import { catchError } from 'rxjs/operators';
import { HttpClient } from '@angular/common/http';

@Injectable({
  providedIn: 'root'
})
export class PicturesService {
  private picturesURL = 'https://three-sixty-rooms-bnu.herokuapp.com/api/pictures';
  private errorHandler: ErrorHandler = new ErrorHandler();

  /**
   * Gets the pictures for the room (usually one) in array form
   * @param roomID The ID of the room for which the pictures belong
   */
  getPictures(roomID: string): Observable<Picture[]> {
    const url = `${this.picturesURL}/?room=${roomID}`;
    return this.http.get<Picture[]>(url).pipe(
      catchError(this.errorHandler.handleError('getPictures', []))
    );
  }

  /**
   * Gets the picture with the given ID from the back-end server
   * @param pictureID The ID of the picture to retrieve
   */
  getPicture(pictureID: string): Observable<Picture> {
    const url = `${this.picturesURL}/${pictureID}`;
    return this.http.get<Picture>(url).pipe(
      catchError(this.errorHandler.handleError<Picture>('getPicture'))
    );
  }

  /**
   * Creates a picture object in the back-end server
   * @param data The FormData containing all the data for the new picture object to be created
   */
  createPicture(data: FormData): Observable<Picture> {
    return this.http.post<Picture>(this.picturesURL, data).pipe(
      catchError(this.errorHandler.handleError<Picture>('createPicture'))
    );
  }

  /**
   * Updates a picture object in the back-end server
   * @param data The FormData object representing the picture to be updated
   * @param pictureID The ID of the picture to be updated
   */
  updatePicture(data: FormData, pictureID: string): Observable<Picture> {
    const url = `${this.picturesURL}/${pictureID}`;


Type.INTERVAL_DT -> {
                val p: Int = INTERVAL_MAX_PRECISION // Based on SQL2023 6.44 SR 2)c), precision is implementation-defined. Set to max
                val s: Int = max(lhs.fractionalPrecision, rhs.fractionalPrecision) // Based on SQL2023 6.44 SR 2)c), set to max of lhs and rhs
                basic(PType.intervalDaySecond(p, s)) { args ->
                    val i1 = args[0]
                    val i2 = args[1]
                    Datum.intervalDaySecond(
                        i1.days - i2.days,
                        i1.hours - i2.hours,
                        i1.minutes - i2.minutes,
                        i1.seconds - i2.seconds,
                        i1.nanos - i2.nanos,
                        p,
                        s
                    )
                }
            }
            lhs.code() == PType.INTERVAL_YM && rhs.code() == PType.INTERVAL_YM -> {
                val p = INTERVAL_MAX_PRECISION // Based on SQL2023 6.44 SR 2)c), precision is implementation-defined. Set to max
                basic(PType.intervalYearMonth(p)) { args ->
                    val i1 = args[0]
                    val i2 = args[1]
                    Datum.intervalYearMonth(i1.years - i2.years, i1.months - i2.months, p)
                }
            }
            else -> null
        }
    }

    private fun getRemainder(value: Int, divisor: Int): Pair<Int, Int> {
        val remainder = value % divisor
        val quotient = value / divisor
        return remainder to quotient
    }

    override fun getBigIntInstance(bigIntLhs: PType, bigIntRhs: PType): Fn {
        return basic(PType.bigint()) { args ->
            val arg0 = args[0].long
            val arg1 = args[1].long
            try {
                val result = Math.subtractExact(arg0, arg1)
                Datum.bigint(result)
            } catch (e: ArithmeticException) {
                throw PErrors.numericValueOutOfRangeException("$arg0 - $arg1", PType.bigint())
            }
        }
    }

    override fun getNumericInstance(numericLhs: PType, numericRhs: PType): Fn {
        val (p, s) = minusPrecisionScale(numericLhs, numericRhs)
        return Function.instance(
            name = signature.name,
            returns = PType.numeric(p, s),
            parameters = arrayOf(
                Parameter("lhs", numericLhs),
                Parameter("rhs", numericRhs),
            )
        ) { args ->
            val arg0 = args[0].bigDecimal
            val arg1 = args[1].bigDecimal
            Datum.numeric(arg0 - arg1, p, s)
        }
    }

    override fun getDecimalInstance(decimalLhs: PType, decimalRhs: PType): Fn {
        val (p, s) = minusPrecisionScale(decimalLhs, decimalRhs)
        return Function.instance(
            name = signature.name,
            returns = PType.decimal(p, s),
            parameters = arrayOf(
                Parameter("lhs", decimalLhs),
                Parameter("rhs", decimalRhs),
            )
        ) { args ->
            val arg0 = args[0].bigDecimal
            val arg1 = args[1].bigDecimal
            Datum.decimal(arg0 - arg1, p, s)
        }
    }

    /**
     * P = max(s1, s2) + max(p1 - s1, p2 - s2) + 1
     * S = max(s1, s2)
     */
    private fun minusPrecisionScale(lhs: PType, rhs: PTyp